Debugger: Fixed pause icon showing up due to APU viewer (among other things)

This commit is contained in:
Sour 2018-03-10 14:31:05 -05:00
parent af0ba9ee2d
commit 16828a0d12
4 changed files with 14 additions and 2 deletions

View file

@ -60,6 +60,7 @@ Debugger::Debugger(shared_ptr<Console> console, shared_ptr<CPU> cpu, shared_ptr<
_stepCycleCount = -1;
_ppuStepCount = -1;
_breakRequested = false;
_pausedForDebugHelper = false;
_breakOnScanline = -2;
_preventResume = 0;
@ -705,10 +706,12 @@ bool Debugger::SleepUntilResume(BreakSource source)
}
_executionStopped = true;
_pausedForDebugHelper = _breakRequested;
while(((stepCount == 0 || _breakRequested) && !_stopFlag && _suspendCount == 0) || _preventResume > 0) {
std::this_thread::sleep_for(std::chrono::duration<int, std::milli>(10));
stepCount = _stepCount.load();
}
_pausedForDebugHelper = false;
_executionStopped = false;
return true;
}
@ -1041,6 +1044,11 @@ bool Debugger::IsExecutionStopped()
return _executionStopped || _console->IsPaused();
}
bool Debugger::IsPauseIconShown()
{
return IsExecutionStopped() && !CheckFlag(DebuggerFlags::HidePauseIcon) && _preventResume == 0 && !_pausedForDebugHelper;
}
void Debugger::PreventResume()
{
_preventResume++;

View file

@ -101,7 +101,10 @@ private:
atomic<uint8_t> _lastInstruction;
atomic<bool> _stepOut;
atomic<int32_t> _stepOverAddr;
atomic<bool> _breakRequested;
bool _pausedForDebugHelper;
atomic<int32_t> _breakOnScanline;
int32_t _ppuViewerScanline;
@ -187,6 +190,7 @@ public:
bool IsExecutionStopped();
bool IsPauseIconShown();
void PreventResume();
void AllowResume();

View file

@ -149,7 +149,7 @@ void SdlRenderer::Render()
bool disableOverlay = EmulationSettings::CheckFlag(EmulationFlags::HidePauseOverlay);
shared_ptr<Debugger> debugger = Console::GetInstance()->GetDebugger(false);
if(debugger && debugger->IsExecutionStopped()) {
paused = !debugger->CheckFlag(DebuggerFlags::HidePauseIcon);
paused = debugger->IsPauseIconShown();
disableOverlay = true;
}

View file

@ -581,7 +581,7 @@ namespace NES
bool disableOverlay = EmulationSettings::CheckFlag(EmulationFlags::HidePauseOverlay);
shared_ptr<Debugger> debugger = Console::GetInstance()->GetDebugger(false);
if(debugger && debugger->IsExecutionStopped()) {
paused = !debugger->CheckFlag(DebuggerFlags::HidePauseIcon);
paused = debugger->IsPauseIconShown();
disableOverlay = true;
}