From 8f0c567e9a3f4d39ccad9457c542d7ebe29b43fb Mon Sep 17 00:00:00 2001 From: kichithewolf Date: Thu, 11 Dec 2025 20:34:39 -0500 Subject: [PATCH 1/3] za map icons for hyperspace --- .../Map/PokemonLZA_MapIconDetector.cpp | 97 +++++++++++++++++++ .../Map/PokemonLZA_MapIconDetector.h | 4 + .../Programs/PokemonLZA_BasicNavigation.cpp | 8 ++ 3 files changed, 109 insertions(+) diff --git a/SerialPrograms/Source/PokemonLZA/Inference/Map/PokemonLZA_MapIconDetector.cpp b/SerialPrograms/Source/PokemonLZA/Inference/Map/PokemonLZA_MapIconDetector.cpp index c31881a5e..7cf9024fd 100644 --- a/SerialPrograms/Source/PokemonLZA/Inference/Map/PokemonLZA_MapIconDetector.cpp +++ b/SerialPrograms/Source/PokemonLZA/Inference/Map/PokemonLZA_MapIconDetector.cpp @@ -161,6 +161,83 @@ const MapIconMatcher& MapIcon_BattleZone(){ return ret; } +const MapIconMatcher& MapIcon_HyperspaceBattleZone(){ + static MapIconMatcher ret( + "PokemonLZA/MapIcons/HyperspaceBattleZone.png", + "HyperspaceBattleZone", + Color(0xff000000), + Color(0xffFB257D), + 100, + 100.0, + { + {0xff000000, 0xffFB257D}, + } + ); + return ret; +} + +const MapIconMatcher& MapIcon_HyperspaceWildZone(){ + static MapIconMatcher ret( + "PokemonLZA/MapIcons/HyperspaceWildZone.png", + "HyperspaceWildZone", + Color(0xff000000), + Color(0xffAED635), + 100, + 100.0, + { + {0xff000000, 0xffAED635}, + } + ); + return ret; +} + +/* +const MapIconMatcher& MapIcon_HyperspaceEntryQuest(){ + static MapIconMatcher ret( + "PokemonLZA/MapIcons/HyperspaceEntryQuest.png", + "HyperspaceEntryWild", + Color(0xff000000), + Color(0xffFFFFDD), + 100, + 100.0, + { + {0xff000000, 0xffFFFFDD}, + } + ); + return ret; +} +*/ + +const MapIconMatcher& MapIcon_HyperspaceEntryWild(){ + static MapIconMatcher ret( + "PokemonLZA/MapIcons/HyperspaceEntryWild.png", + "HyperspaceEntryWild", + Color(0xff000000), + Color(0xffAED635), + 100, + 100.0, + { + {0xff000000, 0xffAED635}, + } + ); + return ret; +} + +const MapIconMatcher& MapIcon_HyperspaceEntryBattle(){ + static MapIconMatcher ret( + "PokemonLZA/MapIcons/HyperspaceEntryBattle.png", + "HyperspaceEntryWild", + Color(0xff000000), + Color(0xffFB257D), + 100, + 100.0, + { + {0xff000000, 0xffFB257D}, + } + ); + return ret; +} + const MapIconMatcher& get_map_icon_matcher(MapIconType icon){ switch (icon){ case MapIconType::PokemonCenter: @@ -177,6 +254,14 @@ const MapIconMatcher& get_map_icon_matcher(MapIconType icon){ return MapIcon_WildZoneFlyable(); case MapIconType::BattleZone: return MapIcon_BattleZone(); + case MapIconType::HyperspaceBattleZone: + return MapIcon_HyperspaceBattleZone(); + case MapIconType::HyperspaceWildZone: + return MapIcon_HyperspaceWildZone(); + case MapIconType::HyperspaceEntryWild: + return MapIcon_HyperspaceEntryWild(); + case MapIconType::HyperspaceEntryBattle: + return MapIcon_HyperspaceEntryBattle(); default: throw InternalProgramError( nullptr, PA_CURRENT_FUNCTION, @@ -207,6 +292,14 @@ const char* map_icon_type_to_string(MapIconType type){ return "WildZoneFlyable"; case MapIconType::BattleZone: return "BattleZone"; + case MapIconType::HyperspaceBattleZone: + return "HyperspaceBattleZone"; + case MapIconType::HyperspaceWildZone: + return "HyperspaceWildZone"; + case MapIconType::HyperspaceEntryWild: + return "HyperspaceEntryWild"; + case MapIconType::HyperspaceEntryBattle: + return "HyperspaceEntryBattle"; default: throw InternalProgramError( nullptr, PA_CURRENT_FUNCTION, @@ -226,6 +319,10 @@ MapIconType string_to_map_icon_type(const std::string& str){ if (str == "WildZone") return MapIconType::WildZone; if (str == "WildZoneFlyable") return MapIconType::WildZoneFlyable; if (str == "BattleZone") return MapIconType::BattleZone; + if (str == "HyperspaceBattleZone") return MapIconType::HyperspaceBattleZone; + if (str == "HyperspaceWildZone") return MapIconType::HyperspaceWildZone; + if (str == "HyperspaceEntryWild") return MapIconType::HyperspaceEntryWild; + if (str == "HyperspaceEntryBattle") return MapIconType::HyperspaceEntryBattle; throw InternalProgramError( nullptr, PA_CURRENT_FUNCTION, "Unknown MapIconType string: " + str diff --git a/SerialPrograms/Source/PokemonLZA/Inference/Map/PokemonLZA_MapIconDetector.h b/SerialPrograms/Source/PokemonLZA/Inference/Map/PokemonLZA_MapIconDetector.h index 1059ed615..812bb092c 100644 --- a/SerialPrograms/Source/PokemonLZA/Inference/Map/PokemonLZA_MapIconDetector.h +++ b/SerialPrograms/Source/PokemonLZA/Inference/Map/PokemonLZA_MapIconDetector.h @@ -31,6 +31,10 @@ enum class MapIconType{ WildZone, WildZoneFlyable, BattleZone, + HyperspaceBattleZone, + HyperspaceWildZone, + HyperspaceEntryWild, + HyperspaceEntryBattle, }; const char* map_icon_type_to_string(MapIconType type); diff --git a/SerialPrograms/Source/PokemonLZA/Programs/PokemonLZA_BasicNavigation.cpp b/SerialPrograms/Source/PokemonLZA/Programs/PokemonLZA_BasicNavigation.cpp index 36747da08..9368fc23b 100644 --- a/SerialPrograms/Source/PokemonLZA/Programs/PokemonLZA_BasicNavigation.cpp +++ b/SerialPrograms/Source/PokemonLZA/Programs/PokemonLZA_BasicNavigation.cpp @@ -111,10 +111,18 @@ bool open_map(ConsoleHandle& console, ProControllerContext& context, bool zoom_t MapIconDetector pokecenter_icon(COLOR_RED, MapIconType::PokemonCenter, icon_region, &console.overlay()); MapIconDetector flyable_building_icon(COLOR_BLACK, MapIconType::BuildingFlyable, icon_region, &console.overlay()); MapIconDetector flayble_cafe_icon(COLOR_ORANGE, MapIconType::CafeFlyable, icon_region, &console.overlay()); + MapIconDetector flyable_hyperspace_battle_zone_icon(COLOR_ORANGE, MapIconType::HyperspaceBattleZone, icon_region, &console.overlay()); + MapIconDetector flyable_hyperspace_wild_zone_icon(COLOR_ORANGE, MapIconType::HyperspaceWildZone, icon_region, &console.overlay()); + MapIconDetector flyable_hyperspace_entry_wild_icon(COLOR_ORANGE, MapIconType::HyperspaceEntryWild, icon_region, &console.overlay()); + MapIconDetector flyable_hyperspace_entry_battle_icon(COLOR_ORANGE, MapIconType::HyperspaceEntryBattle, icon_region, &console.overlay()); MapWatcher map_detector(COLOR_RED, &console.overlay()); map_detector.attach_map_icon_detector(pokecenter_icon); map_detector.attach_map_icon_detector(flyable_building_icon); map_detector.attach_map_icon_detector(flayble_cafe_icon); + map_detector.attach_map_icon_detector(flyable_hyperspace_battle_zone_icon); + map_detector.attach_map_icon_detector(flyable_hyperspace_wild_zone_icon); + map_detector.attach_map_icon_detector(flyable_hyperspace_entry_wild_icon); + map_detector.attach_map_icon_detector(flyable_hyperspace_entry_battle_icon); do{ map_detector.reset_state(); From edd1c7371efddba243972d7ee87d70f38abcbdde Mon Sep 17 00:00:00 2001 From: kichithewolf Date: Thu, 11 Dec 2025 22:03:33 -0500 Subject: [PATCH 2/3] za fly spot num of resets option --- .../PokemonLZA_ShinyHunt_FlySpotReset.cpp | 16 ++++++++++++++++ .../PokemonLZA_ShinyHunt_FlySpotReset.h | 2 ++ 2 files changed, 18 insertions(+) diff --git a/SerialPrograms/Source/PokemonLZA/Programs/ShinyHunting/PokemonLZA_ShinyHunt_FlySpotReset.cpp b/SerialPrograms/Source/PokemonLZA/Programs/ShinyHunting/PokemonLZA_ShinyHunt_FlySpotReset.cpp index 9b88d0b8a..7ab2df666 100644 --- a/SerialPrograms/Source/PokemonLZA/Programs/ShinyHunting/PokemonLZA_ShinyHunt_FlySpotReset.cpp +++ b/SerialPrograms/Source/PokemonLZA/Programs/ShinyHunting/PokemonLZA_ShinyHunt_FlySpotReset.cpp @@ -13,6 +13,7 @@ #include "CommonTools/StartupChecks/VideoResolutionCheck.h" #include "NintendoSwitch/Commands/NintendoSwitch_Commands_PushButtons.h" #include "NintendoSwitch/Commands/NintendoSwitch_Commands_Superscalar.h" +#include "NintendoSwitch/Programs/NintendoSwitch_GameEntry.h" #include "Pokemon/Pokemon_Strings.h" #include "PokemonLA/Inference/Sounds/PokemonLA_ShinySoundDetector.h" #include "PokemonLZA/Programs/PokemonLZA_BasicNavigation.h" @@ -72,6 +73,11 @@ ShinyHunt_FlySpotReset::ShinyHunt_FlySpotReset() LockMode::LOCK_WHILE_RUNNING, Route::NO_MOVEMENT ) + , NUM_RESETS( + "Resets:
Number of resets, for use when performing fly resets in Hyperspace Wild Zones. Each fly takes about 1 Cal. of time. Make sure to leave enough time to catch found shinies. Zero disables this option.", + LockMode::UNLOCK_WHILE_RUNNING, + 0, 0 + ) , NOTIFICATION_STATUS("Status Update", true, false, std::chrono::seconds(3600)) , NOTIFICATIONS({ &NOTIFICATION_STATUS, @@ -83,6 +89,7 @@ ShinyHunt_FlySpotReset::ShinyHunt_FlySpotReset() { PA_ADD_STATIC(SHINY_REQUIRES_AUDIO); PA_ADD_OPTION(ROUTE); + PA_ADD_OPTION(NUM_RESETS); PA_ADD_OPTION(SHINY_DETECTED); PA_ADD_OPTION(NOTIFICATIONS); } @@ -245,6 +252,7 @@ void ShinyHunt_FlySpotReset::program(SingleSwitchProgramEnvironment& env, ProCon ); } + uint64_t num_resets = 0; bool to_zoom_to_max = true; run_until( env.console, context, @@ -254,11 +262,19 @@ void ShinyHunt_FlySpotReset::program(SingleSwitchProgramEnvironment& env, ProCon shiny_sound_handler.process_pending(context); route(env, context, stats, to_zoom_to_max); to_zoom_to_max = false; + num_resets++; stats.resets++; env.update_stats(); if (stats.resets.load(std::memory_order_relaxed) % 10 == 0){ send_program_status_notification(env, NOTIFICATION_STATUS); } + + uint64_t num_resets_temp = NUM_RESETS; + if (num_resets_temp != 0 && num_resets >= num_resets_temp){ + env.log("Number of resets hit. Going to home to pause the game."); + go_home(env.console, context); + break; + } } // end while }, {{shiny_detector}} diff --git a/SerialPrograms/Source/PokemonLZA/Programs/ShinyHunting/PokemonLZA_ShinyHunt_FlySpotReset.h b/SerialPrograms/Source/PokemonLZA/Programs/ShinyHunting/PokemonLZA_ShinyHunt_FlySpotReset.h index 47f59e8e2..36367a517 100644 --- a/SerialPrograms/Source/PokemonLZA/Programs/ShinyHunting/PokemonLZA_ShinyHunt_FlySpotReset.h +++ b/SerialPrograms/Source/PokemonLZA/Programs/ShinyHunting/PokemonLZA_ShinyHunt_FlySpotReset.h @@ -9,6 +9,7 @@ #ifndef PokemonAutomation_PokemonLZA_ShinyHunt_FlySpotReset_H #define PokemonAutomation_PokemonLZA_ShinyHunt_FlySpotReset_H +#include "Common/Cpp/Options/SimpleIntegerOption.h" #include "CommonFramework/Notifications/EventNotificationsTable.h" #include "NintendoSwitch/NintendoSwitch_SingleSwitchProgram.h" #include "PokemonLA/Options/PokemonLA_ShinyDetectedAction.h" @@ -47,6 +48,7 @@ class ShinyHunt_FlySpotReset : public SingleSwitchProgramInstance{ PokemonLA::ShinyRequiresAudioText SHINY_REQUIRES_AUDIO; ShinySoundDetectedActionOption SHINY_DETECTED; EnumDropdownOption ROUTE; + SimpleIntegerOption NUM_RESETS; EventNotificationOption NOTIFICATION_STATUS; EventNotificationsOption NOTIFICATIONS; From cb5be4871fecef826cabcfab272fdbd84ce41021 Mon Sep 17 00:00:00 2001 From: kichithewolf Date: Thu, 11 Dec 2025 22:31:59 -0500 Subject: [PATCH 3/3] update to work with newer hyperspace map function --- .../Inference/Map/PokemonLZA_MapIconDetector.h | 8 ++++---- .../Programs/PokemonLZA_BasicNavigation.cpp | 11 +++++++---- .../PokemonLZA_ShinyHunt_FlySpotReset.cpp | 6 +++--- 3 files changed, 14 insertions(+), 11 deletions(-) diff --git a/SerialPrograms/Source/PokemonLZA/Inference/Map/PokemonLZA_MapIconDetector.h b/SerialPrograms/Source/PokemonLZA/Inference/Map/PokemonLZA_MapIconDetector.h index 812bb092c..cf327199c 100644 --- a/SerialPrograms/Source/PokemonLZA/Inference/Map/PokemonLZA_MapIconDetector.h +++ b/SerialPrograms/Source/PokemonLZA/Inference/Map/PokemonLZA_MapIconDetector.h @@ -31,10 +31,10 @@ enum class MapIconType{ WildZone, WildZoneFlyable, BattleZone, - HyperspaceBattleZone, - HyperspaceWildZone, - HyperspaceEntryWild, - HyperspaceEntryBattle, + HyperspaceBattleZone, //Icon in Lumiose + HyperspaceWildZone, //Icon in Lumiose + HyperspaceEntryWild, //Icon while in Hyperspace + HyperspaceEntryBattle, //Icon while in Hyperspace }; const char* map_icon_type_to_string(MapIconType type); diff --git a/SerialPrograms/Source/PokemonLZA/Programs/PokemonLZA_BasicNavigation.cpp b/SerialPrograms/Source/PokemonLZA/Programs/PokemonLZA_BasicNavigation.cpp index 9368fc23b..1b71df1f4 100644 --- a/SerialPrograms/Source/PokemonLZA/Programs/PokemonLZA_BasicNavigation.cpp +++ b/SerialPrograms/Source/PokemonLZA/Programs/PokemonLZA_BasicNavigation.cpp @@ -113,16 +113,13 @@ bool open_map(ConsoleHandle& console, ProControllerContext& context, bool zoom_t MapIconDetector flayble_cafe_icon(COLOR_ORANGE, MapIconType::CafeFlyable, icon_region, &console.overlay()); MapIconDetector flyable_hyperspace_battle_zone_icon(COLOR_ORANGE, MapIconType::HyperspaceBattleZone, icon_region, &console.overlay()); MapIconDetector flyable_hyperspace_wild_zone_icon(COLOR_ORANGE, MapIconType::HyperspaceWildZone, icon_region, &console.overlay()); - MapIconDetector flyable_hyperspace_entry_wild_icon(COLOR_ORANGE, MapIconType::HyperspaceEntryWild, icon_region, &console.overlay()); - MapIconDetector flyable_hyperspace_entry_battle_icon(COLOR_ORANGE, MapIconType::HyperspaceEntryBattle, icon_region, &console.overlay()); + MapWatcher map_detector(COLOR_RED, &console.overlay()); map_detector.attach_map_icon_detector(pokecenter_icon); map_detector.attach_map_icon_detector(flyable_building_icon); map_detector.attach_map_icon_detector(flayble_cafe_icon); map_detector.attach_map_icon_detector(flyable_hyperspace_battle_zone_icon); map_detector.attach_map_icon_detector(flyable_hyperspace_wild_zone_icon); - map_detector.attach_map_icon_detector(flyable_hyperspace_entry_wild_icon); - map_detector.attach_map_icon_detector(flyable_hyperspace_entry_battle_icon); do{ map_detector.reset_state(); @@ -181,7 +178,13 @@ void open_hyperspace_map(ConsoleHandle& console, ProControllerContext& context){ WallClock deadline = current_time() + 30s; + const ImageFloatBox icon_region{0.0, 0.089, 1.0, 0.911}; + MapIconDetector flyable_hyperspace_entry_wild_icon(COLOR_ORANGE, MapIconType::HyperspaceEntryWild, icon_region, &console.overlay()); + MapIconDetector flyable_hyperspace_entry_battle_icon(COLOR_ORANGE, MapIconType::HyperspaceEntryBattle, icon_region, &console.overlay()); + MapWatcher map_detector(COLOR_RED, &console.overlay()); + map_detector.attach_map_icon_detector(flyable_hyperspace_entry_wild_icon); + map_detector.attach_map_icon_detector(flyable_hyperspace_entry_battle_icon); do{ map_detector.reset_state(); diff --git a/SerialPrograms/Source/PokemonLZA/Programs/ShinyHunting/PokemonLZA_ShinyHunt_FlySpotReset.cpp b/SerialPrograms/Source/PokemonLZA/Programs/ShinyHunting/PokemonLZA_ShinyHunt_FlySpotReset.cpp index 7ab2df666..532d313a2 100644 --- a/SerialPrograms/Source/PokemonLZA/Programs/ShinyHunting/PokemonLZA_ShinyHunt_FlySpotReset.cpp +++ b/SerialPrograms/Source/PokemonLZA/Programs/ShinyHunting/PokemonLZA_ShinyHunt_FlySpotReset.cpp @@ -74,9 +74,9 @@ ShinyHunt_FlySpotReset::ShinyHunt_FlySpotReset() Route::NO_MOVEMENT ) , NUM_RESETS( - "Resets:
Number of resets, for use when performing fly resets in Hyperspace Wild Zones. Each fly takes about 1 Cal. of time. Make sure to leave enough time to catch found shinies. Zero disables this option.", + "Hyperspace Resets:
Number of resets when running the Hyperspace Wild Zone route. Each fly takes about 1 Cal. of time. Make sure to leave enough time to catch found shinies.", LockMode::UNLOCK_WHILE_RUNNING, - 0, 0 + 100, 1 ) , NOTIFICATION_STATUS("Status Update", true, false, std::chrono::seconds(3600)) , NOTIFICATIONS({ @@ -270,7 +270,7 @@ void ShinyHunt_FlySpotReset::program(SingleSwitchProgramEnvironment& env, ProCon } uint64_t num_resets_temp = NUM_RESETS; - if (num_resets_temp != 0 && num_resets >= num_resets_temp){ + if (ROUTE == Route::HYPERSPACE_WILD_ZONE && num_resets >= num_resets_temp){ env.log("Number of resets hit. Going to home to pause the game."); go_home(env.console, context); break;