From 9b72524511b1971c57c3995842a99ef3fd350727 Mon Sep 17 00:00:00 2001 From: nyanpasu64 Date: Sat, 8 Jul 2023 21:05:40 -0700 Subject: [PATCH] Fix delay before throttling emulation after fast-forward ends Previously `m_throttle_deadline` was not being updated during fast-forward, causing the emulator to try to render as many frames as possible in zero seconds. And when you released fast-forward, the emulator would continue to fast-forward for an emulated time equal to the physical time you held the key, waiting for `m_throttle_deadline` to catch up to the physical time. This was only limited when the "System can not to keep up with timings!" fallback would keep the target timebase 100ms before the current time, so the emulator would never fast-forward more than 100ms emulated time after you released Tab. Instead update `m_throttle_deadline` to track wall-clock time, so emulation resumes throttling as usual once fast-forward ends. --- Source/Core/Core/CoreTiming.cpp | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/Source/Core/Core/CoreTiming.cpp b/Source/Core/Core/CoreTiming.cpp index 8e5d489a58..3c2a49092d 100644 --- a/Source/Core/Core/CoreTiming.cpp +++ b/Source/Core/Core/CoreTiming.cpp @@ -373,6 +373,11 @@ void CoreTimingManager::Throttle(const s64 target_cycle) const TimePoint min_deadline = time - m_max_fallback; const TimePoint max_deadline = time + m_max_fallback; + if (speed <= 0.0) + { + m_throttle_deadline = time; + } + if (m_throttle_deadline > max_deadline) { m_throttle_deadline = max_deadline;