add new struct definitions
This commit is contained in:
@@ -187,7 +187,7 @@ namespace Il2CppInspector.Outputs
|
||||
};
|
||||
|
||||
if (mType.IsExplicitLayout || mType.IsSequentialLayout)
|
||||
mType.ClassLayout = new ClassLayoutUser(1, (uint)type.Sizes.nativeSize);
|
||||
mType.ClassLayout = new ClassLayoutUser(1, (uint)type.Sizes.NativeSize);
|
||||
|
||||
// Add nested types
|
||||
foreach (var nestedType in type.DeclaredNestedTypes)
|
||||
@@ -242,7 +242,7 @@ namespace Il2CppInspector.Outputs
|
||||
AddMethod(module, mType, method);
|
||||
|
||||
// Add token attribute
|
||||
if (type.Definition != null)
|
||||
if (type.Definition.IsValid)
|
||||
mType.AddAttribute(module, tokenAttribute, ("Token", $"0x{type.MetadataToken:X8}"));
|
||||
|
||||
// Add custom attribute attributes
|
||||
@@ -270,7 +270,7 @@ namespace Il2CppInspector.Outputs
|
||||
if (field.HasFieldRVA) {
|
||||
// Attempt to get field size
|
||||
|
||||
var fieldSize = field.FieldType.Sizes.nativeSize;
|
||||
var fieldSize = field.FieldType.Sizes.NativeSize;
|
||||
var preview = model.Package.Metadata.ReadBytes((long) field.DefaultValueMetadataAddress, fieldSize);
|
||||
|
||||
mField.InitialValue = preview;
|
||||
@@ -311,7 +311,7 @@ namespace Il2CppInspector.Outputs
|
||||
|
||||
// Add token attribute
|
||||
// Generic properties and constructed properties (from disperate get/set methods) have no definition
|
||||
if (prop.Definition != null)
|
||||
if (prop.Definition.IsValid)
|
||||
mProp.AddAttribute(module, tokenAttribute, ("Token", $"0x{prop.MetadataToken:X8}"));
|
||||
|
||||
// Add custom attribute attributes
|
||||
@@ -433,8 +433,8 @@ namespace Il2CppInspector.Outputs
|
||||
("Offset", string.Format("0x{0:X}", model.Package.BinaryImage.MapVATR(method.VirtualAddress.Value.Start))),
|
||||
("VA", method.VirtualAddress.Value.Start.ToAddressString())
|
||||
};
|
||||
if (method.Definition.slot != ushort.MaxValue)
|
||||
args.Add(("Slot", method.Definition.slot.ToString()));
|
||||
if (method.Definition.Slot != ushort.MaxValue)
|
||||
args.Add(("Slot", method.Definition.Slot.ToString()));
|
||||
|
||||
mMethod.AddAttribute(module, addressAttribute, args.ToArray());
|
||||
}
|
||||
@@ -649,7 +649,7 @@ namespace Il2CppInspector.Outputs
|
||||
AddCustomAttribute(module, module.Assembly, ca);
|
||||
|
||||
// Add token attributes
|
||||
module.AddAttribute(module, tokenAttribute, ("Token", $"0x{asm.ImageDefinition.token:X8}"));
|
||||
module.AddAttribute(module, tokenAttribute, ("Token", $"0x{asm.ImageDefinition.Token:X8}"));
|
||||
module.Assembly.AddAttribute(module, tokenAttribute, ("Token", $"0x{asm.MetadataToken:X8}"));
|
||||
|
||||
if (types.TryGetValue(module, out var shallowTypes))
|
||||
|
||||
@@ -353,7 +353,7 @@ namespace Il2CppInspector.Outputs
|
||||
foreach (var asm in assemblies) {
|
||||
text.Append($"// Image {asm.Index}: {asm.ShortName} - Assembly: {asm.FullName}");
|
||||
if (!SuppressMetadata)
|
||||
text.Append($" - Types {asm.ImageDefinition.typeStart}-{asm.ImageDefinition.typeStart + asm.ImageDefinition.typeCount - 1}");
|
||||
text.Append($" - Types {asm.ImageDefinition.TypeStart}-{asm.ImageDefinition.TypeStart + asm.ImageDefinition.TypeCount - 1}");
|
||||
text.AppendLine();
|
||||
|
||||
// Assembly-level attributes
|
||||
@@ -426,7 +426,7 @@ namespace Il2CppInspector.Outputs
|
||||
sb.Append($" // Metadata: {field.DefaultValueMetadataAddress.ToAddressString()}");
|
||||
// For static array initializers, output metadata address and preview
|
||||
if (field.HasFieldRVA && !SuppressMetadata) {
|
||||
var preview = model.Package.Metadata.ReadBytes((long) field.DefaultValueMetadataAddress, field.FieldType.Sizes.nativeSize);
|
||||
var preview = model.Package.Metadata.ReadBytes((long) field.DefaultValueMetadataAddress, field.FieldType.Sizes.NativeSize);
|
||||
sb.Append($" // Static value (base64): {Convert.ToBase64String(preview)} - Metadata: {field.DefaultValueMetadataAddress.ToAddressString()}");
|
||||
}
|
||||
sb.Append("\n");
|
||||
|
||||
@@ -184,7 +184,7 @@ namespace Il2CppInspector.Outputs
|
||||
// TODO: In the future, add data ranges for the entire IL2CPP metadata tree
|
||||
writeArray("arrayMetadata", () => {
|
||||
if (model.Package.Version >= MetadataVersions.V242) {
|
||||
writeObject(() => writeTypedArray(binary.CodeRegistration.pcodeGenModules, binary.Modules.Count, "struct Il2CppCodeGenModule *", "g_CodeGenModules"));
|
||||
writeObject(() => writeTypedArray(binary.CodeRegistration.CodeGenModules, binary.Modules.Count, "struct Il2CppCodeGenModule *", "g_CodeGenModules"));
|
||||
}
|
||||
}, "IL2CPP Array Metadata");
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user