diff --git a/config.def.h b/config.def.h index 160836b117..780da0552d 100644 --- a/config.def.h +++ b/config.def.h @@ -582,8 +582,11 @@ static const bool savestate_auto_load = false; /* Slowmotion ratio. */ static const float slowmotion_ratio = 3.0; -/* Maximum fast forward ratio (Zero => no limit). */ -static const float fastforward_ratio = -1.0; +/* Maximum fast forward ratio. */ +static const float fastforward_ratio = 1.0; + +/* Throttle fast forward. */ +static const bool fastforward_ratio_throttle_enable = false; /* Enable stdin/network command interface. */ static const bool network_cmd_enable = false; diff --git a/frontend/menu/menu_action.c b/frontend/menu/menu_action.c index 9d01c9d72e..982b7f5724 100644 --- a/frontend/menu/menu_action.c +++ b/frontend/menu/menu_action.c @@ -159,30 +159,6 @@ int menu_action_setting_fraction( setting->cmd_trigger.triggered = true; } } - else if (!strcmp(setting->name, "fastforward_ratio")) - { - bool clamp_value = false; - if (action == MENU_ACTION_START) - *setting->value.fraction = setting->default_value.fraction; - else if (action == MENU_ACTION_LEFT) - { - *setting->value.fraction -= setting->step; - - /* Avoid potential rounding errors when going from 1.1 to 1.0. */ - if (*setting->value.fraction < 0.95f) - *setting->value.fraction = setting->default_value.fraction; - else - clamp_value = true; - } - else if (action == MENU_ACTION_RIGHT) - { - *setting->value.fraction += setting->step; - clamp_value = true; - } - if (clamp_value) - g_settings.fastforward_ratio = - max(min(*setting->value.fraction, setting->max), 1.0f); - } else { switch (action) diff --git a/general.h b/general.h index a76fa5acd6..68085f142f 100644 --- a/general.h +++ b/general.h @@ -382,6 +382,7 @@ struct settings float slowmotion_ratio; float fastforward_ratio; + bool fastforward_ratio_throttle_enable; bool pause_nonactive; unsigned autosave_interval; diff --git a/retroarch.c b/retroarch.c index f66cf52f1f..a4c1f1f76b 100644 --- a/retroarch.c +++ b/retroarch.c @@ -3184,7 +3184,7 @@ void rarch_main_command(unsigned cmd) static inline void do_limit_frame_time(void) { - if (g_settings.fastforward_ratio >= 0.0f) + if (g_settings.fastforward_ratio_throttle_enable) limit_frame_time(); } diff --git a/retroarch.cfg b/retroarch.cfg index 8a5a06bd07..f19fc87955 100644 --- a/retroarch.cfg +++ b/retroarch.cfg @@ -622,8 +622,10 @@ # The maximum rate at which content will be run when using fast forward. (E.g. 5.0 for 60 fps content => 300 fps cap). # RetroArch will go to sleep to ensure that the maximum rate will not be exceeded. # Do not rely on this cap to be perfectly accurate. -# A ratio of zero equals no FPS cap. -# fastforward_ratio = 0.0 +# fastforward_ratio = 1.0 + +# Setting this to false equals no FPS cap and will override the fastforward_ratio value. +# fastforward_ratio_throttle_enable = false # Enable stdin/network command interface. # network_cmd_enable = false diff --git a/settings.c b/settings.c index b2357d068e..f97033b9dc 100644 --- a/settings.c +++ b/settings.c @@ -407,6 +407,7 @@ static void config_set_defaults(void) g_settings.rewind_granularity = rewind_granularity; g_settings.slowmotion_ratio = slowmotion_ratio; g_settings.fastforward_ratio = fastforward_ratio; + g_settings.fastforward_ratio_throttle_enable = fastforward_ratio_throttle_enable; g_settings.pause_nonactive = pause_nonactive; g_settings.autosave_interval = autosave_interval; @@ -1086,6 +1087,7 @@ static bool config_load_file(const char *path, bool set_defaults) g_settings.slowmotion_ratio = 1.0f; CONFIG_GET_FLOAT(fastforward_ratio, "fastforward_ratio"); + CONFIG_GET_BOOL(fastforward_ratio_throttle_enable, "fastforward_ratio_throttle_enable"); CONFIG_GET_BOOL(pause_nonactive, "pause_nonactive"); CONFIG_GET_INT(autosave_interval, "autosave_interval"); @@ -1667,6 +1669,7 @@ bool config_save_file(const char *path) g_settings.savestate_auto_load); config_set_float(conf, "fastforward_ratio", g_settings.fastforward_ratio); + config_set_bool(conf, "fastforward_ratio_throttle_enable", g_settings.fastforward_ratio_throttle_enable); config_set_float(conf, "slowmotion_ratio", g_settings.slowmotion_ratio); config_set_bool(conf, "config_save_on_exit", diff --git a/settings_data.c b/settings_data.c index 6717f06e3a..cf3c7771e6 100644 --- a/settings_data.c +++ b/settings_data.c @@ -2330,7 +2330,8 @@ rarch_setting_t *setting_data_get_list(void) #endif CONFIG_BOOL(g_settings.video.disable_composition, "video_disable_composition", "Window Compositing Disable", disable_composition, "OFF", "ON", GROUP_NAME, SUBGROUP_NAME, general_write_handler, general_read_handler) WITH_CMD(RARCH_CMD_REINIT) WITH_FLAGS(SD_FLAG_CMD_APPLY_AUTO) CONFIG_BOOL(g_settings.pause_nonactive, "pause_nonactive", "Window Unfocus Pause", pause_nonactive, "OFF", "ON", GROUP_NAME, SUBGROUP_NAME, general_write_handler, general_read_handler) - CONFIG_FLOAT(g_settings.fastforward_ratio, "fastforward_ratio", "Maximum Run Speed", fastforward_ratio, "%.1fx", GROUP_NAME, SUBGROUP_NAME, general_write_handler, general_read_handler) WITH_RANGE(0, 10, 0.1, true, true) + CONFIG_BOOL(g_settings.fastforward_ratio_throttle_enable, "fastforward_ratio_throttle_enable", "Limit Maximum Run Speed", fastforward_ratio_throttle_enable, "OFF", "ON", GROUP_NAME, SUBGROUP_NAME, general_write_handler, general_read_handler) + CONFIG_FLOAT(g_settings.fastforward_ratio, "fastforward_ratio", "Maximum Run Speed", fastforward_ratio, "%.1fx", GROUP_NAME, SUBGROUP_NAME, general_write_handler, general_read_handler) WITH_RANGE(1, 10, 0.1, true, true) CONFIG_FLOAT(g_settings.slowmotion_ratio, "slowmotion_ratio", "Slow-Motion Ratio", slowmotion_ratio, "%.1fx", GROUP_NAME, SUBGROUP_NAME, general_write_handler, general_read_handler) WITH_RANGE(1, 10, 1.0, true, true) CONFIG_BOOL(g_settings.savestate_auto_index, "savestate_auto_index", "Save State Auto Index", savestate_auto_index, "OFF", "ON", GROUP_NAME, SUBGROUP_NAME, general_write_handler, general_read_handler) CONFIG_BOOL(g_settings.savestate_auto_save, "savestate_auto_save", "Auto Save State", savestate_auto_save, "OFF", "ON", GROUP_NAME, SUBGROUP_NAME, general_write_handler, general_read_handler)