Implement and output TypeInfo.BaseType
This commit is contained in:
@@ -36,7 +36,11 @@ namespace Il2CppInspector
|
|||||||
writer.Write("interface ");
|
writer.Write("interface ");
|
||||||
else
|
else
|
||||||
writer.Write("class ");
|
writer.Write("class ");
|
||||||
writer.Write($"{type.Name} // TypeDefIndex: {type.Index}\n{{\n");
|
|
||||||
|
var baseText = type.BaseType?.CSharpName ?? "object";
|
||||||
|
baseText = baseText == "object" ? string.Empty : " : " + baseText;
|
||||||
|
|
||||||
|
writer.Write($"{type.Name}{baseText} // TypeDefIndex: {type.Index}\n{{\n");
|
||||||
|
|
||||||
if (type.DeclaredFields.Count > 0)
|
if (type.DeclaredFields.Count > 0)
|
||||||
writer.Write("\t// Fields\n");
|
writer.Write("\t// Fields\n");
|
||||||
@@ -56,6 +60,8 @@ namespace Il2CppInspector
|
|||||||
writer.Write($" = {field.DefaultValueString}");
|
writer.Write($" = {field.DefaultValueString}");
|
||||||
writer.Write("; // 0x{0:X}\n", field.Offset);
|
writer.Write("; // 0x{0:X}\n", field.Offset);
|
||||||
}
|
}
|
||||||
|
if (type.DeclaredFields.Count > 0)
|
||||||
|
writer.Write("\n");
|
||||||
|
|
||||||
if (type.DeclaredMethods.Count > 0)
|
if (type.DeclaredMethods.Count > 0)
|
||||||
writer.Write("\t// Methods\n");
|
writer.Write("\t// Methods\n");
|
||||||
|
|||||||
@@ -21,7 +21,8 @@ namespace Il2CppInspector.Reflection {
|
|||||||
public TypeAttributes Attributes { get; }
|
public TypeAttributes Attributes { get; }
|
||||||
|
|
||||||
// Type that this type inherits from
|
// Type that this type inherits from
|
||||||
public TypeInfo BaseType => throw new NotImplementedException();
|
private Il2CppType baseType;
|
||||||
|
public TypeInfo BaseType => baseType != null? Assembly.Model.GetType(baseType, MemberTypes.TypeInfo) : null;
|
||||||
|
|
||||||
// True if the type contains unresolved generic type parameters
|
// True if the type contains unresolved generic type parameters
|
||||||
public bool ContainsGenericParameters { get; }
|
public bool ContainsGenericParameters { get; }
|
||||||
@@ -121,6 +122,9 @@ namespace Il2CppInspector.Reflection {
|
|||||||
Namespace = pkg.Strings[Definition.namespaceIndex];
|
Namespace = pkg.Strings[Definition.namespaceIndex];
|
||||||
Name = pkg.Strings[pkg.TypeDefinitions[typeIndex].nameIndex];
|
Name = pkg.Strings[pkg.TypeDefinitions[typeIndex].nameIndex];
|
||||||
|
|
||||||
|
if (Definition.parentIndex >= 0)
|
||||||
|
baseType = pkg.TypeUsages[Definition.parentIndex];
|
||||||
|
|
||||||
if ((Definition.flags & Il2CppConstants.TYPE_ATTRIBUTE_SERIALIZABLE) != 0)
|
if ((Definition.flags & Il2CppConstants.TYPE_ATTRIBUTE_SERIALIZABLE) != 0)
|
||||||
Attributes |= TypeAttributes.Serializable;
|
Attributes |= TypeAttributes.Serializable;
|
||||||
if ((Definition.flags & Il2CppConstants.TYPE_ATTRIBUTE_VISIBILITY_MASK) == Il2CppConstants.TYPE_ATTRIBUTE_PUBLIC)
|
if ((Definition.flags & Il2CppConstants.TYPE_ATTRIBUTE_VISIBILITY_MASK) == Il2CppConstants.TYPE_ATTRIBUTE_PUBLIC)
|
||||||
|
|||||||
Reference in New Issue
Block a user