@@ -88,34 +88,20 @@ void close_game(VideoStream& stream, JoyconContext& context){
8888 pbf_press_button (context, BUTTON_HOME, 160ms, ConsoleSettings::instance ().SETTINGS_TO_HOME_DELAY0 );
8989 context.wait_for_all_requests ();
9090
91- // cout << "waiting..." << endl;
92- // context.wait_for(10s);
93-
94- // send a second Home button press, if the first one is dropped
95- bool video_available = (bool )stream.video ().snapshot ();
96- if (video_available){
97- HomeWatcher detector;
98- int ret = wait_until (
99- stream, context,
100- std::chrono::milliseconds (5000 ),
101- { detector }
102- );
103- if (ret == 0 ){
104- stream.log (" Detected Home screen." );
105- }else { // if game initially open. | if game initially closed
106- // initial Home button press was dropped
107- // - Does nothing. | - goes back to home screen, from opened app
108- pbf_press_button (context, BUTTON_HOME, 160ms, ConsoleSettings::instance ().SETTINGS_TO_HOME_DELAY0 );
109- }
110- }else {
111- // - wait some time after first Home button press
112- // to avoid triggering zoom
113- context.wait_for (std::chrono::milliseconds (1000 ));
114- // - Does nothing. | - Press Home a second time in case we drop one.
91+ HomeWatcher detector;
92+ int ret = wait_until (
93+ stream, context,
94+ std::chrono::milliseconds (5000 ),
95+ { detector }
96+ );
97+ if (ret == 0 ){
98+ stream.log (" Detected Home screen." );
99+ }else { // if game initially open. | if game initially closed
100+ // initial Home button press was dropped
101+ // - Does nothing. | - goes back to home screen, from opened app
115102 pbf_press_button (context, BUTTON_HOME, 160ms, ConsoleSettings::instance ().SETTINGS_TO_HOME_DELAY0 );
116103 }
117104
118-
119105 // fail-safe against button drops and unexpected error messages.
120106 pbf_mash_button (context, BUTTON_X, 400ms);
121107 pbf_mash_button (context, BUTTON_B, 2000ms);
0 commit comments