Merge pull request #174

Fix incorrect warning on methods unstripped by unhollower
This commit is contained in:
Geoffrey Horsington authored and GitHub committed 2021-01-16 19:53:36 +02:00
commit c2fe261666
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);