From 94b0826a045fab935ff81ea2c9ac15f5768d9ff0 Mon Sep 17 00:00:00 2001 From: bones_was_here Date: Sat, 29 Jul 2023 20:36:21 +1000 Subject: [PATCH] Fix host.framecount It never incremented if sleep was called, and could have eventually become negative. Signed-off-by: bones_was_here --- host.c | 6 +----- host.h | 2 +- 2 files changed, 2 insertions(+), 6 deletions(-) diff --git a/host.c b/host.c index 543ab5a6..1929ebad 100644 --- a/host.c +++ b/host.c @@ -744,14 +744,10 @@ void Host_Main(void) sleeptime = Host_Frame(time); oldtime = newtime; + ++host.framecount; if (sleeptime >= 1) - { Host_Sleep(sleeptime); - continue; - } - - host.framecount++; } return; diff --git a/host.h b/host.h index 26465423..109948c5 100644 --- a/host.h +++ b/host.h @@ -20,7 +20,7 @@ typedef struct host_static_s { jmp_buf abortframe; int state; - int framecount; // incremented every frame, never reset (checked by Host_Error and Host_SaveConfig_f) + unsigned int framecount; // incremented every frame, never reset (checked by Host_Error and Host_SaveConfig_f) double realtime; // the accumulated mainloop time since application started (with filtering), without any slowmo or clamping double dirtytime; // the main loop wall time for this frame, equal to Sys_DirtyTime() at the start of this host frame double sleeptime; // time spent sleeping overall -- 2.39.2