Skip to content

Commit c59e8f4

Browse files
committed
rollback_hours_from_home() for Switch 2
1 parent 4d550da commit c59e8f4

File tree

2 files changed

+52
-3
lines changed

2 files changed

+52
-3
lines changed

SerialPrograms/Source/NintendoSwitch/DevPrograms/TestProgramSwitch.cpp

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -326,6 +326,11 @@ void TestProgram::program(MultiSwitchProgramEnvironment& env, CancellableScope&
326326

327327
// console.state().set_console_type(CONSOLE_MODEL);
328328

329+
330+
rollback_hours_from_home(console, context, 3, 500ms);
331+
332+
333+
329334
#if 0
330335
while (true){
331336
roll_date_backward_N_Switch2_wired(context, 60);
@@ -358,7 +363,7 @@ void TestProgram::program(MultiSwitchProgramEnvironment& env, CancellableScope&
358363
#endif
359364

360365

361-
#if 1
366+
#if 0
362367
ConsoleTypeDetector_Home detector(console);
363368
detector.make_overlays(overlays);
364369

SerialPrograms/Source/PokemonSwSh/Commands/PokemonSwSh_Commands_DateSpam.cpp

Lines changed: 46 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -147,7 +147,6 @@ void touch_date_from_home(
147147
touch_date_from_home_switch1(console, context, settings_to_home_delay);
148148
return;
149149
}
150-
151150
if (is_switch2(type)){
152151
touch_date_from_home_switch2(console, context, settings_to_home_delay);
153152
return;
@@ -161,7 +160,8 @@ void touch_date_from_home(
161160

162161

163162

164-
void rollback_hours_from_home(
163+
164+
void rollback_hours_from_home_switch1(
165165
ConsoleHandle& console, ProControllerContext& context,
166166
uint8_t hours,
167167
Milliseconds settings_to_home_delay
@@ -182,6 +182,50 @@ void rollback_hours_from_home(
182182
ssf_press_button_ptv(context, BUTTON_A, 160ms, 80ms);
183183
ssf_press_button(context, BUTTON_HOME, settings_to_home_delay, 80ms);
184184
}
185+
void rollback_hours_from_home_switch2(
186+
ConsoleHandle& console, ProControllerContext& context,
187+
uint8_t hours,
188+
Milliseconds settings_to_home_delay
189+
){
190+
home_to_date_time(console, context, true);
191+
192+
ssf_press_button(context, BUTTON_A, 240ms, 80ms);
193+
ssf_issue_scroll(context, SSF_SCROLL_RIGHT, 24ms, 48ms, 24ms);
194+
ssf_issue_scroll(context, SSF_SCROLL_RIGHT, 24ms, 48ms, 24ms);
195+
ssf_issue_scroll(context, SSF_SCROLL_RIGHT, 24ms, 48ms, 24ms);
196+
for (uint8_t c = 0; c < hours; c++){
197+
ssf_issue_scroll(context, SSF_SCROLL_DOWN, 112ms, 48ms, 24ms);
198+
}
199+
ssf_issue_scroll(context, SSF_SCROLL_RIGHT, 24ms, 48ms, 24ms);
200+
ssf_issue_scroll(context, SSF_SCROLL_RIGHT, 24ms, 48ms, 24ms);
201+
ssf_issue_scroll(context, SSF_SCROLL_RIGHT, 24ms, 48ms, 24ms);
202+
ssf_press_button(context, BUTTON_A, 280ms, 80ms);
203+
204+
ssf_press_button(context, BUTTON_HOME, settings_to_home_delay, 80ms);
205+
}
206+
207+
208+
void rollback_hours_from_home(
209+
ConsoleHandle& console, ProControllerContext& context,
210+
uint8_t hours,
211+
Milliseconds settings_to_home_delay
212+
){
213+
ConsoleType type = console.state().console_type();
214+
215+
if (type == ConsoleType::Switch1){
216+
rollback_hours_from_home_switch1(console, context, hours, settings_to_home_delay);
217+
return;
218+
}
219+
if (is_switch2(type)){
220+
rollback_hours_from_home_switch2(console, context, hours, settings_to_home_delay);
221+
return;
222+
}
223+
224+
throw UserSetupError(
225+
console.logger(),
226+
"Please select a valid Switch console type."
227+
);
228+
}
185229

186230

187231

0 commit comments

Comments
 (0)