From 5c7de32a7c22b0e2c8de63229816a34d64b66071 Mon Sep 17 00:00:00 2001 From: fgsfds Date: Thu, 9 Jul 2020 17:33:04 +0300 Subject: [PATCH] update 60fps patch --- enhancements/60fps_ex.patch | 18 +++++++++++------- 1 file changed, 11 insertions(+), 7 deletions(-) diff --git a/enhancements/60fps_ex.patch b/enhancements/60fps_ex.patch index fe7c6e24..9f459359 100644 --- a/enhancements/60fps_ex.patch +++ b/enhancements/60fps_ex.patch @@ -1890,24 +1890,28 @@ index 0467495..fa4eb33 100644 using namespace Microsoft::WRL; // For ComPtr diff --git a/src/pc/gfx/gfx_sdl2.c b/src/pc/gfx/gfx_sdl2.c -index aef2978..ff53b27 100644 +index 25c9f06..a6461ae 100644 --- a/src/pc/gfx/gfx_sdl2.c +++ b/src/pc/gfx/gfx_sdl2.c @@ -53,7 +53,7 @@ static void (*kb_all_keys_up)(void) = NULL; // whether to use timer for frame control static bool use_timer = true; // time between consequtive game frames --static const Uint32 frame_time = 1000 / FRAMERATE; -+static const Uint32 frame_time = 1000 / (2 * FRAMERATE); - static Uint32 frame_start = 0; +-static const int frame_time = 1000 / FRAMERATE; ++static const int frame_time = 1000 / (2 * FRAMERATE); const SDL_Scancode windows_scancode_table[] = { -@@ -142,7 +142,7 @@ static inline void gfx_sdl_set_vsync(int mode) { - if (mode > 1) { + /* 0 1 2 3 4 5 6 7 */ +@@ -142,7 +142,11 @@ static inline void gfx_sdl_set_vsync(const bool enabled) { + if (enabled) { // try to detect refresh rate SDL_GL_SetSwapInterval(1); - const int vblanks = test_vsync(); -+ const int vblanks = test_vsync() / 2; ++ int vblanks = test_vsync(); ++ if (vblanks & 1) ++ vblanks = 0; // not divisible by 60, fuck that ++ else ++ vblanks /= 2; if (vblanks) { printf("determined swap interval: %d\n", vblanks); SDL_GL_SetSwapInterval(vblanks);