Skip to content

Commit c394705

Browse files
committed
Temporary fix to incorrect Switch detection.
1 parent b5bd010 commit c394705

File tree

3 files changed

+16
-3
lines changed

3 files changed

+16
-3
lines changed

SerialPrograms/Source/NintendoSwitch/Inference/NintendoSwitch_ConsoleTypeDetector.cpp

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,6 @@ ConsoleType ConsoleTypeDetector_StartGameUserSelect::detect(const ImageViewRGB32
7070
state = ConsoleType::Switch1;
7171
}
7272

73-
m_console.state().set_console_type(m_console, state);
7473
return state;
7574
}
7675

SerialPrograms/Source/NintendoSwitch/Inference/NintendoSwitch_StartGameUserSelectDetector.cpp

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,8 @@ namespace NintendoSwitch{
2020

2121

2222
StartGameUserSelectDetector::StartGameUserSelectDetector(ConsoleHandle& console, Color color)
23-
: m_type_detector(console, color)
23+
: m_console(console)
24+
, m_type_detector(console, color)
2425
, m_switch1(color)
2526
, m_switch2(color)
2627
{}
@@ -29,9 +30,10 @@ void StartGameUserSelectDetector::make_overlays(VideoOverlaySet& items) const{
2930
m_switch1.make_overlays(items);
3031
m_switch2.make_overlays(items);
3132
}
32-
bool StartGameUserSelectDetector::detect(const ImageViewRGB32& screen){
33+
bool StartGameUserSelectDetector::detect_only(const ImageViewRGB32& screen){
3334
ConsoleType type = m_type_detector.detect(screen);
3435
// cout << "detection: " << (int)x << endl;
36+
m_console_type = type;
3537

3638
if (type == ConsoleType::Unknown){
3739
return false;
@@ -48,6 +50,14 @@ bool StartGameUserSelectDetector::detect(const ImageViewRGB32& screen){
4850
"Invalid ConsoleType: " + std::to_string((int)type)
4951
);
5052
}
53+
bool StartGameUserSelectDetector::detect(const ImageViewRGB32& screen){
54+
if (detect_only(screen)){
55+
m_console.state().set_console_type(m_console, m_console_type);
56+
return true;
57+
}else{
58+
return false;
59+
}
60+
}
5161

5262

5363

SerialPrograms/Source/NintendoSwitch/Inference/NintendoSwitch_StartGameUserSelectDetector.h

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -59,12 +59,16 @@ class StartGameUserSelectDetector : public StaticScreenDetector{
5959
StartGameUserSelectDetector(ConsoleHandle& console, Color color = COLOR_RED);
6060

6161
virtual void make_overlays(VideoOverlaySet& items) const override;
62+
bool detect_only(const ImageViewRGB32& screen);
6263
virtual bool detect(const ImageViewRGB32& screen) override;
6364

6465
private:
66+
ConsoleHandle& m_console;
6567
ConsoleTypeDetector_StartGameUserSelect m_type_detector;
6668
StartGameUserSelectDetector_Switch1 m_switch1;
6769
StartGameUserSelectDetector_Switch2 m_switch2;
70+
71+
ConsoleType m_console_type;
6872
};
6973
class StartGameUserSelectWatcher : public DetectorToFinder<StartGameUserSelectDetector>{
7074
public:

0 commit comments

Comments
 (0)