Skip to content

Commit 188af80

Browse files
committed
feat(proxy): add shell api; add --disable-ue4ss command line/launch arg
1 parent 07f4b8f commit 188af80

File tree

3 files changed

+42
-5
lines changed

3 files changed

+42
-5
lines changed

README.md

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,11 @@ The easiest installation is via downloading the non-dev version of the latest no
2727

2828
If your game is in the custom config list, extract the contents from the relevant folder to `Win64` as well.
2929

30-
If you are planning on doing mod development using UE4SS, you can do the same as above but download the zDEV version instead.
30+
If you are planning on doing mod development using UE4SS, you can do the same as above but download the zDEV version instead.
31+
32+
### Disabling UE4SS Temporarily
33+
34+
If RE-UE4SS is installed via proxy DLL, you can temporarily disable it without uninstalling by launching the game with the `--disable-ue4ss` command line argument.
3135

3236
## Links
3337

UE4SS/proxy_generator/main.cpp

Lines changed: 35 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -209,9 +209,11 @@ int _tmain(int argc, TCHAR* argv[])
209209
cpp_file << endl;
210210
cpp_file << "#define WIN32_LEAN_AND_MEAN" << endl;
211211
cpp_file << "#include <Windows.h>" << endl;
212+
cpp_file << "#include <shellapi.h>" << endl;
212213
cpp_file << "#include <filesystem>" << endl;
213214
cpp_file << endl;
214215
cpp_file << "#pragma comment(lib, \"user32.lib\")" << endl;
216+
cpp_file << "#pragma comment(lib, \"shell32.lib\")" << endl;
215217
cpp_file << endl;
216218

217219
cpp_file << "using namespace RC;" << endl;
@@ -256,6 +258,30 @@ int _tmain(int argc, TCHAR* argv[])
256258
cpp_file << "}" << endl;
257259
cpp_file << endl;
258260

261+
cpp_file << "bool should_disable_ue4ss()" << endl;
262+
cpp_file << "{" << endl;
263+
cpp_file << " int argc = 0;" << endl;
264+
cpp_file << " LPWSTR* argv = CommandLineToArgvW(GetCommandLineW(), &argc);" << endl;
265+
cpp_file << " if (!argv)" << endl;
266+
cpp_file << " {" << endl;
267+
cpp_file << " return false;" << endl;
268+
cpp_file << " }" << endl;
269+
cpp_file << endl;
270+
cpp_file << " bool disable = false;" << endl;
271+
cpp_file << " for (int i = 0; i < argc; i++)" << endl;
272+
cpp_file << " {" << endl;
273+
cpp_file << " if (wcscmp(argv[i], L\"--disable-ue4ss\") == 0)" << endl;
274+
cpp_file << " {" << endl;
275+
cpp_file << " disable = true;" << endl;
276+
cpp_file << " break;" << endl;
277+
cpp_file << " }" << endl;
278+
cpp_file << " }" << endl;
279+
cpp_file << endl;
280+
cpp_file << " LocalFree(argv);" << endl;
281+
cpp_file << " return disable;" << endl;
282+
cpp_file << "}" << endl;
283+
cpp_file << endl;
284+
259285
cpp_file << "HMODULE load_ue4ss_dll(HMODULE moduleHandle)" << endl;
260286
cpp_file << "{" << endl;
261287
cpp_file << " HMODULE hModule = nullptr;" << endl;
@@ -308,12 +334,17 @@ int _tmain(int argc, TCHAR* argv[])
308334
cpp_file << " if (fdwReason == DLL_PROCESS_ATTACH)" << endl;
309335
cpp_file << " {" << endl;
310336
cpp_file << " load_original_dll();" << endl;
311-
cpp_file << " HMODULE hUE4SSDll = load_ue4ss_dll(hInstDll);" << endl;
312-
cpp_file << " if (hUE4SSDll)" << endl;
337+
cpp_file << " setup_functions();" << endl;
338+
cpp_file << endl;
339+
cpp_file << " // Check if UE4SS should be disabled via command line argument" << endl;
340+
cpp_file << " if (should_disable_ue4ss())" << endl;
313341
cpp_file << " {" << endl;
314-
cpp_file << " setup_functions();" << endl;
342+
cpp_file << " // UE4SS is disabled, proxy will still forward calls to original DLL" << endl;
343+
cpp_file << " return TRUE;" << endl;
315344
cpp_file << " }" << endl;
316-
cpp_file << " else" << endl;
345+
cpp_file << endl;
346+
cpp_file << " HMODULE hUE4SSDll = load_ue4ss_dll(hInstDll);" << endl;
347+
cpp_file << " if (!hUE4SSDll)" << endl;
317348
cpp_file << " {" << endl;
318349
cpp_file << " MessageBox(nullptr, L\"Failed to load UE4SS.dll. Please see the docs on correct installation: "
319350
"https://docs.ue4ss.com/installation-guide\", L\"UE4SS Error\", MB_OK | MB_ICONERROR);"

assets/Changelog.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,8 @@ Added support for UE Version 5.4 - ([UE4SS #503](https://github.com/UE4SS-RE/RE-
2020
Added basic support for Development/Debug/Test built Unreal Engine games ([UE4SS #607](https://github.com/UE4SS-RE/RE-UE4SS/pull/607))
2121
- To use this functionality, set DebugBuild to true in UE4SS-Settings.ini
2222

23+
Added command line option to disable RE-UE4SS loading via proxy DLL. Use `--disable-ue4ss` to launch game without UE4SS while keeping the proxy DLL installed. ([UE4SS #1069](https://github.com/UE4SS-RE/RE-UE4SS/pull/1069))
24+
2325
Added new build definition "LessEqual421". Using this definition for games on UE<=4.21 is not mandatory for UE4SS to function, but will ensure the correct alignment is used in containers.
2426

2527
**BREAKING:** - This also changes the default FName alignment from 8 to 4.

0 commit comments

Comments
 (0)