Skip to content

PLZA AutoStory 01.00: start the new game from HOME or the language list - #610

Draft
dayfine wants to merge 33 commits into
plza/slice5bfrom
plza/newgame
Draft

dayfine wants to merge 33 commits into
plza/slice5bfrom
plza/newgame

Conversation

@dayfine

@dayfine dayfine commented Nov 16, 2026 •

Copy link
Copy Markdown
Owner

Depends on #604, #62 (base plza/slice5b; #62 is merged in through its one-commit upstream branch upstream/system-keyboard-v2, so the diff shows this change plus #62's keyboard files).

01.00 started on Confirm Choices after the language, look and name were picked by hand. It now starts from HOME (game closed, save deleted), the language list, or Confirm Choices, and plays each screen as the console showed it on 2026-11-15 in all ten languages: after the user select it presses nothing and waits up to 60 s for the language list (about 15 s of logos); it taps the D-pad to the language 600 ms apart, reading the highlight after each; the look picker has no highlight until the stick moves and the first tilt lands on a different portrait each launch, so it tilts left until a highlight reads, moves to the target and presses A only when the target reads; it checks the keyboard's 0/N counter (12, or 6 in Japanese, Korean and Chinese), types the name with #62's type_on_system_keyboard() (Simplified Chinese switched from Pinyin to letters first), and presses + until Confirm Choices shows (Chinese takes one + to accept the text, one to submit). The confirm step checks the name and language Confirm Choices shows before Ready!. The blind name typer and its tests are gone. Korean stays refused (UserSetupError). The panel gets game language, look 1-8, player name (Kosmos) and a developer capture mode.

Tested with the PokemonLZA AutoStory unit tests (choice checks, list and look moves, capture recording) and frame tests on the 2026-11-15 console frames: language list, look highlight on all ten first tilts, keyboard counter per language, #62's cursor reader on the nine typed languages, and Confirm Choices (frames on dayfine/CommandLineTests plza/new-game-intro at 41d8566, which contains #604's 2abde09). Not run on a console yet with the typer.

The commit "CI (fork only): pin CommandLineTests 41d8566" points CI at those frames; it is fork-only and is dropped at upstream handoff.

dayfine and others added 13 commits November 13, 2026 08:30
Games open the Switch's own keyboard for names (BDSP, Legends: Z-A), and
keyboard_enter_code() types on it blind from an assumed starting key. This adds
SystemKeyboardDetector/Watcher, read_system_keyboard_cursor() (every key,
including the right column and the bottom row), system_keyboard_field_has_text()
and FastCodeEntry::type_on_system_keyboard(), which reads the cursor before each
key, moves it along keyboard_get_path() (now declared in its header), and checks
that each press reached the text field. Image tests for the detector and readers
are in CommandLineTests under NintendoSwitch/SystemKeyboardDetector/.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_013VUubhHeYSMGSSDXZkKZss
01.00 gains a first step, new_game_intro: from the Switch HOME (game
closed, no save) it launches the selected tile and waits out the screens
before the language list (no press for 30 s, then at most 5 A presses),
picks the panel's language on the list, the look on the picker (stick)
and types the name on the Switch keyboard (D-pad on a model of its key
grid, Shift for capitals, PLUS for OK) after reading its 0/N counter. On
Confirm Choices it presses nothing. The confirm step now also reads the
name and language Confirm Choices shows (OCR) and stops if they differ.

New panel options: game language (10; Korean refused as not supported),
player look 1-8, player name (Kosmos), and a developer capture mode that
saves each language's screens from the launch to the keyboard.

Name limits from the console's keyboard frames: 12 for es-ES, es-419,
fr, de, it (en taken as 12, no frame); 6 for ja, ko, zh-Hans, zh-Hant.
Test frames: dayfine/CommandLineTests plza/new-game-intro 36d2d9cc3.
…62's typer

- Launch: no blind A presses after the user select; wait up to 60 s for the
  language list (about 15 s of logos on the console, 2026-11-15).
- Language list: D-pad taps 600 ms apart.
- Look picker: tilt left (150 ms) until a highlight reads, since the first
  tilt lands on a different portrait each launch; A only once the target reads.
