From 115eea3828467bae694a13e70a45664f2772700c Mon Sep 17 00:00:00 2001 From: Alug Date: Mon, 17 Feb 2025 20:40:22 +0100 Subject: [PATCH 1/3] revert all the server ticking stuff --- src/d_clisrv.c | 30 +++++++++++++----------------- 1 file changed, 13 insertions(+), 17 deletions(-) diff --git a/src/d_clisrv.c b/src/d_clisrv.c index 107597223..16fc0e187 100644 --- a/src/d_clisrv.c +++ b/src/d_clisrv.c @@ -6394,21 +6394,19 @@ boolean TryRunTics(tic_t realtics) } #endif - ticking = neededtic > gametic; - - if (ticking) + if (neededtic > gametic) { - if (realtics) - hu_stopped = false; + hu_stopped = false; } if (player_joining) { - if (realtics) - hu_stopped = true; + hu_stopped = true; return false; } + ticking = neededtic > gametic; + if (ticking) { // run the count * tics @@ -6668,14 +6666,6 @@ void NetUpdate(void) if (realtics <= 0) // nothing new to update return; - if (realtics > 5) - { - if (server) - realtics = 1; - else - realtics = 5; - } - #ifdef DEDICATEDIDLETIME if (server && dedicated && gamestate == GS_LEVEL) { @@ -6724,6 +6714,14 @@ void NetUpdate(void) } #endif + if (realtics > 5) + { + if (server) + realtics = 1; + else + realtics = 5; + } + gametime = nowtime; UpdatePingTable(); @@ -6817,8 +6815,6 @@ void NetUpdate(void) Net_AckTicker(); HandleNodeTimeouts(); - nowtime /= NEWTICRATERATIO; - if (nowtime > resptime) { resptime = nowtime; From 58fd729bec7ab409b3be16e120708681702d3a04 Mon Sep 17 00:00:00 2001 From: Alug Date: Mon, 3 Mar 2025 00:14:25 +0100 Subject: [PATCH 2/3] temp revert nanosleep for nix --- src/sdl/i_system.c | 11 +---------- 1 file changed, 1 insertion(+), 10 deletions(-) diff --git a/src/sdl/i_system.c b/src/sdl/i_system.c index 353fd0f82..337f24de3 100644 --- a/src/sdl/i_system.c +++ b/src/sdl/i_system.c @@ -2130,16 +2130,7 @@ void I_Sleep(UINT32 ms) void I_SleepDuration(precise_t duration) { -#if defined(__linux__) || defined(__FreeBSD__) || defined(__HAIKU__) - UINT64 precision = I_GetPrecisePrecision(); - struct timespec ts = { - .tv_sec = duration / precision, - .tv_nsec = duration * 1000000000 / precision % 1000000000, - }; - int status; - do status = clock_nanosleep(CLOCK_MONOTONIC, 0, &ts, &ts); - while (status == EINTR); -#elif defined (MIN_SLEEP_DURATION_MS) +#if defined (MIN_SLEEP_DURATION_MS) UINT64 precision = I_GetPrecisePrecision(); INT32 sleepvalue = cv_sleep.value; UINT64 delaygranularity; From fac2e8ec9837fcc57c149adced523be815456021 Mon Sep 17 00:00:00 2001 From: Alug Date: Mon, 3 Mar 2025 09:56:49 +0100 Subject: [PATCH 3/3] tiny cleanup keyboard stuff --- src/sdl/i_video.c | 40 ++++++++++++++++++++++++---------------- 1 file changed, 24 insertions(+), 16 deletions(-) diff --git a/src/sdl/i_video.c b/src/sdl/i_video.c index 83564bfab..bca0a7840 100644 --- a/src/sdl/i_video.c +++ b/src/sdl/i_video.c @@ -417,13 +417,15 @@ static INT32 Impl_SDL_Scancode_To_Keycode(SDL_Scancode code) } // Get the equivalent ASCII (Unicode?) character for a keypress. -static INT32 GetTypedChar(SDL_Scancode code, SDL_Keysym *sym) +static INT32 GetTypedChar(SDL_Keysym keysym) { SDL_Event next_event; - boolean Text_Input_Only = (chat_on || CON_Ready() || (menu_text_input && menuactive)); //only use this this if on chat or console or the current menu wants inputs from us (except if its the control setup menu ig) + SDL_Keycode keycode = keysym.sym; + SDL_Scancode scancode = keysym.scancode; + const boolean Text_Input_Only = (chat_on || CON_Ready() || (menu_text_input && menuactive)); // only use this this if on chat or console or the current menu wants inputs from us (except if its the control setup menu ig) // Special cases, where we always return a fixed value. - switch (sym->sym) + switch (keycode) { case SDLK_BACKSPACE: return KEY_BACKSPACE; case SDLK_RETURN: return KEY_ENTER; @@ -440,13 +442,13 @@ static INT32 GetTypedChar(SDL_Scancode code, SDL_Keysym *sym) } } - return Impl_SDL_Scancode_To_Keycode(code); //fallback + return Impl_SDL_Scancode_To_Keycode(scancode); // fallback } static INT32 Impl_SDL_Keysym_To_Keycode(SDL_Keysym keysym) { - SDL_Keycode keycode= keysym.sym; - SDL_Scancode scancode= keysym.scancode; + SDL_Keycode keycode = keysym.sym; + SDL_Scancode scancode = keysym.scancode; if (keycode >= SDLK_a && keycode <= SDLK_z) { @@ -457,15 +459,14 @@ static INT32 Impl_SDL_Keysym_To_Keycode(SDL_Keysym keysym) { return KEY_F1 + (keycode - SDLK_F1); } - if(scancode == SDL_SCANCODE_APOSTROPHE) + + switch (scancode) { - return KEY_FR_U_GRAVE; - } - switch(scancode){ case SDL_SCANCODE_APOSTROPHE: return KEY_FR_U_GRAVE; case SDL_SCANCODE_LEFTBRACKET: return '^'; default: break; } + switch (keycode) { // F11 and F12 are separated from the rest of the function keys @@ -858,6 +859,7 @@ static void Impl_HandleWindowEvent(SDL_WindowEvent evt) static void Impl_HandleKeyboardEvent(SDL_KeyboardEvent evt, Uint32 type) { event_t event; + if (type == SDL_KEYUP) { event.type = ev_keyup; @@ -871,12 +873,18 @@ static void Impl_HandleKeyboardEvent(SDL_KeyboardEvent evt, Uint32 type) return; } - if (cv_keyboardlayout.value == 2) - event.data1 = GetTypedChar(evt.keysym.scancode, &evt.keysym); - else if (cv_keyboardlayout.value == 3) - event.data1 = Impl_SDL_Keysym_To_Keycode(evt.keysym); - else - event.data1 = Impl_SDL_Scancode_To_Keycode(evt.keysym.scancode); + switch (cv_keyboardlayout.value) + { + case 2: // "native" + event.data1 = GetTypedChar(evt.keysym); + break; + case 3: // AZERTY + event.data1 = Impl_SDL_Keysym_To_Keycode(evt.keysym); + break; + default: + event.data1 = Impl_SDL_Scancode_To_Keycode(evt.keysym.scancode); + break; + } if (event.data1) D_PostEvent(&event); }