Skip to content

Commit

Permalink
GBA Video: Fix deferred blending when OBJWIN matches window (fixes #1905
Browse files Browse the repository at this point in the history
)
  • Loading branch information
endrift committed Oct 5, 2020
1 parent 830aea2 commit 3f10823
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 9 deletions.
1 change: 1 addition & 0 deletions CHANGES
Expand Up @@ -48,6 +48,7 @@ Emulation fixes:
- GBA Video: Fix rare regression blending semitransparent sprites (fixes mgba.io/i/1876)
- GBA Video: Emulate sprite cycle limits in OpenGL renderer (fixes mgba.io/i/1635)
- GBA Video: Do not affect OBJ pixel priority when writing OBJWIN (fixes mgba.io/i/1890)
- GBA Video: Fix deferred blending when OBJWIN matches window (fixes mgba.io/i/1905)
- SM83: Emulate HALT bug
Other fixes:
- 3DS: Redo video sync to be more precise
Expand Down
19 changes: 10 additions & 9 deletions src/gba/renderers/video-software.c
Expand Up @@ -644,17 +644,18 @@ static void GBAVideoSoftwareRendererDrawScanline(struct GBAVideoRenderer* render
}
if (softwareRenderer->forceTarget1 && (softwareRenderer->blendEffect == BLEND_DARKEN || softwareRenderer->blendEffect == BLEND_BRIGHTEN)) {
x = 0;
uint32_t mask = FLAG_REBLEND | FLAG_IS_BACKGROUND;
uint32_t match = FLAG_REBLEND;
if (GBARegisterDISPCNTIsObjwinEnable(softwareRenderer->dispcnt)) {
mask |= FLAG_OBJWIN;
if (GBAWindowControlIsBlendEnable(softwareRenderer->objwin.packed)) {
match |= FLAG_OBJWIN;
}
}
for (w = 0; w < softwareRenderer->nWindows; ++w) {
int end = softwareRenderer->windows[w].endX;
if (!GBAWindowControlIsBlendEnable(softwareRenderer->windows[w].control.packed)) {
uint32_t mask = FLAG_REBLEND | FLAG_IS_BACKGROUND;
uint32_t match = FLAG_REBLEND;
bool objBlend = GBAWindowControlIsBlendEnable(softwareRenderer->objwin.packed);
bool winBlend = GBAWindowControlIsBlendEnable(softwareRenderer->windows[w].control.packed);
if (GBARegisterDISPCNTIsObjwinEnable(softwareRenderer->dispcnt) && objBlend != winBlend) {
mask |= FLAG_OBJWIN;
if (objBlend) {
match |= FLAG_OBJWIN;
}
} else if (!winBlend) {
x = end;
continue;
}
Expand Down

0 comments on commit 3f10823

Please sign in to comment.