From e725cdc04d03e5a0fd3322202813a293ab317894 Mon Sep 17 00:00:00 2001 From: Boombaastical Date: Sun, 1 Mar 2026 13:21:08 +0100 Subject: [PATCH 1/4] Initial changes to search for specific pokemon in BossFinder --- .../Resources/PokemonSwSh_MaxLairDatabase.cpp | 14 ++++++++++++++ .../Resources/PokemonSwSh_MaxLairDatabase.h | 1 + 2 files changed, 15 insertions(+) diff --git a/SerialPrograms/Source/PokemonSwSh/Resources/PokemonSwSh_MaxLairDatabase.cpp b/SerialPrograms/Source/PokemonSwSh/Resources/PokemonSwSh_MaxLairDatabase.cpp index 95d04e52e0..772b2b907c 100644 --- a/SerialPrograms/Source/PokemonSwSh/Resources/PokemonSwSh_MaxLairDatabase.cpp +++ b/SerialPrograms/Source/PokemonSwSh/Resources/PokemonSwSh_MaxLairDatabase.cpp @@ -198,6 +198,7 @@ struct MaxLairDatabase{ std::map m_bosses; std::map m_bosses_by_dex; + std::map m_rentals_by_dex; static MaxLairDatabase& instance(){ static MaxLairDatabase data; @@ -218,6 +219,15 @@ struct MaxLairDatabase{ } m_bosses_by_dex[iter->second] = item.first; } + + for (const auto& item : m_rentals){ + const MaxLairSlugs& slugs = get_maxlair_slugs(item.first); + auto iter = national_dex.find(slugs.name_slug); + if (iter == national_dex.end()){ + throw InternalProgramError(nullptr, PA_CURRENT_FUNCTION, "Rental slug not found in national dex: " + slugs.name_slug); + } + m_rentals_by_dex[iter->second] = item.first; + } #if 0 for (const auto& item : m_bosses_by_dex){ @@ -237,6 +247,10 @@ const std::map& all_bosses_by_dex(){ const MaxLairDatabase& database = MaxLairDatabase::instance(); return database.m_bosses_by_dex; } +const std::map& all_rentals_by_dex(){ + const MaxLairDatabase& database = MaxLairDatabase::instance(); + return database.m_rentals_by_dex; +} bool is_boss(const std::string& slug){ const MaxLairDatabase& database = MaxLairDatabase::instance(); auto iter = database.m_bosses.find(slug); diff --git a/SerialPrograms/Source/PokemonSwSh/Resources/PokemonSwSh_MaxLairDatabase.h b/SerialPrograms/Source/PokemonSwSh/Resources/PokemonSwSh_MaxLairDatabase.h index 1f6fbe76ff..688f0542ca 100644 --- a/SerialPrograms/Source/PokemonSwSh/Resources/PokemonSwSh_MaxLairDatabase.h +++ b/SerialPrograms/Source/PokemonSwSh/Resources/PokemonSwSh_MaxLairDatabase.h @@ -55,6 +55,7 @@ struct MaxLairMon{ }; const std::map& all_bosses_by_dex(); +const std::map& all_rentals_by_dex(); bool is_boss(const std::string& slug); const MaxLairMon& get_maxlair_mon(const std::string& slug); From 1d06aa52faa1160e9e557c9023c74f8cbdcb10fe Mon Sep 17 00:00:00 2001 From: Boombaastical Date: Mon, 2 Mar 2026 16:24:39 +0100 Subject: [PATCH 2/4] Added the functionality to stop on certain Pokemon seen during Max Lair Adventure (Alolan Raichu and Alolan Marowak) --- .../PokemonSwSh_MaxLair_StateMachine.cpp | 3 +- .../Options/PokemonSwSh_MaxLair_Options.h | 2 + .../PokemonSwSh_MaxLair_BossFinder.cpp | 29 +++++- .../MaxLair/PokemonSwSh_MaxLair_BossFinder.h | 2 + .../MaxLair/PokemonSwSh_MaxLair_Standard.cpp | 3 + .../PokemonSwSh_MaxLair_StrongBoss.cpp | 3 + .../PokemonSwSh_MaxLair_Run_Battle.cpp | 11 ++- .../Program/PokemonSwSh_MaxLair_Run_Battle.h | 3 +- .../Resources/PokemonSwSh_MaxLairDatabase.cpp | 6 +- .../Resources/PokemonSwSh_MaxLairDatabase.h | 2 +- SerialPrograms/cmake/SourceFiles.cmake | 90 ++++++++++--------- 11 files changed, 101 insertions(+), 53 deletions(-) diff --git a/SerialPrograms/Source/PokemonSwSh/MaxLair/Framework/PokemonSwSh_MaxLair_StateMachine.cpp b/SerialPrograms/Source/PokemonSwSh/MaxLair/Framework/PokemonSwSh_MaxLair_StateMachine.cpp index fed71fe8aa..9d09a0d7fb 100644 --- a/SerialPrograms/Source/PokemonSwSh/MaxLair/Framework/PokemonSwSh_MaxLair_StateMachine.cpp +++ b/SerialPrograms/Source/PokemonSwSh/MaxLair/Framework/PokemonSwSh_MaxLair_StateMachine.cpp @@ -160,7 +160,8 @@ StateMachineAction run_state_iteration( global_state, runtime.console_settings[console_index], battle_menu.dmaxed(), - battle_menu.cheer() + battle_menu.cheer(), + runtime.actions ); case 5: console.log("Current State: Catch Select"); diff --git a/SerialPrograms/Source/PokemonSwSh/MaxLair/Options/PokemonSwSh_MaxLair_Options.h b/SerialPrograms/Source/PokemonSwSh/MaxLair/Options/PokemonSwSh_MaxLair_Options.h index 6b4e8335cf..e0949cb5af 100644 --- a/SerialPrograms/Source/PokemonSwSh/MaxLair/Options/PokemonSwSh_MaxLair_Options.h +++ b/SerialPrograms/Source/PokemonSwSh/MaxLair/Options/PokemonSwSh_MaxLair_Options.h @@ -59,6 +59,8 @@ class EndBattleDecider{ const PathStats& path_stats, bool any_shiny, bool boss_is_shiny ) const = 0; + + virtual bool stop_for_non_boss(const std::string& slug) const = 0; }; diff --git a/SerialPrograms/Source/PokemonSwSh/MaxLair/PokemonSwSh_MaxLair_BossFinder.cpp b/SerialPrograms/Source/PokemonSwSh/MaxLair/PokemonSwSh_MaxLair_BossFinder.cpp index 1b503f2437..6b5e547d18 100644 --- a/SerialPrograms/Source/PokemonSwSh/MaxLair/PokemonSwSh_MaxLair_BossFinder.cpp +++ b/SerialPrograms/Source/PokemonSwSh/MaxLair/PokemonSwSh_MaxLair_BossFinder.cpp @@ -87,6 +87,7 @@ MaxLairBossFinder::MaxLairBossFinder() PA_ADD_OPTION(CONSOLES); PA_ADD_OPTION(BOSS_LIST); + PA_ADD_OPTION(NON_BOSS_LIST); PA_ADD_OPTION(HOSTING); PA_ADD_OPTION(TOUCH_DATE_INTERVAL); @@ -119,9 +120,10 @@ void MaxLairBossFinder::update_active_consoles(size_t switch_count){ class EndBattleDecider_BossFinder : public EndBattleDecider{ public: - EndBattleDecider_BossFinder(const Consoles& consoles, const BossActionTable& boss_list) + EndBattleDecider_BossFinder(const Consoles& consoles, const BossActionTable& boss_list, NonBossActionTable& non_boss_list) : m_consoles(consoles) , m_boss_list(boss_list) + , m_non_boss_list(non_boss_list) {} virtual const std::string& normal_ball( size_t console_index @@ -151,6 +153,28 @@ class EndBattleDecider_BossFinder : public EndBattleDecider{ } throw InternalProgramError(nullptr, PA_CURRENT_FUNCTION, "Invalid enum."); } + virtual bool stop_for_non_boss(const std::string& slug) const override { + for (const StaticTableRow* row : m_non_boss_list.table()) { + const NonBossActionRow* nb_row = static_cast(row); + + const std::string& row_slug = nb_row->slug(); + + // Exact match + if (slug == row_slug) { + return nb_row->action == NonBossAction::STOP_PROGRAM; + } + + // If it has a specific variant, match any OCR slug that starts with it and has a hyphen (a form) + if (row_slug.find('-') == std::string::npos) { + if (slug.size() > row_slug.size() && + slug.substr(0, row_slug.size()) == row_slug && + slug[row_slug.size()] == '-') { + return nb_row->action == NonBossAction::STOP_PROGRAM; + } + } + } + return false; + } private: @@ -171,6 +195,7 @@ class EndBattleDecider_BossFinder : public EndBattleDecider{ const Consoles& m_consoles; const BossActionTable& m_boss_list; + const NonBossActionTable& m_non_boss_list; }; @@ -194,7 +219,7 @@ void MaxLairBossFinder::program(MultiSwitchProgramEnvironment& env, CancellableS } }); - EndBattleDecider_BossFinder decider(CONSOLES, BOSS_LIST); + EndBattleDecider_BossFinder decider(CONSOLES, BOSS_LIST, NON_BOSS_LIST); loop_adventures( env, scope, CONSOLES, diff --git a/SerialPrograms/Source/PokemonSwSh/MaxLair/PokemonSwSh_MaxLair_BossFinder.h b/SerialPrograms/Source/PokemonSwSh/MaxLair/PokemonSwSh_MaxLair_BossFinder.h index b8d66f8b49..0c1b95a2e4 100644 --- a/SerialPrograms/Source/PokemonSwSh/MaxLair/PokemonSwSh_MaxLair_BossFinder.h +++ b/SerialPrograms/Source/PokemonSwSh/MaxLair/PokemonSwSh_MaxLair_BossFinder.h @@ -16,6 +16,7 @@ #include "Options/PokemonSwSh_MaxLair_Options_Consoles.h" #include "Options/PokemonSwSh_MaxLair_Options_Hosting.h" #include "Options/PokemonSwSh_MaxLair_Options_BossAction.h" +#include "Options/PokemonSwSh_MaxLair_Options_NonBossAction.h" namespace PokemonAutomation{ @@ -46,6 +47,7 @@ class MaxLairBossFinder : public MultiSwitchProgramInstance{ MaxLairInternal::Consoles CONSOLES; MaxLairInternal::BossActionTable BOSS_LIST; + MaxLairInternal::NonBossActionTable NON_BOSS_LIST; MaxLairInternal::HostingSettings HOSTING; TouchDateIntervalOption TOUCH_DATE_INTERVAL; diff --git a/SerialPrograms/Source/PokemonSwSh/MaxLair/PokemonSwSh_MaxLair_Standard.cpp b/SerialPrograms/Source/PokemonSwSh/MaxLair/PokemonSwSh_MaxLair_Standard.cpp index 53280e6c16..d4aa98138f 100644 --- a/SerialPrograms/Source/PokemonSwSh/MaxLair/PokemonSwSh_MaxLair_Standard.cpp +++ b/SerialPrograms/Source/PokemonSwSh/MaxLair/PokemonSwSh_MaxLair_Standard.cpp @@ -166,6 +166,9 @@ class EndBattleDecider_Standard : public EndBattleDecider{ } return actions.no_shinies; } + virtual bool stop_for_non_boss(const std::string& slug) const override { + return false; + } private: const MaxLairStandard_ConsoleOptions& console(size_t index) const{ diff --git a/SerialPrograms/Source/PokemonSwSh/MaxLair/PokemonSwSh_MaxLair_StrongBoss.cpp b/SerialPrograms/Source/PokemonSwSh/MaxLair/PokemonSwSh_MaxLair_StrongBoss.cpp index d8b2e2def5..830c336fb4 100644 --- a/SerialPrograms/Source/PokemonSwSh/MaxLair/PokemonSwSh_MaxLair_StrongBoss.cpp +++ b/SerialPrograms/Source/PokemonSwSh/MaxLair/PokemonSwSh_MaxLair_StrongBoss.cpp @@ -215,6 +215,9 @@ class EndBattleDecider_StrongBoss : public EndBattleDecider{ return CaughtScreenAction::TAKE_NON_BOSS_SHINY_AND_CONTINUE; } } + virtual bool stop_for_non_boss(const std::string& slug) const override { + return false; + } private: const MaxLairStrongBoss_ConsoleOptions& console(size_t index) const{ diff --git a/SerialPrograms/Source/PokemonSwSh/MaxLair/Program/PokemonSwSh_MaxLair_Run_Battle.cpp b/SerialPrograms/Source/PokemonSwSh/MaxLair/Program/PokemonSwSh_MaxLair_Run_Battle.cpp index 4bd7b7d19f..d858a18daf 100644 --- a/SerialPrograms/Source/PokemonSwSh/MaxLair/Program/PokemonSwSh_MaxLair_Run_Battle.cpp +++ b/SerialPrograms/Source/PokemonSwSh/MaxLair/Program/PokemonSwSh_MaxLair_Run_Battle.cpp @@ -201,7 +201,8 @@ StateMachineAction run_move_select( OcrFailureWatchdog& ocr_watchdog, GlobalStateTracker& state_tracker, const ConsoleSpecificOptions& settings, - bool currently_dmaxed, bool cheer_only + bool currently_dmaxed, bool cheer_only, + const EndBattleDecider& decider ){ GlobalState& state = state_tracker[console_index]; size_t player_index = state.find_player_index(console_index); @@ -216,6 +217,14 @@ StateMachineAction run_move_select( )){ return StateMachineAction::RESET_RECOVER; } + + if (state.wins < 4) { + const std::string& opponent = state.opponent.empty() ? "" : *state.opponent.begin(); + if (!opponent.empty() && decider.stop_for_non_boss(opponent)) { + stream.log("Stopping program as " + opponent + " was encountered.", COLOR_PURPLE); + return StateMachineAction::STOP_PROGRAM; + } + } GlobalState inferred = state_tracker.synchronize(stream.logger(), console_index); diff --git a/SerialPrograms/Source/PokemonSwSh/MaxLair/Program/PokemonSwSh_MaxLair_Run_Battle.h b/SerialPrograms/Source/PokemonSwSh/MaxLair/Program/PokemonSwSh_MaxLair_Run_Battle.h index 2d7fb5bf33..fcb78dd93a 100644 --- a/SerialPrograms/Source/PokemonSwSh/MaxLair/Program/PokemonSwSh_MaxLair_Run_Battle.h +++ b/SerialPrograms/Source/PokemonSwSh/MaxLair/Program/PokemonSwSh_MaxLair_Run_Battle.h @@ -24,7 +24,8 @@ StateMachineAction run_move_select( OcrFailureWatchdog& ocr_watchdog, GlobalStateTracker& state_tracker, const ConsoleSpecificOptions& settings, - bool currently_dmaxed, bool cheer_only + bool currently_dmaxed, bool cheer_only, + const EndBattleDecider& decider ); StateMachineAction throw_balls( diff --git a/SerialPrograms/Source/PokemonSwSh/Resources/PokemonSwSh_MaxLairDatabase.cpp b/SerialPrograms/Source/PokemonSwSh/Resources/PokemonSwSh_MaxLairDatabase.cpp index 772b2b907c..6259802a32 100644 --- a/SerialPrograms/Source/PokemonSwSh/Resources/PokemonSwSh_MaxLairDatabase.cpp +++ b/SerialPrograms/Source/PokemonSwSh/Resources/PokemonSwSh_MaxLairDatabase.cpp @@ -198,7 +198,7 @@ struct MaxLairDatabase{ std::map m_bosses; std::map m_bosses_by_dex; - std::map m_rentals_by_dex; + std::multimap m_rentals_by_dex; static MaxLairDatabase& instance(){ static MaxLairDatabase data; @@ -226,7 +226,7 @@ struct MaxLairDatabase{ if (iter == national_dex.end()){ throw InternalProgramError(nullptr, PA_CURRENT_FUNCTION, "Rental slug not found in national dex: " + slugs.name_slug); } - m_rentals_by_dex[iter->second] = item.first; + m_rentals_by_dex.insert({iter->second, item.first}); } #if 0 @@ -247,7 +247,7 @@ const std::map& all_bosses_by_dex(){ const MaxLairDatabase& database = MaxLairDatabase::instance(); return database.m_bosses_by_dex; } -const std::map& all_rentals_by_dex(){ +const std::multimap& all_rentals_by_dex(){ const MaxLairDatabase& database = MaxLairDatabase::instance(); return database.m_rentals_by_dex; } diff --git a/SerialPrograms/Source/PokemonSwSh/Resources/PokemonSwSh_MaxLairDatabase.h b/SerialPrograms/Source/PokemonSwSh/Resources/PokemonSwSh_MaxLairDatabase.h index 688f0542ca..ab1c329335 100644 --- a/SerialPrograms/Source/PokemonSwSh/Resources/PokemonSwSh_MaxLairDatabase.h +++ b/SerialPrograms/Source/PokemonSwSh/Resources/PokemonSwSh_MaxLairDatabase.h @@ -55,7 +55,7 @@ struct MaxLairMon{ }; const std::map& all_bosses_by_dex(); -const std::map& all_rentals_by_dex(); +const std::multimap& all_rentals_by_dex(); bool is_boss(const std::string& slug); const MaxLairMon& get_maxlair_mon(const std::string& slug); diff --git a/SerialPrograms/cmake/SourceFiles.cmake b/SerialPrograms/cmake/SourceFiles.cmake index 5a1b974229..4352e34105 100644 --- a/SerialPrograms/cmake/SourceFiles.cmake +++ b/SerialPrograms/cmake/SourceFiles.cmake @@ -13,6 +13,8 @@ file(GLOB LIBRARY_SOURCES ../3rdParty/QtWavFile/WavFile.h ../3rdParty/TesseractPA/TesseractPA.cpp ../3rdParty/TesseractPA/TesseractPA.h + ../Common/CRC32/pabb_CRC32.c + ../Common/CRC32/pabb_CRC32.h ../Common/Compiler.h ../Common/ControllerStates/HID_Keyboard_State.h ../Common/ControllerStates/NintendoSwitch_OemController_State.c @@ -26,11 +28,11 @@ file(GLOB LIBRARY_SOURCES ../Common/Cpp/Color.h ../Common/Cpp/Concurrency/AsyncTask.h ../Common/Cpp/Concurrency/Backends/AsyncTask_Default.h + ../Common/Cpp/Concurrency/Backends/ThreadPool_Default.cpp + ../Common/Cpp/Concurrency/Backends/ThreadPool_Default.h ../Common/Cpp/Concurrency/Backends/Thread_Qt.tpp ../Common/Cpp/Concurrency/Backends/Thread_StdThread.tpp ../Common/Cpp/Concurrency/Backends/Thread_StdThreadDetach.tpp - ../Common/Cpp/Concurrency/Backends/ThreadPool_Default.cpp - ../Common/Cpp/Concurrency/Backends/ThreadPool_Default.h ../Common/Cpp/Concurrency/ConditionVariable.h ../Common/Cpp/Concurrency/FireForgetDispatcher.cpp ../Common/Cpp/Concurrency/FireForgetDispatcher.h @@ -82,10 +84,10 @@ file(GLOB LIBRARY_SOURCES ../Common/Cpp/Exceptions.h ../Common/Cpp/ExpressionEvaluator.cpp ../Common/Cpp/ExpressionEvaluator.h - ../Common/Cpp/Filesystem.cpp - ../Common/Cpp/Filesystem.h ../Common/Cpp/FileIO.cpp ../Common/Cpp/FileIO.h + ../Common/Cpp/Filesystem.cpp + ../Common/Cpp/Filesystem.h ../Common/Cpp/Hardware/Hardware.cpp ../Common/Cpp/Hardware/Hardware.h ../Common/Cpp/Hardware/Hardware_arm64_Linux.tpp @@ -159,9 +161,9 @@ file(GLOB LIBRARY_SOURCES ../Common/Cpp/Options/PathOption.h ../Common/Cpp/Options/RandomCodeOption.cpp ../Common/Cpp/Options/RandomCodeOption.h - ../Common/Cpp/Options/SimpleIntegerOptionBase.h ../Common/Cpp/Options/SimpleIntegerOption.cpp ../Common/Cpp/Options/SimpleIntegerOption.h + ../Common/Cpp/Options/SimpleIntegerOptionBase.h ../Common/Cpp/Options/StaticTableOption.cpp ../Common/Cpp/Options/StaticTableOption.h ../Common/Cpp/Options/StaticTextOption.cpp @@ -188,6 +190,13 @@ file(GLOB LIBRARY_SOURCES ../Common/Cpp/SerialConnection/SerialConnection.h ../Common/Cpp/SerialConnection/SerialConnectionPOSIX.h ../Common/Cpp/SerialConnection/SerialConnectionWinAPI.h + ../Common/Cpp/Sockets/AbstractClientSocket.h + ../Common/Cpp/Sockets/ClientSocket.cpp + ../Common/Cpp/Sockets/ClientSocket.h + ../Common/Cpp/Sockets/ClientSocket_POSIX.h + ../Common/Cpp/Sockets/ClientSocket_Qt.h + ../Common/Cpp/Sockets/ClientSocket_WinSocket.h + ../Common/Cpp/Stopwatch.h ../Common/Cpp/StreamConnections/MockDevice.cpp ../Common/Cpp/StreamConnections/MockDevice.h ../Common/Cpp/StreamConnections/PABotBase2_MessageDumper.cpp @@ -196,13 +205,6 @@ file(GLOB LIBRARY_SOURCES ../Common/Cpp/StreamConnections/ReliableStreamConnection.h ../Common/Cpp/StreamConnections/StreamConnection.h ../Common/Cpp/StreamConnections/StreamInterface.h - ../Common/Cpp/Sockets/AbstractClientSocket.h - ../Common/Cpp/Sockets/ClientSocket.cpp - ../Common/Cpp/Sockets/ClientSocket.h - ../Common/Cpp/Sockets/ClientSocket_POSIX.h - ../Common/Cpp/Sockets/ClientSocket_Qt.h - ../Common/Cpp/Sockets/ClientSocket_WinSocket.h - ../Common/Cpp/Stopwatch.h ../Common/Cpp/StreamConverters.cpp ../Common/Cpp/StreamConverters.h ../Common/Cpp/Strings/StringTools.cpp @@ -213,8 +215,17 @@ file(GLOB LIBRARY_SOURCES ../Common/Cpp/Time.h ../Common/Cpp/UiWrapper.h ../Common/Cpp/ValueDebouncer.h - ../Common/CRC32/pabb_CRC32.c - ../Common/CRC32/pabb_CRC32.h + ../Common/PABotBase2/PABotBase2_Connection.h + ../Common/PABotBase2/PABotBase2_ConnectionDebug.c + ../Common/PABotBase2/PABotBase2_ConnectionDebug.h + ../Common/PABotBase2/PABotBase2_PacketParser.c + ../Common/PABotBase2/PABotBase2_PacketParser.h + ../Common/PABotBase2/PABotBase2_PacketSender.c + ../Common/PABotBase2/PABotBase2_PacketSender.h + ../Common/PABotBase2/PABotBase2_StreamCoalescer.c + ../Common/PABotBase2/PABotBase2_StreamCoalescer.h + ../Common/PABotBase2/PABotbase2_ReliableStreamConnection.c + ../Common/PABotBase2/PABotbase2_ReliableStreamConnection.h ../Common/Qt/AutoHeightTable.cpp ../Common/Qt/AutoHeightTable.h ../Common/Qt/AutoWidthLineEdit.cpp @@ -227,8 +238,6 @@ file(GLOB LIBRARY_SOURCES ../Common/Qt/GlobalThreadPoolsQt.cpp ../Common/Qt/GlobalThreadPoolsQt.h ../Common/Qt/NoWheelComboBox.h - ../Common/Qt/QtThreadPool.cpp - ../Common/Qt/QtThreadPool.h ../Common/Qt/Options/BatchWidget.cpp ../Common/Qt/Options/BatchWidget.h ../Common/Qt/Options/BooleanCheckBoxWidget.cpp @@ -277,6 +286,8 @@ file(GLOB LIBRARY_SOURCES ../Common/Qt/Options/TimeDurationWidget.h ../Common/Qt/Options/TimeExpressionWidget.cpp ../Common/Qt/Options/TimeExpressionWidget.h + ../Common/Qt/QtThreadPool.cpp + ../Common/Qt/QtThreadPool.h ../Common/Qt/Redispatch.cpp ../Common/Qt/Redispatch.h ../Common/Qt/ShutdownWithEvents.h @@ -287,17 +298,6 @@ file(GLOB LIBRARY_SOURCES ../Common/Qt/TimeQt.h ../Common/Qt/WidgetStackFixedAspectRatio.cpp ../Common/Qt/WidgetStackFixedAspectRatio.h - ../Common/PABotBase2/PABotBase2_Connection.h - ../Common/PABotBase2/PABotBase2_ConnectionDebug.c - ../Common/PABotBase2/PABotBase2_ConnectionDebug.h - ../Common/PABotBase2/PABotBase2_PacketParser.c - ../Common/PABotBase2/PABotBase2_PacketParser.h - ../Common/PABotBase2/PABotBase2_PacketSender.c - ../Common/PABotBase2/PABotBase2_PacketSender.h - ../Common/PABotBase2/PABotbase2_ReliableStreamConnection.c - ../Common/PABotBase2/PABotbase2_ReliableStreamConnection.h - ../Common/PABotBase2/PABotBase2_StreamCoalescer.c - ../Common/PABotBase2/PABotBase2_StreamCoalescer.h ../Common/SerialPABotBase/SerialPABotBase_Messages_HID_Keyboard.h ../Common/SerialPABotBase/SerialPABotBase_Messages_NS1_OemControllers.h ../Common/SerialPABotBase/SerialPABotBase_Messages_NS_WiredController.h @@ -409,10 +409,10 @@ file(GLOB LIBRARY_SOURCES Source/CommonFramework/Logging/QueuedLogger.h Source/CommonFramework/Notifications/EventNotificationOption.cpp Source/CommonFramework/Notifications/EventNotificationOption.h - Source/CommonFramework/Notifications/EventNotificationsTable.cpp - Source/CommonFramework/Notifications/EventNotificationsTable.h Source/CommonFramework/Notifications/EventNotificationWidget.cpp Source/CommonFramework/Notifications/EventNotificationWidget.h + Source/CommonFramework/Notifications/EventNotificationsTable.cpp + Source/CommonFramework/Notifications/EventNotificationsTable.h Source/CommonFramework/Notifications/MessageAttachment.cpp Source/CommonFramework/Notifications/MessageAttachment.h Source/CommonFramework/Notifications/ProgramInfo.h @@ -628,10 +628,10 @@ file(GLOB LIBRARY_SOURCES Source/CommonTools/OCR/OCR_LargeDictionaryMatcher.h Source/CommonTools/OCR/OCR_NumberReader.cpp Source/CommonTools/OCR/OCR_NumberReader.h - Source/CommonTools/OCR/OCR_RawPaddleOCR.cpp - Source/CommonTools/OCR/OCR_RawPaddleOCR.h Source/CommonTools/OCR/OCR_RawOCR.cpp Source/CommonTools/OCR/OCR_RawOCR.h + Source/CommonTools/OCR/OCR_RawPaddleOCR.cpp + Source/CommonTools/OCR/OCR_RawPaddleOCR.h Source/CommonTools/OCR/OCR_Routines.cpp Source/CommonTools/OCR/OCR_Routines.h Source/CommonTools/OCR/OCR_SmallDictionaryMatcher.cpp @@ -748,8 +748,8 @@ file(GLOB LIBRARY_SOURCES Source/Controllers/SerialPABotBase/Messages/SerialPABotBase_MessageWrappers_BaseProtocol_Misc.h Source/Controllers/SerialPABotBase/Messages/SerialPABotBase_MessageWrappers_BaseProtocol_StaticRequests.h Source/Controllers/SerialPABotBase/Messages/SerialPABotBase_MessageWrappers_HID_Keyboard.h - Source/Controllers/SerialPABotBase/Messages/SerialPABotBase_MessageWrappers_NS_WiredController.h Source/Controllers/SerialPABotBase/Messages/SerialPABotBase_MessageWrappers_NS1_OemControllers.h + Source/Controllers/SerialPABotBase/Messages/SerialPABotBase_MessageWrappers_NS_WiredController.h Source/Controllers/SerialPABotBase/SerialPABotBase.cpp Source/Controllers/SerialPABotBase/SerialPABotBase.h Source/Controllers/SerialPABotBase/SerialPABotBase_Connection.cpp @@ -975,10 +975,10 @@ file(GLOB LIBRARY_SOURCES Source/ML/DataLabeling/ML_SegmentAnythingModelConstants.h Source/ML/Inference/ML_PaddleOCRPipeline.cpp Source/ML/Inference/ML_PaddleOCRPipeline.h - Source/ML/Inference/ML_YOLOv5Detector.cpp - Source/ML/Inference/ML_YOLOv5Detector.h Source/ML/Inference/ML_YOLONavigation.cpp Source/ML/Inference/ML_YOLONavigation.h + Source/ML/Inference/ML_YOLOv5Detector.cpp + Source/ML/Inference/ML_YOLOv5Detector.h Source/ML/ML_Panels.cpp Source/ML/ML_Panels.h Source/ML/Models/ML_ONNXRuntimeHelpers.cpp @@ -1408,10 +1408,10 @@ file(GLOB LIBRARY_SOURCES Source/PokemonFRLG/Inference/Dialogs/PokemonFRLG_PrizeSelectDetector.h Source/PokemonFRLG/Inference/Menus/PokemonFRLG_StartMenuDetector.cpp Source/PokemonFRLG/Inference/Menus/PokemonFRLG_StartMenuDetector.h - Source/PokemonFRLG/Inference/Sounds/PokemonFRLG_ShinySoundDetector.cpp - Source/PokemonFRLG/Inference/Sounds/PokemonFRLG_ShinySoundDetector.h Source/PokemonFRLG/Inference/PokemonFRLG_ShinySymbolDetector.cpp Source/PokemonFRLG/Inference/PokemonFRLG_ShinySymbolDetector.h + Source/PokemonFRLG/Inference/Sounds/PokemonFRLG_ShinySoundDetector.cpp + Source/PokemonFRLG/Inference/Sounds/PokemonFRLG_ShinySoundDetector.h Source/PokemonFRLG/PokemonFRLG_Navigation.cpp Source/PokemonFRLG/PokemonFRLG_Navigation.h Source/PokemonFRLG/PokemonFRLG_Panels.cpp @@ -1711,10 +1711,10 @@ file(GLOB LIBRARY_SOURCES Source/PokemonLZA/Inference/PokemonLZA_DayNightChangeDetector.h Source/PokemonLZA/Inference/PokemonLZA_DialogDetector.cpp Source/PokemonLZA/Inference/PokemonLZA_DialogDetector.h - Source/PokemonLZA/Inference/PokemonLZA_HyperspaceRewardNameReader.cpp - Source/PokemonLZA/Inference/PokemonLZA_HyperspaceRewardNameReader.h Source/PokemonLZA/Inference/PokemonLZA_HyperspaceCalorieDetector.cpp Source/PokemonLZA/Inference/PokemonLZA_HyperspaceCalorieDetector.h + Source/PokemonLZA/Inference/PokemonLZA_HyperspaceRewardNameReader.cpp + Source/PokemonLZA/Inference/PokemonLZA_HyperspaceRewardNameReader.h Source/PokemonLZA/Inference/PokemonLZA_MainMenuDetector.cpp Source/PokemonLZA/Inference/PokemonLZA_MainMenuDetector.h Source/PokemonLZA/Inference/PokemonLZA_OverworldPartySelectionDetector.cpp @@ -1761,18 +1761,18 @@ file(GLOB LIBRARY_SOURCES Source/PokemonLZA/Programs/NonShinyHunting/PokemonLZA_WeatherFinder.h Source/PokemonLZA/Programs/PokemonLZA_BasicNavigation.cpp Source/PokemonLZA/Programs/PokemonLZA_BasicNavigation.h - Source/PokemonLZA/Programs/PokemonLZA_FastTravelNavigation.cpp - Source/PokemonLZA/Programs/PokemonLZA_FastTravelNavigation.h - Source/PokemonLZA/Programs/PokemonLZA_HyperspaceNavigation.cpp - Source/PokemonLZA/Programs/PokemonLZA_HyperspaceNavigation.h Source/PokemonLZA/Programs/PokemonLZA_BoxSorter.cpp Source/PokemonLZA/Programs/PokemonLZA_BoxSorter.h Source/PokemonLZA/Programs/PokemonLZA_ClothingBuyer.cpp Source/PokemonLZA/Programs/PokemonLZA_ClothingBuyer.h Source/PokemonLZA/Programs/PokemonLZA_DonutBerrySession.cpp Source/PokemonLZA/Programs/PokemonLZA_DonutBerrySession.h + Source/PokemonLZA/Programs/PokemonLZA_FastTravelNavigation.cpp + Source/PokemonLZA/Programs/PokemonLZA_FastTravelNavigation.h Source/PokemonLZA/Programs/PokemonLZA_GameEntry.cpp Source/PokemonLZA/Programs/PokemonLZA_GameEntry.h + Source/PokemonLZA/Programs/PokemonLZA_HyperspaceNavigation.cpp + Source/PokemonLZA/Programs/PokemonLZA_HyperspaceNavigation.h Source/PokemonLZA/Programs/PokemonLZA_MegaShardFarmer.cpp Source/PokemonLZA/Programs/PokemonLZA_MegaShardFarmer.h Source/PokemonLZA/Programs/PokemonLZA_MenuNavigation.cpp @@ -1795,12 +1795,12 @@ file(GLOB LIBRARY_SOURCES Source/PokemonLZA/Programs/ShinyHunting/PokemonLZA_ShinyHunt_BenchSit.h Source/PokemonLZA/Programs/ShinyHunting/PokemonLZA_ShinyHunt_FlySpotReset.cpp Source/PokemonLZA/Programs/ShinyHunting/PokemonLZA_ShinyHunt_FlySpotReset.h + Source/PokemonLZA/Programs/ShinyHunting/PokemonLZA_ShinyHunt_HelioptileHunter.cpp + Source/PokemonLZA/Programs/ShinyHunting/PokemonLZA_ShinyHunt_HelioptileHunter.h Source/PokemonLZA/Programs/ShinyHunting/PokemonLZA_ShinyHunt_HyperspaceHunter.cpp Source/PokemonLZA/Programs/ShinyHunting/PokemonLZA_ShinyHunt_HyperspaceHunter.h Source/PokemonLZA/Programs/ShinyHunting/PokemonLZA_ShinyHunt_HyperspaceLegendary.cpp Source/PokemonLZA/Programs/ShinyHunting/PokemonLZA_ShinyHunt_HyperspaceLegendary.h - Source/PokemonLZA/Programs/ShinyHunting/PokemonLZA_ShinyHunt_HelioptileHunter.cpp - Source/PokemonLZA/Programs/ShinyHunting/PokemonLZA_ShinyHunt_HelioptileHunter.h Source/PokemonLZA/Programs/ShinyHunting/PokemonLZA_ShinyHunt_OverworldReset.cpp Source/PokemonLZA/Programs/ShinyHunting/PokemonLZA_ShinyHunt_OverworldReset.h Source/PokemonLZA/Programs/ShinyHunting/PokemonLZA_ShuttleRun.cpp @@ -2410,6 +2410,8 @@ file(GLOB LIBRARY_SOURCES Source/PokemonSwSh/MaxLair/Options/PokemonSwSh_MaxLair_Options_Consoles.h Source/PokemonSwSh/MaxLair/Options/PokemonSwSh_MaxLair_Options_Hosting.cpp Source/PokemonSwSh/MaxLair/Options/PokemonSwSh_MaxLair_Options_Hosting.h + Source/PokemonSwSh/MaxLair/Options/PokemonSwSh_MaxLair_Options_NonBossAction.cpp + Source/PokemonSwSh/MaxLair/Options/PokemonSwSh_MaxLair_Options_NonBossAction.h Source/PokemonSwSh/MaxLair/PokemonSwSh_MaxLair_BossFinder.cpp Source/PokemonSwSh/MaxLair/PokemonSwSh_MaxLair_BossFinder.h Source/PokemonSwSh/MaxLair/PokemonSwSh_MaxLair_Standard.cpp From 59f6a64b1d467759ea35e7dcdc05c32e3e139da1 Mon Sep 17 00:00:00 2001 From: Boombaastical Date: Mon, 2 Mar 2026 16:26:07 +0100 Subject: [PATCH 3/4] Added the function to stop on certain pokemon seen during the Max Lair adventure (Alolan Raichu and Alolan Marowak) --- ...emonSwSh_MaxLair_Options_NonBossAction.cpp | 142 ++++++++++++++++++ ...okemonSwSh_MaxLair_Options_NonBossAction.h | 47 ++++++ 2 files changed, 189 insertions(+) create mode 100644 SerialPrograms/Source/PokemonSwSh/MaxLair/Options/PokemonSwSh_MaxLair_Options_NonBossAction.cpp create mode 100644 SerialPrograms/Source/PokemonSwSh/MaxLair/Options/PokemonSwSh_MaxLair_Options_NonBossAction.h diff --git a/SerialPrograms/Source/PokemonSwSh/MaxLair/Options/PokemonSwSh_MaxLair_Options_NonBossAction.cpp b/SerialPrograms/Source/PokemonSwSh/MaxLair/Options/PokemonSwSh_MaxLair_Options_NonBossAction.cpp new file mode 100644 index 0000000000..6265d52eb4 --- /dev/null +++ b/SerialPrograms/Source/PokemonSwSh/MaxLair/Options/PokemonSwSh_MaxLair_Options_NonBossAction.cpp @@ -0,0 +1,142 @@ +/* Max Lair Non-Boss Action + * + * From: https://github.com/PokemonAutomation/ + * + */ + +#include "Pokemon/Pokemon_Strings.h" +#include "Pokemon/Resources/Pokemon_PokemonNames.h" +#include "PokemonSwSh/Resources/PokemonSwSh_PokemonSprites.h" +#include "PokemonSwSh/Resources/PokemonSwSh_MaxLairDatabase.h" +#include "PokemonSwSh_MaxLair_Options_NonBossAction.h" + +//#include +//using std::cout; +//using std::endl; + +namespace PokemonAutomation{ +namespace NintendoSwitch{ +namespace PokemonSwSh{ +namespace MaxLairInternal{ + + + + +const EnumDropdownDatabase& NonBossAction_Database(){ + static const EnumDropdownDatabase database({ + {NonBossAction::IGNORE, "ignore", "Ignore"}, + {NonBossAction::STOP_PROGRAM, "stop", "Stop program"}, + }); + return database; +} + +static std::string format_display_name(const std::string& slug) { + static const std::vector> region_map = { + + {"-alola", "Alolan "}, + {"-galar", "Galarian "} + }; + + std::string base_slug = slug; + std::string prefix; + + for (const auto& pair : region_map) { + size_t pos = slug.find(pair.first); + if (pos != std::string::npos) { + base_slug = slug.substr(0, pos); + + prefix = pair.second; + break; + } + } + + // Get base Pokemon name + std::string base_name = get_pokemon_name(base_slug).display_name(); + return prefix + base_name; +} + +NonBossActionRow::NonBossActionRow(std::string slug, const std::string& name_slug, const std::string& sprite_slug) + : StaticTableRow(slug) + , pokemon( + LockMode::UNLOCK_WHILE_RUNNING, + format_display_name(slug), + ALL_POKEMON_SPRITES().get_throw(sprite_slug).icon + ) + , action( + NonBossAction_Database(), + LockMode::UNLOCK_WHILE_RUNNING, + NonBossAction::IGNORE + ) +{ + PA_ADD_STATIC(pokemon); + add_option(action, "Action"); +} + + +NonBossActionTable::NonBossActionTable() + : StaticTableOption("Other Pokemon Actions:", LockMode::UNLOCK_WHILE_RUNNING) +{ + + // Limited mode: only display Alolan-Raichu and Alolan-Marowak by default. If the developer wants, it can also add the full list + const bool LIMITED_MODE = true; + + if (LIMITED_MODE) { + std::vector slugs = {"raichu-alola", "marowak-alola"}; + for (const std::string& slug : slugs) { + const MaxLairSlugs& slugs_info = get_maxlair_slugs(slug); + const std::string& sprite_slug = *slugs_info.sprite_slugs.begin(); + const std::string& name_slug = slugs_info.name_slug; + add_row(std::make_unique(slug, name_slug, sprite_slug)); + } + } else { + std::set added_grouped_base; // Track base slugs for grouped forms + + for (const auto& item : all_rentals_by_dex()){ + const std::string& full_slug = item.second; + const MaxLairSlugs& slugs = get_maxlair_slugs(full_slug); + const std::string& sprite_slug = *slugs.sprite_slugs.begin(); + const std::string& name_slug = slugs.name_slug; + + if (full_slug == name_slug) { + add_row(std::make_unique(full_slug, name_slug, sprite_slug)); + continue; + } + + // Check Alola and Galar variants + if (full_slug.size() > 6 && full_slug.substr(full_slug.size() - 6) == "-alola") { + add_row(std::make_unique(full_slug, name_slug, sprite_slug)); + continue; + } + if (full_slug.size() > 6 && full_slug.substr(full_slug.size() - 6) == "-galar") { + add_row(std::make_unique(full_slug, name_slug, sprite_slug)); + continue; + } + + // All other pokemon with suffixes (e.g. Basculin) are grouped under one name + + if (added_grouped_base.find(name_slug) == added_grouped_base.end()) { + add_row(std::make_unique(name_slug, name_slug, sprite_slug)); + added_grouped_base.insert(name_slug); + } + } + } + finish_construction(); +} + +std::vector NonBossActionTable::make_header() const{ + std::vector ret{ + STRING_POKEMON, + "Action", + }; + return ret; +} + + + + + + +} +} +} +} diff --git a/SerialPrograms/Source/PokemonSwSh/MaxLair/Options/PokemonSwSh_MaxLair_Options_NonBossAction.h b/SerialPrograms/Source/PokemonSwSh/MaxLair/Options/PokemonSwSh_MaxLair_Options_NonBossAction.h new file mode 100644 index 0000000000..646ef5b46f --- /dev/null +++ b/SerialPrograms/Source/PokemonSwSh/MaxLair/Options/PokemonSwSh_MaxLair_Options_NonBossAction.h @@ -0,0 +1,47 @@ +/* Max Lair Boss Action + * + * From: https://github.com/PokemonAutomation/ + * + */ + +#ifndef PokemonAutomation_PokemonSwSh_MaxLair_Options_NonBossAction_H +#define PokemonAutomation_PokemonSwSh_MaxLair_Options_NonBossAction_H + +#include "Common/Cpp/Options/EnumDropdownOption.h" +#include "Common/Cpp/Options/StaticTableOption.h" +#include "CommonFramework/Options/LabelCellOption.h" + +namespace PokemonAutomation{ +namespace NintendoSwitch{ +namespace PokemonSwSh{ +namespace MaxLairInternal{ + + +enum class NonBossAction{ + IGNORE, + STOP_PROGRAM, +}; + +class NonBossActionRow : public StaticTableRow{ +public: + NonBossActionRow(std::string slug, const std::string& name_slug, const std::string& sprite_slug); + + LabelCellOption pokemon; + EnumDropdownCell action; +}; + +class NonBossActionTable : public StaticTableOption{ +public: + NonBossActionTable(); + virtual std::vector make_header() const; +}; + + + + + +} +} +} +} +#endif From 3a193761948bdfa03a7578985ec1922e2907e0f6 Mon Sep 17 00:00:00 2001 From: Boombaastical Date: Mon, 2 Mar 2026 16:45:54 +0100 Subject: [PATCH 4/4] Updated with current upstream --- SerialPrograms/cmake/SourceFiles.cmake | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/SerialPrograms/cmake/SourceFiles.cmake b/SerialPrograms/cmake/SourceFiles.cmake index d8241de06e..296feb2b1e 100644 --- a/SerialPrograms/cmake/SourceFiles.cmake +++ b/SerialPrograms/cmake/SourceFiles.cmake @@ -82,10 +82,10 @@ file(GLOB LIBRARY_SOURCES ../Common/Cpp/Exceptions.h ../Common/Cpp/ExpressionEvaluator.cpp ../Common/Cpp/ExpressionEvaluator.h - ../Common/Cpp/FileIO.cpp - ../Common/Cpp/FileIO.h ../Common/Cpp/Filesystem.cpp ../Common/Cpp/Filesystem.h + ../Common/Cpp/FileIO.cpp + ../Common/Cpp/FileIO.h ../Common/Cpp/Hardware/Hardware.cpp ../Common/Cpp/Hardware/Hardware.h ../Common/Cpp/Hardware/Hardware_arm64_Linux.tpp @@ -1408,6 +1408,8 @@ file(GLOB LIBRARY_SOURCES Source/PokemonFRLG/Inference/Dialogs/PokemonFRLG_PrizeSelectDetector.h Source/PokemonFRLG/Inference/Menus/PokemonFRLG_StartMenuDetector.cpp Source/PokemonFRLG/Inference/Menus/PokemonFRLG_StartMenuDetector.h + Source/PokemonFRLG/Inference/Menus/PokemonFRLG_LoadMenuDetector.cpp + Source/PokemonFRLG/Inference/Menus/PokemonFRLG_LoadMenuDetector.h Source/PokemonFRLG/Inference/Sounds/PokemonFRLG_ShinySoundDetector.cpp Source/PokemonFRLG/Inference/Sounds/PokemonFRLG_ShinySoundDetector.h Source/PokemonFRLG/Inference/PokemonFRLG_ShinySymbolDetector.cpp