Skip to content

Commit 213da97

Browse files
committed
Migrate some routines off old joystick API.
1 parent cb12398 commit 213da97

File tree

5 files changed

+26
-24
lines changed

5 files changed

+26
-24
lines changed

SerialPrograms/Source/PokemonBDSP/Programs/Glitches/PokemonBDSP_ActivateMenuGlitch-1.1.2.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -57,8 +57,8 @@ void trigger_menu(VideoStream& stream, ProControllerContext& context){
5757
[](ProControllerContext& context){
5858
for (size_t i = 0; i < 12; i++){
5959
for (size_t c = 0; c < 42; c++){
60-
pbf_controller_state(context, BUTTON_ZL, DPAD_NONE, 128, 128, 128, 128, 1);
61-
pbf_controller_state(context, BUTTON_R | BUTTON_ZL, DPAD_NONE, 128, 128, 128, 128, 5);
60+
pbf_controller_state(context, BUTTON_ZL, DPAD_NONE, {0, 0}, {0, 0}, 8ms);
61+
pbf_controller_state(context, BUTTON_R | BUTTON_ZL, DPAD_NONE, {0, 0}, {0, 0}, 40ms);
6262
pbf_wait(context, 3);
6363
}
6464
pbf_wait(context, 125);

SerialPrograms/Source/PokemonLA/Programs/PokemonLA_FlagNavigationAir.cpp

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -195,11 +195,11 @@ FlagNavigationAir::FlagNavigationAir(
195195
double shift = 0;
196196
double distance, flag_x, flag_y;
197197
if (m_flag.get(distance, flag_x, flag_y)){
198-
shift = (flag_x - 0.5) * 320;
199-
shift = std::max(shift, -32.);
200-
shift = std::min(shift, 32.);
198+
shift = (flag_x - 0.5) * 2.5;
199+
shift = std::max(shift, -1/4.);
200+
shift = std::min(shift, 1/4.);
201201
}
202-
pbf_controller_state(context, BUTTON_B, DPAD_NONE, (int8_t)(128 + shift), 128, 128, 128, 255);
202+
pbf_controller_state(context, BUTTON_B, DPAD_NONE, {shift, 0}, {0, 0}, 2000ms);
203203
});
204204
return false;
205205
};
@@ -237,11 +237,11 @@ FlagNavigationAir::FlagNavigationAir(
237237
double shift = 0;
238238
double distance, flag_x, flag_y;
239239
if (m_flag.get(distance, flag_x, flag_y)){
240-
shift = (flag_x - 0.5) * 640;
241-
shift = std::max(shift, -32.);
242-
shift = std::min(shift, 32.);
240+
shift = (flag_x - 0.5) * 5;
241+
shift = std::max(shift, -1/4.);
242+
shift = std::min(shift, 1/4.);
243243
}
244-
pbf_controller_state(context, BUTTON_Y, DPAD_NONE, (int8_t)(128 + shift), 128, 128, 128, 125);
244+
pbf_controller_state(context, BUTTON_Y, DPAD_NONE, {shift, 0}, {0, 0}, 1000ms);
245245
});
246246
return false;
247247
};

