diff --git a/Il2CppInspector.Common/Cpp/UnityHeaders/24.3-2019.4.15.h b/Il2CppInspector.Common/Cpp/UnityHeaders/24.4-2019.4.15.h similarity index 100% rename from Il2CppInspector.Common/Cpp/UnityHeaders/24.3-2019.4.15.h rename to Il2CppInspector.Common/Cpp/UnityHeaders/24.4-2019.4.15.h diff --git a/Il2CppInspector.Common/Cpp/UnityHeaders/24.3-2020.1.11-2020.1.99.h b/Il2CppInspector.Common/Cpp/UnityHeaders/24.4-2020.1.11-2020.1.99.h similarity index 100% rename from Il2CppInspector.Common/Cpp/UnityHeaders/24.3-2020.1.11-2020.1.99.h rename to Il2CppInspector.Common/Cpp/UnityHeaders/24.4-2020.1.11-2020.1.99.h diff --git a/Il2CppInspector.Common/IL2CPP/Il2CppBinary.cs b/Il2CppInspector.Common/IL2CPP/Il2CppBinary.cs index ccb55ad..71cb63c 100644 --- a/Il2CppInspector.Common/IL2CPP/Il2CppBinary.cs +++ b/Il2CppInspector.Common/IL2CPP/Il2CppBinary.cs @@ -48,7 +48,7 @@ namespace Il2CppInspector public long[] FieldOffsetPointers { get; private set; } // Generated functions which call constructors on custom attributes - // Only for <=24.3 + // Only for < 27 public ulong[] CustomAttributeGenerators { get; private set; } // IL2CPP-generated functions which implement MethodBase.Invoke with a unique signature per invoker, defined in Il2CppInvokerTable.cpp diff --git a/Il2CppInspector.Common/IL2CPP/Il2CppBinaryClasses.cs b/Il2CppInspector.Common/IL2CPP/Il2CppBinaryClasses.cs index f6148d0..90ae910 100644 --- a/Il2CppInspector.Common/IL2CPP/Il2CppBinaryClasses.cs +++ b/Il2CppInspector.Common/IL2CPP/Il2CppBinaryClasses.cs @@ -41,9 +41,9 @@ namespace Il2CppInspector public ulong invokerPointers; // Removed in metadata v27 - [Version(Max = 24.3)] + [Version(Max = 24.4)] public long customAttributeCount; - [Version(Max = 24.3)] + [Version(Max = 24.4)] public ulong customAttributeGenerators; // Removed in metadata v23 @@ -199,7 +199,7 @@ namespace Il2CppInspector public class Il2CppGenericClass { - [Version(Max = 24.3)] + [Version(Max = 24.4)] public long typeDefinitionIndex; /* the generic type definition */ [Version(Min = 27)] public ulong type; // Il2CppType* /* the generic type definition */ diff --git a/Il2CppInspector.Common/IL2CPP/Il2CppInspector.cs b/Il2CppInspector.Common/IL2CPP/Il2CppInspector.cs index 345c786..91e48bc 100644 --- a/Il2CppInspector.Common/IL2CPP/Il2CppInspector.cs +++ b/Il2CppInspector.Common/IL2CPP/Il2CppInspector.cs @@ -137,7 +137,7 @@ namespace Il2CppInspector if (Version >= 27) return buildLateBindingMetadataUsages(); - // Version >= 19 && <= 24.3 + // Version >= 19 && < 27 var usages = new Dictionary(); foreach (var metadataUsageList in Metadata.MetadataUsageLists) { diff --git a/Il2CppInspector.Common/IL2CPP/ImageScan.cs b/Il2CppInspector.Common/IL2CPP/ImageScan.cs index f6e397c..10b1137 100644 --- a/Il2CppInspector.Common/IL2CPP/ImageScan.cs +++ b/Il2CppInspector.Common/IL2CPP/ImageScan.cs @@ -162,7 +162,7 @@ namespace Il2CppInspector var mrSize = (ulong) Metadata.Sizeof(typeof(Il2CppMetadataRegistration), Image.Version, Image.Bits / 8); vas = FindAllMappedWords(imageBytes, (ulong) metadata.Types.Length).Select(a => a - mrSize + ptrSize * 4); - // >= 19 && <= 24.3 + // >= 19 && < 27 if (Image.Version < 27) foreach (var va in vas) { var mr = Image.ReadMappedObject(va); diff --git a/Il2CppInspector.Common/IL2CPP/Metadata.cs b/Il2CppInspector.Common/IL2CPP/Metadata.cs index 8ce7dcc..1007cc2 100644 --- a/Il2CppInspector.Common/IL2CPP/Metadata.cs +++ b/Il2CppInspector.Common/IL2CPP/Metadata.cs @@ -119,7 +119,14 @@ namespace Il2CppInspector VTableMethodIndices = ReadArray(Header.vtableMethodsOffset, Header.vtableMethodsCount / sizeof(uint)); if (Version >= 16) { - Assemblies = ReadArray(Header.assembliesOffset, Header.assembliesCount / Sizeof(typeof(Il2CppAssemblyDefinition))); + // In v24.4 hashValueIndex was removed from Il2CppAssemblyNameDefinition, which is a field in Il2CppAssemblyDefinition + // The number of images and assemblies should be the same. If they are not, we deduce that we are using v24.4 + // Note the version comparison matches both 24.2 and 24.3 here since 24.3 is tested for during binary loading + var assemblyCount = Header.assembliesCount / Sizeof(typeof(Il2CppAssemblyDefinition)); + if (Version == 24.2 && assemblyCount < Images.Length) + Version = 24.4; + + Assemblies = ReadArray(Header.assembliesOffset, Images.Length); ParameterDefaultValues = ReadArray(Header.parameterDefaultValuesOffset, Header.parameterDefaultValuesCount / Sizeof(typeof(Il2CppParameterDefaultValue))); } if (Version >= 19 && Version < 27) { diff --git a/Il2CppInspector.Common/IL2CPP/MetadataClasses.cs b/Il2CppInspector.Common/IL2CPP/MetadataClasses.cs index 738c60f..e7f6f55 100644 --- a/Il2CppInspector.Common/IL2CPP/MetadataClasses.cs +++ b/Il2CppInspector.Common/IL2CPP/MetadataClasses.cs @@ -27,6 +27,9 @@ namespace Il2CppInspector // Unity 2019.1.0f2 -> v24.2 // Unity 2019.2.8f1 -> v24.2 // Unity 2019.3.7f1 -> v24.3 + // Unity 2019.4.15f1 -> v24.4 + // Unity 2020.1.0f1 -> v24.3 + // Unity 2020.1.11f1 -> v24.4 // 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) @@ -100,13 +103,13 @@ namespace Il2CppInspector [Version(Min = 16)] public int assembliesCount; - [Version(Min = 19, Max = 24.3)] + [Version(Min = 19, Max = 24.4)] public int metadataUsageListsOffset; // Il2CppMetadataUsageList - [Version(Min = 19, Max = 24.3)] + [Version(Min = 19, Max = 24.4)] public int metadataUsageListsCount; - [Version(Min = 19, Max = 24.3)] + [Version(Min = 19, Max = 24.4)] public int metadataUsagePairsOffset; // Il2CppMetadataUsagePair - [Version(Min = 19, Max = 24.3)] + [Version(Min = 19, Max = 24.4)] public int metadataUsagePairsCount; [Version(Min = 19)] public int fieldRefsOffset; // Il2CppFieldRef @@ -214,6 +217,7 @@ namespace Il2CppInspector public int nameIndex; public int cultureIndex; + [Version(Max = 24.3)] public int hashValueIndex; public int publicKeyIndex; [Version(Max = 15), ArrayLength(FixedSize = 8)] @@ -239,7 +243,7 @@ namespace Il2CppInspector public int customAttributeIndex; public int byvalTypeIndex; - [Version(Max = 24.3)] + [Version(Max = 24.4)] public int byrefTypeIndex; public int declaringTypeIndex;