diff --git a/CHANGES b/CHANGES index 91277f9b7..b24c08650 100644 --- a/CHANGES +++ b/CHANGES @@ -3,6 +3,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) diff --git a/cinema/gb/window/rfs-hud/baseline_0000.png b/cinema/gb/window/rfs-hud/baseline_0000.png new file mode 100644 index 000000000..a4199c67a Binary files /dev/null and b/cinema/gb/window/rfs-hud/baseline_0000.png differ diff --git a/cinema/gb/window/rfs-hud/baseline_0001.png b/cinema/gb/window/rfs-hud/baseline_0001.png new file mode 100644 index 000000000..a4199c67a Binary files /dev/null and b/cinema/gb/window/rfs-hud/baseline_0001.png differ diff --git a/cinema/gb/window/rfs-hud/baseline_0002.png b/cinema/gb/window/rfs-hud/baseline_0002.png new file mode 100644 index 000000000..d8c767203 Binary files /dev/null and b/cinema/gb/window/rfs-hud/baseline_0002.png differ diff --git a/cinema/gb/window/rfs-hud/baseline_0003.png b/cinema/gb/window/rfs-hud/baseline_0003.png new file mode 100644 index 000000000..d8c767203 Binary files /dev/null and b/cinema/gb/window/rfs-hud/baseline_0003.png differ diff --git a/cinema/gb/window/rfs-hud/baseline_0004.png b/cinema/gb/window/rfs-hud/baseline_0004.png new file mode 100644 index 000000000..d8c767203 Binary files /dev/null and b/cinema/gb/window/rfs-hud/baseline_0004.png differ diff --git a/cinema/gb/window/rfs-hud/baseline_0005.png b/cinema/gb/window/rfs-hud/baseline_0005.png new file mode 100644 index 000000000..d8c767203 Binary files /dev/null and b/cinema/gb/window/rfs-hud/baseline_0005.png differ diff --git a/cinema/gb/window/rfs-hud/baseline_0006.png b/cinema/gb/window/rfs-hud/baseline_0006.png new file mode 100644 index 000000000..7489e9768 Binary files /dev/null and b/cinema/gb/window/rfs-hud/baseline_0006.png differ diff --git a/cinema/gb/window/rfs-hud/baseline_0007.png b/cinema/gb/window/rfs-hud/baseline_0007.png new file mode 100644 index 000000000..7489e9768 Binary files /dev/null and b/cinema/gb/window/rfs-hud/baseline_0007.png differ diff --git a/cinema/gb/window/rfs-hud/baseline_0008.png b/cinema/gb/window/rfs-hud/baseline_0008.png new file mode 100644 index 000000000..7489e9768 Binary files /dev/null and b/cinema/gb/window/rfs-hud/baseline_0008.png differ diff --git a/cinema/gb/window/rfs-hud/baseline_0009.png b/cinema/gb/window/rfs-hud/baseline_0009.png new file mode 100644 index 000000000..7489e9768 Binary files /dev/null and b/cinema/gb/window/rfs-hud/baseline_0009.png differ diff --git a/cinema/gb/window/rfs-hud/baseline_0010.png b/cinema/gb/window/rfs-hud/baseline_0010.png new file mode 100644 index 000000000..334806217 Binary files /dev/null and b/cinema/gb/window/rfs-hud/baseline_0010.png differ diff --git a/cinema/gb/window/rfs-hud/baseline_0011.png b/cinema/gb/window/rfs-hud/baseline_0011.png new file mode 100644 index 000000000..334806217 Binary files /dev/null and b/cinema/gb/window/rfs-hud/baseline_0011.png differ diff --git a/cinema/gb/window/rfs-hud/baseline_0012.png b/cinema/gb/window/rfs-hud/baseline_0012.png new file mode 100644 index 000000000..334806217 Binary files /dev/null and b/cinema/gb/window/rfs-hud/baseline_0012.png differ diff --git a/cinema/gb/window/rfs-hud/baseline_0013.png b/cinema/gb/window/rfs-hud/baseline_0013.png new file mode 100644 index 000000000..334806217 Binary files /dev/null and b/cinema/gb/window/rfs-hud/baseline_0013.png differ diff --git a/cinema/gb/window/rfs-hud/baseline_0014.png b/cinema/gb/window/rfs-hud/baseline_0014.png new file mode 100644 index 000000000..7c444e005 Binary files /dev/null and b/cinema/gb/window/rfs-hud/baseline_0014.png differ diff --git a/cinema/gb/window/rfs-hud/test.mvl b/cinema/gb/window/rfs-hud/test.mvl new file mode 100644 index 000000000..7b25a4ba0 Binary files /dev/null and b/cinema/gb/window/rfs-hud/test.mvl differ diff --git a/src/gb/renderers/software.c b/src/gb/renderers/software.c index ab56570ab..00b703548 100644 --- a/src/gb/renderers/software.c +++ b/src/gb/renderers/software.c @@ -222,22 +222,19 @@ 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; - } + renderer->currentWy = renderer->lastY - renderer->wy; } else { renderer->currentWy += renderer->lastY; } } else if (renderer->wy != oldWy) { renderer->currentWy += oldWy - renderer->wy; + renderer->hasWindow = true; } } } @@ -501,9 +498,13 @@ static void GBVideoSoftwareRendererDrawRange(struct GBVideoRenderer* renderer, i } if (GBRegisterLCDCIsBgEnable(softwareRenderer->lcdc) || softwareRenderer->model >= GB_MODEL_CGB) { int wy = softwareRenderer->wy + softwareRenderer->currentWy; - if (GBRegisterLCDCIsWindow(softwareRenderer->lcdc) && wy <= y && endX >= softwareRenderer->wx - 7) { - if (softwareRenderer->wx - 7 > 0 && !softwareRenderer->d.disableBG) { - GBVideoSoftwareRendererDrawBackground(softwareRenderer, maps, startX, softwareRenderer->wx - 7, softwareRenderer->scx - softwareRenderer->offsetScx, softwareRenderer->scy + y - softwareRenderer->offsetScy); + int wx = softwareRenderer->wx - 7; + 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); } maps = &softwareRenderer->d.vram[GB_BASE_MAP];