#!/usr/bin/env python3 import subprocess, os, glob, sys, time, struct, re RPP = sys.argv[1] if len(sys.argv) > 1 else "/home/m/soothe-bt/render_rt.rpp" KEEP = len(sys.argv) > 2 and sys.argv[2] == "keep" VPTR = 0x1824abb90 # SpectralProcessor vtbl first entry addr (static). verify at runtime too CTOR = 0x180529610 proc = subprocess.Popen( ['reaper', '-nosplash', '-renderproject', RPP], stdout=open('/tmp/rtdump2.log', 'w'), stderr=subprocess.STDOUT) print('reaper', proc.pid, flush=True) host = None deadline = time.time() + 90 while time.time() < deadline and not KEEP: found = [] for p in glob.glob('/proc/[0-9]*'): try: pid = int(os.path.basename(p)) cmd = open(p + '/cmdline', 'rb').read().replace(b'\0', b' ').decode('utf8', 'replace') if 'yabridge-host' not in cmd: continue maps = open(f'/proc/{pid}/maps').read() if 'soothe2' in maps: found.append(pid) except Exception: pass if found: host = found[0] break time.sleep(0.2) print('host', host, flush=True) if not host: if not KEEP: proc.kill() sys.exit('no host') # gather ALL readable regions readable = [] maps = open(f'/proc/{host}/maps').read() tot = 0 for line in maps.splitlines(): parts = line.split() lo, hi = (int(x, 16) for x in parts[0].split('-')) if 'r' in parts[1]: readable.append((lo, hi, parts[1])) tot += hi - lo print('readable regions:', len(readable), 'total MB:', tot / 1e6, flush=True) mem = os.open(f'/proc/{host}/mem', os.O_RDONLY) pat = {v: struct.pack('