diff --git a/cpuexec.cpp b/cpuexec.cpp index c2c562da..35ea9757 100644 --- a/cpuexec.cpp +++ b/cpuexec.cpp @@ -204,6 +204,7 @@ static inline void S9xReschedule (void); +static int endframe = 0; void S9xMainLoop (void) { @@ -314,13 +315,15 @@ void S9xMainLoop (void) S9xPackStatus(); - if (CPU.Flags & SCAN_KEYS_FLAG) + CPU.Flags &= ~SCAN_KEYS_FLAG; + + if (endframe) { #ifdef DEBUGGER if (!(CPU.Flags & FRAME_ADVANCE_FLAG)) #endif S9xSyncSpeed(); - CPU.Flags &= ~SCAN_KEYS_FLAG; + endframe = 0; } } @@ -443,7 +446,9 @@ void S9xDoHEventProcessing (void) Timings.NMITriggerPos = 0xffff; ICPU.Frame++; + endframe = 1; PPU.HVBeamCounterLatched = 0; + CPU.Flags |= SCAN_KEYS_FLAG; } // From byuu: