all repos — mgba @ a3a9fb467c03a80741261c2b1edf18b5a2160c96

mGBA Game Boy Advance Emulator

GBA Video: Fix caching with background toggling (fixes #1118)
Vicki Pfau vi@endrift.com
Fri, 28 Sep 2018 11:38:33 -0700
commit

a3a9fb467c03a80741261c2b1edf18b5a2160c96

parent

5fa1638b1df3e16984bc356653fe405de6e944c7

2 files changed, 9 insertions(+), 2 deletions(-)

jump to
M CHANGESCHANGES

@@ -106,6 +106,7 @@ Bugfixes:

- PSP2: Fix audio crackling after fast forward - PSP2: Fix audio crackling when buffer is full - 3DS: Fix unused screens not clearing (fixes mgba.io/i/1184) + - GBA Video: Fix caching with background toggling (fixes mgba.io/i/1118) Misc: - mGUI: Add SGB border configuration option
M src/gba/renderers/video-software.csrc/gba/renderers/video-software.c

@@ -554,6 +554,8 @@ }

return; } + CLEAN_SCANLINE(softwareRenderer, y); + color_t* row = &softwareRenderer->outputBuffer[softwareRenderer->outputBufferStride * y]; if (GBARegisterDISPCNTIsForcedBlank(softwareRenderer->dispcnt)) { int x;

@@ -675,7 +677,6 @@ }

#else memcpy(row, softwareRenderer->row, VIDEO_HORIZONTAL_PIXELS * sizeof(*row)); #endif - CLEAN_SCANLINE(softwareRenderer, y); } static void GBAVideoSoftwareRendererFinishFrame(struct GBAVideoRenderer* renderer) {

@@ -722,9 +723,10 @@ }

} static void _enableBg(struct GBAVideoSoftwareRenderer* renderer, int bg, bool active) { + int wasActive = renderer->bg[bg].enabled; if (!active) { renderer->bg[bg].enabled = 0; - } else if (!renderer->bg[bg].enabled && active) { + } else if (!wasActive && active) { if (renderer->nextY == 0) { renderer->bg[bg].enabled = 4; } else {

@@ -901,15 +903,19 @@ }

if (renderer->bg[0].enabled > 0 && renderer->bg[0].enabled < 4) { ++renderer->bg[0].enabled; + DIRTY_SCANLINE(renderer, y); } if (renderer->bg[1].enabled > 0 && renderer->bg[1].enabled < 4) { ++renderer->bg[1].enabled; + DIRTY_SCANLINE(renderer, y); } if (renderer->bg[2].enabled > 0 && renderer->bg[2].enabled < 4) { ++renderer->bg[2].enabled; + DIRTY_SCANLINE(renderer, y); } if (renderer->bg[3].enabled > 0 && renderer->bg[3].enabled < 4) { ++renderer->bg[3].enabled; + DIRTY_SCANLINE(renderer, y); } }