Model/C#: Provide FieldHasRVA flag; output metadata preview for static array initializer implementations (#59)

This commit is contained in:
Katy Coe
2020-08-22 03:13:50 +02:00
parent f590ee3def
commit 5828ed106b
2 changed files with 12 additions and 2 deletions

View File

@@ -25,7 +25,8 @@ namespace Il2CppInspector.Reflection {
private readonly long rawOffset;
public long Offset => DeclaringType.ContainsGenericParameters? 0 :
rawOffset - (DeclaringType.IsValueType && !IsStatic? (Assembly.Model.Package.BinaryImage.Bits / 8) * 2 : 0);
public bool HasFieldRVA => (Attributes & FieldAttributes.HasFieldRVA) != 0;
public ulong DefaultValueMetadataAddress { get; }
// Custom attributes for this member
@@ -126,6 +127,8 @@ namespace Il2CppInspector.Reflection {
Attributes |= FieldAttributes.PinvokeImpl;
if ((fieldType.attrs & Il2CppConstants.FIELD_ATTRIBUTE_HAS_DEFAULT) != 0)
Attributes |= FieldAttributes.HasDefault;
if ((fieldType.attrs & Il2CppConstants.FIELD_ATTRIBUTE_HAS_FIELD_RVA) != 0)
Attributes |= FieldAttributes.HasFieldRVA;
// Default initialization value if present
if (pkg.FieldDefaultValue.TryGetValue(fieldIndex, out (ulong address, object variant) value)) {