Skip to content

Commit a41cbb5

Browse files
committed
Cherrypick fixes.
1 parent 139d10a commit a41cbb5

18 files changed

+91
-62
lines changed

SerialPrograms/Source/CommonFramework/Globals.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,10 +23,10 @@ namespace PokemonAutomation{
2323
// misleading version information.
2424
//
2525

26-
const bool IS_BETA_VERSION = true;
26+
const bool IS_BETA_VERSION = false;
2727
const int PROGRAM_VERSION_MAJOR = 0;
2828
const int PROGRAM_VERSION_MINOR = 53;
29-
const int PROGRAM_VERSION_PATCH = 2;
29+
const int PROGRAM_VERSION_PATCH = 3;
3030

3131
const std::string PROGRAM_VERSION_BASE =
3232
"v" + std::to_string(PROGRAM_VERSION_MAJOR) +

SerialPrograms/Source/NintendoSwitch/DevPrograms/TestProgramSwitch.cpp

Lines changed: 15 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -319,7 +319,22 @@ void TestProgram::program(MultiSwitchProgramEnvironment& env, CancellableScope&
319319
// std::terminate();
320320

321321

322+
323+
ImageRGB32 image("20250430-043221293730.png");
324+
322325
#if 1
326+
{
327+
TeraSilhouetteReader reader;
328+
ImageMatch::ImageMatchResult results = reader.read(image);
329+
results.log(logger, 110);
330+
}
331+
#endif
332+
333+
334+
335+
336+
337+
#if 0
323338
ssf_press_button(context, Button::BUTTON_ZR, 1s, 60h, 0ms);
324339
// context->issue_gyro_rotate_x(&scope, 0s, 60h, 0ms, 0x1000);
325340
// context->issue_gyro_rotate_y(&scope, 0s, 60h, 0ms, 0x0000);
@@ -527,16 +542,6 @@ void TestProgram::program(MultiSwitchProgramEnvironment& env, CancellableScope&
527542
#endif
528543

529544

530-
// ImageRGB32 image("screenshot-20250224-203247822474.png");
531-
532-
#if 0
533-
{
534-
TeraSilhouetteReader reader;
535-
ImageMatch::ImageMatchResult results = reader.read(image);
536-
results.log(logger, 110);
537-
}
538-
#endif
539-
540545
#if 0
541546
{
542547
TeraTypeReader reader;

SerialPrograms/Source/NintendoSwitch/Framework/NintendoSwitch_MultiSwitchProgramSession.cpp

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -87,16 +87,13 @@ void MultiSwitchProgramSession::run_program_instance(MultiSwitchProgramEnvironme
8787
size_t consoles = m_system.count();
8888
for (size_t c = 0; c < consoles; c++){
8989
m_option.instance().start_program_controller_check(
90-
scope,
9190
m_system[c].controller_session(), c
9291
);
9392
m_option.instance().start_program_feedback_check(
94-
scope,
9593
env.consoles[c], c,
9694
m_option.descriptor().feedback()
9795
);
9896
m_option.instance().start_program_border_check(
99-
scope,
10097
env.consoles[c], c,
10198
m_option.descriptor().feedback()
10299
);

SerialPrograms/Source/NintendoSwitch/Framework/NintendoSwitch_SingleSwitchProgramSession.cpp

Lines changed: 9 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -66,24 +66,23 @@ void SingleSwitchProgramSession::run_program_instance(SingleSwitchProgramEnviron
6666

6767
// Startup Checks
6868
m_option.instance().start_program_controller_check(
69-
scope, m_system.controller_session()
69+
m_system.controller_session()
7070
);
7171
m_option.instance().start_program_feedback_check(
72-
scope, env.console,
72+
env.console,
7373
m_option.descriptor().feedback()
7474
);
7575
m_option.instance().start_program_border_check(
76-
scope, env.console,
76+
env.console,
7777
m_option.descriptor().feedback()
7878
);
7979

80-
m_scope.store(&scope, std::memory_order_release);
80+
ControllerContext<AbstractController> context(scope, env.console.controller());
81+
m_scope.store(&context, std::memory_order_release);
8182

8283
#ifdef PA_CATCH_PROGRAM_SYSTEM_EXCEPTIONS
8384
try{
84-
m_option.instance().program(env, scope);
85-
86-
ControllerContext<AbstractController> context(scope, env.console.controller());
85+
m_option.instance().program(env, context);
8786
context.wait_for_all_requests();
8887
}catch (...){
8988
try{
@@ -130,11 +129,11 @@ void SingleSwitchProgramSession::internal_run_program(){
130129
m_option.descriptor().display_name(),
131130
timestamp()
132131
);
133-
CancellableHolder<CancellableScope> scope;
134132
AbstractController* controller = m_system.controller_session().controller();
133+
ControllerContext<AbstractController> context(*controller);
135134
SingleSwitchProgramEnvironment env(
136135
program_info,
137-
scope,
136+
context,
138137
*this,
139138
current_stats_tracker(), historical_stats_tracker(),
140139
m_system.logger(),
@@ -147,7 +146,7 @@ void SingleSwitchProgramSession::internal_run_program(){
147146

148147
try{
149148
logger().log("<b>Starting Program: " + identifier() + "</b>");
150-
run_program_instance(env, scope);
149+
run_program_instance(env, context);
151150
logger().log("Program finished normally!", COLOR_BLUE);
152151
}catch (OperationCancelledException&){
153152
}catch (ProgramCancelledException&){

SerialPrograms/Source/NintendoSwitch/NintendoSwitch_MultiSwitchProgram.cpp

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -155,22 +155,19 @@ MultiSwitchProgramInstance::MultiSwitchProgramInstance(
155155

156156

157157
void MultiSwitchProgramInstance::start_program_controller_check(
158-
CancellableScope& scope,
159158
ControllerSession& session, size_t console_index
160159
){
161160
if (!session.ready()){
162161
throw UserSetupError(session.logger(), "Cannot Start: Controller is not ready.");
163162
}
164163
}
165164
void MultiSwitchProgramInstance::start_program_feedback_check(
166-
CancellableScope& scope,
167165
VideoStream& stream, size_t console_index,
168166
FeedbackType feedback_type
169167
){
170168
StartProgramChecks::check_feedback(stream, feedback_type);
171169
}
172170
void MultiSwitchProgramInstance::start_program_border_check(
173-
CancellableScope& scope,
174171
VideoStream& stream, size_t console_index,
175172
FeedbackType feedback_type
176173
){

SerialPrograms/Source/NintendoSwitch/NintendoSwitch_MultiSwitchProgram.h

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -145,16 +145,13 @@ class MultiSwitchProgramInstance{
145145
// Startup Checks: Feel free to override to change behavior.
146146

147147
virtual void start_program_controller_check(
148-
CancellableScope& scope,
149148
ControllerSession& session, size_t console_index
150149
);
151150
virtual void start_program_feedback_check(
152-
CancellableScope& scope,
153151
VideoStream& stream, size_t console_index,
154152
FeedbackType feedback_type
155153
);
156154
virtual void start_program_border_check(
157-
CancellableScope& scope,
158155
VideoStream& stream, size_t console_index,
159156
FeedbackType feedback_type
160157
);

SerialPrograms/Source/NintendoSwitch/NintendoSwitch_SingleSwitchProgram.cpp

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -82,7 +82,6 @@ void SingleSwitchProgramInstance::program(SingleSwitchProgramEnvironment& env, P
8282

8383

8484
void SingleSwitchProgramInstance::start_program_controller_check(
85-
CancellableScope& scope,
8685
ControllerSession& session
8786
){
8887
if (!session.ready()){
@@ -96,14 +95,12 @@ void SingleSwitchProgramInstance::start_program_controller_check(
9695
);
9796
}
9897
void SingleSwitchProgramInstance::start_program_feedback_check(
99-
CancellableScope& scope,
10098
VideoStream& stream,
10199
FeedbackType feedback_type
102100
){
103101
StartProgramChecks::check_feedback(stream, feedback_type);
104102
}
105103
void SingleSwitchProgramInstance::start_program_border_check(
106-
CancellableScope& scope,
107104
VideoStream& stream,
108105
FeedbackType feedback_type
109106
){

SerialPrograms/Source/NintendoSwitch/NintendoSwitch_SingleSwitchProgram.h

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -122,16 +122,13 @@ class SingleSwitchProgramInstance{
122122
// Startup Checks: Feel free to override to change behavior.
123123

124124
virtual void start_program_controller_check(
125-
CancellableScope& scope,
126125
ControllerSession& session
127126
);
128127
virtual void start_program_feedback_check(
129-
CancellableScope& scope,
130128
VideoStream& stream,
131129
FeedbackType feedback_type
132130
);
133131
virtual void start_program_border_check(
134-
CancellableScope& scope,
135132
VideoStream& stream,
136133
FeedbackType feedback_type
137134
);

SerialPrograms/Source/NintendoSwitch/Programs/NintendoSwitch_Navigation.cpp

Lines changed: 27 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -38,8 +38,14 @@ void home_to_date_time(ProControllerContext& context, bool to_date_change, bool
3838
ssf_issue_scroll(context, SSF_SCROLL_DOWN, 24ms);
3939
}while (--iterations);
4040
}
41+
42+
// Scroll left and press A to exit the sleep menu if we happened to
43+
// land there.
44+
ssf_issue_scroll(context, SSF_SCROLL_LEFT, 3);
45+
ssf_press_button(context, BUTTON_A, 3);
46+
4147
{
42-
auto iterations = Milliseconds(336) / 24ms + 1;
48+
auto iterations = Milliseconds(312) / 24ms + 1;
4349
do{
4450
ssf_issue_scroll(context, SSF_SCROLL_RIGHT, 24ms);
4551
}while (--iterations);
@@ -59,12 +65,17 @@ void home_to_date_time(ProControllerContext& context, bool to_date_change, bool
5965

6066
ssf_press_button(context, BUTTON_A, 3);
6167
{
62-
auto iterations = Milliseconds(216) / 24ms + 1;
68+
auto iterations = Milliseconds(240) / 24ms + 1;
6369
do{
6470
ssf_issue_scroll(context, SSF_SCROLL_DOWN, 24ms);
6571
}while (--iterations);
6672
}
67-
ssf_issue_scroll(context, SSF_SCROLL_DOWN, 0);
73+
// ssf_issue_scroll(context, SSF_SCROLL_DOWN, 0);
74+
75+
// Left scroll in case we missed landed in the language change or sleep
76+
// confirmation menus.
77+
ssf_issue_scroll(context, SSF_SCROLL_LEFT, 0ms);
78+
6879
break;
6980
}
7081
case ControllerPerformanceClass::SerialPABotBase_Wireless_ESP32:{
@@ -93,8 +104,14 @@ void home_to_date_time(ProControllerContext& context, bool to_date_change, bool
93104
ssf_issue_scroll(context, SSF_SCROLL_DOWN, unit);
94105
}while (--iterations);
95106
}
107+
108+
// Scroll left and press A to exit the sleep menu if we happened to
109+
// land there.
110+
ssf_issue_scroll(context, SSF_SCROLL_LEFT, unit);
111+
ssf_press_button(context, BUTTON_A, unit, 2*unit, unit);
112+
96113
{
97-
auto iterations = Milliseconds(336) / unit + 1;
114+
auto iterations = Milliseconds(312) / unit + 1;
98115
do{
99116
ssf_issue_scroll(context, SSF_SCROLL_RIGHT, unit);
100117
}while (--iterations);
@@ -108,6 +125,8 @@ void home_to_date_time(ProControllerContext& context, bool to_date_change, bool
108125
ssf_issue_scroll(context, SSF_SCROLL_DOWN, unit);
109126

110127
if (!to_date_change){
128+
// Double up this A press in case one is dropped.
129+
ssf_press_button(context, BUTTON_A, unit);
111130
ssf_press_button(context, BUTTON_A, 360ms, 2*unit, unit);
112131
return;
113132
}
@@ -122,8 +141,8 @@ void home_to_date_time(ProControllerContext& context, bool to_date_change, bool
122141
}while (--iterations);
123142
}
124143

125-
// Left scroll in case we missed the date menu and landed in the
126-
// language change.
144+
// Left scroll in case we missed landed in the language change or sleep
145+
// confirmation menus.
127146
ssf_issue_scroll(context, SSF_SCROLL_LEFT, 0ms, 2*unit, unit);
128147

129148
break;
@@ -181,14 +200,15 @@ void home_to_date_time(JoyconContext& context, bool to_date_change){
181200
//From ControllerPerformanceClass::SerialPABotBase_Wireless_ESP32
182201
//as Joycon will only have that controller type
183202

203+
pbf_move_joystick(context, 255, 128, 2*unit, unit);
184204
pbf_move_joystick(context, 255, 128, 2*unit, unit);
185205
pbf_move_joystick(context, 255, 128, 2*unit, unit);
186206

187207
// Down twice in case we drop one.
188208
pbf_move_joystick(context, 128, 255, 2*unit, unit);
189209
pbf_move_joystick(context, 128, 255, 2*unit, unit);
190210

191-
pbf_move_joystick(context, 255, 128, 2*unit, unit);
211+
pbf_move_joystick(context, 0, 128, 2*unit, unit);
192212

193213
// Press A multiple times to make sure one goes through.
194214
pbf_press_button(context, BUTTON_A, 2*unit, unit);

SerialPrograms/Source/PokemonLGPE/Programs/TestPrograms/PokemonLGPE_SoundListener.h

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,6 @@ class SoundListener : public SingleSwitchProgramInstance{
3030
virtual void program(SingleSwitchProgramEnvironment& env, CancellableScope& scope) override;
3131

3232
virtual void start_program_border_check(
33-
CancellableScope& scope,
3433
VideoStream& stream,
3534
FeedbackType feedback_type
3635
) override{}

0 commit comments

Comments
 (0)