Skip to content

Commit c90e04c

Browse files
committed
More programs authorized without TickPrecise.
1 parent dbc5e30 commit c90e04c

File tree

7 files changed

+37
-19
lines changed

7 files changed

+37
-19
lines changed

SerialPrograms/Source/NintendoSwitch/DevPrograms/TestProgramSwitch.cpp

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -117,6 +117,7 @@
117117
#include "NintendoSwitch/Commands/NintendoSwitch_Commands_DigitEntry.h"
118118
#include "PokemonSV/Programs/PokemonSV_Navigation.h"
119119
#include "PokemonSV/Programs/Farming/PokemonSV_MaterialFarmerTools.h"
120+
#include "PokemonSV/Programs/Farming/PokemonSV_TournamentFarmer.h"
120121

121122

122123
#include <QPixmap>
@@ -281,7 +282,12 @@ void TestProgram::program(MultiSwitchProgramEnvironment& env, CancellableScope&
281282
VideoOverlaySet overlays(overlay);
282283

283284

284-
fly_from_paldea_to_blueberry_entrance(env.program_info(), console, context);
285+
return_to_academy_after_loss(env, console, context);
286+
287+
288+
289+
290+
// fly_from_paldea_to_blueberry_entrance(env.program_info(), console, context);
285291

286292

287293

SerialPrograms/Source/NintendoSwitch/Programs/NintendoSwitch_PreventSleep.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ PreventSleep_Descriptor::PreventSleep_Descriptor()
1919
"Press B every 15 seconds to keep the Switch from sleeping.",
2020
FeedbackType::NONE,
2121
AllowCommandsWhenRunning::DISABLE_COMMANDS,
22-
{SerialPABotBase::OLD_NINTENDO_SWITCH_DEFAULT_REQUIREMENTS}
22+
{ControllerFeature::NintendoSwitch_ProController}
2323
)
2424
{}
2525

SerialPrograms/Source/NintendoSwitch/Programs/NintendoSwitch_PushJoySticks.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ PushJoySticks_Descriptor::PushJoySticks_Descriptor()
2020
"Push Joy Sticks continously.",
2121
FeedbackType::NONE,
2222
AllowCommandsWhenRunning::DISABLE_COMMANDS,
23-
{SerialPABotBase::OLD_NINTENDO_SWITCH_DEFAULT_REQUIREMENTS}
23+
{ControllerFeature::NintendoSwitch_ProController}
2424
)
2525
{}
2626

SerialPrograms/Source/NintendoSwitch/Programs/NintendoSwitch_TurboA.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ TurboA_Descriptor::TurboA_Descriptor()
2222
"Endlessly mash A.",
2323
FeedbackType::NONE,
2424
AllowCommandsWhenRunning::DISABLE_COMMANDS,
25-
{SerialPABotBase::OLD_NINTENDO_SWITCH_DEFAULT_REQUIREMENTS}
25+
{ControllerFeature::NintendoSwitch_ProController}
2626
)
2727
{}
2828

SerialPrograms/Source/PokemonSV/Programs/Farming/PokemonSV_TournamentFarmer.cpp

Lines changed: 15 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ TournamentFarmer_Descriptor::TournamentFarmer_Descriptor()
3838
"Farm the Academy Ace Tournament for money and prizes.",
3939
FeedbackType::REQUIRED,
4040
AllowCommandsWhenRunning::DISABLE_COMMANDS,
41-
{SerialPABotBase::OLD_NINTENDO_SWITCH_DEFAULT_REQUIREMENTS}
41+
{ControllerFeature::NintendoSwitch_ProController}
4242
)
4343
{}
4444

