From 98bc47dc0218cb699798dabc0e60871d66044533 Mon Sep 17 00:00:00 2001 From: ASpoonPlaysGames <66967891+ASpoonPlaysGames@users.noreply.github.com> Date: Tue, 27 Aug 2024 22:06:48 +0100 Subject: [PATCH] Manually hook OnRenderStart --- primedev/client/latencyflex.cpp | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/primedev/client/latencyflex.cpp b/primedev/client/latencyflex.cpp index 395578709..df1ff2ac9 100644 --- a/primedev/client/latencyflex.cpp +++ b/primedev/client/latencyflex.cpp @@ -6,15 +6,13 @@ ConVar* Cvar_r_latencyflex; void (*m_winelfx_WaitAndBeginFrame)(); -// clang-format off -AUTOHOOK(OnRenderStart, client.dll + 0x1952C0, -void, __fastcall, ()) -// clang-format on +void(__fastcall* o_pOnRenderStart)() = nullptr; +void __fastcall h_OnRenderStart() { if (Cvar_r_latencyflex->GetBool() && m_winelfx_WaitAndBeginFrame) m_winelfx_WaitAndBeginFrame(); - OnRenderStart(); + o_pOnRenderStart(); } ON_DLL_LOAD_CLIENT_RELIESON("client.dll", LatencyFlex, ConVar, (CModule module)) @@ -37,6 +35,8 @@ ON_DLL_LOAD_CLIENT_RELIESON("client.dll", LatencyFlex, ConVar, (CModule module)) } AUTOHOOK_DISPATCH() + o_pOnRenderStart = module.Offset(0x1952C0).RCast(); + HookAttach(&(PVOID&)o_pOnRenderStart, (PVOID)h_OnRenderStart); spdlog::info("LatencyFleX initialized."); Cvar_r_latencyflex = new ConVar("r_latencyflex", "1", FCVAR_ARCHIVE, "Whether or not to use LatencyFleX input latency reduction.");