From ed95f8863dc0c48500f035737bf29a32a11d01a9 Mon Sep 17 00:00:00 2001 From: Geoffrey McRae Date: Sun, 8 Nov 2020 10:58:18 +1100 Subject: [PATCH] [client] fix divide by zero fault with fpsMin disabled (set to 0) --- client/src/config.h | 2 +- client/src/main.c | 4 ++-- client/src/main.h | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/client/src/config.h b/client/src/config.h index cd1af77b..e3143548 100644 --- a/client/src/config.h +++ b/client/src/config.h @@ -21,4 +21,4 @@ Place, Suite 330, Boston, MA 02111-1307 USA void config_init(); bool config_load(int argc, char * argv[]); -void config_free(); \ No newline at end of file +void config_free(); diff --git a/client/src/main.c b/client/src/main.c index 36c764a9..d6f531cd 100644 --- a/client/src/main.c +++ b/client/src/main.c @@ -166,7 +166,7 @@ static int renderThread(void * unused) while(state.state != APP_STATE_SHUTDOWN) { - if (state.frameTime > 0) + if (params.fpsMin != 0) { lgWaitEventAbs(e_frame, &time); clock_gettime(CLOCK_MONOTONIC, &time); @@ -1472,7 +1472,7 @@ static int lg_run() // ensure renderer viewport is aware of the current window size updatePositionInfo(); - if (params.fpsMin == -1) + if (params.fpsMin <= 0) { // default 30 fps state.frameTime = 1000000000ULL / 30ULL; diff --git a/client/src/main.h b/client/src/main.h index 201609f1..0ba249e0 100644 --- a/client/src/main.h +++ b/client/src/main.h @@ -138,7 +138,7 @@ struct AppParams bool center; int x, y; unsigned int w, h; - unsigned int fpsMin; + int fpsMin; bool showFPS; bool useSpiceInput; bool useSpiceClipboard;