"""After user presses CROSS once, capture wtrace + fn_entry to see who wrote to the button-state table and what.""" import socket, json, struct s = socket.create_connection(('127.0.0.1', 4370), timeout=20) def send(p): s.sendall((json.dumps(p) + '\n').encode()) buf = b'' while True: c = s.recv(1<<20) if not c: break buf += c if buf.strip().endswith(b'}'): try: return json.loads(buf.decode()) except: continue def to_int(v): if isinstance(v,str): return int(v,16) if v.startswith('0x') else int(v) return v # 1. Snapshot button table print("=== button-table snapshot AFTER press ===") rr = send({'id':1,'cmd':'read_ram','addr':'0x80066B68','len':0x50}) b = bytes.fromhex(rr.get('hex','')) for i in range(0, len(b), 4): if i+4 > len(b): break w = struct.unpack('