99#include " CommonFramework/Notifications/ProgramNotifications.h"
1010#include " CommonFramework/VideoPipeline/VideoOverlay.h"
1111#include " CommonTools/Async/InferenceRoutines.h"
12+ #include " CommonTools/VisualDetectors/BlackScreenDetector.h"
1213#include " NintendoSwitch/Programs/NintendoSwitch_GameEntry.h"
1314#include " NintendoSwitch/Commands/NintendoSwitch_Commands_PushButtons.h"
1415#include " NintendoSwitch/Commands/NintendoSwitch_Commands_Superscalar.h"
@@ -88,13 +89,29 @@ ShinyHunt_ShuttleRun::ShinyHunt_ShuttleRun()
8889
8990namespace {
9091
91- void fly_back (ConsoleHandle& console, ProControllerContext& context) {
92+ void fly_back_to_sewers_entrance (ConsoleHandle& console, ProControllerContext& context) {
9293 pbf_press_button (context, BUTTON_PLUS, 240ms, 80ms); // open map
9394 context.wait_for_all_requests ();
9495 pbf_wait (context, 500ms);
9596 pbf_press_button (context, BUTTON_Y, 100ms, 100ms); // select fly point
96- pbf_mash_button (context, BUTTON_A, 1000ms);
97- wait_until_overworld (console, context, 10s);
97+ {
98+ BlackScreenOverWatcher black_screen (COLOR_BLUE);
99+ int ret = run_until<ProControllerContext>(
100+ console, context,
101+ [](ProControllerContext& context){
102+ pbf_mash_button (context, BUTTON_A, 10000ms);
103+ },
104+ {black_screen}
105+ );
106+ if (ret != 0 ){
107+ OperationFailedException::fire (
108+ ErrorReport::SEND_ERROR_REPORT,
109+ " fly_back_to_sewers_entrance(): cannot detect black screen after mashing A." ,
110+ console
111+ );
112+ }
113+ }
114+ wait_until_overworld (console, context);
98115}
99116
100117void route_klefki (SingleSwitchProgramEnvironment& env, ProControllerContext& context){
@@ -103,7 +120,7 @@ void route_klefki(SingleSwitchProgramEnvironment& env, ProControllerContext& con
103120 pbf_move_left_joystick (context, 128 , 0 , 4900ms, 0ms);
104121 pbf_move_left_joystick (context, 0 , 128 , 1000ms, 0ms);
105122 pbf_press_button (context, BUTTON_L, 100ms, 500ms);
106- fly_back (env.console , context);
123+ fly_back_to_sewers_entrance (env.console , context);
107124}
108125
109126void route_klefki_inkay_goomy (SingleSwitchProgramEnvironment& env, ProControllerContext& context){
@@ -112,7 +129,7 @@ void route_klefki_inkay_goomy(SingleSwitchProgramEnvironment& env, ProController
112129 pbf_move_left_joystick (context, 128 , 0 , 8500ms, 0ms);
113130 pbf_move_left_joystick (context, 255 , 128 , 1300ms, 0ms);
114131 pbf_press_button (context, BUTTON_L, 100ms, 500ms);
115- fly_back (env.console , context);
132+ fly_back_to_sewers_entrance (env.console , context);
116133}
117134
118135void route_litwick (SingleSwitchProgramEnvironment& env, ProControllerContext& context){
@@ -125,15 +142,15 @@ void route_litwick(SingleSwitchProgramEnvironment& env, ProControllerContext& co
125142
126143void route_skrelp (SingleSwitchProgramEnvironment& env, ProControllerContext& context){
127144 context.wait_for_all_requests ();
128- fly_back (env.console , context);
145+ fly_back_to_sewers_entrance (env.console , context);
129146 pbf_wait (context, 1000ms);
130147}
131148
132149void route_skrelp_inkay (SingleSwitchProgramEnvironment& env, ProControllerContext& context){
133150 context.wait_for_all_requests ();
134151 ssf_press_button (context, BUTTON_B, 0ms, 500ms, 0ms);
135152 pbf_move_left_joystick (context, 128 , 0 , 3900ms, 0ms);
136- fly_back (env.console , context);
153+ fly_back_to_sewers_entrance (env.console , context);
137154}
138155
139156void route_skrelp_ariados (SingleSwitchProgramEnvironment& env, ProControllerContext& context){
0 commit comments