update 60fps patch

This commit is contained in:
fgsfds 2020-07-09 17:33:04 +03:00
parent 4b15a8f7b6
commit 54ca76162a

View file

@ -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);