Skip to content

Commit f804d77

Browse files
committed
handle lack of user selection screen
1 parent 3908054 commit f804d77

1 file changed

Lines changed: 8 additions & 2 deletions

File tree

SerialPrograms/Source/PokemonFRLG/Programs/RngManipulation/PokemonFRLG_HardReset.cpp

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,6 @@ void rng_reset_and_return_home(
3535
go_home(console, context);
3636
close_game_from_home(console, context);
3737

38-
// console specific delays between opening the game and returning to the Home screen
3938
Milliseconds launch_delay = 950ms;
4039

4140
bool update_popup = false;
@@ -53,6 +52,7 @@ void rng_reset_and_return_home(
5352
HomeMenuWatcher home(console, std::chrono::milliseconds(2000));
5453
UpdateMenuWatcher update_menu(console, COLOR_PURPLE);
5554
CheckOnlineWatcher check_online(COLOR_CYAN);
55+
BlackScreenWatcher black_screen(COLOR_BLUE, {0.1, 0.15, 0.8, 0.7});
5656

5757
// first, get to the user select screen
5858
context.wait_for_all_requests();
@@ -64,6 +64,7 @@ void rng_reset_and_return_home(
6464
home,
6565
update_menu,
6666
check_online,
67+
black_screen
6768
}
6869
);
6970

@@ -90,6 +91,11 @@ void rng_reset_and_return_home(
9091
context.wait_for(std::chrono::seconds(1));
9192
pbf_press_button(context, BUTTON_A, 160ms, 840ms);
9293
continue;
94+
case 4:
95+
console.log("Detected black screen (no user selection screen). Closing game...");
96+
go_home(console, context);
97+
close_game_from_home(console, context);
98+
break;
9399
default:
94100
console.log("rng_start_game_and_return_home(): No recognizable state after 30 seconds.", COLOR_RED);
95101
pbf_press_button(context, BUTTON_HOME, 160ms, 840ms);
@@ -99,6 +105,7 @@ void rng_reset_and_return_home(
99105
context.wait_for_all_requests();
100106

101107
// By this point, the user selection menu is open with the desired profile selected, and the game hasn't yet been started.
108+
// OR the Switch only has one user, so the game will open directly from the Home screen
102109
// Everything up to this point has not been time-sensitive.
103110
// Waiting for all requests and using inference should be avoided for any button presses that happen *while the game is open*,
104111
// but we can make sure we've gotten back to the home screen and pause there
@@ -115,7 +122,6 @@ void rng_reset_and_return_home(
115122
// make sure a black screen appeared as a result of the button presses
116123
// if a popup appears, flag that it happened even if it gets closed by the home button press
117124
// Not sure how to handle the online check, so leaving it out for now
118-
BlackScreenWatcher black_screen(COLOR_BLUE, {0.1, 0.15, 0.8, 0.7});
119125
int ret3 = wait_until(
120126
console, context,
121127
std::chrono::seconds(2 + (update_popup ? 1 : 0)),

0 commit comments

Comments
 (0)