From 62ced7973bb6a995245fc062a402d12a2d57a449 Mon Sep 17 00:00:00 2001 From: PeachyPeach <72323920+PeachyPeachSM64@users.noreply.github.com> Date: Sun, 29 Dec 2024 19:41:59 +0100 Subject: [PATCH] Fix FPS again (#592) --- src/pc/pc_main.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/pc/pc_main.c b/src/pc/pc_main.c index 6ea06a348..153ae2a60 100644 --- a/src/pc/pc_main.c +++ b/src/pc/pc_main.c @@ -198,7 +198,11 @@ void produce_interpolation_frames_and_delay(void) { remainingTime / (f64) MAX(1, configFrameLimit - sDrawnFrames) ); - if (!configUncappedFramerate && (remainingTime < 0.0 || sDrawnFrames >= configFrameLimit)) { + // Reset counters if: + // - Freeze/lag happens during at least 1 game update + // - No time left for drawing the remaining frames + // - All frames are already drawn + if (!configUncappedFramerate && (curTime > targetTime || remainingTime < 0.0 || sDrawnFrames >= configFrameLimit)) { compute_fps(sPeriodTimeStart, curTime); sPeriodTimeStart = curTime; sFrameTimeStart = curTime;