mirror of https://github.com/mgba-emu/mgba.git
GB Core: Support reloading palette at runtime
This commit is contained in:
parent
ad14408739
commit
e0db333ea3
|
@ -299,6 +299,51 @@ static void _GBCoreReloadConfigOption(struct mCore* core, const char* option, co
|
|||
gb->video.renderer->enableSGBBorder(gb->video.renderer, fakeBool);
|
||||
}
|
||||
}
|
||||
|
||||
if (strcmp("gb.pal", option) == 0) {
|
||||
int color;
|
||||
if (mCoreConfigGetIntValue(config, "gb.pal[0]", &color)) {
|
||||
GBVideoSetPalette(&gb->video, 0, color);
|
||||
}
|
||||
if (mCoreConfigGetIntValue(config, "gb.pal[1]", &color)) {
|
||||
GBVideoSetPalette(&gb->video, 1, color);
|
||||
}
|
||||
if (mCoreConfigGetIntValue(config, "gb.pal[2]", &color)) {
|
||||
GBVideoSetPalette(&gb->video, 2, color);
|
||||
}
|
||||
if (mCoreConfigGetIntValue(config, "gb.pal[3]", &color)) {
|
||||
GBVideoSetPalette(&gb->video, 3, color);
|
||||
}
|
||||
if (mCoreConfigGetIntValue(config, "gb.pal[4]", &color)) {
|
||||
GBVideoSetPalette(&gb->video, 4, color);
|
||||
}
|
||||
if (mCoreConfigGetIntValue(config, "gb.pal[5]", &color)) {
|
||||
GBVideoSetPalette(&gb->video, 5, color);
|
||||
}
|
||||
if (mCoreConfigGetIntValue(config, "gb.pal[6]", &color)) {
|
||||
GBVideoSetPalette(&gb->video, 6, color);
|
||||
}
|
||||
if (mCoreConfigGetIntValue(config, "gb.pal[7]", &color)) {
|
||||
GBVideoSetPalette(&gb->video, 7, color);
|
||||
}
|
||||
if (mCoreConfigGetIntValue(config, "gb.pal[8]", &color)) {
|
||||
GBVideoSetPalette(&gb->video, 8, color);
|
||||
}
|
||||
if (mCoreConfigGetIntValue(config, "gb.pal[9]", &color)) {
|
||||
GBVideoSetPalette(&gb->video, 9, color);
|
||||
}
|
||||
if (mCoreConfigGetIntValue(config, "gb.pal[10]", &color)) {
|
||||
GBVideoSetPalette(&gb->video, 10, color);
|
||||
}
|
||||
if (mCoreConfigGetIntValue(config, "gb.pal[11]", &color)) {
|
||||
GBVideoSetPalette(&gb->video, 11, color);
|
||||
}
|
||||
if (gb->model < GB_MODEL_SGB) {
|
||||
GBVideoWritePalette(&gb->video, GB_REG_BGP, gb->memory.io[GB_REG_BGP]);
|
||||
GBVideoWritePalette(&gb->video, GB_REG_OBP0, gb->memory.io[GB_REG_OBP0]);
|
||||
GBVideoWritePalette(&gb->video, GB_REG_OBP1, gb->memory.io[GB_REG_OBP1]);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
static void _GBCoreDesiredVideoDimensions(const struct mCore* core, unsigned* width, unsigned* height) {
|
||||
|
|
|
@ -289,14 +289,15 @@ void CoreController::loadConfig(ConfigController* config) {
|
|||
updateFastForward();
|
||||
mCoreThreadRewindParamsChanged(&m_threadContext);
|
||||
}
|
||||
if (sizeBefore != sizeAfter) {
|
||||
#ifdef M_CORE_GB
|
||||
if (sizeBefore != sizeAfter) {
|
||||
mCoreConfigSetIntValue(&m_threadContext.core->config, "sgb.borders", 0);
|
||||
m_threadContext.core->reloadConfigOption(m_threadContext.core, "sgb.borders", nullptr);
|
||||
mCoreConfigCopyValue(&m_threadContext.core->config, config->config(), "sgb.borders");
|
||||
m_threadContext.core->reloadConfigOption(m_threadContext.core, "sgb.borders", nullptr);
|
||||
#endif
|
||||
}
|
||||
m_threadContext.core->reloadConfigOption(m_threadContext.core, "gb.pal", config->config());
|
||||
#endif
|
||||
}
|
||||
|
||||
#ifdef USE_DEBUGGERS
|
||||
|
|
Loading…
Reference in New Issue