From baecc500e8a780d29ecec3c668d64b752a5efe23 Mon Sep 17 00:00:00 2001 From: Techjar Date: Fri, 30 Nov 2018 01:20:22 -0500 Subject: [PATCH 1/2] Core: Notify state change callback about stopping state --- Source/Core/Core/Core.cpp | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/Source/Core/Core/Core.cpp b/Source/Core/Core/Core.cpp index b5a4b13ce0..39c2c18fb3 100644 --- a/Source/Core/Core/Core.cpp +++ b/Source/Core/Core/Core.cpp @@ -242,6 +242,10 @@ void Stop() // - Hammertime! s_is_stopping = true; + // Notify state changed callback + if (s_on_state_changed_callback) + s_on_state_changed_callback(State::Stopping); + // Dump left over jobs HostDispatchJobs(); From 9c51439144e033a314ca6a042cf452b90028a364 Mon Sep 17 00:00:00 2001 From: Techjar Date: Fri, 30 Nov 2018 01:20:51 -0500 Subject: [PATCH 2/2] Qt/NetPlayDialog: Request game stop when core enters stopping state This makes it possible to gracefully force stop emulation rather than having to kill Dolphin completely when NetPlay deadlocks in the input loop. Without a graceful stop, Wii saves do not get flushed to the main NAND, and are left in limbo in the temporary NAND. --- Source/Core/DolphinQt/NetPlay/NetPlayDialog.cpp | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/Source/Core/DolphinQt/NetPlay/NetPlayDialog.cpp b/Source/Core/DolphinQt/NetPlay/NetPlayDialog.cpp index fb79123d88..04efe5bea9 100644 --- a/Source/Core/DolphinQt/NetPlay/NetPlayDialog.cpp +++ b/Source/Core/DolphinQt/NetPlay/NetPlayDialog.cpp @@ -338,6 +338,11 @@ void NetPlayDialog::ConnectWidgets() if (isVisible()) { GameStatusChanged(state != Core::State::Uninitialized); + if ((state == Core::State::Uninitialized || state == Core::State::Stopping) && + !m_got_stop_request) + { + Settings::Instance().GetNetPlayClient()->RequestStopGame(); + } if (state == Core::State::Uninitialized) DisplayMessage(tr("Stopped game"), "red"); } @@ -808,9 +813,6 @@ void NetPlayDialog::OnMsgChangeGame(const std::string& title) void NetPlayDialog::GameStatusChanged(bool running) { - if (!running && !m_got_stop_request) - Settings::Instance().GetNetPlayClient()->RequestStopGame(); - QueueOnObject(this, [this, running] { SetOptionsEnabled(!running); }); }