Files
Thomas MartinandClaude Opus 5.5 b7daba0bae Bind Sony SDK functions and boot further: file table read, threads up
- tools/pipeline.py: sdk stage (ps2_analyzer signatures, 177 bindings
  merged into the recompiler config) and entries stage
  (tools/find_entry_points.py: functions reached only through pointers)
- port/main.cpp: VP2S_DIAG now dumps every guest thread, semaphores with
  waiters and the CD manager state
- ghidra_scripts/Decompile.java: creates missing functions on the fly
- docs: boot progress, file table at LBA 1024 identified (XOR stream)
- external/PS2Recomp: stub synthesis for unmapped bindings, CD callback

The game now reads and decrypts its file table and starts its threads;
it waits on IOP RPC replies (sound driver) next.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
2026-10-20 22:38:57 +02:00

36 lines
1.5 KiB
Java

// Decompiles the functions at the given addresses into an output file.
// Args: <output file> <addr> [addr...]
// @category VP2S
import java.io.PrintWriter;
import ghidra.app.decompiler.*;
import ghidra.app.script.GhidraScript;
import ghidra.program.model.listing.Function;
public class Decompile extends GhidraScript {
@Override
public void run() throws Exception {
String[] args = getScriptArgs();
DecompInterface di = new DecompInterface();
di.openProgram(currentProgram);
try (PrintWriter out = new PrintWriter(args[0], "UTF-8")) {
for (int i = 1; i < args.length; i++) {
Function f = getFunctionAt(toAddr(args[i]));
if (f == null) f = getFunctionContaining(toAddr(args[i]));
if (f == null) {
// Routines only reached through pointers may be missing: create them (not saved with -readOnly)
disassemble(toAddr(args[i]));
f = createFunction(toAddr(args[i]), null);
}
if (f == null) { out.println("// no function at " + args[i]); continue; }
DecompileResults r = di.decompileFunction(f, 120, monitor);
out.println("// ===== " + f.getEntryPoint() + " " + f.getName());
out.println(r.decompileCompleted() ? r.getDecompiledFunction().getC() : "// failed: " + r.getErrorMessage());
}
}
di.dispose();
println("wrote " + args[0]);
}
}