Skip to content

Commit 0d4c6f4

Browse files
authored
Merge branch 'PokemonAutomation:main' into main
2 parents 0c80013 + 0077594 commit 0d4c6f4

18 files changed

Lines changed: 244 additions & 175 deletions

.azure-pipelines/azure-pipelines.yml

Lines changed: 29 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -10,13 +10,11 @@ resources:
1010
type: github
1111
name: PokemonAutomation/Arduino-Source-Internal
1212
endpoint: PokemonAutomation
13-
ref: refs/heads/master
1413

1514
- repository: Arduino-Source
1615
type: github
1716
name: PokemonAutomation/Arduino-Source
1817
endpoint: PokemonAutomation
19-
ref: refs/heads/main
2018

2119
variables:
2220
- group: apple-signing
@@ -452,6 +450,28 @@ stages:
452450
# poolName: AlarmClock
453451
# condition: always()
454452

453+
##########################################
454+
# ARTIFACT VALIDATION #
455+
##########################################
456+
457+
- stage: Manual_Validation
458+
displayName: 'Manual Validation'
459+
dependsOn:
460+
- Upload_Debug_Symbols
461+
condition: and(succeeded(), eq('${{ parameters.targetOS }}', 'All'), ne('${{ parameters.buildType }}', 'Commit'))
462+
jobs:
463+
- job: ManualValidation
464+
displayName: 'Manual Validation'
465+
pool: server
466+
timeoutInMinutes: 1440
467+
steps:
468+
- task: ManualValidation@0
469+
timeoutInMinutes: 1440
470+
inputs:
471+
notifyUsers: '$(Build.RequestedForEmail)'
472+
instructions: 'Please validate the build artifacts for each platform. Approve to proceed or reject to fail the pipeline.'
473+
onTimeout: 'reject'
474+
455475
##########################################
456476
# UPDATE TELEMETRY JSON #
457477
##########################################
@@ -461,7 +481,7 @@ stages:
461481
stageName: Update_GitHub_Telemetry_JSON
462482
displayName: 'Update GitHub Telemetry JSON'
463483
dependsOn:
464-
- Upload_Debug_Symbols
484+
- Manual_Validation
465485
buildType: ${{ parameters.buildType }}
466486
versionMajor: ${{ parameters.versionMajor }}
467487
versionMinor: ${{ parameters.versionMinor }}
@@ -506,4 +526,9 @@ stages:
506526
versionMinor: ${{ parameters.versionMinor }}
507527
versionPatch: ${{ parameters.versionPatch }}
508528
versionRepo: PokemonAutomation/ComputerControl
509-
condition: and(succeeded(), eq('${{ parameters.targetOS }}', 'All'), ne('${{ parameters.buildType }}', 'Commit'))
529+
condition: |
530+
and(
531+
in(dependencies.Publish_GitHub_Release.result, 'Succeeded', 'Skipped'),
532+
eq('${{ parameters.targetOS }}', 'All'),
533+
ne('${{ parameters.buildType }}', 'Commit')
534+
)

SerialPrograms/Source/CommonFramework/GlobalSettingsPanel.cpp

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -253,14 +253,8 @@ GlobalSettings::GlobalSettings()
253253
PA_ADD_OPTION(LOG_WINDOW_STARTUP);
254254

255255
PA_ADD_OPTION(KEYBOARD_CONTROLS_LAYOUT);
256+
PA_ADD_OPTION(STREAM_HISTORY);
256257

257-
#if (QT_VERSION_MAJOR == 6) && (QT_VERSION_MINOR >= 8)
258-
if (IS_BETA_VERSION || PreloadSettings::instance().DEVELOPER_MODE){
259-
PA_ADD_OPTION(STREAM_HISTORY);
260-
}
261-
#else
262-
STREAM_HISTORY->set_enabled(false);
263-
#endif
264258
#ifdef PA_ENABLE_SLEEP_SUPPRESS
265259
PA_ADD_OPTION(SLEEP_SUPPRESS);
266260
#endif

