Skip to content

Commit a108f84

Browse files
committed
Suppress date-spam logging.
1 parent a6d0dae commit a108f84

File tree

3 files changed

+111
-44
lines changed

3 files changed

+111
-44
lines changed

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

Lines changed: 77 additions & 42 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
*
55
*/
66

7+
#include "Common/Cpp/RecursiveThrottler.h"
78
#include "CommonFramework/Exceptions/OperationFailedException.h"
89
#include "CommonFramework/ImageTools/ImageBoxes.h"
910
//#include "CommonFramework/VideoPipeline/VideoFeed.h"
@@ -23,7 +24,10 @@ namespace NintendoSwitch{
2324
void home_to_date_time_Switch1_wired_blind(
2425
Logger& logger, ProControllerContext& context, bool to_date_change
2526
){
26-
logger.log("home_to_date_time_Switch1_wired_blind()");
27+
ThrottleScope scope(context->logging_throttler());
28+
if (scope){
29+
context->logger().log("NintendoSwitch::home_to_date_time_Switch1_wired_blind()");
30+
}
2731

2832
ssf_issue_scroll(context, SSF_SCROLL_RIGHT, 32ms);
2933
ssf_issue_scroll(context, SSF_SCROLL_RIGHT, 32ms);
@@ -93,7 +97,10 @@ void home_to_date_time_Switch1_wired_blind(
9397
void home_to_date_time_Switch1_wireless_esp32_blind(
9498
Logger& logger, ProControllerContext& context, bool to_date_change
9599
){
96-
logger.log("home_to_date_time_Switch1_wireless_esp32_blind()");
100+
ThrottleScope scope(context->logging_throttler());
101+
if (scope){
102+
context->logger().log("NintendoSwitch::home_to_date_time_Switch1_wireless_esp32_blind()");
103+
}
97104

98105
Milliseconds tv = context->timing_variation();
99106
Milliseconds unit = 24ms + tv;
@@ -167,7 +174,10 @@ void home_to_date_time_Switch1_wireless_esp32_blind(
167174
void home_to_date_time_Switch1_sbb_blind(
168175
Logger& logger, ProControllerContext& context, bool to_date_change
169176
){
170-
logger.log("home_to_date_time_Switch1_sbb_blind()");
177+
ThrottleScope scope(context->logging_throttler());
178+
if (scope){
179+
context->logger().log("NintendoSwitch::home_to_date_time_Switch1_sbb_blind()");
180+
}
171181

172182
Milliseconds tv = context->timing_variation();
173183
// ssf_do_nothing(context, 1500ms);
@@ -213,34 +223,41 @@ void home_to_date_time_Switch1_wired_feedback(
213223

214224
size_t max_attempts = 5;
215225
for (size_t i = 0; i < max_attempts; i++){
216-
ssf_issue_scroll(context, SSF_SCROLL_RIGHT, 32ms);
217-
ssf_issue_scroll(context, SSF_SCROLL_RIGHT, 32ms);
218-
ssf_issue_scroll(context, SSF_SCROLL_RIGHT, 32ms);
226+
{
227+
ThrottleScope scope(context->logging_throttler());
228+
if (scope){
229+
context->logger().log("NintendoSwitch::home_to_date_time_Switch1_wired_feedback() - Part 1/3");
230+
}
219231

220-
// Down twice in case we drop one.
221-
ssf_issue_scroll(context, SSF_SCROLL_DOWN, 24ms);
222-
ssf_issue_scroll(context, SSF_SCROLL_DOWN, 32ms);
232+
ssf_issue_scroll(context, SSF_SCROLL_RIGHT, 32ms);
233+
ssf_issue_scroll(context, SSF_SCROLL_RIGHT, 32ms);
234+
ssf_issue_scroll(context, SSF_SCROLL_RIGHT, 32ms);
223235

224-
// if (i > 0){ // intentionally create a failure, for testing
225-
ssf_issue_scroll(context, SSF_SCROLL_LEFT, 0ms, 40ms, 24ms);
226-
// }
236+
// Down twice in case we drop one.
237+
ssf_issue_scroll(context, SSF_SCROLL_DOWN, 24ms);
238+
ssf_issue_scroll(context, SSF_SCROLL_DOWN, 32ms);
227239

240+
// if (i > 0){ // intentionally create a failure, for testing
241+
ssf_issue_scroll(context, SSF_SCROLL_LEFT, 0ms, 40ms, 24ms);
242+
// }
228243

229-
// ImageFloatBox system_icon(0.685, 0.69, 0.05, 0.03);
230-
// ImageFloatBox other_setting1(0.615, 0.69, 0.05, 0.03);
231-
// ImageFloatBox other_setting2(0.545, 0.69, 0.05, 0.03);
232244

233-
// Two A presses in case we drop the 1st one.
234-
// the program can self recover even if the second button press is registered.
235-
ssf_press_button(context, BUTTON_A, 24ms, 40ms, 24ms);
236-
ssf_press_button(context, BUTTON_A, 24ms, 48ms, 24ms);
245+
// ImageFloatBox system_icon(0.685, 0.69, 0.05, 0.03);
246+
// ImageFloatBox other_setting1(0.615, 0.69, 0.05, 0.03);
247+
// ImageFloatBox other_setting2(0.545, 0.69, 0.05, 0.03);
237248

238-
// Just button mash it. lol
239-
{
240-
auto iterations = Milliseconds(1200) / 24ms + 1;
241-
do{
242-
ssf_issue_scroll(context, SSF_SCROLL_DOWN, 24ms);
243-
}while (--iterations);
249+
// Two A presses in case we drop the 1st one.
250+
// the program can self recover even if the second button press is registered.
251+
ssf_press_button(context, BUTTON_A, 24ms, 40ms, 24ms);
252+
ssf_press_button(context, BUTTON_A, 24ms, 48ms, 24ms);
253+
254+
// Just button mash it. lol
255+
{
256+
auto iterations = Milliseconds(1200) / 24ms + 1;
257+
do{
258+
ssf_issue_scroll(context, SSF_SCROLL_DOWN, 24ms);
259+
}while (--iterations);
260+
}
244261
}
245262

246263
context.wait_for_all_requests();
@@ -263,26 +280,33 @@ void home_to_date_time_Switch1_wired_feedback(
263280
continue;
264281
}
265282

266-
267283
{
268-
auto iterations = Milliseconds(312) / 24ms + 1;
269-
do{
270-
ssf_issue_scroll(context, SSF_SCROLL_RIGHT, 24ms);
271-
}while (--iterations);
284+
ThrottleScope scope(context->logging_throttler());
285+
if (scope){
286+
context->logger().log("NintendoSwitch::home_to_date_time_Switch1_wired_feedback() - Part 2/3");
287+
}
288+
289+
{
290+
auto iterations = Milliseconds(312) / 24ms + 1;
291+
do{
292+
ssf_issue_scroll(context, SSF_SCROLL_RIGHT, 24ms);
293+
}while (--iterations);
294+
}
295+
296+
ssf_issue_scroll(context, SSF_SCROLL_DOWN, 24ms);
297+
ssf_issue_scroll(context, SSF_SCROLL_DOWN, 24ms);
298+
ssf_issue_scroll(context, SSF_SCROLL_DOWN, 80ms, 40ms, 24ms);
299+
ssf_press_dpad(context, DPAD_DOWN, 360ms, 320ms);
300+
ssf_issue_scroll(context, SSF_SCROLL_DOWN, 24ms);
301+
// if (i > 1){ // intentionally create a failure, for testing
302+
ssf_issue_scroll(context, SSF_SCROLL_DOWN, 24ms);
303+
// }
304+
305+
// only one ButtonA press since the program can self-recover if the button is dropped.
306+
// furthermore, the program can't self-recover if a second button press is registered.
307+
ssf_press_button(context, BUTTON_A, 24ms, 48ms, 24ms);
272308
}
273309

274-
ssf_issue_scroll(context, SSF_SCROLL_DOWN, 24ms);
275-
ssf_issue_scroll(context, SSF_SCROLL_DOWN, 24ms);
276-
ssf_issue_scroll(context, SSF_SCROLL_DOWN, 80ms, 40ms, 24ms);
277-
ssf_press_dpad(context, DPAD_DOWN, 360ms, 320ms);
278-
ssf_issue_scroll(context, SSF_SCROLL_DOWN, 24ms);
279-
// if (i > 1){ // intentionally create a failure, for testing
280-
ssf_issue_scroll(context, SSF_SCROLL_DOWN, 24ms);
281-
// }
282-
283-
// only one ButtonA press since the program can self-recover if the button is dropped.
284-
// furthermore, the program can't self-recover if a second button press is registered.
285-
ssf_press_button(context, BUTTON_A, 24ms, 48ms, 24ms);
286310

287311
context.wait_for_all_requests();
288312
context.wait_for(Milliseconds(300));
@@ -306,6 +330,12 @@ void home_to_date_time_Switch1_wired_feedback(
306330
return;
307331
}
308332

333+
ThrottleScope scope(context->logging_throttler());
334+
if (scope){
335+
context->logger().log("NintendoSwitch::home_to_date_time_Switch1_wired_feedback() - Part 3/3");
336+
}
337+
338+
309339
{
310340
auto iterations = Milliseconds(250) / 24ms + 1;
311341
do{
@@ -334,6 +364,11 @@ void home_to_date_time_Switch1_wired_feedback(
334364

335365

336366
void home_to_date_time_Switch1_joycon_blind(JoyconContext& context, bool to_date_change){
367+
ThrottleScope scope(context->logging_throttler());
368+
if (scope){
369+
context->logger().log("NintendoSwitch::home_to_date_time_Switch1_joycon_blind()");
370+
}
371+
337372
Milliseconds tv = context->timing_variation();
338373
Milliseconds unit = 100ms + tv;
339374

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

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
*
55
*/
66

7+
#include "Common/Cpp/RecursiveThrottler.h"
78
#include "CommonFramework/Exceptions/OperationFailedException.h"
89
#include "CommonFramework/VideoPipeline/VideoFeed.h"
910
#include "CommonFramework/VideoPipeline/VideoOverlayScopes.h"
@@ -81,6 +82,11 @@ ConsoleType settings_detect_console_type(
8182
void home_to_settings_Switch2_procon_blind(
8283
ProControllerContext& context
8384
){
85+
ThrottleScope scope(context->logging_throttler());
86+
if (scope){
87+
context->logger().log("NintendoSwitch::home_to_settings_Switch2_procon_blind()");
88+
}
89+
8490
Milliseconds tv = context->timing_variation();
8591
Milliseconds unit = 24ms + tv;
8692

@@ -115,6 +121,11 @@ void home_to_settings_Switch2_procon_blind(
115121
void home_to_settings_Switch2_joycon_blind(
116122
JoyconContext& context
117123
){
124+
ThrottleScope scope(context->logging_throttler());
125+
if (scope){
126+
context->logger().log("NintendoSwitch::home_to_settings_Switch2_joycon_blind()");
127+
}
128+
118129
Milliseconds tv = context->timing_variation();
119130
Milliseconds unit = 24ms + tv;
120131

@@ -151,6 +162,11 @@ void settings_to_date_time_Switch2_all_blind(
151162
Logger& logger, ControllerContext& context,
152163
ConsoleType console_type, bool to_date_change
153164
){
165+
ThrottleScope scope(context->logging_throttler());
166+
if (scope){
167+
context->logger().log("NintendoSwitch::settings_to_date_time_Switch2_all_blind()");
168+
}
169+
154170
Milliseconds tv = context->timing_variation();
155171
Milliseconds unit = 24ms + tv;
156172

SerialPrograms/Source/PokemonSV/Programs/PokemonSV_MenuNavigation.cpp

Lines changed: 18 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
*
33
*/
44

5+
#include "Common/Cpp/RecursiveThrottler.h"
56
#include "CommonFramework/Exceptions/OperationFailedException.h"
67
#include "CommonFramework/Exceptions/UnexpectedBattleException.h"
78
#include "CommonTools/Async/InferenceRoutines.h"
@@ -10,6 +11,8 @@
1011
#include "NintendoSwitch/Commands/NintendoSwitch_Commands_Superscalar.h"
1112
#include "NintendoSwitch/Programs/NintendoSwitch_GameEntry.h"
1213
#include "NintendoSwitch/Programs/DateSpam/NintendoSwitch_HomeToDateTime.h"
14+
//#include "NintendoSwitch/Programs/DateSpam/NintendoSwitch_RollDateForward1.h"
15+
//#include "NintendoSwitch/Programs/DateSpam/NintendoSwitch_NeutralDateSkip.h"
1316
#include "NintendoSwitch/Programs/DateManip/NintendoSwitch_DateManip.h"
1417
#include "PokemonSV/PokemonSV_Settings.h"
1518
#include "PokemonSV/Inference/Dialogs/PokemonSV_DialogDetector.h"
@@ -50,7 +53,10 @@ void set_time_to_12am_from_home(const ProgramInfo& info, ConsoleHandle& console,
5053
}
5154

5255
void neutral_day_skip_switch1(ConsoleHandle& console, ProControllerContext& context){
53-
console.log("PokemonSV::neutral_day_skip_switch1()");
56+
ThrottleScope scope(context->logging_throttler());
57+
if (scope){
58+
context->logger().log("PokemonSV::neutral_day_skip_switch1()");
59+
}
5460

5561
Milliseconds tv = context->timing_variation();
5662
if (tv == 0ms){
@@ -88,7 +94,10 @@ void neutral_day_skip_switch1(ConsoleHandle& console, ProControllerContext& cont
8894
}
8995
}
9096
void neutral_day_skip_switch2(ConsoleHandle& console, ProControllerContext& context){
91-
console.log("PokemonSV::neutral_day_skip_switch2()");
97+
ThrottleScope scope(context->logging_throttler());
98+
if (scope){
99+
context->logger().log("PokemonSV::neutral_day_skip_switch2()");
100+
}
92101

93102
ssf_press_button(context, BUTTON_A, 216ms, 80ms);
94103
ssf_issue_scroll_ptv(context, SSF_SCROLL_RIGHT);
@@ -109,6 +118,13 @@ void day_skip_from_overworld(ConsoleHandle& console, ProControllerContext& conte
109118
neutral_day_skip_switch1(console, context);
110119
}else if (is_switch2(console_type)){
111120
neutral_day_skip_switch2(console, context);
121+
122+
#if 0
123+
for (int c = 0; c < 10; c++){
124+
NintendoSwitch::roll_date_forward_1(console, context, true);
125+
// NintendoSwitch::neutral_date_skip(console, context);
126+
}
127+
#endif
112128
}else{
113129
throw UserSetupError(
114130
console,

0 commit comments

Comments
 (0)