From 071b1efa678d3a23ba7cbd68b81bf56b4f821d1b Mon Sep 17 00:00:00 2001 From: Katy Coe Date: Sun, 19 Jul 2020 15:43:34 +0200 Subject: [PATCH] C++: Generate Il2CppClass definitions for enum and array types --- Il2CppInspector.Common/Cpp/CppDeclarationGenerator.cs | 9 +-------- Il2CppInspector.Common/Reflection/TypeInfo.cs | 2 +- 2 files changed, 2 insertions(+), 9 deletions(-) diff --git a/Il2CppInspector.Common/Cpp/CppDeclarationGenerator.cs b/Il2CppInspector.Common/Cpp/CppDeclarationGenerator.cs index dc694c3..f2258da 100644 --- a/Il2CppInspector.Common/Cpp/CppDeclarationGenerator.cs +++ b/Il2CppInspector.Common/Cpp/CppDeclarationGenerator.cs @@ -156,8 +156,7 @@ namespace Il2CppInspector.Cpp ((CppEnumType)valueType).AddField(EnumNamer.GetName(field), field.DefaultValue); } - // Use System.Enum base type as klass - boxedType = GenerateObjectStruct(name + "__Boxed", ti.BaseType); + boxedType = GenerateObjectStruct(name + "__Boxed", ti); boxedType.AddField("value", AsCType(ti)); } else { // This structure is passed by value, so it doesn't include Il2CppObject fields. @@ -327,17 +326,11 @@ namespace Il2CppInspector.Cpp VisitedTypes.Add(ti); if (ti.IsArray) { - VisitFieldStructs(ti); IncludeType(ti.ElementType); - IncludeType(ti.BaseType); - return; } else if (ti.HasElementType) { IncludeType(ti.ElementType); - return; } else if (ti.IsEnum) { - VisitFieldStructs(ti); IncludeType(ti.GetEnumUnderlyingType()); - return; } // Visit all fields first, considering only value types, diff --git a/Il2CppInspector.Common/Reflection/TypeInfo.cs b/Il2CppInspector.Common/Reflection/TypeInfo.cs index 54c3d50..1d1d39f 100644 --- a/Il2CppInspector.Common/Reflection/TypeInfo.cs +++ b/Il2CppInspector.Common/Reflection/TypeInfo.cs @@ -273,7 +273,7 @@ namespace Il2CppInspector.Reflection } return res; } - return null; + return Array.Empty(); } // Method that the type is declared in if this is a type parameter of a generic method