FastNativeDetour: temporary fix for net6.0 support

This commit is contained in:
ghorsington committed 2022-08-14 17:18:58 +03:00
1 parent 7a54a77946
commit 5afef9a1db
2 files changed
+5 -4

No files matched your search

+2 -2
View File
@@ -26,9 +26,9 @@
<ItemGroup>
<PackageReference Include="HarmonyX" Version="2.10.0"/>
<PackageReference Include="Iced" Version="1.17.0"/>
<PackageReference Include="Il2CppInterop.Generator" Version="1.0.0-pre.1"/>
<PackageReference Include="Il2CppInterop.Generator" Version="1.0.0-pre.3"/>
<PackageReference Include="Il2CppInterop.ReferenceLibs" Version="1.0.0-pre.1" IncludeAssets="compile" PrivateAssets="all"/>
<PackageReference Include="Il2CppInterop.Runtime" Version="1.0.0-pre.1"/>
<PackageReference Include="Il2CppInterop.Runtime" Version="1.0.0-pre.3"/>
<PackageReference Include="MonoMod.RuntimeDetour" Version="22.5.1.1"/>
<PackageReference Include="Samboy063.Cpp2IL.Core" Version="2022.0.5"/>
</ItemGroup>
+3 -2
View File
@@ -4,7 +4,6 @@ using System.Runtime.InteropServices;
using BepInEx.IL2CPP.Hook.Allocator;
using BepInEx.Logging;
using MonoMod.RuntimeDetour;
using MonoMod.Utils;
namespace BepInEx.IL2CPP.Hook;
@@ -80,7 +79,9 @@ public class FastNativeDetour : IDetour
if (!typeof(Delegate).IsAssignableFrom(typeof(T)))
throw new InvalidOperationException($"Type {typeof(T)} not a delegate type.");
return GenerateTrampoline(typeof(T).GetMethod("Invoke")).CreateDelegate(typeof(T)) as T;
_ = GenerateTrampoline(typeof(T).GetMethod("Invoke"));
return Marshal.GetDelegateForFunctionPointer<T>(TrampolinePtr);
}
public void Dispose()