Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -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)
{}
Expand All @@ -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;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
Expand Down
9 changes: 9 additions & 0 deletions SerialPrograms/Source/Tests/PokemonFRLG_Tests.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down Expand Up @@ -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;
}

}
2 changes: 2 additions & 0 deletions SerialPrograms/Source/Tests/PokemonFRLG_Tests.h
Original file line number Diff line number Diff line change
Expand Up @@ -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
1 change: 1 addition & 0 deletions SerialPrograms/Source/Tests/TestMap.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -314,6 +314,7 @@ const std::map<std::string, TestFunction> 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){
Expand Down