Libretro: Allow choosing the Game Boy model

This commit is contained in:
Douglas Christman 2018-03-24 19:09:27 +08:00 committed by endrift
parent ea2159d159
commit eddd3851bc
1 changed files with 22 additions and 0 deletions

View File

@ -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" },