C++: Generate Il2CppClass definitions for enum and array types

This commit is contained in:
Katy Coe
2020-07-19 15:43:34 +02:00
parent f7d2dd6e2d
commit 071b1efa67
2 changed files with 2 additions and 9 deletions

View File

@@ -156,8 +156,7 @@ namespace Il2CppInspector.Cpp
((CppEnumType)valueType).AddField(EnumNamer.GetName(field), field.DefaultValue); ((CppEnumType)valueType).AddField(EnumNamer.GetName(field), field.DefaultValue);
} }
// Use System.Enum base type as klass boxedType = GenerateObjectStruct(name + "__Boxed", ti);
boxedType = GenerateObjectStruct(name + "__Boxed", ti.BaseType);
boxedType.AddField("value", AsCType(ti)); boxedType.AddField("value", AsCType(ti));
} else { } else {
// This structure is passed by value, so it doesn't include Il2CppObject fields. // This structure is passed by value, so it doesn't include Il2CppObject fields.
@@ -327,17 +326,11 @@ namespace Il2CppInspector.Cpp
VisitedTypes.Add(ti); VisitedTypes.Add(ti);
if (ti.IsArray) { if (ti.IsArray) {
VisitFieldStructs(ti);
IncludeType(ti.ElementType); IncludeType(ti.ElementType);
IncludeType(ti.BaseType);
return;
} else if (ti.HasElementType) { } else if (ti.HasElementType) {
IncludeType(ti.ElementType); IncludeType(ti.ElementType);
return;
} else if (ti.IsEnum) { } else if (ti.IsEnum) {
VisitFieldStructs(ti);
IncludeType(ti.GetEnumUnderlyingType()); IncludeType(ti.GetEnumUnderlyingType());
return;
} }
// Visit all fields first, considering only value types, // Visit all fields first, considering only value types,

View File

@@ -273,7 +273,7 @@ namespace Il2CppInspector.Reflection
} }
return res; return res;
} }
return null; return Array.Empty<MethodBase>();
} }
// Method that the type is declared in if this is a type parameter of a generic method // Method that the type is declared in if this is a type parameter of a generic method