#230 The problem mentioned in this issue is due to the signature of the hook function being incorrect. HybridCLR passes a pointer into this function, but we're using an int here, which causes the upper 32 bits of the pointer to be lost, resulting in an illegal memory access exception. To fix this issue, we can change the argument to long.
[UnmanagedFunctionPointer(CallingConvention.Cdecl)]
internal delegate Il2CppClass* MethodDelegate(long index);
private Il2CppClass* Hook(long index)
{
if (InjectorHelpers.s_InjectedClasses.TryGetValue(index, out IntPtr classPtr))
return (Il2CppClass*)classPtr;
return Original(index);
}
#230 The problem mentioned in this issue is due to the signature of the hook function being incorrect. HybridCLR passes a pointer into this function, but we're using an int here, which causes the upper 32 bits of the pointer to be lost, resulting in an illegal memory access exception. To fix this issue, we can change the argument to long.