Skip to content

Commit dc2deb0

Browse files
committed
Remove old C ssf API.
1 parent f093997 commit dc2deb0

14 files changed

+79
-132
lines changed

SerialPrograms/Source/NintendoSwitch/Commands/NintendoSwitch_Commands_Superscalar.h

Lines changed: 2 additions & 55 deletions
Original file line numberDiff line numberDiff line change
@@ -29,12 +29,13 @@ void ssf_do_nothing (ProControllerContext& context, uint16_t ticks);
2929
void ssf_do_nothing (ProControllerContext& context, Milliseconds duration);
3030

3131

32-
32+
#if 1
3333
void ssf_press_button(
3434
ProControllerContext& context,
3535
Button button,
3636
uint16_t delay, uint16_t hold = 5, uint8_t cool = 3
3737
);
38+
#endif
3839
void ssf_press_button(
3940
ProControllerContext& context,
4041
Button button,
@@ -188,60 +189,6 @@ inline void ssf_issue_scroll_ptv(
188189

189190

190191

191-
//
192-
// The C API used by the MC programs. (no overloading allowed there)
193-
//
194-
195-
inline void ssf_press_button2(
196-
ProControllerContext& context,
197-
Button button, uint16_t duration, uint16_t hold
198-
){
199-
ssf_press_button(context, button, duration, hold);
200-
}
201-
inline void ssf_press_button1(
202-
ProControllerContext& context,
203-
Button button, uint16_t duration
204-
){
205-
ssf_press_button(context, button, duration);
206-
}
207-
inline void ssf_press_dpad2(
208-
ProControllerContext& context,
209-
DpadPosition dpad, uint16_t duration, uint16_t hold
210-
){
211-
ssf_press_dpad(context, dpad, duration, hold);
212-
}
213-
inline void ssf_press_dpad1(
214-
ProControllerContext& context,
215-
DpadPosition dpad, uint16_t duration
216-
){
217-
ssf_press_dpad(context, dpad, duration);
218-
}
219-
inline void ssf_press_joystick2(
220-
ProControllerContext& context,
221-
bool left, uint8_t x, uint8_t y,
222-
uint16_t duration, uint16_t hold
223-
){
224-
if (left){
225-
ssf_press_left_joystick(context, x, y, duration, hold);
226-
}else{
227-
ssf_press_right_joystick(context, x, y, duration, hold);
228-
}
229-
}
230-
inline void ssf_hold_joystick1(
231-
ProControllerContext& context,
232-
bool left, uint8_t x, uint8_t y,
233-
uint16_t hold
234-
){
235-
if (left){
236-
ssf_press_left_joystick(context, x, y, hold, hold);
237-
}else{
238-
ssf_press_right_joystick(context, x, y, hold, hold);
239-
}
240-
}
241-
242-
243-
244-
245192

246193
void ssf_flush_pipeline (JoyconContext& context);
247194
void ssf_do_nothing (JoyconContext& context, Milliseconds duration);

SerialPrograms/Source/NintendoSwitch/Programs/DateSpam/NintendoSwitch1_HomeToDateTime.cpp

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -36,8 +36,8 @@ void home_to_date_time_Switch1_wired_blind(
3636
ssf_issue_scroll(context, SSF_SCROLL_LEFT, 0);
3737

3838
// Two A presses in case we drop the 1st one.
39-
ssf_press_button(context, BUTTON_A, 3);
40-
ssf_press_button(context, BUTTON_A, 3);
39+
ssf_press_button(context, BUTTON_A, 24ms, 40ms, 24ms);
40+
ssf_press_button(context, BUTTON_A, 24ms, 48ms, 24ms);
4141

4242
// Just button mash it. lol
4343
{
@@ -50,7 +50,7 @@ void home_to_date_time_Switch1_wired_blind(
5050
// Scroll left and press A to exit the sleep menu if we happened to
5151
// land there.
5252
ssf_issue_scroll(context, SSF_SCROLL_LEFT, 3);
53-
ssf_press_button(context, BUTTON_A, 3);
53+
ssf_press_button(context, BUTTON_A, 24ms, 48ms, 24ms);
5454

5555
{
5656
auto iterations = Milliseconds(312) / 24ms + 1;
@@ -68,16 +68,16 @@ void home_to_date_time_Switch1_wired_blind(
6868

6969
if (!to_date_change){
7070
// Triple up this A press to make sure it gets through.
71-
ssf_press_button(context, BUTTON_A, 3);
72-
ssf_press_button(context, BUTTON_A, 3);
73-
ssf_press_button(context, BUTTON_A, 45);
71+
ssf_press_button(context, BUTTON_A, 24ms, 48ms, 24ms);
72+
ssf_press_button(context, BUTTON_A, 24ms, 48ms, 24ms);
73+
ssf_press_button(context, BUTTON_A, 360ms, 48ms, 24ms);
7474
return;
7575
}
7676

7777
// Triple up this A press to make sure it gets through.
78-
ssf_press_button(context, BUTTON_A, 3);
79-
ssf_press_button(context, BUTTON_A, 3);
80-
ssf_press_button(context, BUTTON_A, 3);
78+
ssf_press_button(context, BUTTON_A, 24ms, 48ms, 24ms);
79+
ssf_press_button(context, BUTTON_A, 24ms, 48ms, 24ms);
80+
ssf_press_button(context, BUTTON_A, 24ms, 48ms, 24ms);
8181
{
8282
auto iterations = Milliseconds(250) / 24ms + 1;
8383
do{
@@ -235,8 +235,8 @@ void home_to_date_time_Switch1_wired_feedback(
235235

236236
// Two A presses in case we drop the 1st one.
237237
// the program can self recover even if the second button press is registered.
238-
ssf_press_button(context, BUTTON_A, 3);
239-
ssf_press_button(context, BUTTON_A, 3);
238+
ssf_press_button(context, BUTTON_A, 24ms, 40ms, 24ms);
239+
ssf_press_button(context, BUTTON_A, 24ms, 48ms, 24ms);
240240

241241
// Just button mash it. lol
242242
{
@@ -285,7 +285,7 @@ void home_to_date_time_Switch1_wired_feedback(
285285

286286
// only one ButtonA press since the program can self-recover if the button is dropped.
287287
// furthermore, the program can't self-recover if a second button press is registered.
288-
ssf_press_button(context, BUTTON_A, 3);
288+
ssf_press_button(context, BUTTON_A, 24ms, 48ms, 24ms);
289289

290290
context.wait_for_all_requests();
291291
context.wait_for(Milliseconds(300));

SerialPrograms/Source/NintendoSwitch/Programs/DateSpam/NintendoSwitch_RollDateBackwardN.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ namespace NintendoSwitch{
1717
void roll_date_backward_N_Switch1_wired(ProControllerContext& context, uint8_t skips, bool fast){
1818
uint8_t scroll_delay = fast ? 3 : 4;
1919
uint8_t up_delay = 3;
20-
ssf_press_button(context, BUTTON_A, 20, 10);
20+
ssf_press_button(context, BUTTON_A, 160ms, 80ms);
2121
for (uint8_t c = 0; c < skips - 1; c++){
2222
ssf_issue_scroll(context, SSF_SCROLL_DOWN, up_delay);
2323
}
@@ -50,7 +50,7 @@ void roll_date_backward_N_Switch1_wired(ProControllerContext& context, uint8_t s
5050
ssf_press_button(context, BUTTON_A);
5151
#endif
5252

53-
ssf_press_button(context, BUTTON_A, 20, 10);
53+
ssf_press_button(context, BUTTON_A, 160ms, 80ms);
5454
}
5555
void roll_date_backward_N_Switch1_wireless(ProControllerContext& context, uint8_t skips){
5656
Milliseconds tv = context->timing_variation();

SerialPrograms/Source/NintendoSwitch/Programs/NintendoSwitch_PreventSleep.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ PreventSleep::PreventSleep(){}
2929

3030
void PreventSleep::program(SingleSwitchProgramEnvironment& env, ProControllerContext& context){
3131
while (true){
32-
ssf_press_button2(context, BUTTON_B, 15 * TICKS_PER_SECOND, 10);
32+
ssf_press_button(context, BUTTON_B, 15000ms, 80ms);
3333
}
3434
}
3535

SerialPrograms/Source/PokemonRSE/Programs/ShinyHunting/PokemonRSE_ShinyHunt-Deoxys.cpp

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -105,7 +105,7 @@ void ShinyHuntDeoxys::solve_puzzle(SingleSwitchProgramEnvironment& env, ProContr
105105
pbf_press_dpad(context, DPAD_RIGHT, 10, 50);
106106
pbf_press_dpad(context, DPAD_RIGHT, 10, 50);
107107

108-
ssf_press_button(context, BUTTON_B, 0, 90);
108+
ssf_press_button(context, BUTTON_B, 0ms, 720ms);
109109
pbf_press_dpad(context, DPAD_UP, 90, 50);
110110

111111
pbf_press_button(context, BUTTON_A, 20, 40);
@@ -118,7 +118,7 @@ void ShinyHuntDeoxys::solve_puzzle(SingleSwitchProgramEnvironment& env, ProContr
118118
pbf_press_dpad(context, DPAD_RIGHT, 10, 50);
119119
pbf_press_dpad(context, DPAD_RIGHT, 10, 50);
120120

121-
ssf_press_button(context, BUTTON_B, 0, 90);
121+
ssf_press_button(context, BUTTON_B, 0ms, 720ms);
122122
pbf_press_dpad(context, DPAD_DOWN, 90, 50);
123123

124124
pbf_press_button(context, BUTTON_A, 20, 40);
@@ -129,14 +129,14 @@ void ShinyHuntDeoxys::solve_puzzle(SingleSwitchProgramEnvironment& env, ProContr
129129
pbf_press_dpad(context, DPAD_UP, 10, 50);
130130
pbf_press_dpad(context, DPAD_UP, 10, 50);
131131

132-
ssf_press_button(context, BUTTON_B, 0, 115);
132+
ssf_press_button(context, BUTTON_B, 0ms, 920ms);
133133
pbf_press_dpad(context, DPAD_LEFT, 115, 50);
134134

135135
pbf_press_button(context, BUTTON_A, 20, 40);
136136
context.wait_for_all_requests();
137137

138138
env.log("Step 6: 5 Right.");
139-
ssf_press_button(context, BUTTON_B, 0, 100);
139+
ssf_press_button(context, BUTTON_B, 0ms, 800ms);
140140
pbf_press_dpad(context, DPAD_RIGHT, 100, 50);
141141

142142
pbf_press_button(context, BUTTON_A, 20, 40);
@@ -147,7 +147,7 @@ void ShinyHuntDeoxys::solve_puzzle(SingleSwitchProgramEnvironment& env, ProContr
147147
pbf_press_dpad(context, DPAD_LEFT, 10, 50);
148148
pbf_press_dpad(context, DPAD_LEFT, 10, 50);
149149

150-
ssf_press_button(context, BUTTON_B, 0, 60);
150+
ssf_press_button(context, BUTTON_B, 0ms, 480ms);
151151
pbf_press_dpad(context, DPAD_DOWN, 60, 50);
152152

153153
pbf_press_button(context, BUTTON_A, 20, 40);
@@ -156,14 +156,14 @@ void ShinyHuntDeoxys::solve_puzzle(SingleSwitchProgramEnvironment& env, ProContr
156156
env.log("Step 8: 1 Down, 4 Left.");
157157
pbf_press_dpad(context, DPAD_DOWN, 10, 50);
158158

159-
ssf_press_button(context, BUTTON_B, 0, 80);
159+
ssf_press_button(context, BUTTON_B, 0ms, 640ms);
160160
pbf_press_dpad(context, DPAD_LEFT, 80, 50);
161161

162162
pbf_press_button(context, BUTTON_A, 20, 40);
163163
context.wait_for_all_requests();
164164

165165
env.log("Step 8: 7 Right.");
166-
ssf_press_button(context, BUTTON_B, 0, 115);
166+
ssf_press_button(context, BUTTON_B, 0ms, 920ms);
167167
pbf_press_dpad(context, DPAD_RIGHT, 115, 50);
168168

169169
pbf_press_button(context, BUTTON_A, 20, 40);
@@ -181,7 +181,7 @@ void ShinyHuntDeoxys::solve_puzzle(SingleSwitchProgramEnvironment& env, ProContr
181181
context.wait_for_all_requests();
182182

183183
env.log("Step 10: 4 Up.");
184-
ssf_press_button(context, BUTTON_B, 0, 80);
184+
ssf_press_button(context, BUTTON_B, 0ms, 640ms);
185185
pbf_press_dpad(context, DPAD_UP, 80, 80);
186186
context.wait_for_all_requests();
187187
}

SerialPrograms/Source/PokemonSwSh/Programs/DenHunting/PokemonSwSh_DaySkipperEU.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -143,7 +143,7 @@ void DaySkipperEU::run_switch1(SingleSwitchProgramEnvironment& env, ProControlle
143143

144144
pbf_wait(context, 15 * TICKS_PER_SECOND);
145145
while (true){
146-
ssf_press_button1(context, BUTTON_A, 15 * TICKS_PER_SECOND);
146+
ssf_press_button(context, BUTTON_A, 15000ms);
147147
}
148148
}
149149
void DaySkipperEU::run_switch2(SingleSwitchProgramEnvironment& env, ProControllerContext& context){

SerialPrograms/Source/PokemonSwSh/Programs/DenHunting/PokemonSwSh_DaySkipperJPN-7.8k.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -219,7 +219,7 @@ void DaySkipperJPN7p8k::program(SingleSwitchProgramEnvironment& env, ProControll
219219

220220
pbf_wait(context, 15 * TICKS_PER_SECOND);
221221
while (true){
222-
ssf_press_button1(context, BUTTON_A, 15 * TICKS_PER_SECOND);
222+
ssf_press_button(context, BUTTON_A, 15000ms);
223223
}
224224
}
225225

SerialPrograms/Source/PokemonSwSh/Programs/DenHunting/PokemonSwSh_DaySkipperJPN.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -124,7 +124,7 @@ void DaySkipperJPN::run_switch1(SingleSwitchProgramEnvironment& env, ProControll
124124

125125
pbf_wait(context, 15 * TICKS_PER_SECOND);
126126
while (true){
127-
ssf_press_button1(context, BUTTON_A, 15 * TICKS_PER_SECOND);
127+
ssf_press_button(context, BUTTON_A, 15000ms);
128128
}
129129
}
130130
void DaySkipperJPN::run_switch2(SingleSwitchProgramEnvironment& env, ProControllerContext& context){

SerialPrograms/Source/PokemonSwSh/Programs/DenHunting/PokemonSwSh_DaySkipperUS.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -142,7 +142,7 @@ void DaySkipperUS::run_switch1(SingleSwitchProgramEnvironment& env, ProControlle
142142

143143
pbf_wait(context, 15 * TICKS_PER_SECOND);
144144
while (true){
145-
ssf_press_button1(context, BUTTON_A, 15 * TICKS_PER_SECOND);
145+
ssf_press_button(context, BUTTON_A, 15000ms);
146146
}
147147
}
148148
void DaySkipperUS::run_switch2(SingleSwitchProgramEnvironment& env, ProControllerContext& context){

SerialPrograms/Source/PokemonSwSh/Programs/DenHunting/PokemonSwSh_EventBeamFinder.cpp

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -46,22 +46,22 @@ EventBeamFinder::EventBeamFinder()
4646

4747

4848
void EventBeamFinder::goto_near_den(ProControllerContext& context) const{
49-
ssf_hold_joystick1(context, true, STICK_CENTER, STICK_MIN, 375);
49+
ssf_press_left_joystick(context, STICK_CENTER, STICK_MIN, 375, 375);
5050
pbf_wait(context, 50);
51-
ssf_press_button1(context, BUTTON_PLUS, 100);
52-
ssf_press_joystick2(context, true, STICK_MAX, STICK_CENTER, 100, 5);
53-
ssf_press_button1(context, BUTTON_L, 100);
54-
ssf_press_button1(context, BUTTON_PLUS, 100);
55-
ssf_hold_joystick1(context, true, STICK_CENTER, STICK_MIN, 370);
51+
ssf_press_button(context, BUTTON_PLUS, 100);
52+
ssf_press_left_joystick(context, STICK_MAX, STICK_CENTER, 100, 5);
53+
ssf_press_button(context, BUTTON_L, 100);
54+
ssf_press_button(context, BUTTON_PLUS, 100);
55+
ssf_press_left_joystick(context, STICK_CENTER, STICK_MIN, 370, 370);
5656
}
5757
void EventBeamFinder::goto_far_den(ProControllerContext& context) const{
58-
ssf_hold_joystick1(context, true, STICK_CENTER, STICK_MIN, 992);
58+
ssf_press_left_joystick(context, STICK_CENTER, STICK_MIN, 992, 992);
5959
pbf_wait(context, 50);
60-
ssf_press_button1(context, BUTTON_PLUS, 100);
61-
ssf_press_joystick2(context, true, STICK_MIN, STICK_CENTER, 100, 5);
62-
ssf_press_button1(context, BUTTON_L, 100);
63-
ssf_press_button1(context, BUTTON_PLUS, 100);
64-
ssf_hold_joystick1(context, true, STICK_CENTER, STICK_MIN, 300);
60+
ssf_press_button(context, BUTTON_PLUS, 100);
61+
ssf_press_left_joystick(context, STICK_MIN, STICK_CENTER, 100, 5);
62+
ssf_press_button(context, BUTTON_L, 100);
63+
ssf_press_button(context, BUTTON_PLUS, 100);
64+
ssf_press_left_joystick(context, STICK_CENTER, STICK_MIN, 300, 300);
6565
}
6666
void EventBeamFinder::drop_wishing_piece(ProControllerContext& context) const{
6767
ssf_press_button(context, BUTTON_A, 200, 10);

0 commit comments

Comments
 (0)