all repos — mgba @ 45e0ce8e27994ed66e696ea7a67628c4aeb40a98

mGBA Game Boy Advance Emulator

GB Video: Fix highlighting after modifying GB palettes
Vicki Pfau vi@endrift.com
Sun, 22 Nov 2020 15:36:21 -0800
commit

45e0ce8e27994ed66e696ea7a67628c4aeb40a98

parent

7918b5af453872dd1d7ea04ece0248bf787904ec

1 files changed, 12 insertions(+), 12 deletions(-)

jump to
M src/gb/renderers/software.csrc/gb/renderers/software.c

@@ -300,30 +300,30 @@ softwareRenderer->lookup[0] = value & 3;

softwareRenderer->lookup[1] = (value >> 2) & 3; softwareRenderer->lookup[2] = (value >> 4) & 3; softwareRenderer->lookup[3] = (value >> 6) & 3; - softwareRenderer->lookup[PAL_HIGHLIGHT_BG + 0] = value & 3; - softwareRenderer->lookup[PAL_HIGHLIGHT_BG + 1] = (value >> 2) & 3; - softwareRenderer->lookup[PAL_HIGHLIGHT_BG + 2] = (value >> 4) & 3; - softwareRenderer->lookup[PAL_HIGHLIGHT_BG + 3] = (value >> 6) & 3; + softwareRenderer->lookup[PAL_HIGHLIGHT_BG + 0] = PAL_HIGHLIGHT + (value & 3); + softwareRenderer->lookup[PAL_HIGHLIGHT_BG + 1] = PAL_HIGHLIGHT + ((value >> 2) & 3); + softwareRenderer->lookup[PAL_HIGHLIGHT_BG + 2] = PAL_HIGHLIGHT + ((value >> 4) & 3); + softwareRenderer->lookup[PAL_HIGHLIGHT_BG + 3] = PAL_HIGHLIGHT + ((value >> 6) & 3); break; case GB_REG_OBP0: softwareRenderer->lookup[PAL_OBJ + 0] = value & 3; softwareRenderer->lookup[PAL_OBJ + 1] = (value >> 2) & 3; softwareRenderer->lookup[PAL_OBJ + 2] = (value >> 4) & 3; softwareRenderer->lookup[PAL_OBJ + 3] = (value >> 6) & 3; - softwareRenderer->lookup[PAL_HIGHLIGHT_OBJ + 0] = value & 3; - softwareRenderer->lookup[PAL_HIGHLIGHT_OBJ + 1] = (value >> 2) & 3; - softwareRenderer->lookup[PAL_HIGHLIGHT_OBJ + 2] = (value >> 4) & 3; - softwareRenderer->lookup[PAL_HIGHLIGHT_OBJ + 3] = (value >> 6) & 3; + softwareRenderer->lookup[PAL_HIGHLIGHT_OBJ + 0] = PAL_HIGHLIGHT + (value & 3); + softwareRenderer->lookup[PAL_HIGHLIGHT_OBJ + 1] = PAL_HIGHLIGHT + ((value >> 2) & 3); + softwareRenderer->lookup[PAL_HIGHLIGHT_OBJ + 2] = PAL_HIGHLIGHT + ((value >> 4) & 3); + softwareRenderer->lookup[PAL_HIGHLIGHT_OBJ + 3] = PAL_HIGHLIGHT + ((value >> 6) & 3); break; case GB_REG_OBP1: softwareRenderer->lookup[PAL_OBJ + 4] = value & 3; softwareRenderer->lookup[PAL_OBJ + 5] = (value >> 2) & 3; softwareRenderer->lookup[PAL_OBJ + 6] = (value >> 4) & 3; softwareRenderer->lookup[PAL_OBJ + 7] = (value >> 6) & 3; - softwareRenderer->lookup[PAL_HIGHLIGHT_OBJ + 4] = value & 3; - softwareRenderer->lookup[PAL_HIGHLIGHT_OBJ + 5] = (value >> 2) & 3; - softwareRenderer->lookup[PAL_HIGHLIGHT_OBJ + 6] = (value >> 4) & 3; - softwareRenderer->lookup[PAL_HIGHLIGHT_OBJ + 7] = (value >> 6) & 3; + softwareRenderer->lookup[PAL_HIGHLIGHT_OBJ + 4] = PAL_HIGHLIGHT + (value & 3); + softwareRenderer->lookup[PAL_HIGHLIGHT_OBJ + 5] = PAL_HIGHLIGHT + ((value >> 2) & 3); + softwareRenderer->lookup[PAL_HIGHLIGHT_OBJ + 6] = PAL_HIGHLIGHT + ((value >> 4) & 3); + softwareRenderer->lookup[PAL_HIGHLIGHT_OBJ + 7] = PAL_HIGHLIGHT + ((value >> 6) & 3); break; } return value;