mirror of
https://github.com/dolphin-emu/dolphin.git
synced 2025-07-22 22:00:39 -06:00
Throttler: Rename "framelimiter" to "emulation speed".
We don't throttle by frames, we throttle by coretiming speed. So looking up VI for calculating the speed was just very wrong. The new ini option is a float, 1.0f for fullspeed. In the GUI, percentual values are used.
This commit is contained in:
@ -195,21 +195,21 @@ static void ThrottleCallback(u64 last_time, int cyclesLate)
|
||||
|
||||
int diff = (u32)last_time - time;
|
||||
const SConfig& config = SConfig::GetInstance();
|
||||
bool frame_limiter = config.m_Framelimit && !Core::GetIsFramelimiterTempDisabled();
|
||||
bool frame_limiter = config.m_EmulationSpeed > 0.0f && !Core::GetIsThrottlerTempDisabled();
|
||||
u32 next_event = GetTicksPerSecond()/1000;
|
||||
if (config.m_Framelimit > 1)
|
||||
if (frame_limiter)
|
||||
{
|
||||
next_event = next_event * (config.m_Framelimit - 1) * 5 / VideoInterface::TargetRefreshRate;
|
||||
if (config.m_EmulationSpeed != 1.0f)
|
||||
next_event = u32(next_event * config.m_EmulationSpeed);
|
||||
const int max_fallback = config.iTimingVariance;
|
||||
if (abs(diff) > max_fallback)
|
||||
{
|
||||
DEBUG_LOG(COMMON, "system too %s, %d ms skipped", diff<0 ? "slow" : "fast", abs(diff) - max_fallback);
|
||||
last_time = time - max_fallback;
|
||||
}
|
||||
else if (diff > 0)
|
||||
Common::SleepCurrentThread(diff);
|
||||
}
|
||||
|
||||
const int max_fallback = config.iTimingVariance;
|
||||
if (frame_limiter && abs(diff) > max_fallback)
|
||||
{
|
||||
DEBUG_LOG(COMMON, "system too %s, %d ms skipped", diff<0 ? "slow" : "fast", abs(diff) - max_fallback);
|
||||
last_time = time - max_fallback;
|
||||
}
|
||||
else if (frame_limiter && diff > 0)
|
||||
Common::SleepCurrentThread(diff);
|
||||
CoreTiming::ScheduleEvent(next_event - cyclesLate, et_Throttle, last_time + 1);
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user