Skip to content

Commit

Permalink
Rearrange programs. Attempt to recover from dropped Home press when r…
Browse files Browse the repository at this point in the history
…e-entering game.
  • Loading branch information
Mysticial committed Sep 19, 2023
1 parent 464474c commit 7280901
Show file tree
Hide file tree
Showing 2 changed files with 34 additions and 20 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -38,21 +38,32 @@ void resume_game_from_home(
context.wait_for_all_requests();

while (true){
UpdateMenuWatcher detector(false);
int ret = wait_until(
console, context,
std::chrono::milliseconds(1000),
{ detector }
);
if (ret < 0){
return;
{
UpdateMenuWatcher update_detector(false);
int ret = wait_until(
console, context,
std::chrono::milliseconds(1000),
{ update_detector }
);
if (ret == 0){
console.log("Detected update window.", COLOR_RED);

pbf_press_dpad(context, DPAD_UP, 5, 0);
pbf_press_button(context, BUTTON_A, 10, 500);
context.wait_for_all_requests();
continue;
}
}

console.log("Detected update window.", COLOR_RED);

pbf_press_dpad(context, DPAD_UP, 5, 0);
pbf_press_button(context, BUTTON_A, 10, 500);
context.wait_for_all_requests();
// In case we failed to enter the game.
HomeWatcher home_detector;
if (home_detector.detect(console.video().snapshot())){
console.log("Failed to re-enter game. Trying again...", COLOR_RED);
pbf_press_button(context, BUTTON_HOME, 10, 10);
continue;
}else{
break;
}
}
}

Expand Down
17 changes: 10 additions & 7 deletions SerialPrograms/Source/PokemonSV/PokemonSV_Panels.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
#include "PokemonSV_Settings.h"

#include "Programs/General/PokemonSV_MassPurchase.h"
#include "Programs/General/PokemonSV_ClothingBuyer.h"
#include "Programs/General/PokemonSV_MassRelease.h"
#include "Programs/General/PokemonSV_AutonomousBallThrower.h"

Expand All @@ -20,12 +21,9 @@
#include "Programs/General/PokemonSV_AuctionFarmer.h"
#include "Programs/General/PokemonSV_ESPTraining.h"
#include "Programs/Trading/PokemonSV_SelfBoxTrade.h"
#include "Programs/General/PokemonSV_StatsReset.h"
#include "Programs/General/PokemonSV_StatsResetBloodmoon.h"
#include "Programs/General/PokemonSV_TournamentFarmer.h"
#include "Programs/Sandwiches/PokemonSV_SandwichMaker.h"
#include "Programs/General/PokemonSV_SizeChecker.h"
#include "Programs/General/PokemonSV_ClothingBuyer.h"

#include "Programs/Eggs/PokemonSV_EggFetcher.h"
#include "Programs/Eggs/PokemonSV_EggHatcher.h"
Expand All @@ -40,6 +38,9 @@
#include "Programs/FastCodeEntry/PokemonSV_ClipboardFastCodeEntry.h"
#include "Programs/FastCodeEntry/PokemonSV_VideoFastCodeEntry.h"

#include "Programs/General/PokemonSV_StatsReset.h"
#include "Programs/General/PokemonSV_StatsResetBloodmoon.h"

#include "Programs/ShinyHunting/PokemonSV_ShinyHunt-AreaZeroPlatform.h"
#include "Programs/ShinyHunting/PokemonSV_ShinyHunt-Scatterbug.h"

Expand Down Expand Up @@ -70,11 +71,10 @@ std::vector<PanelEntry> PanelListFactory::make_panels() const{

ret.emplace_back("---- General ----");
ret.emplace_back(make_single_switch_program<MassPurchase_Descriptor, MassPurchase>());
ret.emplace_back(make_single_switch_program<ClothingBuyer_Descriptor, ClothingBuyer>());
ret.emplace_back(make_single_switch_program<MassRelease_Descriptor, MassRelease>());
ret.emplace_back(make_single_switch_program<AutonomousBallThrower_Descriptor, AutonomousBallThrower>());
ret.emplace_back(make_single_switch_program<StatsReset_Descriptor, StatsReset>());
ret.emplace_back(make_single_switch_program<SizeChecker_Descriptor, SizeChecker>());
ret.emplace_back(make_single_switch_program<ClothingBuyer_Descriptor, ClothingBuyer>());

// ret.emplace_back("---- Trading ----");
ret.emplace_back(make_multi_switch_program<SelfBoxTrade_Descriptor, SelfBoxTrade>());
Expand Down Expand Up @@ -106,16 +106,19 @@ std::vector<PanelEntry> PanelListFactory::make_panels() const{
ret.emplace_back(make_multi_switch_program<ClipboardFastCodeEntry_Descriptor, ClipboardFastCodeEntry>());
ret.emplace_back(make_multi_switch_program<VideoFastCodeEntry_Descriptor, VideoFastCodeEntry>());

ret.emplace_back("---- Stats Hunting ----");
ret.emplace_back(make_single_switch_program<StatsReset_Descriptor, StatsReset>());
ret.emplace_back(make_single_switch_program<StatsResetBloodmoon_Descriptor, StatsResetBloodmoon>());

ret.emplace_back("---- Shiny Hunting ----");
ret.emplace_back(make_single_switch_program<ShinyHuntAreaZeroPlatform_Descriptor, ShinyHuntAreaZeroPlatform>());

ret.emplace_back("---- Glitches ----");
ret.emplace_back(make_single_switch_program<RideCloner101_Descriptor, RideCloner101>());
ret.emplace_back(make_single_switch_program<CloneItems101_Descriptor, CloneItems101>());

ret.emplace_back("---- Untested/Beta/WIP ----");
ret.emplace_back(make_single_switch_program<StatsResetBloodmoon_Descriptor, StatsResetBloodmoon>());
if (PreloadSettings::instance().DEVELOPER_MODE){
ret.emplace_back("---- Untested/Beta/WIP ----");
ret.emplace_back(make_single_switch_program<ShinyHuntScatterbug_Descriptor, ShinyHuntScatterbug>());
}
if (PreloadSettings::instance().DEVELOPER_MODE){
Expand Down

0 comments on commit 7280901

Please sign in to comment.