From 79a3df36a919eac0bc26afc9943549ae95eef8be Mon Sep 17 00:00:00 2001 From: Jesse <69196954+ThisAMJ@users.noreply.github.com> Date: Mon, 27 Nov 2023 21:26:50 +1100 Subject: [PATCH] fix: unclamp frame time untested because apparently my pc sucks and cant pull 1000, and i dont know what to look for below 10 Fixes #130 --- src/Modules/Engine.cpp | 4 ++++ src/OffsetsData.hpp | 1 + 2 files changed, 5 insertions(+) diff --git a/src/Modules/Engine.cpp b/src/Modules/Engine.cpp index db6a0aea9..7bc07d5f4 100644 --- a/src/Modules/Engine.cpp +++ b/src/Modules/Engine.cpp @@ -649,6 +649,7 @@ bool Engine::IsSkipping() { } static float *host_frametime; +static float *host_frametime_unbounded; void Host_AccumulateTime_Detour(float dt); void (*Host_AccumulateTime)(float dt); static Hook Host_AccumulateTime_Hook(&Host_AccumulateTime_Detour); @@ -657,10 +658,12 @@ void Host_AccumulateTime_Detour(float dt) { Host_AccumulateTime_Hook.Disable(); Host_AccumulateTime(dt); Host_AccumulateTime_Hook.Enable(); + *host_frametime = *host_frametime_unbounded; } else if (g_advance > 0) { Host_AccumulateTime_Hook.Disable(); Host_AccumulateTime(1.0f/60); Host_AccumulateTime_Hook.Enable(); + *host_frametime = *host_frametime_unbounded; --g_advance; } else { *host_frametime = 0; @@ -998,6 +1001,7 @@ bool Engine::Init() { host_frametime = *(float **)((uintptr_t)Host_AccumulateTime + 70); } #endif + host_frametime_unbounded = host_frametime + Offsets::host_frametime_unbounded; Host_AccumulateTime_Hook.SetFunc(Host_AccumulateTime); diff --git a/src/OffsetsData.hpp b/src/OffsetsData.hpp index c96bbd84a..08d736c75 100644 --- a/src/OffsetsData.hpp +++ b/src/OffsetsData.hpp @@ -30,6 +30,7 @@ OFFSET_DEFAULT(Con_IsVisible, 11, 11) OFFSET_DEFAULT(GetLevelNameShort, 53, 53) OFFSET_DEFAULT(GetLightForPoint, 1, 1) OFFSET_DEFAULT(GetPlayerInfo, 8, 8); +OFFSET_DEFAULT(host_frametime_unbounded, 1, -1); // CHLClient OFFSET_DEFAULT(GetAllClasses, 8, 8)