all repos — mgba @ 63f14876c58e81867cc01bfb1165708fa17867c4

mGBA Game Boy Advance Emulator

GB: Only draw full background when not covered by a window
Jeffrey Pfau jeffrey@endrift.com
Mon, 22 Feb 2016 20:57:20 -0800
commit

63f14876c58e81867cc01bfb1165708fa17867c4

parent

883bf556609b07b82fceb704aaf23cb1733dd9fe

1 files changed, 6 insertions(+), 2 deletions(-)

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

@@ -109,14 +109,18 @@ if (GBRegisterLCDCIsTileMap(softwareRenderer->lcdc)) {

maps += GB_SIZE_MAP; } if (GBRegisterLCDCIsBgEnable(softwareRenderer->lcdc)) { - GBVideoSoftwareRendererDrawBackground(softwareRenderer, maps, startX, endX, y, softwareRenderer->scx, softwareRenderer->scy); - if (GBRegisterLCDCIsWindow(softwareRenderer->lcdc) && softwareRenderer->wy <= y && endX >= softwareRenderer->wx - 7) { + if (softwareRenderer->wx - 7 > 0) { + GBVideoSoftwareRendererDrawBackground(softwareRenderer, maps, startX, softwareRenderer->wx - 7, y, softwareRenderer->scx, softwareRenderer->scy); + } + maps = &softwareRenderer->d.vram[GB_BASE_MAP]; if (GBRegisterLCDCIsWindowTileMap(softwareRenderer->lcdc)) { maps += GB_SIZE_MAP; } GBVideoSoftwareRendererDrawBackground(softwareRenderer, maps, softwareRenderer->wx - 7, endX, y, 7 - softwareRenderer->wx, (softwareRenderer->currentWy - y) - softwareRenderer->wy); + } else { + GBVideoSoftwareRendererDrawBackground(softwareRenderer, maps, startX, endX, y, softwareRenderer->scx, softwareRenderer->scy); } } else { memset(&softwareRenderer->row[startX], 0, endX - startX);