SerialPrograms/Source/CommonFramework/Globals.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ namespace PokemonAutomation{
3636
#endif
3737

3838
#ifndef PA_VERSION_PATCH
39-
#define PA_VERSION_PATCH 4
39+
#define PA_VERSION_PATCH 5
4040
#endif
4141

4242
const bool IS_BETA_VERSION = PA_IS_BETA;

SerialPrograms/Source/NintendoSwitch/Framework/UI/NintendoSwitch_CommandRow.cpp

Lines changed: 10 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -161,21 +161,17 @@ CommandRow::CommandRow(
161161
this, [this](bool){ emit screenshot_requested(); }
162162
);
163163

164-
#if (QT_VERSION_MAJOR == 6) && (QT_VERSION_MINOR >= 8)
165-
if (IS_BETA_VERSION || PreloadSettings::instance().DEVELOPER_MODE){
166-
m_video_button = new QPushButton("Video Capture", this);
167-
layout1->addWidget(m_video_button, 2);
168-
if (GlobalSettings::instance().STREAM_HISTORY->enabled()){
169-
connect(
170-
m_video_button, &QPushButton::clicked,
171-
this, [this](bool){ emit video_requested(); }
172-
);
173-
}else{
174-
m_video_button->setEnabled(false);
175-
m_video_button->setToolTip("Please turn on Stream History to enable video capture.");
176-
}
164+
m_video_button = new QPushButton("Video Capture", this);
165+
layout1->addWidget(m_video_button, 2);
166+
if (GlobalSettings::instance().STREAM_HISTORY->enabled()){
167+
connect(
168+
m_video_button, &QPushButton::clicked,
169+
this, [this](bool){ emit video_requested(); }
170+
);
171+
}else{
172+
m_video_button->setEnabled(false);
173+
m_video_button->setToolTip("Please turn on Stream History to enable video capture.");
177174
}
178-
#endif
179175

180176
m_session.add_listener(*this);
181177
m_controller.add_listener(*this);

SerialPrograms/Source/PokemonFRLG/Inference/Dialogs/PokemonFRLG_DialogDetector.cpp

Lines changed: 84 additions & 68 deletions
Original file line numberDiff line numberDiff line change
@@ -26,46 +26,52 @@ namespace NintendoSwitch{
2626
namespace PokemonFRLG{
2727

2828
WhiteDialogDetector::WhiteDialogDetector(Color color)
29-
: m_right_box(0.844, 0.725, 0.005, 0.197)
30-
, m_top_box(0.151, 0.719, 0.698, 0.006)
31-
, m_bottom_box(0.152, 0.913, 0.692, 0.009)
29+
: m_right_box(0.923385, 0.748077, 0.00615385, 0.204577)
30+
, m_top_box(0.0704615, 0.741846, 0.859077, 0.00623077)
31+
, m_bottom_box(0.0716923, 0.943308, 0.851692, 0.00934615)
3232
{}
3333
void WhiteDialogDetector::make_overlays(VideoOverlaySet& items) const{
34-
items.add(COLOR_RED, m_right_box);
35-
items.add(COLOR_RED, m_top_box);
36-
items.add(COLOR_RED, m_bottom_box);
34+
const BoxOption& GAME_BOX = GameSettings::instance().GAME_BOX;
35+
items.add(COLOR_RED, GAME_BOX.inner_to_outer(m_right_box));
36+
items.add(COLOR_RED, GAME_BOX.inner_to_outer(m_top_box));
37+
items.add(COLOR_RED, GAME_BOX.inner_to_outer(m_bottom_box));
3738
}
3839
bool WhiteDialogDetector::detect(const ImageViewRGB32& screen){
39-
ImageViewRGB32 right_image = extract_box_reference(screen, m_right_box);
40-
ImageViewRGB32 top_image = extract_box_reference(screen, m_top_box);
41-
ImageViewRGB32 bottom_image = extract_box_reference(screen, m_bottom_box);
40+
ImageViewRGB32 game_screen = extract_box_reference(screen, GameSettings::instance().GAME_BOX);
41+
42+
ImageViewRGB32 right_image = extract_box_reference(game_screen, m_right_box);
43+
ImageViewRGB32 top_image = extract_box_reference(game_screen, m_top_box);
44+
ImageViewRGB32 bottom_image = extract_box_reference(game_screen, m_bottom_box);
4245
if (is_white(right_image)
4346
&& is_white(top_image)
4447
&& is_white(bottom_image)
45-
){
48+
){
4649
return true;
4750
}
4851
return false;
4952
}
5053

5154
AdvanceWhiteDialogDetector::AdvanceWhiteDialogDetector(Color color)
52-
: m_dialog_box(0.145, 0.727, 0.707, 0.193)
53-
, m_right_box(0.844, 0.725, 0.005, 0.197)
54-
, m_top_box(0.151, 0.719, 0.698, 0.006)
55-
, m_bottom_box(0.152, 0.913, 0.692, 0.009)
55+
: m_dialog_box(0.0630769, 0.750154, 0.870154, 0.200423)
56+
, m_right_box(0.923385, 0.748077, 0.00615385, 0.204577)
57+
, m_top_box(0.0704615, 0.741846, 0.859077, 0.00623077)
58+
, m_bottom_box(0.0716923, 0.943308, 0.851692, 0.00934615)
5659
{}
5760
void AdvanceWhiteDialogDetector::make_overlays(VideoOverlaySet& items) const{
58-
items.add(COLOR_RED, m_dialog_box);
59-
items.add(COLOR_RED, m_right_box);
60-
items.add(COLOR_RED, m_top_box);
61-
items.add(COLOR_RED, m_bottom_box);
61+
const BoxOption& GAME_BOX = GameSettings::instance().GAME_BOX;
62+
items.add(COLOR_RED, GAME_BOX.inner_to_outer(m_dialog_box));
63+
items.add(COLOR_RED, GAME_BOX.inner_to_outer(m_right_box));
64+
items.add(COLOR_RED, GAME_BOX.inner_to_outer(m_top_box));
65+
items.add(COLOR_RED, GAME_BOX.inner_to_outer(m_bottom_box));
6266
}
6367
bool AdvanceWhiteDialogDetector::detect(const ImageViewRGB32& screen){
68+
ImageViewRGB32 game_screen = extract_box_reference(screen, GameSettings::instance().GAME_BOX);
69+
6470
const bool replace_color_within_range = false;
6571

6672
//Filter out background
6773
ImageRGB32 filtered_region = filter_rgb32_range(
68-
extract_box_reference(screen, m_dialog_box),
74+
extract_box_reference(game_screen, m_dialog_box),
6975
combine_rgb(164, 0, 0), combine_rgb(255, 114, 87), Color(0), replace_color_within_range
7076
);
7177
ImageStats stats = image_stats(filtered_region);
@@ -77,118 +83,129 @@ bool AdvanceWhiteDialogDetector::detect(const ImageViewRGB32& screen){
7783
cout << stats.average.b << endl;
7884
*/
7985

80-
ImageViewRGB32 right_image = extract_box_reference(screen, m_right_box);
81-
ImageViewRGB32 top_image = extract_box_reference(screen, m_top_box);
82-
ImageViewRGB32 bottom_image = extract_box_reference(screen, m_bottom_box);
86+
ImageViewRGB32 right_image = extract_box_reference(game_screen, m_right_box);
87+
ImageViewRGB32 top_image = extract_box_reference(game_screen, m_top_box);
88+
ImageViewRGB32 bottom_image = extract_box_reference(game_screen, m_bottom_box);
8389

8490
if (is_white(right_image)
8591
&& is_white(top_image)
8692
&& is_white(bottom_image)
8793
&& (stats.average.r > stats.average.b + 180)
8894
&& (stats.average.r > stats.average.g + 180)
89-
)
90-
{
95+
){
9196
return true;
9297
}
9398
return false;
9499
}
95100

96101
SelectionDialogDetector::SelectionDialogDetector(Color color)
97-
: m_right_box(0.844, 0.725, 0.005, 0.197)
98-
, m_top_box(00.151, 0.719, 0.698, 0.006)
99-
, m_bottom_box(0.152, 0.913, 0.692, 0.009)
100-
, m_selection_box(0.813, 0.436, 0.013, 0.195)
102+
: m_right_box(0.923385, 0.748077, 0.00615385, 0.204577)
103+
, m_top_box(0.0704615, 0.741846, 0.859077, 0.00623077)
104+
, m_bottom_box(0.0716923, 0.943308, 0.851692, 0.00934615)
105+
, m_selection_box(0.885231, 0.447962, 0.016, 0.2025)
101106
{}
102107
void SelectionDialogDetector::make_overlays(VideoOverlaySet& items) const{
103-
items.add(COLOR_RED, m_right_box);
104-
items.add(COLOR_RED, m_top_box);
105-
items.add(COLOR_RED, m_bottom_box);
106-
items.add(COLOR_RED, m_selection_box);
108+
const BoxOption& GAME_BOX = GameSettings::instance().GAME_BOX;
109+
items.add(COLOR_RED, GAME_BOX.inner_to_outer(m_right_box));
110+
items.add(COLOR_RED, GAME_BOX.inner_to_outer(m_top_box));
111+
items.add(COLOR_RED, GAME_BOX.inner_to_outer(m_bottom_box));
112+
items.add(COLOR_RED, GAME_BOX.inner_to_outer(m_selection_box));
107113
}
108114
bool SelectionDialogDetector::detect(const ImageViewRGB32& screen){
109-
ImageViewRGB32 right_image = extract_box_reference(screen, m_right_box);
110-
ImageViewRGB32 top_image = extract_box_reference(screen, m_top_box);
111-
ImageViewRGB32 bottom_image = extract_box_reference(screen, m_bottom_box);
112-
ImageViewRGB32 selection_image = extract_box_reference(screen, m_selection_box);
115+
ImageViewRGB32 game_screen = extract_box_reference(screen, GameSettings::instance().GAME_BOX);
116+
117+
ImageViewRGB32 right_image = extract_box_reference(game_screen, m_right_box);
118+
ImageViewRGB32 top_image = extract_box_reference(game_screen, m_top_box);
119+
ImageViewRGB32 bottom_image = extract_box_reference(game_screen, m_bottom_box);
120+
ImageViewRGB32 selection_image = extract_box_reference(game_screen, m_selection_box);
113121
if (is_white(right_image)
114122
&& is_white(top_image)
115123
&& is_white(bottom_image)
116124
&& is_white(selection_image)
117-
){
125+
){
118126
return true;
119127
}
120128
return false;
121129
}
122130

123131
BattleDialogDetector::BattleDialogDetector(Color color)
124-
: m_dialog_top_box(0.124, 0.727, 0.752, 0.009)
125-
, m_dialog_right_box(0.871, 0.736, 0.005, 0.179)
132+
: m_dialog_top_box(0.0372308, 0.750154, 0.925538, 0.00934615)
133+
, m_dialog_right_box(0.956615, 0.7595, 0.00615385, 0.185885)
126134
{}
127135
void BattleDialogDetector::make_overlays(VideoOverlaySet& items) const{
128-
items.add(COLOR_RED, m_dialog_top_box);
129-
items.add(COLOR_RED, m_dialog_right_box);
136+
const BoxOption& GAME_BOX = GameSettings::instance().GAME_BOX;
137+
items.add(COLOR_RED, GAME_BOX.inner_to_outer(m_dialog_top_box));
138+
items.add(COLOR_RED, GAME_BOX.inner_to_outer(m_dialog_right_box));
130139
}
131140
bool BattleDialogDetector::detect(const ImageViewRGB32& screen){
132-
ImageViewRGB32 dialog_top_image = extract_box_reference(screen, m_dialog_top_box);
133-
ImageViewRGB32 dialog_right_image = extract_box_reference(screen, m_dialog_right_box);
141+
ImageViewRGB32 game_screen = extract_box_reference(screen, GameSettings::instance().GAME_BOX);
142+
143+
ImageViewRGB32 dialog_top_image = extract_box_reference(game_screen, m_dialog_top_box);
144+
ImageViewRGB32 dialog_right_image = extract_box_reference(game_screen, m_dialog_right_box);
134145

135146
if (is_solid(dialog_top_image, { 0.176, 0.357, 0.467 }, 0.25, 20)
136147
&& is_solid(dialog_right_image, { 0.176, 0.357, 0.467 }, 0.25, 20)
137-
){
148+
){
138149
return true;
139150
}
140151
return false;
141152
}
142153

143154

144155
BattleMenuDetector::BattleMenuDetector(Color color)
145-
: m_menu_top_box(0.523, 0.720, 0.357, 0.008) //top of the white dialog box
146-
, m_menu_right_box(0.875, 0.729, 0.005, 0.193)
147-
, m_dialog_top_box(0.123, 0.726, 0.373, 0.013)
148-
, m_dialog_right_box(0.492, 0.739, 0.005, 0.172) //right side, closest to the menu
156+
: m_menu_top_box(0.528308, 0.742885, 0.439385, 0.00830769) //top of the white dialog box
157+
, m_menu_right_box(0.961538, 0.752231, 0.00615385, 0.200423)
158+
, m_dialog_top_box(0.036, 0.749115, 0.459077, 0.0135)
159+
, m_dialog_right_box(0.490154, 0.762615, 0.00615385, 0.178615) //right side, closest to the menu
149160
{}
150161
void BattleMenuDetector::make_overlays(VideoOverlaySet& items) const{
151-
items.add(COLOR_RED, m_menu_top_box);
152-
items.add(COLOR_RED, m_menu_right_box);
153-
items.add(COLOR_RED, m_dialog_top_box);
154-
items.add(COLOR_RED, m_dialog_right_box);
162+
const BoxOption& GAME_BOX = GameSettings::instance().GAME_BOX;
163+
items.add(COLOR_RED, GAME_BOX.inner_to_outer(m_menu_top_box));
164+
items.add(COLOR_RED, GAME_BOX.inner_to_outer(m_menu_right_box));
165+
items.add(COLOR_RED, GAME_BOX.inner_to_outer(m_dialog_top_box));
166+
items.add(COLOR_RED, GAME_BOX.inner_to_outer(m_dialog_right_box));
155167
}
156168
bool BattleMenuDetector::detect(const ImageViewRGB32& screen){
169+
ImageViewRGB32 game_screen = extract_box_reference(screen, GameSettings::instance().GAME_BOX);
170+
157171
//Menu is white
158-
ImageViewRGB32 menu_top_image = extract_box_reference(screen, m_menu_top_box);
159-
ImageViewRGB32 menu_right_image = extract_box_reference(screen, m_menu_right_box);
172+
ImageViewRGB32 menu_top_image = extract_box_reference(game_screen, m_menu_top_box);
173+
ImageViewRGB32 menu_right_image = extract_box_reference(game_screen, m_menu_right_box);
160174

161175
//Background dialog is teal
162-
ImageViewRGB32 dialog_top_image = extract_box_reference(screen, m_dialog_top_box);
163-
ImageViewRGB32 dialog_right_image = extract_box_reference(screen, m_dialog_right_box);
176+
ImageViewRGB32 dialog_top_image = extract_box_reference(game_screen, m_dialog_top_box);
177+
ImageViewRGB32 dialog_right_image = extract_box_reference(game_screen, m_dialog_right_box);
164178

165179
if (is_white(menu_top_image)
166180
&& is_white(menu_right_image)
167181
&& is_solid(dialog_top_image, { 0.176, 0.357, 0.467 }, 0.25, 20) //40, 81, 106 teal
168182
&& is_solid(dialog_right_image, { 0.176, 0.357, 0.467 }, 0.25, 20)
169-
){
183+
){
170184
return true;
171185
}
172186
return false;
173187
}
174188

175189

176190
AdvanceBattleDialogDetector::AdvanceBattleDialogDetector(Color color)
177-
: m_dialog_box(0.123, 0.725, 0.753, 0.197)
178-
, m_dialog_top_box(0.124, 0.727, 0.752, 0.009)
179-
, m_dialog_right_box(0.871, 0.736, 0.005, 0.179)
191+
: m_dialog_box(0.036, 0.748077, 0.926769, 0.204577)
192+
, m_dialog_top_box(0.0372308, 0.750154, 0.925538, 0.00934615)
193+
, m_dialog_right_box(0.956615, 0.7595, 0.00615385, 0.185885)
180194
{}
181195
void AdvanceBattleDialogDetector::make_overlays(VideoOverlaySet& items) const{
182-
items.add(COLOR_RED, m_dialog_box);
183-
items.add(COLOR_RED, m_dialog_top_box);
184-
items.add(COLOR_RED, m_dialog_right_box);
196+
const BoxOption& GAME_BOX = GameSettings::instance().GAME_BOX;
197+
items.add(COLOR_RED, GAME_BOX.inner_to_outer(m_dialog_box));
198+
items.add(COLOR_RED, GAME_BOX.inner_to_outer(m_dialog_top_box));
199+
items.add(COLOR_RED, GAME_BOX.inner_to_outer(m_dialog_right_box));
185200
}
186201
bool AdvanceBattleDialogDetector::detect(const ImageViewRGB32& screen){
202+
ImageViewRGB32 game_screen = extract_box_reference(screen, GameSettings::instance().GAME_BOX);
203+
187204
const bool replace_color_within_range = false;
188205

189206
//Filter out background
190207
ImageRGB32 filtered_region = filter_rgb32_range(
191-
extract_box_reference(screen, m_dialog_box),
208+
extract_box_reference(game_screen, m_dialog_box),
192209
combine_rgb(164, 0, 0), combine_rgb(255, 114, 87), Color(0), replace_color_within_range
193210
);
194211
ImageStats stats = image_stats(filtered_region);
@@ -200,15 +217,14 @@ bool AdvanceBattleDialogDetector::detect(const ImageViewRGB32& screen){
200217
cout << stats.average.b << endl;
201218
*/
202219

203-
ImageViewRGB32 dialog_top_image = extract_box_reference(screen, m_dialog_top_box);
204-
ImageViewRGB32 dialog_right_image = extract_box_reference(screen, m_dialog_right_box);
220+
ImageViewRGB32 dialog_top_image = extract_box_reference(game_screen, m_dialog_top_box);
221+
ImageViewRGB32 dialog_right_image = extract_box_reference(game_screen, m_dialog_right_box);
205222

206223
if (is_solid(dialog_top_image, { 0.176, 0.357, 0.467 }, 0.25, 20)
207224
&& is_solid(dialog_right_image, { 0.176, 0.357, 0.467 }, 0.25, 20)
208225
&& (stats.average.r > stats.average.b + 180)
209226
&& (stats.average.r > stats.average.g + 180)
210-
)
211-
{
227+
){
212228
return true;
213229
}
214230
return false;

0 commit comments

Comments
 (0)