forked from opencode.energia.arti.ee/vt1200
- seed the game from the raw 0x1E93C0 counter (now_ms() returns 0 on its
first call, so the old seed was always zero)
- track pause ourselves: FocusOut pauses once, FocusIn resumes only what we
paused (game_input('p') is a toggle)
- select ExposureMask so the Expose redraw path actually fires
- play.sh/play_keys.sh rebuild the COFF (OUTNAME=termtris) and assert the
run: status=0, tick>0, loops/events/quit per mode; render.sh asserts the
renderer finished; map symbol lookup is column-order independent
- run.sh passes -lightgun -lightgun_device mouse so the pointer drives the
tablet
- docs: link map addresses, monochrome/reverse wording, honest caption and
limits text
Verified here: play.sh and input.sh pass. Still open: the MAME driver in the
tree is newer than the installed binary (Oct 30 build, VR150-era geometry),
so the acceptance suite must be re-run after a rebuild.
50 lines
2.9 KiB
Bash
Executable File
50 lines
2.9 KiB
Bash
Executable File
#!/bin/sh
|
|
# play_keys.sh -- run the real game through move, panels and quit paths.
|
|
set -eu
|
|
DIR=$(cd "$(dirname "$0")" && pwd)
|
|
APP=$(cd "$DIR/.." && pwd)
|
|
ROOT=$(cd "$APP/../.." && pwd)
|
|
M=${MAME:-/home/arti/code/k-space/mame0289/vt1200}
|
|
EV="$APP/evidence"
|
|
mkdir -p "$EV" "$APP/build"
|
|
OUTNAME=termtris "$APP/build.sh" "$APP/src/vt1200/main.c" "$APP/src/game.c" "$APP/src/vt1200/scoredb.c" \
|
|
"$APP/src/vt1200/x11.c" "$APP/src/vt1200/compat.c" "$APP/src/vt1200/xgfix.c" \
|
|
>"$APP/build/play_keys-build.log" 2>&1
|
|
for mode in ${MODES:-move panels quit}; do
|
|
LOG="$APP/build/play_$mode.log"
|
|
rm -f "$EV/loader_frame3200.png"
|
|
DL=$(awk '{for(i=2;i<=NF;i++) if($i=="_dbg_loops") print $(i-1)}' "$APP/build/termtris.map" | head -1)
|
|
DE=$(awk '{for(i=2;i<=NF;i++) if($i=="_dbg_events") print $(i-1)}' "$APP/build/termtris.map" | head -1)
|
|
DT=$(awk '{for(i=2;i<=NF;i++) if($i=="_dbg_last") print $(i-1)}' "$APP/build/termtris.map" | head -1)
|
|
DF=$(awk '{for(i=2;i<=NF;i++) if($i=="_dbg_focus") print $(i-1)}' "$APP/build/termtris.map" | head -1)
|
|
DR=$(awk '{for(i=2;i<=NF;i++) if($i=="_dbg_rev") print $(i-1)}' "$APP/build/termtris.map" | head -1)
|
|
DQ=$(awk '{for(i=2;i<=NF;i++) if($i=="_quit") print $(i-1)}' "$APP/build/termtris.map" | head -1)
|
|
DTICK=$(awk '{for(i=2;i<=NF;i++) if($i=="_tick_interval") print $(i-1)}' "$APP/build/termtris.map" | head -1)
|
|
VT1200_SKIP_LEVEL1=1 LOADER_SNAP=1 PLAY_MODE=$mode DIAG_LOOPS="0x$DL" DIAG_EVENTS="0x$DE" DIAG_LAST="0x$DT" DIAG_FOCUS="0x$DF" DIAG_REV="0x$DR" DIAG_QUIT="0x$DQ" \
|
|
DIAG_TICK="0x$DTICK" \
|
|
LOADER_AT=2500 LOADER_END=3200 \
|
|
LOADER_BIN="$ROOT/dwt/loader/build/loader.bin" \
|
|
LOADER_COFF="$APP/build/termtris.coff" \
|
|
LOADER_OUT="$EV" \
|
|
"$M" vt1200 -rompath "$ROOT/harness/mame/roms" \
|
|
-video none -sound none -nothrottle -skip_gameinfo \
|
|
-debug -debugger none \
|
|
-autoboot_script "$DIR/play_keys.lua" -autoboot_delay 0 \
|
|
>"$LOG" 2>&1 || true
|
|
grep -E 'PLAYKEYS:|LOADER: result|LOADER: snapshot' "$LOG" | tail -5
|
|
DIAG=$(grep -a 'DIAG: loops' "$LOG" | sed -n 's/.*loops=\([0-9]*\) events=\([0-9]*\).*quit=\([0-9]*\)/\1 \2 \3/p' | head -1)
|
|
[ -n "$DIAG" ] || { echo "play_keys.sh: no DIAG line for $mode (see $LOG)" >&2; exit 1; }
|
|
set -- $DIAG
|
|
LOOPS=$1; EVENTS=$2; QUIT=$3
|
|
echo "play_keys: $mode loops=$LOOPS events=$EVENTS quit=$QUIT"
|
|
[ "$LOOPS" -ge 100 ] || { echo "play_keys.sh: $mode main loop barely ran ($LOOPS)" >&2; exit 1; }
|
|
[ "$EVENTS" -ge 6 ] || { echo "play_keys.sh: $mode got $EVENTS events, expected the click and keys" >&2; exit 1; }
|
|
case $mode in
|
|
move|panels) [ "$QUIT" = 0 ] || { echo "play_keys.sh: $mode quit unexpectedly" >&2; exit 1; } ;;
|
|
quit) [ "$QUIT" = 1 ] || { echo "play_keys.sh: q did not reach the game (quit=$QUIT)" >&2; exit 1; } ;;
|
|
esac
|
|
[ -s "$EV/loader_frame3200.png" ] || { echo "play_keys.sh: no $mode snapshot" >&2; exit 1; }
|
|
cp "$EV/loader_frame3200.png" "$EV/termtris_${mode}_3200.png"
|
|
done
|
|
echo "play_keys: $EV/termtris_move_3200.png $EV/termtris_panels_3200.png $EV/termtris_quit_3200.png"
|