mirror of
https://github.com/CTCaer/RetroArch.git
synced 2025-03-05 09:57:06 +00:00
Refactor away rarch_main_set_frame_limit_last_time
This commit is contained in:
parent
aed0cb8d21
commit
7e6b6d8be6
@ -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:
|
||||
|
26
runloop.c
26
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;
|
||||
|
@ -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);
|
||||
|
Loading…
x
Reference in New Issue
Block a user