Files
Sylpheed/tools/re-capture/title_states_capture.sh
Sylpheed RE agent b9062ea3bc tools: a working route to the menu, and the classifier that could not see it
screen_id.py called the main menu "other". Its menu rule required a near-white
fraction above 1.5%, measured in 2026-07; the menu reached from the boot title
measures 0.03% (mean 13,26,59 — dark, strongly blue, essentially green-free).
That is worse than a cosmetic miss: a script that waits for "menu" and never
sees it reports the navigation as failed while the menu is on screen, which is
exactly what happened here. Both measured signatures are now documented in the
code and both classify.

menu_draw_capture.sh now taps ONCE on the first title rather than up to 40 times:
repeating was measured to be useless (the attract title accepts nothing) and the
first title accepts a single press.

title_states_capture.sh is new — it captures the draw list in both title states
in one run, which is what refuted the "the attract title omits the button plate"
theory.
2026-08-18 23:10:29 +00:00

60 lines
2.4 KiB
Bash
Executable File

#!/usr/bin/env bash
# Capture the UI draw list in BOTH title states, in one run:
# (1) the title that appears at the end of the boot sequence, and
# (2) the title the attract loop comes back to.
#
# The question is whether they composite differently — specifically whether the
# interactive one draws `ptbtn00` (the PRESS (A) BUTTON plate, GP_TITLE build 2)
# and the other does not. That would give an observable tell for the state in
# which (A) is accepted, which is currently a matter of luck.
#
# NO pad input at all: a press is what we are trying to explain, and tapping
# through the boot has ended a run on a permanent black screen before.
set -u
export HOME=/sylph-home/re SDL_AUDIODRIVER=dummy DISPLAY=:98
SD="$(cd "$(dirname "$0")" && pwd)"
OUT="${1:-/sylph-home/re/titlestates}"
mkdir -p "$OUT"; rm -f "$OUT"/xenia_re_ui_draws_*.log
shot(){ screenshot "$1" >/dev/null 2>&1; }
screen(){ shot /tmp/tsc.png; python3 "$SD/screen_id.py" /tmp/tsc.png | awk '{print $1}'; }
alive(){ ps -o pid=,stat= -C xenia_canary 2>/dev/null | awk '$2 !~ /^Z/ {print $1}'; }
( cd "$OUT" && nohup run-canary --mem_watch=false --log_ui_draws=true \
--ui_draw_capture_frames=4 --ui_draw_capture_max=4000 \
--logged_profile_slot_0_xuid=B13EBABEBABEBABE \
>"$OUT/canary.stdout" 2>"$OUT/canary.stderr" & )
sleep 8
until xdotool search --name "Xenia-canary" >/dev/null 2>&1; do
[ -n "$(alive)" ] || { echo "EMULATOR GONE"; exit 4; }; sleep 1
done
win="$(xdotool search --name "Xenia-canary" | tail -1)"
arm(){ # arm the capture and dismiss the menu bar F10 also opens
xdotool windowactivate --sync "$win"; sleep 1
xdotool key F10; sleep 3
xdotool mousemove 900 400 click 1; sleep 2
}
wait_for(){ # wait_for <screen> <timeout>
local want="$1" deadline=$(( SECONDS + $2 )) s
while [ $SECONDS -lt $deadline ]; do
s="$(screen)"; echo " t=${SECONDS}s $s (want $want)"
[ "$s" = "$want" ] && return 0
sleep 4
done
return 1
}
echo "== phase 1: the boot title"
wait_for title 420 || { echo "NO BOOT TITLE"; exit 1; }
shot "$OUT/title-boot.png"; arm
echo "== phase 2: wait for the attract movie to take over"
wait_for other 240 || echo " (never left the title)"
echo "== phase 3: the attract title"
wait_for title 420 || { echo "NO ATTRACT TITLE"; exit 2; }
shot "$OUT/title-attract.png"; arm
ls -l "$OUT"/xenia_re_ui_draws_*.log 2>/dev/null
grep -i "UI-CAP" "$OUT/canary.stdout" | tail -6
echo "TITLE STATES CAPTURE DONE (emulator left running)"