diff --git a/SerialPrograms/Source/PokemonFRLG/PokemonFRLG_Navigation.cpp b/SerialPrograms/Source/PokemonFRLG/PokemonFRLG_Navigation.cpp
index 3f5c6cd9e..b0c96ca1e 100644
--- a/SerialPrograms/Source/PokemonFRLG/PokemonFRLG_Navigation.cpp
+++ b/SerialPrograms/Source/PokemonFRLG/PokemonFRLG_Navigation.cpp
@@ -335,15 +335,21 @@ void flee_battle(ConsoleHandle& console, ProControllerContext& context){
}
}
-void home_black_border_check(ConsoleHandle& console, ProControllerContext& context){
- console.log("Going to home to check for black border.");
- pbf_press_button(context, BUTTON_HOME, 120ms, 880ms);
- context.wait_for_all_requests();
- StartProgramChecks::check_border(console);
- console.log("Returning to game.");
- resume_game_from_home(console, context);
- context.wait_for_all_requests();
- console.log("Entered game.");
+void home_black_border_check(ConsoleHandle& console, ProControllerContext& context) {
+ if (GameSettings::instance().DEVICE == GameSettings::Device::switch_1_2) {
+ console.log("Switch 1 or 2 selected in Settings.");
+ console.log("Going to home to check for black border.");
+ pbf_press_button(context, BUTTON_HOME, 120ms, 880ms);
+ context.wait_for_all_requests();
+ StartProgramChecks::check_border(console);
+ console.log("Returning to game.");
+ resume_game_from_home(console, context);
+ context.wait_for_all_requests();
+ console.log("Entered game.");
+ }else{
+ console.log("Non-Switch device selected in Settings.");
+ console.log("Skipping black border check.", COLOR_BLUE);
+ }
}
diff --git a/SerialPrograms/Source/PokemonFRLG/PokemonFRLG_Navigation.h b/SerialPrograms/Source/PokemonFRLG/PokemonFRLG_Navigation.h
index 783ecfcd7..30e206e53 100644
--- a/SerialPrograms/Source/PokemonFRLG/PokemonFRLG_Navigation.h
+++ b/SerialPrograms/Source/PokemonFRLG/PokemonFRLG_Navigation.h
@@ -21,8 +21,7 @@ namespace PokemonFRLG{
// Press A+B+Select+Start at the same time to soft reset, then re-enters the game.
// There are two random waits, one before pressing start and another after loading in the game.
-// This is to prevent repeatedly getting the same pokemon, due to FRLG's RNG
-// For now this assumes no dry battery.
+// This is to prevent repeatedly getting the same pokemon, due to FRLG's RNG.
uint64_t soft_reset(ConsoleHandle& console, ProControllerContext &context);
// From the overworld, open the summary of the Pokemon in slot 6. This assumes the menu cursor is in the top slot (POKEDEX)
diff --git a/SerialPrograms/Source/PokemonFRLG/PokemonFRLG_Settings.cpp b/SerialPrograms/Source/PokemonFRLG/PokemonFRLG_Settings.cpp
index 40a6f6195..05e3ff5f1 100644
--- a/SerialPrograms/Source/PokemonFRLG/PokemonFRLG_Settings.cpp
+++ b/SerialPrograms/Source/PokemonFRLG/PokemonFRLG_Settings.cpp
@@ -20,8 +20,28 @@ GameSettings& GameSettings::instance(){
static GameSettings settings;
return settings;
}
+GameSettings::~GameSettings(){
+ DEVICE.remove_listener(*this);
+ GAME_BOX.remove_listener(*this);
+ GAME_BOX.X.remove_listener(*this);
+ GAME_BOX.Y.remove_listener(*this);
+ GAME_BOX.WIDTH.remove_listener(*this);
+ GAME_BOX.HEIGHT.remove_listener(*this);
+}
GameSettings::GameSettings()
: BatchOption(LockMode::LOCK_WHILE_RUNNING)
+ , m_game_device_settings("Game Device settings:")
+ , DEVICE(
+ "Device:
Select the device the game is running on. "
+ "Refer to the documentation for specific setups.",
+ {
+ {Device::switch_1_2, "switch_1_2", "Nintendo Switch 1 and 2"},
+ //{Device::dev_test, "dev_test", "dev test rg35xx"},
+ //{Device::custom, "custom", "Custom"},
+ },
+ LockMode::LOCK_WHILE_RUNNING,
+ Device::switch_1_2
+ )
, GAME_BOX(
"Game Box: The part of the screen containing the actual video feed.",
LockMode::LOCK_WHILE_RUNNING,
@@ -57,6 +77,8 @@ GameSettings::GameSettings()
1000, 0, 48000 //2000
)
{
+ PA_ADD_STATIC(m_game_device_settings);
+ PA_ADD_OPTION(DEVICE);
PA_ADD_STATIC(GAME_BOX);
PA_ADD_STATIC(m_soft_reset_timings);
PA_ADD_OPTION(SELECT_BUTTON_MASH0);
@@ -64,9 +86,44 @@ GameSettings::GameSettings()
PA_ADD_STATIC(m_shiny_audio_settings);
PA_ADD_OPTION(SHINY_SOUND_THRESHOLD);
PA_ADD_OPTION(SHINY_SOUND_LOW_FREQUENCY);
-}
+ GameSettings::on_config_value_changed(this);
+ DEVICE.add_listener(*this);
+ GAME_BOX.add_listener(*this);
+ GAME_BOX.X.add_listener(*this);
+ GAME_BOX.Y.add_listener(*this);
+ GAME_BOX.WIDTH.add_listener(*this);
+ GAME_BOX.HEIGHT.add_listener(*this);
+}
+void GameSettings::on_config_value_changed(void* object){
+ switch (DEVICE){
+ case Device::switch_1_2:
+ GAME_BOX.X.set(0.09375);
+ GAME_BOX.Y.set(0.00462963);
+ GAME_BOX.WIDTH.set(0.8125);
+ GAME_BOX.HEIGHT.set(0.962963);
+ GAME_BOX.set_visibility(ConfigOptionState::DISABLED);
+ break;
+ case Device::dev_test:
+ GAME_BOX.X.set(0.125);
+ GAME_BOX.Y.set(0.0564814814814815);
+ GAME_BOX.WIDTH.set(0.7494791666666667);
+ GAME_BOX.HEIGHT.set(0.8861111111111111);
+ GAME_BOX.set_visibility(ConfigOptionState::DISABLED);
+ break;
+ case Device::custom:
+ GAME_BOX.set_visibility(ConfigOptionState::ENABLED);
+ break;
+ default:
+ GAME_BOX.X.set(0.09375);
+ GAME_BOX.Y.set(0.00462963);
+ GAME_BOX.WIDTH.set(0.8125);
+ GAME_BOX.HEIGHT.set(0.962963);
+ GAME_BOX.set_visibility(ConfigOptionState::ENABLED);
+ break;
+ }
+}
diff --git a/SerialPrograms/Source/PokemonFRLG/PokemonFRLG_Settings.h b/SerialPrograms/Source/PokemonFRLG/PokemonFRLG_Settings.h
index 78a02bc06..165db4f8c 100644
--- a/SerialPrograms/Source/PokemonFRLG/PokemonFRLG_Settings.h
+++ b/SerialPrograms/Source/PokemonFRLG/PokemonFRLG_Settings.h
@@ -7,6 +7,7 @@
#ifndef PokemonAutomation_PokemonFRLG_Settings_H
#define PokemonAutomation_PokemonFRLG_Settings_H
+#include "Common/Cpp/Options/EnumDropdownOption.h"
#include "Common/Cpp/Options/StaticTextOption.h"
#include "Common/Cpp/Options/FloatingPointOption.h"
#include "Common/Cpp/Options/TimeDurationOption.h"
@@ -18,11 +19,21 @@ namespace NintendoSwitch{
namespace PokemonFRLG{
-class GameSettings : public BatchOption{
+class GameSettings : public BatchOption, private ConfigOption::Listener{
+ ~GameSettings();
GameSettings();
public:
static GameSettings& instance();
+ enum class Device{
+ switch_1_2,
+ dev_test,
+ custom,
+ };
+
+ SectionDividerOption m_game_device_settings;
+ EnumDropdownOption DEVICE;
+
BoxOption GAME_BOX;
SectionDividerOption m_soft_reset_timings;
@@ -34,11 +45,12 @@ class GameSettings : public BatchOption{
FloatingPointOption SHINY_SOUND_THRESHOLD;
FloatingPointOption SHINY_SOUND_LOW_FREQUENCY;
+private:
+ virtual void on_config_value_changed(void* object) override;
};
-
class GameSettings_Descriptor : public PanelDescriptor{
public:
GameSettings_Descriptor();
diff --git a/SerialPrograms/Source/PokemonFRLG/Programs/ShinyHunting/PokemonFRLG_GiftReset.cpp b/SerialPrograms/Source/PokemonFRLG/Programs/ShinyHunting/PokemonFRLG_GiftReset.cpp
index 7ed998308..90c95a41c 100644
--- a/SerialPrograms/Source/PokemonFRLG/Programs/ShinyHunting/PokemonFRLG_GiftReset.cpp
+++ b/SerialPrograms/Source/PokemonFRLG/Programs/ShinyHunting/PokemonFRLG_GiftReset.cpp
@@ -78,6 +78,7 @@ GiftReset::GiftReset()
&NOTIFICATION_SHINY,
&NOTIFICATION_STATUS_UPDATE,
&NOTIFICATION_PROGRAM_FINISH,
+ &NOTIFICATION_ERROR_RECOVERABLE,
})
{
PA_ADD_OPTION(TARGET);
@@ -126,6 +127,7 @@ void GiftReset::obtain_pokemon(SingleSwitchProgramEnvironment& env, ProControlle
}
env.log("Initial A press completed.");
}else{
+ //Need to double check what the first dialog box is for the other gifts
pbf_press_button(context, BUTTON_A, 320ms, 640ms);
}
bool seen_selection_arrow = false;
@@ -253,6 +255,10 @@ bool GiftReset::try_open_summary(SingleSwitchProgramEnvironment& env, ProControl
if (ret < 0){
env.update_stats();
env.log("open_summary(): Unable to open Start menu after 10 attempts.", COLOR_RED);
+ send_program_recoverable_error_notification(
+ env, NOTIFICATION_ERROR_RECOVERABLE,
+ "open_summary(): Unable to open Start menu after 10 attempts."
+ );
return false;
}
@@ -282,6 +288,10 @@ bool GiftReset::try_open_summary(SingleSwitchProgramEnvironment& env, ProControl
env.log("Entered party menu.");
}else{
env.log("open_summary(): Unable to enter party menu.", COLOR_RED);
+ send_program_recoverable_error_notification(
+ env, NOTIFICATION_ERROR_RECOVERABLE,
+ "open_summary(): Unable to enter party menu."
+ );
return false;
}
@@ -307,6 +317,10 @@ bool GiftReset::try_open_summary(SingleSwitchProgramEnvironment& env, ProControl
env.log("Entered summary.");
}else{
env.log("open_summary(): Unable to enter summary.", COLOR_RED);
+ send_program_recoverable_error_notification(
+ env, NOTIFICATION_ERROR_RECOVERABLE,
+ "open_summary(): Unable to enter summary."
+ );
return false;
}
pbf_wait(context, 1000ms);