GB Video: Fix drawing background when window is force-disabled by frontend

This commit is contained in:
Vicki Pfau 2020-10-21 21:44:04 -07:00
parent 064d0e992b
commit 1629eede4e
3 changed files with 6 additions and 7 deletions

View File

@ -22,6 +22,7 @@ Emulation fixes:
- GB MBC: Fix MBC1 mode changing behavior
- GB MBC: Fix some MBC3 bit masking
- GB Video: Fix state after skipping BIOS (fixes mgba.io/i/1715 and mgba.io/i/1716)
- GB Video: Fix drawing background when window is force-disabled by frontend
- GBA: Fix timing advancing too quickly in rare cases
- GBA: Clear GBP connection on reset
- GBA Audio: Fix deserializing SOUNDCNT_L

View File

@ -132,15 +132,15 @@ static bool _parsePacket(struct mVideoLogger* logger, const struct mVideoLoggerD
}
break;
case DIRTY_VRAM:
proxyRenderer->backend->disableBG = proxyRenderer->d.disableBG;
proxyRenderer->backend->disableWIN = proxyRenderer->d.disableWIN;
proxyRenderer->backend->disableOBJ = proxyRenderer->d.disableOBJ;
if (item->address <= GB_SIZE_VRAM - 0x1000) {
logger->readData(logger, &logger->vram[item->address >> 1], 0x1000, true);
proxyRenderer->backend->writeVRAM(proxyRenderer->backend, item->address);
}
break;
case DIRTY_SCANLINE:
proxyRenderer->backend->disableBG = proxyRenderer->d.disableBG;
proxyRenderer->backend->disableWIN = proxyRenderer->d.disableWIN;
proxyRenderer->backend->disableOBJ = proxyRenderer->d.disableOBJ;
if (item->address < GB_VIDEO_VERTICAL_PIXELS) {
proxyRenderer->backend->finishScanline(proxyRenderer->backend, item->address);
}

View File

@ -540,7 +540,7 @@ static void GBVideoSoftwareRendererDrawRange(struct GBVideoRenderer* renderer, i
if (GBRegisterLCDCIsWindow(softwareRenderer->lcdc) && wy == y && wx <= endX) {
softwareRenderer->hasWindow = true;
}
if (GBRegisterLCDCIsWindow(softwareRenderer->lcdc) && softwareRenderer->hasWindow && wx <= endX) {
if (GBRegisterLCDCIsWindow(softwareRenderer->lcdc) && softwareRenderer->hasWindow && wx <= endX && !softwareRenderer->d.disableWIN) {
if (wx > 0 && !softwareRenderer->d.disableBG) {
GBVideoSoftwareRendererDrawBackground(softwareRenderer, maps, startX, wx, softwareRenderer->scx - softwareRenderer->offsetScx, softwareRenderer->scy + y - softwareRenderer->offsetScy);
}
@ -549,9 +549,7 @@ static void GBVideoSoftwareRendererDrawRange(struct GBVideoRenderer* renderer, i
if (GBRegisterLCDCIsWindowTileMap(softwareRenderer->lcdc)) {
maps += GB_SIZE_MAP;
}
if (!softwareRenderer->d.disableWIN) {
GBVideoSoftwareRendererDrawBackground(softwareRenderer, maps, wx, endX, -wx - softwareRenderer->offsetWx, y - wy - softwareRenderer->offsetWy);
}
GBVideoSoftwareRendererDrawBackground(softwareRenderer, maps, wx, endX, -wx - softwareRenderer->offsetWx, y - wy - softwareRenderer->offsetWy);
} else if (!softwareRenderer->d.disableBG) {
GBVideoSoftwareRendererDrawBackground(softwareRenderer, maps, startX, endX, softwareRenderer->scx - softwareRenderer->offsetScx, softwareRenderer->scy + y - softwareRenderer->offsetScy);
}