@@ -552,9 +552,13 @@ void TournamentFarmer::handle_end_of_tournament(SingleSwitchProgramEnvironment&
552552

553553

554554
//Fly to academy from west pokemon center after losing.
555-
void return_to_academy_after_loss(SingleSwitchProgramEnvironment& env, ProControllerContext& context){
555+
void return_to_academy_after_loss(
556+
ProgramEnvironment& env,
557+
VideoStream& stream,
558+
ProControllerContext& context
559+
){
556560
env.log("Tournament lost! Navigating back to academy.");
557-
go_to_academy_fly_point(env, context);
561+
go_to_academy_fly_point(env, stream, context);
558562

559563

560564
pbf_wait(context, 100);
@@ -572,7 +576,7 @@ void return_to_academy_after_loss(SingleSwitchProgramEnvironment& env, ProContro
572576

573577
BlackScreenOverWatcher black_screen(COLOR_RED, { 0.2, 0.2, 0.6, 0.6 });
574578
int ret_black_lost = run_until<ProControllerContext>(
575-
env.console, context,
579+
stream, context,
576580
[](ProControllerContext& context){
577581
pbf_move_left_joystick(context, 128, 0, 5000, 0);
578582
},
@@ -584,8 +588,8 @@ void return_to_academy_after_loss(SingleSwitchProgramEnvironment& env, ProContro
584588
}
585589

586590
//Wait for academy to load.
587-
OverworldWatcher overworld(env.console, COLOR_CYAN);
588-
int ret_academy = wait_until(env.console, context, Milliseconds(4000), { overworld });
591+
OverworldWatcher overworld(stream.logger(), COLOR_CYAN);
592+
int ret_academy = wait_until(stream, context, Milliseconds(4000), { overworld });
589593
if (ret_academy == 0){
590594
env.log("Entered academy. Walking to tournament entry.");
591595
}
@@ -598,19 +602,19 @@ void return_to_academy_after_loss(SingleSwitchProgramEnvironment& env, ProContro
598602
context.wait_for_all_requests();
599603
}
600604

601-
void go_to_academy_fly_point(SingleSwitchProgramEnvironment& env, ProControllerContext& context){
605+
void go_to_academy_fly_point(ProgramEnvironment& env, VideoStream& stream, ProControllerContext& context){
602606
int numAttempts = 0;
603607
int maxAttempts = 5;
604608

605609
bool isFlySuccessful = false;
606610

607611
while (!isFlySuccessful && numAttempts < maxAttempts ){
608-
open_map_from_overworld(env.program_info(), env.console, context);
612+
open_map_from_overworld(env.program_info(), stream, context);
609613
pbf_press_button(context, BUTTON_ZR, 50, 40);
610614
pbf_move_left_joystick(context, 200, 0, 47, 25);
611615
// pbf_move_left_joystick(context, 187, 0, 50, 0);
612616
numAttempts++;
613-
isFlySuccessful = fly_to_overworld_from_map(env.program_info(), env.console, context, true);
617+
isFlySuccessful = fly_to_overworld_from_map(env.program_info(), stream, context, true);
614618
if (!isFlySuccessful){
615619
env.log("Unsuccessful fly attempt.");
616620
}
@@ -621,7 +625,7 @@ void go_to_academy_fly_point(SingleSwitchProgramEnvironment& env, ProControllerC
621625
OperationFailedException::fire(
622626
ErrorReport::SEND_ERROR_REPORT,
623627
"Failed to fly back to academy!",
624-
env.console
628+
stream
625629
);
626630
}
627631

@@ -766,7 +770,7 @@ void TournamentFarmer::program(SingleSwitchProgramEnvironment& env, ProControlle
766770
}
767771

768772
if (battle_lost){
769-
return_to_academy_after_loss(env, context);
773+
return_to_academy_after_loss(env, env.console, context);
770774
break;
771775
}
772776
}

SerialPrograms/Source/PokemonSV/Programs/Farming/PokemonSV_TournamentFarmer.h

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,10 +21,18 @@ namespace NintendoSwitch{
2121
namespace PokemonSV{
2222

2323

24-
void return_to_academy_after_loss(SingleSwitchProgramEnvironment& env, ProControllerContext& context);
24+
void return_to_academy_after_loss(
25+
ProgramEnvironment& env,
26+
VideoStream& stream,
27+
ProControllerContext& context
28+
);
2529

2630
// attempt to fly back to academy fly point from the West Mesogoza Pokecenter. Will attempt maxAttempts times.
27-
void go_to_academy_fly_point(SingleSwitchProgramEnvironment& env, ProControllerContext& context);
31+
void go_to_academy_fly_point(
32+
ProgramEnvironment& env,
33+
VideoStream& stream,
34+
ProControllerContext& context
35+
);
2836

2937
class TournamentFarmer_Descriptor : public SingleSwitchProgramDescriptor{
3038
public:

SerialPrograms/Source/PokemonSV/Programs/Farming/PokemonSV_TournamentFarmer2.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ TournamentFarmer2_Descriptor::TournamentFarmer2_Descriptor()
3535
"Farm the Academy Ace Tournament for money and prizes. (version 2)",
3636
FeedbackType::REQUIRED,
3737
AllowCommandsWhenRunning::DISABLE_COMMANDS,
38-
{SerialPABotBase::OLD_NINTENDO_SWITCH_DEFAULT_REQUIREMENTS}
38+
{ControllerFeature::NintendoSwitch_ProController}
3939
)
4040
{}
4141

@@ -295,7 +295,7 @@ void TournamentFarmer2::program(SingleSwitchProgramEnvironment& env, ProControll
295295

296296

297297
if (battle_lost){
298-
return_to_academy_after_loss(env, context);
298+
return_to_academy_after_loss(env, env.console, context);
299299
break;
300300
}
301301
}

0 commit comments

Comments
 (0)