mirror of
https://github.com/libretro/gambatte-libretro.git
synced 2024-11-23 16:00:06 +00:00
Merge pull request #15 from Alcaro/master
Fix GB colorization in 16bit mode.
This commit is contained in:
commit
50fc339c79
@ -107,6 +107,8 @@ private:
|
||||
GB(const GB &);
|
||||
GB & operator=(const GB &);
|
||||
};
|
||||
|
||||
video_pixel_t gbcToRgb32(const unsigned bgr15);
|
||||
}
|
||||
|
||||
#endif
|
||||
|
@ -495,12 +495,4 @@ static const unsigned short * findGbcPal(const char *const title) {
|
||||
return findGbcTitlePal(title);
|
||||
}
|
||||
|
||||
static unsigned long gbcToRgb32(const unsigned rgb15) {
|
||||
const unsigned long r = rgb15 >> 10 & 0x1F;
|
||||
const unsigned long g = rgb15 >> 5 & 0x1F;
|
||||
const unsigned long b = rgb15 & 0x1F;
|
||||
|
||||
return ((r * 13 + g * 2 + b) >> 1) << 16 | (g * 3 + b) << 9 | (r * 3 + g * 2 + b * 11) >> 1;
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -1,8 +1,7 @@
|
||||
#include "libretro.h"
|
||||
#include "blipper.h"
|
||||
#include "gbcpalettes.h"
|
||||
|
||||
#include <gambatte.h>
|
||||
#include "gbcpalettes.h"
|
||||
|
||||
#include <assert.h>
|
||||
#include <stdio.h>
|
||||
@ -256,6 +255,11 @@ static void check_palette(void)
|
||||
fprintf(stderr, "[Gambatte]: unable to read palette color in %s, line %d (color left as default).\n", custom_palette_path.c_str(), line_count);
|
||||
continue;
|
||||
}
|
||||
#ifdef VIDEO_RGB565
|
||||
rgb32=(rgb32&0x0000F8)>>3 |//red
|
||||
(rgb32&0x00FC00)>>5 |//green
|
||||
(rgb32&0xF80000)>>8;//blue
|
||||
#endif
|
||||
|
||||
if (startswith(line, "Background0="))
|
||||
gb.setDmgPaletteColor(0, 0, rgb32);
|
||||
@ -328,7 +332,7 @@ static void check_variables(void)
|
||||
{
|
||||
for (unsigned colornum = 0; colornum < 4; ++colornum)
|
||||
{
|
||||
rgb32 = gbcToRgb32(gbc_bios_palette[palnum * 4 + colornum]);
|
||||
rgb32 = gambatte::gbcToRgb32(gbc_bios_palette[palnum * 4 + colornum]);
|
||||
gb.setDmgPaletteColor(palnum, colornum, rgb32);
|
||||
}
|
||||
}
|
||||
|
@ -30,7 +30,7 @@ void LCD::setDmgPalette(video_pixel_t *const palette, const video_pixel_t *const
|
||||
palette[3] = dmgColors[data >> 6 & 3];
|
||||
}
|
||||
|
||||
static video_pixel_t gbcToRgb32(const unsigned bgr15) {
|
||||
video_pixel_t gbcToRgb32(const unsigned bgr15) {
|
||||
#ifdef VIDEO_RGB565
|
||||
//If (whatever made the Gambatte devs create this somewhat arcane configuration) is not a concern, it can be replaced with simply 'return bgr15'.
|
||||
const unsigned r = bgr15 & 0x1F;
|
||||
|
Loading…
Reference in New Issue
Block a user