Skip to content

Commit b3b9558

Browse files
committed
Automatically detect console type when we visit Home.
1 parent a4990e2 commit b3b9558

File tree

2 files changed

+10
-8
lines changed

2 files changed

+10
-8
lines changed

SerialPrograms/Source/NintendoSwitch/Inference/NintendoSwitch_ConsoleTypeDetector.cpp

Lines changed: 2 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -87,15 +87,9 @@ void ConsoleTypeDetector_StartGameUserSelect::commit_to_cache(){
8787
}
8888

8989
ConsoleType detect_console_type_from_in_game(ConsoleHandle& console, ProControllerContext& context){
90-
go_home(console, context);
91-
92-
ConsoleTypeDetector_Home detector(console);
93-
ConsoleType console_type = detector.detect_only(console.video().snapshot());
94-
detector.commit_to_cache();
95-
90+
go_home(console, context); // Automatically detects console type as well.
9691
resume_game_from_home(console, context);
97-
98-
return console_type;
92+
return console.state().console_type();
9993
}
10094

10195

SerialPrograms/Source/NintendoSwitch/Programs/NintendoSwitch_GameEntry.cpp

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -59,6 +59,14 @@ void ensure_at_home(ConsoleHandle& console, ControllerContext& context){
5959
{home_menu}
6060
);
6161
if (ret == 0){
62+
// While we're on the Home screen, we might as well read the
63+
// console type as well.
64+
if (console.state().console_type_confirmed()){
65+
return;
66+
}
67+
ConsoleTypeDetector_Home detector(console);
68+
detector.detect_only(console.video().snapshot());
69+
detector.commit_to_cache();
6270
return;
6371
}
6472
console.log("Unable to detect Home. Pressing Home button...", COLOR_RED);

0 commit comments

Comments
 (0)