|
10 | 10 | #include "CommonTools/Async/InferenceRoutines.h" |
11 | 11 | #include "CommonTools/VisualDetectors/BlackScreenDetector.h" |
12 | 12 | #include "NintendoSwitch/Commands/NintendoSwitch_Commands_PushButtons.h" |
| 13 | +#include "PokemonLA/Inference/Objects/PokemonLA_ButtonDetector.h" |
| 14 | +#include "PokemonLA/Inference/Objects/PokemonLA_ArcPhoneDetector.h" |
13 | 15 | #include "PokemonLA/Inference/Map/PokemonLA_MapDetector.h" |
14 | 16 | #include "PokemonLA/Inference/Map/PokemonLA_SelectedRegionDetector.h" |
15 | | -#include "PokemonLA/Inference/Objects/PokemonLA_ButtonDetector.h" |
16 | 17 | #include "PokemonLA/PokemonLA_Settings.h" |
17 | 18 | #include "PokemonLA/PokemonLA_TravelLocations.h" |
18 | 19 | #include "PokemonLA/Programs/PokemonLA_EscapeFromAttack.h" |
@@ -172,26 +173,45 @@ void mash_A_to_change_region( |
172 | 173 | context.wait_for(std::chrono::milliseconds(1000)); |
173 | 174 | #endif |
174 | 175 |
|
175 | | - stream.log("Waiting for end of loading screen..."); |
176 | | - BlackScreenOverWatcher black_screen1a(COLOR_RED, {0.20, 0.02, 0.60, 0.05}); |
177 | | - BlackScreenOverWatcher black_screen1b(COLOR_RED, {0.20, 0.93, 0.60, 0.05}); |
178 | | - int ret = run_until<SwitchControllerContext>( |
179 | | - stream, context, |
180 | | - [](SwitchControllerContext& context){ |
181 | | - pbf_mash_button(context, BUTTON_A, GameSettings::instance().LOAD_REGION_TIMEOUT); |
182 | | - }, |
183 | | - { |
184 | | - {black_screen1a}, |
185 | | - {black_screen1b}, |
| 176 | + { |
| 177 | + stream.log("Waiting for end of loading screen..."); |
| 178 | + BlackScreenOverWatcher black_screen1a(COLOR_RED, {0.20, 0.02, 0.60, 0.05}); |
| 179 | + BlackScreenOverWatcher black_screen1b(COLOR_RED, {0.20, 0.93, 0.60, 0.05}); |
| 180 | + int ret = run_until<SwitchControllerContext>( |
| 181 | + stream, context, |
| 182 | + [](SwitchControllerContext& context){ |
| 183 | + pbf_mash_button(context, BUTTON_A, GameSettings::instance().LOAD_REGION_TIMEOUT); |
| 184 | + }, |
| 185 | + { |
| 186 | + {black_screen1a}, |
| 187 | + {black_screen1b}, |
| 188 | + } |
| 189 | + ); |
| 190 | + if (ret < 0){ |
| 191 | + OperationFailedException::fire( |
| 192 | + ErrorReport::SEND_ERROR_REPORT, |
| 193 | + "Failed to load into region after timeout.", |
| 194 | + stream |
| 195 | + ); |
186 | 196 | } |
187 | | - ); |
188 | | - if (ret < 0){ |
189 | | - OperationFailedException::fire( |
190 | | - ErrorReport::SEND_ERROR_REPORT, |
191 | | - "Failed to load into region after timeout.", |
192 | | - stream |
| 197 | + } |
| 198 | + { |
| 199 | + stream.log("Waiting for overworld..."); |
| 200 | + ArcPhoneDetector phone(stream.logger(), stream.overlay(), std::chrono::milliseconds(250), true); |
| 201 | + int ret = wait_until( |
| 202 | + stream, context, |
| 203 | + Milliseconds(GameSettings::instance().LOAD_REGION_TIMEOUT * 1000 / TICKS_PER_SECOND), |
| 204 | + {phone} |
193 | 205 | ); |
| 206 | + if (ret < 0){ |
| 207 | + OperationFailedException::fire( |
| 208 | + ErrorReport::SEND_ERROR_REPORT, |
| 209 | + "Failed to load into region after timeout.", |
| 210 | + stream |
| 211 | + ); |
| 212 | + } |
194 | 213 | } |
| 214 | + |
195 | 215 | stream.log("Loaded into map..."); |
196 | 216 | context.wait_for(std::chrono::milliseconds((uint64_t)(GameSettings::instance().POST_WARP_DELAY * 1000))); |
197 | 217 | } |
|
0 commit comments