Skip to content

Commit bca0d90

Browse files
authored
Merge pull request #577 from pifopi/v0.52bis
V0.52bis
2 parents 6c3350b + dbc3d73 commit bca0d90

File tree

4 files changed

+23
-7
lines changed

4 files changed

+23
-7
lines changed

SerialPrograms/Source/NintendoSwitch/DevPrograms/TestProgramSwitch.cpp

Lines changed: 15 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -121,6 +121,7 @@
121121
#include "NintendoSwitch/Programs/NintendoSwitch_NumberCodeEntry.h"
122122
#include "PokemonSV/Inference/ItemPrinter/PokemonSV_ItemPrinterMenuDetector.h"
123123
#include "PokemonSV/Inference/Picnics/PokemonSV_SandwichHandDetector.h"
124+
#include "PokemonSwSh/MaxLair/Inference/PokemonSwSh_MaxLair_Detect_PokemonSwapMenu.h"
124125

125126

126127
#include <QPixmap>
@@ -317,6 +318,15 @@ void TestProgram::program(MultiSwitchProgramEnvironment& env, CancellableScope&
317318

318319
// std::terminate();
319320

321+
ImageRGB32 image("20250420-043111395281.png");
322+
323+
OcrFailureWatchdog watchdog(logger);
324+
325+
PokemonSwSh::MaxLairInternal::PokemonSwapMenuReader reader(logger, overlay, Language::Korean, watchdog);
326+
327+
double hp[4];
328+
reader.read_hp(image, hp);
329+
320330

321331
#if 0
322332
ImageRGB32 image("20250404-154507236508.png");
@@ -385,17 +395,17 @@ void TestProgram::program(MultiSwitchProgramEnvironment& env, CancellableScope&
385395
#endif
386396

387397

388-
numberpad_enter_code(logger, context, "708538991006", false);
398+
// numberpad_enter_code(logger, context, "708538991006", false);
389399

390400

391401

392402
#if 0
393403
for (size_t i = 0; i < 100; i++){
394-
for (size_t c = 0; c < 7; c++){
395-
ssf_issue_scroll(context, DPAD_RIGHT, 40ms);
404+
for (size_t c = 0; c < 4; c++){
405+
ssf_issue_scroll(context, DPAD_RIGHT, 17ms);
396406
}
397-
for (size_t c = 0; c < 7; c++){
398-
ssf_issue_scroll(context, DPAD_LEFT, 40ms);
407+
for (size_t c = 0; c < 4; c++){
408+
ssf_issue_scroll(context, DPAD_LEFT, 17ms);
399409
}
400410
}
401411
#endif

SerialPrograms/Source/Pokemon/Inference/Pokemon_ReadHpBar.cpp

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ double read_hp_bar_internal(const ImageViewRGB32& image){
3535
max_color = std::max(max_color, stats.average.g);
3636
max_color = std::max(max_color, stats.average.b);
3737
// cout << "max_color: " << max_color << ", stddev: " << stats.stddev.sum() << endl;
38-
if (max_color > 128 && stats.stddev.sum() < 70){
38+
if (max_color > 128 && stats.stddev.sum() < 120){
3939
break;
4040
}
4141
bar *= 0.5;
@@ -83,8 +83,10 @@ double read_hp_bar(const ImageViewRGB32& image){
8383

8484
double read_hp_bar(Logger& logger, const ImageViewRGB32& image){
8585
double hp = read_hp_bar(image);
86+
8687
// static int c = 0;
8788
// image.save("test-" + std::to_string(c++) + ".png");
89+
8890
if (hp <= 0){
8991
logger.log("HP Read: ?", COLOR_RED);
9092
}else{

SerialPrograms/Source/PokemonLA/Inference/Battles/PokemonLA_BattlePokemonSwitchDetector.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@ bool BattlePokemonSwitchDetector::process_frame(const ImageViewRGB32& frame, Wal
5757
}
5858

5959
const ImageStats white_3 = image_stats(extract_box_reference(frame, m_white_bg_3));
60-
if(is_white(white_3, 500, 10) == false){
60+
if(is_white(white_3, 500, 15) == false){
6161
// std::cout << "no white_3" << std::endl;
6262
m_detected.store(false, std::memory_order_release);
6363
return false;

SerialPrograms/Source/PokemonLGPE/Programs/ShinyHunting/PokemonLGPE_AlolanTrade.cpp

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -184,6 +184,10 @@ void AlolanTrade::program(SingleSwitchProgramEnvironment& env, CancellableScope&
184184
//Pokedex - Bag - Party - Communicate - Save (these all have a colored line under when selected + an arrow to indicate)
185185
//(Press Y for options)
186186

187+
//Make sure any extra dialog is closed
188+
pbf_mash_button(context, BUTTON_B, 3000ms);
189+
context.wait_for_all_requests();
190+
187191
//Wait a bit.
188192
pbf_wait(context, 2500ms);
189193
context.wait_for_all_requests();

0 commit comments

Comments
 (0)