"""Dump the payload region MEMORY (0x8014000-0x8018000) at draw ~30 and draw ~300 of trek — the full compiled scene at two depths, independent of when writes occurred. Saves trek_content30.pkl / trek_content300.pkl for frame assembly.""" import sys, time, struct, pickle sys.path.insert(0, r'C:\VWE\TeslaRel410\emulator\firmware-decomp') sys.path.insert(0, r'C:\VWE\TeslaRel410\dpl3-revive\patha') import emu860, dis860, emu_main emu860.Mem.log = lambda self, *a, **k: None S = r'C:\Users\cyd\AppData\Local\Temp\claude\c--VWE-TeslaRel410\4e848c76-6e89-4034-8047-d8d491cb32d8\scratchpad' snap = pickle.load(open(S + r'\snap_trek0.pkl', 'rb')) r = emu_main.MainRunner(r'C:\VWE\TeslaRel410\dpl3-revive\patha\trek.raw.bin', fw='capfw7', max_cmds=30000) cpu = r.cpu cpu.mem.pages = {k: bytearray(v) for k, v in snap['pages'].items()} cpu.ctrl.clear(); cpu.ctrl.update(snap['ctrl']) cpu.r = list(snap['r']); cpu.f = list(snap['f']); cpu.cr = dict(snap['cr']); cpu.pc = snap['pc'] cpu._apipe = list(snap['apipe']); cpu._mpipe = list(snap['mpipe']); cpu._fp_pipes() cpu._lpipe = list(snap['lpipe']); cpu._gpipe = list(snap['gpipe']) cpu._kr, cpu._ki, cpu._t = snap['kr'], snap['ki'], snap['t'] cpu.lcc = snap['lcc']; r.qi = snap['qi']; r.heap = list(snap['heap']) def dump(tag): words = {} for a in range(0x0815e000, 0x08180000, 4): w = cpu.mem.r32(a) if w: words[a] = w pickle.dump({'mem': words, 'qi': r.qi}, open(S + r'\trek_content%s.pkl' % tag, 'wb')) print("dumped %d nonzero words at cmd %d -> trek_content%s.pkl" % (len(words), r.qi, tag), flush=True) t0 = time.time(); startq = r.qi targets = [(startq + 60, '30')] ti = 0 while time.time() - t0 < 800 and ti < len(targets): if r.qi >= targets[ti][0]: dump(targets[ti][1]); ti += 1 continue h = r.hooks.get(cpu.pc) if h: if h(cpu) == 'done': break continue if not cpu.step(): break print("done at cmd %d in %.0fs" % (r.qi, time.time() - t0))