From 2fa810d1ad2b432b1fcee49634ca4b46788871e6 Mon Sep 17 00:00:00 2001 From: Matthew Budd Date: Sun, 8 Nov 2020 19:52:15 -0500 Subject: [PATCH] Added logic to Qt GUI to allow for frame advance usage when at a debugger breakpoint. --- src/drivers/Qt/ConsoleDebugger.cpp | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-) diff --git a/src/drivers/Qt/ConsoleDebugger.cpp b/src/drivers/Qt/ConsoleDebugger.cpp index a01200f2..53470188 100644 --- a/src/drivers/Qt/ConsoleDebugger.cpp +++ b/src/drivers/Qt/ConsoleDebugger.cpp @@ -2371,7 +2371,22 @@ void FCEUD_DebugBreakpoint( int bpNum ) while ( nes_shm->runEmulator && FCEUI_EmulationPaused() && !FCEUI_EmulationFrameStepped()) { - usleep(100000); + // HACK: break when Frame Advance is pressed + extern bool frameAdvanceRequested; + extern int frameAdvance_Delay_count, frameAdvance_Delay; + + if (frameAdvanceRequested) + { + if ( (frameAdvance_Delay_count == 0) || (frameAdvance_Delay_count >= frameAdvance_Delay) ) + { + FCEUI_SetEmulationPaused(EMULATIONPAUSED_FA); + } + if (frameAdvance_Delay_count < frameAdvance_Delay) + { + frameAdvance_Delay_count++; + } + } + usleep(16667); } // since we unfreezed emulation, reset delta_cycles counter ResetDebugStatisticsDeltaCounters();