From 0d9c01ecaa3a009efda4db514565fdd565ca6753 Mon Sep 17 00:00:00 2001 From: Katy Coe Date: Sat, 15 Aug 2020 06:27:00 +0200 Subject: [PATCH] IL2CPP: Update structures for compatibility with metadata v27 --- .../IL2CPP/Il2CppBinaryClasses.cs | 23 ++++++++++++++++--- .../IL2CPP/MetadataClasses.cs | 22 +++++++++++++----- 2 files changed, 36 insertions(+), 9 deletions(-) diff --git a/Il2CppInspector.Common/IL2CPP/Il2CppBinaryClasses.cs b/Il2CppInspector.Common/IL2CPP/Il2CppBinaryClasses.cs index 3b58efe..59ea30b 100644 --- a/Il2CppInspector.Common/IL2CPP/Il2CppBinaryClasses.cs +++ b/Il2CppInspector.Common/IL2CPP/Il2CppBinaryClasses.cs @@ -1,6 +1,6 @@ /* Copyright 2017 Perfare - https://github.com/Perfare/Il2CppDumper - Copyright 2017-2020 Katy Coe - http://www.hearthcode.org - http://www.djkaty.com + Copyright 2017-2020 Katy Coe - http://www.djkaty.com - https://github.com/djkaty All rights reserved. */ @@ -39,7 +39,11 @@ namespace Il2CppInspector public ulong genericMethodPointers; public ulong invokerPointersCount; public ulong invokerPointers; + + // Removed in metadata v27 + [Version(Max = 24.3)] public long customAttributeCount; + [Version(Max = 24.3)] public ulong customAttributeGenerators; // Removed in metadata v23 @@ -86,6 +90,13 @@ namespace Il2CppInspector public ulong rgctxsCount; public ulong rgctxs; public ulong debuggerMetadata; + + // Added in metadata v27 + public ulong customAttributeCacheGenerator; // CustomAttributesCacheGenerator* + public ulong moduleInitializer; // Il2CppMethodPointer + public ulong staticConstructorTypeIndices; // TypeDefinitionIndex* + public ulong metadataRegistration; // Il2CppMetadataRegistration* // Per-assembly mode only + public ulong codeRegistration; // Il2CppCodeRegistration* // Per-assembly mode only } #pragma warning disable CS0649 @@ -167,10 +178,12 @@ namespace Il2CppInspector /* union { - TypeDefinitionIndex klassIndex; // for VALUETYPE and CLASS + TypeDefinitionIndex klassIndex; // for VALUETYPE and CLASS ( v24.2 // Unity 2019.2.8f1 -> v24.2 // Unity 2019.3.7f1 -> v24.3 + // Unity 2020.2.0f1 -> v27 // https://unity3d.com/get-unity/download/archive // Metadata version is written at the end of Unity.IL2CPP.MetadataCacheWriter.WriteLibIl2CppMetadata or WriteMetadata (Unity.IL2CPP.dll) @@ -99,20 +100,20 @@ namespace Il2CppInspector [Version(Min = 16)] public int assembliesCount; - [Version(Min = 19)] + [Version(Min = 19, Max = 24.3)] public int metadataUsageListsOffset; // Il2CppMetadataUsageList - [Version(Min = 19)] + [Version(Min = 19, Max = 24.3)] public int metadataUsageListsCount; - [Version(Min = 19)] + [Version(Min = 19, Max = 24.3)] public int metadataUsagePairsOffset; // Il2CppMetadataUsagePair - [Version(Min = 19)] + [Version(Min = 19, Max = 24.3)] public int metadataUsagePairsCount; [Version(Min = 19)] public int fieldRefsOffset; // Il2CppFieldRef [Version(Min = 19)] public int fieldRefsCount; [Version(Min = 20)] - public int referencedAssembliesOffset; // int + public int referencedAssembliesOffset; // int32_t [Version(Min = 20)] public int referencedAssembliesCount; @@ -141,6 +142,12 @@ namespace Il2CppInspector [Version(Min = 23)] public int windowsRuntimeTypeNamesSize; + // Added in metadata v27 + [Version(Min = 27)] + public int windowsRuntimeStringsOffset; // const char* + [Version(Min = 27)] + public int windowsRuntimeStringsSize; + // Added in metadata v24 [Version(Min = 24)] public int exportedTypeDefinitionsOffset; // TypeDefinitionIndex @@ -232,6 +239,7 @@ namespace Il2CppInspector public int customAttributeIndex; public int byvalTypeIndex; + [Version(Max = 24.3)] public int byrefTypeIndex; public int declaringTypeIndex; @@ -424,12 +432,14 @@ namespace Il2CppInspector public int offset; } + // Removed in metadata v27 public class Il2CppMetadataUsageList { public uint start; public uint count; } + // Removed in metadata v27 public class Il2CppMetadataUsagePair { public uint destinationindex;