Use il.baddr in the il2cpp script

This commit is contained in:
pancake 2024-11-09 16:09:21 +01:00 committed by pancake
parent 073660d42a
commit 59e21269fa

View File

@ -2,27 +2,33 @@
function flagName(s) { function flagName(s) {
return r2.call('fD ' + s).trim(); return r2.call('fD ' + s).trim();
} }
const baddr = r2.cmd("?vx il.baddr 2> /dev/null");
const script = JSON.parse(r2.cmd("cat script.json")); const script = JSON.parse(r2.cmd("cat script.json"));
const commands = []; const commands = [];
console.error("Using il.baddr = " + baddr);
console.error("Loading methods..."); console.error("Loading methods...");
for (const method of script.ScriptMethod) { for (const method of script.ScriptMethod) {
const fname = flagName(method.Name); const fname = flagName(method.Name);
commands.push("f sym.il." + fname + " = " + method.Address); const faddr = method.Address + baddr;
commands.push("f sym.il." + fname + " = " + faddr);
} }
console.error("Loading strings..."); console.error("Loading strings...");
for (const str of script.ScriptString) { for (const str of script.ScriptString) {
const fname = flagName(str.Value); const fname = flagName(str.Value);
commands.push("f str.il." + fname + " = " + str.Address); const faddr = str.Address + baddr;
commands.push("f str.il." + fname + " = " + faddr);
} }
console.error("Loading IL metadata..."); console.error("Loading IL metadata...");
for (const meta of script.ScriptMetadata) { for (const meta of script.ScriptMetadata) {
const fname = flagName(meta.Name) + (meta.Address & 0xfff); const fname = flagName(meta.Name) + (meta.Address & 0xfff);
commands.push("f il.meta." + fname + " = " + meta.Address); const faddr = meta.Address + baddr;
commands.push("f il.meta." + fname + " = " + faddr);
} }
console.error("Loading IL methods metadata..."); console.error("Loading IL methods metadata...");
for (const meta of script.ScriptMetadataMethod) { for (const meta of script.ScriptMetadataMethod) {
const fname = flagName(meta.Name) + (meta.Address & 0xfff); const fname = flagName(meta.Name) + (meta.Address & 0xfff);
commands.push("f il.meta.method." + fname + " = " + meta.Address); const faddr = meta.Address + baddr;
commands.push("f il.meta.method." + fname + " = " + faddr);
} }
console.error("Importing flags..."); console.error("Importing flags...");
for (const cmd of commands) { for (const cmd of commands) {