From 76ce3073f2553a37c15e29a9e17b4a91c8bb3a62 Mon Sep 17 00:00:00 2001 From: jw098 Date: Thu, 29 Jan 2026 21:27:16 -0800 Subject: [PATCH 1/3] Autostory: adjust usage of flying to Pokecenter in snowy areas. --- .../Programs/AutoStory/PokemonSV_AutoStory_Segment_28.cpp | 4 +++- .../Programs/AutoStory/PokemonSV_AutoStory_Segment_30.cpp | 1 + 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/SerialPrograms/Source/PokemonSV/Programs/AutoStory/PokemonSV_AutoStory_Segment_28.cpp b/SerialPrograms/Source/PokemonSV/Programs/AutoStory/PokemonSV_AutoStory_Segment_28.cpp index fa406c027..2b89bb7cb 100644 --- a/SerialPrograms/Source/PokemonSV/Programs/AutoStory/PokemonSV_AutoStory_Segment_28.cpp +++ b/SerialPrograms/Source/PokemonSV/Programs/AutoStory/PokemonSV_AutoStory_Segment_28.cpp @@ -307,7 +307,9 @@ void checkpoint_70(SingleSwitchProgramEnvironment& env, ProControllerContext& co [&](size_t attempt_number){ context.wait_for_all_requests(); // fly back to North Province Area Three - move_cursor_towards_flypoint_and_go_there(env.program_info(), env.console, context, {ZoomChange::KEEP_ZOOM, -1, +1, 0ms}, FlyPoint::POKECENTER); + // fly_to_overworld_from_map() may fail since the snowy background on the map will false positive the destinationMenuItemWatcher (MapDestinationMenuDetector at box {0.523000, 0.680000, 0.080000, 0.010000}), which causes the fly to fail + // we can get around this by either placing down a marker, or by zooming out so that that section isn't white snow. + move_cursor_towards_flypoint_and_go_there(env.program_info(), env.console, context, {ZoomChange::ZOOM_OUT, -1, +1, 0ms}, FlyPoint::POKECENTER); // fly back to Glaseado Mountain Pokecenter // this clears Pokemon in minimap diff --git a/SerialPrograms/Source/PokemonSV/Programs/AutoStory/PokemonSV_AutoStory_Segment_30.cpp b/SerialPrograms/Source/PokemonSV/Programs/AutoStory/PokemonSV_AutoStory_Segment_30.cpp index f88a94ae1..de8c497c5 100644 --- a/SerialPrograms/Source/PokemonSV/Programs/AutoStory/PokemonSV_AutoStory_Segment_30.cpp +++ b/SerialPrograms/Source/PokemonSV/Programs/AutoStory/PokemonSV_AutoStory_Segment_30.cpp @@ -234,6 +234,7 @@ void checkpoint_76(SingleSwitchProgramEnvironment& env, ProControllerContext& co // pokemon are cleared from minimap after the Snow Slope run // fly back to Glaseado Gym Pokecenter + // the problem with the snowy background is still there. but the marker placed previously is also still there move_cursor_towards_flypoint_and_go_there(env.program_info(), env.console, context, {ZoomChange::ZOOM_IN, -1, +1, 0ms}, FlyPoint::POKECENTER); From d513dbc0aa97a9ab8c09dfacfd593d636927ccaa Mon Sep 17 00:00:00 2001 From: jw098 Date: Thu, 29 Jan 2026 21:50:36 -0800 Subject: [PATCH 2/3] Autostory: add pre-check to confrim minimap is unlocked. --- .../Programs/AutoStory/PokemonSV_AutoStory.cpp | 12 ++++++++++++ .../Programs/AutoStory/PokemonSV_AutoStory.h | 1 + .../AutoStory/PokemonSV_AutoStoryTools.cpp | 16 ++++++++++++++++ .../AutoStory/PokemonSV_AutoStoryTools.h | 2 ++ 4 files changed, 31 insertions(+) diff --git a/SerialPrograms/Source/PokemonSV/Programs/AutoStory/PokemonSV_AutoStory.cpp b/SerialPrograms/Source/PokemonSV/Programs/AutoStory/PokemonSV_AutoStory.cpp index 7bc534895..6c0f5480b 100644 --- a/SerialPrograms/Source/PokemonSV/Programs/AutoStory/PokemonSV_AutoStory.cpp +++ b/SerialPrograms/Source/PokemonSV/Programs/AutoStory/PokemonSV_AutoStory.cpp @@ -525,6 +525,12 @@ AutoStory::AutoStory() LockMode::UNLOCK_WHILE_RUNNING, true ) + , ENSURE_MINIMAP_UNLOCKED( + "Pre-check: Ensure the minimap is unlocked:
" + "This is to ensure the minimap is unlocked. We use it to detect our direction.", + LockMode::UNLOCK_WHILE_RUNNING, + true + ) , GO_HOME_WHEN_DONE(true) , NOTIFICATION_STATUS_UPDATE("Status Update", true, false, std::chrono::seconds(30)) , NOTIFICATIONS({ @@ -764,6 +770,7 @@ AutoStory::AutoStory() PA_ADD_OPTION(CHANGE_SETTINGS); PA_ADD_OPTION(ENSURE_TIME_UNSYNCED); PA_ADD_OPTION(ENSURE_CORRECT_MOVES); + PA_ADD_OPTION(ENSURE_MINIMAP_UNLOCKED); PA_ADD_OPTION(NOTIFICATIONS); @@ -1316,6 +1323,11 @@ void AutoStory::program(SingleSwitchProgramEnvironment& env, ProControllerContex confirm_lead_pokemon_moves(env, context, LANGUAGE); } + if (ENSURE_MINIMAP_UNLOCKED && STORY_SECTION == StorySection::MAIN_STORY){ + env.console.log("Ensure the minimap is unlocked."); + confirm_minimap_unlocked(env, context); + } + run_autostory(env, context); send_program_finished_notification(env, NOTIFICATION_PROGRAM_FINISH); diff --git a/SerialPrograms/Source/PokemonSV/Programs/AutoStory/PokemonSV_AutoStory.h b/SerialPrograms/Source/PokemonSV/Programs/AutoStory/PokemonSV_AutoStory.h index 3f9709d11..e81776fcf 100644 --- a/SerialPrograms/Source/PokemonSV/Programs/AutoStory/PokemonSV_AutoStory.h +++ b/SerialPrograms/Source/PokemonSV/Programs/AutoStory/PokemonSV_AutoStory.h @@ -104,6 +104,7 @@ class AutoStory : public SingleSwitchProgramInstance, public ConfigOption::Liste BooleanCheckBoxOption CHANGE_SETTINGS; BooleanCheckBoxOption ENSURE_TIME_UNSYNCED; BooleanCheckBoxOption ENSURE_CORRECT_MOVES; + BooleanCheckBoxOption ENSURE_MINIMAP_UNLOCKED; GoHomeWhenDoneOption GO_HOME_WHEN_DONE; diff --git a/SerialPrograms/Source/PokemonSV/Programs/AutoStory/PokemonSV_AutoStoryTools.cpp b/SerialPrograms/Source/PokemonSV/Programs/AutoStory/PokemonSV_AutoStoryTools.cpp index 8d88d7b82..261b784c6 100644 --- a/SerialPrograms/Source/PokemonSV/Programs/AutoStory/PokemonSV_AutoStoryTools.cpp +++ b/SerialPrograms/Source/PokemonSV/Programs/AutoStory/PokemonSV_AutoStoryTools.cpp @@ -551,6 +551,22 @@ void confirm_lead_pokemon_moves(SingleSwitchProgramEnvironment& env, ProControll } +void confirm_minimap_unlocked(SingleSwitchProgramEnvironment& env, ProControllerContext& context){ + DirectionDetector direction; + try{ + direction.change_direction(env.program_info(), env.console, context, 3.02); + pbf_press_button(context, BUTTON_L, 200ms, 200ms); + }catch(OperationFailedException&){ + OperationFailedException::fire( + ErrorReport::SEND_ERROR_REPORT, + "confirm_minimap_unlocked(): Unable to confirm that the minimap is unlocked. Likely because the direction cannot be detected. " + "If you manually confirm that the minimap is unlocked, you can disable this precheck in the program setting \"Pre-check: Ensure the minimap is unlocked\".", + env.console + ); + } + +} + void change_settings_prior_to_autostory_segment_mode(SingleSwitchProgramEnvironment& env, ProControllerContext& context, size_t current_segment_num, Language language){ // get index of `Options` in the Main Menu, which depends on where you are in Autostory int8_t options_index; diff --git a/SerialPrograms/Source/PokemonSV/Programs/AutoStory/PokemonSV_AutoStoryTools.h b/SerialPrograms/Source/PokemonSV/Programs/AutoStory/PokemonSV_AutoStoryTools.h index 05598bec1..0a565447d 100644 --- a/SerialPrograms/Source/PokemonSV/Programs/AutoStory/PokemonSV_AutoStoryTools.h +++ b/SerialPrograms/Source/PokemonSV/Programs/AutoStory/PokemonSV_AutoStoryTools.h @@ -185,6 +185,8 @@ void swap_starter_moves(SingleSwitchProgramEnvironment& env, ProControllerContex // start and end in the overworld void confirm_lead_pokemon_moves(SingleSwitchProgramEnvironment& env, ProControllerContext& context, Language language); +void confirm_minimap_unlocked(SingleSwitchProgramEnvironment& env, ProControllerContext& context); + // run the given `action`. if detect a battle, stop the action, and throw exception void do_action_and_monitor_for_battles( const ProgramInfo& info, From 83b86da5e4bb1756050097342df1a45a0646e137 Mon Sep 17 00:00:00 2001 From: jw098 Date: Thu, 29 Jan 2026 21:54:14 -0800 Subject: [PATCH 3/3] add logging, comments for Autostory --- .../PokemonSV/Programs/AutoStory/PokemonSV_AutoStoryTools.cpp | 2 ++ 1 file changed, 2 insertions(+) diff --git a/SerialPrograms/Source/PokemonSV/Programs/AutoStory/PokemonSV_AutoStoryTools.cpp b/SerialPrograms/Source/PokemonSV/Programs/AutoStory/PokemonSV_AutoStoryTools.cpp index 261b784c6..01fb204b2 100644 --- a/SerialPrograms/Source/PokemonSV/Programs/AutoStory/PokemonSV_AutoStoryTools.cpp +++ b/SerialPrograms/Source/PokemonSV/Programs/AutoStory/PokemonSV_AutoStoryTools.cpp @@ -830,8 +830,10 @@ void do_action_and_monitor_for_battles_early( {no_minimap} ); if (ret == 0){ // if see no minimap. stop and see if we detect a battle. if so, throw Battl exception + stream.log("do_action_and_monitor_for_battles_early: Detected no mini-map. Possibly caught in a battle."); do_action_and_monitor_for_battles(info, stream, context, [&](const ProgramInfo& info, VideoStream& stream, ProControllerContext& context){ + // wait 30 seconds to see if we detect a battle. If so, this throws an UnexpectedBattleException. pbf_wait(context, Seconds(30)); });