mirror of
https://github.com/BepInEx/BepInEx.git
synced 2026-10-20 01:46:13 +00:00
29 lines
777 B
C#
29 lines
777 B
C#
using System;
|
|
using Il2CppInterop.Runtime.Injection;
|
|
|
|
namespace BepInEx.Unity.IL2CPP.Hook;
|
|
|
|
internal class Il2CppInteropDetourProvider : IDetourProvider
|
|
{
|
|
public IDetour Create<TDelegate>(nint original, TDelegate target) where TDelegate : Delegate =>
|
|
new Il2CppInteropDetour(INativeDetour.Create(original, target));
|
|
}
|
|
|
|
internal class Il2CppInteropDetour : IDetour
|
|
{
|
|
private readonly INativeDetour detour;
|
|
|
|
public Il2CppInteropDetour(INativeDetour detour)
|
|
{
|
|
this.detour = detour;
|
|
}
|
|
|
|
public void Dispose() => detour.Dispose();
|
|
|
|
public void Apply() => detour.Apply();
|
|
|
|
public nint Target => detour.OriginalMethodPtr;
|
|
public nint Detour => detour.DetourMethodPtr;
|
|
public nint OriginalTrampoline => detour.TrampolinePtr;
|
|
}
|