Skip to content

Commit

Permalink
Remove the GenerateTrampoline method on IDetour
Browse files Browse the repository at this point in the history
  • Loading branch information
aldelaro5 committed Aug 6, 2024
1 parent 2deb288 commit d310dc6
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions Il2CppInterop.Runtime/Injection/DetourProvider.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
using System;
using System.Runtime.InteropServices;
using Il2CppInterop.Runtime.Startup;

namespace Il2CppInterop.Runtime.Injection;
Expand All @@ -10,7 +11,6 @@ public interface IDetour : IDisposable
nint OriginalTrampoline { get; }

void Apply();
T GenerateTrampoline<T>() where T : Delegate;
}

public interface IDetourProvider
Expand All @@ -23,8 +23,8 @@ internal static class Detour
public static IDetour Apply<T>(nint original, T target, out T trampoline) where T : Delegate
{
var detour = Il2CppInteropRuntime.Instance.DetourProvider.Create(original, target);
trampoline = detour.GenerateTrampoline<T>();
detour.Apply();
trampoline = Marshal.GetDelegateForFunctionPointer<T>(detour.OriginalTrampoline);
return detour;
}
}

0 comments on commit d310dc6

Please sign in to comment.