diff --git a/command_event.c b/command_event.c index 1f11b63b79..a3b5b2c2f4 100644 --- a/command_event.c +++ b/command_event.c @@ -1729,7 +1729,7 @@ bool event_command(enum event_command cmd) event_set_volume(-0.5f); break; case EVENT_CMD_SET_FRAME_LIMIT: - rarch_main_set_frame_limit_last_time(); + rarch_main_ctl(RARCH_MAIN_CTL_SET_FRAME_LIMIT_LAST_TIME, NULL); break; case EVENT_CMD_NONE: default: diff --git a/runloop.c b/runloop.c index 480ea05eab..340f83dc64 100644 --- a/runloop.c +++ b/runloop.c @@ -828,18 +828,6 @@ void rarch_main_state_free(void) main_max_frames = 0; } -void rarch_main_set_frame_limit_last_time(void) -{ - settings_t *settings = config_get_ptr(); - struct retro_system_av_info *av_info = video_viewport_get_system_av_info(); - float fastforward_ratio = settings->fastforward_ratio; - - if (fastforward_ratio == 0.0f) - fastforward_ratio = 1.0f; - - frame_limit_last_time = retro_get_time_usec(); - frame_limit_minimum_time = (retro_time_t)roundf(1000000.0f / (av_info->timing.fps * fastforward_ratio)); -} void rarch_main_global_free(void) { @@ -883,8 +871,22 @@ void rarch_main_set_max_frames(unsigned val) bool rarch_main_ctl(enum rarch_main_ctl_state state, void *data) { + settings_t *settings = config_get_ptr(); + switch (state) { + case RARCH_MAIN_CTL_SET_FRAME_LIMIT_LAST_TIME: + { + struct retro_system_av_info *av_info = video_viewport_get_system_av_info(); + float fastforward_ratio = settings->fastforward_ratio; + + if (fastforward_ratio == 0.0f) + fastforward_ratio = 1.0f; + + frame_limit_last_time = retro_get_time_usec(); + frame_limit_minimum_time = (retro_time_t)roundf(1000000.0f / (av_info->timing.fps * fastforward_ratio)); + } + return true; case RARCH_MAIN_CTL_IS_IDLE: { bool *ptr = (bool*)data; diff --git a/runloop.h b/runloop.h index d903abe365..131fc64fbc 100644 --- a/runloop.h +++ b/runloop.h @@ -40,7 +40,8 @@ enum rarch_main_ctl_state RARCH_MAIN_CTL_IS_SLOWMOTION, RARCH_MAIN_CTL_SET_SLOWMOTION, RARCH_MAIN_CTL_IS_PAUSED, - RARCH_MAIN_CTL_SET_PAUSED + RARCH_MAIN_CTL_SET_PAUSED, + RARCH_MAIN_CTL_SET_FRAME_LIMIT_LAST_TIME }; typedef struct rarch_resolution @@ -339,8 +340,6 @@ FILE *rarch_main_log_file(void); bool rarch_main_ctl(enum rarch_main_ctl_state state, void *data); -void rarch_main_set_frame_limit_last_time(void); - void rarch_main_set_max_frames(unsigned val); void rarch_main_state_free(void);