GBA Video: Don't iterate affine backgrounds when disabled

This commit is contained in:
Vicki Pfau 2021-09-22 15:52:29 -07:00
parent 86fe869087
commit 2d4294e417
3 changed files with 25 additions and 12 deletions

View File

@ -19,6 +19,7 @@ Emulation fixes:
- GBA Memory: Fix misaligned 32-bit I/O loads (fixes mgba.io/i/2307)
- 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:
- Core: Don't attempt to restore rewind diffs past start of rewind
- FFmpeg: Don't attempt to use YUV 4:2:0 for lossless videos (fixes mgba.io/i/2084)

View File

@ -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;
}
}
}

View File

@ -545,10 +545,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;
}
@ -621,10 +625,14 @@ static void GBAVideoSoftwareRendererDrawScanline(struct GBAVideoRenderer* render
GBAVideoSoftwareRendererPostprocessBuffer(softwareRenderer);
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;
}
}
if (softwareRenderer->bg[0].enabled > 0 && softwareRenderer->bg[0].enabled < 4) {