From 96e466743db5aa6a66612f79ffcaccba5c45ade7 Mon Sep 17 00:00:00 2001 From: LukeFZ <17146677+LukeFZ@users.noreply.github.com> Date: Wed, 29 Nov 2023 21:16:43 +0100 Subject: [PATCH] Fix 24.5 compatibility, check metadata from data first since thats more common now --- Il2CppInspector.Common/IL2CPP/Il2CppBinary.cs | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/Il2CppInspector.Common/IL2CPP/Il2CppBinary.cs b/Il2CppInspector.Common/IL2CPP/Il2CppBinary.cs index cb88389..05d60f7 100644 --- a/Il2CppInspector.Common/IL2CPP/Il2CppBinary.cs +++ b/Il2CppInspector.Common/IL2CPP/Il2CppBinary.cs @@ -169,7 +169,7 @@ namespace Il2CppInspector Image.Version = metadataVersion; StatusUpdate("Searching for binary metadata"); - if (!((FindMetadataFromSymbols() ?? FindMetadataFromCode() ?? FindMetadataFromData()) is (ulong code, ulong meta))) + if (!((FindMetadataFromSymbols() ?? FindMetadataFromData() ?? FindMetadataFromCode()) is (ulong code, ulong meta))) return false; TryPrepareMetadata(code, meta); @@ -278,11 +278,18 @@ namespace Il2CppInspector // genericAdjustorThunks was inserted before invokerPointersCount in 24.5 and 27.1 // pointer expected if we need to bump version - if (Image.Version == 24.4 && CodeRegistration.invokerPointersCount > 0x100000) { + if (Image.Version == 24.4 && CodeRegistration.invokerPointersCount > 0x50000) + { Image.Version = 24.5; CodeRegistration = Image.ReadMappedObject(codeRegistration); } + if (Image.Version == 24.4 && CodeRegistration.reversePInvokeWrapperCount > 0x50000) { + Image.Version = 24.5; + codeRegistration -= 1 * pointerSize; + CodeRegistration = Image.ReadMappedObject(codeRegistration); + } + // Plugin hook to pre-process binary isModified |= PluginHooks.PreProcessBinary(this).IsStreamModified;