From e02e553facc671d2ac7b3914be265dae74956b51 Mon Sep 17 00:00:00 2001 From: Jesse <69196954+ThisAMJ@users.noreply.github.com> Date: Fri, 19 Jul 2024 17:35:52 +1000 Subject: [PATCH] fix: `host_timescale` loads (mostly... it removes *most* of the timescale effect on loads) Fixes #247 Approximately cuts loading times in half? Depends on hardware, and I'm unsure if this is the optimal value. --- src/Modules/Engine.cpp | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/Modules/Engine.cpp b/src/Modules/Engine.cpp index db2eeef9a..e05b4a9df 100644 --- a/src/Modules/Engine.cpp +++ b/src/Modules/Engine.cpp @@ -695,6 +695,12 @@ void Host_AccumulateTime_Detour(float dt) { *host_frametime_unbounded = 0; } + // HACK: Force frametime to equal 2 ticks when loading + // Limits host_timescale effect on load times, faster loads + if (g_cap_frametime == 1 && sar_loads_uncap.GetBool()) { + *host_frametime = *host_frametime_unbounded = 2.0f/60; + } + if (*host_frametime != *host_frametime_unbounded) { if (sar_frametime_uncap.GetBool() && g_cap_frametime == 0) { if (sar_frametime_debug.GetBool()) console->Print("Host_AccumulateTime: %f (uncapped from %f)\n", *host_frametime_unbounded, *host_frametime);