Fix 24.5 compatibility, check metadata from data first since thats more common now

This commit is contained in:
LukeFZ
2023-11-29 21:16:43 +01:00
parent 2d73e28cea
commit 96e466743d

View File

@@ -169,7 +169,7 @@ namespace Il2CppInspector
Image.Version = metadataVersion; Image.Version = metadataVersion;
StatusUpdate("Searching for binary metadata"); 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; return false;
TryPrepareMetadata(code, meta); TryPrepareMetadata(code, meta);
@@ -278,11 +278,18 @@ namespace Il2CppInspector
// genericAdjustorThunks was inserted before invokerPointersCount in 24.5 and 27.1 // genericAdjustorThunks was inserted before invokerPointersCount in 24.5 and 27.1
// pointer expected if we need to bump version // 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; Image.Version = 24.5;
CodeRegistration = Image.ReadMappedObject<Il2CppCodeRegistration>(codeRegistration); CodeRegistration = Image.ReadMappedObject<Il2CppCodeRegistration>(codeRegistration);
} }
if (Image.Version == 24.4 && CodeRegistration.reversePInvokeWrapperCount > 0x50000) {
Image.Version = 24.5;
codeRegistration -= 1 * pointerSize;
CodeRegistration = Image.ReadMappedObject<Il2CppCodeRegistration>(codeRegistration);
}
// Plugin hook to pre-process binary // Plugin hook to pre-process binary
isModified |= PluginHooks.PreProcessBinary(this).IsStreamModified; isModified |= PluginHooks.PreProcessBinary(this).IsStreamModified;