diff --git a/CHANGES b/CHANGES index 4d2aeafd0..34020c283 100644 --- a/CHANGES +++ b/CHANGES @@ -61,6 +61,7 @@ Misc: - GBA Cheats: Implement "never" type codes (closes mgba.io/i/915) - GBA DMA: Enhanced logging (closes mgba.io/i/2454) - GBA Video: Implement layer placement for OpenGL renderer (fixes mgba.io/i/1962) + - GBA Video: Fix highlighting for sprites with mid-frame palette changes - mGUI: Add margin to right-aligned menu text (fixes mgba.io/i/871) - mGUI: Autosave less frequently when fast-forwarding - Qt: Rearrange menus some diff --git a/src/gba/renderers/video-software.c b/src/gba/renderers/video-software.c index 7c78d2173..35737a9e3 100644 --- a/src/gba/renderers/video-software.c +++ b/src/gba/renderers/video-software.c @@ -437,6 +437,14 @@ static void GBAVideoSoftwareRendererWritePalette(struct GBAVideoRenderer* render } else if (softwareRenderer->blendEffect == BLEND_DARKEN) { softwareRenderer->variantPalette[address >> 1] = _darken(color, softwareRenderer->bldy); } + int highlightAmount = renderer->highlightAmount >> 4; + if (highlightAmount) { + softwareRenderer->highlightPalette[address >> 1] = mColorMix5Bit(0x10 - highlightAmount, softwareRenderer->normalPalette[address >> 1], highlightAmount, renderer->highlightColor); + softwareRenderer->highlightVariantPalette[address >> 1] = mColorMix5Bit(0x10 - highlightAmount, softwareRenderer->variantPalette[address >> 1], highlightAmount, renderer->highlightColor); + } else { + softwareRenderer->highlightPalette[address >> 1] = softwareRenderer->normalPalette[address >> 1]; + softwareRenderer->highlightVariantPalette[address >> 1] = softwareRenderer->variantPalette[address >> 1]; + } if (renderer->cache) { mCacheSetWritePalette(renderer->cache, address >> 1, color); }