diff --git a/Il2CppInspector.Common/IL2CPP/Metadata.cs b/Il2CppInspector.Common/IL2CPP/Metadata.cs index c71578a..839f053 100644 --- a/Il2CppInspector.Common/IL2CPP/Metadata.cs +++ b/Il2CppInspector.Common/IL2CPP/Metadata.cs @@ -92,7 +92,7 @@ namespace Il2CppInspector // Set object versioning for Bin2Object from metadata version Version = new StructVersion(Header.Version); - if (Version < MetadataVersions.V160 || Version > MetadataVersions.V310) { + if (Version < MetadataVersions.V160 || Version > MetadataVersions.V350) { throw new InvalidOperationException($"The supplied metadata file is not of a supported version ({Header.Version})."); } @@ -215,9 +215,26 @@ namespace Il2CppInspector else { var stringLiteralList = ReadVersionedObjectArray(Header.StringLiteralOffset, Header.StringLiteralSize / Sizeof()); - StringLiterals = new string[stringLiteralList.Length]; - for (var i = 0; i < stringLiteralList.Length; i++) - StringLiterals[i] = ReadFixedLengthString(Header.StringLiteralDataOffset + stringLiteralList[i].DataIndex, (int)stringLiteralList[i].Length); + if (Version >= MetadataVersions.V350) + { + StringLiterals = new string[stringLiteralList.Length - 1]; + for (var i = 0; i < stringLiteralList.Length; i++) + { + var currentStringDataIndex = stringLiteralList[i].DataIndex; + var nextStringDataIndex = stringLiteralList[i + 1].DataIndex; + var stringLength = nextStringDataIndex - currentStringDataIndex; + + StringLiterals[i] = ReadFixedLengthString(Header.StringLiteralDataOffset + currentStringDataIndex, stringLength); + } + + } + else + { + StringLiterals = new string[stringLiteralList.Length]; + for (var i = 0; i < stringLiteralList.Length; i++) + StringLiterals[i] = ReadFixedLengthString(Header.StringLiteralDataOffset + stringLiteralList[i].DataIndex, (int)stringLiteralList[i].Length); + + } } // Post-processing hook diff --git a/Il2CppInspector.Common/Next/BinaryMetadata/Il2CppCodeRegistration.cs b/Il2CppInspector.Common/Next/BinaryMetadata/Il2CppCodeRegistration.cs index 89912e0..99d1e6e 100644 --- a/Il2CppInspector.Common/Next/BinaryMetadata/Il2CppCodeRegistration.cs +++ b/Il2CppInspector.Common/Next/BinaryMetadata/Il2CppCodeRegistration.cs @@ -77,6 +77,7 @@ public partial record struct Il2CppCodeRegistration [NativeInteger] [VersionCondition(EqualTo = "29.0", IncludingTag = "2022"), VersionCondition(EqualTo = "31.0", IncludingTag = "2022")] [VersionCondition(EqualTo = "29.0", IncludingTag = "2023"), VersionCondition(EqualTo = "31.0", IncludingTag = "2023")] + [VersionCondition(GreaterThan = "35.0")] public uint UnresolvedIndirectCallCount; // UnresolvedVirtualCallCount pre 29.1 [VersionCondition(GreaterThan = "22.0")] @@ -84,10 +85,12 @@ public partial record struct Il2CppCodeRegistration [VersionCondition(EqualTo = "29.0", IncludingTag = "2022"), VersionCondition(EqualTo = "31.0", IncludingTag = "2022")] [VersionCondition(EqualTo = "29.0", IncludingTag = "2023"), VersionCondition(EqualTo = "31.0", IncludingTag = "2023")] + [VersionCondition(GreaterThan = "35.0")] public Pointer UnresolvedInstanceCallWrappers; [VersionCondition(EqualTo = "29.0", IncludingTag = "2022"), VersionCondition(EqualTo = "31.0", IncludingTag = "2022")] [VersionCondition(EqualTo = "29.0", IncludingTag = "2023"), VersionCondition(EqualTo = "31.0", IncludingTag = "2023")] + [VersionCondition(GreaterThan = "35.0")] public Pointer UnresolvedStaticCallPointers; [NativeInteger] diff --git a/Il2CppInspector.Common/Next/Metadata/Il2CppMethodDefinition.cs b/Il2CppInspector.Common/Next/Metadata/Il2CppMethodDefinition.cs index b8cb72a..0efa091 100644 --- a/Il2CppInspector.Common/Next/Metadata/Il2CppMethodDefinition.cs +++ b/Il2CppInspector.Common/Next/Metadata/Il2CppMethodDefinition.cs @@ -18,7 +18,7 @@ public partial record struct Il2CppMethodDefinition public TypeDefinitionIndex DeclaringType { get; private set; } public TypeIndex ReturnType { get; private set; } - [VersionCondition(EqualTo = "31.0")] + [VersionCondition(GreaterThan = "31.0")] public uint ReturnParameterToken { get; private set; } public ParameterIndex ParameterStart { get; private set; } diff --git a/Il2CppInspector.Common/Next/Metadata/Il2CppStringLiteral.cs b/Il2CppInspector.Common/Next/Metadata/Il2CppStringLiteral.cs index b1521fe..ebd6436 100644 --- a/Il2CppInspector.Common/Next/Metadata/Il2CppStringLiteral.cs +++ b/Il2CppInspector.Common/Next/Metadata/Il2CppStringLiteral.cs @@ -6,6 +6,7 @@ using StringLiteralIndex = int; [VersionedStruct] public partial record struct Il2CppStringLiteral { + [VersionCondition(LessThan = "31.0")] public uint Length { get; private set; } public StringLiteralIndex DataIndex { get; private set; } } \ No newline at end of file diff --git a/Il2CppInspector.Common/Next/Metadata/Il2CppTypeDefinition.cs b/Il2CppInspector.Common/Next/Metadata/Il2CppTypeDefinition.cs index 52efe14..b6a50e0 100644 --- a/Il2CppInspector.Common/Next/Metadata/Il2CppTypeDefinition.cs +++ b/Il2CppInspector.Common/Next/Metadata/Il2CppTypeDefinition.cs @@ -32,6 +32,8 @@ public partial record struct Il2CppTypeDefinition public TypeIndex DeclaringTypeIndex { get; private set; } public TypeIndex ParentIndex { get; private set; } + + [VersionCondition(LessThan = "31.0")] public TypeIndex ElementTypeIndex { get; private set; } [VersionCondition(LessThan = "24.1")] diff --git a/Il2CppInspector.Common/Next/MetadataVersions.cs b/Il2CppInspector.Common/Next/MetadataVersions.cs index 11e9bf1..9a2a695 100644 --- a/Il2CppInspector.Common/Next/MetadataVersions.cs +++ b/Il2CppInspector.Common/Next/MetadataVersions.cs @@ -28,4 +28,7 @@ public static class MetadataVersions // No tag - 29.0/31.0 public static readonly string Tag2022 = "2022"; // 29.1/31.1 + + // Unity 6000.3.0a2 + public static readonly StructVersion V350 = new(35); } \ No newline at end of file diff --git a/Il2CppInspector.Common/Reflection/TypeInfo.cs b/Il2CppInspector.Common/Reflection/TypeInfo.cs index 21ffe19..b2af0ce 100644 --- a/Il2CppInspector.Common/Reflection/TypeInfo.cs +++ b/Il2CppInspector.Common/Reflection/TypeInfo.cs @@ -13,6 +13,7 @@ using System.Linq; using System.Reflection; using System.Text; using System.Text.RegularExpressions; +using Il2CppInspector.Next; using Il2CppInspector.Next.BinaryMetadata; using Il2CppInspector.Next.Metadata; @@ -784,7 +785,12 @@ namespace Il2CppInspector.Reflection // Enumerations - bit 1 of bitfield indicates this (also the baseTypeReference will be System.Enum) if (Definition.Bitfield.EnumType) { IsEnum = true; - enumUnderlyingTypeReference = TypeRef.FromReferenceIndex(Assembly.Model, Definition.ElementTypeIndex); + + var enumUnderlyingTypeIndex = Assembly.Model.Package.Version >= MetadataVersions.V350 + ? Definition.ParentIndex + : Definition.ElementTypeIndex; + + enumUnderlyingTypeReference = TypeRef.FromReferenceIndex(Assembly.Model, enumUnderlyingTypeIndex); } // Pass-by-reference type diff --git a/Il2CppInspector.Common/Utils/BlobReader.cs b/Il2CppInspector.Common/Utils/BlobReader.cs index 89e4940..ba507d9 100644 --- a/Il2CppInspector.Common/Utils/BlobReader.cs +++ b/Il2CppInspector.Common/Utils/BlobReader.cs @@ -163,7 +163,11 @@ public static class BlobReader var typeHandle = inspector.TypeReferences[typeIndex].Data.KlassIndex; enumType = inspector.TypeDefinitions[typeHandle]; - var elementTypeHandle = inspector.TypeReferences[enumType.ElementTypeIndex].Data.KlassIndex; + var elementTypeIndex = inspector.Version >= MetadataVersions.V350 + ? enumType.ParentIndex + : enumType.ElementTypeIndex; + + var elementTypeHandle = inspector.TypeReferences[elementTypeIndex].Data.KlassIndex; var elementType = inspector.TypeDefinitions[elementTypeHandle]; typeEnum = inspector.TypeReferences[elementType.ByValTypeIndex].Type; } diff --git a/README.md b/README.md index c2b44f3..8bd9b0c 100644 --- a/README.md +++ b/README.md @@ -754,8 +754,9 @@ Unity version | IL2CPP version | Support 2020.2.4-2020.3.x | 27.1 | Working 2021.1.0-2021.1.x | 27.2 | Working 2021.2.0-2021.2.x | 29 | Working -2021.3.0+ | 29.1 | Working -2022.3.33+ | 31(.1) | Working +2021.3.0-??? | 29.1 | Working +2022.3.33-6000.2.x | 31(.1) | Working +6000.3.0a2+ | 35 | Working Please refer to the companion repository https://github.com/nneonneo/Il2CppVersions if you would like to track the changes between each IL2CPP release version.