SerialPrograms/Source/PokemonLZA/Programs/ShinyHunting/PokemonLZA_BeldumHunter.cpp

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -100,7 +100,7 @@ bool BeldumHunter::run_iteration(SingleSwitchProgramEnvironment& env, ProControl
100100
int ret = run_until<ProControllerContext>(
101101
env.console, context,
102102
[&](ProControllerContext& context) {
103-
pbf_controller_state(context, BUTTON_B, DPAD_NONE, 128, 0, 128, 128, 100);
103+
pbf_controller_state(context, BUTTON_B, DPAD_NONE, {0, +1}, {0, 0}, 800ms);
104104
pbf_wait(context, 5000ms);
105105
},
106106
{ {entered} }
@@ -123,20 +123,20 @@ bool BeldumHunter::run_iteration(SingleSwitchProgramEnvironment& env, ProControl
123123
[&](ProControllerContext& context) {
124124

125125
env.log("Go straight toward the elevator.");
126-
pbf_controller_state(context, BUTTON_B, DPAD_NONE, 128, 0, 128, 128, 460);
126+
pbf_controller_state(context, BUTTON_B, DPAD_NONE, {0, +1}, {0, 0}, 3680ms);
127127

128128
env.log("Go left to where the Noivern spawns, then forward and then left.");
129-
pbf_controller_state(context, BUTTON_B, DPAD_NONE, 0, 128, 128, 128, 300);
130-
pbf_controller_state(context, BUTTON_B, DPAD_NONE, 128, 0, 128, 128, 80);
131-
pbf_controller_state(context, BUTTON_B, DPAD_NONE, 0, 128, 128, 128, 180);
129+
pbf_controller_state(context, BUTTON_B, DPAD_NONE, {-1, 0}, {0, 0}, 2400ms);
130+
pbf_controller_state(context, BUTTON_B, DPAD_NONE, {0, +1}, {0, 0}, 640ms);
131+
pbf_controller_state(context, BUTTON_B, DPAD_NONE, {-1, 0}, {0, 0}, 1440ms);
132132

133133
env.log("Through the Houndoom room and down the hallway.");
134-
pbf_controller_state(context, BUTTON_B, DPAD_NONE, 128, 255, 128, 128, 140);
135-
pbf_controller_state(context, BUTTON_B, DPAD_NONE, 0, 128, 128, 128, 200);
136-
pbf_controller_state(context, BUTTON_B, DPAD_NONE, 128, 0, 128, 128, 340);
134+
pbf_controller_state(context, BUTTON_B, DPAD_NONE, {0, -1}, {0, 0}, 1120ms);
135+
pbf_controller_state(context, BUTTON_B, DPAD_NONE, {-1, 0}, {0, 0}, 1600ms);
136+
pbf_controller_state(context, BUTTON_B, DPAD_NONE, {0, +1}, {0, 0}, 2720ms);
137137

138138
env.log("Final hallway to Beldum room.");
139-
pbf_controller_state(context, BUTTON_B, DPAD_NONE, 0, 128, 128, 128, 400);
139+
pbf_controller_state(context, BUTTON_B, DPAD_NONE, {-1, 0}, {0, 0}, 3200ms);
140140
pbf_press_button(context, BUTTON_L, 40ms, 40ms);
141141
context.wait_for_all_requests();
142142
},

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

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -631,8 +631,10 @@ void quest_travel_500(const ProgramInfo& info, VideoStream& stream, ProControlle
631631
pbf_press_button(context, BUTTON_L | BUTTON_PLUS, 20, 105);
632632

633633
for(int j = 0; j < 60; j++){ //One min just to be safe.
634-
pbf_controller_state(context, BUTTON_LCLICK, DPAD_NONE,
635-
128, 0, 255, 128, TICKS_PER_SECOND);
634+
pbf_controller_state(
635+
context, BUTTON_LCLICK, DPAD_NONE,
636+
{0, +1}, {+1, 0}, 1000ms
637+
);
636638
}
637639
context.wait_for_all_requests();
638640

SerialPrograms/Source/PokemonSV/Programs/Sandwiches/PokemonSV_SandwichRoutines.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -317,10 +317,10 @@ bool move_then_recover_sandwich_hand_position(
317317

318318
move_session.dispatch([&](ProControllerContext& context){
319319
// move to bottom right corner, while holding A
320-
pbf_controller_state(context, BUTTON_A, DPAD_NONE, 255, 255, 128, 128, num_ticks_to_move_1);
320+
pbf_controller_state(context, BUTTON_A, DPAD_NONE, {+1, -1}, {0, 0}, num_ticks_to_move_1 * 8ms);
321321

322322
// move to left slightly, while holding A
323-
pbf_controller_state(context, BUTTON_A, DPAD_NONE, 0, 128, 128, 128, num_ticks_to_move_2);
323+
pbf_controller_state(context, BUTTON_A, DPAD_NONE, {-1, 0}, {0, 0}, num_ticks_to_move_2 * 8ms);
324324

325325
// keep holding A.
326326
pbf_press_button(context, BUTTON_A, num_ticks_to_hold_A, 0);
@@ -420,7 +420,7 @@ HandMoveData move_sandwich_hand_and_check_if_plates_empty(
420420

421421
if (pressing_A){
422422
move_session.dispatch([](ProControllerContext& context){
423-
pbf_controller_state(context, BUTTON_A, DPAD_NONE, 128, 128, 128, 128, 3000);
423+
pbf_press_button(context, BUTTON_A, 24000ms, 0ms);
424424
});
425425
}
426426

0 commit comments

Comments
 (0)