Skip to content

Commit 154e25d

Browse files
committed
Use feedback when going home.
1 parent 771db1b commit 154e25d

21 files changed

+52
-38
lines changed

SerialPrograms/Source/NintendoSwitch/Programs/NintendoSwitch_GameEntry.cpp

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,12 +33,21 @@ namespace NintendoSwitch{
3333

3434

3535
void go_home(ConsoleHandle& console, ProControllerContext& context){
36+
console.log("Going Home...");
37+
pbf_press_button(context, BUTTON_HOME, 160ms, 0ms);
38+
if (!console.video().snapshot()){
39+
pbf_wait(context, 640ms);
40+
return;
41+
}
42+
ensure_at_home(console, context);
43+
}
44+
void go_home(ConsoleHandle& console, JoyconContext& context){
45+
console.log("Going Home...");
3646
pbf_press_button(context, BUTTON_HOME, 160ms, 0ms);
3747
if (!console.video().snapshot()){
3848
pbf_wait(context, 640ms);
3949
return;
4050
}
41-
4251
ensure_at_home(console, context);
4352
}
4453

SerialPrograms/Source/NintendoSwitch/Programs/NintendoSwitch_GameEntry.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@ namespace NintendoSwitch{
1717

1818

1919
void go_home(ConsoleHandle& console, ProControllerContext& context);
20+
void go_home(ConsoleHandle& console, JoyconContext& context);
2021
void ensure_at_home(ConsoleHandle& console, ProControllerContext& context);
2122
void ensure_at_home(ConsoleHandle& console, JoyconContext& context);
2223

SerialPrograms/Source/PokemonBDSP/Programs/ShinyHunting/PokemonBDSP_LegendaryReset.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,8 @@
88
#include "CommonTools/Async/InferenceRoutines.h"
99
#include "NintendoSwitch/NintendoSwitch_Settings.h"
1010
#include "NintendoSwitch/Commands/NintendoSwitch_Commands_PushButtons.h"
11+
#include "NintendoSwitch/Programs/NintendoSwitch_GameEntry.h"
1112
#include "PokemonSwSh/ShinyHuntTracker.h"
12-
#include "PokemonBDSP/PokemonBDSP_Settings.h"
1313
#include "PokemonBDSP/Inference/Battles/PokemonBDSP_StartBattleDetector.h"
1414
#include "PokemonBDSP/Inference/Battles/PokemonBDSP_BattleMenuDetector.h"
1515
#include "PokemonBDSP/Inference/ShinyDetection/PokemonBDSP_ShinyEncounterDetector.h"
@@ -87,7 +87,7 @@ void LegendaryReset::program(SingleSwitchProgramEnvironment& env, ProControllerC
8787
env.update_stats();
8888

8989
if (reset){
90-
pbf_press_button(context, BUTTON_HOME, 80ms, GameSettings::instance().GAME_TO_HOME_DELAY0);
90+
go_home(env.console, context);
9191
if (!reset_game_from_home(env, env.console, context, ConsoleSettings::instance().TOLERATE_SYSTEM_UPDATE_MENU_FAST)){
9292
stats.add_error();
9393
continue;

SerialPrograms/Source/PokemonBDSP/Programs/ShinyHunting/PokemonBDSP_ShinyHunt-Overworld.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,10 +6,10 @@
66

77
#include "CommonFramework/Exceptions/OperationFailedException.h"
88
#include "CommonFramework/Notifications/ProgramNotifications.h"
9-
#include "NintendoSwitch/Commands/NintendoSwitch_Commands_PushButtons.h"
109
#include "NintendoSwitch/NintendoSwitch_Settings.h"
10+
#include "NintendoSwitch/Commands/NintendoSwitch_Commands_PushButtons.h"
11+
#include "NintendoSwitch/Programs/NintendoSwitch_GameEntry.h"
1112
#include "PokemonSwSh/ShinyHuntTracker.h"
12-
#include "PokemonBDSP/PokemonBDSP_Settings.h"
1313
#include "PokemonBDSP/Inference/ShinyDetection/PokemonBDSP_ShinyEncounterDetector.h"
1414
#include "PokemonBDSP/Programs/PokemonBDSP_EncounterHandler.h"
1515
#include "PokemonBDSP/Programs/PokemonBDSP_GameEntry.h"
@@ -156,7 +156,7 @@ void ShinyHuntOverworld::program(SingleSwitchProgramEnvironment& env, ProControl
156156
e.send_notification(env, NOTIFICATION_ERROR_RECOVERABLE);
157157

158158
stats.add_error();
159-
pbf_press_button(context, BUTTON_HOME, 80ms, GameSettings::instance().GAME_TO_HOME_DELAY0);
159+
go_home(env.console, context);
160160
if (!reset_game_from_home(
161161
env, env.console, context,
162162
ConsoleSettings::instance().TOLERATE_SYSTEM_UPDATE_MENU_FAST

SerialPrograms/Source/PokemonBDSP/Programs/ShinyHunting/PokemonBDSP_StarterReset.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,10 +11,10 @@
1111
#include "CommonTools/VisualDetectors/ImageMatchDetector.h"
1212
#include "NintendoSwitch/NintendoSwitch_Settings.h"
1313
#include "NintendoSwitch/Commands/NintendoSwitch_Commands_PushButtons.h"
14+
#include "NintendoSwitch/Programs/NintendoSwitch_GameEntry.h"
1415
#include "Pokemon/Pokemon_Strings.h"
1516
#include "Pokemon/Pokemon_Notification.h"
1617
#include "PokemonSwSh/ShinyHuntTracker.h"
17-
#include "PokemonBDSP/PokemonBDSP_Settings.h"
1818
#include "PokemonBDSP/Resources/PokemonBDSP_NameDatabase.h"
1919
#include "PokemonBDSP/Programs/PokemonBDSP_GameEntry.h"
2020
#include "PokemonBDSP/Inference/PokemonBDSP_SelectionArrow.h"
@@ -125,7 +125,7 @@ void StarterReset::program(SingleSwitchProgramEnvironment& env, ProControllerCon
125125
}
126126

127127
if (reset){
128-
pbf_press_button(context, BUTTON_HOME, 80ms, GameSettings::instance().GAME_TO_HOME_DELAY0);
128+
go_home(env.console, context);
129129
if (!reset_game_from_home(env, env.console, context, ConsoleSettings::instance().TOLERATE_SYSTEM_UPDATE_MENU_FAST)){
130130
stats.add_error();
131131
consecutive_failures++;

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

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@
1313
#include "CommonTools/Async/InferenceRoutines.h"
1414
#include "NintendoSwitch/NintendoSwitch_Settings.h"
1515
#include "NintendoSwitch/Commands/NintendoSwitch_Commands_PushButtons.h"
16+
#include "NintendoSwitch/Programs/NintendoSwitch_GameEntry.h"
1617
#include "Pokemon/Pokemon_Notification.h"
1718
#include "Pokemon/Inference/Pokemon_NameReader.h"
1819
#include "PokemonSwSh/ShinyHuntTracker.h"
@@ -126,7 +127,7 @@ void ShinyHuntLakeTrio::program(SingleSwitchProgramEnvironment& env, ProControll
126127
env.update_stats();
127128

128129
if (reset){
129-
pbf_press_button(context, BUTTON_HOME, 80ms, GameSettings::instance().GAME_TO_HOME_DELAY0);
130+
go_home(env.console, context);
130131
if (!reset_game_from_home(env, env.console, context, ConsoleSettings::instance().TOLERATE_SYSTEM_UPDATE_MENU_FAST)){
131132
stats.add_error();
132133
continue;

SerialPrograms/Source/PokemonLGPE/Programs/Farming/PokemonLGPE_DailyItemFarmer.cpp

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -4,22 +4,22 @@
44
*
55
*/
66

7-
#include "CommonFramework/Exceptions/OperationFailedException.h"
7+
//#include "CommonFramework/Exceptions/OperationFailedException.h"
88
#include "CommonFramework/Notifications/ProgramNotifications.h"
99
#include "CommonFramework/ProgramStats/StatsTracking.h"
10-
#include "CommonFramework/VideoPipeline/VideoFeed.h"
11-
#include "CommonTools/Async/InferenceRoutines.h"
10+
//#include "CommonFramework/VideoPipeline/VideoFeed.h"
11+
//#include "CommonTools/Async/InferenceRoutines.h"
1212
#include "CommonTools/StartupChecks/VideoResolutionCheck.h"
13+
#include "NintendoSwitch/NintendoSwitch_Settings.h"
1314
#include "NintendoSwitch/Commands/NintendoSwitch_Commands_PushButtons.h"
1415
#include "NintendoSwitch/Controllers/NintendoSwitch_Joycon.h"
1516
#include "NintendoSwitch/Programs/NintendoSwitch_GameEntry.h"
1617
#include "NintendoSwitch/Programs/DateSpam/NintendoSwitch_HomeToDateTime.h"
17-
#include "NintendoSwitch/NintendoSwitch_Settings.h"
1818
#include "Pokemon/Pokemon_Strings.h"
19-
#include "CommonTools/VisualDetectors/BlackScreenDetector.h"
19+
//#include "CommonTools/VisualDetectors/BlackScreenDetector.h"
2020
#include "PokemonLGPE/Commands/PokemonLGPE_DateSpam.h"
21-
#include "PokemonLGPE/Inference/PokemonLGPE_ShinySymbolDetector.h"
22-
#include "PokemonLGPE/Programs/PokemonLGPE_GameEntry.h"
21+
//#include "PokemonLGPE/Inference/PokemonLGPE_ShinySymbolDetector.h"
22+
//#include "PokemonLGPE/Programs/PokemonLGPE_GameEntry.h"
2323
#include "PokemonSwSh/Commands/PokemonSwSh_Commands_DateSpam.h"
2424
#include "PokemonLGPE_DailyItemFarmer.h"
2525

@@ -215,7 +215,7 @@ void DailyItemFarmer::program(SingleSwitchProgramEnvironment& env, CancellableSc
215215
}
216216

217217
if (FIX_TIME_WHEN_DONE){
218-
pbf_press_button(context, BUTTON_HOME, 80ms, 1000ms);
218+
go_home(env.console, context);
219219
home_to_date_time(env.console, context, false);
220220
pbf_press_button(context, BUTTON_A, 50ms, 500ms);
221221
pbf_press_button(context, BUTTON_A, 50ms, 500ms);

SerialPrograms/Source/PokemonSV/Programs/AutoStory/PokemonSV_AutoStory_Segment_11.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -573,7 +573,7 @@ void checkpoint_26(
573573
mash_button_till_overworld(env.console, context, BUTTON_A, 360);
574574

575575
// fix the time
576-
pbf_press_button(context, BUTTON_HOME, 80ms, GameSettings::instance().GAME_TO_HOME_DELAY1);
576+
go_home(env.console, context);
577577
home_to_date_time(env.console, context, false);
578578
pbf_press_button(context, BUTTON_A, 20, 105);
579579
pbf_press_button(context, BUTTON_A, 20, 105);

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

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,8 @@
2222
#include "Kernels/Waterfill/Kernels_Waterfill_Session.h"
2323
#include "Pokemon/Pokemon_Strings.h"
2424
#include "NintendoSwitch/Commands/NintendoSwitch_Commands_PushButtons.h"
25-
#include "PokemonSV/PokemonSV_Settings.h"
25+
#include "NintendoSwitch/Programs/NintendoSwitch_GameEntry.h"
26+
//#include "PokemonSV/PokemonSV_Settings.h"
2627
#include "PokemonSV/Inference/Dialogs/PokemonSV_DialogDetector.h"
2728
#include "PokemonSV/Inference/PokemonSV_AuctionItemNameReader.h"
2829
#include "PokemonSV/Inference/Overworld/PokemonSV_OverworldDetector.h"
@@ -179,17 +180,17 @@ void AuctionFarmer::reset_auctions(SingleSwitchProgramEnvironment& env, ProContr
179180
try{
180181
if (do_full_reset){
181182
if (year == MAX_YEAR){
182-
pbf_press_button(context, BUTTON_HOME, 80ms, GameSettings::instance().GAME_TO_HOME_DELAY1);
183+
go_home(env.console, context);
183184
PokemonSwSh::home_roll_date_enter_game_autorollback(env.console, context, year);
184185
}
185186
save_game_from_overworld(env.program_info(), env.console, context);
186187

187-
pbf_press_button(context, BUTTON_HOME, 80ms, GameSettings::instance().GAME_TO_HOME_DELAY1);
188+
go_home(env.console, context);
188189
PokemonSwSh::home_roll_date_enter_game_autorollback(env.console, context, year);
189190
}
190191
pbf_wait(context, 1 * TICKS_PER_SECOND);
191192

192-
pbf_press_button(context, BUTTON_HOME, 80ms, GameSettings::instance().GAME_TO_HOME_DELAY1);
193+
go_home(env.console, context);
193194
context.wait_for_all_requests();
194195
reset_game_from_home(env.program_info(), env.console, context, TICKS_PER_SECOND);
195196
}catch (OperationFailedException& e){

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -139,7 +139,7 @@ void BBQSoloFarmer::program(SingleSwitchProgramEnvironment& env, ProControllerCo
139139
//Fix the time to prevent running out of years
140140
pbf_wait(context, 250);
141141
context.wait_for_all_requests();
142-
pbf_press_button(context, BUTTON_HOME, 80ms, GameSettings::instance().GAME_TO_HOME_DELAY1);
142+
go_home(env.console, context);
143143
home_to_date_time(env.console, context, false);
144144
pbf_press_button(context, BUTTON_A, 20, 105);
145145
pbf_press_button(context, BUTTON_A, 20, 105);
@@ -160,7 +160,7 @@ void BBQSoloFarmer::program(SingleSwitchProgramEnvironment& env, ProControllerCo
160160
env.update_stats();
161161

162162
if (BBQ_OPTIONS.FIX_TIME_WHEN_DONE){
163-
pbf_press_button(context, BUTTON_HOME, 80ms, GameSettings::instance().GAME_TO_HOME_DELAY1);
163+
go_home(env.console, context);
164164
home_to_date_time(env.console, context, false);
165165
pbf_press_button(context, BUTTON_A, 20, 105);
166166
pbf_press_button(context, BUTTON_A, 20, 105);

0 commit comments

Comments
 (0)