32 lines
1.6 KiB
Java
32 lines
1.6 KiB
Java
// Decompile the export root FUN_14119d2d0 and selected callees, to find the
|
|
// per-track row-insert that sets index_shift (0x02) and the 0x14/0x18/0x1a blob.
|
|
// Also dump callees of FUN_14117be20 (rekordbox/export.pdb string xref).
|
|
// Output -> ~/ghidra_proj/decroot.txt
|
|
import java.io.PrintWriter;
|
|
import java.util.*;
|
|
import ghidra.app.script.GhidraScript;
|
|
import ghidra.app.decompiler.*;
|
|
import ghidra.program.model.listing.*;
|
|
|
|
public class DecRoot extends GhidraScript {
|
|
PrintWriter out; DecompInterface di; FunctionManager fm;
|
|
Set<String> done = new HashSet<>();
|
|
void dec(String a, String why) {
|
|
Function f = fm.getFunctionContaining(currentProgram.getAddressFactory().getAddress(a));
|
|
if (f == null) { out.println("// no fn at " + a + " (" + why + ")"); return; }
|
|
if (!done.add(f.getEntryPoint().toString())) return;
|
|
out.println("\n//===== " + f.getName() + " @ " + f.getEntryPoint() + " [" + why + "] =====");
|
|
DecompileResults r = di.decompileFunction(f, 120, monitor);
|
|
out.println(r != null && r.decompileCompleted() ? r.getDecompiledFunction().getC() : "// decompile failed: "+(r!=null?r.getErrorMessage():"null"));
|
|
}
|
|
@Override public void run() throws Exception {
|
|
out = new PrintWriter("/home/ntr/ghidra_proj/decroot.txt");
|
|
di = new DecompInterface(); di.openProgram(currentProgram);
|
|
fm = currentProgram.getFunctionManager();
|
|
dec("0x14119d2d0", "export root (/.PIONEER/rekordbox/export.pdb)");
|
|
dec("0x14117be20", "rekordbox/export.pdb xref");
|
|
out.flush(); out.close();
|
|
println("wrote decroot.txt");
|
|
}
|
|
}
|