Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 14 additions & 1 deletion Il2CppInterop.Runtime/Injection/InjectorHelpers.cs
Original file line number Diff line number Diff line change
Expand Up @@ -75,13 +75,26 @@ internal static void Setup()
GenericMethodGetMethodHook_Unity6.ApplyHook();
else
GenericMethodGetMethodHook.ApplyHook();
GetTypeInfoFromTypeDefinitionIndexHook.ApplyHook();
if (IsHybridClrPresent())
{
Logger.Instance.LogTrace("HybridCLR detected in game; MetadataCache::GetTypeInfoFromTypeDefinitionIndex will not be hooked.");
}
else
{
Logger.Instance.LogTrace("HybridCLR not detected; MetadataCache::GetTypeInfoFromTypeDefinitionIndex will be hooked.");
GetTypeInfoFromTypeDefinitionIndexHook.ApplyHook();
}
GetFieldDefaultValueHook.ApplyHook();
ClassInit ??= FindClassInit();
FromIl2CppTypeHook.ApplyHook();
FromNameHook.ApplyHook();
}

internal static bool IsHybridClrPresent()
{
return Il2CppSystem.Type.GetType("HybridCLR.RuntimeApi") != null;
}

internal static long CreateClassToken(IntPtr classPointer)
{
long newToken = Interlocked.Decrement(ref s_LastInjectedToken);
Expand Down
Loading