- Name: type_on_system_keyboard() (switch/system-keyboard), Simplified
  Chinese switched to letters first; + until Confirm Choices shows (Chinese
  takes one + to accept the text, one to submit).
- Drop the blind name typer (PokemonLZA_AutoStoryNameKeys) and its tests;
  new_game_problem() checks the name against the typer's key map.
- Revert this PR's CommandLineTests pin bump.
- Tests on the 2026-11-15 frames: language list, look highlight (10),
  keyboard counter (10), the system keyboard reader (9), Confirm Choices (12).
HOME's tiles are in last-played order, so slot 0 launched FireRed on
console B. The launch now presses HOME (first tile) and moves right until
the OCR'd title above the tile row ends in Z-A, up to 8 tiles, else a
UserSetupError. Capture mode's help says it ignores Game Language.
# Conflicts:
#	.github/workflows/cpp-ci-serial-programs-base.yml
# Conflicts:
#	.github/workflows/cpp-ci-serial-programs-base.yml
The 01.01 load (LOAD_SAVE_FIRST) reloaded with reset_game_from_home(),
which closes and launches HOME's first tile: FireRed, played last on
console B, so 01.01 failed at on_platform with a FireRed battle on screen.
#610's tile search covered only the new game.

launch_plza_from_home() is now the only way AutoStory starts PLZA: HOME,
close whatever game runs (logging whether it was PLZA), find PLZA's tile
by its title among the first 8, launch it. The new game, capture mode and
the latest-save reload all go through it; the reload then runs PLZA's
title and load as reset_game_from_home() did (gamemenu_to_ingame() is now
declared in PokemonLZA_GameEntry.h).

Test: the tile search over console frames, FireRed first and Z-A second
(new CommandLineTests frame; fork-only pin d0deaeb).
@dayfine

dayfine commented Nov 16, 2026

Copy link
Copy Markdown
Owner Author

Launch fix (7d47855, 7db5b1c): 01.01's "loading the latest save" reloaded with reset_game_from_home(), which launches HOME's first tile. That tile was FireRed (played last), so the run failed at on_platform with a FireRed battle on screen. launch_plza_from_home() (Actions/PokemonLZA_AutoStoryLaunch) is now the only way AutoStory starts PLZA. It goes HOME, closes whatever game is running and logs whether that was PLZA, then finds PLZA's tile by its OCR'd title among the first 8 and launches it. If the tile isn't there, it fails with a setup error. Test: the tile search over console frames, FireRed first and Z-A second (CommandLineTests d0deaeb, fork-only pin).

