Skip to content

Commit b146d24

Browse files
committed
Pass program info to "connect_to_intermet()" errors.
1 parent a1b2d6c commit b146d24

9 files changed

+27
-10
lines changed

SerialPrograms/Source/PokemonSwSh/MaxLair/Program/PokemonSwSh_MaxLair_Run_EnterLobby.cpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -63,14 +63,15 @@ class GreyDialogDetector : public VisualInferenceCallback{
6363

6464

6565
std::shared_ptr<const ImageRGB32> enter_lobby(
66+
const ProgramInfo& info,
6667
VideoStream& stream, ProControllerContext& context,
6768
size_t boss_slot, bool connect_to_internet,
6869
ReadableQuantity999& ore
6970
){
7071
pbf_mash_button(context, BUTTON_B, 2 * TICKS_PER_SECOND);
7172

7273
if (connect_to_internet){
73-
connect_to_internet_with_inference(stream, context);
74+
connect_to_internet_with_inference(info, stream, context);
7475
}
7576

7677
VideoOverlaySet boxes(stream.overlay());

SerialPrograms/Source/PokemonSwSh/MaxLair/Program/PokemonSwSh_MaxLair_Run_EnterLobby.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@ namespace MaxLairInternal{
1919

2020

2121
std::shared_ptr<const ImageRGB32> enter_lobby(
22+
const ProgramInfo& info,
2223
VideoStream& stream, ProControllerContext& context,
2324
size_t boss_slot, bool connect_to_internet,
2425
ReadableQuantity999& ore

SerialPrograms/Source/PokemonSwSh/MaxLair/Program/PokemonSwSh_MaxLair_Run_Start.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -132,7 +132,7 @@ bool start_raid_local(
132132
if (env.consoles.size() == 1){
133133
ProControllerContext context(scope, host.pro_controller());
134134
return start_raid_self_solo(
135-
host, context,
135+
env.program_info(), host, context,
136136
state_tracker, entrance[0], boss_slot, console_stats[0].ore
137137
);
138138
}
@@ -147,7 +147,7 @@ bool start_raid_local(
147147
bool is_host = index == host.index();
148148

149149
entrance[index] = enter_lobby(
150-
console, context,
150+
env.program_info(), console, context,
151151
is_host ? boss_slot : 0,
152152
settings.MODE == HostingMode::HOST_ONLINE,
153153
console_stats[index].ore
@@ -301,7 +301,7 @@ bool start_raid_host(
301301
bool is_host = index == host.index();
302302

303303
entrance[index] = enter_lobby(
304-
console, context,
304+
env.program_info(), console, context,
305305
is_host ? boss_slot : 0,
306306
settings.MODE == HostingMode::HOST_ONLINE,
307307
console_stats[index].ore

SerialPrograms/Source/PokemonSwSh/MaxLair/Program/PokemonSwSh_MaxLair_Run_StartSolo.cpp

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -128,6 +128,7 @@ bool start_adventure(
128128

129129

130130
bool start_raid_self_solo(
131+
const ProgramInfo& info,
131132
VideoStream& stream, ProControllerContext& context,
132133
GlobalStateTracker& state_tracker,
133134
std::shared_ptr<const ImageRGB32>& entrance, size_t boss_slot,
@@ -138,7 +139,7 @@ bool start_raid_self_solo(
138139
GlobalState& state = state_tracker[0];
139140

140141
// Enter lobby.
141-
entrance = enter_lobby(stream, context, boss_slot, false, ore);
142+
entrance = enter_lobby(info, stream, context, boss_slot, false, ore);
142143
if (!*entrance){
143144
return false;
144145
}
@@ -172,7 +173,8 @@ bool start_raid_host_solo(
172173

173174
// Enter lobby.
174175
entrance = enter_lobby(
175-
console, context, boss_slot,
176+
env.program_info(), console, context,
177+
boss_slot,
176178
settings.MODE == HostingMode::HOST_ONLINE,
177179
ore
178180
);
@@ -210,7 +212,13 @@ bool start_raid_host_solo(
210212

211213
if (!wait_for_a_player(console, context, *entrance, time_limit)){
212214
pbf_mash_button(context, BUTTON_B, 10 * TICKS_PER_SECOND);
213-
return start_raid_self_solo(console, context, state_tracker, entrance, boss_slot, ore);
215+
return start_raid_self_solo(
216+
env.program_info(), console, context,
217+
state_tracker,
218+
entrance,
219+
boss_slot,
220+
ore
221+
);
214222
}
215223

216224
// Ready up.

SerialPrograms/Source/PokemonSwSh/MaxLair/Program/PokemonSwSh_MaxLair_Run_StartSolo.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77
#ifndef PokemonAutomation_PokemonSwSh_MaxLair_Run_StartSolo_H
88
#define PokemonAutomation_PokemonSwSh_MaxLair_Run_StartSolo_H
99

10+
#include "CommonFramework/Notifications/ProgramInfo.h"
1011
#include "CommonFramework/ImageTypes/ImageRGB32.h"
1112
#include "CommonFramework/Tools/VideoStream.h"
1213
#include "NintendoSwitch/Controllers/NintendoSwitch_ProController.h"
@@ -42,6 +43,7 @@ bool start_adventure(
4243

4344

4445
bool start_raid_self_solo(
46+
const ProgramInfo& info,
4547
VideoStream& stream, ProControllerContext& context,
4648
GlobalStateTracker& state_tracker,
4749
std::shared_ptr<const ImageRGB32>& entrance, size_t boss_slot,

SerialPrograms/Source/PokemonSwSh/Programs/Hosting/PokemonSwSh_AutoHost.cpp

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@ using namespace Pokemon;
2828

2929

3030
bool connect_to_internet(
31+
const ProgramInfo& info,
3132
VideoStream& stream, ProControllerContext& context,
3233
bool host_online,
3334
Milliseconds connect_to_internet_delay
@@ -40,7 +41,7 @@ bool connect_to_internet(
4041
return true;
4142
}
4243
if (connect_to_internet_with_inference(
43-
stream, context,
44+
info, stream, context,
4445
std::chrono::seconds(5), connect_to_internet_delay
4546
)){
4647
return true;
@@ -136,7 +137,7 @@ void run_autohost(
136137
context.wait_for_all_requests();
137138

138139
if (!connect_to_internet(
139-
console, context,
140+
env.program_info(), console, context,
140141
host_online,
141142
connect_to_internet_delay
142143
)){

SerialPrograms/Source/PokemonSwSh/Programs/Hosting/PokemonSwSh_AutoHost.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@ namespace PokemonSwSh{
2424

2525

2626
bool connect_to_internet(
27+
const ProgramInfo& info,
2728
VideoStream& stream, ProControllerContext& context,
2829
bool host_online,
2930
Milliseconds connect_to_internet_delay

SerialPrograms/Source/PokemonSwSh/Programs/PokemonSwSh_Internet.cpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ namespace PokemonSwSh{
1818

1919

2020
bool connect_to_internet_with_inference(
21+
const ProgramInfo& info,
2122
VideoStream& stream, ProControllerContext& context,
2223
Milliseconds post_wait_time,
2324
Milliseconds timeout_ticks
@@ -41,7 +42,7 @@ bool connect_to_internet_with_inference(
4142
stream.log("Y-COMM detected.");
4243
}else{
4344
stream.log("Failed to detect Y-COMM after timeout.", COLOR_RED);
44-
dump_image(stream.logger(), ProgramInfo(), "connect_to_internet_with_inference", stream.video().snapshot());
45+
dump_image(stream.logger(), info, "connect_to_internet_with_inference", stream.video().snapshot());
4546
ok = false;
4647
}
4748
}

SerialPrograms/Source/PokemonSwSh/Programs/PokemonSwSh_Internet.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88
#define PokemonAutomation_PokemonSwSh_Internet_H
99

1010
#include <chrono>
11+
#include "CommonFramework/Notifications/ProgramInfo.h"
1112
#include "CommonFramework/Tools/VideoStream.h"
1213
#include "NintendoSwitch/Controllers/NintendoSwitch_ProController.h"
1314

@@ -20,6 +21,7 @@ using namespace std::chrono_literals;
2021

2122

2223
bool connect_to_internet_with_inference(
24+
const ProgramInfo& info,
2325
VideoStream& stream, ProControllerContext& context,
2426
Milliseconds post_wait_time = 3000ms,
2527
Milliseconds timeout_ticks = 120s

0 commit comments

Comments
 (0)