all repos — mgba @ ed2353ff76da104221a0dfcdfe26a724a536a517

mGBA Game Boy Advance Emulator

GBA Video: Fix BLDY for semitransparent sprite on non-target-2 backgrounds
Vicki Pfau vi@endrift.com
Tue, 31 Dec 2019 00:05:59 -0800
commit

ed2353ff76da104221a0dfcdfe26a724a536a517

parent

b9a0e14561ae81213585dd63ec273b8fd51da0b3

M CHANGESCHANGES

@@ -91,8 +91,9 @@ - ARM: Fix STR writeback pipeline stage

- ARM: Partially fix LDM/STM writeback with empty register list - ARM: Fix stepping when events are pending - GBA DMA: Fix case where DMAs could get misaligned (fixes mgba.io/i/1092) + - GBA Memory: Fix open bus from IWRAM (fixes mgba.io/i/1575) - GBA Video: Fix OpenGL renderer 512x512 backgrounds (fixes mgba.io/i/1572) - - GBA Memory: Fix open bus from IWRAM (fixes mgba.io/i/1575) + - GBA Video: Fix BLDY for semitransparent sprite on non-target-2 backgrounds Other fixes: - 3DS: Fix screen darkening (fixes mgba.io/i/1562) - Core: Fix uninitialized memory issues with graphics caches
M include/mgba/internal/gba/renderers/video-software.hinclude/mgba/internal/gba/renderers/video-software.h

@@ -131,7 +131,8 @@ struct Window windows[MAX_WINDOW];

struct GBAVideoSoftwareBackground bg[4]; - int oamDirty; + bool forceTarget1; + bool oamDirty; int oamMax; struct GBAVideoRendererSprite sprites[128]; int16_t objOffsetX;
M src/gba/renderers/software-obj.csrc/gba/renderers/software-obj.c

@@ -165,7 +165,7 @@ return 0;

} int objwinSlowPath = GBARegisterDISPCNTIsObjwinEnable(renderer->dispcnt) && GBAWindowControlGetBlendEnable(renderer->objwin.packed) != GBAWindowControlIsBlendEnable(renderer->currentWindow.packed); - int variant = renderer->target1Obj && + int variant = (renderer->target1Obj || GBAObjAttributesAGetMode(sprite->a) == OBJ_MODE_SEMITRANSPARENT) && GBAWindowControlIsBlendEnable(renderer->currentWindow.packed) && (renderer->blendEffect == BLEND_BRIGHTEN || renderer->blendEffect == BLEND_DARKEN); if (GBAObjAttributesAGetMode(sprite->a) == OBJ_MODE_SEMITRANSPARENT || objwinSlowPath) {

@@ -175,6 +175,7 @@ target2 |= renderer->bg[1].target2;

target2 |= renderer->bg[2].target2; target2 |= renderer->bg[3].target2; if (target2) { + renderer->forceTarget1 = true; flags |= FLAG_REBLEND; variant = 0; } else {
M src/gba/renderers/video-software.csrc/gba/renderers/video-software.c

@@ -592,6 +592,7 @@ if (softwareRenderer->blendDirty) {

_updatePalettes(softwareRenderer); softwareRenderer->blendDirty = false; } + softwareRenderer->forceTarget1 = false; int w; x = 0;

@@ -622,7 +623,7 @@ softwareRenderer->bg[3].highlight = softwareRenderer->d.highlightBG[3];

_drawScanline(softwareRenderer, y); - if (softwareRenderer->target2Bd) { + if (softwareRenderer->forceTarget1 && softwareRenderer->target2Bd) { x = 0; for (w = 0; w < softwareRenderer->nWindows; ++w) { uint32_t backdrop = 0;

@@ -640,9 +641,9 @@ }

} } } - if (softwareRenderer->target1Obj && (softwareRenderer->blendEffect == BLEND_DARKEN || softwareRenderer->blendEffect == BLEND_BRIGHTEN)) { + if (softwareRenderer->forceTarget1 && (softwareRenderer->blendEffect == BLEND_DARKEN || softwareRenderer->blendEffect == BLEND_BRIGHTEN)) { x = 0; - uint32_t mask = FLAG_REBLEND | FLAG_TARGET_1 | FLAG_IS_BACKGROUND; + uint32_t mask = FLAG_REBLEND | FLAG_IS_BACKGROUND; uint32_t match = FLAG_REBLEND; if (GBARegisterDISPCNTIsObjwinEnable(softwareRenderer->dispcnt)) { mask |= FLAG_OBJWIN;