GB Video: Fix STAT bit 0 in CGB mode
Jeffrey Pfau jeffrey@endrift.com
Sat, 16 Apr 2016 10:48:48 -0700
1 files changed,
7 insertions(+),
3 deletions(-)
jump to
M
src/gb/renderers/software.c
→
src/gb/renderers/software.c
@@ -108,7 +108,7 @@ uint8_t* maps = &softwareRenderer->d.vram[GB_BASE_MAP];
if (GBRegisterLCDCIsTileMap(softwareRenderer->lcdc)) { maps += GB_SIZE_MAP; } - if (GBRegisterLCDCIsBgEnable(softwareRenderer->lcdc)) { + if (GBRegisterLCDCIsBgEnable(softwareRenderer->lcdc) || softwareRenderer->model >= GB_MODEL_CGB) { 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);@@ -195,7 +195,7 @@ int p = 0;
if (renderer->model >= GB_MODEL_CGB) { GBObjAttributes attrs = attr[topX + topY]; p = GBObjAttributesGetCGBPalette(attrs) * 4; - if (GBObjAttributesIsPriority(attrs)) { + if (GBObjAttributesIsPriority(attrs) && GBRegisterLCDCIsBgEnable(renderer->lcdc)) { p |= 0x80; } if (GBObjAttributesIsBank(attrs)) {@@ -230,7 +230,7 @@ int p = 0;
if (renderer->model >= GB_MODEL_CGB) { GBObjAttributes attrs = attr[topX + topY]; p = GBObjAttributesGetCGBPalette(attrs) * 4; - if (GBObjAttributesIsPriority(attrs)) { + if (GBObjAttributesIsPriority(attrs) && GBRegisterLCDCIsBgEnable(renderer->lcdc)) { p |= 0x80; } if (GBObjAttributesIsBank(attrs)) {@@ -304,6 +304,10 @@ if (renderer->model >= GB_MODEL_CGB) {
p = (GBObjAttributesGetCGBPalette(obj->attr) + 8) * 4; if (GBObjAttributesIsBank(obj->attr)) { data += GB_SIZE_VRAM_BANK0; + } + if (!GBRegisterLCDCIsBgEnable(renderer->lcdc)) { + mask = 0x60; + mask2 = 0x83; } } else { p = (GBObjAttributesGetPalette(obj->attr) + 8) * 4;