Skip to content

AutoStory: launch a game to its save, through the Switch prompts - #545

Closed
dayfine wants to merge 11 commits into
plza/upstream/s2-10from
plza/upstream/s2-11
Closed

dayfine wants to merge 11 commits into
plza/upstream/s2-10from
plza/upstream/s2-11

Conversation

@dayfine

@dayfine dayfine commented Nov 15, 2026 •

Copy link
Copy Markdown
Owner

Depends on #544

Adds a run's first event, the launch: from wherever the console is (HOME with the game closed or suspended, the title, the overworld) to the overworld on a save, one driver for every game with each game's policy saying how its screens look. It also adds the Switch's own prompts between HOME and a game (close software, user select, update), which every game's launch policy starts with. launch_story_game() and switch_launch_prompts() have no caller in this chain: Used by the PLZA program PR (batch 2). Tests: the StoryLaunch suite over the fake backend, built and run by Fork Draft CI. Part of the re-split of #522/#524/#525 into reviewable steps; review fixes are new commits on the PR that owns each problem, merged up the chain.

@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.

Reviewed SHA: 944abe8

Verdict

NEEDS_REWORK

First-pass review of this PR's own diff against plza/upstream/s2-10 (#544). The launch driver's state machine holds up when I trace it: X then A for RESTART, A only on the game's tile, a wait on HOME after the launch press, per-screen press caps, settled-looks before success, a cancel check each look, and failure before any press for a missing tile/title check or backup save. The 29 cases in Pokemon_StoryLaunch_Tests.cpp cover it well. Code health: 0 failures. CRLF kept, files listed in SourceFiles.cmake. Fork Draft CI (ubuntu / build) was still pending when I looked.

Medium

  1. switch_launch_prompts() (Pokemon_StorySwitchPrompts.h/.cpp) has no caller and no test anywhere through this chain tip. The tests build their own prompts. Its press details (Up twice then A on the update prompt, CLOSE_GAME_DELAY after A on "Close software?") go unchecked until some later PR uses it. Land it with its first caller, or say in the description which PR that is. The same goes for launch_story_game() itself: only tests call it in this chain.
  2. Overlap with upstream NintendoSwitch/Programs/NintendoSwitch_GameEntry.cpp. That file already handles close, user select and the update window (resume_game_from_home: Up, Up, A, the same as here). The driver needs a backend/simulation seam, which GameEntry lacks, so a new driver may be right. A maintainer will ask why GameEntry isn't reused, though, so the header comment or the description should answer that in one line.
  3. Lab talk in code. Pokemon_StoryLaunch.h backup_title ("console B, 2026-11-14"), Pokemon_StoryLaunch.cpp:46-49 LaunchReadable::title ("PLZA's loose title check (console B, 2026-11-14)"), and test comments at Pokemon_StoryLaunch_Tests.cpp ~196, ~237 ("Console B, 2026-11-14 02:41 (FRLG)"), ~280 ("Console B, PLZA, 2026-11-14 13:09"). Keep the screen behavior and drop our console and timestamps (user theme T3). The PLZA button example in the shared header (StoryLaunchRequest::Save::BACKUP) is fine as an example, but "PLZA" belongs in the PLZA policy rather than the shared engine's enum comment.

Low

  1. The title-readability condition is written twice, two ways. LaunchDriver::step() passes .title = m_title_held_looks == 0 && (m_launched || !title_after_launch), and read_launch_look() then checks (launched || !policy.title_after_launch) again, with launched = m_launched || m_loading. The second check never changes the result. Keep one (user theme T5).
  2. move_to_tile() hard-codes Milliseconds(80), Milliseconds(400), which are StoryLaunchPress{}'s defaults. Use StoryLaunchPress{.button = button} so the numbers live in one place, and give those defaults a why (80 ms hold, 400 ms release).
  3. press() failure text "{} presses changed nothing": the count is per screen name over the whole launch (e.g. "home" counts the X and every A), not consecutive presses that did nothing. Say "took {} presses".
  4. switch_launch_prompts(ConsoleHandle&): the returned matches lambdas keep detectors that reference console. Say in the header comment that the prompts must not outlive the console.

# Conflicts:
#	SerialPrograms/Source/Pokemon/AutoStory/Pokemon_AutoStory_Tests.h
The launch driver and its tests keep each screen behavior they guard and
drop the console, game and timestamps of the runs that showed it.
@dayfine

dayfine commented Nov 15, 2026

Copy link
Copy Markdown
Owner Author

Review fixes, tip 8c54ec8be:

Fixed: 3 (console, game and timestamps out of the launch header, driver and tests), 1 (description: launch_story_game() and switch_launch_prompts() are used by the PLZA program PR, batch 2).
Not changed: 2, 4, 5, 6, 7.

@dayfine

dayfine commented Nov 15, 2026

Copy link
Copy Markdown
Owner Author

Empty after the PLZA-minimal S2 cut (HomeTileReader / shared launch stay on the BDSP/FRLG branches). Branch kept as the base of the next PR.

@dayfine dayfine closed this Nov 15, 2026
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