all repos — mgba @ e0eefa24da253ee1cfce2c86f757fc6c576ae46c

mGBA Game Boy Advance Emulator

Hack to guess when blending should be disabled
Jeffrey Pfau jeffrey@endrift.com
Fri, 01 Nov 2013 23:39:26 -0700
commit

e0eefa24da253ee1cfce2c86f757fc6c576ae46c

parent

a87d30ed9f32fa7645906621780a37d0ddf7114d

1 files changed, 10 insertions(+), 2 deletions(-)

jump to
M src/gba/renderers/video-software.csrc/gba/renderers/video-software.c

@@ -1267,7 +1267,11 @@ flags |= FLAG_TARGET_2 *renderer->target2Obj;

flags |= FLAG_OBJWIN * (sprite->mode == OBJ_MODE_OBJWIN); int x = sprite->x; unsigned charBase = BASE_TILE + sprite->tile * 0x20; - int variant = renderer->target1Obj && renderer->currentWindow.blendEnable && sprite->mode != OBJ_MODE_SEMITRANSPARENT && (renderer->blendEffect == BLEND_BRIGHTEN || renderer->blendEffect == BLEND_DARKEN); + int variant = renderer->target1Obj && renderer->currentWindow.blendEnable && (renderer->blendEffect == BLEND_BRIGHTEN || renderer->blendEffect == BLEND_DARKEN); + if (sprite->mode == OBJ_MODE_SEMITRANSPARENT && renderer->target2Bd) { + // Hack: if a sprite is blended, then the variant palette is not used, but we don't know if it's blended in advance + variant = 0; + } color_t* palette = renderer->normalPalette; if (variant) { palette = renderer->variantPalette;

@@ -1335,7 +1339,11 @@ flags |= FLAG_OBJWIN * (sprite->mode == OBJ_MODE_OBJWIN);

int x = sprite->x; unsigned charBase = BASE_TILE + sprite->tile * 0x20; struct GBAOAMMatrix* mat = &renderer->d.oam->mat[sprite->matIndex]; - int variant = renderer->target1Obj && renderer->currentWindow.blendEnable && sprite->mode != OBJ_MODE_SEMITRANSPARENT && (renderer->blendEffect == BLEND_BRIGHTEN || renderer->blendEffect == BLEND_DARKEN); + int variant = renderer->target1Obj && renderer->currentWindow.blendEnable && (renderer->blendEffect == BLEND_BRIGHTEN || renderer->blendEffect == BLEND_DARKEN); + if (sprite->mode == OBJ_MODE_SEMITRANSPARENT && renderer->target2Bd) { + // Hack: if a sprite is blended, then the variant palette is not used, but we don't know if it's blended in advance + variant = 0; + } color_t* palette = renderer->normalPalette; if (variant) { palette = renderer->variantPalette;