GBA Video: Revert scanline latching changes (fixes #2153, fixes #2149)

This commit is contained in:
Vicki Pfau 2021-04-29 22:42:07 -07:00
parent 745a12d00e
commit 2d03ae73da
18 changed files with 15 additions and 13 deletions

View File

@ -1,4 +1,6 @@
0.9.2: (Future) 0.9.2: (Future)
Emulation fixes:
- GBA Video: Revert scanline latching changes (fixes mgba.io/i/2153, mgba.io/i/2149)
Other fixes: Other fixes:
- Core: Fix memory leak in opening games from the library - Core: Fix memory leak in opening games from the library
- Qt: Fix infrequent deadlock when using sync to video - Qt: Fix infrequent deadlock when using sync to video

Binary file not shown.

Before

Width:  |  Height:  |  Size: 14 KiB

After

Width:  |  Height:  |  Size: 15 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 14 KiB

After

Width:  |  Height:  |  Size: 15 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 14 KiB

After

Width:  |  Height:  |  Size: 15 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 14 KiB

After

Width:  |  Height:  |  Size: 15 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 14 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 14 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 14 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 14 KiB

Binary file not shown.

Binary file not shown.

Before

Width:  |  Height:  |  Size: 23 KiB

After

Width:  |  Height:  |  Size: 22 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 23 KiB

After

Width:  |  Height:  |  Size: 22 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 22 KiB

After

Width:  |  Height:  |  Size: 22 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 22 KiB

After

Width:  |  Height:  |  Size: 22 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 22 KiB

After

Width:  |  Height:  |  Size: 22 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 19 KiB

After

Width:  |  Height:  |  Size: 19 KiB

View File

@ -719,16 +719,16 @@ static void GBAVideoSoftwareRendererFinishFrame(struct GBAVideoRenderer* rendere
softwareRenderer->bg[3].sy = softwareRenderer->bg[3].refy; softwareRenderer->bg[3].sy = softwareRenderer->bg[3].refy;
if (softwareRenderer->bg[0].enabled > 0) { if (softwareRenderer->bg[0].enabled > 0) {
softwareRenderer->bg[0].enabled = 3; softwareRenderer->bg[0].enabled = 4;
} }
if (softwareRenderer->bg[1].enabled > 0) { if (softwareRenderer->bg[1].enabled > 0) {
softwareRenderer->bg[1].enabled = 3; softwareRenderer->bg[1].enabled = 4;
} }
if (softwareRenderer->bg[2].enabled > 0) { if (softwareRenderer->bg[2].enabled > 0) {
softwareRenderer->bg[2].enabled = 3; softwareRenderer->bg[2].enabled = 4;
} }
if (softwareRenderer->bg[3].enabled > 0) { 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) { } else if (!wasActive && active) {
if (renderer->nextY == 0 || GBARegisterDISPCNTGetMode(renderer->dispcnt) > 2) { if (renderer->nextY == 0 || GBARegisterDISPCNTGetMode(renderer->dispcnt) > 2) {
// TODO: Investigate in more depth how switching background works in different modes // TODO: Investigate in more depth how switching background works in different modes
renderer->bg[bg].enabled = 3; renderer->bg[bg].enabled = 4;
} else { } else {
renderer->bg[bg].enabled = 1; renderer->bg[bg].enabled = 1;
} }
@ -830,7 +830,7 @@ static void GBAVideoSoftwareRendererWriteBLDCNT(struct GBAVideoSoftwareRenderer*
#define TEST_LAYER_ENABLED(X) \ #define TEST_LAYER_ENABLED(X) \
!renderer->d.disableBG[X] && \ !renderer->d.disableBG[X] && \
(renderer->bg[X].enabled == 3 && \ (renderer->bg[X].enabled == 4 && \
(GBAWindowControlIsBg ## X ## Enable(renderer->currentWindow.packed) || \ (GBAWindowControlIsBg ## X ## Enable(renderer->currentWindow.packed) || \
(GBARegisterDISPCNTIsObjwinEnable(renderer->dispcnt) && GBAWindowControlIsBg ## X ## Enable (renderer->objwin.packed))) && \ (GBARegisterDISPCNTIsObjwinEnable(renderer->dispcnt) && GBAWindowControlIsBg ## X ## Enable (renderer->objwin.packed))) && \
renderer->bg[X].priority == priority) 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; 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; ++renderer->bg[0].enabled;
DIRTY_SCANLINE(renderer, y); 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; ++renderer->bg[1].enabled;
DIRTY_SCANLINE(renderer, y); 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; ++renderer->bg[2].enabled;
DIRTY_SCANLINE(renderer, y); 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; ++renderer->bg[3].enabled;
DIRTY_SCANLINE(renderer, y); DIRTY_SCANLINE(renderer, y);
} }

View File

@ -159,9 +159,6 @@ void _startHdraw(struct mTiming* timing, void* context, uint32_t cyclesLate) {
video->p->memory.io[REG_VCOUNT >> 1] = video->vcount; video->p->memory.io[REG_VCOUNT >> 1] = video->vcount;
if (video->vcount < GBA_VIDEO_VERTICAL_PIXELS) { if (video->vcount < GBA_VIDEO_VERTICAL_PIXELS) {
if (video->frameskipCounter <= 0) {
video->renderer->drawScanline(video->renderer, video->vcount);
}
video->shouldStall = 1; video->shouldStall = 1;
} }
@ -213,6 +210,9 @@ void _startHblank(struct mTiming* timing, void* context, uint32_t cyclesLate) {
// Begin Hblank // Begin Hblank
GBARegisterDISPSTAT dispstat = video->p->memory.io[REG_DISPSTAT >> 1]; GBARegisterDISPSTAT dispstat = video->p->memory.io[REG_DISPSTAT >> 1];
dispstat = GBARegisterDISPSTATFillInHblank(dispstat); 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) { if (video->vcount < GBA_VIDEO_VERTICAL_PIXELS) {
GBADMARunHblank(video->p, -cyclesLate); GBADMARunHblank(video->p, -cyclesLate);