From 029d144adfd6a0d51bf3e6f3f2a52a5346eb2aba Mon Sep 17 00:00:00 2001 From: kichithewolf Date: Fri, 10 Apr 2026 14:12:41 -0400 Subject: [PATCH 1/2] move prizeselectdetector box up slightly --- .../Dialogs/PokemonFRLG_PrizeSelectDetector.cpp | 10 +++++----- SerialPrograms/Source/Tests/PokemonFRLG_Tests.cpp | 9 +++++++++ SerialPrograms/Source/Tests/PokemonFRLG_Tests.h | 2 ++ SerialPrograms/Source/Tests/TestMap.cpp | 1 + 4 files changed, 17 insertions(+), 5 deletions(-) diff --git a/SerialPrograms/Source/PokemonFRLG/Inference/Dialogs/PokemonFRLG_PrizeSelectDetector.cpp b/SerialPrograms/Source/PokemonFRLG/Inference/Dialogs/PokemonFRLG_PrizeSelectDetector.cpp index 56a01dbf4d..e041eb60f0 100644 --- a/SerialPrograms/Source/PokemonFRLG/Inference/Dialogs/PokemonFRLG_PrizeSelectDetector.cpp +++ b/SerialPrograms/Source/PokemonFRLG/Inference/Dialogs/PokemonFRLG_PrizeSelectDetector.cpp @@ -20,7 +20,7 @@ namespace PokemonFRLG{ PrizeSelectDetector::PrizeSelectDetector(Color color) : m_right_box(0.923385, 0.748077, 0.00615385, 0.204577) - , m_top_box(0.0704615, 0.741846, 0.859077, 0.00623077) + , m_top_box(0.0704615, 0.75, 0.859077, 0.00623077) , m_bottom_box(0.0716923, 0.943308, 0.851692, 0.00934615) , m_selection_box(0.705538, 0.528962, 0.212923, 0.0602308) {} @@ -38,10 +38,10 @@ bool PrizeSelectDetector::detect(const ImageViewRGB32& screen){ ImageViewRGB32 top_image = extract_box_reference(game_screen, m_top_box); ImageViewRGB32 bottom_image = extract_box_reference(game_screen, m_bottom_box); ImageViewRGB32 selection_image = extract_box_reference(game_screen, m_selection_box); - if (is_solid(right_image, { 0.25, 0.38, 0.369 }) - && is_solid(top_image, { 0.25, 0.38, 0.369 }) - && is_solid(bottom_image, { 0.25, 0.38, 0.369 }) - && is_solid(selection_image, { 0.25, 0.38, 0.369 }) + if (is_white(right_image) + && is_white(top_image) + && is_white(bottom_image) + && is_white(selection_image) ){ return true; } diff --git a/SerialPrograms/Source/Tests/PokemonFRLG_Tests.cpp b/SerialPrograms/Source/Tests/PokemonFRLG_Tests.cpp index 7284941bed..ba4dc437ea 100644 --- a/SerialPrograms/Source/Tests/PokemonFRLG_Tests.cpp +++ b/SerialPrograms/Source/Tests/PokemonFRLG_Tests.cpp @@ -13,6 +13,7 @@ //#include "NintendoSwitch/NintendoSwitch_ConsoleHandle.h" #include "PokemonFRLG/Inference/Dialogs/PokemonFRLG_DialogDetector.h" #include "PokemonFRLG/Inference/Dialogs/PokemonFRLG_BattleDialogs.h" +#include "PokemonFRLG/Inference/Dialogs/PokemonFRLG_PrizeSelectDetector.h" #include "PokemonFRLG/Inference/PokemonFRLG_ShinySymbolDetector.h" #include "PokemonFRLG_Tests.h" #include "TestUtils.h" @@ -68,4 +69,12 @@ int test_pokemonFRLG_BattleMenuDetector(const ImageViewRGB32& image, bool target return 0; } +int test_pokemonFRLG_PrizeSelectDetector(const ImageViewRGB32& image, bool target){ + auto overlay = DummyVideoOverlay(); + PrizeSelectDetector detector(COLOR_RED); + bool result = detector.detect(image); + TEST_RESULT_EQUAL(result, target); + return 0; +} + } diff --git a/SerialPrograms/Source/Tests/PokemonFRLG_Tests.h b/SerialPrograms/Source/Tests/PokemonFRLG_Tests.h index 8d15dbd249..bed8f372ce 100644 --- a/SerialPrograms/Source/Tests/PokemonFRLG_Tests.h +++ b/SerialPrograms/Source/Tests/PokemonFRLG_Tests.h @@ -27,6 +27,8 @@ int test_pokemonFRLG_AdvanceBattleDialogDetector(const ImageViewRGB32& image, bo int test_pokemonFRLG_BattleMenuDetector(const ImageViewRGB32& image, bool target); +int test_pokemonFRLG_PrizeSelectDetector(const ImageViewRGB32& image, bool target); + } #endif diff --git a/SerialPrograms/Source/Tests/TestMap.cpp b/SerialPrograms/Source/Tests/TestMap.cpp index bfd2f7827e..0242761a63 100644 --- a/SerialPrograms/Source/Tests/TestMap.cpp +++ b/SerialPrograms/Source/Tests/TestMap.cpp @@ -314,6 +314,7 @@ const std::map TEST_MAP = { {"PokemonFRLG_SelectionDialogDetector", std::bind(image_bool_detector_helper, test_pokemonFRLG_SelectionDialogDetector, _1)}, {"PokemonFRLG_AdvanceBattleDialogDetector", std::bind(image_bool_detector_helper, test_pokemonFRLG_AdvanceBattleDialogDetector, _1)}, {"PokemonFRLG_BattleMenuDetector", std::bind(image_bool_detector_helper, test_pokemonFRLG_BattleMenuDetector, _1)}, + {"PokemonFRLG_PrizeSelectDetector", std::bind(image_bool_detector_helper, test_pokemonFRLG_PrizeSelectDetector, _1)}, }; TestFunction find_test_function(const std::string& test_space, const std::string& test_name){ From d440efd0385e695eaf07255810636cd1cda475ca Mon Sep 17 00:00:00 2001 From: kichithewolf Date: Fri, 10 Apr 2026 14:30:12 -0400 Subject: [PATCH 2/2] adjust party detection for better tolerance --- .../Menus/PokemonFRLG_PartyMenuDetector.cpp | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/SerialPrograms/Source/PokemonFRLG/Inference/Menus/PokemonFRLG_PartyMenuDetector.cpp b/SerialPrograms/Source/PokemonFRLG/Inference/Menus/PokemonFRLG_PartyMenuDetector.cpp index 756f02241c..7ea3981ccf 100644 --- a/SerialPrograms/Source/PokemonFRLG/Inference/Menus/PokemonFRLG_PartyMenuDetector.cpp +++ b/SerialPrograms/Source/PokemonFRLG/Inference/Menus/PokemonFRLG_PartyMenuDetector.cpp @@ -76,17 +76,17 @@ bool PartySelectionDetector::detect(const ImageViewRGB32& screen){ ImageFloatBox PartySlotDetector::party_slot_boxes(PartySlot position){ switch (position){ case PartySlot::ONE: - return ImageFloatBox(0.130000, 0.163000, 0.200000, 0.009000); + return ImageFloatBox(0.035000, 0.376617, 0.003280, 0.070000); case PartySlot::TWO: - return ImageFloatBox(0.710000, 0.063000, 0.260000, 0.009000); + return ImageFloatBox(0.985000, 0.080000, 0.003280, 0.099663); case PartySlot::THREE: - return ImageFloatBox(0.710000, 0.213000, 0.260000, 0.009000); + return ImageFloatBox(0.985000, 0.230000, 0.003280, 0.099663); case PartySlot::FOUR: - return ImageFloatBox(0.710000, 0.363000, 0.260000, 0.009000); + return ImageFloatBox(0.985000, 0.380000, 0.003280, 0.099663); case PartySlot::FIVE: - return ImageFloatBox(0.710000, 0.513000, 0.260000, 0.009000); + return ImageFloatBox(0.985000, 0.530000, 0.003280, 0.099663); case PartySlot::SIX: - return ImageFloatBox(0.710000, 0.663000, 0.260000, 0.009000); + return ImageFloatBox(0.985000, 0.675000, 0.003280, 0.099663); default: break; }