Skip to content

Commit 52b42fe

Browse files
committed
add ENSURE_TIME_UNSYNCED to Autostory
1 parent a0db7d3 commit 52b42fe

File tree

2 files changed

+38
-8
lines changed

2 files changed

+38
-8
lines changed

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

Lines changed: 35 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,9 @@
2121
#include "CommonTools/StartupChecks/StartProgramChecks.h"
2222
#include "CommonTools/StartupChecks/VideoResolutionCheck.h"
2323
#include "NintendoSwitch/Commands/NintendoSwitch_Commands_PushButtons.h"
24+
#include "NintendoSwitch/Programs/DateManip/NintendoSwitch_DateManip.h"
25+
#include "NintendoSwitch/Programs/NintendoSwitch_GameEntry.h"
26+
#include "PokemonSV/PokemonSV_Settings.h"
2427
#include "Pokemon/Pokemon_Strings.h"
2528
#include "PokemonSwSh/Inference/PokemonSwSh_IvJudgeReader.h"
2629
#include "PokemonSV/Inference/PokemonSV_MainMenuDetector.h"
@@ -508,6 +511,25 @@ AutoStory::AutoStory()
508511
LockMode::UNLOCK_WHILE_RUNNING,
509512
false
510513
)
514+
, CHANGE_SETTINGS(
515+
"<b>Pre-check: Update game settings:</b><br>"
516+
"This is to ensure the game has the correct settings, particularly with Autosave turned off, and Camera Support off.<br>"
517+
"WARNING: if you disable this, make sure you manually set the in-game settings as laid out in the wiki.",
518+
LockMode::UNLOCK_WHILE_RUNNING,
519+
true
520+
)
521+
, ENSURE_TIME_UNSYNCED(
522+
"<b>Pre-check: Ensure time unsynced:</b><br>"
523+
"This is to ensure the Switch has time unsynced from the internet, so it can be changed. This is run prior to the main story.",
524+
LockMode::UNLOCK_WHILE_RUNNING,
525+
true
526+
)
527+
, ENSURE_CORRECT_MOVES(
528+
"<b>Pre-check: Ensure lead Gardevoir has the correct moves:</b><br>"
529+
"This is to ensure the lead Gardevoir has the correct moves in the correct order: Moonblast, Mystical Fire, Psychic, Misty Terrain. This is run prior to the main story.",
530+
LockMode::UNLOCK_WHILE_RUNNING,
531+
true
532+
)
511533
, GO_HOME_WHEN_DONE(true)
512534
, NOTIFICATION_STATUS_UPDATE("Status Update", true, false, std::chrono::seconds(30))
513535
, NOTIFICATIONS({
@@ -522,13 +544,6 @@ AutoStory::AutoStory()
522544
, m_advanced_options_end(
523545
""
524546
)
525-
, CHANGE_SETTINGS(
526-
"<b>Change settings at Program Start:</b><br>"
527-
"This is to ensure the program has the correct settings, particularly with Autosave turned off, and Camera Support off.<br>"
528-
"WARNING: if you disable this, make sure you manually set the in-game settings as laid out in the wiki.",
529-
LockMode::UNLOCK_WHILE_RUNNING,
530-
true
531-
)
532547
, ENABLE_TEST_CHECKPOINTS(
533548
"<b>TEST: test_checkpoints():</b>",
534549
LockMode::UNLOCK_WHILE_RUNNING,
@@ -788,6 +803,8 @@ AutoStory::AutoStory()
788803

789804
PA_ADD_OPTION(ENABLE_ADVANCED_MODE);
790805
PA_ADD_OPTION(CHANGE_SETTINGS);
806+
PA_ADD_OPTION(ENSURE_TIME_UNSYNCED);
807+
PA_ADD_OPTION(ENSURE_CORRECT_MOVES);
791808

792809
PA_ADD_OPTION(NOTIFICATIONS);
793810

@@ -1336,6 +1353,17 @@ void AutoStory::program(SingleSwitchProgramEnvironment& env, ProControllerContex
13361353
}
13371354
}
13381355

1356+
if (ENSURE_TIME_UNSYNCED && STORY_SECTION == StorySection::MAIN_STORY){
1357+
pbf_press_button(context, BUTTON_HOME, 160ms, GameSettings::instance().GAME_TO_HOME_DELAY1);
1358+
ensure_time_unsynced(env, context);
1359+
go_home(env.console, context);
1360+
resume_game_from_home(env.console, context, true);
1361+
}
1362+
1363+
if (ENSURE_CORRECT_MOVES && STORY_SECTION == StorySection::MAIN_STORY){
1364+
1365+
}
1366+
13391367
run_autostory(env, context);
13401368

13411369
send_program_finished_notification(env, NOTIFICATION_PROGRAM_FINISH);

SerialPrograms/Source/PokemonSV/Programs/AutoStory/PokemonSV_AutoStory.h

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -101,6 +101,9 @@ class AutoStory : public SingleSwitchProgramInstance, public ConfigOption::Liste
101101
EnumDropdownOption<StarterChoice> STARTERCHOICE;
102102

103103
BooleanCheckBoxOption ENABLE_ADVANCED_MODE;
104+
BooleanCheckBoxOption CHANGE_SETTINGS;
105+
BooleanCheckBoxOption ENSURE_TIME_UNSYNCED;
106+
BooleanCheckBoxOption ENSURE_CORRECT_MOVES;
104107

105108
GoHomeWhenDoneOption GO_HOME_WHEN_DONE;
106109

@@ -109,7 +112,6 @@ class AutoStory : public SingleSwitchProgramInstance, public ConfigOption::Liste
109112

110113
SectionDividerOption m_advanced_options;
111114
SectionDividerOption m_advanced_options_end;
112-
BooleanCheckBoxOption CHANGE_SETTINGS;
113115

114116
BooleanCheckBoxOption ENABLE_TEST_CHECKPOINTS;
115117
SimpleIntegerOption<uint16_t> START_CHECKPOINT;

0 commit comments

Comments
 (0)