From ff004dcb817af55de2388985ab54dcd8b16204ff Mon Sep 17 00:00:00 2001 From: Kasuromi <29818914+Kasuromi@users.noreply.github.com> Date: Wed, 20 Apr 2022 19:23:13 +0300 Subject: [PATCH] Use UnityVersionHandler's size providers --- BepInEx.IL2CPP/Hook/IL2CPPDetourMethodPatcher.cs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/BepInEx.IL2CPP/Hook/IL2CPPDetourMethodPatcher.cs b/BepInEx.IL2CPP/Hook/IL2CPPDetourMethodPatcher.cs index c76a931..1179dba 100644 --- a/BepInEx.IL2CPP/Hook/IL2CPPDetourMethodPatcher.cs +++ b/BepInEx.IL2CPP/Hook/IL2CPPDetourMethodPatcher.cs @@ -104,8 +104,8 @@ public unsafe class IL2CPPDetourMethodPatcher : MethodPatcher // Create a modified native MethodInfo struct to point towards the trampoline modifiedNativeMethodInfo = UnityVersionHandler.NewMethod(); Buffer.MemoryCopy(originalNativeMethodInfo.Pointer.ToPointer(), - modifiedNativeMethodInfo.Pointer.ToPointer(), modifiedNativeMethodInfo.StructSize, - originalNativeMethodInfo.StructSize); + modifiedNativeMethodInfo.Pointer.ToPointer(), UnityVersionHandler.MethodSize(), + UnityVersionHandler.MethodSize()); modifiedNativeMethodInfo.MethodPointer = trampolinePtr; isValid = true; }