This commit is contained in:
ghorsington committed 2021-01-16 19:54:00 +02:00
commit 6a73dbf6ea
1 file changed
+12 -2
@@ -55,8 +55,18 @@ namespace BepInEx.IL2CPP.Hook
var methodField = UnhollowerUtils.GetIl2CppMethodInfoPointerFieldForGeneratedMethod(Original);
if (methodField == null)
throw new Exception($"No IL2CPP equivalent found for {Original.FullDescription()}. The target might have been automatically generated by Unhollower (e.g. field accessor).");
{
var fieldInfoField = UnhollowerUtils.GetIl2CppFieldInfoPointerFieldForGeneratedFieldAccessor(Original);
if (fieldInfoField != null)
{
throw new Exception($"Method {Original.FullDescription()} is a field accessor, it can't be patched.");
}
// Generated method is probably unstripped, it can be safely handed to IL handler
return;
}
// Get the native MethodInfo struct for the target method
originalNativeMethodInfo = (Il2CppMethodInfo*)(IntPtr)methodField.GetValue(null);