Output: Show offsets in metadata file for const fields and parameters with default values

This commit is contained in:
Katy Coe
2019-11-14 05:02:36 +01:00
parent 1fb013dcc2
commit 9b79217a38
4 changed files with 23 additions and 14 deletions

View File

@@ -16,6 +16,7 @@ namespace Il2CppInspector.Reflection {
public Il2CppFieldDefinition Definition { get; }
public int Index { get; }
public long Offset { get; }
public ulong DefaultValueMetadataAddress { get; }
// Custom attributes for this member
public override IEnumerable<CustomAttributeData> CustomAttributes => CustomAttributeData.GetCustomAttributes(this);
@@ -111,8 +112,10 @@ namespace Il2CppInspector.Reflection {
Attributes |= FieldAttributes.HasDefault;
// Default initialization value if present
if (pkg.FieldDefaultValue.TryGetValue(fieldIndex, out object variant))
DefaultValue = variant;
if (pkg.FieldDefaultValue.TryGetValue(fieldIndex, out (ulong address, object variant) value)) {
DefaultValue = value.variant;
DefaultValueMetadataAddress = value.address;
}
}
public string GetAccessModifierString() => this switch {