diff --git a/BepInEx.NetLauncher/NetPreloader.cs b/BepInEx.NetLauncher/NetPreloader.cs index bd3f4e0..7052c8e 100644 --- a/BepInEx.NetLauncher/NetPreloader.cs +++ b/BepInEx.NetLauncher/NetPreloader.cs @@ -8,7 +8,6 @@ using BepInEx.Configuration; using BepInEx.Logging; using BepInEx.NetLauncher.RuntimeFixes; using BepInEx.Preloader.Core; -using BepInEx.Preloader.Core.RuntimeFixes; using MonoMod.RuntimeDetour; namespace BepInEx.NetLauncher @@ -48,8 +47,6 @@ namespace BepInEx.NetLauncher Logger.Sources.Add(TraceLogSource.CreateSource()); - HarmonyFixes.Apply(); - string consoleTile = $"BepInEx {typeof(Paths).Assembly.GetName().Version} - {Process.GetCurrentProcess().ProcessName}"; Log.LogMessage(consoleTile); diff --git a/BepInEx.Preloader.Core/BepInEx.Preloader.Core.csproj b/BepInEx.Preloader.Core/BepInEx.Preloader.Core.csproj index 2e93464..f5a3b8e 100644 --- a/BepInEx.Preloader.Core/BepInEx.Preloader.Core.csproj +++ b/BepInEx.Preloader.Core/BepInEx.Preloader.Core.csproj @@ -42,7 +42,6 @@ - @@ -64,5 +63,6 @@ 20.8.3.5 + \ No newline at end of file diff --git a/BepInEx.Preloader.Core/RuntimeFixes/HarmonyFixes.cs b/BepInEx.Preloader.Core/RuntimeFixes/HarmonyFixes.cs deleted file mode 100644 index 2134459..0000000 --- a/BepInEx.Preloader.Core/RuntimeFixes/HarmonyFixes.cs +++ /dev/null @@ -1,36 +0,0 @@ -using System; -using System.Diagnostics; -using HarmonyLib; - -namespace BepInEx.Preloader.Core.RuntimeFixes -{ - public static class HarmonyFixes - { - public static void Apply() - { - try - { - var harmony = new HarmonyLib.Harmony("BepInEx.Preloader.RuntimeFixes.HarmonyFixes"); - harmony.Patch(AccessTools.Method(typeof(Traverse), nameof(Traverse.GetValue), new Type[0]), null, new HarmonyMethod(typeof(HarmonyFixes), nameof(GetValue))); - harmony.Patch(AccessTools.Method(typeof(Traverse), nameof(Traverse.SetValue), new []{ typeof(object) }), null, new HarmonyMethod(typeof(HarmonyFixes), nameof(SetValue))); - } - catch (Exception e) - { - PreloaderLogger.Log.LogError(e); - } - } - - private static void GetValue(Traverse __instance) - { - if (!__instance.FieldExists() && !__instance.MethodExists() && !__instance.TypeExists()) - PreloaderLogger.Log.LogWarning("Traverse.GetValue was called while not pointing at an existing Field, Property, Method or Type. The return value can be unexpected.\n" + new StackTrace()); - } - - private static void SetValue(Traverse __instance) - { - // If method exists it will crash inside traverse so only need to mention the field missing - if (!__instance.FieldExists() && !__instance.MethodExists()) - PreloaderLogger.Log.LogWarning("Traverse.SetValue was called while not pointing at an existing Field or Property. The call will have no effect.\n" + new StackTrace()); - } - } -} \ No newline at end of file diff --git a/BepInEx.Preloader.Unity/UnityPreloader.cs b/BepInEx.Preloader.Unity/UnityPreloader.cs index 7f44374..82535cc 100644 --- a/BepInEx.Preloader.Unity/UnityPreloader.cs +++ b/BepInEx.Preloader.Unity/UnityPreloader.cs @@ -3,18 +3,15 @@ using System.Collections.Generic; using System.Diagnostics; using System.IO; using System.Linq; -using System.Text; using BepInEx.Bootstrap; using BepInEx.Configuration; using BepInEx.Core.Logging; using BepInEx.Logging; using BepInEx.Preloader.Core; using BepInEx.Preloader.Core.Logging; -using BepInEx.Preloader.Core.RuntimeFixes; using BepInEx.Preloader.RuntimeFixes; using Mono.Cecil; using Mono.Cecil.Cil; -using MonoMod.RuntimeDetour; using MonoMod.Utils; using MethodAttributes = Mono.Cecil.MethodAttributes; @@ -55,8 +52,6 @@ namespace BepInEx.Preloader.Unity Logger.Sources.Add(TraceLogSource.CreateSource()); - HarmonyFixes.Apply(); - PreloaderLog = new PreloaderConsoleListener(ConfigPreloaderCOutLogging.Value); Logger.Listeners.Add(PreloaderLog);