Skip to content

Add Command File Runner, a developer program driven by text command files - #58

Closed
dayfine wants to merge 10 commits into
mainfrom
lab/lab-console
Closed

dayfine wants to merge 10 commits into
mainfrom
lab/lab-console

Conversation

@dayfine

@dayfine dayfine commented Oct 29, 2026 •

Copy link
Copy Markdown
Owner

Checking whether a detector fires on a given screen meant a rebuild and a full program run. Command File Runner (a developer program under Nintendo Switch) runs .txt command files dropped into an inbox folder against the live console — press, dpad, stick, wait, walk, shot, shots, detect, wait_for/expect, state, close_game, help, stop — and writes a timed result file with screenshots to the outbox, stopping a file at its first failing line. walk holds the left stick until the screen stops changing and reports how long it moved, for measuring maps: a timed stick hold moves a different number of tiles from one try to the next. Options set the folder and whether to stop once the inbox is empty; games can register their own commands and detectors (BDSP AutoStory adds walking and save-loading probes on its branch). A README.md next to the code documents the file format and every command; like the other testing programs it has no page on the documentation site.

Unit tests cover reading command files without a console: splitting lines and comments, argument errors, button and D-pad names, and which inbox file runs next. Tested on a Switch with this build (macOS, no warnings): two files queued before start with "Stop When Inbox Is Empty" on. The first covered help, press, dpad, stick, wait, walk, shot, shots, detect and state on live video and on a saved image, wait_for timing out, expect, close_game and comments, and every line passed. The second failed on an unknown button, saved a screenshot and ended; the program then stopped by itself. stop was checked in an earlier run, and the tool has since run about 600 probe files on a lab Switch. walk was checked on a lab Switch by mapping Sandgem Town and Route 201: it stopped at signs, trees, a fence and an NPC, and repeated walks ended on the same tiles.

🤖 Generated with Claude Code

https://claude.ai/code/session_01AKYzhrMnPK61XHWEch4a6E

@dayfine dayfine changed the title Add a Lab Console program for probing a live game Add Command File Runner, a developer program driven by text command files Oct 29, 2026
@dayfine
dayfine force-pushed the lab/lab-console branch 4 times, most recently from dbcc31f to 6f1cb51 Compare October 29, 2026 20:17
@dayfine
dayfine changed the base branch from main to switch/system-keyboard October 29, 2026 20:17
@dayfine
dayfine changed the base branch from switch/system-keyboard to main October 29, 2026 20:29
@dayfine
dayfine force-pushed the lab/lab-console branch 2 times, most recently from 9ef662f to e2e5da8 Compare October 29, 2026 20:35
…iles

Answering "does this detector fire on that screen?" meant a rebuild and a
full program run. Command File Runner runs .txt files dropped into
<folder>/inbox against the live console, one command per line (press,
dpad, stick, wait, shot/shots, detect, wait_for/expect, state, close_game,
help, stop), and writes a timed result file with screenshots to
<folder>/outbox, stopping a file at its first failing line.

Options set the command folder and whether to stop once the inbox is
empty. Games can register their own commands and detectors. README.md
next to the code documents the file format and every command; like the
other testing programs it has no page on the documentation site.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01AKYzhrMnPK61XHWEch4a6E
Moves the line splitting, button and D-pad names and the inbox order into
their own file, unchanged, and tests them without a console.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01AKYzhrMnPK61XHWEch4a6E
@dayfine
dayfine marked this pull request as ready for review October 30, 2026 03:43

@dayfine dayfine left a comment

Copy link
Copy Markdown
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

dayfine and others added 5 commits October 29, 2026 21:55
A command line is now just its words: split_command_line() returns them,
and required_arg(), optional_number() and optional_duration() read
arguments from them, with the same error messages. All definitions move
to the .cpp. Adds a unit test for the argument readers and checks the
error messages.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01AKYzhrMnPK61XHWEch4a6E
On the macOS Intel CI build, the std::invalid_argument from std::stod()
escapes the catch (std::exception&), so the "argument errors" test failed
with "Unknown exception". strtod() reports a bad number without
throwing; the error message is unchanged.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01AKYzhrMnPK61XHWEch4a6E
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01AKYzhrMnPK61XHWEch4a6E
…w long it moved

A timed stick hold moves a different number of tiles from one try to the
next, so a map measured with holds is not measured. "walk x y" holds the
left stick in 200 ms slices and stops when two slices in a row barely
change the screen (a wall, a sign, someone in the way).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01AKYzhrMnPK61XHWEch4a6E
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01AKYzhrMnPK61XHWEch4a6E
…d_save (#102)

* Command File Runner: BDSP detectors, measured D-pad taps and bdsp_load_save

The runner had no game detectors and no way for a game to hook in, so a lab
operator could not ask "is this a dialog box?" or reload the BDSP save from a
command file.

- BDSP registers bdsp_dialog, bdsp_battle_text, bdsp_battle_menu,
  bdsp_exp_gain, bdsp_menu and bdsp_map, plus bdsp_load_save, from its
  PanelListFactory constructor (a static registrar in the static library
  would be dropped by the linker).
- "taps DIR N [all] [hold] [release] [still]" taps the D-pad and reports,
  per tap, whether the screen moved (RMSD at 192x108, shared with walk).
- run_command_file_line() lets a game command run built-ins such as
  close_game and state.
- README: new commands, detectors and how a game registers them.
- Tests: parsing of taps arguments.

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01AKYzhrMnPK61XHWEch4a6E

* Command File Runner: a D-pad tap toward a new direction also steps

The taps README and code comment said the first tap of a new direction only
turns the player. Measured 2026-10-31 in Floaroma: a 160 ms left tap from
facing north moved one tile, with a screen change of about 37 at 192x108, the
same as a plain step. Say every tap is a step unless something blocks it.

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01AKYzhrMnPK61XHWEch4a6E

---------

Co-authored-by: Claude Fable 5.1 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01AKYzhrMnPK61XHWEch4a6E
@dayfine

dayfine commented Nov 1, 2026

Copy link
Copy Markdown
Owner Author

Superseded: the Command File Runner, its tests and README come to the fork's main through #103, and the lab channel on it is #107.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant