From 3be0cfe09c2db48db353fc19e596bd9f315eff58 Mon Sep 17 00:00:00 2001 From: pstef <3462925+pstef@users.noreply.github.com> Date: Thu, 20 Mar 2025 21:44:39 +0000 Subject: [PATCH] Allow frame_time_accumulator to go negative to be able to catch the underflow and correct it. --- gfx/video_driver.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/gfx/video_driver.c b/gfx/video_driver.c index b54779c8e7..436b018526 100644 --- a/gfx/video_driver.c +++ b/gfx/video_driver.c @@ -3645,7 +3645,7 @@ void video_driver_frame(const void *data, unsigned width, static retro_time_t curr_time; static retro_time_t fps_time; static float last_fps, frame_time; - static uint16_t frame_time_accumulator; + static int32_t frame_time_accumulator; /* Mark the start of nonblock state for * ignoring initial previous frame time */ static int8_t nonblock_active; @@ -3729,7 +3729,7 @@ void video_driver_frame(const void *data, unsigned width, || (last_frame_duped && !!data)) ) { - uint16_t frame_time_accumulator_prev = frame_time_accumulator; + int32_t frame_time_accumulator_prev = frame_time_accumulator; uint16_t frame_time_delta = new_time - last_time; uint16_t frame_time_target = video_info.frame_time_target;