2020#include " CommonTools/Images/SolidColorTest.h"
2121#include " CommonTools/Async/InferenceRoutines.h"
2222#include " NintendoSwitch/Commands/NintendoSwitch_Commands_PushButtons.h"
23+ #include " NintendoSwitch/Commands/NintendoSwitch_Commands_Superscalar.h"
2324#include " NintendoSwitch/NintendoSwitch_Settings.h"
2425#include " Pokemon/Pokemon_Strings.h"
2526#include " Pokemon/Inference/Pokemon_PokeballNameReader.h"
@@ -48,7 +49,8 @@ CramomaticRNG_Descriptor::CramomaticRNG_Descriptor()
4849 " Perform RNG manipulation to get rare balls from the Cram-o-matic." ,
4950 FeedbackType::REQUIRED,
5051 AllowCommandsWhenRunning::DISABLE_COMMANDS,
51- {SerialPABotBase::OLD_NINTENDO_SWITCH_DEFAULT_REQUIREMENTS}
52+ {ControllerFeature::NintendoSwitch_ProController},
53+ FasterIfTickPrecise::MUCH_FASTER
5254 )
5355{}
5456
@@ -133,12 +135,12 @@ CramomaticRNG::CramomaticRNG()
133135 , ADVANCE_PRESS_DURATION(
134136 " <b>Advance Press Duration:</b><br>Hold the button down for this long to advance once." ,
135137 LockMode::LOCK_WHILE_RUNNING,
136- 10
138+ " 80 ms "
137139 )
138140 , ADVANCE_RELEASE_DURATION(
139141 " <b>Advance Release Duration:</b><br>After releasing the button, wait this long before pressing it again." ,
140142 LockMode::LOCK_WHILE_RUNNING,
141- 10
143+ " 80 ms "
142144 )
143145 , SAVE_SCREENSHOTS(
144146 " <b>Save Debug Screenshots:</b>" ,
@@ -174,8 +176,8 @@ CramomaticRNG::CramomaticRNG()
174176
175177void CramomaticRNG::navigate_to_party (SingleSwitchProgramEnvironment& env, ProControllerContext& context){
176178 pbf_press_button (context, BUTTON_X, 10 , 125 );
177- pbf_press_button (context, BUTTON_A, 10 , 10 );
178- pbf_wait (context, 2 * TICKS_PER_SECOND );
179+ pbf_press_button (context, BUTTON_A, 20 , 10 );
180+ pbf_wait (context, 2000ms );
179181}
180182
181183CramomaticTarget CramomaticRNG::calculate_target (SingleSwitchProgramEnvironment& env, Xoroshiro128PlusState state, std::vector<CramomaticSelection> selected_balls){
@@ -281,7 +283,7 @@ CramomaticTarget CramomaticRNG::calculate_target(SingleSwitchProgramEnvironment&
281283}
282284
283285void CramomaticRNG::leave_to_overworld_and_interact (SingleSwitchProgramEnvironment& env, ProControllerContext& context){
284- pbf_press_button (context, BUTTON_B, 2 * TICKS_PER_SECOND, 5 );
286+ pbf_press_button (context, BUTTON_B, 2000ms, 40ms );
285287 pbf_press_button (context, BUTTON_B, 10 , 70 );
286288
287289 pbf_mash_button (context, BUTTON_A, 320 );
@@ -305,7 +307,7 @@ void CramomaticRNG::choose_apricorn(SingleSwitchProgramEnvironment& env, ProCont
305307 }
306308
307309 // select the apricorn(s)
308- pbf_wait (context, 1 * TICKS_PER_SECOND );
310+ pbf_wait (context, 1000ms );
309311 pbf_press_button (context, BUTTON_A, 10 , 30 );
310312 if (sport){
311313 pbf_press_dpad (context, DPAD_DOWN, 20 , 10 );
@@ -317,7 +319,7 @@ void CramomaticRNG::choose_apricorn(SingleSwitchProgramEnvironment& env, ProCont
317319 }
318320 pbf_press_button (context, BUTTON_A, 10 , 30 );
319321
320- pbf_mash_button (context, BUTTON_A, 5 * TICKS_PER_SECOND );
322+ pbf_mash_button (context, BUTTON_A, 5000ms );
321323}
322324
323325std::pair<bool , std::string> CramomaticRNG::receive_ball (SingleSwitchProgramEnvironment& env, ProControllerContext& context){
@@ -367,16 +369,16 @@ std::pair<bool, std::string> CramomaticRNG::receive_ball(SingleSwitchProgramEnvi
367369 arrow_detected = true ;
368370 }
369371 }
370- pbf_press_button (context, BUTTON_B, 10 , TICKS_PER_SECOND );
372+ pbf_press_button (context, BUTTON_B, 80ms, 1000ms );
371373 return {arrow_detected, best_ball};
372374}
373375
374376void CramomaticRNG::recover_from_wrong_state (SingleSwitchProgramEnvironment& env, ProControllerContext& context){
375377 // Mash the B button to exit potential menus or dialog boxes
376- pbf_mash_button (context, BUTTON_B, 30 * TICKS_PER_SECOND );
378+ pbf_mash_button (context, BUTTON_B, 30s );
377379
378380 // take a step in case Hyde repositioned the player
379- pbf_move_left_joystick (context, 128 , 0 , TICKS_PER_SECOND, 10 );
381+ pbf_move_left_joystick (context, 128 , 0 , 1000ms, 80ms );
380382
381383 context.wait_for_all_requests ();
382384}
@@ -436,7 +438,7 @@ void CramomaticRNG::program(SingleSwitchProgramEnvironment& env, ProControllerCo
436438 // Touch the date.
437439 if (TOUCH_DATE_INTERVAL.ok_to_touch_now ()){
438440 env.log (" Touching date to prevent rollover." );
439- pbf_press_button (context, BUTTON_HOME, 160ms, GameSettings::instance ().GAME_TO_HOME_DELAY_SAFE0 );
441+ ssf_press_button (context, BUTTON_HOME, GameSettings::instance ().GAME_TO_HOME_DELAY_SAFE0 , 160ms );
440442 touch_date_from_home (context, ConsoleSettings::instance ().SETTINGS_TO_HOME_DELAY0 );
441443 resume_game_no_interact (env.console , context, ConsoleSettings::instance ().TOLERATE_SYSTEM_UPDATE_MENU_FAST );
442444 }
@@ -482,7 +484,13 @@ void CramomaticRNG::program(SingleSwitchProgramEnvironment& env, ProControllerCo
482484 num_apricorn_one -= sport ? 2 : 4 ;
483485 num_apricorn_two -= sport ? 2 : 0 ;
484486
485- do_rng_advances (env.console , context, rng, target.needed_advances , ADVANCE_PRESS_DURATION, ADVANCE_RELEASE_DURATION);
487+ do_rng_advances (
488+ env.console , context,
489+ rng,
490+ target.needed_advances ,
491+ ADVANCE_PRESS_DURATION,
492+ ADVANCE_RELEASE_DURATION
493+ );
486494 leave_to_overworld_and_interact (env, context);
487495
488496 try {
0 commit comments