Skip to content

Commit 778166a

Browse files
committed
Clear out more SwSh programs for SBB.
1 parent eeed056 commit 778166a

File tree

65 files changed

+314
-244
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

65 files changed

+314
-244
lines changed

SerialPrograms/Source/CommonFramework/Globals.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ namespace PokemonAutomation{
2525
const bool IS_BETA_VERSION = true;
2626
const int PROGRAM_VERSION_MAJOR = 0;
2727
const int PROGRAM_VERSION_MINOR = 51;
28-
const int PROGRAM_VERSION_PATCH = 10;
28+
const int PROGRAM_VERSION_PATCH = 11;
2929

3030
const std::string PROGRAM_VERSION_BASE =
3131
"v" + std::to_string(PROGRAM_VERSION_MAJOR) +

SerialPrograms/Source/NintendoSwitch/Commands/NintendoSwitch_Commands_Routines.cpp

Lines changed: 22 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -6,13 +6,19 @@
66

77
//#include <sstream>
88
#include "ClientSource/Libraries/MessageConverter.h"
9-
#include "NintendoSwitch/Inference/NintendoSwitch_DetectHome.h"
109
#include "CommonFramework/VideoPipeline/VideoFeed.h"
1110
#include "CommonTools/Async/InferenceRoutines.h"
11+
#include "NintendoSwitch/NintendoSwitch_Settings.h"
1212
#include "NintendoSwitch_Commands_Routines.h"
1313
#include "NintendoSwitch_Commands_PushButtons.h"
14+
#include "NintendoSwitch_Commands_Superscalar.h"
15+
#include "NintendoSwitch/Inference/NintendoSwitch_DetectHome.h"
1416
//#include "NintendoSwitch_Messages_Routines.h"
1517

18+
//#include <iostream>
19+
//using std::cout;
20+
//using std::endl;
21+
1622
namespace PokemonAutomation{
1723
namespace NintendoSwitch{
1824

@@ -24,14 +30,18 @@ void close_game(VideoStream& stream, ProControllerContext& context){
2430
// this sequence will close the game from the home screen,
2531
// regardless of whether the game is initially open or closed.
2632

27-
// if game initially open. | if game initially closed
28-
pbf_mash_button(context, BUTTON_X, 100); // - Close game. | - does nothing
29-
pbf_press_dpad(context, DPAD_DOWN, 50, 50); // - Does nothing. | - moves selector away from the closed game to avoid opening it.
30-
pbf_press_dpad(context, DPAD_DOWN, 50, 50); // - Does nothing. | - Press Down a second time in case we drop one.
31-
pbf_mash_button(context, BUTTON_A, 50); // - Confirm close game. | - opens an app on the home screen (e.g. Online)
32-
pbf_press_button(context, BUTTON_HOME, 50, 50); // - Does nothing. | - goes back to home screen.
33+
// if game initially open. | if game initially closed
34+
pbf_mash_button(context, BUTTON_X, 100); // - Close game. | - does nothing
35+
ssf_press_dpad_ptv(context, DPAD_DOWN); // - Does nothing. | - moves selector away from the closed game to avoid opening it.
36+
ssf_press_dpad_ptv(context, DPAD_DOWN); // - Does nothing. | - Press Down a second time in case we drop one.
37+
pbf_mash_button(context, BUTTON_A, 50); // - Confirm close game. | - opens an app on the home screen (e.g. Online)
38+
// - Does nothing. | - goes back to home screen.
39+
pbf_press_button(context, BUTTON_HOME, 160ms, ConsoleSettings::instance().SETTINGS_TO_HOME_DELAY0);
3340
context.wait_for_all_requests();
3441

42+
// cout << "waiting..." << endl;
43+
// context.wait_for(10s);
44+
3545
// send a second Home button press, if the first one is dropped
3646
bool video_available = (bool)stream.video().snapshot();
3747
if (video_available){
@@ -43,15 +53,17 @@ void close_game(VideoStream& stream, ProControllerContext& context){
4353
);
4454
if (ret == 0){
4555
stream.log("Detected Home screen.");
46-
}else{ // if game initially open. | if game initially closed
56+
}else{ // if game initially open. | if game initially closed
4757
// initial Home button press was dropped
48-
pbf_press_button(context, BUTTON_HOME, 50, 50); // - Does nothing. | - goes back to home screen, from opened app
58+
// - Does nothing. | - goes back to home screen, from opened app
59+
pbf_press_button(context, BUTTON_HOME, 160ms, ConsoleSettings::instance().SETTINGS_TO_HOME_DELAY0);
4960
}
5061
}else{
5162
// - wait some time after first Home button press
5263
// to avoid triggering zoom
5364
context.wait_for(std::chrono::milliseconds(1000));
54-
pbf_press_button(context, BUTTON_HOME, 50, 50); // - Does nothing. | - Press Home a second time in case we drop one.
65+
// - Does nothing. | - Press Home a second time in case we drop one.
66+
pbf_press_button(context, BUTTON_HOME, 160ms, ConsoleSettings::instance().SETTINGS_TO_HOME_DELAY0);
5567
}
5668

5769

SerialPrograms/Source/NintendoSwitch/Commands/NintendoSwitch_Commands_Superscalar.h

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -128,6 +128,20 @@ inline void ssf_press_button_ptv(
128128
cool + context->timing_variation()
129129
);
130130
}
131+
inline void ssf_press_dpad_ptv(
132+
ProControllerContext& context,
133+
DpadPosition position,
134+
Milliseconds delay = 3*8ms,
135+
Milliseconds hold = 5*8ms,
136+
Milliseconds cool = 3*8ms
137+
){
138+
ssf_press_dpad(
139+
context, position,
140+
delay + context->timing_variation(),
141+
hold + context->timing_variation(),
142+
cool + context->timing_variation()
143+
);
144+
}
131145
inline void ssf_issue_scroll_ptv(
132146
ProControllerContext& context,
133147
DpadPosition direction,

SerialPrograms/Source/NintendoSwitch/Programs/NintendoSwitch_FriendDelete.cpp

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,8 @@ FriendDelete_Descriptor::FriendDelete_Descriptor()
2020
"Mass delete/block all those unwanted friends.",
2121
FeedbackType::NONE,
2222
AllowCommandsWhenRunning::DISABLE_COMMANDS,
23-
{SerialPABotBase::OLD_NINTENDO_SWITCH_DEFAULT_REQUIREMENTS}
23+
{ControllerFeature::NintendoSwitch_ProController},
24+
FasterIfTickPrecise::NOT_FASTER
2425
)
2526
{}
2627

@@ -59,21 +60,21 @@ FriendDelete::FriendDelete()
5960
PA_ADD_OPTION(FINISH_DELETE_DELAY0);
6061
}
6162
void FriendDelete::program(SingleSwitchProgramEnvironment& env, ProControllerContext& context){
62-
pbf_press_button(context, BUTTON_A, 5, 5);
63+
pbf_press_button(context, BUTTON_A, 10, 20);
6364

6465
for (uint16_t c = 0; c < FRIENDS_TO_DELETE; c++){
6566
pbf_press_button(context, BUTTON_A, 40ms, VIEW_FRIEND_DELAY0); // View friend
66-
pbf_press_dpad(context, DPAD_DOWN, 5, 5);
67+
pbf_press_dpad(context, DPAD_DOWN, 10, 20);
6768
pbf_press_button(context, BUTTON_A, 10, 90); // Click on Options
6869
if (BLOCK_FRIENDS){
69-
pbf_press_dpad(context, DPAD_DOWN, 5, 5);
70+
pbf_press_dpad(context, DPAD_DOWN, 10, 20);
7071
}
7172
pbf_press_button(context, BUTTON_A, 10, 90); // Click on Remove/Block Friend
7273
if (BLOCK_FRIENDS){
73-
pbf_press_button(context, BUTTON_A, 40ms, VIEW_FRIEND_DELAY0); // Confirm
74+
pbf_press_button(context, BUTTON_A, 80ms, VIEW_FRIEND_DELAY0); // Confirm
7475
}
75-
pbf_press_button(context, BUTTON_A, 40ms, DELETE_FRIEND_DELAY0); // Confirm
76-
pbf_press_button(context, BUTTON_A, 40ms, FINISH_DELETE_DELAY0); // Finish delete friend.
76+
pbf_press_button(context, BUTTON_A, 80ms, DELETE_FRIEND_DELAY0); // Confirm
77+
pbf_press_button(context, BUTTON_A, 80ms, FINISH_DELETE_DELAY0); // Finish delete friend.
7778
}
7879
}
7980

SerialPrograms/Source/NintendoSwitch/Programs/NintendoSwitch_GameEntry.cpp

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -119,7 +119,7 @@ void start_game_from_home_with_inference(
119119
}
120120

121121
if (game_slot != 0){
122-
ssf_press_button(context, BUTTON_HOME, ConsoleSettings::instance().SETTINGS_TO_HOME_DELAY0, 80ms);
122+
ssf_press_button(context, BUTTON_HOME, 160ms, ConsoleSettings::instance().SETTINGS_TO_HOME_DELAY0);
123123
for (uint8_t c = 1; c < game_slot; c++){
124124
pbf_press_dpad(context, DPAD_RIGHT, 5, 5);
125125
}
@@ -200,9 +200,9 @@ void start_game_from_home(
200200
}
201201

202202
if (game_slot != 0){
203-
ssf_press_button(context, BUTTON_HOME, ConsoleSettings::instance().SETTINGS_TO_HOME_DELAY0, 80ms);
203+
ssf_press_button(context, BUTTON_HOME, 160ms, ConsoleSettings::instance().SETTINGS_TO_HOME_DELAY0);
204204
for (uint8_t c = 1; c < game_slot; c++){
205-
pbf_press_dpad(context, DPAD_RIGHT, 5, 5);
205+
ssf_press_dpad_ptv(context, DPAD_RIGHT, 80ms);
206206
}
207207
}
208208

@@ -216,8 +216,8 @@ void start_game_from_home(
216216

217217
// If the update menu isn't there, these will get swallowed by the opening
218218
// animation for the select user menu.
219-
pbf_press_button(context, BUTTON_A, 5, 175); // Choose game
220-
pbf_press_dpad(context, DPAD_UP, 5, 0); // Skip the update window.
219+
pbf_press_button(context, BUTTON_A, 10, 175); // Choose game
220+
pbf_press_dpad(context, DPAD_UP, 10, 0); // Skip the update window.
221221
move_to_user(context, user_slot);
222222
}
223223

@@ -226,9 +226,9 @@ void start_game_from_home(
226226
// Mash your way into the game.
227227
pbf_mash_button(context, BUTTON_A, start_game_mash);
228228
}else{
229-
pbf_press_button(context, BUTTON_A, 5, 175); // Enter select user menu.
229+
pbf_press_button(context, BUTTON_A, 10, 175); // Enter select user menu.
230230
move_to_user(context, user_slot);
231-
pbf_press_button(context, BUTTON_A, 5, 5); // Enter game
231+
ssf_press_button_ptv(context, BUTTON_A, 120ms); // Enter game
232232

233233
// Switch to mashing ZL instead of A to get into the game.
234234
// Mash your way into the game.

SerialPrograms/Source/Pokemon/Pokemon_Notification.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ std::string shiny_symbol(ShinyType shiny_type){
3737
case ShinyType::STAR_SHINY:
3838
return "\u2728";
3939
case ShinyType::SQUARE_SHINY:
40-
return "\u2733"; // Green square asterisk
40+
return ":purple_square:";
4141
default:
4242
return "";
4343
}

SerialPrograms/Source/PokemonSwSh/Commands/PokemonSwSh_Commands_DateSpam.cpp

Lines changed: 36 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -144,16 +144,16 @@ void home_roll_date_enter_game(
144144

145145
if (rollback_year){
146146
roll_date_backward_N(context, MAX_YEAR, true);
147-
ssf_press_button(context, BUTTON_A, 20, 10);
148-
ssf_issue_scroll(context, SSF_SCROLL_LEFT, 3);
149-
ssf_issue_scroll(context, SSF_SCROLL_LEFT, 3);
150-
ssf_issue_scroll(context, SSF_SCROLL_LEFT, 3);
151-
ssf_issue_scroll(context, SSF_SCROLL_UP, 2);
152-
ssf_issue_scroll(context, SSF_SCROLL_LEFT, 3);
153-
ssf_issue_scroll(context, SSF_SCROLL_UP, 2);
154-
ssf_issue_scroll(context, SSF_SCROLL_LEFT, 3);
155-
// ssf_issue_scroll(context, SSF_SCROLL_LEFT, 3);
156-
ssf_issue_scroll(context, SSF_SCROLL_UP, 2);
147+
ssf_press_button_ptv(context, BUTTON_A, 160ms, 80ms);
148+
ssf_issue_scroll_ptv(context, SSF_SCROLL_LEFT, 24ms);
149+
ssf_issue_scroll_ptv(context, SSF_SCROLL_LEFT, 24ms);
150+
ssf_issue_scroll_ptv(context, SSF_SCROLL_LEFT, 24ms);
151+
ssf_issue_scroll_ptv(context, SSF_SCROLL_UP, 16ms);
152+
ssf_issue_scroll_ptv(context, SSF_SCROLL_LEFT, 24ms);
153+
ssf_issue_scroll_ptv(context, SSF_SCROLL_UP, 16ms);
154+
ssf_issue_scroll_ptv(context, SSF_SCROLL_LEFT, 24ms);
155+
// ssf_issue_scroll_ptv(context, SSF_SCROLL_LEFT, 24ms);
156+
ssf_issue_scroll_ptv(context, SSF_SCROLL_UP, 16ms);
157157
}else{
158158
roll_date_forward_1(context, true);
159159
}
@@ -166,23 +166,23 @@ void touch_date_from_home(ProControllerContext& context, Milliseconds settings_t
166166
// Touch the date without changing it. This prevents unintentional rollovers.
167167

168168
home_to_date_time(context, true, true);
169-
ssf_press_button(context, BUTTON_A, 20, 10);
170-
171-
ssf_press_button(context, BUTTON_A, 0);
172-
ssf_issue_scroll(context, SSF_SCROLL_RIGHT, 3);
173-
ssf_issue_scroll(context, SSF_SCROLL_RIGHT, 3);
174-
ssf_issue_scroll(context, SSF_SCROLL_RIGHT, 3);
175-
ssf_press_button(context, BUTTON_A, 0);
176-
ssf_issue_scroll(context, SSF_SCROLL_RIGHT, 3);
177-
178-
ssf_issue_scroll(context, SSF_SCROLL_LEFT, 3);
179-
ssf_issue_scroll(context, SSF_SCROLL_UP, 2);
180-
ssf_issue_scroll(context, SSF_SCROLL_RIGHT, 0);
181-
ssf_press_button(context, BUTTON_A, 20, 10);
182-
183-
ssf_press_button(context, BUTTON_A, 20, 10);
184-
ssf_issue_scroll(context, SSF_SCROLL_LEFT, 3);
185-
ssf_issue_scroll(context, SSF_SCROLL_DOWN, 2);
169+
ssf_press_button_ptv(context, BUTTON_A, 160ms, 80ms);
170+
171+
ssf_press_button_ptv(context, BUTTON_A, 0ms);
172+
ssf_issue_scroll_ptv(context, SSF_SCROLL_RIGHT);
173+
ssf_issue_scroll_ptv(context, SSF_SCROLL_RIGHT);
174+
ssf_issue_scroll_ptv(context, SSF_SCROLL_RIGHT);
175+
ssf_press_button_ptv(context, BUTTON_A, 0ms);
176+
ssf_issue_scroll_ptv(context, SSF_SCROLL_RIGHT);
177+
178+
ssf_issue_scroll_ptv(context, SSF_SCROLL_LEFT);
179+
ssf_issue_scroll_ptv(context, SSF_SCROLL_UP, 16ms);
180+
ssf_issue_scroll_ptv(context, SSF_SCROLL_RIGHT, 0ms);
181+
ssf_press_button_ptv(context, BUTTON_A, 160ms, 80ms);
182+
183+
ssf_press_button_ptv(context, BUTTON_A, 160ms, 80ms);
184+
ssf_issue_scroll_ptv(context, SSF_SCROLL_LEFT);
185+
ssf_issue_scroll_ptv(context, SSF_SCROLL_DOWN, 16ms);
186186
ssf_press_button(context, BUTTON_HOME, settings_to_home_delay, 80ms);
187187
}
188188
void rollback_hours_from_home(
@@ -191,19 +191,19 @@ void rollback_hours_from_home(
191191
Milliseconds settings_to_home_delay
192192
){
193193
home_to_date_time(context, true, false);
194-
ssf_press_button(context, BUTTON_A, 20, 10);
194+
ssf_press_button_ptv(context, BUTTON_A, 160ms, 80ms);
195195

196-
ssf_press_button(context, BUTTON_A, 0);
197-
ssf_issue_scroll(context, SSF_SCROLL_RIGHT, 3);
198-
ssf_issue_scroll(context, SSF_SCROLL_RIGHT, 3);
196+
ssf_press_button_ptv(context, BUTTON_A, 0ms);
197+
ssf_issue_scroll_ptv(context, SSF_SCROLL_RIGHT);
198+
ssf_issue_scroll_ptv(context, SSF_SCROLL_RIGHT);
199199
for (uint8_t c = 0; c < hours; c++){
200-
ssf_issue_scroll(context, SSF_SCROLL_DOWN, 3);
200+
ssf_issue_scroll_ptv(context, SSF_SCROLL_DOWN);
201201
}
202-
ssf_press_button(context, BUTTON_A, 0);
203-
ssf_issue_scroll(context, SSF_SCROLL_RIGHT, 3);
204-
ssf_issue_scroll(context, SSF_SCROLL_RIGHT, 3);
202+
ssf_press_button_ptv(context, BUTTON_A, 0ms);
203+
ssf_issue_scroll_ptv(context, SSF_SCROLL_RIGHT);
204+
ssf_issue_scroll_ptv(context, SSF_SCROLL_RIGHT);
205205

206-
ssf_press_button(context, BUTTON_A, 20, 10);
206+
ssf_press_button_ptv(context, BUTTON_A, 160ms, 80ms);
207207
ssf_press_button(context, BUTTON_HOME, settings_to_home_delay, 80ms);
208208
}
209209

SerialPrograms/Source/PokemonSwSh/Commands/PokemonSwSh_Commands_GameEntry.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -135,7 +135,7 @@ void start_game_from_home(
135135
// If "user_slot" is zero, it uses whatever the cursor is on.
136136

137137
if (game_slot != 0){
138-
ssf_press_button(context, BUTTON_HOME, ConsoleSettings::instance().SETTINGS_TO_HOME_DELAY0, 80ms);
138+
ssf_press_button(context, BUTTON_HOME, 160ms, ConsoleSettings::instance().SETTINGS_TO_HOME_DELAY0);
139139
for (uint8_t c = 1; c < game_slot; c++){
140140
pbf_press_dpad(context, DPAD_RIGHT, 5, 5);
141141
}

SerialPrograms/Source/PokemonSwSh/InferenceTraining/PokemonSwSh_GenerateIVCheckerOCR.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ GenerateIVCheckerOCR_Descriptor::GenerateIVCheckerOCR_Descriptor()
3636
"Generate IV Checker OCR Data",
3737
FeedbackType::REQUIRED,
3838
AllowCommandsWhenRunning::DISABLE_COMMANDS,
39-
{SerialPABotBase::OLD_NINTENDO_SWITCH_DEFAULT_REQUIREMENTS}
39+
{ControllerFeature::NintendoSwitch_ProController}
4040
)
4141
{}
4242

SerialPrograms/Source/PokemonSwSh/InferenceTraining/PokemonSwSh_GenerateNameOCRPokedex.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ GenerateNameOCRDataPokedex_Descriptor::GenerateNameOCRDataPokedex_Descriptor()
3535
"Generate " + STRING_POKEMON + " Name OCR data by iterating the " + STRING_POKEDEX + ".",
3636
FeedbackType::REQUIRED,
3737
AllowCommandsWhenRunning::DISABLE_COMMANDS,
38-
{SerialPABotBase::OLD_NINTENDO_SWITCH_DEFAULT_REQUIREMENTS}
38+
{ControllerFeature::NintendoSwitch_ProController}
3939
)
4040
{}
4141

0 commit comments

Comments
 (0)