From d7ecdb5e4eda3e195d6d319f94280486d01d0bc3 Mon Sep 17 00:00:00 2001 From: Vicki Pfau Date: Sat, 30 May 2020 17:00:07 -0700 Subject: [PATCH] GBA: Fix timing advancing too quickly in rare cases --- CHANGES | 1 + src/gba/gba.c | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/CHANGES b/CHANGES index 55bb9ba99..cedefd7bc 100644 --- a/CHANGES +++ b/CHANGES @@ -11,6 +11,7 @@ Emulation fixes: - GB Video: Fix state after skipping BIOS (fixes mgba.io/i/1715 and mgba.io/i/1716) - GB Video: Fix BGPS value after skipping BIOS (fixes mgba.io/i/1717) - GBA: Add missing RTC overrides for Legendz games + - GBA: Fix timing advancing too quickly in rare cases - GBA BIOS: Implement dummy sound driver calls - GBA BIOS: Improve HLE BIOS timing - GBA BIOS: Reset renderer when RegisterRamReset called (fixes mgba.io/i/1756) diff --git a/src/gba/gba.c b/src/gba/gba.c index 1ae1ae832..7a4bcea0d 100644 --- a/src/gba/gba.c +++ b/src/gba/gba.c @@ -282,7 +282,7 @@ static void GBAProcessEvents(struct ARMCore* cpu) { mLOG(GBA, FATAL, "Negative cycles passed: %i", cycles); } #endif - nextEvent = mTimingTick(&gba->timing, nextEvent + cycles); + nextEvent = mTimingTick(&gba->timing, cycles < nextEvent ? nextEvent : cycles); } while (gba->cpuBlocked); cpu->nextEvent = nextEvent;