all repos — mgba @ 4767ae42d292514186b85694beac061037822394

mGBA Game Boy Advance Emulator

GB Video: Darken colors in GBA mode
Vicki Pfau vi@endrift.com
Wed, 04 Jul 2018 12:28:55 -0700
commit

4767ae42d292514186b85694beac061037822394

parent

d620faba0a106abd916e1a909492d3a28853b70b

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

jump to
M CHANGESCHANGES

@@ -66,6 +66,7 @@ - Qt: Add load alternate save option

- 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:
M src/gb/renderers/software.csrc/gb/renderers/software.c

@@ -437,10 +437,29 @@ } else if (index >= 0x40 && !(index & 0xF)) {

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);