Skip to content

Commit 4dadbdf

Browse files
committed
Update menu detector false positives on checking for internet box.
1 parent 8e962fa commit 4dadbdf

4 files changed

Lines changed: 26 additions & 2 deletions

File tree

SerialPrograms/Source/CommonFramework/Globals.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,8 +25,8 @@ namespace PokemonAutomation{
2525

2626
const bool IS_BETA_VERSION = true;
2727
const int PROGRAM_VERSION_MAJOR = 0;
28-
const int PROGRAM_VERSION_MINOR = 61;
29-
const int PROGRAM_VERSION_PATCH = 9;
28+
const int PROGRAM_VERSION_MINOR = 62;
29+
const int PROGRAM_VERSION_PATCH = 1;
3030

3131
const std::string PROGRAM_VERSION_BASE =
3232
"v" + std::to_string(PROGRAM_VERSION_MAJOR) +

SerialPrograms/Source/NintendoSwitch/DevPrograms/TestProgramSwitch.cpp

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -517,6 +517,14 @@ void TestProgram::program(MultiSwitchProgramEnvironment& env, CancellableScope&
517517

518518

519519

520+
UpdateMenuWatcher update_menu(console, COLOR_PURPLE);
521+
CheckOnlineWatcher check_online(COLOR_CYAN);
522+
update_menu.make_overlays(overlays);
523+
check_online.make_overlays(overlays);
524+
525+
526+
527+
520528
#if 0
521529
{
522530
MockDevice device;

SerialPrograms/Source/NintendoSwitch/Inference/NintendoSwitch_UpdatePopupDetector.cpp

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -77,6 +77,7 @@ UpdatePopupDetector_Switch1::UpdatePopupDetector_Switch1(Color color)
7777
, m_left(0.08, 0.25, 0.10, 0.38)
7878
, m_bottom_solid(0.10, 0.84, 0.80, 0.04)
7979
, m_bottom_buttons(0.70, 0.92, 0.28, 0.05)
80+
, m_option_divider(0.49, 0.66, 0.02, 0.01)
8081
{}
8182
void UpdatePopupDetector_Switch1::make_overlays(VideoOverlaySet& items) const{
8283
items.add(m_color, m_box_top);
@@ -85,8 +86,14 @@ void UpdatePopupDetector_Switch1::make_overlays(VideoOverlaySet& items) const{
8586
items.add(m_color, m_left);
8687
items.add(m_color, m_bottom_solid);
8788
items.add(m_color, m_bottom_buttons);
89+
items.add(m_color, m_option_divider);
8890
}
8991
bool UpdatePopupDetector_Switch1::detect(const ImageViewRGB32& screen){
92+
ImageStats option_divider = image_stats(extract_box_reference(screen, m_option_divider));
93+
if (option_divider.stddev.sum() < 10){
94+
return false;
95+
}
96+
9097
ImageStats stats_box_top = image_stats(extract_box_reference(screen, m_box_top));
9198
// cout << stats_box_top.average << stats_box_top.stddev << endl;
9299
bool white;
@@ -161,6 +168,7 @@ UpdatePopupDetector_Switch2::UpdatePopupDetector_Switch2(Color color)
161168
, m_left(0.08, 0.25, 0.10, 0.38)
162169
, m_bottom_solid(0.10, 0.86, 0.80, 0.04)
163170
, m_bottom_buttons(0.70, 0.92, 0.28, 0.05)
171+
, m_option_divider(0.49, 0.60, 0.02, 0.01)
164172
{}
165173

166174
void UpdatePopupDetector_Switch2::make_overlays(VideoOverlaySet& items) const{
@@ -170,8 +178,14 @@ void UpdatePopupDetector_Switch2::make_overlays(VideoOverlaySet& items) const{
170178
items.add(m_color, m_left);
171179
items.add(m_color, m_bottom_solid);
172180
items.add(m_color, m_bottom_buttons);
181+
items.add(m_color, m_option_divider);
173182
}
174183
bool UpdatePopupDetector_Switch2::detect(const ImageViewRGB32& screen){
184+
ImageStats option_divider = image_stats(extract_box_reference(screen, m_option_divider));
185+
if (option_divider.stddev.sum() < 10){
186+
return false;
187+
}
188+
175189
ImageStats stats_box_top = image_stats(extract_box_reference(screen, m_box_top));
176190
// cout << stats_box_top.average << stats_box_top.stddev << endl;
177191
bool white;

SerialPrograms/Source/NintendoSwitch/Inference/NintendoSwitch_UpdatePopupDetector.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,7 @@ class UpdatePopupDetector_Switch1 : public StaticScreenDetector{
3333
ImageFloatBox m_left;
3434
ImageFloatBox m_bottom_solid;
3535
ImageFloatBox m_bottom_buttons;
36+
ImageFloatBox m_option_divider;
3637
};
3738
class UpdatePopupDetector_Switch2 : public StaticScreenDetector{
3839
public:
@@ -49,6 +50,7 @@ class UpdatePopupDetector_Switch2 : public StaticScreenDetector{
4950
ImageFloatBox m_left;
5051
ImageFloatBox m_bottom_solid;
5152
ImageFloatBox m_bottom_buttons;
53+
ImageFloatBox m_option_divider;
5254
};
5355

5456

0 commit comments

Comments
 (0)