mirror of
https://github.com/sinai-dev/UnityExplorer.git
synced 2024-12-23 01:59:40 +08:00
Revert "Use PatchProcessor ctor directly instead of Harmony.CreatePatchProcessor"
This reverts commit 9c1d459655
.
This commit is contained in:
parent
3f31db8dd8
commit
8123ec2412
@ -193,7 +193,7 @@ namespace UnityExplorer.Core.Input
|
||||
throw new MissingMethodException($"Could not find method for patching - '{type.FullName}.{method}'!");
|
||||
}
|
||||
|
||||
var processor = ExplorerCore.CreatePatch(methodInfo);
|
||||
var processor = ExplorerCore.Harmony.CreateProcessor(methodInfo);
|
||||
processor.AddPrefix(prefix);
|
||||
processor.Patch();
|
||||
}
|
||||
@ -207,7 +207,7 @@ namespace UnityExplorer.Core.Input
|
||||
{
|
||||
try
|
||||
{
|
||||
var processor = ExplorerCore.CreatePatch(type.GetProperty(property, ReflectionUtility.FLAGS).GetSetMethod());
|
||||
var processor = ExplorerCore.Harmony.CreateProcessor(type.GetProperty(property, ReflectionUtility.FLAGS).GetSetMethod());
|
||||
processor.AddPrefix(prefix);
|
||||
processor.Patch();
|
||||
}
|
||||
|
@ -14,7 +14,7 @@ namespace UnityExplorer
|
||||
try
|
||||
{
|
||||
var method = typeof(Assembly).GetMethod(nameof(Assembly.GetTypes), new Type[0]);
|
||||
var processor = ExplorerCore.CreatePatch(method);
|
||||
var processor = ExplorerCore.Harmony.CreateProcessor(method);
|
||||
processor.AddFinalizer(typeof(ReflectionPatches).GetMethod(nameof(Assembly_GetTypes)));
|
||||
processor.Patch();
|
||||
}
|
||||
|
@ -14,8 +14,6 @@ using UnityExplorer.UI;
|
||||
using UnityExplorer.Inspectors;
|
||||
using UnityExplorer.ObjectExplorer;
|
||||
using UnityExplorer.UI.Panels;
|
||||
using HarmonyLib;
|
||||
using System.Reflection;
|
||||
|
||||
namespace UnityExplorer
|
||||
{
|
||||
@ -29,9 +27,7 @@ namespace UnityExplorer
|
||||
public static IExplorerLoader Loader { get; private set; }
|
||||
public static RuntimeContext Context { get; internal set; }
|
||||
|
||||
private static HarmonyLib.Harmony Harmony { get; } = new HarmonyLib.Harmony(GUID);
|
||||
|
||||
public static PatchProcessor CreatePatch(MethodBase targetMethod) => new PatchProcessor(Harmony, targetMethod);
|
||||
public static HarmonyLib.Harmony Harmony { get; } = new HarmonyLib.Harmony(GUID);
|
||||
|
||||
/// <summary>
|
||||
/// Initialize UnityExplorer with the provided Loader implementation.
|
||||
|
@ -61,7 +61,7 @@ namespace UnityExplorer.Hooks
|
||||
|
||||
try
|
||||
{
|
||||
patchProcessor = ExplorerCore.CreatePatch(TargetMethod);
|
||||
patchProcessor = ExplorerCore.Harmony.CreateProcessor(TargetMethod);
|
||||
|
||||
// Dynamically compile the patch method
|
||||
|
||||
|
@ -511,7 +511,7 @@ namespace UnityExplorer.UI
|
||||
if (UnhollowerBaseLib.UnhollowerUtils.GetIl2CppMethodInfoPointerFieldForGeneratedMethod(unloadAllBundles) == null)
|
||||
return;
|
||||
#endif
|
||||
var processor = ExplorerCore.CreatePatch(unloadAllBundles);
|
||||
var processor = ExplorerCore.Harmony.CreateProcessor(unloadAllBundles);
|
||||
var prefix = new HarmonyMethod(typeof(UIManager).GetMethod(nameof(Prefix_UnloadAllAssetBundles), AccessTools.all));
|
||||
processor.AddPrefix(prefix);
|
||||
processor.Patch();
|
||||
|
Loading…
Reference in New Issue
Block a user