From 30897746e22e1792994b419f91036fc3dc29957d Mon Sep 17 00:00:00 2001 From: Katy Coe Date: Mon, 4 Nov 2019 18:32:41 +0100 Subject: [PATCH] Model: Set Assembly, BaseType, Definition and Index for arrays --- Il2CppInspector/Reflection/TypeInfo.cs | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/Il2CppInspector/Reflection/TypeInfo.cs b/Il2CppInspector/Reflection/TypeInfo.cs index a5f1c98..9bcb1b8 100644 --- a/Il2CppInspector/Reflection/TypeInfo.cs +++ b/Il2CppInspector/Reflection/TypeInfo.cs @@ -25,6 +25,7 @@ namespace Il2CppInspector.Reflection { public TypeInfo BaseType => baseTypeUsage != -1 ? Assembly.Model.GetTypeFromUsage(baseTypeUsage, MemberTypes.TypeInfo) + : IsArray? Assembly.Model.TypesByDefinitionIndex.First(t => t.FullName == "System.Array") : Assembly.Model.TypesByDefinitionIndex.First(t => t.FullName == "System.Object"); // True if the type contains unresolved generic type parameters @@ -326,13 +327,16 @@ namespace Il2CppInspector.Reflection { } } - // TODO: Set Assembly, BaseType and DeclaringType for the two below + // TODO: Set DeclaringType for the two below // Array with known dimensions and bounds if (pType.type == Il2CppTypeEnum.IL2CPP_TYPE_ARRAY) { var descriptor = image.ReadMappedObject(pType.datapoint); elementType = model.GetTypeFromVirtualAddress(descriptor.etype); + Assembly = ElementType.Assembly; + Definition = ElementType.Definition; + Index = ElementType.Index; Namespace = ElementType.Namespace; Name = ElementType.Name; @@ -344,6 +348,9 @@ namespace Il2CppInspector.Reflection { if (pType.type == Il2CppTypeEnum.IL2CPP_TYPE_SZARRAY) { elementType = model.GetTypeFromVirtualAddress(pType.datapoint); + Assembly = ElementType.Assembly; + Definition = ElementType.Definition; + Index = ElementType.Index; Namespace = ElementType.Namespace; Name = ElementType.Name;