PLZA launch paths, all routed through it now:

  • play_new_game_intro() HOME case (01.00): was close + launch slot 0 (PLZA AutoStory 01.00: start the new game from HOME or the language list #610 had already added the tile search here)
  • capture_intro_screens(): was go_home + close + launch slot 0
  • reload_latest_save() (01.01+ with LOAD_SAVE_FIRST, retries, reload_when_chained): was reset_game_from_home(), slot 0. It now runs the launch, then PLZA's own openedgame_to_gamemenu and gamemenu_to_ingame.

Not done: no check of PLZA's title screen after the launch. The tile is checked by its title before A, and the load waits are the same as before. The other PLZA programs (shiny hunters, DonutMaker, etc.) still call reset_game_from_home() with slot 0. They assume PLZA is the running game.

Other games, listed only, not changed:

  • BDSP launch_bdsp_save() (bdsp/starter-rng-adopt) uses the shared Pokemon::launch_story_game from nav/shared AutoStory: shared launch from HOME to the overworld on a save #477, which searches the tile by name (switch_home_tile_named, NintendoSwitch_HomeTileReader). Covered.
  • BDSP PokemonBDSP_AutoStory_NewGame.cpp:426 calls from_home_close_and_reopen_game(), which closes and launches slot 0. Same hole.
  • FRLG AutoStory (PokemonFRLG_AutoStory.cpp:204/248/332 on frlg/part-ids-stage8) uses the in-game soft_reset() (A+B+-/+), which doesn't go through HOME. It's safe while FRLG is running, but nothing launches FRLG if another game is running.
  • PLZA should move to the shared launch_story_game once the PLZA chain and nav/shared meet. That needs a merge of 542 commits, so it isn't done here.

…eloads

Every look of every step of a checkpoint goes through AutosaveSightings
(a backend wrapper the story game puts around each action): a badge with
none in the 5 s before it logs "[PLZA] autosave badge at <t>s in <step>".
A checkpoint whose badge showed saves for the run ("[Save] X: the game
autosaved (seen)"); else not saved, whatever the plan claims.

run_plza_segments() decides between rows instead of the plan's
reload_when_chained true: on from the live screen when the next row's
start check passes or cannot tell (logged "START UNCHECKED"); a reload
only onto an autosave seen in this run; otherwise fail as no_start_save
rather than rewind to an older save. "always" stays for 03.04 (commit
b99791a) and now 03.11 (facing after the ride); 02.07 and 03.02 lose
their flags. 03.01's autosave claim becomes unverified: a chained run on
console B saw none there.
The autosave sightings now come from the slices below (engine in slice 2b,
plan flags in slices 3, 4 and 5). Conflict in
PokemonLZA_AutoStoryGame_Tests.cpp resolved to this branch's content: the
tree equals a9f6195.
…ts autosave

03.02 failed on console B at talk_to_taunie (2026-11-16): the timed 3 s
walk stopped short of Taunie, who stood a few steps ahead under the
Quartiere Verde arch with no "A Talk" prompt, and the talk's A found no
one.

- A walk's "end" may be "prompt": the last leg is held until the A prompt
  shows, its ms the bound; a last leg that only turns is looked at once
  after the turn; a HELD last leg is held at its angle.
- "talk" looks for the A prompt for 1 s first and presses nothing without
  it ("talk_no_prompt").
- The lint fails a talk not right after a step that ends on its A prompt
  (a walk to "prompt", or walk_to_prompt). Every walk before a talk now
  ends on the prompt: 01.03, 02.04, 02.05, 02.06, 03.01, 03.02b, 03.04,
  03.05, 03.10 (02.02 already used walk_to_prompt).
- 03.02 ends at the autosave seen in leave_hotel_z; 03.02b starts outside
  Hotel Z and walks on to Taunie's prompt, 8 s at most.
03.02b on console B (2026-11-16): the walk ended on Taunie's prompt, A
opened her talk on a dimmed "Smart Rotom" card with no text box, and
talk_to_taunie failed as talk_no_text.

"talk" now takes the shared scene-start rule (scene_under_way(), now
public and counting a tutorial card) for its talk having started: text,
a subtitle's chevron, a choice, a battle, a card, a fade, or a moving
screen with no HUD. The HUD staying after A is the failure,
"talk_no_scene". Every TALK step runs this one handler.
… start holds two looks

03.02b run 2 on console B (2026-11-16): the walk ended on an A prompt at
3250 ms (as in run 1, where A at it opened a dimmed "Smart Rotom" card),
the talk counted as started 0.4 s after A, and story_battle ran the
battle code on the overworld for 2 min ("Failed to lock on").

- 03.02b presses through Taunie's talk and cards to the battle HUD with
  story_battle_start before each battle, as 01.03 and 02.01 do.
- The lint fails a story_battle not right after story_battle_start.
- story_battle fights only on the battle HUD within 10 s, else
  "battle_never_started", nothing pressed.
- "talk" needs its scene under way on two looks in a row, not one look
  of the press, and logs the look it started on; a walk to an end event
  logs the look it ended on.
…e start ending in control fails at once

03.02b run 3 on console B (2026-11-16): the first A prompt 3.25 s from
the reload spot starts a scene (a fade, the Smart Rotom card, a fade)
that hands control back at the Quartiere Verde arch, Taunie a few steps
ahead; story_battle_start then waited 90 s on the party bar.

- 03.02b: to_plaza_scene_prompt, plaza_scene (A at its prompt, the scene
  to control), to_taunie (walk_to_prompt, 8 s), then her talk and the
  battles.
- The scene machine with stop_at_battle or stop_at_choice ends at once,
  failing as "scene_ended_in_control", when the party bar holds 5 s with
  nothing busy; shorter shows between a talk's lines go on.
…y the move hints

03.02b run 4 on console B (2026-11-16): Taunie's battle ran 70 s with the
player not locked on, so no move list or "A: Select Move" hint showed,
and story_battle_start waited out its 90 s.

- BattlePanelDetector: the panel at the bottom left, its sky blue level
  badge and its HP bar (fill or grey trough), measured on that frame
  (badge 0.78, bar 0.95; overworld frames 0.18 and 0.20 at most).
- BATTLE_STARTED is the move hints or the panel, so story_battle_start
  ends on a battle whether or not the player is locked on;
  fight_story_battle already locks on with ZL (upstream's
  TrainerBattleState).
- Frame tests: the run 4 frame reads as a battle, two prompt frames do
  not. CI (fork only) pins CommandLineTests 721bb64, which adds the frame
  (branch plza/battle-panel).
…orm wait and the fade wait

Four AutoStoryGame tests failed on CI since they were added; the code
behaves as before, the scripted looks were short.

- Chain cases (a9f6195): 01.01's platform wait does not count a look
  with the autosave badge (platform_look() since e37c765), so
  PLATFORM_SAVING, PLATFORM is one platform look, not two. Each script
  gets the second PLATFORM; "start check fails" gets two more for
  01.02's check to read.
- "a battle start that ends in control" (edcd305): the FADE_BLACK
  state's wait reads the first look after the fade without recording it,
  so the party bar's 5 s ran from 3000 ms and the frozen 6100 ms look
  never reached it. The script repeats the 1000 ms look.
…only

03.02b run 5 on console B (2026-11-16): after_taunie_battle pressed A and
B in turn for 120 s on the "Map & Missions" tutorial card over the map
app. A turns the card's page, B turns it back, so it never left page 1.

- talk_through_map_screen presses one button a look by what shows: A on
  a tutorial card (TUTORIAL_CARD_READING) and on text before the card, B
  on the rest: the map app, which B closes and where A places a pin, and
  her talk after it, as played by hand (step 45). The scene machine and
  the talk's lines already press A on a card.
- Frame test: the run 5 frame reads as a tutorial card (its panel 240,
  the map's blue edges 69-75 with spread under 6); a battle frame and the
  A Talk prompt do not.
- Sim tests: the card paged with A only, then B on the map and the talk.
  CI (fork only) pins CommandLineTests 0414d97, which adds the frame
  (branch plza/battle-panel).
03.04's after_pokedex waited 45 s on the party bar (scene_never_started,
console B 2026-11-16): talk_to_pokedex_screen had already played the
nurse's wrap-up and Taunie's scene to control, through two black fades
and the autosave. A lint rule now rejects a scene (MASH) step right after
a step that presses through its scenes to control; 03.04's after_pokedex
and 03.09's five_registered fold into the step before them.
Console B 2026-11-16 saw 03.04 end outside the Pokemon Center, in
control, after the game's autosave. 03.04 is marked autosave; 03.05 starts
by the Center's door, and its walk back to the nurse and 03.06's walk out
are marked UNVERIFIED: their legs were measured inside the Center, and
Lumiose has no tile grid to plan a route target on.
dayfine and others added 3 commits November 16, 2026 06:57
… talk again

03.05's heal_party pressed A on the nurse's closing box; the A landed on
her A prompt and started her talk again ("your Pokemon is already in great
shape") until the 120 s timeout (console B 2026-11-16). In every scene
machine that ends in control, a text box now gets B (it turns a line like
A, and does nothing once the box closes) and a choice gets A (its top
row). Machines that stop at a choice or a battle keep their text button.
A closed-loop test models the nurse: A at the closing box or the prompt
talks again, B does not.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01AKYzhrMnPK61XHWEch4a6E
03.06 now ends on the autosave seen in wild_zones_tutorial (console B,
2026-11-16, badge at 41.4 s). The run to Wild Zone 1's gate and the
entry move to the start of 03.07, which reloads that save: 03.07 had
reloaded outside the gate and thrown Poke Balls there (no_catch).
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