From 2deb28883e0d4142de14167829c828cc0ac99597 Mon Sep 17 00:00:00 2001 From: aldelaro5 Date: Tue, 6 Aug 2024 00:39:43 -0400 Subject: [PATCH 1/2] Upgrade to harmonyx 2.13 on HarmonySupport --- .../Il2CppInterop.HarmonySupport.csproj | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Il2CppInterop.HarmonySupport/Il2CppInterop.HarmonySupport.csproj b/Il2CppInterop.HarmonySupport/Il2CppInterop.HarmonySupport.csproj index 6e8e09f1..dfb12307 100644 --- a/Il2CppInterop.HarmonySupport/Il2CppInterop.HarmonySupport.csproj +++ b/Il2CppInterop.HarmonySupport/Il2CppInterop.HarmonySupport.csproj @@ -7,7 +7,7 @@ - + From d310dc63c748c68aab0ff505833e23a9f486b937 Mon Sep 17 00:00:00 2001 From: aldelaro5 Date: Tue, 6 Aug 2024 00:40:20 -0400 Subject: [PATCH 2/2] Remove the GenerateTrampoline method on IDetour --- Il2CppInterop.Runtime/Injection/DetourProvider.cs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Il2CppInterop.Runtime/Injection/DetourProvider.cs b/Il2CppInterop.Runtime/Injection/DetourProvider.cs index 24ce64ba..7a1cf79b 100644 --- a/Il2CppInterop.Runtime/Injection/DetourProvider.cs +++ b/Il2CppInterop.Runtime/Injection/DetourProvider.cs @@ -1,4 +1,5 @@ using System; +using System.Runtime.InteropServices; using Il2CppInterop.Runtime.Startup; namespace Il2CppInterop.Runtime.Injection; @@ -10,7 +11,6 @@ public interface IDetour : IDisposable nint OriginalTrampoline { get; } void Apply(); - T GenerateTrampoline() where T : Delegate; } public interface IDetourProvider @@ -23,8 +23,8 @@ internal static class Detour public static IDetour Apply(nint original, T target, out T trampoline) where T : Delegate { var detour = Il2CppInteropRuntime.Instance.DetourProvider.Create(original, target); - trampoline = detour.GenerateTrampoline(); detour.Apply(); + trampoline = Marshal.GetDelegateForFunctionPointer(detour.OriginalTrampoline); return detour; } }