Skip to content

Commit deecbef

Browse files
committed
More joystick migration.
1 parent 487b5ea commit deecbef

20 files changed

+52
-71
lines changed

SerialPrograms/Source/NintendoSwitch/Commands/NintendoSwitch_Commands_PushButtons.cpp

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -102,11 +102,6 @@ void pbf_wait(JoyconContext& context, Milliseconds duration){
102102
void pbf_press_button(JoyconContext& context, Button button, Milliseconds hold, Milliseconds release){
103103
ssf_press_button(context, button, hold + release, hold, 0ms);
104104
}
105-
#if 0
106-
void pbf_move_joystick(JoyconContext& context, uint8_t x, uint8_t y, Milliseconds hold, Milliseconds release){
107-
ssf_press_joystick(context, x, y, hold + release, hold, 0ms);
108-
}
109-
#endif
110105
void pbf_move_joystick(JoyconContext& context, const JoystickPosition& position, Milliseconds hold, Milliseconds release){
111106
ssf_press_joystick(context, position, hold + release, hold, 0ms);
112107
}

SerialPrograms/Source/NintendoSwitch/Commands/NintendoSwitch_Commands_PushButtons.h

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -112,7 +112,6 @@ void pbf_controller_state(
112112

113113
void pbf_wait (JoyconContext& context, Milliseconds duration);
114114
void pbf_press_button (JoyconContext& context, Button button, Milliseconds hold, Milliseconds release);
115-
//void pbf_move_joystick (JoyconContext& context, uint8_t x, uint8_t y, Milliseconds hold, Milliseconds release);
116115
void pbf_move_joystick (JoyconContext& context, const JoystickPosition& position, Milliseconds hold, Milliseconds release);
117116
void pbf_mash_button (JoyconContext& context, Button button, Milliseconds duration);
118117

SerialPrograms/Source/NintendoSwitch/Controllers/Procon/NintendoSwitch_ProControllerState.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -190,8 +190,8 @@ std::string ProControllerState::to_cpp(Milliseconds hold, Milliseconds release)
190190
+ std::to_string(left_joystick.x) + ", " + std::to_string(left_joystick.y) + "}, "
191191
+ hold_str + ", " + release_str + ");\n";
192192
case 3:
193-
return "pbf_move_right_joystick(context, "
194-
+ std::to_string(right_joystick.x) + ", " + std::to_string(right_joystick.y) + ", "
193+
return "pbf_move_right_joystick(context, {"
194+
+ std::to_string(right_joystick.x) + ", " + std::to_string(right_joystick.y) + "}, "
195195
+ hold_str + ", " + release_str + ");\n";
196196
}
197197
throw InternalProgramError(nullptr, PA_CURRENT_FUNCTION, "Impossible state.");

SerialPrograms/Source/PokemonBDSP/Programs/PokemonBDSP_BoxRelease.cpp

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -12,12 +12,11 @@ namespace NintendoSwitch{
1212
namespace PokemonBDSP{
1313

1414
void detach(ProControllerContext& context){
15-
pbf_press_button(context, BUTTON_ZL, 20, 50);
16-
pbf_move_right_joystick(context, 128, 255, 20, 10);
17-
pbf_press_button(context, BUTTON_ZL, 20, 85);
18-
pbf_press_button(context, BUTTON_ZL, 20, 85);
19-
// pbf_move_right_joystick(context, 128, 255, 20, 0);
20-
pbf_press_button(context, BUTTON_B, 20, 85);
15+
pbf_press_button(context, BUTTON_ZL, 160ms, 400ms);
16+
pbf_move_right_joystick(context, 128, 255, 160ms, 80ms);
17+
pbf_press_button(context, BUTTON_ZL, 160ms, 680ms);
18+
pbf_press_button(context, BUTTON_ZL, 160ms, 680ms);
19+
pbf_press_button(context, BUTTON_B, 160ms, 680ms);
2120
}
2221
void detach_box(ProControllerContext& context, uint16_t box_scroll_delay){
2322
for (uint8_t row = 0; row < 5; row++){

SerialPrograms/Source/PokemonLA/Programs/Farming/PokemonLA_NuggetFarmerHighlands.cpp

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -148,8 +148,6 @@ bool NuggetFarmerHighlands::run_iteration(
148148
pbf_move_left_joystick(context, 64, 255, 50, 0);
149149
pbf_press_button(context, BUTTON_B, 150, 250);
150150

151-
// pbf_move_right_joystick(context, 0, 128, 200, 125);
152-
153151
},
154152
{
155153
{dialog_detector},

SerialPrograms/Source/PokemonLA/Programs/General/PokemonLA_RamanasIslandCombee.cpp

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -183,50 +183,50 @@ void RamanasCombeeFinder::grouped_path(SingleSwitchProgramEnvironment& env, ProC
183183

184184
env.console.log("Checking Tree 1");
185185
change_mount(env.console,context,MountState::BRAVIARY_ON);
186-
pbf_move_left_joystick(context, 239, 0, 100, 20);
186+
pbf_move_left_joystick(context, 239, 0, 800ms, 160ms);
187187
pbf_press_button(context, BUTTON_B, 2390, 0);
188188
pbf_press_button(context, BUTTON_Y, 380, 0);
189-
pbf_move_right_joystick(context, 127, 255, 90, 20);
189+
pbf_move_right_joystick(context, 127, 255, 720ms, 160ms);
190190
check_tree_no_stop(env, context);
191191

192192
env.console.log("Checking Tree 2");
193-
pbf_press_button(context, BUTTON_PLUS, 20, 200);
194-
pbf_move_left_joystick(context, 242, 0, 100, 20);
193+
pbf_press_button(context, BUTTON_PLUS, 20, 1600ms);
194+
pbf_move_left_joystick(context, 242, 0, 800ms, 160ms);
195195
context.wait_for_all_requests();
196196
enable_shiny_sound(context);
197197
pbf_press_button(context, BUTTON_B, 420, 0);
198198
pbf_press_button(context, BUTTON_Y, 380, 0);
199-
pbf_move_right_joystick(context, 127, 255, 90, 20);
199+
pbf_move_right_joystick(context, 127, 255, 720ms, 160ms);
200200
check_tree_no_stop(env, context);
201201

202202
env.console.log("Checking Tree 3");
203-
pbf_press_button(context, BUTTON_PLUS, 20, 200);
204-
pbf_move_left_joystick(context, 0, 60, 100, 20);
203+
pbf_press_button(context, BUTTON_PLUS, 20, 1600ms);
204+
pbf_move_left_joystick(context, 0, 60, 800ms, 160ms);
205205
context.wait_for_all_requests();
206206
enable_shiny_sound(context);
207207
pbf_press_button(context, BUTTON_B, 350, 0);
208208
pbf_press_button(context, BUTTON_Y, 380, 0);
209-
pbf_move_right_joystick(context, 127, 255, 90, 20);
209+
pbf_move_right_joystick(context, 127, 255, 720ms, 160ms);
210210
check_tree_no_stop(env, context);
211211

212212
env.console.log("Checking Tree 4");
213-
pbf_press_button(context, BUTTON_PLUS, 20, 200);
214-
pbf_move_left_joystick(context, 50, 255, 100, 20);
213+
pbf_press_button(context, BUTTON_PLUS, 20, 1600ms);
214+
pbf_move_left_joystick(context, 50, 255, 800ms, 160ms);
215215
context.wait_for_all_requests();
216216
enable_shiny_sound(context);
217217
pbf_press_button(context, BUTTON_B, 375, 0);
218218
pbf_press_button(context, BUTTON_Y, 380, 0);
219-
pbf_move_right_joystick(context, 127, 255, 90, 20);
219+
pbf_move_right_joystick(context, 127, 255, 720ms, 160ms);
220220
check_tree_no_stop(env, context);
221221

222222
env.console.log("Checking Tree 5");
223-
pbf_press_button(context, BUTTON_PLUS, 20, 200);
224-
pbf_move_left_joystick(context, 200, 0, 100, 20);
223+
pbf_press_button(context, BUTTON_PLUS, 20, 1600ms);
224+
pbf_move_left_joystick(context, 200, 0, 800ms, 160ms);
225225
context.wait_for_all_requests();
226226
enable_shiny_sound(context);
227227
pbf_press_button(context, BUTTON_B, 85, 0);
228228
pbf_press_button(context, BUTTON_Y, 380, 0);
229-
pbf_move_right_joystick(context, 127, 255, 90, 20);
229+
pbf_move_right_joystick(context, 127, 255, 720ms, 160ms);
230230
},
231231
{
232232
{battle_menu_detector},

SerialPrograms/Source/PokemonLA/Programs/PokemonLA_FlagNavigationAir.cpp

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -57,11 +57,11 @@ FlagNavigationAir::FlagNavigationAir(
5757
uint8_t turn = m_flag_x <= 0.5 ? 0 : 255;
5858
for (size_t c = 0; c < 2; c++){
5959
pbf_mash_button(context, BUTTON_ZL, 2 * TICKS_PER_SECOND);
60-
pbf_move_right_joystick(context, turn, 128, 400, 0);
61-
pbf_move_right_joystick(context, 128, 255, 120, 0);
62-
pbf_move_right_joystick(context, turn, 128, 400, 0);
63-
pbf_move_right_joystick(context, 128, 0, 200, 0);
64-
pbf_move_right_joystick(context, turn, 128, 400, 0);
60+
pbf_move_right_joystick(context, turn, 128, 3200ms, 0ms);
61+
pbf_move_right_joystick(context, 128, 255, 960ms, 0ms);
62+
pbf_move_right_joystick(context, turn, 128, 3200ms, 0ms);
63+
pbf_move_right_joystick(context, 128, 0, 1600ms, 0ms);
64+
pbf_move_right_joystick(context, turn, 128, 3200ms, 0ms);
6565
}
6666
context.wait_for_all_requests();
6767
m_find_flag_failed.store(true, std::memory_order_release);

SerialPrograms/Source/PokemonLA/Programs/ShinyHunting/PokemonLA_ShinyHunt-CustomPath.cpp

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -146,16 +146,6 @@ void ShinyHuntCustomPath::do_non_listen_action(
146146
}
147147
break;
148148
}
149-
#if 0
150-
case PathAction::ROTATE_CAMERA:{
151-
if (row.camera_turn_ticks > 0){
152-
pbf_move_right_joystick(context, {+1, 0}, uint16_t(row.camera_turn_ticks), 0);
153-
}else if (row.camera_turn_ticks < 0){
154-
pbf_move_right_joystick(context, {-1, 0}, uint16_t(-row.camera_turn_ticks), 0);
155-
}
156-
break;
157-
}
158-
#endif
159149
case PathAction::MOVE_FORWARD:{
160150
switch(row.parameters.move_speed){
161151
case PathSpeed::NORMAL_SPEED:

SerialPrograms/Source/PokemonLA/Programs/TestPrograms/PokemonLA_SoundListener.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,7 @@ SoundListener::SoundListener()
7474

7575
void SoundListener::program(SingleSwitchProgramEnvironment& env, ProControllerContext& context){
7676
// Connect the controller.
77-
// pbf_move_right_joystick(context, 0, 255, 10, 0);
77+
// pbf_move_right_joystick(context, 0, 255, 80ms, 0ms);
7878

7979
// search_alpha_roar_from_audio_dump();
8080
// return;

SerialPrograms/Source/PokemonLZA/Programs/PokemonLZA_BasicNavigation.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -138,7 +138,7 @@ bool open_map(ConsoleHandle& console, ProControllerContext& context, bool zoom_t
138138
map_detector.reset_state();
139139
// move right joystick to zoom out the map
140140
for(int i = 0; i < 3; i++){
141-
pbf_move_right_joystick(context, 128, 255, 100ms, 300ms);
141+
pbf_move_right_joystick(context, {0, -1}, 100ms, 300ms);
142142
}
143143
context.wait_for_all_requests();
144144
console.log("Set to fully zoomed out");

0 commit comments

Comments
 (0)