diff --git a/Il2CppInspector/Il2CppBinary.cs b/Il2CppInspector/Il2CppBinary.cs index 6489bdd..fb6c910 100644 --- a/Il2CppInspector/Il2CppBinary.cs +++ b/Il2CppInspector/Il2CppBinary.cs @@ -40,6 +40,9 @@ namespace Il2CppInspector // Generated functions which call constructors on custom attributes public ulong[] CustomAttributeGenerators { get; private set; } + // Generic method specs for vtables + public Il2CppMethodSpec[] MethodSpecs { get; private set; } + // Every defined type public List Types { get; private set; } @@ -187,7 +190,10 @@ namespace Il2CppInspector Types = image.ReadMappedObjectPointerArray(MetadataRegistration.ptypes, (int) MetadataRegistration.typesCount); // Custom attribute constructors - CustomAttributeGenerators = Image.ReadMappedArray(CodeRegistration.customAttributeGenerators, (int) CodeRegistration.customAttributeCount); + CustomAttributeGenerators = image.ReadMappedArray(CodeRegistration.customAttributeGenerators, (int) CodeRegistration.customAttributeCount); + + // Generic method specs + MethodSpecs = image.ReadMappedArray(MetadataRegistration.methodSpecs, (int) MetadataRegistration.methodSpecsCount); } } } diff --git a/Il2CppInspector/Il2CppBinaryClasses.cs b/Il2CppInspector/Il2CppBinaryClasses.cs index c5cd6fb..c59b658 100644 --- a/Il2CppInspector/Il2CppBinaryClasses.cs +++ b/Il2CppInspector/Il2CppBinaryClasses.cs @@ -209,4 +209,11 @@ namespace Il2CppInspector public ulong sizes; public ulong lobounds; } + + public class Il2CppMethodSpec + { + public int methodDefinitionIndex; + public int classIndexIndex; + public int methodIndexIndex; + } } diff --git a/Il2CppInspector/Il2CppInspector.cs b/Il2CppInspector/Il2CppInspector.cs index 2b4d11b..d9de797 100644 --- a/Il2CppInspector/Il2CppInspector.cs +++ b/Il2CppInspector/Il2CppInspector.cs @@ -41,15 +41,18 @@ namespace Il2CppInspector public Il2CppGenericParameter[] GenericParameters => Metadata.GenericParameters; public int[] GenericConstraintIndices => Metadata.GenericConstraintIndices; public Il2CppCustomAttributeTypeRange[] AttributeTypeRanges => Metadata.AttributeTypeRanges; + public Il2CppInterfaceOffsetPair[] InterfaceOffsets => Metadata.InterfaceOffsets; public int[] InterfaceUsageIndices => Metadata.InterfaceUsageIndices; public int[] NestedTypeIndices => Metadata.NestedTypeIndices; public int[] AttributeTypeIndices => Metadata.AttributeTypeIndices; + public uint[] VTableMethodIndices => Metadata.VTableMethodIndices; public Dictionary FieldDefaultValue { get; } = new Dictionary(); public Dictionary ParameterDefaultValue { get; } = new Dictionary(); public List FieldOffsets { get; } public List TypeUsages => Binary.Types; public Dictionary Modules => Binary.Modules; public ulong[] CustomAttributeGenerators => Binary.CustomAttributeGenerators; + public Il2CppMethodSpec[] MethodSpecs => Binary.MethodSpecs; // TODO: Finish all file access in the constructor and eliminate the need for this public IFileFormatReader BinaryImage => Binary.Image; diff --git a/Il2CppInspector/Metadata.cs b/Il2CppInspector/Metadata.cs index c364c86..cbd1c60 100644 --- a/Il2CppInspector/Metadata.cs +++ b/Il2CppInspector/Metadata.cs @@ -31,11 +31,13 @@ namespace Il2CppInspector public Il2CppGenericContainer[] GenericContainers { get; } public Il2CppGenericParameter[] GenericParameters { get; } public Il2CppCustomAttributeTypeRange[] AttributeTypeRanges { get; } + public Il2CppInterfaceOffsetPair[] InterfaceOffsets { get; } public int[] InterfaceUsageIndices { get; } public int[] NestedTypeIndices { get; } public int[] AttributeTypeIndices { get; } public int[] GenericConstraintIndices { get; } + public uint[] VTableMethodIndices { get; } public Dictionary Strings { get; } = new Dictionary(); @@ -109,6 +111,8 @@ namespace Il2CppInspector GenericContainers = ReadArray(Header.genericContainersOffset, Header.genericContainersCount / Sizeof(typeof(Il2CppGenericContainer))); GenericParameters = ReadArray(Header.genericParametersOffset, Header.genericParametersCount / Sizeof(typeof(Il2CppGenericParameter))); GenericConstraintIndices = ReadArray(Header.genericParameterConstraintsOffset, Header.genericParameterConstraintsCount / sizeof(int)); + InterfaceOffsets = ReadArray(Header.interfaceOffsetsOffset, Header.interfaceOffsetsCount / Sizeof(typeof(Il2CppInterfaceOffsetPair))); + VTableMethodIndices = ReadArray(Header.vtableMethodsOffset, Header.vtableMethodsCount / sizeof(uint)); if (Version >= 16) { Assemblies = ReadArray(Header.assembliesOffset, Header.assembliesCount / Sizeof(typeof(Il2CppAssemblyDefinition))); diff --git a/Il2CppInspector/MetadataClasses.cs b/Il2CppInspector/MetadataClasses.cs index 8a82f78..2073a1a 100644 --- a/Il2CppInspector/MetadataClasses.cs +++ b/Il2CppInspector/MetadataClasses.cs @@ -415,4 +415,10 @@ namespace Il2CppInspector public int start; public int count; } + + public class Il2CppInterfaceOffsetPair + { + public int interfaceTypeIndex; + public int offset; + } }