Files
Sylpheed/tools/re-capture/title_draw_capture.sh
sylph-decoder 4c92f54439 re: make the one-emulator rule enforceable instead of remembered
The withdrawal last iteration was caused by `rm -f /tmp/xenia-canary.lock` --
the obvious way past a lock orphaned by kill -9, which also disables the guard
for every later launch. Three instances ended up live at once, sharing
/tmp/xenia_pad.txt and display :98, and silently confounded an input experiment.

Care is not a fix, so this is tooling. ensure_single_emulator.sh counts live
instances, stops them (plain kill, then -9, each with a bounded wait), verifies
ZERO, and only then removes the lock -- refusing loudly if any remain. The lock
is never removed before the condition it guards against is verified absent.

FOUR scripts did the bare `rm -f`, and only two were mine from today:
menu_loop_session.sh, title_draw_capture.sh, poke_control.sh and
resume_reliability.sh. So the footgun was corpus-wide rather than introduced
this session. All four now route through the guard.

The guard is controlled rather than assumed: run against a deliberately started
live instance it reports "1 instance(s) live -- stopping them", ends at 0 with
the lock cleared, and exits 0. A guard that only ever passes on an already-clean
slate would prove nothing.

It also kills by process NAME. `pkill -f xenia_canary` matches the shell running
it -- that has now cost this corpus three commands, one of them a cleanup that
died halfway and left the very instances it was meant to remove.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Wuu56cE8vJGTBtn1ppsk8v
2026-08-30 16:23:59 +00:00

37 lines
1.9 KiB
Bash
Executable File

#!/usr/bin/env bash
# Does the game DRAW the sweep leaves (pteff03 / pteff03a) on a SETTLED title?
#
# ui-resting-pose.md records a tension: two renders one plateau-phase apart differ
# by RMSE 11.9 INSIDE the adjudication box, while two captures of that screen from
# different sessions differ by 0.32 there, and an --at sweep against a capture is
# flat to 1.2. A metric cannot be insensitive to an 11.9 change unless what
# changed is largely absent from what it is compared against.
#
# The leaves are a 400 px-wide strip at scale (100, 600) / (100, 800) -- 1080 and
# 1440 px tall, taller than the screen. If the game draws them and they free-run,
# the draw stream shows a tall strip whose x translates frame to frame. That is
# unmistakable, and the plate's own pulsing is the in-capture control that the
# instrument is seeing real variation rather than one frozen frame.
set -u
export HOME=/sylph-home/re SDL_AUDIODRIVER=dummy DISPLAY=:98
SD="$(cd "$(dirname "$0")" && pwd)"
OUT="${1:-/sylph-home/re/titledraw}"; mkdir -p "$OUT"; rm -f "$OUT"/xenia_re_ui_draws_*.log
. "$(dirname "${BASH_SOURCE[0]}")/ensure_single_emulator.sh"
ensure_single_emulator || exit 3
( cd "$OUT" && nohup run-canary --mem_watch=false --log_ui_draws=true \
--ui_draw_capture_frames="${FRAMES:-150}" --ui_draw_capture_max=400000 \
--logged_profile_slot_0_xuid=B13EBABEBABEBABE \
>"$OUT/canary.stdout" 2>"$OUT/canary.stderr" & )
sleep 10
ps -C xenia_canary >/dev/null 2>&1 || { echo "EMULATOR DID NOT START:"; tail -3 "$OUT/canary.stderr"; exit 4; }
until xdotool search --name "Xenia-canary" >/dev/null 2>&1; do sleep 1; done
win="$(xdotool search --name "Xenia-canary" | tail -1)"
python3 "$SD/wait_plate_pulse.py" 900 || exit 1
xdotool windowactivate --sync "$win"; sleep 1
xdotool key F10; sleep 0.6
xdotool mousemove 900 400 click 1
sleep 12
grep -i "UI-CAP" "$OUT/canary.stdout" | tail -3
ls -l "$OUT"/xenia_re_ui_draws_*.log 2>/dev/null || echo "NO CAPTURE LOG"
echo "TITLE DRAW CAPTURE DONE"