From b4a8df053f6cd1924d68e40fc29d328da4bf1b04 Mon Sep 17 00:00:00 2001 From: Vicki Pfau Date: Sun, 7 Jun 2020 18:35:00 -0700 Subject: [PATCH] GBA: Break infinite loop for 0-frame mVLs (fixes #1723) --- CHANGES | 1 + src/gba/core.c | 3 ++- 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/CHANGES b/CHANGES index af727a99d..0080e7c0c 100644 --- a/CHANGES +++ b/CHANGES @@ -38,6 +38,7 @@ Other fixes: - Core: Fix crash modifying hash table entry (fixes mgba.io/i/1673) - GB Video: Fix some cases where SGB border doesn't draw to mutli-buffers - GBA: Reject incorrectly sized BIOSes + - GBA: Break infinite loop for 0-frame mVLs (fixes mgba.io/i/1723) - Debugger: Don't skip undefined instructions when debugger attached - Qt: Force OpenGL paint engine creation thread (fixes mgba.io/i/1642) - Qt: Fix OpenGL 2.1 support (fixes mgba.io/i/1678) diff --git a/src/gba/core.c b/src/gba/core.c index b1110c5e2..224d03f76 100644 --- a/src/gba/core.c +++ b/src/gba/core.c @@ -643,7 +643,8 @@ static void _GBACoreReset(struct mCore* core) { static void _GBACoreRunFrame(struct mCore* core) { struct GBA* gba = core->board; int32_t frameCounter = gba->video.frameCounter; - while (gba->video.frameCounter == frameCounter) { + uint32_t startCycle = mTimingCurrentTime(&gba->timing); + while (gba->video.frameCounter == frameCounter && mTimingCurrentTime(&gba->timing) - startCycle < VIDEO_TOTAL_LENGTH) { ARMRunLoop(core->cpu); } }