From 55a3824671c79025a40ee39c22b5382b38eaa8ae Mon Sep 17 00:00:00 2001 From: Vicki Pfau Date: Wed, 22 Sep 2021 15:52:48 -0700 Subject: [PATCH] GBA Video: Delay enabling backgrounds in bitmap modes (fixes #1668) --- CHANGES | 1 + src/gba/renderers/video-software.c | 4 +++- 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/CHANGES b/CHANGES index 55ebc94af..8e9555164 100644 --- a/CHANGES +++ b/CHANGES @@ -6,6 +6,7 @@ Emulation fixes: - GBA SIO: Fix SI value for unattached MULTI mode - GBA Video: Fix backdrop color if DISPCNT is first set to 0 (fixes mgba.io/i/2260) - GBA Video: Don't iterate affine backgrounds when disabled + - GBA Video: Delay enabling backgrounds in bitmap modes (fixes mgba.io/i/1668) Other fixes: - FFmpeg: Don't attempt to use YUV 4:2:0 for lossless videos (fixes mgba.io/i/2084) - GB Video: Fix memory leak when reseting SGB games diff --git a/src/gba/renderers/video-software.c b/src/gba/renderers/video-software.c index f416ce830..6e3299c3c 100644 --- a/src/gba/renderers/video-software.c +++ b/src/gba/renderers/video-software.c @@ -757,9 +757,11 @@ static void _enableBg(struct GBAVideoSoftwareRenderer* renderer, int bg, bool ac if (!active) { renderer->bg[bg].enabled = 0; } else if (!wasActive && active) { - if (renderer->nextY == 0 || GBARegisterDISPCNTGetMode(renderer->dispcnt) > 2) { + if (renderer->nextY == 0) { // TODO: Investigate in more depth how switching background works in different modes renderer->bg[bg].enabled = 4; + } else if (GBARegisterDISPCNTGetMode(renderer->dispcnt) > 2) { + renderer->bg[bg].enabled = 2; } else { renderer->bg[bg].enabled = 1; }