diff --git a/CHANGES b/CHANGES index 42b1f040d..55ebc94af 100644 --- a/CHANGES +++ b/CHANGES @@ -5,6 +5,7 @@ Emulation fixes: - GBA Memory: Add cursory cartridge open bus emulation (fixes mgba.io/i/2032) - 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 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/gl.c b/src/gba/renderers/gl.c index dff331fc4..5c15ec9cc 100644 --- a/src/gba/renderers/gl.c +++ b/src/gba/renderers/gl.c @@ -1433,10 +1433,14 @@ void GBAVideoGLRendererDrawScanline(struct GBAVideoRenderer* renderer, int y) { } if (GBARegisterDISPCNTGetMode(glRenderer->dispcnt) != 0) { - glRenderer->bg[2].affine.sx += glRenderer->bg[2].affine.dmx; - glRenderer->bg[2].affine.sy += glRenderer->bg[2].affine.dmy; - glRenderer->bg[3].affine.sx += glRenderer->bg[3].affine.dmx; - glRenderer->bg[3].affine.sy += glRenderer->bg[3].affine.dmy; + if (glRenderer->bg[2].enabled == 4) { + glRenderer->bg[2].affine.sx += glRenderer->bg[2].affine.dmx; + glRenderer->bg[2].affine.sy += glRenderer->bg[2].affine.dmy; + } + if (glRenderer->bg[3].enabled == 4) { + glRenderer->bg[3].affine.sx += glRenderer->bg[3].affine.dmx; + glRenderer->bg[3].affine.sy += glRenderer->bg[3].affine.dmy; + } } } diff --git a/src/gba/renderers/video-software.c b/src/gba/renderers/video-software.c index fb970322a..f416ce830 100644 --- a/src/gba/renderers/video-software.c +++ b/src/gba/renderers/video-software.c @@ -543,10 +543,14 @@ static void GBAVideoSoftwareRendererDrawScanline(struct GBAVideoRenderer* render if (!dirty) { if (GBARegisterDISPCNTGetMode(softwareRenderer->dispcnt) != 0) { - softwareRenderer->bg[2].sx += softwareRenderer->bg[2].dmx; - softwareRenderer->bg[2].sy += softwareRenderer->bg[2].dmy; - softwareRenderer->bg[3].sx += softwareRenderer->bg[3].dmx; - softwareRenderer->bg[3].sy += softwareRenderer->bg[3].dmy; + if (softwareRenderer->bg[2].enabled == 4) { + softwareRenderer->bg[2].sx += softwareRenderer->bg[2].dmx; + softwareRenderer->bg[2].sy += softwareRenderer->bg[2].dmy; + } + if (softwareRenderer->bg[3].enabled == 4) { + softwareRenderer->bg[3].sx += softwareRenderer->bg[3].dmx; + softwareRenderer->bg[3].sy += softwareRenderer->bg[3].dmy; + } } return; } @@ -931,10 +935,14 @@ static void _drawScanline(struct GBAVideoSoftwareRenderer* renderer, int y) { } } if (GBARegisterDISPCNTGetMode(renderer->dispcnt) != 0) { - renderer->bg[2].sx += renderer->bg[2].dmx; - renderer->bg[2].sy += renderer->bg[2].dmy; - renderer->bg[3].sx += renderer->bg[3].dmx; - renderer->bg[3].sy += renderer->bg[3].dmy; + if (softwareRenderer->bg[2].enabled == 4) { + softwareRenderer->bg[2].sx += softwareRenderer->bg[2].dmx; + softwareRenderer->bg[2].sy += softwareRenderer->bg[2].dmy; + } + if (softwareRenderer->bg[3].enabled == 4) { + softwareRenderer->bg[3].sx += softwareRenderer->bg[3].dmx; + softwareRenderer->bg[3].sy += softwareRenderer->bg[3].dmy; + } } if (renderer->bg[0].enabled > 0 && renderer->bg[0].enabled < 4) {