- Инфраструктура: RTTI-дампы (rtti_dsp/full.json), декомпиляции DSP-классов (decomp_*.txt), Ghidra-скрипты (Dump*.java, ImportRtti*.java, Diag.java), depthcurve/curve_fits LUT. - Поведенческая модель sim_v5.py + sim.py (RMSE ~0.3dB), утилиты (measure, tt_sweep, patchparam, sweep, harness_*, verify_sim). - summary.md + roadmap.md (контракт из manual M1-M12, топология пайплайна из OCR, фазы A-C). - pipeline_ocr.txt: OCR диаграммы Appendix A (mid/side ручка, trim/mix/bypass порядок).
64 lines
3.3 KiB
Java
64 lines
3.3 KiB
Java
import ghidra.app.script.GhidraScript;
|
|
import ghidra.app.decompiler.DecompInterface;
|
|
import ghidra.app.decompiler.DecompileResults;
|
|
import ghidra.program.model.listing.Function;
|
|
import ghidra.program.model.listing.FunctionManager;
|
|
import ghidra.program.model.address.Address;
|
|
import java.io.PrintWriter;
|
|
import java.io.FileWriter;
|
|
import java.util.LinkedHashMap;
|
|
import java.util.Map;
|
|
|
|
public class DumpDsp extends GhidraScript {
|
|
@Override
|
|
public void run() throws Exception {
|
|
Map<String,long[]> vts = new LinkedHashMap<String,long[]>();
|
|
vts.put("SpectralProcessor", new long[]{0x1824abb90L, 64});
|
|
vts.put("Soothe2ModuleBase", new long[]{0x1824ac7a8L, 64});
|
|
vts.put("CloudyAudioProcessor", new long[]{0x1824ab7c0L, 64});
|
|
vts.put("AudioProcessingModule", new long[]{0x1824ac638L, 64});
|
|
vts.put("IIRFilterExtended", new long[]{0x1824ac5d8L, 64});
|
|
vts.put("Soothe2FilterGraph", new long[]{0x1824be810L, 64});
|
|
vts.put("FilterGraph_6_0x400", new long[]{0x1824be228L, 64});
|
|
vts.put("FilterGraphGrid", new long[]{0x1824be0a8L, 64});
|
|
DecompInterface di = new DecompInterface();
|
|
di.openProgram(currentProgram);
|
|
FunctionManager fm = currentProgram.getFunctionManager();
|
|
PrintWriter pw = new PrintWriter(new java.io.BufferedWriter(new FileWriter("/home/m/re-tools/decomp_dsp.txt", false)));
|
|
for (Map.Entry<String,long[]> e : vts.entrySet()) {
|
|
long base = e.getValue()[0]; int n = (int) e.getValue()[1];
|
|
pw.println("############ VTABLE " + e.getKey() + " 0x" + Long.toHexString(base));
|
|
pw.println("SLOTLIST:");
|
|
for (int i = 0; i < n; i++) {
|
|
Address va = currentProgram.getAddressFactory().getDefaultAddressSpace().
|
|
getAddress(base + i * 8L);
|
|
long tgt = (long) currentProgram.getMemory().getLong(va);
|
|
if (tgt < 0x180000000L || tgt > 0x182a00000L) continue;
|
|
Address a = currentProgram.getAddressFactory().getDefaultAddressSpace().getAddress(tgt);
|
|
Function f = fm.getFunctionAt(a);
|
|
long sz = (f == null) ? 0 : f.getBody().getNumAddresses();
|
|
pw.println(" [" + i + "] 0x" + Long.toHexString(tgt) + " size=" + sz);
|
|
}
|
|
pw.println("CCODE:");
|
|
for (int i = 0; i < n; i++) {
|
|
Address va = currentProgram.getAddressFactory().getDefaultAddressSpace().
|
|
getAddress(base + i * 8L);
|
|
long tgt = (long) currentProgram.getMemory().getLong(va);
|
|
if (tgt < 0x180000000L || tgt > 0x182a00000L) continue;
|
|
Address a = currentProgram.getAddressFactory().getDefaultAddressSpace().getAddress(tgt);
|
|
Function f = fm.getFunctionAt(a);
|
|
if (f == null) continue;
|
|
long sz = f.getBody().getNumAddresses();
|
|
if (sz < 60) continue;
|
|
DecompileResults res = di.decompileFunction(f, 90, monitor);
|
|
if (res != null && res.getDecompiledFunction() != null) {
|
|
pw.println(" --- [" + i + "] 0x" + Long.toHexString(tgt) + " size=" + sz + " ---");
|
|
pw.println(res.getDecompiledFunction().getC());
|
|
}
|
|
}
|
|
}
|
|
pw.close();
|
|
di.dispose();
|
|
println("DSP_DONE");
|
|
}
|
|
} |