diff --git a/CHANGES b/CHANGES index 66cf8ca10..5a607d669 100644 --- a/CHANGES +++ b/CHANGES @@ -1,4 +1,6 @@ 0.9.2: (Future) +Emulation fixes: + - GBA Video: Revert scanline latching changes (fixes mgba.io/i/2153, mgba.io/i/2149) Other fixes: - Core: Fix memory leak in opening games from the library - Qt: Fix infrequent deadlock when using sync to video diff --git a/cinema/gba/bg/lady-sia/baseline_0000.png b/cinema/gba/bg/lady-sia/baseline_0000.png index 282d9cf3b..56454bbfa 100644 Binary files a/cinema/gba/bg/lady-sia/baseline_0000.png and b/cinema/gba/bg/lady-sia/baseline_0000.png differ diff --git a/cinema/gba/bg/lady-sia/baseline_0001.png b/cinema/gba/bg/lady-sia/baseline_0001.png index 282d9cf3b..d1eb4323c 100644 Binary files a/cinema/gba/bg/lady-sia/baseline_0001.png and b/cinema/gba/bg/lady-sia/baseline_0001.png differ diff --git a/cinema/gba/bg/lady-sia/baseline_0002.png b/cinema/gba/bg/lady-sia/baseline_0002.png index 14ffb7d46..80f6dd2cb 100644 Binary files a/cinema/gba/bg/lady-sia/baseline_0002.png and b/cinema/gba/bg/lady-sia/baseline_0002.png differ diff --git a/cinema/gba/bg/lady-sia/baseline_0003.png b/cinema/gba/bg/lady-sia/baseline_0003.png index 2e4d8ed37..30d9b4446 100644 Binary files a/cinema/gba/bg/lady-sia/baseline_0003.png and b/cinema/gba/bg/lady-sia/baseline_0003.png differ diff --git a/cinema/gba/bg/lady-sia/baseline_0004.png b/cinema/gba/bg/lady-sia/baseline_0004.png deleted file mode 100644 index 6e0793103..000000000 Binary files a/cinema/gba/bg/lady-sia/baseline_0004.png and /dev/null differ diff --git a/cinema/gba/bg/lady-sia/baseline_0005.png b/cinema/gba/bg/lady-sia/baseline_0005.png deleted file mode 100644 index b9320fb90..000000000 Binary files a/cinema/gba/bg/lady-sia/baseline_0005.png and /dev/null differ diff --git a/cinema/gba/bg/lady-sia/baseline_0006.png b/cinema/gba/bg/lady-sia/baseline_0006.png deleted file mode 100644 index 280f0152f..000000000 Binary files a/cinema/gba/bg/lady-sia/baseline_0006.png and /dev/null differ diff --git a/cinema/gba/bg/lady-sia/baseline_0007.png b/cinema/gba/bg/lady-sia/baseline_0007.png deleted file mode 100644 index b6355a2d5..000000000 Binary files a/cinema/gba/bg/lady-sia/baseline_0007.png and /dev/null differ diff --git a/cinema/gba/bg/lady-sia/test.mvl b/cinema/gba/bg/lady-sia/test.mvl index ced00badf..214133dd2 100644 Binary files a/cinema/gba/bg/lady-sia/test.mvl and b/cinema/gba/bg/lady-sia/test.mvl differ diff --git a/cinema/gba/obj/unaligned-256-linear/baseline_0000.png b/cinema/gba/obj/unaligned-256-linear/baseline_0000.png index adf0534d0..4be2744f7 100644 Binary files a/cinema/gba/obj/unaligned-256-linear/baseline_0000.png and b/cinema/gba/obj/unaligned-256-linear/baseline_0000.png differ diff --git a/cinema/gba/obj/unaligned-256-linear/baseline_0001.png b/cinema/gba/obj/unaligned-256-linear/baseline_0001.png index adf0534d0..4be2744f7 100644 Binary files a/cinema/gba/obj/unaligned-256-linear/baseline_0001.png and b/cinema/gba/obj/unaligned-256-linear/baseline_0001.png differ diff --git a/cinema/gba/obj/unaligned-256-linear/baseline_0002.png b/cinema/gba/obj/unaligned-256-linear/baseline_0002.png index 6b3cfab23..5f20a6405 100644 Binary files a/cinema/gba/obj/unaligned-256-linear/baseline_0002.png and b/cinema/gba/obj/unaligned-256-linear/baseline_0002.png differ diff --git a/cinema/gba/obj/unaligned-256-linear/baseline_0003.png b/cinema/gba/obj/unaligned-256-linear/baseline_0003.png index 6b3cfab23..5f20a6405 100644 Binary files a/cinema/gba/obj/unaligned-256-linear/baseline_0003.png and b/cinema/gba/obj/unaligned-256-linear/baseline_0003.png differ diff --git a/cinema/gba/obj/unaligned-256-linear/baseline_0004.png b/cinema/gba/obj/unaligned-256-linear/baseline_0004.png index 52ea42a96..a13aec49a 100644 Binary files a/cinema/gba/obj/unaligned-256-linear/baseline_0004.png and b/cinema/gba/obj/unaligned-256-linear/baseline_0004.png differ diff --git a/cinema/gba/obj/unaligned-256-linear/baseline_0005.png b/cinema/gba/obj/unaligned-256-linear/baseline_0005.png index 82cc61aef..05395349e 100644 Binary files a/cinema/gba/obj/unaligned-256-linear/baseline_0005.png and b/cinema/gba/obj/unaligned-256-linear/baseline_0005.png differ diff --git a/src/gba/renderers/video-software.c b/src/gba/renderers/video-software.c index 76b9dfd0b..fb970322a 100644 --- a/src/gba/renderers/video-software.c +++ b/src/gba/renderers/video-software.c @@ -719,16 +719,16 @@ static void GBAVideoSoftwareRendererFinishFrame(struct GBAVideoRenderer* rendere softwareRenderer->bg[3].sy = softwareRenderer->bg[3].refy; if (softwareRenderer->bg[0].enabled > 0) { - softwareRenderer->bg[0].enabled = 3; + softwareRenderer->bg[0].enabled = 4; } if (softwareRenderer->bg[1].enabled > 0) { - softwareRenderer->bg[1].enabled = 3; + softwareRenderer->bg[1].enabled = 4; } if (softwareRenderer->bg[2].enabled > 0) { - softwareRenderer->bg[2].enabled = 3; + softwareRenderer->bg[2].enabled = 4; } if (softwareRenderer->bg[3].enabled > 0) { - softwareRenderer->bg[3].enabled = 3; + softwareRenderer->bg[3].enabled = 4; } } @@ -755,7 +755,7 @@ static void _enableBg(struct GBAVideoSoftwareRenderer* renderer, int bg, bool ac } else if (!wasActive && active) { if (renderer->nextY == 0 || GBARegisterDISPCNTGetMode(renderer->dispcnt) > 2) { // TODO: Investigate in more depth how switching background works in different modes - renderer->bg[bg].enabled = 3; + renderer->bg[bg].enabled = 4; } else { renderer->bg[bg].enabled = 1; } @@ -830,7 +830,7 @@ static void GBAVideoSoftwareRendererWriteBLDCNT(struct GBAVideoSoftwareRenderer* #define TEST_LAYER_ENABLED(X) \ !renderer->d.disableBG[X] && \ - (renderer->bg[X].enabled == 3 && \ + (renderer->bg[X].enabled == 4 && \ (GBAWindowControlIsBg ## X ## Enable(renderer->currentWindow.packed) || \ (GBARegisterDISPCNTIsObjwinEnable(renderer->dispcnt) && GBAWindowControlIsBg ## X ## Enable (renderer->objwin.packed))) && \ renderer->bg[X].priority == priority) @@ -937,19 +937,19 @@ static void _drawScanline(struct GBAVideoSoftwareRenderer* renderer, int y) { renderer->bg[3].sy += renderer->bg[3].dmy; } - if (renderer->bg[0].enabled > 0 && renderer->bg[0].enabled < 3) { + 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 < 3) { + 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 < 3) { + 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 < 3) { + if (renderer->bg[3].enabled > 0 && renderer->bg[3].enabled < 4) { ++renderer->bg[3].enabled; DIRTY_SCANLINE(renderer, y); } diff --git a/src/gba/video.c b/src/gba/video.c index 10baa7dae..01e652e59 100644 --- a/src/gba/video.c +++ b/src/gba/video.c @@ -159,9 +159,6 @@ void _startHdraw(struct mTiming* timing, void* context, uint32_t cyclesLate) { video->p->memory.io[REG_VCOUNT >> 1] = video->vcount; if (video->vcount < GBA_VIDEO_VERTICAL_PIXELS) { - if (video->frameskipCounter <= 0) { - video->renderer->drawScanline(video->renderer, video->vcount); - } video->shouldStall = 1; } @@ -213,6 +210,9 @@ void _startHblank(struct mTiming* timing, void* context, uint32_t cyclesLate) { // Begin Hblank GBARegisterDISPSTAT dispstat = video->p->memory.io[REG_DISPSTAT >> 1]; dispstat = GBARegisterDISPSTATFillInHblank(dispstat); + if (video->vcount < GBA_VIDEO_VERTICAL_PIXELS && video->frameskipCounter <= 0) { + video->renderer->drawScanline(video->renderer, video->vcount); + } if (video->vcount < GBA_VIDEO_VERTICAL_PIXELS) { GBADMARunHblank(video->p, -cyclesLate);