Skip to content
This repository was archived by the owner on Sep 17, 2024. It is now read-only.

Commit df5d4fb

Browse files
committed
Force disable the EOS overlay due to IAT hooking conflicts
1 parent a67cfbf commit df5d4fb

File tree

2 files changed

+48
-1
lines changed

2 files changed

+48
-1
lines changed
Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
#include <cstdint>
2+
#include <string.h>
3+
4+
constinit const char *TargetFunctionNames[] = {
5+
"EOS_Overlay_ApplicationWillShutdown",
6+
"EOS_Overlay_CloseBrowser",
7+
"EOS_Overlay_EjectInstance",
8+
"EOS_Overlay_EvaluateJS",
9+
"EOS_Overlay_GetDisplaySettings",
10+
"EOS_Overlay_Initialize",
11+
"EOS_Overlay_InvokeJavascriptCallback",
12+
"EOS_Overlay_LoadURL",
13+
"EOS_Overlay_ObserveBrowserStatus",
14+
"EOS_Overlay_RegisterGamepadListener",
15+
"EOS_Overlay_RegisterJSBindings",
16+
"EOS_Overlay_RegisterKeyListener",
17+
"EOS_Overlay_SetAnalyticsEventHandler",
18+
"EOS_Overlay_SetDisplaySettings",
19+
"EOS_Overlay_SetLogMessageHandler",
20+
"EOS_Overlay_UnregisterGamepadListener",
21+
"EOS_Overlay_UnregisterKeyListener",
22+
};
23+
24+
uint32_t __fastcall HookedEOS_Overlay_Stub(void *a1, void *a2, void *a3)
25+
{
26+
return 0xFFFFFFFF;
27+
}
28+
29+
void TryInterceptEOSFunction(void *ModuleHandle, const void *FunctionName, void **FunctionPointer)
30+
{
31+
if (!FunctionName || !*FunctionPointer || reinterpret_cast<uintptr_t>(FunctionName) < 0x10000)
32+
return;
33+
34+
// Each export from EOSOVH-Win64-Shipping.dll requires interception. They're all guilty of calling the
35+
// overlay initialization function, which causes other hooks to be removed.
36+
for (auto name : TargetFunctionNames)
37+
{
38+
if (strcmp(static_cast<const char *>(FunctionName), name) != 0)
39+
continue;
40+
41+
*FunctionPointer = &HookedEOS_Overlay_Stub;
42+
break;
43+
}
44+
}

source/wrapper_generic/dllmain.cpp

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,13 +10,14 @@
1010
// sl.common.dll loads _nvngx.dll <- we are here
1111
// _nvngx.dll loads nvngx_dlssg.dll <- intercept this stage
1212
//
13-
constinit const wchar_t *TargetLibrariesToHook[] = { L"sl.interposer.dll", L"sl.common.dll", L"sl.dlss_g.dll", L"_nvngx.dll" };
13+
constinit const wchar_t *TargetLibrariesToHook[] = { L"sl.interposer.dll", L"sl.common.dll", L"sl.dlss_g.dll", L"_nvngx.dll", L"EOSSDK-Win64-Shipping.dll" };
1414
constinit const wchar_t *TargetImplementationDll = L"nvngx_dlssg.dll";
1515
constinit const wchar_t *RelplacementImplementationDll = L"dlssg_to_fsr3_amd_is_better.dll";
1616

1717
bool EnableAggressiveHooking;
1818

1919
void TryInterceptNvAPIFunction(void *ModuleHandle, const void *FunctionName, void **FunctionPointer);
20+
void TryInterceptEOSFunction(void *ModuleHandle, const void *FunctionName, void **FunctionPointer);
2021
bool PatchImportsForModule(const wchar_t *Path, HMODULE ModuleHandle);
2122

2223
void *LoadImplementationDll()
@@ -95,6 +96,8 @@ FARPROC WINAPI HookedGetProcAddress(HMODULE hModule, LPCSTR lpProcName)
9596
auto proc = GetProcAddress(hModule, lpProcName);
9697

9798
TryInterceptNvAPIFunction(hModule, lpProcName, reinterpret_cast<void **>(&proc));
99+
TryInterceptEOSFunction(hModule, lpProcName, reinterpret_cast<void **>(&proc));
100+
98101
return proc;
99102
}
100103

0 commit comments

Comments
 (0)