GB Video: Darken colors in GBA mode

This commit is contained in:
Vicki Pfau 2018-07-04 12:28:55 -07:00
parent d620faba0a
commit 4767ae42d2
2 changed files with 21 additions and 1 deletions

View File

@ -66,6 +66,7 @@ Misc:
- GB Audio: Improved audio quality
- GB, GBA Audio: Increase max audio volume
- GB: Fix VRAM/palette locking (fixes mgba.io/i/1109)
- GB Video: Darken colors in GBA mode
0.6.3: (2017-04-14)
Bugfixes:

View File

@ -437,10 +437,29 @@ static void GBVideoSoftwareRendererWritePalette(struct GBVideoRenderer* renderer
color = softwareRenderer->palette[0];
}
}
softwareRenderer->palette[index] = color;
if (renderer->cache) {
mCacheSetWritePalette(renderer->cache, index, color);
}
if (softwareRenderer->model == GB_MODEL_AGB) {
unsigned r = M_R5(value);
unsigned g = M_G5(value);
unsigned b = M_B5(value);
r = r * r;
g = g * g;
b = b * b;
#ifdef COLOR_16_BIT
r /= 31;
g /= 31;
b /= 31;
color = mColorFrom555(r | (g << 5) | (b << 10));
#else
r >>= 2;
g >>= 2;
b >>= 2;
color = r | (g << 8) | (b << 16);
#endif
}
softwareRenderer->palette[index] = color;
if (softwareRenderer->model == GB_MODEL_SGB && !index && GBRegisterLCDCIsEnable(softwareRenderer->lcdc)) {
renderer->writePalette(renderer, 0x04, value);