#!/usr/bin/env bash # F1 -- MEASURE THE MENU REPEAT RATE, as a count of presents between cursor moves. # # The human watched the real game: a held direction repeats. `C_PAD_DECODER` has # no timer on any direction path (pad-decoder-double-tap-not-key-repeat.md), so # the repeat is in the layer above and can only be MEASURED here. # # Instrument: the guest's own vertex stream via the UI draw logger -- the same # instrument that settled the splash, and the one with no Canary processing in # it. A cursor move shows up as the focused quad's NDC rect changing. # # ⚠️ Drives the boot BLIND on timings rather than classifying frames. That is # deliberate: the classifier route costs a screenshot per poll, and screenshots # cost ~10 s each while xenia runs. The draw log records what actually happened, # so a mistimed press is visible in the result rather than silently assumed. # # menu_repeat_probe.sh [out_dir] [hold_button] set -u export HOME=/sylph-home/re SDL_AUDIODRIVER=dummy DISPLAY=:98 export XENIA_PAD_FILE=/tmp/xenia_pad.txt OUT="${1:-/sylph-home/re/f1}" HOLD="${2:-DOWN}" mkdir -p "$OUT"; rm -f "$OUT"/xenia_re_ui_draws_*.log pad() { printf '%s' "$1" > "$XENIA_PAD_FILE.tmp"; mv "$XENIA_PAD_FILE.tmp" "$XENIA_PAD_FILE"; } tap() { pad "press=$1"; sleep 0.40; pad ""; sleep 0.30; } pad "" ( cd "$OUT" && nohup run-canary --log_ui_draws=true \ --ui_draw_capture_frames=4000 --ui_draw_capture_max=900000 \ >"$OUT/canary.stdout" 2>"$OUT/canary.stderr" & ) sleep 8 # Arm the capture. ⚠️ Copied verbatim from ui_draw_capture.sh, which works. # A first attempt used `xdotool search --class xenia_canary key --window %1 F10` # and armed NOTHING -- it failed silently behind a `|| true`, the run completed, # and only the ABSENT log revealed it. Window lookup is by NAME, the key goes to # the window AND globally, and a failure is now fatal rather than tolerated. win="$(xdotool search --name "Xenia-canary" | tail -1)" [ -n "$win" ] || { echo "FATAL: no Xenia window to arm"; pkill -x xenia_canary; exit 1; } xdotool windowactivate "$win" 2>/dev/null xdotool key --window "$win" F10 xdotool key F10 echo "armed at ${SECONDS}s (win=$win)" # The boot, driven blind. Splashes ~8 s, then the attract movie; A skips it. sleep 12; tap A ; echo "A #1 (skip video) at ${SECONDS}s" sleep 6; tap A ; echo "A #2 (reveal plate) at ${SECONDS}s" sleep 3; tap A ; echo "A #3 (accept plate) at ${SECONDS}s" sleep 5 echo "HOLDING $HOLD at ${SECONDS}s" pad "press=$HOLD" sleep 12 pad "" echo "released at ${SECONDS}s" sleep 3 pkill -x xenia_canary echo "done at ${SECONDS}s; log:"; ls -la "$OUT"/*.log