JSON: Add arrayMetadata entry (currently Il2CppCodeGenModule *[])
This commit is contained in:
@@ -124,6 +124,7 @@ namespace Il2CppInspector.Model
|
||||
Add(binary.MetadataRegistrationPointer, binary.MetadataRegistration);
|
||||
|
||||
if (Model.Package.Version >= 24.2) {
|
||||
// TODO: Add some kind of AppArray composite type for arrays as we'll be adding more later
|
||||
Add(binary.CodeRegistration.pcodeGenModules, binary.CodeGenModulePointers);
|
||||
|
||||
foreach (var ptr in binary.CodeGenModulePointers)
|
||||
|
||||
@@ -147,16 +147,10 @@ namespace Il2CppInspector.Outputs
|
||||
private void writeMetadata() {
|
||||
var binary = model.Package.Binary;
|
||||
|
||||
// TODO: In the future, add struct definitions/fields, data ranges and the entire IL2CPP metadata tree
|
||||
writeArray("typeMetadata", () => {
|
||||
writeObject(() => writeTypedName(binary.CodeRegistrationPointer, "struct Il2CppCodeRegistration", "g_CodeRegistration"));
|
||||
writeObject(() => writeTypedName(binary.MetadataRegistrationPointer, "struct Il2CppMetadataRegistration", "g_MetadataRegistration"));
|
||||
|
||||
if (model.Package.Version >= 24.2)
|
||||
writeObject(() => writeTypedName(binary.CodeRegistration.pcodeGenModules,
|
||||
// Ghidra doesn't like *[x] or ** so use * * instead
|
||||
$"struct Il2CppCodeGenModule * *", "g_CodeGenModules"));
|
||||
|
||||
foreach (var ptr in binary.CodeGenModulePointers)
|
||||
writeObject(() => writeTypedName(ptr.Value, "struct Il2CppCodeGenModule", $"g_{ptr.Key.Replace(".dll", "")}CodeGenModule"));
|
||||
}, "IL2CPP Type Metadata");
|
||||
@@ -177,6 +171,13 @@ namespace Il2CppInspector.Outputs
|
||||
"void il2cpp_codegen_register(const Il2CppCodeRegistration* const codeRegistration, const Il2CppMetadataRegistration* const metadataRegistration)",
|
||||
"il2cpp_codegen_register"));
|
||||
}, "IL2CPP Function Metadata");
|
||||
|
||||
// TODO: In the future, add data ranges for the entire IL2CPP metadata tree
|
||||
writeArray("arrayMetadata", () => {
|
||||
if (model.Package.Version >= 24.2) {
|
||||
writeObject(() => writeTypedArray(binary.CodeRegistration.pcodeGenModules, binary.Modules.Count, "struct Il2CppCodeGenModule *", "g_CodeGenModules"));
|
||||
}
|
||||
}, "IL2CPP Array Metadata");
|
||||
}
|
||||
|
||||
private void writeApis() {
|
||||
@@ -214,6 +215,7 @@ namespace Il2CppInspector.Outputs
|
||||
}, "Symbol table");
|
||||
}
|
||||
|
||||
// JSON helpers
|
||||
private void writeObject(Action objectWriter) => writeObject(null, objectWriter);
|
||||
|
||||
private void writeObject(string name, Action objectWriter, string description = null) {
|
||||
@@ -250,6 +252,11 @@ namespace Il2CppInspector.Outputs
|
||||
writer.WriteString("signature", type.ToEscapedString());
|
||||
}
|
||||
|
||||
private void writeTypedArray(ulong address, int count, string type, string name) {
|
||||
writeTypedName(address, type, name);
|
||||
writer.WriteNumber("count", count);
|
||||
}
|
||||
|
||||
private void writeDotNetSignature(MethodBase method) {
|
||||
writer.WriteString("dotNetSignature", method.ToString().ToEscapedString());
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user