mirror of
https://github.com/libretro/RetroArch.git
synced 2024-11-28 02:30:35 +00:00
Move minimum_frame_time/last_frame_time to g_runloop
This commit is contained in:
parent
e39d5188a3
commit
be4d15f2df
11
general.h
11
general.h
@ -461,6 +461,12 @@ struct runloop
|
||||
unsigned count;
|
||||
unsigned max;
|
||||
} video;
|
||||
|
||||
struct
|
||||
{
|
||||
retro_time_t minimum_time;
|
||||
retro_time_t last_time;
|
||||
} limit;
|
||||
} frames;
|
||||
|
||||
struct
|
||||
@ -558,11 +564,6 @@ struct global
|
||||
unsigned windowed_scale;
|
||||
} pending;
|
||||
|
||||
struct
|
||||
{
|
||||
retro_time_t minimum_frame_time;
|
||||
retro_time_t last_frame_time;
|
||||
} frame_limit;
|
||||
|
||||
struct
|
||||
{
|
||||
|
@ -1761,7 +1761,7 @@ static void validate_cpu_features(void)
|
||||
static void init_system_av_info(void)
|
||||
{
|
||||
pretro_get_system_av_info(&g_extern.system.av_info);
|
||||
g_extern.frame_limit.last_frame_time = rarch_get_time_usec();
|
||||
g_runloop.frames.limit.last_time = rarch_get_time_usec();
|
||||
}
|
||||
|
||||
static void deinit_core(void)
|
||||
|
12
runloop.c
12
runloop.c
@ -698,23 +698,23 @@ static void limit_frame_time(void)
|
||||
* g_settings.fastforward_ratio;
|
||||
mft_f = 1000000.0f / effective_fps;
|
||||
|
||||
g_extern.frame_limit.minimum_frame_time = (retro_time_t) roundf(mft_f);
|
||||
g_runloop.frames.limit.minimum_time = (retro_time_t) roundf(mft_f);
|
||||
|
||||
target = g_extern.frame_limit.last_frame_time +
|
||||
g_extern.frame_limit.minimum_frame_time;
|
||||
target = g_runloop.frames.limit.last_time +
|
||||
g_runloop.frames.limit.minimum_time;
|
||||
to_sleep_ms = (target - current) / 1000;
|
||||
|
||||
if (to_sleep_ms <= 0)
|
||||
{
|
||||
g_extern.frame_limit.last_frame_time = rarch_get_time_usec();
|
||||
g_runloop.frames.limit.last_time = rarch_get_time_usec();
|
||||
return;
|
||||
}
|
||||
|
||||
rarch_sleep((unsigned int)to_sleep_ms);
|
||||
|
||||
/* Combat jitter a bit. */
|
||||
g_extern.frame_limit.last_frame_time +=
|
||||
g_extern.frame_limit.minimum_frame_time;
|
||||
g_runloop.frames.limit.last_time +=
|
||||
g_runloop.frames.limit.minimum_time;
|
||||
}
|
||||
|
||||
/**
|
||||
|
Loading…
Reference in New Issue
Block a user