Skip to content

Commit 082d28f

Browse files
committed
feat(proxy): add --ue4ss-path command line/launch arg
1 parent d971c87 commit 082d28f

File tree

4 files changed

+77
-2
lines changed

4 files changed

+77
-2
lines changed

README.md

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -29,9 +29,12 @@ If your game is in the custom config list, extract the contents from the relevan
2929

3030
If you are planning on doing mod development using UE4SS, you can do the same as above but download the zDEV version instead.
3131

32-
### Disabling UE4SS Temporarily
32+
### Command Line Options
3333

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.
34+
If RE-UE4SS is installed via proxy DLL, the following command line options are available:
35+
36+
- `--disable-ue4ss` - Temporarily disable UE4SS without uninstalling by launching the game with this argument.
37+
- `--ue4ss-path <path>` - Specify a custom path to UE4SS.dll. Supports both absolute paths (e.g., `C:\custom\UE4SS.dll`) and relative paths (e.g., `dev\builds\UE4SS.dll` relative to the game executable directory). Useful for testing different UE4SS builds without modifying installation files.
3538

3639
## Links
3740

UE4SS/proxy_generator/main.cpp

Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -282,6 +282,30 @@ int _tmain(int argc, TCHAR* argv[])
282282
cpp_file << "}" << endl;
283283
cpp_file << endl;
284284

285+
cpp_file << "std::wstring get_ue4ss_path_from_args()" << endl;
286+
cpp_file << "{" << endl;
287+
cpp_file << " int argc = 0;" << endl;
288+
cpp_file << " LPWSTR* argv = CommandLineToArgvW(GetCommandLineW(), &argc);" << endl;
289+
cpp_file << " if (!argv)" << endl;
290+
cpp_file << " {" << endl;
291+
cpp_file << " return L\"\";" << endl;
292+
cpp_file << " }" << endl;
293+
cpp_file << endl;
294+
cpp_file << " std::wstring ue4ss_path;" << endl;
295+
cpp_file << " for (int i = 0; i < argc - 1; i++)" << endl;
296+
cpp_file << " {" << endl;
297+
cpp_file << " if (wcscmp(argv[i], L\"--ue4ss-path\") == 0)" << endl;
298+
cpp_file << " {" << endl;
299+
cpp_file << " ue4ss_path = argv[i + 1];" << endl;
300+
cpp_file << " break;" << endl;
301+
cpp_file << " }" << endl;
302+
cpp_file << " }" << endl;
303+
cpp_file << endl;
304+
cpp_file << " LocalFree(argv);" << endl;
305+
cpp_file << " return ue4ss_path;" << endl;
306+
cpp_file << "}" << endl;
307+
cpp_file << endl;
308+
285309
cpp_file << "HMODULE load_ue4ss_dll(HMODULE moduleHandle)" << endl;
286310
cpp_file << "{" << endl;
287311
cpp_file << " HMODULE hModule = nullptr;" << endl;
@@ -291,6 +315,25 @@ int _tmain(int argc, TCHAR* argv[])
291315
cpp_file << " const fs::path ue4ssPath = currentPath / \"ue4ss\" / \"UE4SS.dll\";" << endl;
292316
cpp_file << endl;
293317

318+
cpp_file << " // Check for --ue4ss-path command line argument" << endl;
319+
cpp_file << " std::wstring cmdLineUe4ssPath = get_ue4ss_path_from_args();" << endl;
320+
cpp_file << " if (!cmdLineUe4ssPath.empty())" << endl;
321+
cpp_file << " {" << endl;
322+
cpp_file << " fs::path ue4ssArgPath = cmdLineUe4ssPath;" << endl;
323+
cpp_file << " if (!ue4ssArgPath.is_absolute())" << endl;
324+
cpp_file << " {" << endl;
325+
cpp_file << " ue4ssArgPath = currentPath / ue4ssArgPath;" << endl;
326+
cpp_file << " }" << endl;
327+
cpp_file << endl;
328+
cpp_file << " // Attempt to load UE4SS.dll from the command line path" << endl;
329+
cpp_file << " hModule = LoadLibrary(ue4ssArgPath.c_str());" << endl;
330+
cpp_file << " if (hModule)" << endl;
331+
cpp_file << " {" << endl;
332+
cpp_file << " return hModule;" << endl;
333+
cpp_file << " }" << endl;
334+
cpp_file << " }" << endl;
335+
cpp_file << endl;
336+
294337
cpp_file << " // Check for override.txt" << endl;
295338
cpp_file << " const fs::path overrideFilePath = currentPath / \"override.txt\";" << endl;
296339
cpp_file << " if (fs::exists(overrideFilePath))" << endl;

assets/Changelog.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,8 @@ Added basic support for Development/Debug/Test built Unreal Engine games ([UE4SS
2222

2323
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))
2424

25+
Added command line option to specify custom UE4SS.dll path via proxy DLL. Use `--ue4ss-path <path>` to load UE4SS.dll from a custom location, supporting both absolute and relative paths. This allows developers to easily test different UE4SS builds without modifying files. ([UE4SS #XXXX](https://github.com/UE4SS-RE/RE-UE4SS/pull/XXXX))
26+
2527
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.
2628

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

docs/installation-guide.md

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -64,6 +64,33 @@ For example, possible paths could be:
6464
- `C:/ue4ss/`
6565
- `../../Content/Paks`
6666

67+
### Command Line Path Override
68+
69+
You can also specify a custom path to `UE4SS.dll` via a command line argument. This takes priority over the `override.txt` file.
70+
71+
Use the `--ue4ss-path` argument when launching your game:
72+
73+
```
74+
game.exe --ue4ss-path "C:\custom\path\to\UE4SS.dll"
75+
```
76+
77+
Both absolute and relative paths are supported. Relative paths are resolved from the `game executable directory`:
78+
79+
```
80+
game.exe --ue4ss-path "dev\builds\UE4SS.dll"
81+
```
82+
83+
This is particularly useful for:
84+
- Developers testing different UE4SS builds without modifying files
85+
- Quick switching between UE4SS versions
86+
- Automated testing with different configurations
87+
88+
**Load Priority Order:**
89+
1. `--ue4ss-path` command line argument (highest priority)
90+
2. `override.txt` file
91+
3. `<game executable directory>/ue4ss/UE4SS.dll`
92+
4. `<game executable directory>/UE4SS.dll` (lowest priority)
93+
6794
## Manual Injection
6895

6996
> Using manual injection will mean that the `root directory` and `working directory` are treated as one single directory that happens to also be the same directory as your `game executable directory`, but any directory may be used.

0 commit comments

Comments
 (0)