all repos — mgba @ 046f7a3374395a4446db4fdd70ac8cbea9755df0

mGBA Game Boy Advance Emulator

GBA Video: Fix resetting palettes
Vicki Pfau vi@endrift.com
Tue, 01 Dec 2020 21:23:48 -0800
commit

046f7a3374395a4446db4fdd70ac8cbea9755df0

parent

aaf1fef5ade790f1e57887e78ff92e5302c3d882

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

jump to
M src/gba/renderers/gl.csrc/gba/renderers/gl.c

@@ -931,9 +931,18 @@ glRenderer->firstY = -1;

glRenderer->dispcnt = 0x0080; glRenderer->mosaic = 0; glRenderer->nextPalette = 0; - glRenderer->lastPalette = 1; + glRenderer->lastPalette = GBA_VIDEO_VERTICAL_PIXELS - 1; memset(glRenderer->shadowRegs, 0, sizeof(glRenderer->shadowRegs)); glRenderer->regsDirty = 0xFFFFFFFFFFFEULL; + + int i; + for (i = 0; i < 512; ++i) { + int r = M_R5(glRenderer->d.palette[i]); + int g = M_G5(glRenderer->d.palette[i]) << 1; + g |= g >> 5; + int b = M_B5(glRenderer->d.palette[i]); + glRenderer->shadowPalette[0][i] = (r << 11) | (g << 5) | b; + } } void GBAVideoGLRendererWriteVRAM(struct GBAVideoRenderer* renderer, uint32_t address) {