From a6d441519a256653fafbc21ddb5c15dab249bb7b Mon Sep 17 00:00:00 2001 From: dayfine Date: Sun, 8 Nov 2026 20:40:39 -0800 Subject: [PATCH 1/4] Command File Runner: LZA story actions, `type`, and a steps file Someone playing Legends Z-A by hand through the lab channel can now record story steps at the action level rather than as raw presses: - Registry: games register commands with a kind (DRIVES_CONSOLE or READS_STREAM) and readings (values such as a heading) alongside detectors, from their panel list, so the Switch module includes no game headers. - `type TEXT` types a name on the system keyboard (#62), presses + and checks that the keyboard closed. - LZA commands over #282's actions: lza_talk, lza_talk_to, lza_pick, lza_move, lza_face, lza_fly, lza_battle, lza_heal, lza_shop, lza_save; detectors lza_dialog, lza_overworld, lza_arrow; reading lza_facing. - Every command appends a JSON line to /.steps.jsonl: command, args, times, ok/error, game detector state before and after, and the end frame. The .out journal is unchanged. - devtools/lab/cfr_steps_to_story.py turns a steps file into draft story table rows, collapsing raw input runs into one RAW line to review. Co-Authored-By: Claude Opus 5.5 Claude-Session: https://claude.ai/code/session_013VUubhHeYSMGSSDXZkKZss --- .github/workflows/lab-instance-tools.yml | 1 + .../Source/CommonFramework/Windows/Lab.md | 23 +- .../NintendoSwitch_CommandFileParsing.cpp | 7 + .../NintendoSwitch_CommandFileParsing.h | 4 + .../NintendoSwitch_CommandFileRecorder.cpp | 66 +++++ .../NintendoSwitch_CommandFileRecorder.h | 57 ++++ ...ntendoSwitch_CommandFileRecorder_Tests.cpp | 135 +++++++++ ...NintendoSwitch_CommandFileRecorder_Tests.h | 23 ++ .../NintendoSwitch_CommandFileRunner.cpp | 262 +++++++++++++++--- .../NintendoSwitch_CommandFileRunner.h | 52 +++- ...NintendoSwitch_CommandFileRunner_Tests.cpp | 54 ++++ .../NintendoSwitch_LabCommands.cpp | 22 +- .../Programs/CommandFileRunner/README.md | 8 +- .../PokemonLZA/PokemonLZA_Panels.cpp | 6 +- .../PokemonLZA/PokemonLZA_Tests.cpp | 2 + .../PokemonLZA_AutoStoryCommands.cpp | 233 ++++++++++++++++ .../AutoStory/PokemonLZA_AutoStoryCommands.h | 90 ++++++ .../PokemonLZA_AutoStoryCommands_Tests.cpp | 203 ++++++++++++++ .../PokemonLZA_AutoStoryCommands_Tests.h | 26 ++ SerialPrograms/cmake/SourceFiles.cmake | 8 + devtools/lab/README.md | 1 + devtools/lab/cfr_steps_to_story.py | 195 +++++++++++++ devtools/lab/test_cfr_steps_to_story.py | 63 +++++ .../testdata/cfr_steps_sample.expected.cpp | 30 ++ .../lab/testdata/cfr_steps_sample.steps.jsonl | 19 ++ 25 files changed, 1519 insertions(+), 71 deletions(-) create mode 100644 SerialPrograms/Source/NintendoSwitch/Programs/CommandFileRunner/NintendoSwitch_CommandFileRecorder.cpp create mode 100644 SerialPrograms/Source/NintendoSwitch/Programs/CommandFileRunner/NintendoSwitch_CommandFileRecorder.h create mode 100644 SerialPrograms/Source/NintendoSwitch/Programs/CommandFileRunner/NintendoSwitch_CommandFileRecorder_Tests.cpp create mode 100644 SerialPrograms/Source/NintendoSwitch/Programs/CommandFileRunner/NintendoSwitch_CommandFileRecorder_Tests.h create mode 100644 SerialPrograms/Source/VideoGames/PokemonLZA/Programs/AutoStory/PokemonLZA_AutoStoryCommands.cpp create mode 100644 SerialPrograms/Source/VideoGames/PokemonLZA/Programs/AutoStory/PokemonLZA_AutoStoryCommands.h create mode 100644 SerialPrograms/Source/VideoGames/PokemonLZA/Programs/AutoStory/PokemonLZA_AutoStoryCommands_Tests.cpp create mode 100644 SerialPrograms/Source/VideoGames/PokemonLZA/Programs/AutoStory/PokemonLZA_AutoStoryCommands_Tests.h create mode 100755 devtools/lab/cfr_steps_to_story.py create mode 100644 devtools/lab/test_cfr_steps_to_story.py create mode 100644 devtools/lab/testdata/cfr_steps_sample.expected.cpp create mode 100644 devtools/lab/testdata/cfr_steps_sample.steps.jsonl diff --git a/.github/workflows/lab-instance-tools.yml b/.github/workflows/lab-instance-tools.yml index ebf48e6600..55e47d1eb4 100644 --- a/.github/workflows/lab-instance-tools.yml +++ b/.github/workflows/lab-instance-tools.yml @@ -19,3 +19,4 @@ jobs: with: python-version: '3.12' - run: python3 -m unittest discover -s devtools/lab -p 'test_lab_instance.py' -v + - run: python3 -m unittest discover -s devtools/lab -p 'test_cfr_steps_to_story.py' -v diff --git a/SerialPrograms/Source/CommonFramework/Windows/Lab.md b/SerialPrograms/Source/CommonFramework/Windows/Lab.md index 37ccad0e5e..6c4d16affe 100644 --- a/SerialPrograms/Source/CommonFramework/Windows/Lab.md +++ b/SerialPrograms/Source/CommonFramework/Windows/Lab.md @@ -27,6 +27,7 @@ takes effect at the next launch. | `Lab/done/.txt` | app moves | The request, moved here when it starts. | | `Lab/outbox/.out` | app writes | The request's journal (below). It appears only once the request has finished; `.tmp` shows the progress so far. | | `Lab/outbox/_