diff options
author | bunnei <bunneidev@gmail.com> | 2015-04-28 05:13:57 +0200 |
---|---|---|
committer | bunnei <bunneidev@gmail.com> | 2015-05-02 00:27:06 +0200 |
commit | 3dd268878570c2c48e2be4018ff4d0ea851ece60 (patch) | |
tree | b00f5eb003d5f3f34d5a34190a3e645fe854e0d4 /src/citra_qt/main.cpp | |
parent | CoreTiming: Initialize static variables at bootup. (diff) | |
download | yuzu-3dd268878570c2c48e2be4018ff4d0ea851ece60.tar yuzu-3dd268878570c2c48e2be4018ff4d0ea851ece60.tar.gz yuzu-3dd268878570c2c48e2be4018ff4d0ea851ece60.tar.bz2 yuzu-3dd268878570c2c48e2be4018ff4d0ea851ece60.tar.lz yuzu-3dd268878570c2c48e2be4018ff4d0ea851ece60.tar.xz yuzu-3dd268878570c2c48e2be4018ff4d0ea851ece60.tar.zst yuzu-3dd268878570c2c48e2be4018ff4d0ea851ece60.zip |
Diffstat (limited to 'src/citra_qt/main.cpp')
-rw-r--r-- | src/citra_qt/main.cpp | 39 |
1 files changed, 24 insertions, 15 deletions
diff --git a/src/citra_qt/main.cpp b/src/citra_qt/main.cpp index fe1dac622..5441c17f1 100644 --- a/src/citra_qt/main.cpp +++ b/src/citra_qt/main.cpp @@ -199,6 +199,10 @@ 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... @@ -217,6 +221,25 @@ void GMainWindow::BootGame(std::string filename) { OnStartGame(); } +void GMainWindow::ShutdownGame() { + emu_thread->SetCpuRunning(false); + + emu_thread->ShutdownCpu(); + emu_thread->WaitForCpuShutdown(); + emu_thread->Stop(); + + delete emu_thread; + emu_thread = nullptr; + + System::Shutdown(); + + 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)")); @@ -249,21 +272,7 @@ void GMainWindow::OnPauseGame() } void GMainWindow::OnStopGame() { - emu_thread->SetCpuRunning(false); - - emu_thread->ShutdownCpu(); - emu_thread->WaitForCpuShutdown(); - emu_thread->Stop(); - - delete emu_thread; - - System::Shutdown(); - - ui.action_Start->setEnabled(true); - ui.action_Pause->setEnabled(false); - ui.action_Stop->setEnabled(false); - - render_window->hide(); + ShutdownGame(); } void GMainWindow::OnOpenHotkeysDialog() |