mirror of https://github.com/mgba-emu/mgba.git
GB, GBA: Fix global cycle counter discrepancy
This commit is contained in:
parent
0026249806
commit
2ee7642d0b
|
@ -707,13 +707,13 @@ void GBProcessEvents(struct SM83Core* cpu) {
|
|||
int32_t nextEvent;
|
||||
|
||||
cpu->cycles = 0;
|
||||
#ifdef USE_DEBUGGERS
|
||||
gb->timing.globalCycles += cycles;
|
||||
#endif
|
||||
cpu->nextEvent = INT_MAX;
|
||||
|
||||
nextEvent = cycles;
|
||||
do {
|
||||
#ifdef USE_DEBUGGERS
|
||||
gb->timing.globalCycles += nextEvent;
|
||||
#endif
|
||||
nextEvent = mTimingTick(&gb->timing, nextEvent);
|
||||
} while (gb->cpuBlocked && !gb->earlyExit);
|
||||
cpu->nextEvent = nextEvent;
|
||||
|
|
|
@ -288,7 +288,7 @@ static void GBAProcessEvents(struct ARMCore* cpu) {
|
|||
int32_t cycles = cpu->cycles;
|
||||
cpu->cycles = 0;
|
||||
#ifdef USE_DEBUGGERS
|
||||
gba->timing.globalCycles += cycles;
|
||||
gba->timing.globalCycles += cycles < nextEvent ? nextEvent : cycles;
|
||||
#endif
|
||||
#ifndef NDEBUG
|
||||
if (cycles < 0) {
|
||||
|
|
Loading…
Reference in New Issue