GBA Video: Fix BLDY for semitransparent sprite on non-target-2 backgrounds

This commit is contained in:
Vicki Pfau 2019-12-31 00:05:59 -08:00
parent b9a0e14561
commit ed2353ff76
7 changed files with 10 additions and 6 deletions

View File

@ -91,8 +91,9 @@ Emulation fixes:
- ARM: Partially fix LDM/STM writeback with empty register list - ARM: Partially fix LDM/STM writeback with empty register list
- ARM: Fix stepping when events are pending - ARM: Fix stepping when events are pending
- GBA DMA: Fix case where DMAs could get misaligned (fixes mgba.io/i/1092) - GBA DMA: Fix case where DMAs could get misaligned (fixes mgba.io/i/1092)
- 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 Memory: Fix open bus from IWRAM (fixes mgba.io/i/1575)
- GBA Video: Fix OpenGL renderer 512x512 backgrounds (fixes mgba.io/i/1572)
- GBA Video: Fix BLDY for semitransparent sprite on non-target-2 backgrounds
Other fixes: Other fixes:
- 3DS: Fix screen darkening (fixes mgba.io/i/1562) - 3DS: Fix screen darkening (fixes mgba.io/i/1562)
- Core: Fix uninitialized memory issues with graphics caches - Core: Fix uninitialized memory issues with graphics caches

Binary file not shown.

After

Width:  |  Height:  |  Size: 6.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 6.2 KiB

Binary file not shown.

View File

@ -131,7 +131,8 @@ struct GBAVideoSoftwareRenderer {
struct GBAVideoSoftwareBackground bg[4]; struct GBAVideoSoftwareBackground bg[4];
int oamDirty; bool forceTarget1;
bool oamDirty;
int oamMax; int oamMax;
struct GBAVideoRendererSprite sprites[128]; struct GBAVideoRendererSprite sprites[128];
int16_t objOffsetX; int16_t objOffsetX;

View File

@ -165,7 +165,7 @@ int GBAVideoSoftwareRendererPreprocessSprite(struct GBAVideoSoftwareRenderer* re
} }
int objwinSlowPath = GBARegisterDISPCNTIsObjwinEnable(renderer->dispcnt) && GBAWindowControlGetBlendEnable(renderer->objwin.packed) != GBAWindowControlIsBlendEnable(renderer->currentWindow.packed); 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) && GBAWindowControlIsBlendEnable(renderer->currentWindow.packed) &&
(renderer->blendEffect == BLEND_BRIGHTEN || renderer->blendEffect == BLEND_DARKEN); (renderer->blendEffect == BLEND_BRIGHTEN || renderer->blendEffect == BLEND_DARKEN);
if (GBAObjAttributesAGetMode(sprite->a) == OBJ_MODE_SEMITRANSPARENT || objwinSlowPath) { if (GBAObjAttributesAGetMode(sprite->a) == OBJ_MODE_SEMITRANSPARENT || objwinSlowPath) {
@ -175,6 +175,7 @@ int GBAVideoSoftwareRendererPreprocessSprite(struct GBAVideoSoftwareRenderer* re
target2 |= renderer->bg[2].target2; target2 |= renderer->bg[2].target2;
target2 |= renderer->bg[3].target2; target2 |= renderer->bg[3].target2;
if (target2) { if (target2) {
renderer->forceTarget1 = true;
flags |= FLAG_REBLEND; flags |= FLAG_REBLEND;
variant = 0; variant = 0;
} else { } else {

View File

@ -592,6 +592,7 @@ static void GBAVideoSoftwareRendererDrawScanline(struct GBAVideoRenderer* render
_updatePalettes(softwareRenderer); _updatePalettes(softwareRenderer);
softwareRenderer->blendDirty = false; softwareRenderer->blendDirty = false;
} }
softwareRenderer->forceTarget1 = false;
int w; int w;
x = 0; x = 0;
@ -622,7 +623,7 @@ static void GBAVideoSoftwareRendererDrawScanline(struct GBAVideoRenderer* render
_drawScanline(softwareRenderer, y); _drawScanline(softwareRenderer, y);
if (softwareRenderer->target2Bd) { if (softwareRenderer->forceTarget1 && softwareRenderer->target2Bd) {
x = 0; x = 0;
for (w = 0; w < softwareRenderer->nWindows; ++w) { for (w = 0; w < softwareRenderer->nWindows; ++w) {
uint32_t backdrop = 0; uint32_t backdrop = 0;
@ -640,9 +641,9 @@ static void GBAVideoSoftwareRendererDrawScanline(struct GBAVideoRenderer* render
} }
} }
} }
if (softwareRenderer->target1Obj && (softwareRenderer->blendEffect == BLEND_DARKEN || softwareRenderer->blendEffect == BLEND_BRIGHTEN)) { if (softwareRenderer->forceTarget1 && (softwareRenderer->blendEffect == BLEND_DARKEN || softwareRenderer->blendEffect == BLEND_BRIGHTEN)) {
x = 0; 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; uint32_t match = FLAG_REBLEND;
if (GBARegisterDISPCNTIsObjwinEnable(softwareRenderer->dispcnt)) { if (GBARegisterDISPCNTIsObjwinEnable(softwareRenderer->dispcnt)) {
mask |= FLAG_OBJWIN; mask |= FLAG_OBJWIN;