Files
Sylpheed/tools/re-capture/tutorial_launch.sh
Sylpheed RE agent 0b4dcc6e8f tools/docs: the second-capital-ship blocker is stale; retry boots, not presses
BACKLOG said the per-class ship generalisation needs "the capture-ship-placement
build of Canary". Checked: the ship capture is in the CURRENT build —
RequestShipCaptureFrame and CaptureShipDrawForRE are in command_processor.cc on
auto/re-ui-draw-order, and F10 wrote a 2.9 MB ship capture from this session's
binary. No separate build is needed.

What actually blocks it is navigation: a mission is behind the main menu, and (A)
at the title is accepted on about half of boots with nothing observable
predicting which. tutorial_launch.sh drives boot -> title -> menu -> TUTORIAL and
retries the WHOLE BOOT on refusal, because re-pressing the same title never
works — measured, not assumed.

First run of it: (A) refused, so it rebooted. That is the expected shape rather
than a failure of the harness.
2026-08-19 03:24:40 +00:00

62 lines
2.3 KiB
Bash
Executable File

#!/usr/bin/env bash
# Boot -> title -> main menu -> TUTORIAL, and report where it lands.
#
# The point is a runtime capture of a SECOND capital ship (the per-class
# generalisation in BACKLOG). The ship capture itself is in the current build —
# F10 arms it — so what is being tested here is only whether a mission is
# reachable, given that (A) at the title takes about half the time.
set -u
export HOME=/sylph-home/re SDL_AUDIODRIVER=dummy DISPLAY=:98
SD="$(cd "$(dirname "$0")" && pwd)"
OUT="${1:-/sylph-home/re/tutorial}"
mkdir -p "$OUT"
shot(){ screenshot "$1" >/dev/null 2>&1; }
screen(){ shot /tmp/tl.png; python3 "$SD/screen_id.py" /tmp/tl.png | awk '{print $1}'; }
alive(){ ps -o pid=,stat= -C xenia_canary 2>/dev/null | awk '$2 !~ /^Z/ {print $1}'; }
# (A) at the title is accepted on roughly half of boots and nothing observable
# predicts which (docs/re/canary-scripted-input-traps.md), so retry the whole
# boot rather than the press: pressing again on the same title never works.
for attempt in $(seq 1 "${ATTEMPTS:-4}"); do
echo "=== attempt $attempt"
pkill -9 -x xenia_canary 2>/dev/null; sleep 3
( cd "$OUT" && nohup run-canary --mem_watch=false \
--logged_profile_slot_0_xuid=B13EBABEBABEBABE \
>"$OUT/canary.stdout" 2>&1 & )
sleep 8
until xdotool search --name "Xenia-canary" >/dev/null 2>&1; do
[ -n "$(alive)" ] || { echo "EMULATOR GONE"; exit 4; }; sleep 1
done
deadline=$(( SECONDS + 400 ))
s=""
while [ $SECONDS -lt $deadline ]; do
s="$(screen)"; [ "$s" = "title" ] && break; sleep 2
done
[ "$s" = "title" ] || { echo "NO TITLE this attempt"; continue; }
echo "title at ${SECONDS}s -> A"
python3 "$SD/pad.py" tap A 0.3
for _ in 1 2 3 4 5 6 7 8; do sleep 3; s="$(screen)"; [ "$s" = "menu" ] && break; done
shot "$OUT/menu.png"
if [ "$s" != "menu" ]; then
echo "NO MENU (screen=$s) — (A) not accepted; rebooting"
continue
fi
echo "menu reached; two d-pad steps down to TUTORIAL, then A"
python3 "$SD/pad.py" dpad down 0.08; sleep 1.2
python3 "$SD/pad.py" dpad down 0.08; sleep 1.2
shot "$OUT/menu-on-tutorial.png"
python3 "$SD/pad.py" tap A 0.3
for i in $(seq 1 24); do
sleep 8; s="$(screen)"
shot "$OUT/after-$(printf '%02d' "$i").png"
echo " t+$((i*8))s $s"
[ "$s" = "flight" ] && { echo "IN FLIGHT"; break; }
done
echo "TUTORIAL LAUNCH ATTEMPT DONE (emulator left running)"
exit 0
done
echo "GAVE UP after ${ATTEMPTS:-4} boots"