diff --git a/src/gb/gb.c b/src/gb/gb.c index 4424d3b0d..c4a332741 100644 --- a/src/gb/gb.c +++ b/src/gb/gb.c @@ -528,11 +528,11 @@ void GBUpdateIRQs(struct GB* gb) { void GBProcessEvents(struct LR35902Core* cpu) { struct GB* gb = (struct GB*) cpu->master; do { - int32_t cycles = cpu->nextEvent; + int32_t cycles = cpu->cycles; int32_t nextEvent; int32_t testEvent; - cpu->cycles -= cycles; + cpu->cycles = 0; cpu->nextEvent = INT_MAX; if (gb->eiPending != INT_MAX) { diff --git a/src/gba/gba.c b/src/gba/gba.c index 556bf6655..4c875ace6 100644 --- a/src/gba/gba.c +++ b/src/gba/gba.c @@ -235,11 +235,11 @@ static void GBAProcessEvents(struct ARMCore* cpu) { } do { - int32_t cycles = cpu->nextEvent; + int32_t cycles = cpu->cycles; int32_t nextEvent; int32_t testEvent; - cpu->cycles -= cycles; + cpu->cycles = 0; cpu->nextEvent = INT_MAX; #ifndef NDEBUG