mirror of
https://github.com/TheBozos/VP2S_Recomp.git
synced 2026-12-01 07:38:48 -10:00
- 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]>
36 lines
1.5 KiB
Java
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]);
|
|
}
|
|
}
|