diff --git a/Il2CppInspector.Common/Outputs/AssemblyShims.cs b/Il2CppInspector.Common/Outputs/AssemblyShims.cs index b6cae38..5232c2b 100644 --- a/Il2CppInspector.Common/Outputs/AssemblyShims.cs +++ b/Il2CppInspector.Common/Outputs/AssemblyShims.cs @@ -67,6 +67,7 @@ namespace Il2CppInspector.Outputs // Our custom attributes private TypeDef addressAttribute; private TypeDef fieldOffsetAttribute; + private TypeDef staticFieldOffsetAttribute; private TypeDef attributeAttribute; private TypeDef metadataOffsetAttribute; private TypeDef metadataPreviewAttribute; @@ -118,6 +119,10 @@ namespace Il2CppInspector.Outputs fieldOffsetAttribute.Fields.Add(new FieldDefUser("Offset", stringField, FieldAttributes.Public)); fieldOffsetAttribute.AddDefaultConstructor(attributeCtorRef); + staticFieldOffsetAttribute = createAttribute("StaticFieldOffsetAttribute"); + staticFieldOffsetAttribute.Fields.Add(new FieldDefUser("Offset", stringField, FieldAttributes.Public)); + staticFieldOffsetAttribute.AddDefaultConstructor(attributeCtorRef); + attributeAttribute = createAttribute("AttributeAttribute"); attributeAttribute.Fields.Add(new FieldDefUser("Name", stringField, FieldAttributes.Public)); attributeAttribute.Fields.Add(new FieldDefUser("RVA", stringField, FieldAttributes.Public)); @@ -233,7 +238,9 @@ namespace Il2CppInspector.Outputs // Field offset if (!field.IsStatic) - mField.AddAttribute(module, fieldOffsetAttribute, ("Offset", $"0x{field.Offset:X}")); + mField.AddAttribute(module, fieldOffsetAttribute, ("Offset", $"0x{field.Offset:X2}")); + else if (!field.IsLiteral) + mField.AddAttribute(module, staticFieldOffsetAttribute, ("Offset", $"0x{field.Offset:X2}")); // Add token attribute mField.AddAttribute(module, tokenAttribute, ("Token", $"0x{field.MetadataToken:X8}"));