Skip to content

Commit a63a142

Browse files
committed
Migrate PLA and SV settings to TimeDurationOption.
1 parent 18c3c46 commit a63a142

File tree

45 files changed

+132
-153
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

45 files changed

+132
-153
lines changed

Common/Qt/Options/TimeDurationWidget.cpp

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -72,16 +72,6 @@ TimeDurationOptionWidget<Type>::TimeDurationOptionWidget(QWidget& parent, TimeDu
7272
, ConfigWidget(value, *this)
7373
, m_value(value)
7474
{
75-
this->setToolTip(QString::fromStdString(
76-
"Time duration in " + value.units() +
77-
"<br><br>"
78-
"For controller timings, this will be rounded "
79-
"up to the tick size of the controller."
80-
"<br><br>"
81-
"The tick size for wired controllers is usually 8ms and are very precise."
82-
"<br><br>"
83-
"Wireless controllers have larger tick sizes and are imprecise due to wireless communication latency."
84-
));
8575

8676
QHBoxLayout* layout = new QHBoxLayout(this);
8777
layout->setContentsMargins(0, 0, 0, 0);
@@ -102,6 +92,16 @@ TimeDurationOptionWidget<Type>::TimeDurationOptionWidget(QWidget& parent, TimeDu
10292
m_box = new QLineEdit(QString::fromStdString(m_value.current_text()), this);
10393
row0->addWidget(m_box);
10494
row0->addWidget(new QLabel(QString::fromStdString(value.units()), this));
95+
m_box->setToolTip(QString::fromStdString(
96+
"Time duration in " + value.units() +
97+
"<br><br>"
98+
"For controller timings, this will be rounded "
99+
"up to the tick size of the controller."
100+
"<br><br>"
101+
"The tick size for wired controllers is usually 8ms and are very precise."
102+
"<br><br>"
103+
"Wireless controllers have larger tick sizes and are imprecise due to wireless communication latency."
104+
));
105105

106106
QLabel* description = new QLabel(QString::fromStdString(m_value.time_string()), this);
107107
description->setAlignment(Qt::AlignHCenter);

SerialPrograms/Source/PokemonBDSP/PokemonBDSP_Settings.cpp

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

7-
#include "Common/NintendoSwitch/NintendoSwitch_ControllerDefs.h"
8-
#include "CommonFramework/Globals.h"
97
#include "Pokemon/Pokemon_Strings.h"
108
#include "PokemonBDSP_Settings.h"
119

1210
namespace PokemonAutomation{
1311
namespace NintendoSwitch{
1412
namespace PokemonBDSP{
15-
using namespace Pokemon;
13+
14+
using namespace Pokemon;
1615

1716

1817

@@ -181,9 +180,9 @@ GameSettings_Descriptor::GameSettings_Descriptor()
181180
: PanelDescriptor(
182181
Color(),
183182
"PokemonBDSP:GlobalSettings",
184-
STRING_POKEMON + " BDSP", STRING_POKEMON + " Settings",
183+
STRING_POKEMON + " BDSP", "Game Settings",
185184
"ComputerControl/blob/master/Wiki/Programs/PokemonBDSP/PokemonSettings.md",
186-
"Global " + STRING_POKEMON + " Settings"
185+
"Global " + STRING_POKEMON + " Brilliant Diamond and Shing Pearl Settings"
187186
)
188187
{}
189188

SerialPrograms/Source/PokemonLA/Options/PokemonLA_ShinyDetectedAction.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -143,7 +143,7 @@ void on_shiny_sound(
143143
pbf_press_button(context, BUTTON_CAPTURE, 2 * TICKS_PER_SECOND, 0);
144144
}
145145

146-
pbf_press_button(context, BUTTON_HOME, 20, GameSettings::instance().GAME_TO_HOME_DELAY);
146+
pbf_press_button(context, BUTTON_HOME, 160ms, GameSettings::instance().GAME_TO_HOME_DELAY0);
147147
context.wait_for_all_requests();
148148
throw ProgramFinishedException();
149149
}

SerialPrograms/Source/PokemonLA/PokemonLA_Settings.cpp

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

7-
#include "Common/NintendoSwitch/NintendoSwitch_ControllerDefs.h"
8-
#include "CommonFramework/Globals.h"
97
#include "Pokemon/Pokemon_Strings.h"
108
#include "PokemonLA_Settings.h"
119

@@ -29,25 +27,15 @@ GameSettings::GameSettings()
2927
1.0, 0, 100
3028
)
3129
, m_menu_navigation("<font size=4><b>Menu Navigation Timings:</b></font>")
32-
// , OVERWORLD_TO_MENU_DELAY(
33-
// "<b>Overworld to Menu Delay:</b><br>Delay to bring up the menu when pressing X in the overworld.",
34-
// "250"
35-
// )
36-
// , MENU_TO_OVERWORLD_DELAY(
37-
// "<b>Menu to Overworld Delay:</b><br>Delay to go from menu back to overworld.",
38-
// "250"
39-
// )
40-
, GAME_TO_HOME_DELAY(
30+
, GAME_TO_HOME_DELAY0(
4131
"<b>Game to Home Delay:</b><br>Delay from pressing home to entering the the Switch home menu.",
4232
LockMode::LOCK_WHILE_RUNNING,
43-
TICKS_PER_SECOND,
44-
"125"
33+
"1000ms"
4534
)
46-
, LOAD_REGION_TIMEOUT(
35+
, LOAD_REGION_TIMEOUT0(
4736
"<b>Load Region Timeout:</b><br>Wait at most this long to enter a region before giving up.",
4837
LockMode::LOCK_WHILE_RUNNING,
49-
TICKS_PER_SECOND,
50-
"30 * TICKS_PER_SECOND"
38+
"30s"
5139
)
5240
, m_start_game_timings("<font size=4><b>Start Game Timings:</b></font>")
5341
, START_GAME_MASH0(
@@ -58,19 +46,17 @@ GameSettings::GameSettings()
5846
, START_GAME_WAIT1(
5947
"<b>2. Start Game Wait:</b><br>Wait this long for the game to load.",
6048
LockMode::LOCK_WHILE_RUNNING,
61-
"40000ms"
49+
"40s"
6250
)
63-
, ENTER_GAME_MASH(
51+
, ENTER_GAME_MASH0(
6452
"<b>3. Enter Game Mash:</b><br>Mash A for this long to enter the game.",
6553
LockMode::LOCK_WHILE_RUNNING,
66-
TICKS_PER_SECOND,
67-
"5 * TICKS_PER_SECOND"
54+
"5000ms"
6855
)
69-
, ENTER_GAME_WAIT(
56+
, ENTER_GAME_WAIT0(
7057
"<b>4. Enter Game Wait:</b><br>Wait this long for the game to enter the overworld.",
7158
LockMode::LOCK_WHILE_RUNNING,
72-
TICKS_PER_SECOND,
73-
"15 * TICKS_PER_SECOND"
59+
"15s"
7460
)
7561
, m_advanced_options(
7662
"<font size=4><b>Advanced Options:</b> You should not need to touch anything below here.</font>"
@@ -110,16 +96,14 @@ GameSettings::GameSettings()
11096
PA_ADD_OPTION(POST_WARP_DELAY);
11197

11298
PA_ADD_STATIC(m_menu_navigation);
113-
// PA_ADD_OPTION(OVERWORLD_TO_MENU_DELAY);
114-
// PA_ADD_OPTION(MENU_TO_OVERWORLD_DELAY);
115-
PA_ADD_OPTION(GAME_TO_HOME_DELAY);
116-
PA_ADD_OPTION(LOAD_REGION_TIMEOUT);
99+
PA_ADD_OPTION(GAME_TO_HOME_DELAY0);
100+
PA_ADD_OPTION(LOAD_REGION_TIMEOUT0);
117101

118102
PA_ADD_STATIC(m_start_game_timings);
119103
PA_ADD_OPTION(START_GAME_MASH0);
120104
PA_ADD_OPTION(START_GAME_WAIT1);
121-
PA_ADD_OPTION(ENTER_GAME_MASH);
122-
PA_ADD_OPTION(ENTER_GAME_WAIT);
105+
PA_ADD_OPTION(ENTER_GAME_MASH0);
106+
PA_ADD_OPTION(ENTER_GAME_WAIT0);
123107

124108
PA_ADD_STATIC(m_advanced_options);
125109
PA_ADD_OPTION(SHINY_SOUND_THRESHOLD);
@@ -138,9 +122,9 @@ GameSettings_Descriptor::GameSettings_Descriptor()
138122
: PanelDescriptor(
139123
Color(),
140124
"PokemonLA:GlobalSettings",
141-
STRING_POKEMON + " LA", STRING_POKEMON + " Settings",
125+
STRING_POKEMON + " LA", "Game Settings",
142126
"ComputerControl/blob/master/Wiki/Programs/PokemonLA/PokemonSettings.md",
143-
"Global " + STRING_POKEMON + " Settings"
127+
"Global " + STRING_POKEMON + " Legends Arceus Settings"
144128
)
145129
{}
146130

SerialPrograms/Source/PokemonLA/PokemonLA_Settings.h

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -8,10 +8,8 @@
88
#define PokemonAutomation_PokemonLA_Settings_H
99

1010
#include "Common/Cpp/Options/StaticTextOption.h"
11-
#include "Common/Cpp/Options/BooleanCheckBoxOption.h"
1211
#include "Common/Cpp/Options/FloatingPointOption.h"
1312
#include "Common/Cpp/Options/TimeDurationOption.h"
14-
#include "Common/Cpp/Options/TimeExpressionOption.h"
1513
#include "CommonFramework/Panels/SettingsPanel.h"
1614

1715
namespace PokemonAutomation{
@@ -28,16 +26,14 @@ class GameSettings : public BatchOption{
2826
FloatingPointOption POST_WARP_DELAY;
2927

3028
SectionDividerOption m_menu_navigation;
31-
// TimeExpressionOption<uint16_t> OVERWORLD_TO_MENU_DELAY;
32-
// TimeExpressionOption<uint16_t> MENU_TO_OVERWORLD_DELAY;
33-
TimeExpressionOption<uint16_t> GAME_TO_HOME_DELAY;
34-
TimeExpressionOption<uint16_t> LOAD_REGION_TIMEOUT;
29+
MillisecondsOption GAME_TO_HOME_DELAY0;
30+
MillisecondsOption LOAD_REGION_TIMEOUT0;
3531

3632
SectionDividerOption m_start_game_timings;
3733
MillisecondsOption START_GAME_MASH0;
3834
MillisecondsOption START_GAME_WAIT1;
39-
TimeExpressionOption<uint16_t> ENTER_GAME_MASH;
40-
TimeExpressionOption<uint16_t> ENTER_GAME_WAIT;
35+
MillisecondsOption ENTER_GAME_MASH0;
36+
MillisecondsOption ENTER_GAME_WAIT0;
4137

4238
SectionDividerOption m_advanced_options;
4339
FloatingPointOption SHINY_SOUND_THRESHOLD;

SerialPrograms/Source/PokemonLA/Programs/Farming/PokemonLA_LeapGrinder.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -278,15 +278,15 @@ void LeapGrinder::program(SingleSwitchProgramEnvironment& env, SwitchControllerC
278278
stats.errors++;
279279
e.send_notification(env, NOTIFICATION_ERROR_RECOVERABLE);
280280

281-
pbf_press_button(context, BUTTON_HOME, 20, GameSettings::instance().GAME_TO_HOME_DELAY);
281+
pbf_press_button(context, BUTTON_HOME, 160ms, GameSettings::instance().GAME_TO_HOME_DELAY0);
282282
reset_game_from_home(env, env.console, context, ConsoleSettings::instance().TOLERATE_SYSTEM_UPDATE_MENU_FAST);
283283
// Switch from items to pokemons
284284
pbf_press_button(context, BUTTON_X, 20, 30);
285285
}
286286
}
287287

288288
env.update_stats();
289-
pbf_press_button(context, BUTTON_HOME, 20, GameSettings::instance().GAME_TO_HOME_DELAY);
289+
pbf_press_button(context, BUTTON_HOME, 160ms, GameSettings::instance().GAME_TO_HOME_DELAY0);
290290
send_program_finished_notification(env, NOTIFICATION_PROGRAM_FINISH);
291291
}
292292

SerialPrograms/Source/PokemonLA/Programs/Farming/PokemonLA_NuggetFarmerHighlands.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -230,7 +230,7 @@ void NuggetFarmerHighlands::program(SingleSwitchProgramEnvironment& env, SwitchC
230230
stats.errors++;
231231
e.send_notification(env, NOTIFICATION_ERROR_RECOVERABLE);
232232

233-
pbf_press_button(context, BUTTON_HOME, 20, GameSettings::instance().GAME_TO_HOME_DELAY);
233+
pbf_press_button(context, BUTTON_HOME, 160ms, GameSettings::instance().GAME_TO_HOME_DELAY0);
234234
reset_game_from_home(env, env.console, context, ConsoleSettings::instance().TOLERATE_SYSTEM_UPDATE_MENU_FAST);
235235
}
236236
}

SerialPrograms/Source/PokemonLA/Programs/General/PokemonLA_DistortionWaiter.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -147,7 +147,7 @@ void DistortionWaiter::program(SingleSwitchProgramEnvironment& env, SwitchContro
147147
{}, "",
148148
env.console.video().snapshot()
149149
);
150-
pbf_press_button(context, BUTTON_HOME, 20, GameSettings::instance().GAME_TO_HOME_DELAY);
150+
pbf_press_button(context, BUTTON_HOME, 160ms, GameSettings::instance().GAME_TO_HOME_DELAY0);
151151
}
152152

153153

SerialPrograms/Source/PokemonLA/Programs/General/PokemonLA_OutbreakFinder.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -735,7 +735,7 @@ bool OutbreakFinder::run_iteration(
735735
}
736736

737737
env.log("No target MMO sprite found. Reset game...");
738-
pbf_press_button(context, BUTTON_HOME, 20, GameSettings::instance().GAME_TO_HOME_DELAY);
738+
pbf_press_button(context, BUTTON_HOME, 160ms, GameSettings::instance().GAME_TO_HOME_DELAY0);
739739
reset_game_from_home(env, env.console, context, ConsoleSettings::instance().TOLERATE_SYSTEM_UPDATE_MENU_FAST);
740740
}
741741
}

SerialPrograms/Source/PokemonLA/Programs/General/PokemonLA_RamanasIslandCombee.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -328,7 +328,7 @@ void RamanasCombeeFinder::program(SingleSwitchProgramEnvironment& env, SwitchCon
328328
stats.errors++;
329329
e.send_notification(env, NOTIFICATION_ERROR_RECOVERABLE);
330330

331-
pbf_press_button(context, BUTTON_HOME, 20, GameSettings::instance().GAME_TO_HOME_DELAY);
331+
pbf_press_button(context, BUTTON_HOME, 160ms, GameSettings::instance().GAME_TO_HOME_DELAY0);
332332
reset_game_from_home(env, env.console, context, ConsoleSettings::instance().TOLERATE_SYSTEM_UPDATE_MENU_FAST);
333333
}
334334
}

0 commit comments

Comments
 (0)