@@ -79,8 +79,20 @@ static Il2CppInteropManager()
7979 false ,
8080 "If enabled, BepInEx will save dummy assemblies generated by an Cpp2IL dumper into BepInEx/dummy." ) ;
8181
82+ private static readonly ConfigEntry < string > IL2CPPInteropAssembliesPath = ConfigFile . CoreConfig . Bind (
83+ "IL2CPP" , "IL2CPPInteropAssembliesPath" ,
84+ "{BepInEx}" ,
85+ new StringBuilder ( )
86+ . AppendLine ( "The path to the folder where IL2CPPInterop assemblies are stored." )
87+ . AppendLine ( "Supports the following placeholders:" )
88+ . AppendLine ( "{BepInEx} - Path to the BepInEx folder." )
89+ . AppendLine ( "{ProcessName} - Name of the current process" )
90+ . ToString ( ) ) ;
91+
8292 private static readonly ManualLogSource Logger = BepInEx . Logging . Logger . CreateLogSource ( "InteropManager" ) ;
8393
94+ private static string il2cppInteropBasePath ;
95+
8496 private static bool initialized ;
8597
8698 public static string GameAssemblyPath => Environment . GetEnvironmentVariable ( "BEPINEX_GAME_ASSEMBLY_PATH" ) ??
@@ -89,9 +101,20 @@ static Il2CppInteropManager()
89101
90102 private static string HashPath => Path . Combine ( IL2CPPInteropAssemblyPath , "assembly-hash.txt" ) ;
91103
92- private static string UnityBaseLibsDirectory => Path . Combine ( Paths . BepInExRootPath , "unity-libs" ) ;
104+ private static string IL2CPPBasePath {
105+ get {
106+ if ( il2cppInteropBasePath != null )
107+ return il2cppInteropBasePath ;
108+ var path = Utility . GetCommandLineArgValue ( "--unhollowed-path" ) ?? IL2CPPInteropAssembliesPath . Value ;
109+ il2cppInteropBasePath = path . Replace ( "{BepInEx}" , Paths . BepInExRootPath )
110+ . Replace ( "{ProcessName}" , Paths . ProcessName ) ;
111+ return il2cppInteropBasePath ;
112+ }
113+ }
114+
115+ private static string UnityBaseLibsDirectory => Path . Combine ( IL2CPPBasePath , "unity-libs" ) ;
93116
94- internal static string IL2CPPInteropAssemblyPath => Path . Combine ( Paths . BepInExRootPath , "interop" ) ;
117+ internal static string IL2CPPInteropAssemblyPath => Path . Combine ( IL2CPPBasePath , "interop" ) ;
95118
96119 private static ILoggerFactory LoggerFactory { get ; } = MSLoggerFactory . Create ( b =>
97120 {
0 commit comments