Move minimum_frame_time/last_frame_time to g_runloop

This commit is contained in:
twinaphex 2015-03-07 13:43:31 +01:00
parent e39d5188a3
commit be4d15f2df
3 changed files with 13 additions and 12 deletions

View File

@ -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
{

View File

@ -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)

View File

@ -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;
}
/**