diff --git a/README.md b/README.md index cb356982a..0bf582861 100755 --- a/README.md +++ b/README.md @@ -1,7 +1,7 @@ yuzu emulator early access ============= -This is the source code for early-access 3211. +This is the source code for early-access 3212. ## Legal Notice diff --git a/src/yuzu/bootmanager.cpp b/src/yuzu/bootmanager.cpp index 7dca2117c..8b7b9e0b7 100755 --- a/src/yuzu/bootmanager.cpp +++ b/src/yuzu/bootmanager.cpp @@ -80,6 +80,11 @@ void EmuThread::run() { system.GetCpuManager().OnGpuReady(); + system.RegisterExitCallback([this]() { + stop_source.request_stop(); + SetRunning(false); + }); + // Holds whether the cpu was running during the last iteration, // so that the DebugModeLeft signal can be emitted before the // next execution step diff --git a/src/yuzu/bootmanager.h b/src/yuzu/bootmanager.h index fcd34a2e4..e8af41ab4 100755 --- a/src/yuzu/bootmanager.h +++ b/src/yuzu/bootmanager.h @@ -84,9 +84,10 @@ public: } /** - * Requests for the emulation thread to stop running + * Requests for the emulation thread to immediately stop running */ - void RequestStop() { + void ForceStop() { + LOG_WARNING(Frontend, "Force stopping EmuThread"); stop_source.request_stop(); SetRunning(false); } diff --git a/src/yuzu/main.cpp b/src/yuzu/main.cpp index bce822fab..cb6dde858 100755 --- a/src/yuzu/main.cpp +++ b/src/yuzu/main.cpp @@ -1706,9 +1706,6 @@ void GMainWindow::BootGame(const QString& filename, u64 program_id, std::size_t system->RegisterExecuteProgramCallback( [this](std::size_t program_index_) { render_window->ExecuteProgram(program_index_); }); - // Register an Exit callback such that Core can exit the currently running application. - system->RegisterExitCallback([this]() { render_window->Exit(); }); - connect(render_window, &GRenderWindow::Closed, this, &GMainWindow::OnStopGame); connect(render_window, &GRenderWindow::MouseActivity, this, &GMainWindow::OnMouseActivity); // BlockingQueuedConnection is important here, it makes sure we've finished refreshing our views @@ -1795,12 +1792,16 @@ void GMainWindow::ShutdownGame() { system->SetShuttingDown(true); system->DetachDebugger(); discord_rpc->Pause(); - emu_thread->RequestStop(); + + RequestGameExit(); emit EmulationStopping(); // Wait for emulation thread to complete and delete it - emu_thread->wait(); + if (!emu_thread->wait(5000)) { + emu_thread->ForceStop(); + emu_thread->wait(); + } emu_thread = nullptr; emulation_running = false;