all repos — mgba @ 2ee7642d0ba2ec66488e3bf4897d6196ee281723

mGBA Game Boy Advance Emulator

GB, GBA: Fix global cycle counter discrepancy
Vicki Pfau vi@endrift.com
Tue, 29 Dec 2020 01:59:38 -0800
commit

2ee7642d0ba2ec66488e3bf4897d6196ee281723

parent

002624980646cc63720e133f9dafc3c51a6edb36

2 files changed, 4 insertions(+), 4 deletions(-)

jump to
M src/gb/gb.csrc/gb/gb.c

@@ -707,13 +707,13 @@ int32_t cycles = cpu->cycles;

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;
M src/gba/gba.csrc/gba/gba.c

@@ -288,7 +288,7 @@ do {

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) {