From 666dc14043450f2417035cedfedfb46df6f58bb1 Mon Sep 17 00:00:00 2001 From: Souryo Date: Wed, 14 Dec 2016 20:48:47 -0500 Subject: [PATCH] Debugger: Disabled pause when in debugger - fixes deadlocks --- Core/Console.cpp | 8 +++++++- GUI.NET/Forms/frmMain.cs | 3 +++ 2 files changed, 10 insertions(+), 1 deletion(-) diff --git a/Core/Console.cpp b/Core/Console.cpp index ea652395..bc63457f 100644 --- a/Core/Console.cpp +++ b/Core/Console.cpp @@ -325,11 +325,17 @@ void Console::Run() _runLock.Release(); PlatformUtilities::EnableScreensaver(); - while(paused && !_stop) { + while(paused && !_stop && _debugger == nullptr) { //Sleep until emulation is resumed std::this_thread::sleep_for(std::chrono::duration(100)); paused = EmulationSettings::IsPaused(); } + + if(_debugger != nullptr) { + //Prevent pausing when debugger is active + EmulationSettings::ClearFlags(EmulationFlags::Paused); + } + PlatformUtilities::DisableScreensaver(); _runLock.Acquire(); MessageManager::SendNotification(ConsoleNotificationType::GameResumed); diff --git a/GUI.NET/Forms/frmMain.cs b/GUI.NET/Forms/frmMain.cs index e68f5d44..60258809 100644 --- a/GUI.NET/Forms/frmMain.cs +++ b/GUI.NET/Forms/frmMain.cs @@ -562,6 +562,9 @@ namespace Mesen.GUI.Forms mnuSaveState.Enabled = (_emuThread != null && !isNetPlayClient && !InteropEmu.IsNsf()); mnuLoadState.Enabled = (_emuThread != null && !isNetPlayClient && !InteropEmu.IsNsf() && !InteropEmu.MoviePlaying() && !InteropEmu.MovieRecording()); + //Disable pause when debugger is running + mnuPause.Enabled &= !InteropEmu.DebugIsDebuggerRunning(); + mnuPause.Text = InteropEmu.IsPaused() ? ResourceHelper.GetMessage("Resume") : ResourceHelper.GetMessage("Pause"); mnuPause.Image = InteropEmu.IsPaused() ? Mesen.GUI.Properties.Resources.Play : Mesen.GUI.Properties.Resources.Pause;