#!/usr/bin/env python3 """Does Ⓐ on a SETTLED BOOT title reach the main menu? One clean trial. navigation.md carried "the boot title accepts a single Ⓐ (2 of 2 runs)". I reported a counter-example, then WITHDREW it: three emulators were live at once, all reading /tmp/xenia_pad.txt and sharing display :98, so a press reached every instance while `screenshot` grabbed whichever window was topmost. That left the claim unsupported rather than refuted, and this is the clean re-run. Gated on the plate pulse (glyph in [500,2500] held 12 samples) so the press lands on the BOOT title, not the attract loop's -- the attract title is documented as accepting nothing, and a single `screen_id.py` classification cannot tell them apart. After the press it samples every ~2 s for 40 s and reports the glyph series, so the outcome AND the latency are visible, and a null result is distinguishable from a slow one. a_press_reliability.py OUTDIR [wait_s] """ import subprocess, sys, time, os import numpy as np from PIL import Image OUT = sys.argv[1]; WAIT = float(sys.argv[2]) if len(sys.argv) > 2 else 900 W, H = 1280, 720 NEED, CEIL, HOLD = 500, 2500, 12 def _open(): return subprocess.Popen( ["ffmpeg","-loglevel","error","-f","x11grab","-draw_mouse","0", "-video_size",f"{W}x{H}","-i",":98","-r","4","-f","rawvideo", "-pix_fmt","rgb24","-"], stdout=subprocess.PIPE, bufsize=W*H*3*2) def glyph(a): r,g,b = a[:,:,0],a[:,:,1],a[:,:,2] return int(((g>130)&(g-r>45)&(g-b>45)).sum()) def tap(btn, secs=0.5): for st in (f"press={btn}",""): with open("/tmp/xenia_pad.txt.tmp","w") as f: f.write(st) os.replace("/tmp/xenia_pad.txt.tmp","/tmp/xenia_pad.txt") if st: time.sleep(secs) T0=time.time(); p,n,seg,streak=_open(),W*H*3,time.time(),0 state="wait"; t_press=None; samples=[] while time.time()-T0 < WAIT: if time.time()-seg > 30: p.kill(); p=_open(); seg=time.time() buf=p.stdout.read(n) if len(buf)=HOLD: print(f"[{time.time()-T0:7.1f}s] BOOT TITLE SETTLED (glyph {c}) — pressing A", flush=True) Image.fromarray(a).save(f"{OUT}/before.png") tap("A",0.5); t_press=time.time(); state="watch"; last=0 elif state=="watch": el=time.time()-t_press if el-last >= 2.0: last=el; samples.append((el,c)) Image.fromarray(a).save(f"{OUT}/after-{int(el):02d}.png") print(f" +{el:5.1f}s glyph {c}", flush=True) if el > 40: break p.kill() print("\nglyph series after the press:", [f"{e:.0f}s:{g}" for e,g in samples], flush=True) print("A-PRESS TRIAL DONE", flush=True)