Collect field defaults into Il2CppInspector.FieldDefaultValue on load

This commit is contained in:
Katy Coe
2017-11-07 07:04:46 +01:00
parent 5890b0a1c1
commit 2a2617674a
5 changed files with 93 additions and 76 deletions

View File

@@ -34,7 +34,7 @@ namespace Il2CppInspector.Reflection {
Model = model;
Definition = Model.Package.Metadata.Images[imageIndex];
Index = Definition.assemblyIndex;
FullName = Model.Package.Metadata.Strings[Definition.nameIndex];
FullName = Model.Package.Strings[Definition.nameIndex];
if (Definition.entryPointIndex != -1) {
// TODO: Generate EntryPoint method from entryPointIndex

View File

@@ -53,9 +53,9 @@ namespace Il2CppInspector.Reflection {
base(declaringType) {
Definition = pkg.Metadata.Fields[fieldIndex];
Index = fieldIndex;
Name = pkg.Metadata.Strings[pkg.Metadata.Fields[fieldIndex].nameIndex];
Name = pkg.Strings[pkg.Metadata.Fields[fieldIndex].nameIndex];
fieldType = pkg.Binary.Types[Definition.typeIndex];
fieldType = pkg.TypeUsages[Definition.typeIndex];
if ((fieldType.attrs & DefineConstants.FIELD_ATTRIBUTE_PRIVATE) == DefineConstants.FIELD_ATTRIBUTE_PRIVATE)
Attributes |= FieldAttributes.Private;
if ((fieldType.attrs & DefineConstants.FIELD_ATTRIBUTE_PUBLIC) == DefineConstants.FIELD_ATTRIBUTE_PUBLIC)

View File

@@ -116,10 +116,10 @@ namespace Il2CppInspector.Reflection {
// Initialize from specified type index in metadata
public TypeInfo(Il2CppInspector pkg, int typeIndex, Assembly owner) :
base(owner) {
Definition = pkg.Metadata.Types[typeIndex];
Definition = pkg.TypeDefinitions[typeIndex];
Index = typeIndex;
Namespace = pkg.Metadata.Strings[Definition.namespaceIndex];
Name = pkg.Metadata.Strings[pkg.Metadata.Types[typeIndex].nameIndex];
Namespace = pkg.Strings[Definition.namespaceIndex];
Name = pkg.Strings[pkg.TypeDefinitions[typeIndex].nameIndex];
IsSerializable = (Definition.flags & DefineConstants.TYPE_ATTRIBUTE_SERIALIZABLE) != 0;
IsPublic = (Definition.flags & DefineConstants.TYPE_ATTRIBUTE_VISIBILITY_MASK) == DefineConstants.TYPE_ATTRIBUTE_PUBLIC;