From 9dfbc9bdce15c299faf06aa7bf68a8660366daee Mon Sep 17 00:00:00 2001 From: ameerj <52414509+ameerj@users.noreply.github.com> Date: Thu, 22 Jul 2021 19:56:21 -0400 Subject: general: Rename "Frame Limit" references to "Speed Limit" This setting is best referred to as a speed limit, as it involves the limits of all timing based aspects of the emulator, not only framerate. This allows us to differentiate it from the fps unlocker setting. --- src/core/perf_stats.cpp | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) (limited to 'src/core/perf_stats.cpp') diff --git a/src/core/perf_stats.cpp b/src/core/perf_stats.cpp index 6635a1339..c9ded49d0 100644 --- a/src/core/perf_stats.cpp +++ b/src/core/perf_stats.cpp @@ -127,15 +127,15 @@ double PerfStats::GetLastFrameTimeScale() const { return duration_cast(previous_frame_length).count() / FRAME_LENGTH; } -void FrameLimiter::DoFrameLimiting(microseconds current_system_time_us) { - if (!Settings::values.use_frame_limit.GetValue() || +void SpeedLimiter::DoSpeedLimiting(microseconds current_system_time_us) { + if (!Settings::values.use_speed_limit.GetValue() || Settings::values.use_multi_core.GetValue()) { return; } auto now = Clock::now(); - const double sleep_scale = Settings::values.frame_limit.GetValue() / 100.0; + const double sleep_scale = Settings::values.speed_limit.GetValue() / 100.0; // Max lag caused by slow frames. Shouldn't be more than the length of a frame at the current // speed percent or it will clamp too much and prevent this from properly limiting to that @@ -143,17 +143,17 @@ void FrameLimiter::DoFrameLimiting(microseconds current_system_time_us) { // limiting const microseconds max_lag_time_us = duration_cast( std::chrono::duration(25ms / sleep_scale)); - frame_limiting_delta_err += duration_cast( + speed_limiting_delta_err += duration_cast( std::chrono::duration( (current_system_time_us - previous_system_time_us) / sleep_scale)); - frame_limiting_delta_err -= duration_cast(now - previous_walltime); - frame_limiting_delta_err = - std::clamp(frame_limiting_delta_err, -max_lag_time_us, max_lag_time_us); + speed_limiting_delta_err -= duration_cast(now - previous_walltime); + speed_limiting_delta_err = + std::clamp(speed_limiting_delta_err, -max_lag_time_us, max_lag_time_us); - if (frame_limiting_delta_err > microseconds::zero()) { - std::this_thread::sleep_for(frame_limiting_delta_err); + if (speed_limiting_delta_err > microseconds::zero()) { + std::this_thread::sleep_for(speed_limiting_delta_err); auto now_after_sleep = Clock::now(); - frame_limiting_delta_err -= duration_cast(now_after_sleep - now); + speed_limiting_delta_err -= duration_cast(now_after_sleep - now); now = now_after_sleep; } -- cgit v1.2.3