diff --git a/BepInEx.Preloader/Entrypoint.cs b/BepInEx.Preloader/Entrypoint.cs index 3f58845..813a8ba 100644 --- a/BepInEx.Preloader/Entrypoint.cs +++ b/BepInEx.Preloader/Entrypoint.cs @@ -8,11 +8,11 @@ namespace BepInEx.Preloader { internal static class PreloaderRunner { - public static void PreloaderMain(string[] args) + public static void PreloaderMain() { string bepinPath = Path.GetDirectoryName(Path.GetDirectoryName(Path.GetFullPath(EnvVars.DOORSTOP_INVOKE_DLL_PATH))); - Paths.SetExecutablePath(args[0], bepinPath, EnvVars.DOORSTOP_MANAGED_FOLDER_DIR); + Paths.SetExecutablePath(EnvVars.DOORSTOP_PROCESS_PATH, bepinPath, EnvVars.DOORSTOP_MANAGED_FOLDER_DIR); AppDomain.CurrentDomain.AssemblyResolve += LocalResolve; Preloader.Run(); } @@ -58,7 +58,7 @@ namespace BepInEx.Preloader { EnvVars.LoadVars(); - silentExceptionLog = Path.Combine(Path.GetDirectoryName(args[0]), silentExceptionLog); + silentExceptionLog = Path.Combine(EnvVars.DOORSTOP_PROCESS_PATH, silentExceptionLog); // Get the path of this DLL via Doorstop env var because Assembly.Location mangles non-ASCII characters on some versions of Mono for unknown reasons preloaderPath = Path.GetDirectoryName(Path.GetFullPath(EnvVars.DOORSTOP_INVOKE_DLL_PATH)); @@ -69,7 +69,7 @@ namespace BepInEx.Preloader // To prevent that, we have to use reflection and a separate startup class so that we can install required assembly resolvers before the main code typeof(Entrypoint).Assembly.GetType($"BepInEx.Preloader.{nameof(PreloaderRunner)}") ?.GetMethod(nameof(PreloaderRunner.PreloaderMain)) - ?.Invoke(null, new object[] { args }); + ?.Invoke(null, null); AppDomain.CurrentDomain.AssemblyResolve -= ResolveCurrentDirectory; } diff --git a/BepInEx.Preloader/EnvVars.cs b/BepInEx.Preloader/EnvVars.cs index f98d925..c6d271e 100644 --- a/BepInEx.Preloader/EnvVars.cs +++ b/BepInEx.Preloader/EnvVars.cs @@ -17,11 +17,17 @@ namespace BepInEx.Preloader /// Full path to the game's "Managed" folder that contains all the game's managed assemblies /// public static string DOORSTOP_MANAGED_FOLDER_DIR { get; private set; } + + /// + /// Full path to the game executable currently running. + /// + public static string DOORSTOP_PROCESS_PATH { get; private set; } internal static void LoadVars() { DOORSTOP_INVOKE_DLL_PATH = Environment.GetEnvironmentVariable("DOORSTOP_INVOKE_DLL_PATH"); DOORSTOP_MANAGED_FOLDER_DIR = Environment.GetEnvironmentVariable("DOORSTOP_MANAGED_FOLDER_DIR"); + DOORSTOP_PROCESS_PATH = Environment.GetEnvironmentVariable("DOORSTOP_PROCESS_PATH"); } } } \ No newline at end of file diff --git a/README.md b/README.md index 413ec11..85ad151 100644 --- a/README.md +++ b/README.md @@ -22,7 +22,7 @@ Unity plugin framework **[User and developer guides](https://github.com/BepInEx/BepInEx/wiki)** ## Used libraries -- [NeighTools/UnityDoorstop](https://github.com/NeighTools/UnityDoorstop) - 2.12.1.0 ([f96e256](https://github.com/NeighTools/UnityDoorstop/commit/f96e25679bea87d80821b7e9d3b9e9824f85454c)) +- [NeighTools/UnityDoorstop](https://github.com/NeighTools/UnityDoorstop) - 3.0.0.0 ([5410184](https://github.com/NeighTools/UnityDoorstop/commit/5410184a82afca55b1ec7db86fd743c444a13e64)) - [pardeike/Harmony](https://github.com/pardeike/Harmony) - pre-2.0 ([443f551](https://github.com/pardeike/Harmony/commit/443f551ec45ecf409755b5979a4466343197de03)) - [0x0ade/MonoMod](https://github.com/0x0ade/MonoMod) - v20.4.3.1 ([231fd2a](https://github.com/MonoMod/MonoMod/commit/231fd2aaa851da126c552db1780b8ca670b6db87)) - [jbevain/cecil](https://github.com/jbevain/cecil) - 0.10.4 ([98ec890](https://github.com/jbevain/cecil/commit/98ec890d44643ad88d573e97be0e120435eda732)) diff --git a/build.cake b/build.cake index d0f8e46..5ba99ee 100644 --- a/build.cake +++ b/build.cake @@ -4,6 +4,9 @@ #addin nuget:?package=Cake.Json&version=4.0.0 #addin nuget:?package=Newtonsoft.Json&version=11.0.2 +const string DOORSTOP_VER = "3.0.0.0"; +const string DOORSTOP_DLL = "version.dll"; + var target = Argument("target", "Build"); var isBleedingEdge = Argument("bleeding_edge", false); var buildId = Argument("build_id", 0); @@ -85,8 +88,6 @@ Task("Build") } }); -const string DOORSTOP_VER = "2.12.1.0"; -const string DOORSTOP_DLL = "winhttp.dll"; Task("DownloadDoorstop") .Does(() => {