Libretro: Add frameskip option
Vicki Pfau vi@endrift.com
Fri, 12 Jan 2018 20:52:15 -0800
2 files changed,
20 insertions(+),
5 deletions(-)
M
src/platform/libretro/libretro.c
→
src/platform/libretro/libretro.c
@@ -88,6 +88,13 @@ mCoreConfigSetDefaultValue(&core->config, "idleOptimization", "detect");
} } + var.key = "mgba_frameskip"; + var.value = 0; + if (environCallback(RETRO_ENVIRONMENT_GET_VARIABLE, &var) && var.value) { + opts.frameskip = strtol(var.value, NULL, 10); + + } + mCoreConfigLoadDefaults(&core->config, &opts); mCoreLoadConfig(core); }@@ -105,6 +112,7 @@ { "mgba_allow_opposing_directions", "Allow opposing directional input; OFF|ON" },
{ "mgba_use_bios", "Use BIOS file if found (requires restart); ON|OFF" }, { "mgba_skip_bios", "Skip BIOS intro (requires restart); OFF|ON" }, { "mgba_idle_optimization", "Idle loop removal; Remove Known|Detect and Remove|Don't Remove" }, + { "mgba_frameskip", "Frameskip; 0|1|2|3|4|5|6|7|8|9|10" }, { 0, 0 } };@@ -222,15 +230,21 @@ void retro_run(void) {
uint16_t keys; inputPollCallback(); - struct retro_variable var = { - .key = "mgba_allow_opposing_directions", - .value = 0 - }; - bool updated = false; if (environCallback(RETRO_ENVIRONMENT_GET_VARIABLE_UPDATE, &updated) && updated) { + struct retro_variable var = { + .key = "mgba_allow_opposing_directions", + .value = 0 + }; if (environCallback(RETRO_ENVIRONMENT_GET_VARIABLE, &var) && var.value) { ((struct GBA*) core->board)->allowOpposingDirections = strcmp(var.value, "yes") == 0; + } + + var.key = "mgba_frameskip"; + var.value = 0; + if (environCallback(RETRO_ENVIRONMENT_GET_VARIABLE, &var) && var.value) { + mCoreConfigSetUIntValue(&core->config, "frameskip", strtol(var.value, NULL, 10)); + mCoreLoadConfig(core); } }