From e582e98b62299eb1b90ff438cdd2fd299671ba07 Mon Sep 17 00:00:00 2001 From: Vicki Pfau Date: Wed, 13 May 2020 23:31:44 -0700 Subject: [PATCH] GBA Video: Fix mosaic objects drawing past the end (fixes #1702) --- CHANGES | 1 + src/gba/renderers/software-obj.c | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/CHANGES b/CHANGES index 512bbfdce..857c583ce 100644 --- a/CHANGES +++ b/CHANGES @@ -6,6 +6,7 @@ - GBA SIO: Fix Multiplayer busy bit - GBA SIO: Fix double-unloading active driver - GBA Timers: Fix deserializing count-up timers + - GBA Video: Fix mosaic objects drawing past the end (fixes mgba.io/i/1702) Other fixes: - Core: Fix ELF loading regression (fixes mgba.io/i/1669) - Core: Fix crash modifying hash table entry (fixes mgba.io/i/1673) diff --git a/src/gba/renderers/software-obj.c b/src/gba/renderers/software-obj.c index d49142ecf..3ca084dbe 100644 --- a/src/gba/renderers/software-obj.c +++ b/src/gba/renderers/software-obj.c @@ -224,7 +224,7 @@ int GBAVideoSoftwareRendererPreprocessSprite(struct GBAVideoSoftwareRenderer* re int mosaicH = 1; if (GBAObjAttributesAIsMosaic(sprite->a)) { mosaicH = GBAMosaicControlGetObjH(renderer->mosaic) + 1; - if (condition % mosaicH) { + if (condition != end && condition % mosaicH) { condition += mosaicH - (condition % mosaicH); } }