diff --git a/SerialPrograms/Source/VideoGames/PokemonLZA/Programs/AutoStory/Actions/PokemonLZA_AutoStoryActionTable.cpp b/SerialPrograms/Source/VideoGames/PokemonLZA/Programs/AutoStory/Actions/PokemonLZA_AutoStoryActionTable.cpp index f2b76cee35..c0bcebf696 100644 --- a/SerialPrograms/Source/VideoGames/PokemonLZA/Programs/AutoStory/Actions/PokemonLZA_AutoStoryActionTable.cpp +++ b/SerialPrograms/Source/VideoGames/PokemonLZA/Programs/AutoStory/Actions/PokemonLZA_AutoStoryActionTable.cpp @@ -48,7 +48,6 @@ constexpr std::string_view WALK_UNTIL_SCENE = "scene"; constexpr std::pair WALK_ENDS[] = { {"fade_white", ScreenEvent::FADE_WHITE}, {"fade_black", ScreenEvent::FADE_BLACK}, - {"dialog", ScreenEvent::DIALOG_BOX}, {"prompt", ScreenEvent::INTERACT_PROMPT}, }; @@ -193,13 +192,14 @@ std::optional walk_step(PlzaConsoleHooks& hooks, const WalkArgs& w } -// 01.01's arrival takes ~240 s, hence 360 s. No blind A: one at the end of -// a talk restarts it. +// 01.01's arrival takes ~240 s, hence 360 s. Blind A only with +// "blind_a_after_ms", for a box with no advance arrow (03.01's letter): one +// at the end of a talk restarts it. Pokemon::StoryActionParser move_hints_action(){ return [](const JsonObject& args) -> StoryStepRun{ reject_unknown_keys(args, { "min_length_ms", "quiet_ms", "press_a_first", "quiet_is_control", "end_after_black_fades", - "gap_press_ms", "advance_with_a", + "gap_press_ms", "advance_with_a", "blind_a_after_ms", }); SceneMachineConfig config; config.quiet = ms_or(args, "quiet_ms", 60s); @@ -211,6 +211,7 @@ Pokemon::StoryActionParser move_hints_action(){ if (const std::optional gap = optional_ms(args, "gap_press_ms")){ config.gap_press = *gap; } + config.blind_press_after = optional_ms(args, "blind_a_after_ms"); if (const JsonValue* fades = args.get_value("end_after_black_fades")){ config.end_after_black_fades = (size_t)fades->to_integer_throw(); } diff --git a/SerialPrograms/Source/VideoGames/PokemonLZA/Programs/AutoStory/Actions/PokemonLZA_AutoStoryLines.cpp b/SerialPrograms/Source/VideoGames/PokemonLZA/Programs/AutoStory/Actions/PokemonLZA_AutoStoryLines.cpp index 503443a202..bae99fa7fc 100644 --- a/SerialPrograms/Source/VideoGames/PokemonLZA/Programs/AutoStory/Actions/PokemonLZA_AutoStoryLines.cpp +++ b/SerialPrograms/Source/VideoGames/PokemonLZA/Programs/AutoStory/Actions/PokemonLZA_AutoStoryLines.cpp @@ -8,6 +8,7 @@ #include "VideoGames/PokemonLZA/Programs/AutoStory/Detectors/PokemonLZA_AutoStoryTutorialCardDetector.h" #include "VideoGames/PokemonLZA/Programs/AutoStory/PokemonLZA_AutoStoryReadings.h" #include "VideoGames/PokemonLZA/Programs/AutoStory/PokemonLZA_AutoStorySceneMachine.h" +#include "VideoGames/PokemonLZA/Programs/AutoStory/PokemonLZA_AutoStorySignalProbe.h" #include "PokemonLZA_AutoStoryLines.h" namespace PokemonAutomation{ @@ -49,17 +50,31 @@ LinesPassed press_a_through_lines(PlzaBackend& backend, Milliseconds quiet, Mill return passed; } +namespace{ + +// The party bar or text on `look`, logged as the exit's "[Signals]" line. +bool out_of_menu(const ScreenObservation& look, PlzaBackend& backend, SignalProbe& signals){ + signals.look(look); + const bool party_bar = look.events.has(ScreenEvent::PLAYER_CAN_MOVE); + if (!party_bar && !text_shows(look)){ + return false; + } + backend.log_detail(signals.line("press_b_out_of_menu", "menu_exit", party_bar ? "party_bar" : "arrow")); + return true; +} + +} // namespace + bool press_b_out_of_menu(PlzaBackend& backend, size_t presses){ + SignalProbe signals; for (size_t pressed = 0; pressed < presses; pressed++){ backend.scope().throw_if_cancelled(); - const ScreenObservation look = backend.observe(); - if (look.events.has(ScreenEvent::PLAYER_CAN_MOVE) || look.events.has(ScreenEvent::DIALOG_BOX)){ + if (out_of_menu(backend.observe(), backend, signals)){ return true; } backend.press(BUTTON_B, /*hold=*/160ms, /*release=*/840ms); } - const ScreenObservation look = backend.observe(); - return look.events.has(ScreenEvent::PLAYER_CAN_MOVE) || look.events.has(ScreenEvent::DIALOG_BOX); + return out_of_menu(backend.observe(), backend, signals); } diff --git a/SerialPrograms/Source/VideoGames/PokemonLZA/Programs/AutoStory/Actions/PokemonLZA_AutoStoryLines_Tests.cpp b/SerialPrograms/Source/VideoGames/PokemonLZA/Programs/AutoStory/Actions/PokemonLZA_AutoStoryLines_Tests.cpp index 8b6a15adee..31094903e1 100644 --- a/SerialPrograms/Source/VideoGames/PokemonLZA/Programs/AutoStory/Actions/PokemonLZA_AutoStoryLines_Tests.cpp +++ b/SerialPrograms/Source/VideoGames/PokemonLZA/Programs/AutoStory/Actions/PokemonLZA_AutoStoryLines_Tests.cpp @@ -4,6 +4,7 @@ * */ +#include #include #include #include @@ -12,6 +13,7 @@ #include "Common/Cpp/TestRunners/UnitTest.h" #include "Pokemon/AutoStory/Testing/Pokemon_StoryFakeBackend.h" #include "VideoGames/PokemonLZA/Programs/AutoStory/Detectors/PokemonLZA_AutoStoryTutorialCardDetector.h" +#include "VideoGames/PokemonLZA/Programs/AutoStory/PokemonLZA_AutoStoryReadings.h" #include "PokemonLZA_AutoStoryLines.h" #include "PokemonLZA_AutoStoryLines_Tests.h" @@ -35,7 +37,7 @@ ScreenObservation look(ScreenEvents events, std::vector readin } ScreenObservation dialog(Milliseconds at){ - return look({ScreenEvent::DIALOG_BOX}, /*readings=*/{}, at); + return look(/*events=*/{}, {ADVANCE_ARROW_READING}, at); } ScreenObservation card(Milliseconds at){ @@ -125,6 +127,8 @@ struct MenuCase{ struct Expectation{ bool out = false; std::string inputs; + // The exit's "[Signals]" line; empty: not checked. + std::string signals = {}; }; Expectation expectation; }; @@ -142,6 +146,17 @@ const MenuCase MENU_CASES[] = { .input = {.looks = {nothing(Milliseconds(0)), dialog(Milliseconds(0))}, .presses = 5}, .expectation = {.out = true, .inputs = "press B"}, }, + { + // The log analysis tells a signal never seen from one seen at 0 ms. + .name = "the exit's signals line shows a dash for each signal never seen", + .input = {.looks = {nothing(Milliseconds(0)), nothing(Milliseconds(1000)), party_bar(Milliseconds(2000))}, .presses = 5}, + .expectation = { + .out = true, + .inputs = "press B, press B", + .signals = "[Signals] press_b_out_of_menu menu_exit by=party_bar after=2000 first: party_bar@2000 hint@- prompt@- " + "arrow@- shadow.dialog_box@- autosave@- banner@- choice@- fade@- last_busy@- shadow.dialog_box_at_decision=0", + }, + }, { .name = "still in the menu after the presses", .input = {.looks = {nothing(Milliseconds(0))}, .presses = 2}, @@ -159,6 +174,10 @@ UnitTestResult check_menu(const MenuCase& test, CancellableScope& scope){ if (inputs != test.expectation.inputs){ return std::format("expected inputs \"{}\", got \"{}\"", test.expectation.inputs, inputs); } + const std::vector& lines = backend.lines(); + if (!test.expectation.signals.empty() && std::find(lines.begin(), lines.end(), test.expectation.signals) == lines.end()){ + return std::format("expected the line \"{}\" in:\n{}", test.expectation.signals, joined(lines)); + } return true; } diff --git a/SerialPrograms/Source/VideoGames/PokemonLZA/Programs/AutoStory/Actions/PokemonLZA_AutoStoryMarkerWalk.cpp b/SerialPrograms/Source/VideoGames/PokemonLZA/Programs/AutoStory/Actions/PokemonLZA_AutoStoryMarkerWalk.cpp index 761fea9e39..e5def968ec 100644 --- a/SerialPrograms/Source/VideoGames/PokemonLZA/Programs/AutoStory/Actions/PokemonLZA_AutoStoryMarkerWalk.cpp +++ b/SerialPrograms/Source/VideoGames/PokemonLZA/Programs/AutoStory/Actions/PokemonLZA_AutoStoryMarkerWalk.cpp @@ -10,6 +10,7 @@ #include #include "NintendoSwitch/Commands/NintendoSwitch_Commands_PushButtons.h" #include "VideoGames/PokemonLZA/Programs/AutoStory/Detectors/PokemonLZA_AutoStoryObjectiveMarkerReader.h" +#include "VideoGames/PokemonLZA/Programs/AutoStory/PokemonLZA_AutoStorySceneMachine.h" #include "PokemonLZA_AutoStoryMarkerArrival.h" #include "PokemonLZA_AutoStoryMarkerDistance.h" #include "PokemonLZA_AutoStoryMarkerWalk.h" @@ -77,7 +78,7 @@ class MarkerWalk{ private: // A dialog not near the objective gets B (B cannot start a talk again). bool at_objective(const ScreenObservation& look, const std::optional& marker){ - const bool prompt = look.events.has(ScreenEvent::INTERACT_PROMPT) || look.events.has(ScreenEvent::DIALOG_BOX); + const bool prompt = look.events.has(ScreenEvent::INTERACT_PROMPT) || text_shows(look); const std::optional read = marker ? marker->distance : std::nullopt; on_read(read, m_arrival.look(MarkerLook{ .distance = read, .marker_shows = marker.has_value(), .prompt_or_dialog = prompt, .at = current_time(), @@ -94,7 +95,7 @@ class MarkerWalk{ )); } m_prompt_passed = prompt; - if (look.events.has(ScreenEvent::DIALOG_BOX)){ + if (text_shows(look)){ pbf_press_button(m_env.context, BUTTON_B, /*hold=*/160ms, /*release=*/240ms); } return false; @@ -176,7 +177,7 @@ bool objective_reached(StoryEnv& env, PlzaBackend& backend, MarkerArrival& arriv arrival.look(MarkerLook{ .distance = std::nullopt, .marker_shows = marker, - .prompt_or_dialog = look.events.has(ScreenEvent::INTERACT_PROMPT) || look.events.has(ScreenEvent::DIALOG_BOX), + .prompt_or_dialog = look.events.has(ScreenEvent::INTERACT_PROMPT) || text_shows(look), .at = current_time(), }); if (arrival.arrived()){ diff --git a/SerialPrograms/Source/VideoGames/PokemonLZA/Programs/AutoStory/Actions/PokemonLZA_AutoStoryMenuSave.cpp b/SerialPrograms/Source/VideoGames/PokemonLZA/Programs/AutoStory/Actions/PokemonLZA_AutoStoryMenuSave.cpp index 6fde68088d..9010e62f24 100644 --- a/SerialPrograms/Source/VideoGames/PokemonLZA/Programs/AutoStory/Actions/PokemonLZA_AutoStoryMenuSave.cpp +++ b/SerialPrograms/Source/VideoGames/PokemonLZA/Programs/AutoStory/Actions/PokemonLZA_AutoStoryMenuSave.cpp @@ -12,6 +12,7 @@ #include "VideoGames/PokemonLZA/Programs/AutoStory/Detectors/PokemonLZA_AutoStoryTutorialCardDetector.h" #include "VideoGames/PokemonLZA/Programs/AutoStory/PokemonLZA_AutoStoryMenuReadings.h" #include "VideoGames/PokemonLZA/Programs/AutoStory/PokemonLZA_AutoStoryReadings.h" +#include "VideoGames/PokemonLZA/Programs/AutoStory/PokemonLZA_AutoStorySignalProbe.h" #include "PokemonLZA_AutoStoryMenuSave.h" namespace PokemonAutomation{ @@ -70,7 +71,7 @@ MenuSaveScreen menu_save_screen(const ScreenObservation& look){ if (look.events.has(ScreenEvent::CHOICE_BOX)){ return MenuSaveScreen::CHOICE; } - if (look.events.has(ScreenEvent::DIALOG_BOX)){ + if (has_reading(look, ADVANCE_ARROW_READING)){ return MenuSaveScreen::TEXT; } if (has_reading(look, MENU_SAVE_BUTTON_READING)){ @@ -79,8 +80,8 @@ MenuSaveScreen menu_save_screen(const ScreenObservation& look){ if (has_reading(look, MAIN_MENU_READING)){ return MenuSaveScreen::MAIN_MENU; } - // 01.01's platform shows no party bar. - if (look.events.has(ScreenEvent::PLAYER_CAN_MOVE) || has_reading(look, PLATFORM_READING)){ + // 01.01's platform shows no party bar, only the controls hint. + if (look.events.has(ScreenEvent::PLAYER_CAN_MOVE) || has_reading(look, CONTROLS_HINT_READING)){ return MenuSaveScreen::OVERWORLD; } return MenuSaveScreen::UNKNOWN; @@ -181,9 +182,11 @@ std::optional back_to_overworld(PlzaBackend& backend){ const size_t max_looks = MENU_SAVE_LIMIT / MENU_SAVE_POLL + 1; std::optional start; size_t overworld_looks = 0; + SignalProbe signals; for (size_t looks = 1; ; looks++){ backend.scope().throw_if_cancelled(); const ScreenObservation look = backend.observe(); + signals.look(look); if (look.events.has(ScreenEvent::SWITCH_HOME_MENU)){ return Pokemon::game_not_running_failure(); } @@ -202,6 +205,8 @@ std::optional back_to_overworld(PlzaBackend& backend){ overworld_looks++; if (overworld_looks >= MENU_SAVE_HELD_LOOKS){ backend.log(std::format("[PLZA set_text_speed_fast] text speed set, back on the overworld at {:.1f}s", now.count() / 1000.0)); + const bool party_bar = look.events.has(ScreenEvent::PLAYER_CAN_MOVE); + backend.log_detail(signals.line("set_text_speed_fast", "text_speed_exit", party_bar ? "party_bar" : "hint")); return std::nullopt; } backend.wait(MENU_SAVE_POLL); diff --git a/SerialPrograms/Source/VideoGames/PokemonLZA/Programs/AutoStory/Actions/PokemonLZA_AutoStoryMenuSave.h b/SerialPrograms/Source/VideoGames/PokemonLZA/Programs/AutoStory/Actions/PokemonLZA_AutoStoryMenuSave.h index 717b66cf1e..b3d33a6fdb 100644 --- a/SerialPrograms/Source/VideoGames/PokemonLZA/Programs/AutoStory/Actions/PokemonLZA_AutoStoryMenuSave.h +++ b/SerialPrograms/Source/VideoGames/PokemonLZA/Programs/AutoStory/Actions/PokemonLZA_AutoStoryMenuSave.h @@ -29,7 +29,7 @@ std::optional save_from_menu(PlzaBackend& backend); // PlzaAction::SET_TEXT_SPEED_FAST: X, 2 s for the menu, A on the first // menu's tutorial card while it shows (1.5 s apart), then blind presses to // the options' text speed and Fast (L, Up, A, Down, Right), then B until -// the overworld or the platform shows on two looks in a row. Fails as +// the party bar or the controls hint shows on two looks in a row. Fails as // "text_speed_timeout" when not back within 30 s, and as GAME_NOT_RUNNING // on the Switch's HOME. std::optional set_text_speed_fast(PlzaBackend& backend); diff --git a/SerialPrograms/Source/VideoGames/PokemonLZA/Programs/AutoStory/Actions/PokemonLZA_AutoStoryMenuSave_Tests.cpp b/SerialPrograms/Source/VideoGames/PokemonLZA/Programs/AutoStory/Actions/PokemonLZA_AutoStoryMenuSave_Tests.cpp index 423cf46591..44b9ae62dd 100644 --- a/SerialPrograms/Source/VideoGames/PokemonLZA/Programs/AutoStory/Actions/PokemonLZA_AutoStoryMenuSave_Tests.cpp +++ b/SerialPrograms/Source/VideoGames/PokemonLZA/Programs/AutoStory/Actions/PokemonLZA_AutoStoryMenuSave_Tests.cpp @@ -45,7 +45,7 @@ ScreenObservation card(Milliseconds at){ } ScreenObservation text(Milliseconds at){ - return look({ScreenEvent::DIALOG_BOX}, /*readings=*/{}, at); + return look(/*events=*/{}, {ADVANCE_ARROW_READING}, at); } ScreenObservation main_menu(Milliseconds at){ @@ -57,15 +57,16 @@ ScreenObservation save_button(Milliseconds at){ } ScreenObservation choice(Milliseconds at){ - return look({ScreenEvent::DIALOG_BOX, ScreenEvent::CHOICE_BOX}, /*readings=*/{}, at); + return look({ScreenEvent::CHOICE_BOX}, /*readings=*/{}, at); } ScreenObservation home(Milliseconds at){ return look({ScreenEvent::SWITCH_HOME_MENU}, /*readings=*/{}, at); } +// 01.01's platform: the controls hint, no party bar. ScreenObservation platform(Milliseconds at){ - return look(/*events=*/{}, {PLATFORM_READING}, at); + return look(/*events=*/{}, {CONTROLS_HINT_READING}, at); } // No detector reads the options screens. diff --git a/SerialPrograms/Source/VideoGames/PokemonLZA/Programs/AutoStory/Actions/PokemonLZA_AutoStoryPlatformWait.cpp b/SerialPrograms/Source/VideoGames/PokemonLZA/Programs/AutoStory/Actions/PokemonLZA_AutoStoryPlatformWait.cpp index ec15569341..fd2cce1f47 100644 --- a/SerialPrograms/Source/VideoGames/PokemonLZA/Programs/AutoStory/Actions/PokemonLZA_AutoStoryPlatformWait.cpp +++ b/SerialPrograms/Source/VideoGames/PokemonLZA/Programs/AutoStory/Actions/PokemonLZA_AutoStoryPlatformWait.cpp @@ -7,6 +7,7 @@ #include #include "VideoGames/PokemonLZA/Programs/AutoStory/PokemonLZA_AutoStoryReadings.h" #include "VideoGames/PokemonLZA/Programs/AutoStory/PokemonLZA_AutoStorySceneMachine.h" +#include "VideoGames/PokemonLZA/Programs/AutoStory/PokemonLZA_AutoStorySignalProbe.h" #include "PokemonLZA_AutoStoryPlatformWait.h" namespace PokemonAutomation{ @@ -33,7 +34,8 @@ struct PlatformProgress{ std::optional faded_in = std::nullopt; }; -// True once the platform has held PLATFORM_LOOKS looks. +// True once the platform's controls hint ("(L) Move") has held +// PLATFORM_LOOKS looks: the platform has no party bar. bool platform_look(PlzaBackend& backend, const ScreenObservation& look, PlatformWait wait, PlatformProgress& progress){ if (look.readings.contains(AUTOSAVE_READING)){ if (!progress.autosave_seen){ @@ -44,13 +46,13 @@ bool platform_look(PlzaBackend& backend, const ScreenObservation& look, Platform return false; } const bool counts = wait == PlatformWait::PLATFORM_ONLY || progress.autosave_seen; - progress.streak = counts && look.readings.contains(PLATFORM_READING) ? progress.streak + 1 : 0; + progress.streak = counts && look.readings.contains(CONTROLS_HINT_READING) ? progress.streak + 1 : 0; return progress.streak >= PLATFORM_LOOKS; } // The opening's last line ("Your train has arrived in Lumiose City!") waits for A. bool text_waiting_for_a(const ScreenObservation& look){ - return look.events.has(ScreenEvent::DIALOG_BOX) && look.readings.contains(ADVANCE_ARROW_READING); + return look.readings.contains(ADVANCE_ARROW_READING); } // A Plus held while the confirm screen still fades out does nothing (console @@ -69,13 +71,13 @@ void track_fade_in(const ScreenObservation& look, PlatformProgress& progress){ } // Once per fade-in, while the opening plays. Plus on the platform opens the -// map, so none once the platform or the autosave before it shows. +// map, so none once its controls hint or the autosave before it shows. bool opening_skip_due(const ScreenObservation& look, PlatformWait wait, const PlatformProgress& progress){ if (wait != PlatformWait::AFTER_AUTOSAVE || progress.autosave_seen || !progress.faded_in){ return false; } return look.when - *progress.faded_in >= OPENING_SKIP_AFTER_FADE_IN && !text_shows(look) && - !look.readings.contains(PLATFORM_READING); + !look.readings.contains(CONTROLS_HINT_READING); } } // namespace @@ -86,12 +88,15 @@ std::optional wait_for_platform(PlzaBackend& backend, Milliseconds const size_t max_looks = (size_t)(timeout / PLATFORM_POLL) + 1; std::optional start; PlatformProgress progress; + SignalProbe signals; for (size_t looks = 0; looks < max_looks; looks++){ backend.scope().throw_if_cancelled(); const ScreenObservation look = backend.observe(); + signals.look(look); start = start.value_or(look.when); if (platform_look(backend, look, wait, progress)){ backend.log(std::format("[PLZA] platform wait: on the platform after {} looks", looks + 1)); + backend.log_detail(signals.line("wait_for_platform", "platform", /*by=*/"hint")); return std::nullopt; } if (look.when - *start >= timeout){ @@ -112,23 +117,11 @@ std::optional wait_for_platform(PlzaBackend& backend, Milliseconds backend.wait(PLATFORM_POLL); } return StoryFailure{.code = "platform_not_seen", .detail = std::format( - "No platform on {} looks in a row within {} ms (autosave {}).", + "No controls hint on {} looks in a row within {} ms (autosave {}).", PLATFORM_LOOKS, timeout.count(), progress.autosave_seen ? "seen" : "not seen" )}; } -bool platform_holds_within(PlzaBackend& backend, size_t looks){ - size_t streak = 0; - for (size_t look = 0; look < looks; look++){ - backend.scope().throw_if_cancelled(); - streak = backend.observe().readings.contains(PLATFORM_READING) ? streak + 1 : 0; - if (streak >= PLATFORM_LOOKS){ - return true; - } - backend.wait(PLATFORM_POLL); - } - return false; -} diff --git a/SerialPrograms/Source/VideoGames/PokemonLZA/Programs/AutoStory/Actions/PokemonLZA_AutoStoryPlatformWait.h b/SerialPrograms/Source/VideoGames/PokemonLZA/Programs/AutoStory/Actions/PokemonLZA_AutoStoryPlatformWait.h index 3b98217cd4..4975d7f054 100644 --- a/SerialPrograms/Source/VideoGames/PokemonLZA/Programs/AutoStory/Actions/PokemonLZA_AutoStoryPlatformWait.h +++ b/SerialPrograms/Source/VideoGames/PokemonLZA/Programs/AutoStory/Actions/PokemonLZA_AutoStoryPlatformWait.h @@ -9,7 +9,6 @@ #ifndef PokemonAutomation_PokemonLZA_AutoStoryPlatformWait_H #define PokemonAutomation_PokemonLZA_AutoStoryPlatformWait_H -#include #include #include "Common/Cpp/Time.h" #include "Pokemon/AutoStory/Pokemon_StoryFailure.h" @@ -25,13 +24,12 @@ enum class PlatformWait{ AFTER_AUTOSAVE, // "opening_to_platform": the autosave badge first }; -// One A per text box with the advance arrow (A does not advance the -// cutscene). AFTER_AUTOSAVE: Plus held 0.75 s after each fade-in of the -// opening, until it skips to the platform. Fails as "platform_not_seen". +// The platform is its controls hint on two looks in a row. One A per +// advance arrow (A does not advance the cutscene). AFTER_AUTOSAVE: Plus held +// 0.75 s after each fade-in of the opening, until it skips to the platform. +// Fails as "platform_not_seen". std::optional wait_for_platform(PlzaBackend& backend, Milliseconds timeout, PlatformWait wait); -// Whether the platform shows on two looks in a row within `looks` looks. -bool platform_holds_within(PlzaBackend& backend, size_t looks); diff --git a/SerialPrograms/Source/VideoGames/PokemonLZA/Programs/AutoStory/Actions/PokemonLZA_AutoStoryWalkScreenChecks.cpp b/SerialPrograms/Source/VideoGames/PokemonLZA/Programs/AutoStory/Actions/PokemonLZA_AutoStoryWalkScreenChecks.cpp index 139507b175..47f04c0ab8 100644 --- a/SerialPrograms/Source/VideoGames/PokemonLZA/Programs/AutoStory/Actions/PokemonLZA_AutoStoryWalkScreenChecks.cpp +++ b/SerialPrograms/Source/VideoGames/PokemonLZA/Programs/AutoStory/Actions/PokemonLZA_AutoStoryWalkScreenChecks.cpp @@ -12,6 +12,7 @@ #include #include "VideoGames/PokemonLZA/Programs/AutoStory/PokemonLZA_AutoStoryReadings.h" #include "VideoGames/PokemonLZA/Programs/AutoStory/PokemonLZA_AutoStorySceneMachine.h" +#include "VideoGames/PokemonLZA/Programs/AutoStory/PokemonLZA_AutoStorySignalProbe.h" #include "PokemonLZA_AutoStoryWalkScreenChecks.h" namespace PokemonAutomation{ @@ -89,28 +90,24 @@ constexpr Milliseconds PROMPT_IS_CONTROL = 1000ms; constexpr Milliseconds PROMPT_STEADY_GAP = 300ms; bool prompt_taken(const ScreenObservation& look){ - return fade_shows(look) || look.events.has(ScreenEvent::DIALOG_BOX) || look.events.has(ScreenEvent::CHOICE_BOX); + return fade_shows(look) || text_shows(look) || look.events.has(ScreenEvent::CHOICE_BOX); } // What keeps control from being free; none when it is. std::optional not_free_control(const ScreenObservation& look){ - if (look.readings.contains(ADVANCE_ARROW_READING)){ + if (text_shows(look)){ return "text waiting for A"; } - if (look.events.has(ScreenEvent::DIALOG_BOX)){ - return "a text box"; - } if (fade_shows(look)){ return "a fade"; } return std::nullopt; } -// The party bar, the station platform after the opening, or the -// tutorial's controls hint. +// The party bar, or the tutorial's controls hint (also 01.01's platform, +// which shows no party bar). bool control_shows(const ScreenObservation& look){ - return look.events.has(ScreenEvent::PLAYER_CAN_MOVE) || look.readings.contains(PLATFORM_READING) || - look.readings.contains(CONTROLS_HINT_READING); + return look.events.has(ScreenEvent::PLAYER_CAN_MOVE) || look.readings.contains(CONTROLS_HINT_READING); } bool prompt_steady(PlzaBackend& backend){ @@ -301,8 +298,10 @@ std::optional check_can_walk(PlzaBackend& backend, std::s int control_looks = 0; std::optional quiet_since; std::optional prompt_since; + SignalProbe signals; for (Milliseconds waited = 0ms; waited <= FREE_CONTROL_WAIT; waited += FREE_CONTROL_LOOK){ const ScreenObservation look = backend.observe(); + signals.look(look); const std::optional busy = not_free_control(look); if (busy){ last_busy = *busy; @@ -312,6 +311,8 @@ std::optional check_can_walk(PlzaBackend& backend, std::s } control_looks = !busy && control_shows(look) ? control_looks + 1 : 0; if (control_looks >= 2){ + const bool party_bar = look.events.has(ScreenEvent::PLAYER_CAN_MOVE); + backend.log_detail(signals.line(walk, "walk_control", party_bar ? "party_bar" : "hint")); return std::nullopt; } if (!busy && look.events.has(ScreenEvent::INTERACT_PROMPT)){ @@ -323,12 +324,14 @@ std::optional check_can_walk(PlzaBackend& backend, std::s } if (prompt_since && waited - *prompt_since >= PROMPT_IS_CONTROL){ backend.log(std::format("[PLZA] {}: the A prompt held {} ms with nothing busy: control.", walk, PROMPT_IS_CONTROL.count())); + backend.log_detail(signals.line(walk, "walk_control", /*by=*/"prompt")); return std::nullopt; } if (quiet_since && waited - *quiet_since >= QUIET_IS_CONTROL){ backend.log(std::format( "[PLZA] {}: nothing busy for {} ms and no sign of control; taken as control.", walk, QUIET_IS_CONTROL.count() )); + backend.log_detail(signals.line(walk, "walk_control", /*by=*/"quiet")); return std::nullopt; } backend.wait(FREE_CONTROL_LOOK); diff --git a/SerialPrograms/Source/VideoGames/PokemonLZA/Programs/AutoStory/Detectors/PokemonLZA_AutoStoryDetectors_Tests.cpp b/SerialPrograms/Source/VideoGames/PokemonLZA/Programs/AutoStory/Detectors/PokemonLZA_AutoStoryDetectors_Tests.cpp index d0b1735941..e92a416c66 100644 --- a/SerialPrograms/Source/VideoGames/PokemonLZA/Programs/AutoStory/Detectors/PokemonLZA_AutoStoryDetectors_Tests.cpp +++ b/SerialPrograms/Source/VideoGames/PokemonLZA/Programs/AutoStory/Detectors/PokemonLZA_AutoStoryDetectors_Tests.cpp @@ -27,7 +27,6 @@ #include "PokemonLZA_AutoStoryDetectors_Tests.h" #include "PokemonLZA_AutoStoryMainMissionBannerDetector.h" #include "PokemonLZA_AutoStoryMissionCompleteDetector.h" -#include "PokemonLZA_AutoStoryPlatformArrivalDetector.h" #include "PokemonLZA_AutoStoryTutorialCardDetector.h" namespace PokemonAutomation{ @@ -43,7 +42,6 @@ constexpr size_t HEIGHT = 1080; // Per detector: the expected read, or none when not checked. struct DetectorReads{ - std::optional platform = {}; std::optional autosave = {}; std::optional controls_hint = {}; std::optional advance_arrow = {}; @@ -57,7 +55,6 @@ struct DetectorField{ std::optional DetectorReads::* read; }; const DetectorField DETECTOR_FIELDS[] = { - {"platform", &DetectorReads::platform}, {"autosave", &DetectorReads::autosave}, {"controls hint", &DetectorReads::controls_hint}, {"advance arrow", &DetectorReads::advance_arrow}, @@ -96,7 +93,6 @@ std::string mismatches(const DetectorReads& got, const DetectorReads& want){ } struct StoryDetectors{ - PlatformArrivalDetector platform; AutosaveDetector autosave; ControlsHintDetector hint; AdvanceArrowDetector arrow; @@ -106,7 +102,7 @@ struct StoryDetectors{ DetectorReads read(const ImageViewRGB32& frame){ return DetectorReads{ - .platform = platform.detect(frame), .autosave = autosave.detect(frame), + .autosave = autosave.detect(frame), .controls_hint = hint.detect(frame), .advance_arrow = arrow.detect(frame), .mission_banner = banner.detect(frame), .mission_complete = complete.detect(frame), .party_bar = party_bar.detect(frame), @@ -187,7 +183,7 @@ const SyntheticFrameCase SYNTHETIC_FRAME_CASES[] = { UnitTestResult check_synthetic_frame(const SyntheticFrameCase& test, Logger& logger){ StoryDetectors detectors; const DetectorReads got = detectors.read(test.input.frame()); - logger.log(std::format("{}: {}{}", test.name, to_string(detectors.platform.last_distances()), firing(got))); + logger.log(std::format("{} reads{}", test.name, firing(got))); const std::string wrong = mismatches(got, test.expectation.reads); if (!wrong.empty()){ return std::format("Wrong on {}:{}", test.name, wrong); @@ -216,13 +212,13 @@ DetectorReads as_named(std::string_view name){ return name.find(reading) != std::string_view::npos; }; return DetectorReads{ - .platform = has("+platform"), .autosave = has("+autosave"), + .autosave = has("+autosave"), .controls_hint = has("+controls_hint"), .advance_arrow = has("+advance_arrow"), .mission_banner = has("+mission_banner"), .mission_complete = has("+mission_complete"), }; } -// The opening cutscene up to the platform: none is the platform. +// The opening cutscene up to the platform: no detector fires. std::optional opening(std::string_view){ return DetectorReads{}; } @@ -234,7 +230,6 @@ std::optional arrival_to_ad(std::string_view name){ return std::nullopt; } return DetectorReads{ - .platform = name.find("+platform") != std::string_view::npos, .controls_hint = *index <= 6, .advance_arrow = *index == 40, }; } @@ -247,7 +242,6 @@ std::optional arrival_to_ad_subtitles(std::string_view name){ } const bool box_arrow = *index == 44 || *index == 49 || *index == 53 || *index == 78; return DetectorReads{ - .platform = name.find("+platform") != std::string_view::npos, .controls_hint = *index <= 6, .advance_arrow = box_arrow || (*index >= 93 && *index <= 115), }; @@ -260,7 +254,6 @@ std::optional arrival_to_mission_banner(std::string_view name){ return std::nullopt; } return DetectorReads{ - .platform = name.find("+platform") != std::string_view::npos, .controls_hint = name.find("+controls_hint") != std::string_view::npos, .advance_arrow = name.find("+advance_arrow") != std::string_view::npos, .mission_banner = *index == 181, @@ -356,7 +349,7 @@ UnitTestResult check_frame_folder(const FrameFolderCase& test, Logger& logger){ continue; } const DetectorReads got = detectors.read(ImageRGB32(path.string())); - logger.log(std::format("{}: {}{}", name, to_string(detectors.platform.last_distances()), firing(got))); + logger.log(std::format("{} reads{}", name, firing(got))); const std::string wrong = mismatches(got, every_detector(*want)); if (!wrong.empty()){ failures += std::format(" {}:{};", name, wrong); diff --git a/SerialPrograms/Source/VideoGames/PokemonLZA/Programs/AutoStory/Detectors/PokemonLZA_AutoStoryPlatformArrivalDetector.cpp b/SerialPrograms/Source/VideoGames/PokemonLZA/Programs/AutoStory/Detectors/PokemonLZA_AutoStoryPlatformArrivalDetector.cpp deleted file mode 100644 index 43118b4077..0000000000 --- a/SerialPrograms/Source/VideoGames/PokemonLZA/Programs/AutoStory/Detectors/PokemonLZA_AutoStoryPlatformArrivalDetector.cpp +++ /dev/null @@ -1,152 +0,0 @@ -/* PokemonLZA AutoStory - Opening detectors - * - * From: https://github.com/PokemonAutomation/ - * - */ - -#include -#include -#include -#include -#include -#include -#include "Common/Cpp/Exceptions.h" -#include "Common/Cpp/Json/JsonObject.h" -#include "Common/Cpp/Json/JsonValue.h" -#include "CommonFramework/ImageTypes/ImageViewRGB32.h" -#include "CommonFramework/VideoPipeline/VideoOverlayScopes.h" -#include "PokemonLZA_AutoStoryPlatformArrivalDetector.h" -#include "PokemonLZA_AutoStoryReferenceCells.h" - -namespace PokemonAutomation{ -namespace NintendoSwitch{ -namespace PokemonLZA{ - - -namespace{ - -// On 1920x1080: top band y 0-300; sides x 0-640 and 1280-1920, y 300-1080, leaving -// out the player (x 780-1200). Cells 30x30 (top) or 40x39 (sides). -struct PlatformRegion{ - std::string_view name; - ImageFloatBox box; - size_t cols; - size_t rows; -}; - -const PlatformRegion PLATFORM_REGIONS[] = { - {"top", {0.0, 0.0, 1.0, 300.0 / 1080}, 64, 10}, - {"left", {0.0, 300.0 / 1080, 640.0 / 1920, 780.0 / 1080}, 16, 20}, - {"right", {1280.0 / 1920, 300.0 / 1080, 640.0 / 1920, 780.0 / 1080}, 16, 20}, -}; - -// Measured against the reference: the train's interior just before the platform -// top 112.8, left 82.6; the platform loaded from its autosave top 68.1, left 41.7 at -// most. The right side holds moving NPCs, so it only has to be roughly the platform -// (a menu or another place is 140+). -constexpr double PLATFORM_TOP_MAX = 90.0; -constexpr double PLATFORM_LEFT_MAX = 55.0; -constexpr double PLATFORM_RIGHT_MAX = 120.0; - -// The largest distance: every channel of every cell 255 apart, sqrt(3) * 255. -constexpr double MAX_PLATFORM_DISTANCE = 441.7; - -using Cells = ReferenceCells; - -Cells region_cells(const ImageViewRGB32& screen, const PlatformRegion& region){ - return grid_cells(screen, region.box, region.cols, region.rows); -} - -// The reference's cells of `region` from ReferenceData/plza-platform.json: -// "regions": {: {"cols": n, "rows": ["rrggbb...", ...]}}. -Cells reference_cells(const JsonObject& regions, const PlatformRegion& region){ - const std::string source = "plza-platform.json"; - const JsonObject& entry = regions.get_object_throw(std::string(region.name), source); - return read_cell_grid(entry, region.cols, region.rows, std::format("{} region {}", source, region.name)); -} - -const std::vector& platform_reference(){ - static const std::vector reference = []{ - for (const auto& [name, text] : autostory_reference_json()){ - if (name != "plza-platform"){ - continue; - } - const JsonValue json = parse_json(text); - const JsonObject& regions = json.to_object_throw("plza-platform.json").get_object_throw("regions"); - std::vector cells; - for (const PlatformRegion& region : PLATFORM_REGIONS){ - cells.push_back(reference_cells(regions, region)); - } - return cells; - } - throw FileException(nullptr, PA_CURRENT_FUNCTION, "The platform reference is not built in.", "plza-platform.json"); - }(); - return reference; -} - -PlatformDistances platform_distances(const ImageViewRGB32& screen){ - const std::vector& reference = platform_reference(); - double distance[std::size(PLATFORM_REGIONS)] = {}; - for (size_t index = 0; index < std::size(PLATFORM_REGIONS); index++){ - distance[index] = cells_rmsd(reference[index], region_cells(screen, PLATFORM_REGIONS[index])); - } - return PlatformDistances{.top = distance[0], .left = distance[1], .right = distance[2]}; -} - -bool platform_matches(const PlatformDistances& distances){ - return distances.top <= PLATFORM_TOP_MAX - && distances.left <= PLATFORM_LEFT_MAX - && distances.right <= PLATFORM_RIGHT_MAX; -} - -} // namespace - - -ImageRGB32 platform_reference_image(size_t width, size_t height){ - ImageRGB32 image(width, height); - image.fill(0xff000000); - const std::vector& reference = platform_reference(); - for (size_t index = 0; index < std::size(PLATFORM_REGIONS); index++){ - const PlatformRegion& region = PLATFORM_REGIONS[index]; - const ImagePixelBox box = floatbox_to_pixelbox(width, height, region.box); - for (size_t y = box.min_y; y < box.max_y; y++){ - for (size_t x = box.min_x; x < box.max_x; x++){ - const size_t col = (x - box.min_x) * region.cols / (box.max_x - box.min_x); - const size_t row = (y - box.min_y) * region.rows / (box.max_y - box.min_y); - const FloatPixel& cell = reference[index][row * region.cols + col]; - image.pixel(x, y) = (uint32_t)Color((uint8_t)std::lround(cell.r), (uint8_t)std::lround(cell.g), (uint8_t)std::lround(cell.b)); - } - } - } - return image; -} - -std::string to_string(const PlatformDistances& distances){ - return std::format("top {:.1f}, left {:.1f}, right {:.1f}", distances.top, distances.left, distances.right); -} - - -PlatformArrivalDetector::PlatformArrivalDetector(Color color) - : m_color(color) -{} - -void PlatformArrivalDetector::make_overlays(VideoOverlaySet& items) const{ - for (const PlatformRegion& region : PLATFORM_REGIONS){ - items.add(m_color, region.box); - } -} - -bool PlatformArrivalDetector::detect(const ImageViewRGB32& screen){ - if (screen.width() == 0 || screen.height() == 0){ - // No frame: as far from the platform as a frame can be. - m_last = PlatformDistances{.top = MAX_PLATFORM_DISTANCE, .left = MAX_PLATFORM_DISTANCE, .right = MAX_PLATFORM_DISTANCE}; - return false; - } - m_last = platform_distances(screen); - return platform_matches(m_last); -} - - -} // namespace PokemonLZA -} // namespace NintendoSwitch -} // namespace PokemonAutomation diff --git a/SerialPrograms/Source/VideoGames/PokemonLZA/Programs/AutoStory/Detectors/PokemonLZA_AutoStoryPlatformArrivalDetector.h b/SerialPrograms/Source/VideoGames/PokemonLZA/Programs/AutoStory/Detectors/PokemonLZA_AutoStoryPlatformArrivalDetector.h deleted file mode 100644 index 440c73cb3f..0000000000 --- a/SerialPrograms/Source/VideoGames/PokemonLZA/Programs/AutoStory/Detectors/PokemonLZA_AutoStoryPlatformArrivalDetector.h +++ /dev/null @@ -1,62 +0,0 @@ -/* PokemonLZA AutoStory - Platform arrival detector - * - * From: https://github.com/PokemonAutomation/ - * - * The station platform once the opening cutscene ends and the player has control. - * - */ - -#ifndef PokemonAutomation_PokemonLZA_AutoStoryPlatformArrivalDetector_H -#define PokemonAutomation_PokemonLZA_AutoStoryPlatformArrivalDetector_H - -#include -#include "Common/Cpp/Color.h" -#include "CommonFramework/ImageTools/ImageBoxes.h" -#include "CommonFramework/ImageTypes/ImageRGB32.h" -#include "CommonTools/VisualDetector.h" - -namespace PokemonAutomation{ -namespace NintendoSwitch{ -namespace PokemonLZA{ - - -// Per region, the RMSD over its cells of the summed squared channel differences -// (0 = the same, at most 441). -struct PlatformDistances{ - double top; - double left; - double right; -}; - -// The reference as a frame (the player's area black): the platform, for tests. -// code-health: allow test_only_api -- the tests' platform frame needs the reference cells that only this .cpp reads -ImageRGB32 platform_reference_image(size_t width, size_t height); - -// "top 12.3, left 4.5, right 30.1", for the log. -std::string to_string(const PlatformDistances& distances); - - -// The station platform with free control, right after the opening -// cutscene, at the default camera. -class PlatformArrivalDetector : public StaticScreenDetector{ -public: - explicit PlatformArrivalDetector(Color color = COLOR_CYAN); - - virtual void make_overlays(VideoOverlaySet& items) const override; - virtual bool detect(const ImageViewRGB32& screen) override; - - const PlatformDistances& last_distances() const{ - return m_last; - } - -private: - Color m_color; - PlatformDistances m_last{.top = 0, .left = 0, .right = 0}; -}; - - - -} // namespace PokemonLZA -} // namespace NintendoSwitch -} // namespace PokemonAutomation -#endif diff --git a/SerialPrograms/Source/VideoGames/PokemonLZA/Programs/AutoStory/Detectors/PokemonLZA_AutoStoryStartScreenReader.cpp b/SerialPrograms/Source/VideoGames/PokemonLZA/Programs/AutoStory/Detectors/PokemonLZA_AutoStoryStartScreenReader.cpp index 38bf2f8715..06b00dc05a 100644 --- a/SerialPrograms/Source/VideoGames/PokemonLZA/Programs/AutoStory/Detectors/PokemonLZA_AutoStoryStartScreenReader.cpp +++ b/SerialPrograms/Source/VideoGames/PokemonLZA/Programs/AutoStory/Detectors/PokemonLZA_AutoStoryStartScreenReader.cpp @@ -18,8 +18,7 @@ namespace PokemonLZA{ StartSignature read_start_screen(const ImageViewRGB32& screen){ PlzaScreenObserver observer; const ScreenEvents events = observer.read(screen); - const bool unreadable = events.has(ScreenEvent::FADE_BLACK) || events.has(ScreenEvent::FADE_WHITE) - || events.has(ScreenEvent::DIALOG_BOX); + const bool unreadable = events.has(ScreenEvent::FADE_BLACK) || events.has(ScreenEvent::FADE_WHITE); if (unreadable){ return StartSignature{}; } diff --git a/SerialPrograms/Source/VideoGames/PokemonLZA/Programs/AutoStory/PokemonLZA_AutoStory.cpp b/SerialPrograms/Source/VideoGames/PokemonLZA/Programs/AutoStory/PokemonLZA_AutoStory.cpp index 7a548c0f0a..a8ebac41f4 100644 --- a/SerialPrograms/Source/VideoGames/PokemonLZA/Programs/AutoStory/PokemonLZA_AutoStory.cpp +++ b/SerialPrograms/Source/VideoGames/PokemonLZA/Programs/AutoStory/PokemonLZA_AutoStory.cpp @@ -32,7 +32,6 @@ #include "Actions/PokemonLZA_AutoStoryMapWalk.h" #include "Actions/PokemonLZA_AutoStoryNewGame.h" #include "Detectors/PokemonLZA_AutoStoryMinimapMatch.h" -#include "Detectors/PokemonLZA_AutoStoryPlatformArrivalDetector.h" #include "Detectors/PokemonLZA_AutoStoryStartScreenReader.h" #include "PokemonLZA_AutoStoryBackups.h" #include "PokemonLZA_AutoStoryConsoleBackend.h" @@ -186,7 +185,7 @@ constexpr std::string_view RECORD_START_MINIMAPS_LABEL = constexpr std::string_view RELOAD_PROBE_AFTER_LABEL = "Reload Probe After:
For developers: checkpoint ids, comma-separated (e.g. 03.03). After each passes, reload the latest save " - "once, log where it lands by the minimap references and the platform (\"[ReloadProbe]\") with a screenshot in the AutoStoryDev folder " + "once, log where it lands by the minimap references (\"[ReloadProbe]\") with a screenshot in the AutoStoryDev folder " "of the user files, and go on from the checkpoint whose start the screen shows. Empty: off."; // A run after the new game starts from the latest save, not from wherever @@ -312,7 +311,7 @@ std::set> checkpoint_ids(std::string_view text){ return ids; } -// "[ReloadProbe] after 03.03: landed at 03.04-start (platform no; 03.04-start 8.2, +// "[ReloadProbe] after 03.03: landed at 03.04-start (03.04-start 8.2, // 03.05-start 24.0, 03.03-start 31.5)", and the frame. Presses nothing. void log_reload_landing(StoryEnv& story, PlzaBackend& backend, const StoryCheckpoint& passed){ story.context.wait_for_all_requests(); @@ -321,13 +320,12 @@ void log_reload_landing(StoryEnv& story, PlzaBackend& backend, const StoryCheckp backend.log(std::format("[ReloadProbe] after {}: landed at unknown (no frame)", passed.id)); return; } - const bool platform = PlatformArrivalDetector().detect(*snapshot.frame); const std::vector distances = minimap_distances(*snapshot.frame); - std::string scores = std::format("platform {}", platform ? "yes" : "no"); + std::string scores; for (size_t index = 0; index < distances.size() && index < 3; index++){ - scores += std::format("{} {} {:.1f}", index == 0 ? ";" : ",", distances[index].reference, distances[index].distance); + scores += std::format("{}{} {:.1f}", index == 0 ? "" : ", ", distances[index].reference, distances[index].distance); } - const std::string landed = platform ? "platform" : matching_minimap(*snapshot.frame).value_or("unknown"); + const std::string landed = matching_minimap(*snapshot.frame).value_or("unknown"); backend.log(std::format("[ReloadProbe] after {}: landed at {} ({})", passed.id, landed, scores)); const std::string folder = start_minimaps_folder(); Filesystem::create_directories(Filesystem::Path(folder)); diff --git a/SerialPrograms/Source/VideoGames/PokemonLZA/Programs/AutoStory/PokemonLZA_AutoStoryBackups_Tests.cpp b/SerialPrograms/Source/VideoGames/PokemonLZA/Programs/AutoStory/PokemonLZA_AutoStoryBackups_Tests.cpp index db2c9760a3..2a92cf6482 100644 --- a/SerialPrograms/Source/VideoGames/PokemonLZA/Programs/AutoStory/PokemonLZA_AutoStoryBackups_Tests.cpp +++ b/SerialPrograms/Source/VideoGames/PokemonLZA/Programs/AutoStory/PokemonLZA_AutoStoryBackups_Tests.cpp @@ -255,7 +255,7 @@ bool has_line(const std::vector& lines, std::string_view wanted){ constexpr Milliseconds OWN_BADGE = 2000ms; std::vector badge_in_first_step(){ - return {look({}), look({AUTOSAVE_READING}, OWN_BADGE), look({PLATFORM_READING}, OWN_BADGE + 1000ms)}; + return {look({}), look({AUTOSAVE_READING}, OWN_BADGE), look({CONTROLS_HINT_READING}, OWN_BADGE + 1000ms)}; } // The backup card reads 1 registered: 03.06's start. @@ -311,7 +311,7 @@ UnitTestResult check_rewind(const RewindCase& test, CancellableScope& scope){ return check_run( RewindRun{ .rows = story_rows(), .first = RUN_FROM, .last = RUN_TO, - .looks = test.input.autosave_in_failed_run ? badge_in_first_step() : std::vector{look({PLATFORM_READING})}, + .looks = test.input.autosave_in_failed_run ? badge_in_first_step() : std::vector{look({CONTROLS_HINT_READING})}, .failed_catches = test.input.failed_catches, .failure = test.input.failure, .card = test.input.card, .max_rewinds = test.input.max_rewinds, }, @@ -397,8 +397,8 @@ UnitTestResult check_gate(const GateCase& test, CancellableScope& scope){ const std::vector looks = test.input.badge == BadgeIn::FIRST_STEP ? badge_in_first_step() : std::vector{ - look({}), look({PLATFORM_READING}, 1000ms), look({PLATFORM_READING}, 1300ms), - look({AUTOSAVE_READING}, OWN_BADGE), look({PLATFORM_READING}, OWN_BADGE + 1000ms), + look({}), look({CONTROLS_HINT_READING}, 1000ms), look({CONTROLS_HINT_READING}, 1300ms), + look({AUTOSAVE_READING}, OWN_BADGE), look({CONTROLS_HINT_READING}, OWN_BADGE + 1000ms), }; return check_run( RewindRun{ diff --git a/SerialPrograms/Source/VideoGames/PokemonLZA/Programs/AutoStory/PokemonLZA_AutoStoryChainStart_Tests.cpp b/SerialPrograms/Source/VideoGames/PokemonLZA/Programs/AutoStory/PokemonLZA_AutoStoryChainStart_Tests.cpp index 2896dd0ee0..fd32a3bd77 100644 --- a/SerialPrograms/Source/VideoGames/PokemonLZA/Programs/AutoStory/PokemonLZA_AutoStoryChainStart_Tests.cpp +++ b/SerialPrograms/Source/VideoGames/PokemonLZA/Programs/AutoStory/PokemonLZA_AutoStoryChainStart_Tests.cpp @@ -41,7 +41,7 @@ ScreenObservation look_of(std::optional reading){ // 01.01's platform, then the looks off it. const std::vector CHAIN_LOOKS = { - look_of(PLATFORM_READING), look_of(PLATFORM_READING), + look_of(CONTROLS_HINT_READING), look_of(CONTROLS_HINT_READING), look_of(std::nullopt), look_of(std::nullopt), look_of(std::nullopt), look_of(std::nullopt), }; diff --git a/SerialPrograms/Source/VideoGames/PokemonLZA/Programs/AutoStory/PokemonLZA_AutoStoryConsoleBackend.cpp b/SerialPrograms/Source/VideoGames/PokemonLZA/Programs/AutoStory/PokemonLZA_AutoStoryConsoleBackend.cpp index ee2843c52e..b9b49f667c 100644 --- a/SerialPrograms/Source/VideoGames/PokemonLZA/Programs/AutoStory/PokemonLZA_AutoStoryConsoleBackend.cpp +++ b/SerialPrograms/Source/VideoGames/PokemonLZA/Programs/AutoStory/PokemonLZA_AutoStoryConsoleBackend.cpp @@ -33,6 +33,7 @@ using namespace std::chrono_literals; PlzaConsoleBackend::PlzaConsoleBackend(StoryEnv& env) : m_env(env) , m_home(env.env.console, COLOR_RED) + , m_shadow_dialog_box({.white = WhiteDialogPart::BOX_ONLY}) , m_save_button(COLOR_GREEN, nullptr, SelectionArrowType::RIGHT, main_menu_save_arrow_box()) {} @@ -89,9 +90,6 @@ ScreenObservation PlzaConsoleBackend::observe(){ look.events.set(ScreenEvent::SWITCH_HOME_MENU, true); }else if (frame){ look = Pokemon::screen_observation(m_observer.read(*frame.frame)); - if (m_platform.detect(*frame.frame)){ - look.readings[std::string(PLATFORM_READING)] = 1; - } if (m_autosave.detect(*frame.frame)){ look.readings[std::string(AUTOSAVE_READING)] = 1; } @@ -101,6 +99,9 @@ ScreenObservation PlzaConsoleBackend::observe(){ if (m_advance_arrow.detect(*frame.frame)){ look.readings[std::string(ADVANCE_ARROW_READING)] = 1; } + if (m_shadow_dialog_box.detect(*frame.frame)){ + look.readings[std::string(SHADOW_DIALOG_BOX_READING)] = 1; + } if (m_mission_complete.detect(*frame.frame)){ look.readings[std::string(MISSION_COMPLETE_READING)] = 1; }else if (m_mission_banner.detect(*frame.frame)){ diff --git a/SerialPrograms/Source/VideoGames/PokemonLZA/Programs/AutoStory/PokemonLZA_AutoStoryConsoleBackend.h b/SerialPrograms/Source/VideoGames/PokemonLZA/Programs/AutoStory/PokemonLZA_AutoStoryConsoleBackend.h index f11879bb3e..3dcd36dcbe 100644 --- a/SerialPrograms/Source/VideoGames/PokemonLZA/Programs/AutoStory/PokemonLZA_AutoStoryConsoleBackend.h +++ b/SerialPrograms/Source/VideoGames/PokemonLZA/Programs/AutoStory/PokemonLZA_AutoStoryConsoleBackend.h @@ -25,9 +25,9 @@ #include "VideoGames/PokemonLZA/Programs/AutoStory/Detectors/PokemonLZA_AutoStoryAdvanceArrowDetector.h" #include "VideoGames/PokemonLZA/Programs/AutoStory/Detectors/PokemonLZA_AutoStoryAutosaveDetector.h" #include "VideoGames/PokemonLZA/Programs/AutoStory/Detectors/PokemonLZA_AutoStoryControlsHintDetector.h" +#include "VideoGames/PokemonLZA/Programs/AutoStory/Detectors/PokemonLZA_AutoStoryDialogDetector.h" #include "VideoGames/PokemonLZA/Programs/AutoStory/Detectors/PokemonLZA_AutoStoryMainMissionBannerDetector.h" #include "VideoGames/PokemonLZA/Programs/AutoStory/Detectors/PokemonLZA_AutoStoryMissionCompleteDetector.h" -#include "VideoGames/PokemonLZA/Programs/AutoStory/Detectors/PokemonLZA_AutoStoryPlatformArrivalDetector.h" #include "VideoGames/PokemonLZA/Programs/AutoStory/Actions/PokemonLZA_AutoStoryHeading.h" #include "PokemonLZA_AutoStoryBackend.h" #include "PokemonLZA_AutoStoryScreenEvents.h" @@ -85,12 +85,13 @@ class PlzaConsoleBackend : public PlzaBackend{ StoryEnv& m_env; HomeMenuDetector m_home; PlzaScreenObserver m_observer; - PlatformArrivalDetector m_platform; AutosaveDetector m_autosave; ControlsHintDetector m_controls_hint; AdvanceArrowDetector m_advance_arrow; MainMissionBannerDetector m_mission_banner; MissionCompleteDetector m_mission_complete; + // The white box while its text types: SHADOW_DIALOG_BOX_READING, for the log. + StoryDialogDetector m_shadow_dialog_box; MainMenuDetector m_main_menu; MapDetector m_map; SelectionArrowDetector m_save_button; diff --git a/SerialPrograms/Source/VideoGames/PokemonLZA/Programs/AutoStory/PokemonLZA_AutoStoryGame.cpp b/SerialPrograms/Source/VideoGames/PokemonLZA/Programs/AutoStory/PokemonLZA_AutoStoryGame.cpp index b81d3f7bde..fbe414200c 100644 --- a/SerialPrograms/Source/VideoGames/PokemonLZA/Programs/AutoStory/PokemonLZA_AutoStoryGame.cpp +++ b/SerialPrograms/Source/VideoGames/PokemonLZA/Programs/AutoStory/PokemonLZA_AutoStoryGame.cpp @@ -12,7 +12,6 @@ #include #include #include -#include "VideoGames/PokemonLZA/Programs/AutoStory/Actions/PokemonLZA_AutoStoryPlatformWait.h" #include "VideoGames/PokemonLZA/Programs/AutoStory/Actions/PokemonLZA_AutoStoryWalkScreenChecks.h" #include "PokemonLZA_AutoStoryActionNames.h" #include "PokemonLZA_AutoStoryStarts.h" @@ -33,15 +32,6 @@ bool first_step_checks_start(const Pokemon::StoryCheckpoint& checkpoint){ return checkpoint_first_action(checkpoint) == action_name(PlzaAction::WAIT_FOR_PLATFORM) || checkpoint_starts_without_save(checkpoint); } -// Right after a load the platform reads on the first two looks. -constexpr size_t START_LOOKS = 4; - - -enum class StartCheck{ - PASSED, // its first step checks it - FAILED, // the station platform holds: 01.01's start, not this checkpoint's - UNCHECKED, // off the platform; nothing checks the checkpoint's own start yet -}; // "[Boundary] start: ": what pins the start ("pinned by // minimap", "unchecked"), the evidence for which start checks a run needs. @@ -49,14 +39,6 @@ void log_start_boundary(PlzaBackend& backend, std::string_view id, std::string_v backend.log(std::format("[Boundary] {} start: {}", id, pinned)); } -// Only the station platform is read so far. -StartCheck check_start(PlzaBackend& backend, const Pokemon::StoryCheckpoint& checkpoint){ - if (first_step_checks_start(checkpoint)){ - return StartCheck::PASSED; - } - return platform_holds_within(backend, START_LOOKS) ? StartCheck::FAILED : StartCheck::UNCHECKED; -} - } // namespace @@ -72,18 +54,9 @@ std::optional load_checkpoint_start(Pokemon::StoryGame& g if (!game.reload(backend, checkpoint)){ return Pokemon::StoryFailure{.code = "reload_failed", .detail = "the reload is at no checkpoint's start"}; } - switch (check_start(backend, checkpoint)){ - case StartCheck::PASSED: - return std::nullopt; - case StartCheck::FAILED: - backend.log(std::format("[Checkpoint] {}: the save is on the station platform, not at its start", checkpoint.id)); - return Pokemon::StoryFailure{.code = "older_save", .detail = std::format( - "the latest save is on the station platform (01.01's start), older than {}'s start", checkpoint.id - )}; - case StartCheck::UNCHECKED: - break; + if (!first_step_checks_start(checkpoint)){ + backend.log(std::format("[Checkpoint] {}: START UNCHECKED: nothing reads this row's own start", checkpoint.id)); } - backend.log(std::format("[Checkpoint] {}: off the station platform; START UNCHECKED: nothing reads this row's own start", checkpoint.id)); return std::nullopt; } @@ -126,31 +99,14 @@ std::variant check_live_start(CheckpointRun& run, return Pokemon::StoryFailure{.code = "chain_off_start", .detail = std::format("the run is not at {}'s start: {}", checkpoint.id, screen)}; } -// `seen`: whether the checkpoint before's autosave showed. Fails when only a -// reload would do and there is no save to load. +// `seen`: whether the checkpoint before's autosave showed. std::variant decide_chain(CheckpointRun& run, const Pokemon::StoryCheckpoint& checkpoint, bool seen){ - PlzaBackend& backend = run.backend; - const auto no_save = [&](std::string_view why){ - backend.log(std::format("[Checkpoint] {}: no save at its start: {}", checkpoint.id, why)); - return Pokemon::StoryFailure{.code = "no_start_save", .detail = std::format( - "no save at {}'s start: {}; a reload would rewind to an older save", checkpoint.id, why - )}; - }; - switch (check_start(backend, checkpoint)){ - case StartCheck::PASSED: - backend.log(std::format("[Checkpoint] {}: start check passed; on from the live screen", checkpoint.id)); - log_start_boundary(backend, checkpoint.id, "pinned by platform"); + if (first_step_checks_start(checkpoint)){ + run.backend.log(std::format("[Checkpoint] {}: start check passed; on from the live screen", checkpoint.id)); + log_start_boundary(run.backend, checkpoint.id, "pinned by its first step"); return Chain::ON; - case StartCheck::UNCHECKED: - return check_live_start(run, checkpoint, seen); - case StartCheck::FAILED: - break; - } - if (!seen){ - return no_save("the start check failed and the autosave before it was not seen"); } - backend.log(std::format("[Checkpoint] {}: start check failed; reloads its start save", checkpoint.id)); - return Chain::RELOAD; + return check_live_start(run, checkpoint, seen); } std::optional reload_into( diff --git a/SerialPrograms/Source/VideoGames/PokemonLZA/Programs/AutoStory/PokemonLZA_AutoStoryGame.h b/SerialPrograms/Source/VideoGames/PokemonLZA/Programs/AutoStory/PokemonLZA_AutoStoryGame.h index 110d786ccb..765424eb8e 100644 --- a/SerialPrograms/Source/VideoGames/PokemonLZA/Programs/AutoStory/PokemonLZA_AutoStoryGame.h +++ b/SerialPrograms/Source/VideoGames/PokemonLZA/Programs/AutoStory/PokemonLZA_AutoStoryGame.h @@ -35,9 +35,8 @@ namespace PokemonLZA{ // (which must outlive it) saw; no reload. Pokemon::StoryGame plza_story_game(const MarkedCheckpoints& marked, AutosaveSightings& sightings); -// Reloads the latest save. Fails as "older_save" when it lands on the -// station platform but `checkpoint` is not 01.01, "no_reload" when `game` has -// none, "reload_failed" when the reload says it is at no start. +// Reloads the latest save. Fails as "no_reload" when `game` has none, +// "reload_failed" when the reload says it is at no start. std::optional load_checkpoint_start( Pokemon::StoryGame& game, PlzaBackend& backend, const Pokemon::StoryCheckpoint& checkpoint ); @@ -70,9 +69,7 @@ struct CheckpointRunOptions{ // - reload_when_chained checkpoints reload and must land at their start: // "reload_off_start", or "reload_unchecked" with no start or reader. // - other checkpoints are checked on the live screen: "chain_off_start" when -// elsewhere; no start or reader runs on unchecked. On the station -// platform, the checkpoint's start is reloaded, "no_start_save" when no -// autosave was seen. +// elsewhere; no start or reader runs on unchecked. std::optional run_plza_checkpoints( Pokemon::StoryGame& game, std::span checkpoints, CheckpointRunOptions& options, PlzaBackend& backend, Pokemon::RunState& state, AutosaveSightings& sightings diff --git a/SerialPrograms/Source/VideoGames/PokemonLZA/Programs/AutoStory/PokemonLZA_AutoStoryGame_Tests.cpp b/SerialPrograms/Source/VideoGames/PokemonLZA/Programs/AutoStory/PokemonLZA_AutoStoryGame_Tests.cpp index 4dad47ec3b..cd043b89d2 100644 --- a/SerialPrograms/Source/VideoGames/PokemonLZA/Programs/AutoStory/PokemonLZA_AutoStoryGame_Tests.cpp +++ b/SerialPrograms/Source/VideoGames/PokemonLZA/Programs/AutoStory/PokemonLZA_AutoStoryGame_Tests.cpp @@ -119,14 +119,15 @@ ScreenObservation look(ScreenEvents events, std::vector readin return observation; } -const ScreenObservation PLATFORM = look({}, {PLATFORM_READING}); +// 01.01's platform: the controls hint, no party bar. +const ScreenObservation PLATFORM = look({}, {CONTROLS_HINT_READING}); // 2 s in: a badge in a checkpoint's first 1.5 s is the save before it. const ScreenObservation OWN_AUTOSAVE = look({}, {AUTOSAVE_READING}, Milliseconds(2000)); const ScreenObservation CUTSCENE = look({}); const ScreenObservation STILL = look({ScreenEvent::SCREEN_STILL}); const ScreenObservation WHITE_FADE = look({ScreenEvent::FADE_WHITE}); const ScreenObservation BLACK_FADE = look({ScreenEvent::FADE_BLACK}); -const ScreenObservation DIALOG = look({ScreenEvent::DIALOG_BOX}); +const ScreenObservation DIALOG = look({}, {ADVANCE_ARROW_READING}); const ScreenObservation A_PROMPT = look({ScreenEvent::INTERACT_PROMPT, ScreenEvent::PLAYER_CAN_MOVE}); ScreenObservation party_bar(Milliseconds at){ @@ -134,7 +135,7 @@ ScreenObservation party_bar(Milliseconds at){ } ScreenObservation choice(int selected, int rows = 2){ - ScreenObservation observation = look({ScreenEvent::DIALOG_BOX, ScreenEvent::CHOICE_BOX}); + ScreenObservation observation = look({ScreenEvent::CHOICE_BOX}); observation.readings[std::string(CHOICE_ROWS_READING)] = rows; observation.readings[std::string(CHOICE_SELECTED_READING)] = selected; return observation; @@ -254,12 +255,12 @@ const RunCase RUN_CASES[] = { { .name = "01.01's arrival ends 5 s after its third black fade, not after the banner that follows its second; Plus in the 5 s with no text", .input = {.checkpoint = "01.01", .first_step = 3, .looks = { - look({ScreenEvent::DIALOG_BOX}, /*readings=*/{}, Milliseconds(0)), + look(/*events=*/{}, {ADVANCE_ARROW_READING}, Milliseconds(0)), look({ScreenEvent::FADE_BLACK}, /*readings=*/{}, Milliseconds(1000)), look(/*events=*/{}, /*readings=*/{}, Milliseconds(2000)), look({ScreenEvent::FADE_BLACK}, /*readings=*/{}, Milliseconds(2500)), look(/*events=*/{}, /*readings=*/{}, Milliseconds(3000)), - look({ScreenEvent::DIALOG_BOX}, /*readings=*/{}, Milliseconds(3500)), + look(/*events=*/{}, {ADVANCE_ARROW_READING}, Milliseconds(3500)), look(/*events=*/{}, {MISSION_BANNER_READING}, Milliseconds(4000)), look(/*events=*/{}, {MISSION_BANNER_READING}, Milliseconds(4250)), look(/*events=*/{}, /*readings=*/{}, Milliseconds(4500)), @@ -271,7 +272,7 @@ const RunCase RUN_CASES[] = { }}, .expectation = { .verdict = "done", - .inputs = "press B, wait 250ms, wait 250ms, press B, wait 250ms, wait 250ms, wait 500ms, press +, wait 250ms, wait 500ms", + .inputs = "press A, wait 250ms, wait 250ms, press A, wait 250ms, wait 250ms, wait 500ms, press +, wait 250ms, wait 500ms", .line = "[PlusSkip] 01.01/arrival_scenes pressed -> skipped", }, }, @@ -356,19 +357,33 @@ const RunCase RUN_CASES[] = { { .name = "02.05's ride to 2F: the hall's quiet is control", .input = {.checkpoint = "02.05", .first_step = 4, .steps = 1, .looks = { - look({ScreenEvent::DIALOG_BOX}, /*readings=*/{}, Milliseconds(0)), look(/*events=*/{}, /*readings=*/{}, Milliseconds(1000)), + look(/*events=*/{}, {ADVANCE_ARROW_READING}, Milliseconds(0)), look(/*events=*/{}, /*readings=*/{}, Milliseconds(1000)), look({ScreenEvent::SCREEN_STILL}, /*readings=*/{}, Milliseconds(6000)), }}, .expectation = { .verdict = "done", - .inputs = "press B, wait 500ms", + .inputs = "press A, wait 500ms", + .line = "[PLZA mash_to_move_hints] done: quiet, taken as control.", + }, + }, + { + // Console B 2026-11-19: the letter's box shows no advance arrow. + .name = "03.01's letter after the lobby scene gets A every 2 s until 10 s quiet", + .input = {.checkpoint = "03.01", .first_step = 7, .steps = 1, .looks = { + look(/*events=*/{}, /*readings=*/{}, Milliseconds(0)), look(/*events=*/{}, /*readings=*/{}, Milliseconds(2000)), + look(/*events=*/{}, /*readings=*/{}, Milliseconds(4000)), look(/*events=*/{}, /*readings=*/{}, Milliseconds(6000)), + look({ScreenEvent::SCREEN_STILL}, /*readings=*/{}, Milliseconds(12000)), + }}, + .expectation = { + .verdict = "done", + .inputs = "press A, press A, press A, press A", .line = "[PLZA mash_to_move_hints] done: quiet, taken as control.", }, }, { .name = "02.06 with no autosave badge seen is not saved", .input = {.checkpoint = "02.06", .first_step = 4, .looks = { - look({ScreenEvent::DIALOG_BOX}, /*readings=*/{}, Milliseconds(0)), party_bar(Milliseconds(21000)), party_bar(Milliseconds(22000)), + look(/*events=*/{}, {ADVANCE_ARROW_READING}, Milliseconds(0)), party_bar(Milliseconds(21000)), party_bar(Milliseconds(22000)), }}, .expectation = {.verdict = "done", .line = "[Save] 02.06: not saved (the plan's autosave was not seen)"}, }, @@ -429,13 +444,13 @@ const RunCase RUN_CASES[] = { .name = "03.03's walk off the roof holds its last leg 8000 ms of game time, though a run slice takes less", .input = {.checkpoint = "03.03c", .first_step = 0, .steps = 1, .looks = concat( party_bars(Milliseconds(111), 60), - {look({ScreenEvent::DIALOG_BOX}, /*readings=*/{}, Milliseconds(6700)), look({ScreenEvent::DIALOG_BOX}, /*readings=*/{}, Milliseconds(6800))} + {look(/*events=*/{}, {ADVANCE_ARROW_READING}, Milliseconds(6700)), look(/*events=*/{}, {ADVANCE_ARROW_READING}, Milliseconds(6800))} )}, .expectation = {.verdict = "done"}, }, // Arrow reads from a passing run: 272 out of the gate, 254 after one turn. { - .name = "03.09's walk faces the street first, then walks its legs into Ryon's dialog", + .name = "03.09's walk faces the street first, then walks its legs until Ryon's text takes control", .input = { .checkpoint = "03.09", .first_step = 0, .steps = 1, .looks = concat(std::vector(7, party_bar(Milliseconds(0))), {DIALOG}), @@ -444,8 +459,8 @@ const RunCase RUN_CASES[] = { .expectation = { .verdict = "done", .inputs = "wait 250ms, press L, stick -15deg 150ms walk, release 100ms, press L, stick 0deg 6500ms run, " - "press L, stick -90deg 150ms walk, release 100ms, press L, stick 0deg 250ms run", - .line = "[PLZA] walk: the end event after 250 ms of the last leg.", + "press L, stick -90deg 150ms walk, release 100ms, press L, stick 0deg 250ms run, stick 0deg 250ms run", + .line = "[PLZA] walk: a scene (text waiting for A) took control after 500 ms of the last leg: the walk stops.", }, }, }; @@ -539,23 +554,13 @@ struct LoadCase{ const LoadCase LOAD_CASES[] = { { - .name = "01.02's start: loaded, and off the platform", - .input = {.checkpoint = "01.02", .looks = {CUTSCENE}}, + .name = "01.02's start: loaded, and not checked", + .input = {.checkpoint = "01.02", .looks = {PLATFORM}}, .expectation = { - .verdict = "done", .inputs = "press HOME, wait 300ms, wait 300ms, wait 300ms, wait 300ms", - .line = "[Checkpoint] 01.02: off the station platform; START UNCHECKED: nothing reads this row's own start", + .verdict = "done", .inputs = "press HOME", + .line = "[Checkpoint] 01.02: START UNCHECKED: nothing reads this row's own start", }, }, - { - .name = "01.02's start on the platform is an older save", - .input = {.checkpoint = "01.02", .looks = {PLATFORM}}, - .expectation = {.verdict = "older_save", .inputs = "press HOME, wait 300ms"}, - }, - { - .name = "one platform look is not the platform", - .input = {.checkpoint = "01.02", .looks = {PLATFORM, CUTSCENE, PLATFORM, CUTSCENE}}, - .expectation = {.verdict = "done", .inputs = "press HOME, wait 300ms, wait 300ms, wait 300ms, wait 300ms"}, - }, { .name = "01.01's start is left to its first step's platform check", .input = {.checkpoint = "01.01", .looks = {CUTSCENE}}, @@ -614,47 +619,31 @@ struct ChainCase{ Expectation expectation; }; -const ScreenObservation PLATFORM_SAVING = look({}, {PLATFORM_READING, AUTOSAVE_READING}, Milliseconds(2000)); +const ScreenObservation PLATFORM_SAVING = look({}, {CONTROLS_HINT_READING, AUTOSAVE_READING}, Milliseconds(2000)); const ScreenObservation IN_CONTROL = look({ScreenEvent::PLAYER_CAN_MOVE}); const std::vector ROOF_SAVED = {CUTSCENE, PLATFORM_SAVING, PLATFORM, PLATFORM, PLATFORM, PLATFORM}; -// START_LOOKS looks off the platform, then 01.02's scene. +// 01.02's scene after the reload. const std::vector AFTER_RELOAD = { - CUTSCENE, CUTSCENE, CUTSCENE, CUTSCENE, DIALOG, + DIALOG, look({ScreenEvent::PLAYER_CAN_MOVE}, /*readings=*/{}, Milliseconds(1000)), look({ScreenEvent::PLAYER_CAN_MOVE}, /*readings=*/{}, Milliseconds(3000)), }; const StartSignature STATION_FRONT{.talk_prompt = false, .party = 1}; const ChainCase CHAIN_CASES[] = { { - .name = "autosave seen and the start check does not fail: on without a reload", + .name = "autosave seen: on from the live screen without a reload", .input = {.looks = {CUTSCENE, PLATFORM_SAVING, PLATFORM, PLATFORM, CUTSCENE, CUTSCENE, CUTSCENE, CUTSCENE, choice(0)}}, .expectation = {.verdict = "done", .reloads = 0}, }, { - .name = "autosave seen and the start check fails: reloads the start", - .input = {.looks = { - CUTSCENE, PLATFORM_SAVING, PLATFORM, PLATFORM, PLATFORM, PLATFORM, CUTSCENE, CUTSCENE, CUTSCENE, CUTSCENE, choice(0), - }}, - .expectation = {.verdict = "done", .reloads = 1}, - }, - { - .name = "no autosave seen and the start check fails: no reload, no save to start from", - .input = {.looks = {PLATFORM}}, - .expectation = {.verdict = "failed at 01.02 chain: no_start_save", .reloads = 0}, - }, - { - .name = "a reload onto an older save stops", - .input = {.looks = {CUTSCENE, PLATFORM_SAVING, PLATFORM}}, - .expectation = {.verdict = "failed at 01.02 chain: older_save", .reloads = 1}, - }, - { - .name = "an autosave before the last step does not save the row: no save to reload the next from", + .name = "an autosave before the last step does not save the row", .input = { .looks = {CUTSCENE, PLATFORM_SAVING, PLATFORM, PLATFORM, PLATFORM, PLATFORM}, .first_actions = {"wait_for_platform", "wait_for_platform"}, + .second_action = "wait_for_platform", }, .expectation = { - .verdict = "failed at 01.02 chain: no_start_save", .reloads = 0, + .verdict = "done", .reloads = 0, .line = "[Save] 01.01: not saved (the game autosaved in wait_for_platform, before wait_for_platform_again: a reload would skip wait_for_platform_again)", }, }, diff --git a/SerialPrograms/Source/VideoGames/PokemonLZA/Programs/AutoStory/PokemonLZA_AutoStoryReadings.h b/SerialPrograms/Source/VideoGames/PokemonLZA/Programs/AutoStory/PokemonLZA_AutoStoryReadings.h index 9c8ed19ea9..7e095aab90 100644 --- a/SerialPrograms/Source/VideoGames/PokemonLZA/Programs/AutoStory/PokemonLZA_AutoStoryReadings.h +++ b/SerialPrograms/Source/VideoGames/PokemonLZA/Programs/AutoStory/PokemonLZA_AutoStoryReadings.h @@ -16,13 +16,12 @@ namespace NintendoSwitch{ namespace PokemonLZA{ -// 1: the station platform with free control after the opening cutscene. -constexpr std::string_view PLATFORM_READING = "scene.platform"; // 1: the autosave badge ("Saving...", top right). constexpr std::string_view AUTOSAVE_READING = "scene.autosave"; -// 1: the tutorial's controls hint ("(L) Move"): the player has control. +// 1: the tutorial's controls hint ("(L) Move"): the player has control +// (also on 01.01's station platform, which shows no party bar). constexpr std::string_view CONTROLS_HINT_READING = "scene.controls_hint"; // 1: the advance chevron, at a dialogue box or boxless subtitles. @@ -35,6 +34,10 @@ constexpr std::string_view MISSION_BANNER_READING = "scene.mission_banner"; // MISSION_BANNER_READING. constexpr std::string_view MISSION_COMPLETE_READING = "scene.mission_complete"; +// 1: a white dialogue box (its bottom edge, while the text still types), +// for the "[Signals]" log only: no decision reads it. +constexpr std::string_view SHADOW_DIALOG_BOX_READING = "shadow.dialog_box"; + // A choice box's row count; unset when the rows do not read. constexpr std::string_view CHOICE_ROWS_READING = "choice.rows"; diff --git a/SerialPrograms/Source/VideoGames/PokemonLZA/Programs/AutoStory/PokemonLZA_AutoStorySceneGolden_Tests.cpp b/SerialPrograms/Source/VideoGames/PokemonLZA/Programs/AutoStory/PokemonLZA_AutoStorySceneGolden_Tests.cpp index 0fd909873b..b4caf9374b 100644 --- a/SerialPrograms/Source/VideoGames/PokemonLZA/Programs/AutoStory/PokemonLZA_AutoStorySceneGolden_Tests.cpp +++ b/SerialPrograms/Source/VideoGames/PokemonLZA/Programs/AutoStory/PokemonLZA_AutoStorySceneGolden_Tests.cpp @@ -3,7 +3,6 @@ * From: https://github.com/PokemonAutomation/ * */ -// code-health: allow file_lines -- one golden table for the scene steps, sharing the recorded screens above it /* Golden sequences: a scene step's screens as a console run logged them, * played back through the built-in plan's step by time (the clock moves @@ -58,7 +57,7 @@ Milliseconds seconds_in_log(std::string_view text){ ScreenObservation golden_look(Milliseconds at, std::string_view screen){ const std::pair events[] = { {"black fade", ScreenEvent::FADE_BLACK}, {"white fade", ScreenEvent::FADE_WHITE}, - {"text box", ScreenEvent::DIALOG_BOX}, {"choice box", ScreenEvent::CHOICE_BOX}, + {"choice box", ScreenEvent::CHOICE_BOX}, {"battle", ScreenEvent::BATTLE_STARTED}, {"party bar", ScreenEvent::PLAYER_CAN_MOVE}, {"A prompt", ScreenEvent::INTERACT_PROMPT}, {"still", ScreenEvent::SCREEN_STILL}, }; @@ -100,7 +99,7 @@ struct GoldenScreen{ std::string_view screen; }; -// One per line: "5.9s: text box, advance arrow". +// One per line: "5.9s: party bar, advance arrow". std::vector golden_screens(std::string_view text){ std::vector screens; size_t from = 0; @@ -216,437 +215,7 @@ struct GoldenCase{ Expectation expectation; }; -// 03.02b tepig_battle_start (console B 2026-11-17 23:25): "We're not done -// just yet!", the Type Matchups card, the battle's fade, the HUD. -constexpr std::string_view TEPIG_START = R"( -0.0s: text box, advance arrow -0.4s: text box -0.8s: nothing -1.3s: tutorial card -1.7s: still, tutorial card -2.5s: tutorial card -2.9s: nothing -3.4s: black fade -4.5s: still -4.7s: battle, still -)"; - -// The same start four minutes before (console B 2026-11-17 23:21), the -// camera turned away by the Totodile battle's lock-on recovery: after the -// fade, the battle's effects with no HUD for 22 s, then the party bar. -constexpr std::string_view TEPIG_START_OFF_CAMERA = R"( -0.0s: text box, advance arrow -0.4s: nothing -0.9s: tutorial card -1.7s: still, tutorial card -2.1s: tutorial card -2.6s: nothing -3.1s: black fade -4.1s: nothing -26.6s: party bar -)"; - -// A battle start whose fade a cutscene follows (the screen moving, no -// party bar), as Totodile's start (console B 2026-11-17 23:20) got blind -// ZL and turns ~4 s after its fade; the party bar once it settles. -constexpr std::string_view BATTLE_START_CUTSCENE = R"( -0.0s: text box, advance arrow -0.4s: black fade -1.4s: nothing -20.0s: party bar -)"; - -// 01.02 pancham_cornered, French, passed (console B 2026-11-16 22:45). -// From 35 s on, the text and the screen between its lines took turns. -constexpr std::string_view PANCHAM_FR = R"( -0.0s: still -0.8s: nothing -5.9s: text box -8.3s: text box, advance arrow -8.7s: nothing -10.8s: text box -16.0s: nothing -16.6s: text box, advance arrow -17.0s: nothing -19.5s: text box -19.9s: text box, advance arrow -20.3s: text box -21.5s: nothing -22.0s: text box -24.5s: text box, advance arrow -24.9s: nothing -27.4s: text box -28.6s: nothing -30.7s: text box, advance arrow -31.1s: nothing -33.6s: text box -34.8s: text box, advance arrow -35.2s: nothing -35.7s: text box, advance arrow -36.1s: nothing -36.6s: text box, advance arrow -37.0s: nothing -37.9s: text box, advance arrow -38.3s: nothing -38.7s: text box, advance arrow -39.1s: nothing -39.6s: text box, advance arrow -40.0s: nothing -40.4s: text box, advance arrow -40.8s: nothing -41.2s: text box, advance arrow -41.6s: nothing -42.2s: text box, advance arrow -42.6s: nothing -43.0s: text box, advance arrow -43.4s: nothing -44.4s: text box, advance arrow -44.8s: nothing -45.2s: text box, advance arrow -45.6s: nothing -46.5s: text box -48.2s: nothing -48.7s: text box -49.1s: nothing -49.5s: text box -49.9s: nothing -50.3s: text box -50.7s: text box, advance arrow -51.1s: nothing -51.6s: text box -53.3s: nothing -55.3s: text box -55.7s: nothing -56.1s: text box -56.5s: text box, advance arrow -56.9s: text box -58.5s: text box, choice box -)"; - -// 03.01 lobby_scene up to Alton's first choice (console B 2026-11-17 -// 00:12, German): B for the text then, one in flight as the choice -// opened. The run went on to loop on his choice; here the screen stays -// quiet after it, as once he has his answer. -constexpr std::string_view LOBBY_ALTON_DE = R"( -0.0s: nothing -0.5s: black fade -6.7s: still -7.4s: nothing -13.0s: text box, advance arrow -13.4s: nothing -14.5s: text box, advance arrow -14.9s: nothing -16.9s: text box -19.0s: text box, advance arrow -19.4s: text box -19.9s: text box, choice box, 2 rows, row 0 -20.3s: nothing -)"; - const GoldenCase GOLDEN_CASES[] = { - { - .name = "03.11 leave_mable, a bare scene through Mable's menus (passed 2026-11-16 21:40)", - .input = {.checkpoint = "03.11", .step = "leave_mable", .screens = R"( -0.0s: text box, still -0.4s: nothing -1.6s: text box -2.0s: nothing -2.9s: black fade -5.9s: still -6.3s: text box -9.2s: nothing -9.6s: text box -11.7s: text box, advance arrow -12.1s: text box -19.4s: nothing -19.8s: black fade -22.9s: still -23.3s: party bar -)"}, - .expectation = { - .keys = { - {"text box", "B"}, {"text box, still", "B"}, {"text box, advance arrow", "B"}, - // Her mission and reward menus: only B closes them. - {"nothing", "B"}, {"still", "B"}, - {"black fade", "-"}, - {"party bar", "-"}, - }, - .verdict = "done", .end = "[PLZA scene] done on can_move.", - }, - }, - { - .name = "03.04 pokedex_app, the nurse and the Pokedex app (passed 2026-11-16 03:51)", - .input = {.checkpoint = "03.04", .step = "pokedex_app", .screens = R"( -0.0s: still -0.4s: text box -0.8s: text box, advance arrow -1.2s: text box -7.3s: nothing -7.7s: text box -10.6s: text box, advance arrow -11.4s: nothing -21.2s: text box, advance arrow -21.6s: nothing -25.0s: text box -28.3s: nothing -32.1s: white fade -33.4s: nothing -36.3s: text box -36.7s: nothing -38.2s: text box -38.6s: nothing -45.4s: tutorial card -46.2s: still, tutorial card -46.6s: nothing -50.0s: text box -50.8s: text box, advance arrow -51.2s: text box -54.0s: nothing -55.5s: black fade -57.0s: still -57.4s: nothing -57.9s: text box -59.5s: text box, advance arrow -59.9s: text box -61.2s: nothing -64.5s: black fade -66.8s: still -67.2s: party bar -)"}, - .expectation = { - .keys = { - {"text box", "B"}, {"text box, advance arrow", "B"}, - // The Pokedex screens: only B closes them. - {"nothing", "- or B"}, {"still", "- or B"}, - {"tutorial card", "A"}, {"still, tutorial card", "A"}, - {"white fade", "-"}, {"black fade", "-"}, - {"party bar", "-"}, - }, - .verdict = "done", .end = "[PLZA talk_to_pokedex_screen] done on can_move.", - }, - }, - { - .name = "01.03 andi_battle_start, Andi's talk to the battle HUD (passed 2026-11-16 22:51)", - .input = {.checkpoint = "01.03", .step = "andi_battle_start", .screens = R"( -0.0s: text box, still, advance arrow -0.4s: nothing -2.4s: text box -3.6s: text box, advance arrow -4.1s: nothing -5.6s: text box -6.8s: nothing -7.3s: text box -9.0s: text box, advance arrow -9.4s: nothing -10.4s: text box -12.9s: nothing -16.9s: text box -18.6s: text box, advance arrow -19.5s: black fade -25.6s: still -26.6s: still, advance arrow -27.0s: advance arrow -27.8s: nothing -38.5s: battle, controls hint -)"}, - .expectation = { - .keys = { - // A: the talk ends in the battle, with no prompt to restart. - {"text box", "A"}, {"text box, still, advance arrow", "A"}, {"text box, advance arrow", "A"}, - // The VS splash's subtitles show only the chevron. - {"still, advance arrow", "A"}, {"advance arrow", "A"}, - {"nothing", "- or +"}, {"still", "-"}, {"black fade", "-"}, - {"battle, controls hint", "-"}, - }, - .verdict = "done", .end = "[PLZA story_battle_start] done on battle.", - }, - }, - { - .name = "03.02b tepig_battle_start, the battle HUD right after the battle's fade (passed 2026-11-17 23:25)", - .input = {.checkpoint = "03.02b", .step = "tepig_battle_start", .screens = TEPIG_START}, - .expectation = { - .keys = { - {"text box, advance arrow", "A"}, {"text box", "A"}, - {"tutorial card", "A"}, {"still, tutorial card", "A"}, - // No lock-on: the HUD shows within 3 s of the fade. - {"nothing", "-"}, {"black fade", "-"}, {"still", "-"}, - {"battle, still", "-"}, - }, - .verdict = "done", .end = "[PLZA story_battle_start] done on battle.", - }, - }, - { - // The battle ran off camera, with no HUD until locked on. - .name = "03.02b tepig_battle_start, the party bar a second after the battle's fade: ZL, the move symbols lock on (failed 2026-11-17 23:21)", - .input = {.checkpoint = "03.02b", .step = "tepig_battle_start", .screens = TEPIG_START_OFF_CAMERA, .symbols_from_watch = 1}, - .expectation = { - .keys = { - {"text box, advance arrow", "A"}, - {"tutorial card", "A"}, {"still, tutorial card", "A"}, - {"nothing", "-"}, {"black fade", "-"}, - {"party bar", "ZL"}, - }, - .verdict = "done", .end = "[PLZA story_battle_start] done on locked_on.", - }, - }, - { - .name = "03.02b tepig_battle_start, the opponent behind the camera: no move symbols, a turn, L and ZL again", - .input = { - .checkpoint = "03.02b", .step = "tepig_battle_start", .screens = TEPIG_START_OFF_CAMERA, .symbols_from_watch = 2, - }, - .expectation = { - .keys = { - {"text box, advance arrow", "A"}, - {"tutorial card", "A"}, {"still, tutorial card", "A"}, - {"nothing", "-"}, {"black fade", "-"}, - {"party bar", "ZL or stick or L"}, - }, - .verdict = "done", .end = "[PLZA story_battle_start] lock-on 2/5: turned 90 degrees right, L, ZL held: the move symbols showed.", - }, - }, - { - .name = "03.02b taunie_battle_start, a cutscene after the battle's fade: no ZL until it settles", - .input = {.checkpoint = "03.02b", .step = "taunie_battle_start", .screens = BATTLE_START_CUTSCENE, .symbols_from_watch = 1}, - .expectation = { - .keys = { - {"text box, advance arrow", "A"}, {"black fade", "-"}, - {"nothing", "-"}, - {"party bar", "ZL"}, - }, - .verdict = "done", .end = "[PLZA story_battle_start] done on locked_on.", - }, - }, - { - .name = "02.05 floor_question, the elevator's talk with A to its choice (passed 2026-11-16 23:50)", - .input = {.checkpoint = "02.05", .step = "floor_question", .screens = R"( -0.0s: black fade, still -1.3s: still -2.1s: text box, still, advance arrow -2.5s: nothing -3.0s: text box, advance arrow -3.4s: nothing -3.9s: text box, choice box -)"}, - .expectation = { - .keys = { - // B would close the elevator's talk. - {"text box, still, advance arrow", "A"}, {"text box, advance arrow", "A"}, - {"black fade, still", "-"}, {"still", "-"}, {"nothing", "-"}, - {"text box, choice box", "-"}, - }, - .verdict = "done", .end = "[PLZA text_to_choice] done on choice.", - }, - }, - { - .name = "01.02 pancham_cornered, French, B to Pancham's choice (passed 2026-11-16 22:45)", - .input = {.checkpoint = "01.02", .step = "pancham_cornered", .screens = PANCHAM_FR}, - .expectation = { - .keys = { - // B: an A as the text ends could land on the choice. - {"text box", "B"}, {"text box, advance arrow", "B"}, - {"still", "-"}, {"nothing", "- or +"}, - {"text box, choice box", "-"}, - }, - .verdict = "done", .end = "[PLZA text_to_choice] done on choice.", - }, - }, - { - .name = "01.02 battle_area, French, to Ryon's A prompt (passed 2026-11-16 22:46)", - .input = {.checkpoint = "01.02", .step = "battle_area", .screens = R"( -0.0s: text box -2.0s: nothing -2.6s: text box -5.1s: text box, advance arrow -5.5s: text box -6.7s: nothing -8.2s: black fade -13.8s: still -14.4s: nothing -14.9s: A prompt -)"}, - .expectation = { - .keys = { - // B: an A on the closing box restarts the talk. - {"text box", "B"}, {"text box, advance arrow", "B"}, - {"nothing", "-"}, {"still", "-"}, {"black fade", "-"}, - // No A: it restarts Ryon's talk. - {"A prompt", "-"}, - }, - .verdict = "done", .end = "[PLZA mash_to_move_hints] done on talk_prompt.", - }, - }, - { - .name = "03.05 heal_party, the nurse's talk to control (passed 2026-11-16 06:59)", - .input = {.checkpoint = "03.05", .step = "heal_party", .screens = R"( -0.0s: still -0.3s: text box, still -0.7s: text box -2.3s: nothing -2.8s: text box -4.2s: party bar -4.7s: party bar, A prompt -)"}, - .expectation = { - .keys = { - // B: an A on her closing box restarts her talk. - {"text box", "B"}, {"text box, still", "B"}, - {"still", "-"}, {"nothing", "-"}, - {"party bar", "-"}, {"party bar, A prompt", "-"}, - }, - .verdict = "done", .end = "[PLZA scene] done on can_move.", - }, - }, - { - .name = "03.01 lobby_scene, German, A on the text as Alton's choice opens (B in flight picked his cancel row, 2026-11-17 00:12)", - .input = {.checkpoint = "03.01", .step = "lobby_scene", .screens = LOBBY_ALTON_DE}, - .expectation = { - .keys = { - // A B landing as the choice opens would take its last row. - {"text box", "A"}, {"text box, advance arrow", "A"}, - {"text box, choice box, 2 rows, row 0", "A"}, - {"nothing", "- or +"}, {"still", "-"}, {"black fade", "-"}, - }, - .verdict = "done", .end = "[PLZA mash_to_move_hints] done: quiet, taken as control.", - }, - }, - { - .name = "03.06 wild_zones_tutorial, French, B through the text and A on the card to control (passed 2026-11-17 14:28)", - .input = {.checkpoint = "03.06", .step = "wild_zones_tutorial", .screens = R"( -0.0s: still -0.3s: black fade, still -1.0s: still -2.1s: text box, still -2.5s: text box -2.9s: text box, advance arrow -3.3s: text box -3.7s: nothing -5.7s: text box -7.0s: text box, advance arrow -7.4s: text box -9.0s: nothing -11.0s: text box -11.8s: text box, advance arrow -14.9s: tutorial card -15.3s: still, tutorial card -16.1s: nothing -16.6s: text box -18.3s: text box, advance arrow -18.7s: nothing -19.2s: black fade -21.5s: still -22.0s: party bar, still -22.2s: party bar -)"}, - .expectation = { - .keys = { - {"text box", "B"}, {"text box, still", "B"}, {"text box, advance arrow", "B"}, - {"tutorial card", "A"}, {"still, tutorial card", "A"}, - {"nothing", "-"}, {"still", "-"}, {"black fade", "-"}, {"black fade, still", "-"}, - {"party bar", "-"}, {"party bar, still", "-"}, - }, - .verdict = "done", .end = "[PLZA scene] done on can_move.", - }, - }, { .name = "03.06 wild_zones_tutorial, the HUD 45 s and no scene: not at its trigger (failed 2026-11-16 21:03)", .input = {.checkpoint = "03.06", .step = "wild_zones_tutorial", .screens = R"( @@ -663,60 +232,6 @@ const GoldenCase GOLDEN_CASES[] = { "the A prompt or the mission banner).", }, }, - { - .name = "03.07 after_catches, French, A on the subtitles' chevron, B on the text box, to control (passed 2026-11-17 14:31)", - .input = {.checkpoint = "03.07", .step = "after_catches", .screens = R"( -0.0s: text box, advance arrow -0.4s: nothing -1.9s: advance arrow -2.4s: nothing -2.9s: text box -3.7s: text box, advance arrow -4.1s: nothing -4.6s: text box -10.1s: black fade -12.2s: still -12.5s: nothing -13.0s: party bar, A prompt, controls hint -)"}, - .expectation = { - .keys = { - // B: an A on the closing box restarts the talk. - {"text box", "B"}, {"text box, advance arrow", "B"}, - // A subtitle with no box. - {"advance arrow", "A"}, - {"nothing", "-"}, {"still", "-"}, {"black fade", "-"}, - {"party bar, A prompt, controls hint", "-"}, - }, - .verdict = "done", .end = "[PLZA mash_to_move_hints] done on can_move.", - }, - }, - { - .name = "03.09 research_lab_gate, French, Ryon's scene to control (passed 2026-11-17 14:34)", - .input = {.checkpoint = "03.09", .step = "research_lab_gate", .screens = R"( -0.0s: black fade, still -1.3s: nothing -7.4s: text box -8.6s: text box, advance arrow -9.0s: nothing -14.1s: text box -17.8s: nothing -20.8s: advance arrow -21.2s: nothing -25.3s: black fade -27.3s: still -27.8s: party bar, still -28.1s: party bar -)"}, - .expectation = { - .keys = { - {"text box", "B"}, {"text box, advance arrow", "B"}, {"advance arrow", "A"}, - {"nothing", "- or +"}, {"still", "-"}, {"black fade", "-"}, {"black fade, still", "-"}, - {"party bar", "-"}, {"party bar, still", "-"}, - }, - .verdict = "done", .end = "[PLZA scene] done on can_move.", - }, - }, { .name = "03.09 research_lab_gate, the party bar and an A prompt 45 s and no scene (failed 2026-11-16 21:34)", .input = {.checkpoint = "03.09", .step = "research_lab_gate", .screens = R"( @@ -730,32 +245,6 @@ const GoldenCase GOLDEN_CASES[] = { "the A prompt or the mission banner).", }, }, - { - .name = "03.10 arrive_3f, French, a bare scene off the elevator to control (passed 2026-11-17 14:35)", - .input = {.checkpoint = "03.10", .step = "arrive_3f", .screens = R"( -0.0s: nothing -0.8s: black fade -5.4s: still -5.8s: nothing -6.6s: text box, advance arrow -7.0s: nothing -10.7s: text box -14.0s: text box, advance arrow -14.4s: text box -16.0s: nothing -17.2s: black fade -18.8s: still -19.2s: party bar -)"}, - .expectation = { - .keys = { - {"text box", "B"}, {"text box, advance arrow", "B"}, - {"nothing", "B or +"}, {"still", "B"}, - {"black fade", "-"}, {"party bar", "-"}, - }, - .verdict = "done", .end = "[PLZA scene] done on can_move.", - }, - }, { .name = "03.04 into_pokemon_center, a timed walk whose last turn faces the nurse's A prompt (passed 2026-11-17 14:26)", .input = {.checkpoint = "03.04", .step = "into_pokemon_center", .screens = R"( @@ -857,105 +346,6 @@ const GoldenCase GOLDEN_CASES[] = { "within 10 s", }, }, - { - // heal_party's screens start where the talk hands over (3.5 s). - .name = "03.05 whole checkpoint: the walk to the nurse, the talk, her heal to control (passed 2026-11-17 14:27)", - .input = {.checkpoint = "03.05", .step = "", .screens = R"( -0.0s: party bar -2.6s: party bar, A prompt -3.5s: text box, still -3.9s: text box -4.7s: text box, advance arrow -5.1s: text box -6.0s: nothing -6.5s: text box, advance arrow -6.9s: nothing -7.9s: party bar -8.4s: party bar, A prompt -)"}, - .expectation = { - .keys = { - {"party bar", "L or stick or hold"}, {"party bar, A prompt", "A"}, - {"text box", "B"}, {"text box, still", "B"}, {"text box, advance arrow", "B"}, - {"nothing", "-"}, - }, - .verdict = "done", .end = "[PLZA scene] done on can_move.", - }, - }, - { - // From the black fade on; the controls hint at the end is synthetic. - .name = "01.01 arrival_scenes, Italian, Jacinthe's subtitles each after a quiet spell, then the controls hint (stopped as a loop 2026-11-15 22:27)", - .input = {.checkpoint = "01.01", .step = "arrival_scenes", .screens = R"( -0.0s: black fade -2.4s: nothing -3.9s: still -5.6s: nothing -12.5s: advance arrow -12.9s: nothing -13.8s: text box -14.3s: nothing -24.4s: advance arrow -24.8s: nothing -34.2s: advance arrow -34.7s: nothing -39.7s: advance arrow -40.6s: controls hint -)"}, - .expectation = { - .keys = { - {"text box", "B"}, {"advance arrow", "A"}, - // Plus once the cutscene, moving then still, has run 3 s. - {"nothing", "- or +"}, {"still", "- or +"}, {"black fade", "-"}, {"controls hint", "-"}, - }, - .verdict = "done", .end = "[PLZA mash_to_move_hints] done on controls_hint.", - }, - }, - { - // The controls hint is synthetic. Console B 2026-11-19 held such - // stills 5-10 s with no Plus. - .name = "01.01 arrival_scenes, a cutscene still 3 s after the text gets Plus", - .input = {.checkpoint = "01.01", .step = "arrival_scenes", .screens = R"( -0.0s: text box -0.4s: nothing -1.0s: still -8.0s: text box -9.0s: controls hint -)"}, - .expectation = { - .keys = {{"text box", "B"}, {"nothing", "-"}, {"still", "+"}, {"controls hint", "-"}}, - .verdict = "done", .end = "[PLZA mash_to_move_hints] done on controls_hint.", - }, - }, - { - .name = "01.02 battle_area, Italian, the A Parla prompt past 20 s ends the step (A there restarted the talk 2026-11-15 21:56)", - .input = {.checkpoint = "01.02", .step = "battle_area", .screens = R"( -0.0s: text box -1.2s: text box, advance arrow -1.7s: nothing -2.2s: text box -3.0s: text box, advance arrow -3.4s: nothing -3.7s: text box -5.6s: nothing -7.1s: black fade -12.8s: still -13.2s: nothing -13.7s: A prompt -15.7s: nothing -16.2s: text box -17.0s: text box, advance arrow -17.4s: nothing -18.4s: A prompt -22.4s: nothing -)"}, - .expectation = { - .keys = { - {"text box", "B"}, {"text box, advance arrow", "B"}, - {"nothing", "- or +"}, {"still", "-"}, {"black fade", "-"}, {"A prompt", "-"}, - }, - .verdict = "done", .end = "[PLZA mash_to_move_hints] done on talk_prompt.", - }, - }, { // The controls hint after the cutscene is synthetic. .name = "02.02 street_scene, English, a textless cutscene past the start window, then the controls hint (failed as scene_never_started 2026-11-15 23:23)", diff --git a/SerialPrograms/Source/VideoGames/PokemonLZA/Programs/AutoStory/PokemonLZA_AutoStorySceneMachine.cpp b/SerialPrograms/Source/VideoGames/PokemonLZA/Programs/AutoStory/PokemonLZA_AutoStorySceneMachine.cpp index 2581732d44..cd7dfc5428 100644 --- a/SerialPrograms/Source/VideoGames/PokemonLZA/Programs/AutoStory/PokemonLZA_AutoStorySceneMachine.cpp +++ b/SerialPrograms/Source/VideoGames/PokemonLZA/Programs/AutoStory/PokemonLZA_AutoStorySceneMachine.cpp @@ -28,6 +28,7 @@ #include "PokemonLZA_AutoStoryMenuReadings.h" #include "PokemonLZA_AutoStoryReadings.h" #include "PokemonLZA_AutoStorySceneMachine.h" +#include "PokemonLZA_AutoStorySignalProbe.h" namespace PokemonAutomation{ namespace NintendoSwitch{ @@ -42,7 +43,9 @@ namespace{ // Held this long is free control (two looks or more); the party bar also // shows between a scene's lines, and A on a prompt restarts the talk (01.02). constexpr Milliseconds CONTROLS_HINT_HOLD = 1s; -constexpr Milliseconds PARTY_BAR_HOLD = 1s; +// Twice the < 1 s a line types at fast speed: the party bar shows under +// the typing text, with no advance arrow yet. +constexpr Milliseconds PARTY_BAR_HOLD = 2s; constexpr Milliseconds PROMPT_HOLD = 1s; // With stop_at_battle or stop_at_choice, the party bar this long with // nothing busy is the scene over with no battle or choice. @@ -253,8 +256,8 @@ bool idle_screen(SceneScreen screen){ bool busy(const ScreenObservation& look){ - return text_shows(look) || fade_shows(look) || look.readings.contains(MISSION_COMPLETE_READING) || - look.readings.contains(TUTORIAL_CARD_READING); + return text_shows(look) || fade_shows(look) || look.events.has(ScreenEvent::CHOICE_BOX) || + look.readings.contains(MISSION_COMPLETE_READING) || look.readings.contains(TUTORIAL_CARD_READING); } bool scene_shows(const ScreenObservation& look){ @@ -275,9 +278,10 @@ bool control_prompt_shows(const SceneMachineConfig& config, const ScreenObservat return party_bar_is_control(config) && look.events.has(ScreenEvent::INTERACT_PROMPT); } -// On a closing box B does nothing, where A restarts the talk (03.05's nurse). +// B where the party bar shows (an overworld talk): on a closing box B does +// nothing, where A restarts the talk (03.05's nurse). Button default_text_button(const SceneMachineConfig& config, const ScreenObservation& look){ - return party_bar_is_control(config) && look.events.has(ScreenEvent::DIALOG_BOX) ? BUTTON_B : BUTTON_A; + return party_bar_is_control(config) && look.events.has(ScreenEvent::PLAYER_CAN_MOVE) ? BUTTON_B : BUTTON_A; } Button dialog_button(const SceneMachineConfig& config, const ScreenObservation& look){ @@ -488,7 +492,7 @@ SceneScreen SceneTimeline::classify(const ScreenObservation& look) const{ if (m_config.stop_at_choice && look.events.has(ScreenEvent::CHOICE_BOX)){ return SceneScreen::CHOICE; } - if (text_shows(look)){ + if (text_shows(look) || look.events.has(ScreenEvent::CHOICE_BOX)){ return SceneScreen::DIALOG; } if (look.readings.contains(MAP_READING)){ @@ -703,17 +707,16 @@ void SceneTimeline::record_control(const ScreenObservation& look){ m_scene.last_busy = look.when; } m_scene.seen = m_scene.seen || scene_under_way(look); - const bool box = look.events.has(ScreenEvent::DIALOG_BOX); + const bool text = text_shows(look); track_since(party_bar_is_control(m_config) && party_bar_free(look), look.when, m_control.party_bar_since); const bool control_instead = !party_bar_is_control(m_config) && look.events.has(ScreenEvent::PLAYER_CAN_MOVE) && !busy(look); track_since(control_instead, look.when, m_control.party_bar_instead_since); - track_since(look.readings.contains(CONTROLS_HINT_READING) && !box, look.when, m_control.hint_since); - track_since(control_prompt_shows(m_config, look) && !box, look.when, m_control.prompt_since); + track_since(look.readings.contains(CONTROLS_HINT_READING) && !text, look.when, m_control.hint_since); + track_since(control_prompt_shows(m_config, look) && !text, look.when, m_control.prompt_since); } void SceneTimeline::record_banner(const ScreenObservation& look){ - const bool box = look.events.has(ScreenEvent::DIALOG_BOX); - m_banner.looks = look.readings.contains(MISSION_BANNER_READING) && !box ? m_banner.looks + 1 : 0; + m_banner.looks = look.readings.contains(MISSION_BANNER_READING) && !text_shows(look) ? m_banner.looks + 1 : 0; m_banner.seen = m_banner.seen || m_banner.looks > 0; track_since(m_banner.looks > 0, look.when, m_banner.since); if (!m_banner.since){ @@ -733,7 +736,7 @@ void SceneTimeline::record_black_fades(const ScreenObservation& look){ std::string describe_look(const ScreenObservation& look){ const std::pair events[] = { {ScreenEvent::FADE_BLACK, "black fade"}, {ScreenEvent::FADE_WHITE, "white fade"}, - {ScreenEvent::DIALOG_BOX, "text box"}, {ScreenEvent::CHOICE_BOX, "choice box"}, + {ScreenEvent::CHOICE_BOX, "choice box"}, {ScreenEvent::BATTLE_STARTED, "battle"}, {ScreenEvent::PLAYER_CAN_MOVE, "party bar"}, {ScreenEvent::INTERACT_PROMPT, "A prompt"}, {ScreenEvent::SCREEN_STILL, "still"}, }; @@ -963,6 +966,10 @@ class SceneRunner{ const SceneTimeline& timeline() const{ return m_timeline; } + // Since the last press. + const SignalProbe& signals() const{ + return m_signals; + } // A Plus press still waiting for its outcome did nothing. void finish(); void act(SceneScreen screen, const ScreenObservation& look); @@ -971,6 +978,8 @@ class SceneRunner{ void perform(SceneAction action, const ScreenObservation& look); void wait(SceneAction action); void log_fields_fired(SceneScreen screen, const ScreenObservation& look); + // "[Signals] text_A|text_B by=arrow ...", not for a choice. + void log_text_press(Button button, const ScreenObservation& look); void log_skip(std::string_view outcome); // Before all but the first, a quarter turn and L put the camera behind // the player (the backend has no camera stick). @@ -983,6 +992,7 @@ class SceneRunner{ std::string m_step; std::set m_fields_logged; std::optional m_skip_pressed; + SignalProbe m_signals; }; SceneRunner::SceneRunner(PlzaBackend& backend, std::string_view label, const SceneMachineConfig& config, WallClock start, std::string_view step) @@ -1009,12 +1019,16 @@ void SceneRunner::act(SceneScreen screen, const ScreenObservation& look){ } } m_timeline.record(look); + m_signals.look(look); std::string readings = describe_look(look); if (screen == SceneScreen::FADE_BLACK){ readings = std::format("{}, {}", readings, m_timeline.black_fade_count()); } m_log.look(screen, readings, look.when, action_presses(action)); perform(action, look); + if (action_presses(action)){ + m_signals.restart(); + } } void SceneRunner::perform(SceneAction action, const ScreenObservation& look){ @@ -1027,9 +1041,12 @@ void SceneRunner::perform(SceneAction action, const ScreenObservation& look){ case SceneAction::PRESS_B: m_backend.press(BUTTON_B, PRESS_HOLD, PRESS_RELEASE); return; - case SceneAction::PRESS_TEXT: - m_backend.press(text_button(m_log, m_config, look), PRESS_HOLD, PRESS_RELEASE); + case SceneAction::PRESS_TEXT:{ + const Button button = text_button(m_log, m_config, look); + log_text_press(button, look); + m_backend.press(button, PRESS_HOLD, PRESS_RELEASE); return; + } case SceneAction::PRESS_BLIND: m_backend.press(m_config.blind_button, PRESS_HOLD, PRESS_RELEASE); return; @@ -1076,6 +1093,13 @@ void SceneRunner::log_fields_fired(SceneScreen screen, const ScreenObservation& } } +void SceneRunner::log_text_press(Button button, const ScreenObservation& look){ + if (!look.events.has(ScreenEvent::CHOICE_BOX)){ + // Not through m_log: its detail() would cut the look counts short. + m_backend.log_detail(m_signals.line(m_step, button == BUTTON_B ? "text_B" : "text_A", /*by=*/"arrow")); + } +} + void SceneRunner::log_skip(std::string_view outcome){ m_skip_pressed.reset(); m_log.detail(std::format("[PlusSkip] {} pressed -> {}", m_step, outcome)); @@ -1143,6 +1167,24 @@ void wait_banner_gone(PlzaBackend& backend, std::string_view label){ backend.log(std::format("[PLZA {}] the mission banner still shows after {} A presses; going on.", label, BANNER_PRESSES)); } +// The signal that ended the machine on `terminal`, for its "[Signals]" line. +std::string_view end_signal(SceneScreen terminal){ + switch (terminal){ + case SceneScreen::CAN_MOVE: + return "party_bar"; + case SceneScreen::CONTROLS_HINT: + return "hint"; + case SceneScreen::TALK_PROMPT: + return "prompt"; + case SceneScreen::MISSION_BANNER: + return "banner"; + case SceneScreen::QUIET_END: + return "quiet"; + default: + return scene_screen_name(terminal); + } +} + // The failure a terminal screen stands for, if any. std::optional terminal_failure( std::string_view label, const SceneMachineConfig& config, SceneScreen terminal, std::string_view expected @@ -1199,7 +1241,7 @@ std::string describe_scene_look(const ScreenObservation& look){ } bool text_shows(const ScreenObservation& look){ - return look.events.has(ScreenEvent::DIALOG_BOX) || look.readings.contains(ADVANCE_ARROW_READING); + return look.readings.contains(ADVANCE_ARROW_READING); } bool fade_shows(const ScreenObservation& look){ @@ -1207,7 +1249,7 @@ bool fade_shows(const ScreenObservation& look){ } bool party_bar_free(const ScreenObservation& look){ - return look.events.has(ScreenEvent::PLAYER_CAN_MOVE) && !look.events.has(ScreenEvent::DIALOG_BOX); + return look.events.has(ScreenEvent::PLAYER_CAN_MOVE) && !busy(look); } bool scene_under_way(const ScreenObservation& look){ @@ -1237,6 +1279,10 @@ std::optional run_scene_machine( }; const ScreenMachineResult result = run_screen_machine(observe, backend.scope(), scene_states(look, runner), timeout, /*log=*/nullptr); runner.finish(); + if (const ScreenMachineTerminal* terminal = std::get_if(&result)){ + const SceneScreen screen = scene_screen_names().get_enum(terminal->state_name); + backend.log_detail(runner.signals().line(step, "scene_end", end_signal(screen))); + } if (config.end_after_black_fades){ backend.log(std::format( "[PLZA {}] the mission banner {}.", label, runner.timeline().banner_seen() ? "showed" : "did not show (the detector may have missed it)" diff --git a/SerialPrograms/Source/VideoGames/PokemonLZA/Programs/AutoStory/PokemonLZA_AutoStorySceneMachine.h b/SerialPrograms/Source/VideoGames/PokemonLZA/Programs/AutoStory/PokemonLZA_AutoStorySceneMachine.h index 6af23cecb5..b73e90a78c 100644 --- a/SerialPrograms/Source/VideoGames/PokemonLZA/Programs/AutoStory/PokemonLZA_AutoStorySceneMachine.h +++ b/SerialPrograms/Source/VideoGames/PokemonLZA/Programs/AutoStory/PokemonLZA_AutoStorySceneMachine.h @@ -77,13 +77,14 @@ struct SceneMachineConfig{ // moving screen (a cutscene can play a minute with no text). bool scene_under_way(const ScreenObservation& look); -// A text box, or the advance chevron without one. +// Text waiting for A: the advance chevron, with or without a box. bool text_shows(const ScreenObservation& look); // A black or a white fade. bool fade_shows(const ScreenObservation& look); -// The party bar with no text box over it (it shows between a talk's lines too). +// The party bar with nothing busy over it: no advance arrow, fade or choice +// (it shows under a talk's lines too). bool party_bar_free(const ScreenObservation& look); // "text box, advance arrow": `look`'s events and readings; "nothing" for none. diff --git a/SerialPrograms/Source/VideoGames/PokemonLZA/Programs/AutoStory/PokemonLZA_AutoStoryScreenEvents.cpp b/SerialPrograms/Source/VideoGames/PokemonLZA/Programs/AutoStory/PokemonLZA_AutoStoryScreenEvents.cpp index 50062c4f1a..918b695143 100644 --- a/SerialPrograms/Source/VideoGames/PokemonLZA/Programs/AutoStory/PokemonLZA_AutoStoryScreenEvents.cpp +++ b/SerialPrograms/Source/VideoGames/PokemonLZA/Programs/AutoStory/PokemonLZA_AutoStoryScreenEvents.cpp @@ -27,8 +27,7 @@ const ImageFloatBox BATTLE_HINT_BOX{0.40, 0.84, 0.20, 0.10}; PlzaScreenObserver::PlzaScreenObserver() - : m_dialog({.white = WhiteDialogPart::BOX_ONLY}) - , m_choice_arrow(COLOR_YELLOW, nullptr, SelectionArrowType::RIGHT, dialog_choice_box()) + : m_choice_arrow(COLOR_YELLOW, nullptr, SelectionArrowType::RIGHT, dialog_choice_box()) , m_interact(COLOR_RED, ButtonType::ButtonA, INTERACT_PROMPT_BOX) , m_battle_hint(COLOR_CYAN, ButtonType::ButtonA, BATTLE_HINT_BOX) , m_battle_panel(COLOR_GREEN) @@ -48,17 +47,14 @@ ScreenEvents PlzaScreenObserver::read(const ImageViewRGB32& screen){ if (fade_in(out) != WarpFade::NONE){ return out; } - const bool box = m_dialog.detect(screen); - out.set(ScreenEvent::DIALOG_BOX, box); out.set(ScreenEvent::CHOICE_BOX, m_choice_arrow.detect(screen)); - out.set(ScreenEvent::INTERACT_PROMPT, !box && m_interact.detect(screen)); + out.set(ScreenEvent::INTERACT_PROMPT, m_interact.detect(screen)); out.set(ScreenEvent::BATTLE_STARTED, m_battle_hint.detect(screen) || (m_battle_panel.detect(screen) && m_battle_markers.detect(screen))); - out.set(ScreenEvent::PLAYER_CAN_MOVE, !box && m_party.detect(screen)); + out.set(ScreenEvent::PLAYER_CAN_MOVE, m_party.detect(screen)); return out; } void PlzaScreenObserver::make_overlays(VideoOverlaySet& items) const{ - m_dialog.make_overlays(items); m_choice_arrow.make_overlays(items); m_interact.make_overlays(items); m_battle_hint.make_overlays(items); diff --git a/SerialPrograms/Source/VideoGames/PokemonLZA/Programs/AutoStory/PokemonLZA_AutoStoryScreenEvents.h b/SerialPrograms/Source/VideoGames/PokemonLZA/Programs/AutoStory/PokemonLZA_AutoStoryScreenEvents.h index 3209db4554..262e4670dd 100644 --- a/SerialPrograms/Source/VideoGames/PokemonLZA/Programs/AutoStory/PokemonLZA_AutoStoryScreenEvents.h +++ b/SerialPrograms/Source/VideoGames/PokemonLZA/Programs/AutoStory/PokemonLZA_AutoStoryScreenEvents.h @@ -17,17 +17,17 @@ #include "VideoGames/PokemonLZA/Inference/PokemonLZA_SelectionArrowDetector.h" #include "VideoGames/PokemonLZA/Programs/AutoStory/Detectors/PokemonLZA_AutoStoryBattleMarkersDetector.h" #include "VideoGames/PokemonLZA/Programs/AutoStory/Detectors/PokemonLZA_AutoStoryBattlePanelDetector.h" -#include "VideoGames/PokemonLZA/Programs/AutoStory/Detectors/PokemonLZA_AutoStoryDialogDetector.h" namespace PokemonAutomation{ namespace NintendoSwitch{ namespace PokemonLZA{ -// The shared events from PLZA's detectors. DIALOG_BOX shows while the text -// still types. BATTLE_STARTED is the HUD's hints (only while locked on) or -// the player's panel with the battle markers (the panel alone shows all -// through a wild zone); story battles show no Run prompt. +// The shared events from PLZA's detectors. No DIALOG_BOX: text is the +// backend's advance arrow reading, and PLAYER_CAN_MOVE (the party bar) +// also shows under a talk's text. BATTLE_STARTED is the HUD's hints (only +// while locked on) or the player's panel with the battle markers (the panel +// alone shows all through a wild zone); story battles show no Run prompt. class PlzaScreenObserver : public ScreenEventObserver{ public: PlzaScreenObserver(); @@ -40,7 +40,6 @@ class PlzaScreenObserver : public ScreenEventObserver{ virtual void make_overlays(VideoOverlaySet& items) const override; private: - StoryDialogDetector m_dialog; SelectionArrowDetector m_choice_arrow; ButtonDetector m_interact; ButtonDetector m_battle_hint; diff --git a/SerialPrograms/Source/VideoGames/PokemonLZA/Programs/AutoStory/PokemonLZA_AutoStoryScreenEvents_Tests.cpp b/SerialPrograms/Source/VideoGames/PokemonLZA/Programs/AutoStory/PokemonLZA_AutoStoryScreenEvents_Tests.cpp index 20936ba18c..5698bd27a9 100644 --- a/SerialPrograms/Source/VideoGames/PokemonLZA/Programs/AutoStory/PokemonLZA_AutoStoryScreenEvents_Tests.cpp +++ b/SerialPrograms/Source/VideoGames/PokemonLZA/Programs/AutoStory/PokemonLZA_AutoStoryScreenEvents_Tests.cpp @@ -145,32 +145,28 @@ struct DialogFrameCase{ }; Input input; struct Expectation{ - bool dialog = false; bool interact_prompt = false; }; Expectation expectation; }; +// No text box masks the A prompt: the text must not read as one. const DialogFrameCase DIALOG_FRAME_CASES[] = { { // Ends 03.09's walk (walk_to_unread_marker()). .name = "Ryon's five-species dialog at the lab gate on the Italian game", .input = {.path = "AutoStoryScreenEvents/it_0309_lab_gate_ryon_dialog.png"}, - .expectation = {.dialog = true, .interact_prompt = false}, + .expectation = {.interact_prompt = false}, }, }; UnitTestResult check_dialog_frame(const DialogFrameCase& test){ const std::string path = std::format("{}PokemonLZA/{}", UNIT_TEST_RESOURCE_PATH(), test.input.path); PlzaScreenObserver observer; - const ScreenEvents events = observer.read(ImageRGB32(path)); - const bool dialog = events.has(ScreenEvent::DIALOG_BOX); - const bool prompt = events.has(ScreenEvent::INTERACT_PROMPT); - if (dialog != test.expectation.dialog || prompt != test.expectation.interact_prompt){ + const bool prompt = observer.read(ImageRGB32(path)).has(ScreenEvent::INTERACT_PROMPT); + if (prompt != test.expectation.interact_prompt){ return std::format( - "{}: expected dialog {}, A prompt {}; got dialog {}, A prompt {}", test.input.path, - test.expectation.dialog ? "yes" : "no", test.expectation.interact_prompt ? "yes" : "no", - dialog ? "yes" : "no", prompt ? "yes" : "no" + "{}: expected A prompt {}; got {}", test.input.path, test.expectation.interact_prompt ? "yes" : "no", prompt ? "yes" : "no" ); } return true; diff --git a/SerialPrograms/Source/VideoGames/PokemonLZA/Programs/AutoStory/PokemonLZA_AutoStorySignalProbe.cpp b/SerialPrograms/Source/VideoGames/PokemonLZA/Programs/AutoStory/PokemonLZA_AutoStorySignalProbe.cpp new file mode 100644 index 0000000000..bdd13b7a5b --- /dev/null +++ b/SerialPrograms/Source/VideoGames/PokemonLZA/Programs/AutoStory/PokemonLZA_AutoStorySignalProbe.cpp @@ -0,0 +1,85 @@ +/* PokemonLZA AutoStory - Signal probe + * + * From: https://github.com/PokemonAutomation/ + * + */ + +#include +#include +#include "PokemonLZA_AutoStoryReadings.h" +#include "PokemonLZA_AutoStorySceneMachine.h" +#include "PokemonLZA_AutoStorySignalProbe.h" + +namespace PokemonAutomation{ +namespace NintendoSwitch{ +namespace PokemonLZA{ + + +namespace{ + +struct ProbedSignal{ + std::string_view name; + bool (*shows)(const ScreenObservation& look); +}; + +bool has(const ScreenObservation& look, std::string_view reading){ + return look.readings.contains(reading); +} + +constexpr std::array SIGNALS{{ + {"party_bar", [](const ScreenObservation& look){ return look.events.has(ScreenEvent::PLAYER_CAN_MOVE); }}, + {"hint", [](const ScreenObservation& look){ return has(look, CONTROLS_HINT_READING); }}, + {"prompt", [](const ScreenObservation& look){ return look.events.has(ScreenEvent::INTERACT_PROMPT); }}, + {"arrow", [](const ScreenObservation& look){ return has(look, ADVANCE_ARROW_READING); }}, + {SHADOW_DIALOG_BOX_READING, [](const ScreenObservation& look){ return has(look, SHADOW_DIALOG_BOX_READING); }}, + {"autosave", [](const ScreenObservation& look){ return has(look, AUTOSAVE_READING); }}, + {"banner", [](const ScreenObservation& look){ return has(look, MISSION_BANNER_READING); }}, + {"choice", [](const ScreenObservation& look){ return look.events.has(ScreenEvent::CHOICE_BOX); }}, + {"fade", [](const ScreenObservation& look){ return fade_shows(look); }}, +}}; + +std::string since(const std::optional& when, WallClock start){ + if (!when){ + return "-"; + } + return std::to_string(std::chrono::duration_cast(*when - start).count()); +} + +} // namespace + + +void SignalProbe::look(const ScreenObservation& look){ + m_start = m_start.value_or(look.when); + m_last = look.when; + for (size_t index = 0; index < PROBED_SIGNALS; index++){ + if (!m_first[index] && SIGNALS[index].shows(look)){ + m_first[index] = look.when; + } + } + if (text_shows(look) || fade_shows(look) || look.events.has(ScreenEvent::CHOICE_BOX)){ + m_last_busy = look.when; + } + m_dialog_box_last = has(look, SHADOW_DIALOG_BOX_READING); +} + +void SignalProbe::restart(){ + *this = SignalProbe{}; +} + +std::string SignalProbe::line(std::string_view where, std::string_view decision, std::string_view by) const{ + const WallClock start = m_start.value_or(m_last); + std::string first; + for (size_t index = 0; index < PROBED_SIGNALS; index++){ + first += std::format(" {}@{}", SIGNALS[index].name, since(m_first[index], start)); + } + return std::format( + "[Signals] {} {} by={} after={} first:{} last_busy@{} shadow.dialog_box_at_decision={}", + where, decision, by, since(m_last, start), first, since(m_last_busy, start), m_dialog_box_last ? 1 : 0 + ); +} + + + +} // namespace PokemonLZA +} // namespace NintendoSwitch +} // namespace PokemonAutomation diff --git a/SerialPrograms/Source/VideoGames/PokemonLZA/Programs/AutoStory/PokemonLZA_AutoStorySignalProbe.h b/SerialPrograms/Source/VideoGames/PokemonLZA/Programs/AutoStory/PokemonLZA_AutoStorySignalProbe.h new file mode 100644 index 0000000000..a92ae3edde --- /dev/null +++ b/SerialPrograms/Source/VideoGames/PokemonLZA/Programs/AutoStory/PokemonLZA_AutoStorySignalProbe.h @@ -0,0 +1,57 @@ +/* PokemonLZA AutoStory - Signal probe + * + * From: https://github.com/PokemonAutomation/ + * + * For the log only: when each of the overlapping screen signals first + * showed over one wait, so a decision's "[Signals]" line shows which signal + * decided it and which others backed it (which are redundant). No decision + * reads it. + * + */ + +#ifndef PokemonAutomation_PokemonLZA_AutoStorySignalProbe_H +#define PokemonAutomation_PokemonLZA_AutoStorySignalProbe_H + +#include +#include +#include +#include +#include +#include "Common/Cpp/Time.h" +#include "CommonTools/ScreenMachine/ScreenObservation.h" + +namespace PokemonAutomation{ +namespace NintendoSwitch{ +namespace PokemonLZA{ + + +// The signals a "[Signals]" line times, in its order. +constexpr size_t PROBED_SIGNALS = 9; + +class SignalProbe{ +public: + // Notes what `look` shows; the first look after a restart starts the wait. + void look(const ScreenObservation& look); + // A new wait from the next look (after a press). + void restart(); + + // "[Signals] by= after= first: party_bar@ + // ... last_busy@ shadow.dialog_box_at_decision=0|1": ms from the + // wait's first look, "-" for never seen; the decision is on the last look. + // Busy is the advance arrow, a fade or a choice. + std::string line(std::string_view where, std::string_view decision, std::string_view by) const; + +private: + std::optional m_start; + WallClock m_last = WallClock::min(); + std::array, PROBED_SIGNALS> m_first = {}; + std::optional m_last_busy; + bool m_dialog_box_last = false; +}; + + + +} // namespace PokemonLZA +} // namespace NintendoSwitch +} // namespace PokemonAutomation +#endif diff --git a/SerialPrograms/Source/VideoGames/PokemonLZA/Programs/AutoStory/ReferenceData/plza-platform.json b/SerialPrograms/Source/VideoGames/PokemonLZA/Programs/AutoStory/ReferenceData/plza-platform.json deleted file mode 100644 index 1d59ee8577..0000000000 --- a/SerialPrograms/Source/VideoGames/PokemonLZA/Programs/AutoStory/ReferenceData/plza-platform.json +++ /dev/null @@ -1,70 +0,0 @@ -{ - "source": "the station platform right after the opening cutscene, default camera, 1920x1080", - "regions": { - "top": { - "cols": 64, - "rows": [ - "96dbf56fa2a7364b27577a55a2e8ffa8edffadf1ffb2f4ffb6f6ffb3f7ffb0f6ff9ee2f090d3e6a6edfca8f1ffa6f0ffa3eeff73a7bb234156476f8774afc846698241657d21415a243a4047658321436244668048687e4a6b8248698047687e4869804c6e854b6d8548697f45647a45667c39586c2c4557213a4c26466726475f1f3b554756665e65736d70797679817c7d856c70786e71796d7381777d8f74798773767e6f727963676f6c717c61656d5b606b61646b676a72666a7254585e", - "719ba7374b263245245576645c816a85b6a297cec6c0faffc4fdffc1fcffbdfbffb9faffadeef780b7ca86bfd09cdbe9aff3ff74a8b924455b466a7da7eeff6797ab2b475b25486022384139566e36587441608046677d3c5b6f3753673450632e495b2d485a2d485a2f4a5d355163355164294456243d4e1f3a51315d8b3a65911e3d5554616f6c7078797b8274767e797b826569716b6f79747a8c6e7586767b8b70747e6d707873757d6a6e775e626a5b606955596065697362677152565c", - "2d3849343e4c39474636442f4057323f553396c6b9c8feffc9ffffc9ffffc8ffffc2fafca5dbe37eabb76e97a587bac8afedf67fb3bf25475b486e7fb4f5ff82bbce385e782f546e223843324e63365a7745617f253f54314d6233516838576e33557030516b30526b33516738566b2942562840531f394b2e567e4c79ae5f769121435e54606d73767f75787f6c707a686c756c6f767479875d636d4f58666870816b707a77798183848b737781676a725d626c6669706f727a686b73545961", - "364f742a36482c3848313d4e3743504b5e5dacd7dcccfeffd1ffffd3ffffd3ffffcdfdfdb1dfe391bac3b4e6eaccffffb9edf27daab7224555456876c2fbffc0f9fdb0e9f16596a9223d472945542e516d3a5875213c513350663456723d607c46687f4a6c84496a813e627a2a4a62274255223a4c2546624671a4596d865e70885563735b626e6367706b6f78777f93777d8d676b746e73814a50583f464d4d545e6a6d7773757d84848b787c85676b746569737d7e8371757d60646c555a62", - "7da9f775a6f85b86ca4566943648622f3b4b313e524e5e6d83a0a9bce2e5d6ffffc9f1f350677192b5bbd8ffffdaffffd7ffff96c2c922414e43626ecdfeffd2ffffd1ffffc1f4f629455026404b29496237516326405726455c2e4a5b2f4b5c2c47592b47592c47582d48592e475927455a223b4f39536e4860773e5a72405b736d7179676c756c6f78767a856067766f76886c717c646a7442494e3d434a3c434b70747e7878807a7c837a7d8773757d666a7475777e6e7077696d744f545d", - "9cb8e59ebceba0c0f49bbffb8cb8fb7aa6e75b6281434559313c4b313f505366748da9b1aed1d594b2b6dfffffe1ffffdfffffa1c7cc2543523e5b67b1d9e3bdebf4b3efff97e2fe45768f28485a284b622c455229475f2c475d38576d2d4d6432526934546b3150662d4b61233b4d243f54304d664353626268725f68715c656e6a6f796a6e776e7179717581484e56565d6a757b89565c6341474ea4a7a9c7c9cbd9dadcd9dadcd9dadbdadbddd8d8da6e727b71747b7879806d70774d525d", - "9eb9e19fbae3a2bde6aac5ebacc8eeaecaf39fafd36b56606e5d705f67845470963b4d66323e4f47576494acb2a9c3c8defefea4c9d025414d39566290deff74c3ee70bae478cdf761a3c433556a3d6784243e4a35546a233d5235556c34546b305168315269325168284255254256374b5e546578495764767881787a8275777f6f727b6c70796b6f78676c7841484d4c535e757b8b545a62434950cfd0d2d2d3d6d2d3d7cbced2d5d7dbc6c8ccf7f7f76f737c7f808787878c63676e4f555f", - "9ab5e0a3bee4a6c0e7a2bde6a5c0e7a7c2e8aabfe46b54516c56546d5a5ea6c4f59fc3fa8aaee56483b24b5e783341544661734f7678264550344f5b70b8d876c0e774bee56cadd44c6f863e657966afd72a48562d49582742562b495f355870365a743456702f4e6528455a3f55673a4f5d75777f676b747a7c838281887d7e8674777f72767e676b746167723f4e5c4a5b70696f7c535963464c56d0d1d4c7c9ced7dcdeced1d5dadde0e3e5e6efeff06468707e808786868c64686f4c515c", - "9bb4dd9eb8df9fbbe1a3bce3a9c2e6a4bfe4a9c1e66a53506b54516a53519db6dd7e8a9e79889da6c3f18eb6f18ab5f57595c75a759425424c304952507c6c5ea09e7fd6ff7dd5ff5077903c61727ad1fc487c972b47532643532d4e645490b565aed65a98be47799a364f62495c69626a73787a8070737c7e7e8585848b626e7c707580787b8371747c606672223f5c3e50664e5c6c525762474d59b0b2b7d1d3d5ced3d8dfe0e1d2d5d7dcdddedadbdc575c6462666c696c735f636b494f5c", - "6b81a37088aa758db087a0c3a1b9dd9fb9df9ab2d54c4d5e524d5a584f5793abd28086927e756b9bb8e68cacd980a7df96b3e08397b3233b442b404a6882a84f66834a6e8466aacf4f77903b5e6e69add94a799540687c2946553c647e7fb6ca8ecbdf7ab9d472c2eb4c62726e747c7f80866f737b6f737b7e7f8586858b7d838c6f77846d707b7679815d66715870824c5a6758616c515761454c574147524b515c4a566c585b694c535e6f727b6d70795459626c6f77686c7460656d494f5c" - ] - }, - "left": { - "cols": 16, - "rows": [ - "6c7e92596a7d49618167604c6c685a474c443b413f3c4959808c9a7c92b17b95bc7ea2d38da8d54b5a64263a418caee2", - "6b809a4d5d6b486488645d48655e473841442d353f31384067604e6b7b8553667e799cc9708296314a5c273b41667993", - "768aa24856644a668a605a465f5a44323b402b343a2c353e645f4f5f6c7252667f7496c16f849a3a596c244251576c82", - "7692b5596d834f6e945b564452504329343c28323a353d455151496f776f5469817292b9626d8036536720373d4a5f77", - "6b748351535d506d915651414d4c433638432c313b3038454649465c5b624d63806f8eb16d7f9a4b68741f3d4e5c7a9a", - "58555f50505e4f6c8f524e414d4c42282a3222262e3d3c444b59697188a17594b86a8db780a1cb40576b1d2c30547293", - "5455605a5d6c4863895e666b626c762e37442b34403c3a425a759680a0c87e9fc8678bb77b9dc843647d1e425341596a", - "667e9d6f8aad81a0c683a2c97a9ac02e3a4827333d2a3240708fb57a9ac57698c457759a4c65802d434f1f323634485d", - "84a5ca81a3c880a2c77c9ec57899c15c7a9e486e9f252e396486b1567499455e77485f73475d722d425220313931455f", - "7fa1c87c9fc77a9dc6779ac47395c05f7ca3547cb8456896425b74485e72495f74405670364c6f354c70364c714b5c7a", - "7a9cc5789ac47698c37295c05c7ea6435d7b43596e495f74495f73445a71395071344a6d344a6e344b6f526280828898", - "7497c17094bf5a79a0445d7942586c475d704a6075485e743c526f344a6e344c70344b70344b6f58668284899a838999", - "506e903f5871445a6e4a6075495f73495e72405671354c6e334a6d344c71344b70354c705f6c85828898868b9c838898", - "44596d495f734a6174495f73435970384f70334a6e32496d334b6f344c72364d72647086828797868c9d858b9c70798e", - "465c70465c70455a6f3b516e344b6f344b6f32496c344c71334a6f394f716e778c848998848a9983889778809370798d", - "465c6f3f556e33496b334b6f334b6f32496d32486c31486b3a4d6d747c8e848a988187948186947d83926b74887f8492", - "3247642e43632f456531476a31466930466830476a40526f777d8c8388938489957f84907e8390677083797f8d808593", - "2c405d2b405d2d42612f45663046683046674958747d828f878b95858994858a958387926f7685737a888085907f838e", - "2a3c572a3d592c405e2e42612f45654b5a747f8490858992848890858891848892747986666e7f7e838d7f838d7f848e", - "293b55293b55293b562e415e545f7381858e878a92868a9283868f8488917a7e89626a7a797d8882868e7f838c7d828b" - ] - }, - "right": { - "cols": 16, - "rows": [ - "666c785d636e62666f474d59545963595e68464c573e4450485364494e60636872797a81656a7387868c6e7178505663", - "686e796b6e78676b74464c57555a64585e67454b553c424d4c4e5d4b4048686b74797b8154596271747c6a6e754d535f", - "5352526c6f785f646e464c58555a64565c65464c563b414c5559644e332c4d4a4d70737a5a5f676b6f76656a724b515f", - "5b5e57656a73555c674248565e626c585d664349533f42496d6b6b83623e747367676b73575c646c6e75646871484e5c", - "515b63656a75545d6d404653565d6b4e54603f4651473c3e958b63af98357e7235616671484d5565686e686c74454c59", - "4050694c5769485367383f4c545b694c525d3b434d403a3fb4a25bb0972e9e8a325b626d4b515c595f68585e65424958", - "3f51713f52714051714052724c597240495a3440522c2c3281765081712c836e2e6469714f555f60666e555b66434a59", - "3f52733f52734052744052734153744053744d5d80515c772f333e12192052464860656e5056605b616a505761434a58", - "3e52733e52744053753f52743f5273405374415475435473283344121b264d545f4f56604a515d5259624e545f404855", - "3e52743e52744054773f52744154773f53744154764255772a374c151e293f48543d444b424d5f4b5462474d5a3b4251", - "3e53773d52753e52743f53774054774256793f5375415476303b50171e278a74407e735f474748435678415371415271", - "3d52753f54783f54783e53763f53764054774054765061825e505f6b5a61615e59ad83334747423f4e6845587a425475", - "3e54793c52753c52753e54783e54773e53763e53764055794155784255784f5a6f71644f8b7243445571425577415374", - "3e53783d52763c51753b51753d53763e53773e53763f54763e537641557942567943577a40547643577a425678415475", - "384e713c51753c51743c50733c50723f53773e53773e52753e52753e51744054784154784053764054764052743f5071", - "3a4e6f374c6d394d6f3b4f723c50733b4e703c4f713d50723c50723b4f703c4f703e51734053763e50713c4e6f3e4f6f", - "4f5d76374b6c374a6c374a6c374a6b374a6a394c6c3b4e703a4d6e3a4d6d3a4d6d3b4e6e3d4e6f3c4e6d394b69384966", - "6d75863d4e6c364869374969364767364867374968384a6a384a6a3a4c6c3b4d6d3c4d6d3a4c6a3b4c6b384865374763", - "7b808c576279344563354766354766344665354766394a69354765374967374967394b6938496637486436466135455e", - "7b7f8b707683404f6835466535476635476535466435476533456136476536476435466234445f32425b32425b324158" - ] - } - } -} diff --git a/SerialPrograms/Source/VideoGames/PokemonLZA/Programs/AutoStory/StoryData/plza-01.00b.plan.json b/SerialPrograms/Source/VideoGames/PokemonLZA/Programs/AutoStory/StoryData/plza-01.00b.plan.json index efccadaf84..5506137abb 100644 --- a/SerialPrograms/Source/VideoGames/PokemonLZA/Programs/AutoStory/StoryData/plza-01.00b.plan.json +++ b/SerialPrograms/Source/VideoGames/PokemonLZA/Programs/AutoStory/StoryData/plza-01.00b.plan.json @@ -12,7 +12,7 @@ }, { "id": "opening", - "why": "Plus held 0.75 s after each fade-in of the opening, until it skips to the platform (A does not advance it); then the autosave badge and the platform", + "why": "Plus held 0.75 s after each fade-in of the opening, until it skips to the platform (A does not advance it); then the autosave badge and the platform's controls hint", "action": "opening_to_platform", "args": { "timeout_ms": 240000 diff --git a/SerialPrograms/Source/VideoGames/PokemonLZA/Programs/AutoStory/StoryData/plza-01.01.plan.json b/SerialPrograms/Source/VideoGames/PokemonLZA/Programs/AutoStory/StoryData/plza-01.01.plan.json index 436b3de90e..6e6310a260 100644 --- a/SerialPrograms/Source/VideoGames/PokemonLZA/Programs/AutoStory/StoryData/plza-01.01.plan.json +++ b/SerialPrograms/Source/VideoGames/PokemonLZA/Programs/AutoStory/StoryData/plza-01.01.plan.json @@ -10,7 +10,7 @@ "events": [ { "id": "on_platform", - "why": "start check: on the platform with free control", + "why": "start check: on the platform with free control, read by its controls hint (the platform has no party bar)", "action": "wait_for_platform", "args": { "timeout_ms": 10000 diff --git a/SerialPrograms/Source/VideoGames/PokemonLZA/Programs/AutoStory/StoryData/plza-03.01.plan.json b/SerialPrograms/Source/VideoGames/PokemonLZA/Programs/AutoStory/StoryData/plza-03.01.plan.json index ac1b721b47..bbff3d3400 100644 --- a/SerialPrograms/Source/VideoGames/PokemonLZA/Programs/AutoStory/StoryData/plza-03.01.plan.json +++ b/SerialPrograms/Source/VideoGames/PokemonLZA/Programs/AutoStory/StoryData/plza-03.01.plan.json @@ -52,7 +52,19 @@ }, { "id": "lobby_scene", - "why": "the ride, Z-A Royale, the outfit, AZ, Lida; autosave. 20 s quiet means control; Alton's choice is the top row", + "why": "the old lobby_scene (the ride, Z-A Royale, the outfit, AZ, Lida; autosave) up to its letter (\"Estimada Kosmos:\" on ES-LA) whose box shows no advance arrow: the scene goes quiet there (console B 2026-11-19), so 20 s quiet ends this part. When the arrow does read the letter, this part runs to control instead and the next two end on quiet", + "action": "mash_to_move_hints", + "args": {"quiet_ms": 20000, "quiet_is_control": true, "advance_with_a": true} + }, + { + "id": "lobby_letter", + "why": "A every 2 s through the letter's pages; 10 s with no text ends it", + "action": "mash_to_move_hints", + "args": {"blind_a_after_ms": 0, "quiet_ms": 10000, "quiet_is_control": true, "advance_with_a": true} + }, + { + "id": "lobby_scene_rest", + "why": "the rest of the scene after the letter (two cutscenes on console B 2026-11-19, which Plus skips). 20 s quiet means control; Alton's choice is the top row", "action": "mash_to_move_hints", "args": {"quiet_ms": 20000, "quiet_is_control": true, "advance_with_a": true} } diff --git a/SerialPrograms/Source/VideoGames/PokemonLZA/Programs/AutoStory/StoryData/plza-03.09.plan.json b/SerialPrograms/Source/VideoGames/PokemonLZA/Programs/AutoStory/StoryData/plza-03.09.plan.json index 718ea84de2..13de5f17ae 100644 --- a/SerialPrograms/Source/VideoGames/PokemonLZA/Programs/AutoStory/StoryData/plza-03.09.plan.json +++ b/SerialPrograms/Source/VideoGames/PokemonLZA/Programs/AutoStory/StoryData/plza-03.09.plan.json @@ -23,7 +23,7 @@ 13000 ] ], - "end": "dialog", + "end": "scene", "heading": 257 } }, diff --git a/SerialPrograms/Source/VideoGames/PokemonLZA/Programs/AutoStory/StoryData/plza-03.11.plan.json b/SerialPrograms/Source/VideoGames/PokemonLZA/Programs/AutoStory/StoryData/plza-03.11.plan.json index 5088d26750..664985bc07 100644 --- a/SerialPrograms/Source/VideoGames/PokemonLZA/Programs/AutoStory/StoryData/plza-03.11.plan.json +++ b/SerialPrograms/Source/VideoGames/PokemonLZA/Programs/AutoStory/StoryData/plza-03.11.plan.json @@ -27,7 +27,7 @@ 1600 ] ], - "end": "dialog" + "end": "scene" } }, { diff --git a/SerialPrograms/cmake/SourceFiles.cmake b/SerialPrograms/cmake/SourceFiles.cmake index 3c80e19e50..b02163ee4e 100644 --- a/SerialPrograms/cmake/SourceFiles.cmake +++ b/SerialPrograms/cmake/SourceFiles.cmake @@ -2413,8 +2413,6 @@ file(GLOB LIBRARY_SOURCES Source/VideoGames/PokemonLZA/Programs/AutoStory/Detectors/PokemonLZA_AutoStoryObjectiveMarkerReader_Tests.h Source/VideoGames/PokemonLZA/Programs/AutoStory/Detectors/PokemonLZA_AutoStoryPixelShares.cpp Source/VideoGames/PokemonLZA/Programs/AutoStory/Detectors/PokemonLZA_AutoStoryPixelShares.h - Source/VideoGames/PokemonLZA/Programs/AutoStory/Detectors/PokemonLZA_AutoStoryPlatformArrivalDetector.cpp - Source/VideoGames/PokemonLZA/Programs/AutoStory/Detectors/PokemonLZA_AutoStoryPlatformArrivalDetector.h Source/VideoGames/PokemonLZA/Programs/AutoStory/Detectors/PokemonLZA_AutoStoryReferenceCells.cpp Source/VideoGames/PokemonLZA/Programs/AutoStory/Detectors/PokemonLZA_AutoStoryReferenceCells.h Source/VideoGames/PokemonLZA/Programs/AutoStory/Detectors/PokemonLZA_AutoStoryStartScreenReader.cpp @@ -2450,6 +2448,8 @@ file(GLOB LIBRARY_SOURCES Source/VideoGames/PokemonLZA/Programs/AutoStory/PokemonLZA_AutoStorySceneGolden_Tests.h Source/VideoGames/PokemonLZA/Programs/AutoStory/PokemonLZA_AutoStoryScreenEvents.cpp Source/VideoGames/PokemonLZA/Programs/AutoStory/PokemonLZA_AutoStoryScreenEvents.h + Source/VideoGames/PokemonLZA/Programs/AutoStory/PokemonLZA_AutoStorySignalProbe.cpp + Source/VideoGames/PokemonLZA/Programs/AutoStory/PokemonLZA_AutoStorySignalProbe.h Source/VideoGames/PokemonLZA/Programs/AutoStory/PokemonLZA_AutoStoryScreenEvents_Tests.cpp Source/VideoGames/PokemonLZA/Programs/AutoStory/PokemonLZA_AutoStoryScreenEvents_Tests.h Source/VideoGames/PokemonLZA/Programs/AutoStory/PokemonLZA_AutoStoryStarts.cpp @@ -3527,6 +3527,7 @@ list(APPEND LOGIC_LIBRARY_SOURCES Source/VideoGames/PokemonLZA/Programs/AutoStory/PokemonLZA_AutoStoryBackups.cpp Source/VideoGames/PokemonLZA/Programs/AutoStory/PokemonLZA_AutoStoryGame.cpp Source/VideoGames/PokemonLZA/Programs/AutoStory/PokemonLZA_AutoStorySceneMachine.cpp + Source/VideoGames/PokemonLZA/Programs/AutoStory/PokemonLZA_AutoStorySignalProbe.cpp Source/VideoGames/PokemonLZA/Programs/AutoStory/PokemonLZA_AutoStoryStarts.cpp Source/VideoGames/PokemonLZA/Programs/AutoStory/PokemonLZA_AutoStoryStoryFiles.cpp Source/VideoGames/PokemonLZA/Programs/AutoStory/PokemonLZA_AutoStoryTable.cpp