Sanitize fastforward_ratio value when loading a config file

in case it's <= 0.0
This commit is contained in:
twinaphex 2014-10-03 19:07:40 +02:00
parent 557789a479
commit b7d47f3df9
2 changed files with 8 additions and 7 deletions

View File

@ -2531,15 +2531,10 @@ static inline void update_frame_time(void)
static void limit_frame_time(void)
{
double effective_fps, mft_f;
retro_time_t current = rarch_get_time_usec();
retro_time_t target = 0, to_sleep_ms = 0;
float ffr = g_settings.fastforward_ratio;
if (ffr <= 0.0)
ffr = -1.0;
effective_fps = (g_extern.system.av_info.timing.fps * ffr);
mft_f = 1000000.0f / effective_fps;
double effective_fps = (g_extern.system.av_info.timing.fps * g_settings.fastforward_ratio);
double mft_f = 1000000.0f / effective_fps;
g_extern.frame_limit.minimum_frame_time = (retro_time_t) roundf(mft_f);

View File

@ -1087,6 +1087,12 @@ static bool config_load_file(const char *path, bool set_defaults)
g_settings.slowmotion_ratio = 1.0f;
CONFIG_GET_FLOAT(fastforward_ratio, "fastforward_ratio");
/* Sanitize fastforward_ratio value - previously range was -1
* and up (with 0 being skipped) */
if (g_settings.fastforward_ratio <= 0.0f)
g_settings.fastforward_ratio = 1.0f;
CONFIG_GET_BOOL(fastforward_ratio_throttle_enable, "fastforward_ratio_throttle_enable");
CONFIG_GET_BOOL(pause_nonactive, "pause_nonactive");