diff --git a/Core/Debugger/Debugger.cpp b/Core/Debugger/Debugger.cpp index 5b50660c..ed68b398 100644 --- a/Core/Debugger/Debugger.cpp +++ b/Core/Debugger/Debugger.cpp @@ -99,9 +99,6 @@ Debugger::Debugger(Emulator* emu, IConsole* console) RefreshCodeCache(); - if(_emu->IsPaused()) { - Step(_mainCpuType, 1, StepType::Step); - } _executionStopped = false; } @@ -397,6 +394,11 @@ void Debugger::Step(CpuType cpuType, int32_t stepCount, StepType type) _waitForBreakResume = false; } +bool Debugger::IsPaused() +{ + return _waitForBreakResume; +} + bool Debugger::IsExecutionStopped() { return _executionStopped || _emu->IsThreadPaused(); diff --git a/Core/Debugger/Debugger.h b/Core/Debugger/Debugger.h index 03c36aeb..d0cb2aa2 100644 --- a/Core/Debugger/Debugger.h +++ b/Core/Debugger/Debugger.h @@ -106,6 +106,7 @@ public: void Run(); void Step(CpuType cpuType, int32_t stepCount, StepType type); + bool IsPaused(); bool IsExecutionStopped(); bool HasBreakRequest(); diff --git a/Core/Shared/Emulator.cpp b/Core/Shared/Emulator.cpp index a91ad3a2..f2c8c099 100644 --- a/Core/Shared/Emulator.cpp +++ b/Core/Shared/Emulator.cpp @@ -661,7 +661,7 @@ bool Emulator::IsPaused() { shared_ptr debugger = _debugger.lock(); if(debugger) { - return debugger->IsExecutionStopped(); + return debugger->IsPaused(); } else { return _paused; } diff --git a/NewUI/Debugger/ViewModels/DebuggerWindowViewModel.cs b/NewUI/Debugger/ViewModels/DebuggerWindowViewModel.cs index a4ea566c..90dd9cdd 100644 --- a/NewUI/Debugger/ViewModels/DebuggerWindowViewModel.cs +++ b/NewUI/Debugger/ViewModels/DebuggerWindowViewModel.cs @@ -536,7 +536,7 @@ namespace Mesen.Debugger.ViewModels }; } - private void Step(StepType type, int instructionCount = 1) + public void Step(StepType type, int instructionCount = 1) { switch(type) { case StepType.PpuStep: diff --git a/NewUI/Debugger/Windows/DebuggerWindow.axaml.cs b/NewUI/Debugger/Windows/DebuggerWindow.axaml.cs index 0cc3c3e6..0144b5ef 100644 --- a/NewUI/Debugger/Windows/DebuggerWindow.axaml.cs +++ b/NewUI/Debugger/Windows/DebuggerWindow.axaml.cs @@ -76,7 +76,7 @@ namespace Mesen.Debugger.Windows ScrollToAddress((uint)_scrollToAddress); } else if(_model.Config.BreakOnOpen) { if(!EmuApi.IsPaused()) { - EmuApi.Pause(); + _model.Step(StepType.Step); } } }