summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/yuzu/bootmanager.cpp5
-rw-r--r--src/yuzu/bootmanager.h10
-rw-r--r--src/yuzu/main.cpp5
3 files changed, 17 insertions, 3 deletions
diff --git a/src/yuzu/bootmanager.cpp b/src/yuzu/bootmanager.cpp
index 5b5b6fed8..f7321258c 100644
--- a/src/yuzu/bootmanager.cpp
+++ b/src/yuzu/bootmanager.cpp
@@ -80,6 +80,11 @@ void EmuThread::run() {
80 80
81 system.GetCpuManager().OnGpuReady(); 81 system.GetCpuManager().OnGpuReady();
82 82
83 system.RegisterExitCallback([this]() {
84 stop_source.request_stop();
85 SetRunning(false);
86 });
87
83 // Holds whether the cpu was running during the last iteration, 88 // Holds whether the cpu was running during the last iteration,
84 // so that the DebugModeLeft signal can be emitted before the 89 // so that the DebugModeLeft signal can be emitted before the
85 // next execution step 90 // next execution step
diff --git a/src/yuzu/bootmanager.h b/src/yuzu/bootmanager.h
index f4deae4ee..c2b127f19 100644
--- a/src/yuzu/bootmanager.h
+++ b/src/yuzu/bootmanager.h
@@ -11,6 +11,7 @@
11#include <QImage> 11#include <QImage>
12#include <QStringList> 12#include <QStringList>
13#include <QThread> 13#include <QThread>
14#include <QTimer>
14#include <QTouchEvent> 15#include <QTouchEvent>
15#include <QWidget> 16#include <QWidget>
16 17
@@ -87,6 +88,15 @@ public:
87 * Requests for the emulation thread to stop running 88 * Requests for the emulation thread to stop running
88 */ 89 */
89 void RequestStop() { 90 void RequestStop() {
91 QTimer::singleShot(5000, this, &EmuThread::ForceStop);
92 }
93
94private slots:
95 void ForceStop() {
96 if (!IsRunning()) {
97 return;
98 }
99 LOG_WARNING(Frontend, "Force stopping EmuThread");
90 stop_source.request_stop(); 100 stop_source.request_stop();
91 SetRunning(false); 101 SetRunning(false);
92 } 102 }
diff --git a/src/yuzu/main.cpp b/src/yuzu/main.cpp
index b11b26f7b..b38957d9a 100644
--- a/src/yuzu/main.cpp
+++ b/src/yuzu/main.cpp
@@ -1707,9 +1707,6 @@ void GMainWindow::BootGame(const QString& filename, u64 program_id, std::size_t
1707 system->RegisterExecuteProgramCallback( 1707 system->RegisterExecuteProgramCallback(
1708 [this](std::size_t program_index_) { render_window->ExecuteProgram(program_index_); }); 1708 [this](std::size_t program_index_) { render_window->ExecuteProgram(program_index_); });
1709 1709
1710 // Register an Exit callback such that Core can exit the currently running application.
1711 system->RegisterExitCallback([this]() { render_window->Exit(); });
1712
1713 connect(render_window, &GRenderWindow::Closed, this, &GMainWindow::OnStopGame); 1710 connect(render_window, &GRenderWindow::Closed, this, &GMainWindow::OnStopGame);
1714 connect(render_window, &GRenderWindow::MouseActivity, this, &GMainWindow::OnMouseActivity); 1711 connect(render_window, &GRenderWindow::MouseActivity, this, &GMainWindow::OnMouseActivity);
1715 // BlockingQueuedConnection is important here, it makes sure we've finished refreshing our views 1712 // BlockingQueuedConnection is important here, it makes sure we've finished refreshing our views
@@ -1793,6 +1790,8 @@ void GMainWindow::ShutdownGame() {
1793 system->SetShuttingDown(true); 1790 system->SetShuttingDown(true);
1794 system->DetachDebugger(); 1791 system->DetachDebugger();
1795 discord_rpc->Pause(); 1792 discord_rpc->Pause();
1793
1794 RequestGameExit();
1796 emu_thread->RequestStop(); 1795 emu_thread->RequestStop();
1797 1796
1798 emit EmulationStopping(); 1797 emit EmulationStopping();