summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/yuzu/bootmanager.cpp5
-rw-r--r--src/yuzu/bootmanager.h5
-rw-r--r--src/yuzu/main.cpp11
3 files changed, 14 insertions, 7 deletions
diff --git a/src/yuzu/bootmanager.cpp b/src/yuzu/bootmanager.cpp
index 1a47fb9c9..642f96690 100644
--- a/src/yuzu/bootmanager.cpp
+++ b/src/yuzu/bootmanager.cpp
@@ -79,6 +79,11 @@ void EmuThread::run() {
79 79
80 system.GetCpuManager().OnGpuReady(); 80 system.GetCpuManager().OnGpuReady();
81 81
82 system.RegisterExitCallback([this]() {
83 stop_source.request_stop();
84 SetRunning(false);
85 });
86
82 // Holds whether the cpu was running during the last iteration, 87 // Holds whether the cpu was running during the last iteration,
83 // so that the DebugModeLeft signal can be emitted before the 88 // so that the DebugModeLeft signal can be emitted before the
84 // next execution step 89 // next execution step
diff --git a/src/yuzu/bootmanager.h b/src/yuzu/bootmanager.h
index f4deae4ee..f0edad6e4 100644
--- a/src/yuzu/bootmanager.h
+++ b/src/yuzu/bootmanager.h
@@ -84,9 +84,10 @@ public:
84 } 84 }
85 85
86 /** 86 /**
87 * Requests for the emulation thread to stop running 87 * Requests for the emulation thread to immediately stop running
88 */ 88 */
89 void RequestStop() { 89 void ForceStop() {
90 LOG_WARNING(Frontend, "Force stopping EmuThread");
90 stop_source.request_stop(); 91 stop_source.request_stop();
91 SetRunning(false); 92 SetRunning(false);
92 } 93 }
diff --git a/src/yuzu/main.cpp b/src/yuzu/main.cpp
index df7166d4b..70552bdb8 100644
--- a/src/yuzu/main.cpp
+++ b/src/yuzu/main.cpp
@@ -1710,9 +1710,6 @@ void GMainWindow::BootGame(const QString& filename, u64 program_id, std::size_t
1710 system->RegisterExecuteProgramCallback( 1710 system->RegisterExecuteProgramCallback(
1711 [this](std::size_t program_index_) { render_window->ExecuteProgram(program_index_); }); 1711 [this](std::size_t program_index_) { render_window->ExecuteProgram(program_index_); });
1712 1712
1713 // Register an Exit callback such that Core can exit the currently running application.
1714 system->RegisterExitCallback([this]() { render_window->Exit(); });
1715
1716 connect(render_window, &GRenderWindow::Closed, this, &GMainWindow::OnStopGame); 1713 connect(render_window, &GRenderWindow::Closed, this, &GMainWindow::OnStopGame);
1717 connect(render_window, &GRenderWindow::MouseActivity, this, &GMainWindow::OnMouseActivity); 1714 connect(render_window, &GRenderWindow::MouseActivity, this, &GMainWindow::OnMouseActivity);
1718 // BlockingQueuedConnection is important here, it makes sure we've finished refreshing our views 1715 // BlockingQueuedConnection is important here, it makes sure we've finished refreshing our views
@@ -1799,12 +1796,16 @@ void GMainWindow::ShutdownGame() {
1799 system->SetShuttingDown(true); 1796 system->SetShuttingDown(true);
1800 system->DetachDebugger(); 1797 system->DetachDebugger();
1801 discord_rpc->Pause(); 1798 discord_rpc->Pause();
1802 emu_thread->RequestStop(); 1799
1800 RequestGameExit();
1803 1801
1804 emit EmulationStopping(); 1802 emit EmulationStopping();
1805 1803
1806 // Wait for emulation thread to complete and delete it 1804 // Wait for emulation thread to complete and delete it
1807 emu_thread->wait(); 1805 if (!emu_thread->wait(5000)) {
1806 emu_thread->ForceStop();
1807 emu_thread->wait();
1808 }
1808 emu_thread = nullptr; 1809 emu_thread = nullptr;
1809 1810
1810 emulation_running = false; 1811 emulation_running = false;