Skip to content

Commit 54f41a9

Browse files
committed
Gift Reset no longer assumes cursor position.
1 parent d81f84c commit 54f41a9

1 file changed

Lines changed: 25 additions & 5 deletions

File tree

SerialPrograms/Source/PokemonFRLG/Programs/ShinyHunting/PokemonFRLG_GiftReset.cpp

Lines changed: 25 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -10,13 +10,14 @@
1010
#include "CommonFramework/ProgramStats/StatsTracking.h"
1111
#include "CommonFramework/VideoPipeline/VideoFeed.h"
1212
#include "CommonTools/Async/InferenceRoutines.h"
13-
#include "Pokemon/Pokemon_Strings.h"
1413
#include "NintendoSwitch/Commands/NintendoSwitch_Commands_PushButtons.h"
14+
#include "Pokemon/Pokemon_Strings.h"
1515
#include "PokemonFRLG/Inference/Dialogs/PokemonFRLG_DialogDetector.h"
1616
#include "PokemonFRLG/Inference/Menus/PokemonFRLG_StartMenuDetector.h"
1717
#include "PokemonFRLG/Inference/Menus/PokemonFRLG_SummaryDetector.h"
1818
#include "PokemonFRLG/Inference/PokemonFRLG_ShinySymbolDetector.h"
1919
#include "PokemonFRLG/PokemonFRLG_Navigation.h"
20+
#include "PokemonFRLG/Programs/PokemonFRLG_StartMenuNavigation.h"
2021
#include "PokemonFRLG_GiftReset.h"
2122

2223
namespace PokemonAutomation{
@@ -263,14 +264,33 @@ bool GiftReset::try_open_summary(SingleSwitchProgramEnvironment& env, ProControl
263264
return false;
264265
}
265266

266-
if (TARGET != Target::starters){
267+
if (TARGET == Target::starters){
268+
// We navigate to pokedex since we don't have it yet so it becomes Pokemon.
269+
if (!move_cursor_to_position(env.console, context, SelectionArrowPositionStartMenu::POKEDEX)){
270+
std::string str = "open_summary(): Unable to move menu cursor to: " + Pokemon::STRING_POKEMON;
271+
env.log(str, COLOR_RED);
272+
send_program_recoverable_error_notification(
273+
env, NOTIFICATION_ERROR_RECOVERABLE,
274+
str
275+
);
276+
return false;
277+
}
278+
}else{
267279
//Pokedex, Pokemon, Bag, Trainer, Save, Option, Exit
268280
env.log("Navigating to party menu.");
269281
pbf_wait(context, 200ms);
270282
context.wait_for_all_requests();
271-
pbf_press_dpad(context, DPAD_DOWN, 320ms, 320ms);
272-
context.wait_for_all_requests();
273-
} //For starters, no Pokedex yet, do Pokemon is on top and we skip this
283+
284+
if (!move_cursor_to_position(env.console, context, SelectionArrowPositionStartMenu::POKEMON)){
285+
std::string str = "open_summary(): Unable to move menu cursor to: " + Pokemon::STRING_POKEMON;
286+
env.log(str, COLOR_RED);
287+
send_program_recoverable_error_notification(
288+
env, NOTIFICATION_ERROR_RECOVERABLE,
289+
str
290+
);
291+
return false;
292+
}
293+
}
274294

275295
//Open party menu
276296
BlackScreenOverWatcher blk1(COLOR_RED);

0 commit comments

Comments
 (0)