mirror of https://github.com/mgba-emu/mgba.git
GB: Allow setting DMG palette
This commit is contained in:
parent
f73fd7f3da
commit
ba65740b15
|
@ -139,6 +139,8 @@ void GBVideoWriteLYC(struct GBVideo* video, uint8_t value);
|
||||||
void GBVideoWritePalette(struct GBVideo* video, uint16_t address, uint8_t value);
|
void GBVideoWritePalette(struct GBVideo* video, uint16_t address, uint8_t value);
|
||||||
void GBVideoSwitchBank(struct GBVideo* video, uint8_t value);
|
void GBVideoSwitchBank(struct GBVideo* video, uint8_t value);
|
||||||
|
|
||||||
|
void GBVideoSetPalette(struct GBVideo* video, unsigned index, uint16_t color);
|
||||||
|
|
||||||
struct GBSerializedState;
|
struct GBSerializedState;
|
||||||
void GBVideoSerialize(const struct GBVideo* video, struct GBSerializedState* state);
|
void GBVideoSerialize(const struct GBVideo* video, struct GBSerializedState* state);
|
||||||
void GBVideoDeserialize(struct GBVideo* video, const struct GBSerializedState* state);
|
void GBVideoDeserialize(struct GBVideo* video, const struct GBSerializedState* state);
|
||||||
|
|
|
@ -105,6 +105,21 @@ static void _GBCoreLoadConfig(struct mCore* core, const struct mCoreConfig* conf
|
||||||
gb->audio.masterVolume = core->opts.volume;
|
gb->audio.masterVolume = core->opts.volume;
|
||||||
}
|
}
|
||||||
gb->video.frameskip = core->opts.frameskip;
|
gb->video.frameskip = core->opts.frameskip;
|
||||||
|
|
||||||
|
int color;
|
||||||
|
if (mCoreConfigGetIntValue(&core->config, "gb.pal[0]", &color)) {
|
||||||
|
GBVideoSetPalette(&gb->video, 0, color);
|
||||||
|
}
|
||||||
|
if (mCoreConfigGetIntValue(&core->config, "gb.pal[1]", &color)) {
|
||||||
|
GBVideoSetPalette(&gb->video, 1, color);
|
||||||
|
}
|
||||||
|
if (mCoreConfigGetIntValue(&core->config, "gb.pal[2]", &color)) {
|
||||||
|
GBVideoSetPalette(&gb->video, 2, color);
|
||||||
|
}
|
||||||
|
if (mCoreConfigGetIntValue(&core->config, "gb.pal[3]", &color)) {
|
||||||
|
GBVideoSetPalette(&gb->video, 3, color);
|
||||||
|
}
|
||||||
|
|
||||||
mCoreConfigCopyValue(&core->config, config, "gb.bios");
|
mCoreConfigCopyValue(&core->config, config, "gb.bios");
|
||||||
mCoreConfigCopyValue(&core->config, config, "gbc.bios");
|
mCoreConfigCopyValue(&core->config, config, "gbc.bios");
|
||||||
|
|
||||||
|
|
|
@ -439,6 +439,13 @@ void GBVideoSwitchBank(struct GBVideo* video, uint8_t value) {
|
||||||
video->vramCurrentBank = value;
|
video->vramCurrentBank = value;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void GBVideoSetPalette(struct GBVideo* video, unsigned index, uint16_t color) {
|
||||||
|
if (index >= 4) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
video->dmgPalette[index] = color;
|
||||||
|
}
|
||||||
|
|
||||||
static void GBVideoDummyRendererInit(struct GBVideoRenderer* renderer, enum GBModel model) {
|
static void GBVideoDummyRendererInit(struct GBVideoRenderer* renderer, enum GBModel model) {
|
||||||
UNUSED(renderer);
|
UNUSED(renderer);
|
||||||
UNUSED(model);
|
UNUSED(model);
|
||||||
|
|
Loading…
Reference in New Issue