Sfoglia il codice sorgente

Remove no longer necessary harmony fix
Rebase of c096209

Bepis 3 anni fa
parent
commit
b1f218f328

+ 0 - 3
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);
 

+ 1 - 1
BepInEx.Preloader.Core/BepInEx.Preloader.Core.csproj

@@ -42,7 +42,6 @@
     <Compile Include="Patching\PatcherPlugin.cs" />
     <Compile Include="InternalPreloaderLogger.cs" />
     <Compile Include="Properties\AssemblyInfo.cs" />
-    <Compile Include="RuntimeFixes\HarmonyFixes.cs" />
   </ItemGroup>
   <ItemGroup>
     <ProjectReference Include="..\BepInEx.Core\BepInEx.Core.csproj">
@@ -64,5 +63,6 @@
       <Version>20.8.3.5</Version>
     </PackageReference>
   </ItemGroup>
+  <ItemGroup />
   <Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
 </Project>

+ 0 - 36
BepInEx.Preloader.Core/RuntimeFixes/HarmonyFixes.cs

@@ -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());
-		}
-	}
-}

+ 0 - 5
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);