GB Video: Fix clearing scanline buffer (fixes #1958)
Vicki Pfau vi@endrift.com
Tue, 01 Dec 2020 21:16:06 -0800
1 files changed,
2 insertions(+),
2 deletions(-)
jump to
M
src/gb/renderers/software.c
→
src/gb/renderers/software.c
@@ -570,7 +570,7 @@ if (GBRegisterLCDCIsTileMap(softwareRenderer->lcdc)) {
maps += GB_SIZE_MAP; } if (softwareRenderer->d.disableBG) { - memset(&softwareRenderer->row[startX], 0, endX - startX); + memset(&softwareRenderer->row[startX], 0, (endX - startX) * sizeof(softwareRenderer->row[0])); } if (GBRegisterLCDCIsBgEnable(softwareRenderer->lcdc) || softwareRenderer->model >= GB_MODEL_CGB) { int wy = softwareRenderer->wy + softwareRenderer->currentWy;@@ -592,7 +592,7 @@ } else if (!softwareRenderer->d.disableBG) {
GBVideoSoftwareRendererDrawBackground(softwareRenderer, maps, startX, endX, softwareRenderer->scx - softwareRenderer->offsetScx, softwareRenderer->scy + y - softwareRenderer->offsetScy, renderer->highlightBG); } } else if (!softwareRenderer->d.disableBG) { - memset(&softwareRenderer->row[startX], 0, endX - startX); + memset(&softwareRenderer->row[startX], 0, (endX - startX) * sizeof(softwareRenderer->row[0])); } if (GBRegisterLCDCIsObjEnable(softwareRenderer->lcdc) && !softwareRenderer->d.disableOBJ) {