GB Video: Fix more window edge cases (fixes #1346)
Vicki Pfau vi@endrift.com
Sat, 09 Mar 2019 14:11:55 -0800
18 files changed,
10 insertions(+),
9 deletions(-)
jump to
M
CHANGES
→
CHANGES
@@ -15,6 +15,7 @@ - GB I/O: Filter IE top bits properly (fixes mgba.io/i/1329)
- 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)
M
src/gb/renderers/software.c
→
src/gb/renderers/software.c
@@ -224,25 +224,22 @@ static void GBVideoSoftwareRendererUpdateWindow(struct GBVideoSoftwareRenderer* renderer, bool before, bool after, uint8_t oldWy) {
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 @@ }
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); }