aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/citra_qt/main.cpp
diff options
context:
space:
mode:
authorGravatar bunnei <bunneidev@gmail.com>2015-04-28 19:03:01 -0400
committerGravatar bunnei <bunneidev@gmail.com>2015-05-01 18:27:07 -0400
commite4ea133717a5292339c134160da984ba186d3de8 (patch)
treef6c3e289eaee3c79375d136279509523d4b3aca8 /src/citra_qt/main.cpp
parent3dd268878570c2c48e2be4018ff4d0ea851ece60 (diff)
Qt: Restructured to remove unnecessary shutdown event and various cleanups.
Diffstat (limited to 'src/citra_qt/main.cpp')
-rw-r--r--src/citra_qt/main.cpp33
1 files changed, 18 insertions, 15 deletions
diff --git a/src/citra_qt/main.cpp b/src/citra_qt/main.cpp
index 5441c17f..dd180baa 100644
--- a/src/citra_qt/main.cpp
+++ b/src/citra_qt/main.cpp
@@ -199,10 +199,6 @@ void GMainWindow::OnDisplayTitleBars(bool show)
void GMainWindow::BootGame(std::string filename) {
LOG_INFO(Frontend, "Citra starting...\n");
- // Shutdown previous session if the emu thread is still active...
- if (emu_thread != nullptr)
- ShutdownGame();
-
System::Init(render_window);
// Load a game or die...
@@ -222,29 +218,36 @@ void GMainWindow::BootGame(std::string filename) {
}
void GMainWindow::ShutdownGame() {
- emu_thread->SetCpuRunning(false);
-
- emu_thread->ShutdownCpu();
- emu_thread->WaitForCpuShutdown();
- emu_thread->Stop();
-
+ // Shutdown the emulation thread and wait for it to complete
+ emu_thread->SetRunning(false);
+ emu_thread->Shutdown();
+ emu_thread->wait();
delete emu_thread;
emu_thread = nullptr;
+ // Release emu threads from any breakpoints
+ Pica::g_debug_context->ClearBreakpoints();
+
+ // Shutdown the core emulation
System::Shutdown();
+ // Update the GUI
ui.action_Start->setEnabled(true);
ui.action_Pause->setEnabled(false);
ui.action_Stop->setEnabled(false);
-
render_window->hide();
}
void GMainWindow::OnMenuLoadFile()
{
QString filename = QFileDialog::getOpenFileName(this, tr("Load File"), QString(), tr("3DS executable (*.3ds *.3dsx *.elf *.axf *.bin *.cci *.cxi)"));
- if (filename.size())
- BootGame(filename.toLatin1().data());
+ if (filename.size()) {
+ // Shutdown previous session if the emu thread is still active...
+ if (emu_thread != nullptr)
+ ShutdownGame();
+
+ BootGame(filename.toLatin1().data());
+ }
}
void GMainWindow::OnMenuLoadSymbolMap() {
@@ -255,7 +258,7 @@ void GMainWindow::OnMenuLoadSymbolMap() {
void GMainWindow::OnStartGame()
{
- emu_thread->SetCpuRunning(true);
+ emu_thread->SetRunning(true);
ui.action_Start->setEnabled(false);
ui.action_Pause->setEnabled(true);
@@ -264,7 +267,7 @@ void GMainWindow::OnStartGame()
void GMainWindow::OnPauseGame()
{
- emu_thread->SetCpuRunning(false);
+ emu_thread->SetRunning(false);
ui.action_Start->setEnabled(true);
ui.action_Pause->setEnabled(false);