Skip to content

Commit e105a80

Browse files
author
Gin
committed
m
1 parent 14b2327 commit e105a80

File tree

1 file changed

+10
-7
lines changed

1 file changed

+10
-7
lines changed

SerialPrograms/Source/PokemonHome/Programs/PokemonHome_BoxSorting.cpp

Lines changed: 10 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,7 @@ language
3232
#include "Common/Cpp/Json/JsonValue.h"
3333
#include "Common/Cpp/Json/JsonArray.h"
3434
#include "Common/Cpp/Json/JsonObject.h"
35+
#include "CommonFramework/Exceptions/OperationFailedException.h"
3536
#include "CommonFramework/ImageTools/ImageBoxes.h"
3637
#include "CommonFramework/ImageTools/ImageStats.h"
3738
#include "CommonFramework/Notifications/ProgramNotifications.h"
@@ -275,16 +276,14 @@ std::ostream& operator<<(std::ostream& os, const std::optional<Pokemon>& pokemon
275276
return os;
276277
}
277278

278-
std::string create_overlay_log(const Pokemon& pokemon){
279+
std::string create_overlay_info(const Pokemon& pokemon){
279280
const std::string& species_slug = NATIONAL_DEX_SLUGS()[pokemon.national_dex_number-1];
280281
const std::string& display_name = get_pokemon_name(species_slug).display_name();
281282
std::string overlay_log = display_name;
282283
if(pokemon.gender == StatsHuntGenderFilter::Male){
283284
overlay_log += " " + UNICODE_MALE;
284285
} else if (pokemon.gender == StatsHuntGenderFilter::Female){
285286
overlay_log += " " + UNICODE_FEMALE;
286-
} else{
287-
overlay_log += " " + UNICODE_GENDERLESS;
288287
}
289288
if (pokemon.shiny){
290289
overlay_log += " *";
@@ -679,8 +678,12 @@ void BoxSorting::program(SingleSwitchProgramEnvironment& env, ProControllerConte
679678
screen = env.console.video().snapshot();
680679

681680
const int national_dex_number = OCR::read_number_waterfill(env.console, extract_box_reference(screen, national_dex_number_box), 0xff808080, 0xffffffff);
682-
if (national_dex_number <= 0 || national_dex_number > 1025) { // Current last pokemon is pecharunt
683-
dump_image(env.console, ProgramInfo(), "ReadSummary_national_dex_number", screen);
681+
if (national_dex_number <= 0 || national_dex_number > NATIONAL_DEX_SLUGS().size()) {
682+
OperationFailedException::fire(
683+
ErrorReport::SEND_ERROR_REPORT,
684+
"BoxSorting Check Summary: Unable to read a correct dex number, found: " + std::to_string(national_dex_number),
685+
env.console
686+
);
684687
}
685688
cur_pokemon_info->national_dex_number = (uint16_t)national_dex_number;
686689

@@ -713,7 +716,7 @@ void BoxSorting::program(SingleSwitchProgramEnvironment& env, ProControllerConte
713716
}
714717
cur_pokemon_info->ot_id = ot_id;
715718

716-
env.add_overlay_log("Read " + create_overlay_log(*cur_pokemon_info));
719+
env.add_overlay_log("Read " + create_overlay_info(*cur_pokemon_info));
717720

718721
// NOTE edit when adding new struct members (detections go here likely)
719722

@@ -722,7 +725,7 @@ void BoxSorting::program(SingleSwitchProgramEnvironment& env, ProControllerConte
722725
// nature_box
723726
// ability_box
724727

725-
pbf_press_button(context, BUTTON_R, 10, VIDEO_DELAY+15);
728+
pbf_press_button(context, BUTTON_R, 10, VIDEO_DELAY+15); // Press button R to go to next summary screen
726729
context.wait_for_all_requests();
727730
}
728731
}

0 commit comments

Comments
 (0)