From f27d45090d9c7411e7e3d9f66322e3941edecc4b Mon Sep 17 00:00:00 2001 From: Sam Byass Date: Fri, 18 Feb 2022 18:14:01 +0000 Subject: [PATCH] Lib: Fix reading of unity 2018.4.34-2018.4.36 --- LibCpp2IL/BinaryStructures/Il2CppCodeRegistration.cs | 4 ++-- LibCpp2IL/Metadata/Il2CppAssemblyNameDefinition.cs | 4 +++- LibCpp2IL/Metadata/Il2CppGlobalMetadataHeader.cs | 4 ++-- LibCpp2IL/Metadata/Il2CppMetadata.cs | 2 ++ LibCpp2IL/Metadata/Il2CppMethodDefinition.cs | 10 +++++----- LibCpp2IL/Metadata/Il2CppTypeDefinition.cs | 4 ++-- 6 files changed, 16 insertions(+), 12 deletions(-) diff --git a/LibCpp2IL/BinaryStructures/Il2CppCodeRegistration.cs b/LibCpp2IL/BinaryStructures/Il2CppCodeRegistration.cs index 9b250575..f20dec27 100644 --- a/LibCpp2IL/BinaryStructures/Il2CppCodeRegistration.cs +++ b/LibCpp2IL/BinaryStructures/Il2CppCodeRegistration.cs @@ -3,8 +3,8 @@ namespace LibCpp2IL.BinaryStructures public class Il2CppCodeRegistration { - [Version(Max = 24.1f)] public ulong methodPointersCount; - [Version(Max = 24.1f)] public ulong methodPointers; + [Version(Max = 24.15f)] public ulong methodPointersCount; + [Version(Max = 24.15f)] public ulong methodPointers; public ulong reversePInvokeWrapperCount; public ulong reversePInvokeWrappers; diff --git a/LibCpp2IL/Metadata/Il2CppAssemblyNameDefinition.cs b/LibCpp2IL/Metadata/Il2CppAssemblyNameDefinition.cs index 4f29a2f4..38503d18 100644 --- a/LibCpp2IL/Metadata/Il2CppAssemblyNameDefinition.cs +++ b/LibCpp2IL/Metadata/Il2CppAssemblyNameDefinition.cs @@ -7,7 +7,9 @@ public class Il2CppAssemblyNameDefinition { public int nameIndex; public int cultureIndex; - [Version(Max = 24.3f)] public int hashValueIndex; + [Version(Max = 24.1f)] + [Version(Min = 24.2f, Max=24.3f)] //Not present in 24.15 + public int hashValueIndex; public int publicKeyIndex; public uint hash_alg; public int hash_len; diff --git a/LibCpp2IL/Metadata/Il2CppGlobalMetadataHeader.cs b/LibCpp2IL/Metadata/Il2CppGlobalMetadataHeader.cs index 00759418..dea6c0d7 100644 --- a/LibCpp2IL/Metadata/Il2CppGlobalMetadataHeader.cs +++ b/LibCpp2IL/Metadata/Il2CppGlobalMetadataHeader.cs @@ -44,8 +44,8 @@ public class Il2CppGlobalMetadataHeader public int interfaceOffsetsCount; public int typeDefinitionsOffset; // Il2CppTypeDefinition public int typeDefinitionsCount; - [Version(Max = 24.1f)] public int rgctxEntriesOffset; // Il2CppRGCTXDefinition - [Version(Max = 24.1f)] public int rgctxEntriesCount; + [Version(Max = 24.15f)] public int rgctxEntriesOffset; // Il2CppRGCTXDefinition + [Version(Max = 24.15f)] public int rgctxEntriesCount; public int imagesOffset; // Il2CppImageDefinition public int imagesCount; public int assembliesOffset; // Il2CppAssemblyDefinition diff --git a/LibCpp2IL/Metadata/Il2CppMetadata.cs b/LibCpp2IL/Metadata/Il2CppMetadata.cs index 1564d45b..967d3c83 100644 --- a/LibCpp2IL/Metadata/Il2CppMetadata.cs +++ b/LibCpp2IL/Metadata/Il2CppMetadata.cs @@ -91,6 +91,8 @@ public class Il2CppMetadata : ClassReadingBinaryReader actualVersion = 24.3f; //2019.3.7 introduces v24.3 else if (unityVersion.IsGreaterEqual(2019)) actualVersion = 24.2f; //2019.1.0 introduces v24.2 + else if (unityVersion.IsGreaterEqual(2018, 4, 34)) + actualVersion = 24.15f; //2018.4.34 made a tiny little change which just removes HashValueIndex from AssemblyNameDefinition else if (unityVersion.IsGreaterEqual(2018, 3)) actualVersion = 24.1f; //2018.3.0 introduces v24.1 else diff --git a/LibCpp2IL/Metadata/Il2CppMethodDefinition.cs b/LibCpp2IL/Metadata/Il2CppMethodDefinition.cs index e41ef3be..1f42deab 100644 --- a/LibCpp2IL/Metadata/Il2CppMethodDefinition.cs +++ b/LibCpp2IL/Metadata/Il2CppMethodDefinition.cs @@ -16,11 +16,11 @@ public class Il2CppMethodDefinition public int parameterStart; [Version(Max = 24)] public int customAttributeIndex; public int genericContainerIndex; - [Version(Max = 24.1f)] public int methodIndex; - [Version(Max = 24.1f)] public int invokerIndex; - [Version(Max = 24.1f)] public int delegateWrapperIndex; - [Version(Max = 24.1f)] public int rgctxStartIndex; - [Version(Max = 24.1f)] public int rgctxCount; + [Version(Max = 24.15f)] public int methodIndex; + [Version(Max = 24.15f)] public int invokerIndex; + [Version(Max = 24.15f)] public int delegateWrapperIndex; + [Version(Max = 24.15f)] public int rgctxStartIndex; + [Version(Max = 24.15f)] public int rgctxCount; public uint token; public ushort flags; public ushort iflags; diff --git a/LibCpp2IL/Metadata/Il2CppTypeDefinition.cs b/LibCpp2IL/Metadata/Il2CppTypeDefinition.cs index ae2d6163..9ca5aa01 100644 --- a/LibCpp2IL/Metadata/Il2CppTypeDefinition.cs +++ b/LibCpp2IL/Metadata/Il2CppTypeDefinition.cs @@ -20,8 +20,8 @@ public class Il2CppTypeDefinition public int parentIndex; public int elementTypeIndex; // we can probably remove this one. Only used for enums - [Version(Max = 24.1f)] public int rgctxStartIndex; - [Version(Max = 24.1f)] public int rgctxCount; + [Version(Max = 24.15f)] public int rgctxStartIndex; + [Version(Max = 24.15f)] public int rgctxCount; public int genericContainerIndex;