diff --git a/src/platform/libretro/libretro.c b/src/platform/libretro/libretro.c index c7c3876b4..071e19c57 100644 --- a/src/platform/libretro/libretro.c +++ b/src/platform/libretro/libretro.c @@ -63,6 +63,27 @@ static void _reloadSettings(void) { }; struct retro_variable var; + enum GBModel model; + const char* modelName; + + var.key = "mgba_model"; + var.value = 0; + if (environCallback(RETRO_ENVIRONMENT_GET_VARIABLE, &var) && var.value) { + if (strcmp(var.value, "Game Boy") == 0) { + model = GB_MODEL_DMG; + } else if (strcmp(var.value, "Super Game Boy") == 0) { + model = GB_MODEL_SGB; + } else if (strcmp(var.value, "Game Boy Color") == 0) { + model = GB_MODEL_CGB; + } else { + model = GB_MODEL_AUTODETECT; + } + + modelName = GBModelToName(model); + mCoreConfigSetDefaultValue(&core->config, "gb.model", modelName); + mCoreConfigSetDefaultValue(&core->config, "sgb.model", modelName); + mCoreConfigSetDefaultValue(&core->config, "cgb.model", modelName); + } var.key = "mgba_use_bios"; var.value = 0; @@ -119,6 +140,7 @@ void retro_set_environment(retro_environment_t env) { struct retro_variable vars[] = { { "mgba_solar_sensor_level", "Solar sensor level; 0|1|2|3|4|5|6|7|8|9|10" }, { "mgba_allow_opposing_directions", "Allow opposing directional input; OFF|ON" }, + { "mgba_model", "Game Boy model (requires restart); Autodetect|Game Boy|Super Game Boy|Game Boy Color" }, { "mgba_use_bios", "Use BIOS file if found (requires restart); ON|OFF" }, { "mgba_skip_bios", "Skip BIOS intro (requires restart); OFF|ON" }, { "mgba_sgb_borders", "Use Super Game Boy borders (requires restart); ON|OFF" },