From fb5bf36c91ec10cd8b8ea1b316372929e6051bcf Mon Sep 17 00:00:00 2001 From: Souryo Date: Sat, 5 Aug 2017 14:24:44 -0400 Subject: [PATCH] Debugger: Fixed deadlock when trying to reset game just as it is about to crash (STP/HLT opcode) --- Core/Console.cpp | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) diff --git a/Core/Console.cpp b/Core/Console.cpp index c27ffce2..fb1f823c 100644 --- a/Core/Console.cpp +++ b/Core/Console.cpp @@ -248,11 +248,13 @@ void Console::Reset(bool softReset) SoundMixer::StopRecording(); Console::Pause(); - if(softReset) { - Instance->ResetComponents(softReset); - } else { - //Full reset of all objects to ensure the emulator always starts in the exact same state - LoadROM(Instance->_romFilepath, Instance->_patchFilename); + if(Instance->_initialized) { + if(softReset) { + Instance->ResetComponents(softReset); + } else { + //Full reset of all objects to ensure the emulator always starts in the exact same state + LoadROM(Instance->_romFilepath, Instance->_patchFilename); + } } Console::Resume(); } @@ -439,8 +441,6 @@ void Console::Run() SaveStateManager::SaveRecentGame(_mapper->GetRomName(), _romFilepath, _patchFilename); } - MessageManager::SendNotification(ConsoleNotificationType::GameStopped); - _rewindManager.reset(); SoundMixer::StopAudio(); MovieManager::Stop(); @@ -472,6 +472,8 @@ void Console::Run() _stopLock.Release(); _runLock.Release(); + + MessageManager::SendNotification(ConsoleNotificationType::GameStopped); } bool Console::IsRunning()