GB Video: Fix more window edge cases (fixes #1346)

This commit is contained in:
Vicki Pfau 2019-03-09 14:11:55 -08:00
parent 57ad372c78
commit c85d0b1096
18 changed files with 10 additions and 9 deletions

View File

@ -15,6 +15,7 @@ Emulation fixes:
- GBA Video: Fix scanline cache with scale factor change edge cases
- GBA DMA: Fix DMA0-2 lengths (fixes mgba.io/i/1344)
- GB Video: Fix window y changing mid-window (fixes mgba.io/i/1345)
- GB Video: Fix more window edge cases (fixes mgba.io/i/1346)
Other fixes:
- Qt: More app metadata fixes
- Qt: Fix load recent from archive (fixes mgba.io/i/1325)

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.5 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.5 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.5 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.5 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.6 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.6 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.6 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.6 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.7 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.7 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.7 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.7 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.7 KiB

Binary file not shown.

View File

@ -224,25 +224,22 @@ static void GBVideoSoftwareRendererUpdateWindow(struct GBVideoSoftwareRenderer*
if (renderer->lastY >= GB_VIDEO_VERTICAL_PIXELS || !(after || before)) {
return;
}
if (renderer->lastY >= renderer->wy) {
if (renderer->lastY >= oldWy) {
if (!after) {
renderer->currentWy -= renderer->lastY;
renderer->hasWindow = true;
} else if (!before) {
if (!renderer->hasWindow) {
if (renderer->lastY > renderer->wy) {
renderer->currentWy = GB_VIDEO_VERTICAL_PIXELS;
} else {
renderer->currentWy = renderer->lastY - renderer->wy;
if (renderer->lastY == renderer->wy && renderer->lastX > renderer->wx) {
++renderer->currentWy;
}
renderer->currentWy = renderer->lastY - renderer->wy;
if (renderer->lastY >= renderer->wy && renderer->lastX > renderer->wx) {
++renderer->currentWy;
}
} else {
renderer->currentWy += renderer->lastY;
}
} else if (renderer->wy != oldWy) {
renderer->currentWy += oldWy - renderer->wy;
renderer->hasWindow = true;
}
}
}
@ -508,7 +505,10 @@ static void GBVideoSoftwareRendererDrawRange(struct GBVideoRenderer* renderer, i
if (GBRegisterLCDCIsBgEnable(softwareRenderer->lcdc) || softwareRenderer->model >= GB_MODEL_CGB) {
int wy = softwareRenderer->wy + softwareRenderer->currentWy;
int wx = softwareRenderer->wx + softwareRenderer->currentWx - 7;
if (GBRegisterLCDCIsWindow(softwareRenderer->lcdc) && wy <= y && wx <= endX) {
if (GBRegisterLCDCIsWindow(softwareRenderer->lcdc) && wy == y && wx <= endX) {
softwareRenderer->hasWindow = true;
}
if (softwareRenderer->hasWindow && wx <= endX) {
if (wx > 0 && !softwareRenderer->d.disableBG) {
GBVideoSoftwareRendererDrawBackground(softwareRenderer, maps, startX, wx, softwareRenderer->scx - softwareRenderer->offsetScx, softwareRenderer->scy + y - softwareRenderer->offsetScy);
}