aboutsummaryrefslogtreecommitdiff
path: root/NorthstarDLL/latencyflex.cpp
diff options
context:
space:
mode:
authorBobTheBob9 <for.oliver.kirkham@gmail.com>2022-08-22 21:59:18 +0100
committerBobTheBob9 <for.oliver.kirkham@gmail.com>2022-08-22 21:59:18 +0100
commitee8ae568bc42cb5311edd7294eb0f8f2ae078bd1 (patch)
tree9cb1cdb308d81772812cd4456f94634ee10b6670 /NorthstarDLL/latencyflex.cpp
parent921668fd9578d514258edec7432b656cc5d7041d (diff)
downloadNorthstarLauncher-ee8ae568bc42cb5311edd7294eb0f8f2ae078bd1.tar.gz
NorthstarLauncher-ee8ae568bc42cb5311edd7294eb0f8f2ae078bd1.zip
add more prs
Diffstat (limited to 'NorthstarDLL/latencyflex.cpp')
-rw-r--r--NorthstarDLL/latencyflex.cpp21
1 files changed, 11 insertions, 10 deletions
diff --git a/NorthstarDLL/latencyflex.cpp b/NorthstarDLL/latencyflex.cpp
index b9d232b2..7b5a8ebf 100644
--- a/NorthstarDLL/latencyflex.cpp
+++ b/NorthstarDLL/latencyflex.cpp
@@ -5,14 +5,12 @@ AUTOHOOK_INIT()
ConVar* Cvar_r_latencyflex;
-HMODULE m_lfxModule {};
-typedef void (*PFN_winelfx_WaitAndBeginFrame)();
-PFN_winelfx_WaitAndBeginFrame m_winelfx_WaitAndBeginFrame {};
+void (*m_winelfx_WaitAndBeginFrame)();
AUTOHOOK(OnRenderStart, client.dll + 0x1952C0,
void,, ())
{
- if (Cvar_r_latencyflex->GetInt())
+ if (Cvar_r_latencyflex->GetBool() && m_winelfx_WaitAndBeginFrame)
m_winelfx_WaitAndBeginFrame();
OnRenderStart();
@@ -23,9 +21,15 @@ ON_DLL_LOAD_CLIENT_RELIESON("client.dll", LatencyFlex, ConVar, (CModule module))
// Connect to the LatencyFleX service
// LatencyFleX is an open source vendor agnostic replacement for Nvidia Reflex input latency reduction technology.
// https://ishitatsuyuki.github.io/post/latencyflex/
- m_lfxModule = LoadLibraryA("latencyflex_wine.dll");
-
- if (m_lfxModule == nullptr)
+ HMODULE pLfxModule;
+
+ if (pLfxModule = LoadLibraryA("latencyflex_layer.dll"))
+ m_winelfx_WaitAndBeginFrame = reinterpret_cast<void (*)()>(
+ reinterpret_cast<void*>(GetProcAddress(pLfxModule, "lfx_WaitAndBeginFrame")));
+ else if (pLfxModule = LoadLibraryA("latencyflex_wine.dll"))
+ m_winelfx_WaitAndBeginFrame = reinterpret_cast<void (*)()>(
+ reinterpret_cast<void*>(GetProcAddress(pLfxModule, "winelfx_WaitAndBeginFrame")));
+ else
{
spdlog::info("Unable to load LatencyFleX library, LatencyFleX disabled.");
return;
@@ -33,9 +37,6 @@ ON_DLL_LOAD_CLIENT_RELIESON("client.dll", LatencyFlex, ConVar, (CModule module))
AUTOHOOK_DISPATCH()
- m_winelfx_WaitAndBeginFrame =
- reinterpret_cast<PFN_winelfx_WaitAndBeginFrame>(reinterpret_cast<void*>(GetProcAddress(m_lfxModule, "winelfx_WaitAndBeginFrame")));
spdlog::info("LatencyFleX initialized.");
-
Cvar_r_latencyflex = new ConVar("r_latencyflex", "1", FCVAR_ARCHIVE, "Whether or not to use LatencyFleX input latency reduction.");
}