File tree Expand file tree Collapse file tree 4 files changed +31
-3
lines changed
Reloaded.Mod.Loader.Bootstrapper Expand file tree Collapse file tree 4 files changed +31
-3
lines changed Original file line number Diff line number Diff line change 1
1
#pragma once
2
2
3
3
/* For C# source, see EntryPoint.cs */
4
- #define CURRENT_VERSION 7
4
+ #define CURRENT_VERSION 8
5
5
6
6
enum EntryPointFlags : int
7
7
{
@@ -19,6 +19,7 @@ struct EntryPointParameters
19
19
public:
20
20
int version { CURRENT_VERSION };
21
21
EntryPointFlags flags { None };
22
+ LPWSTR dll_path { nullptr };
22
23
23
24
EntryPointParameters () = default ;
24
25
};
Original file line number Diff line number Diff line change @@ -180,6 +180,10 @@ bool load_reloaded(ReloadedPaths& reloadedPaths)
180
180
throw std::exception (" Failed to load .NET assembly." );
181
181
}
182
182
183
+ // Set path to current dll
184
+ // Using GetModuleFileNameW
185
+ entryPointParameters.dll_path = new wchar_t [MAX_PATH];
186
+ GetModuleFileNameW (thisProcessModule, entryPointParameters.dll_path , MAX_PATH);
183
187
initialize (&entryPointParameters, sizeof (EntryPointParameters));
184
188
return true ;
185
189
}
Original file line number Diff line number Diff line change @@ -92,10 +92,18 @@ private static unsafe void SetupLoader2(EntryPointParameters* parameters)
92
92
93
93
var setupHooksTask = Task . Run ( ( ) => ExecuteTimed ( "Setting Up Hooks (Async)" , ( ) => SetupHooks ( hooks ) ) ) ;
94
94
InitialiseParameters ( parameters ) ;
95
+ if ( _parameters . SupportsDllPath && _parameters . DllPath != null )
96
+ {
97
+ var reloadedPath = Marshal . PtrToStringUni ( ( nint ) _parameters . DllPath ) ;
98
+ Logger ! . LogWriteLineAsync ( $ "Loaded via: { reloadedPath } ", Logger . ColorInformation ) ;
99
+ if ( reloadedPath ! . EndsWith ( ".asi" ) )
100
+ Logger ! . LogWriteLineAsync ( $ "Remove the above `.asi` file to uninstall. (Should be in your app/game folder)", Logger . ColorInformation ) ;
101
+ }
102
+
95
103
ExecuteTimed ( "Loading Mods (Total)" , ( ) => LoadMods ( hooks ) ) ;
96
104
97
105
setupHooksTask . Wait ( ) ;
98
- Logger ? . LogWriteLineAsync ( $ "Total Loader Initialization Time: { _stopWatch . ElapsedMilliseconds } ms") ;
106
+ Logger ! . LogWriteLineAsync ( $ "Total Loader Initialization Time: { _stopWatch . ElapsedMilliseconds } ms") ;
99
107
_stopWatch . Reset ( ) ;
100
108
}
101
109
Original file line number Diff line number Diff line change @@ -14,7 +14,7 @@ Also update EntryPointParameter.h in bootstrapper accordingly.
14
14
/// <summary>
15
15
/// Current version of parameters.
16
16
/// </summary>
17
- public const int CurrentVersion = 7 ;
17
+ public const int CurrentVersion = 8 ;
18
18
19
19
// Version 1
20
20
/// <summary>
@@ -30,6 +30,11 @@ Also update EntryPointParameter.h in bootstrapper accordingly.
30
30
// Version 2
31
31
// ...
32
32
33
+ /// <summary>
34
+ /// Contains the path to the native DLL which loaded the loader.
35
+ /// </summary>
36
+ public unsafe char * DllPath ;
37
+
33
38
/// <summary>
34
39
/// Checks if struct is using latest version.
35
40
/// </summary>
@@ -55,9 +60,19 @@ public static unsafe EntryPointParameters Copy(EntryPointParameters* pointer)
55
60
result . Version = pointer ->Version ;
56
61
result . Flags = pointer ->Flags ;
57
62
}
63
+
64
+ if ( pointer ->Version >= 8 )
65
+ {
66
+ result . DllPath = pointer ->DllPath ;
67
+ }
58
68
59
69
return result ;
60
70
}
71
+
72
+ /// <summary>
73
+ /// True if reading the DLL path is supported.
74
+ /// </summary>
75
+ public bool SupportsDllPath => Version >= 8 ;
61
76
}
62
77
63
78
/// <summary>
You can’t perform that action at this time.
0 commit comments