all repos — mgba @ c581764e236ab115d50f7a362c1b9abb02962a24

mGBA Game Boy Advance Emulator

GB Video: Fix strange window y behavior when paritally disabled
Jeffrey Pfau jeffrey@endrift.com
Sat, 06 Feb 2016 19:29:27 -0800
commit

c581764e236ab115d50f7a362c1b9abb02962a24

parent

88c94622095ac8f043518bada5f27e9e4380aa40

2 files changed, 7 insertions(+), 3 deletions(-)

jump to
M src/gb/renderers/software.csrc/gb/renderers/software.c

@@ -63,6 +63,7 @@ struct GBVideoSoftwareRenderer* softwareRenderer = (struct GBVideoSoftwareRenderer*) renderer;

softwareRenderer->scy = 0; softwareRenderer->scx = 0; softwareRenderer->wy = 0; + softwareRenderer->currentWy = 0; softwareRenderer->wx = 0; }

@@ -120,13 +121,14 @@ }

if (GBRegisterLCDCIsBgEnable(softwareRenderer->lcdc)) { GBVideoSoftwareRendererDrawBackground(softwareRenderer, maps, x, y, softwareRenderer->scx, softwareRenderer->scy); - if (GBRegisterLCDCIsWindow(softwareRenderer->lcdc) && softwareRenderer->wy <= y) { + if (GBRegisterLCDCIsWindow(softwareRenderer->lcdc) && softwareRenderer->wy <= y && x >= softwareRenderer->wx - 7) { maps = &softwareRenderer->d.vram[GB_BASE_MAP]; if (GBRegisterLCDCIsWindowTileMap(softwareRenderer->lcdc)) { maps += GB_SIZE_MAP; } - if (x >= softwareRenderer->wx - 7) { - GBVideoSoftwareRendererDrawBackground(softwareRenderer, maps, x, y, 7 - softwareRenderer->wx, -softwareRenderer->wy); + GBVideoSoftwareRendererDrawBackground(softwareRenderer, maps, x, y, 7 - softwareRenderer->wx, (softwareRenderer->currentWy - y) - softwareRenderer->wy); + if (x == 159) { // TODO: Find a better way to do this + ++softwareRenderer->currentWy; } } } else {

@@ -151,6 +153,7 @@ if (softwareRenderer->temporaryBuffer) {

mappedMemoryFree(softwareRenderer->temporaryBuffer, GB_VIDEO_HORIZONTAL_PIXELS * GB_VIDEO_VERTICAL_PIXELS * 4); softwareRenderer->temporaryBuffer = 0; } + softwareRenderer->currentWy = 0; } static void GBVideoSoftwareRendererDrawBackground(struct GBVideoSoftwareRenderer* renderer, uint8_t* maps, int x, int y, int sx, int sy) {
M src/gb/renderers/software.hsrc/gb/renderers/software.h

@@ -27,6 +27,7 @@ uint8_t scy;

uint8_t scx; uint8_t wy; uint8_t wx; + uint8_t currentWy; GBRegisterLCDC lcdc; };