GB Video: Increase palette entry width to 24 bits

This commit is contained in:
Vicki Pfau 2017-06-13 22:15:48 -07:00
parent 0cc49ac4fb
commit aa8f77c18f
3 changed files with 6 additions and 3 deletions

View File

@ -31,6 +31,9 @@ typedef uint32_t color_t;
#define M_G8(X) (((((X) >> 2) & 0xF8) * 0x21) >> 5)
#define M_B8(X) (((((X) >> 7) & 0xF8) * 0x21) >> 5)
#define M_RGB5_TO_RGB8(X) ((M_R5(X) << 3) | (M_G5(X) << 11) | (M_B5(X) << 19))
#define M_RGB8_TO_RGB5(X) ((((X) & 0xF8) >> 3) | (((X) & 0xF800) >> 6) | (((X) & 0xF80000) >> 9))
struct blip_t;
struct mCoreCallbacks {

View File

@ -144,7 +144,7 @@ void GBVideoWriteLYC(struct GBVideo* video, uint8_t value);
void GBVideoWritePalette(struct GBVideo* video, uint16_t address, uint8_t value);
void GBVideoSwitchBank(struct GBVideo* video, uint8_t value);
void GBVideoSetPalette(struct GBVideo* video, unsigned index, uint16_t color);
void GBVideoSetPalette(struct GBVideo* video, unsigned index, uint32_t color);
struct GBSerializedState;
void GBVideoSerialize(const struct GBVideo* video, struct GBSerializedState* state);

View File

@ -471,11 +471,11 @@ void GBVideoSwitchBank(struct GBVideo* video, uint8_t value) {
video->vramCurrentBank = value;
}
void GBVideoSetPalette(struct GBVideo* video, unsigned index, uint16_t color) {
void GBVideoSetPalette(struct GBVideo* video, unsigned index, uint32_t color) {
if (index >= 4) {
return;
}
video->dmgPalette[index] = color;
video->dmgPalette[index] = M_RGB8_TO_RGB5(color);
}
static void GBVideoDummyRendererInit(struct GBVideoRenderer* renderer, enum GBModel model) {