Skip to content

Commit 23f257c

Browse files
committed
rse new panel and settings
1 parent 52b4510 commit 23f257c

File tree

7 files changed

+252
-0
lines changed

7 files changed

+252
-0
lines changed

SerialPrograms/CMakeLists.txt

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1306,6 +1306,10 @@ file(GLOB MAIN_SOURCES
13061306
Source/PokemonLA/Resources/PokemonLA_PokemonSprites.h
13071307
Source/PokemonLA/Resources/PokemonLA_WeatherAndTimeIcons.cpp
13081308
Source/PokemonLA/Resources/PokemonLA_WeatherAndTimeIcons.h
1309+
Source/PokemonRSE/PokemonRSE_Panels.cpp
1310+
Source/PokemonRSE/PokemonRSE_Panels.h
1311+
Source/PokemonRSE/PokemonRSE_Settings.cpp
1312+
Source/PokemonRSE/PokemonRSE_Settings.h
13091313
Source/PokemonSV/Inference/Battles/PokemonSV_BattleBallReader.cpp
13101314
Source/PokemonSV/Inference/Battles/PokemonSV_BattleBallReader.h
13111315
Source/PokemonSV/Inference/Battles/PokemonSV_EncounterWatcher.cpp

SerialPrograms/Source/CommonFramework/GlobalSettingsPanel.cpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,7 @@ const std::set<std::string> TOKENS{
4242
"9f86d081884c7d659a2feaa0c55ad015a3bf4f1b2b0b822cd15d6c15b0f00a08", // jw's token.
4343
"e8d168bc482e96553ea9f9ecaea5a817474dbccc2a6a228a6bde67f2b2aa2889", // James' token.
4444
"7555b7c63481cad42306718c67e7f9def5bfd1da8f6cd299ccd3d7dc95f307ae", // Kuro's token.
45+
"3d475b46d121fc24559d100de2426feaa53cd6578aac2817c4857a610ccde2dd", // kichi's token.
4546
};
4647

4748

SerialPrograms/Source/PanelLists.cpp

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,11 +12,13 @@
1212
#include "CommonFramework/PersistentSettings.h"
1313
#include "CommonFramework/Windows/DpiScaler.h"
1414
#include "CommonFramework/Panels/UI/PanelListWidget.h"
15+
#include "CommonFramework/GlobalSettingsPanel.h"
1516
#include "NintendoSwitch/NintendoSwitch_Panels.h"
1617
#include "PokemonSwSh/PokemonSwSh_Panels.h"
1718
#include "PokemonHome/PokemonHome_Panels.h"
1819
#include "PokemonBDSP/PokemonBDSP_Panels.h"
1920
#include "PokemonLA/PokemonLA_Panels.h"
21+
#include "PokemonRSE/PokemonRSE_Panels.h"
2022
#include "PokemonSV/PokemonSV_Panels.h"
2123
#include "ZeldaTotK/ZeldaTotK_Panels.h"
2224
#include "PanelLists.h"
@@ -47,6 +49,9 @@ ProgramSelect::ProgramSelect(QWidget& parent, PanelHolder& holder)
4749
add(std::make_unique<NintendoSwitch::PokemonBDSP::PanelListFactory>());
4850
add(std::make_unique<NintendoSwitch::PokemonLA::PanelListFactory>());
4951
add(std::make_unique<NintendoSwitch::PokemonSV::PanelListFactory>());
52+
if (PreloadSettings::instance().DEVELOPER_MODE) {
53+
add(std::make_unique<NintendoSwitch::PokemonRSE::PanelListFactory>());
54+
}
5055
add(std::make_unique<NintendoSwitch::ZeldaTotK::PanelListFactory>());
5156

5257

Lines changed: 55 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,55 @@
1+
/* Pokemon RSE Panels
2+
*
3+
* From: https://github.com/PokemonAutomation/Arduino-Source
4+
*
5+
*/
6+
7+
#include "CommonFramework/GlobalSettingsPanel.h"
8+
#include "Pokemon/Pokemon_Strings.h"
9+
#include "PokemonRSE_Panels.h"
10+
11+
#include "PokemonRSE_Settings.h"
12+
13+
//#include "Programs/ShinyHunting/PokemonRSE_AudioStarterReset.h"
14+
//#include "Programs/ShinyHunting/PokemonRSE_StarterReset.h"
15+
//#include "Programs/TestPrograms/PokemonRSE_SoundListener.h"
16+
17+
namespace PokemonAutomation{
18+
namespace NintendoSwitch{
19+
namespace PokemonRSE{
20+
21+
22+
23+
PanelListFactory::PanelListFactory()
24+
: PanelListDescriptor("Pokemon Ruby and Sapphire, Pokemon Emerald")
25+
{}
26+
27+
std::vector<PanelEntry> PanelListFactory::make_panels() const{
28+
std::vector<PanelEntry> ret;
29+
30+
ret.emplace_back("---- Settings ----");
31+
ret.emplace_back(make_settings<GameSettings_Descriptor, GameSettingsPanel>());
32+
33+
//ret.emplace_back("---- General ----");
34+
35+
ret.emplace_back("---- Shiny Hunting ----");
36+
//ret.emplace_back(make_single_switch_program<AudioStarterReset_Descriptor, AudioStarterReset>());
37+
38+
39+
if (PreloadSettings::instance().DEVELOPER_MODE){
40+
ret.emplace_back("---- Test ----");
41+
//ret.emplace_back(make_single_switch_program<StarterReset_Descriptor, StarterReset>()); //outdated early test program
42+
43+
ret.emplace_back("---- Developer Tools ----");
44+
//ret.emplace_back(make_single_switch_program<SoundListener_Descriptor, SoundListener>());
45+
}
46+
47+
return ret;
48+
}
49+
50+
51+
52+
53+
}
54+
}
55+
}
Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
/* Pokemon RSE Panels
2+
*
3+
* From: https://github.com/PokemonAutomation/Arduino-Source
4+
*
5+
*/
6+
7+
#ifndef PokemonAutomation_PokemonRSE_Panels_H
8+
#define PokemonAutomation_PokemonRSE_Panels_H
9+
10+
#include "CommonFramework/Panels/PanelList.h"
11+
12+
namespace PokemonAutomation{
13+
namespace NintendoSwitch{
14+
namespace PokemonRSE{
15+
16+
17+
18+
class PanelListFactory : public PanelListDescriptor{
19+
public:
20+
PanelListFactory();
21+
virtual std::vector<PanelEntry> make_panels() const;
22+
};
23+
24+
25+
26+
}
27+
}
28+
}
29+
#endif
Lines changed: 99 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,99 @@
1+
/* Pokemon RSE Settings
2+
*
3+
* From: https://github.com/PokemonAutomation/Arduino-Source
4+
*
5+
*/
6+
7+
#include "Common/NintendoSwitch/NintendoSwitch_ControllerDefs.h"
8+
#include "CommonFramework/Globals.h"
9+
10+
#include "PokemonRSE_Settings.h"
11+
12+
namespace PokemonAutomation{
13+
namespace NintendoSwitch{
14+
namespace PokemonRSE{
15+
16+
17+
18+
GameSettings& GameSettings::instance(){
19+
static GameSettings settings;
20+
return settings;
21+
}
22+
GameSettings::GameSettings()
23+
: BatchOption(LockMode::LOCK_WHILE_RUNNING)
24+
, m_menu_navigation("<font size=4><b>Menu Navigation Timings:</b></font>")
25+
, GAME_TO_HOME_DELAY(
26+
"<b>Game to Home Delay:</b><br>Delay from pressing home to entering the the Switch home menu.",
27+
LockMode::LOCK_WHILE_RUNNING,
28+
TICKS_PER_SECOND,
29+
"125"
30+
)
31+
, m_soft_reset_timings("<font size=4><b>Soft Reset Timings:</b></font>")
32+
, START_BUTTON_MASH(
33+
"<b>1. Start Button Mash:</b><br>Mash Start for this long after a soft reset to get to the main menu.",
34+
LockMode::LOCK_WHILE_RUNNING,
35+
TICKS_PER_SECOND,
36+
"5 * TICKS_PER_SECOND"
37+
)
38+
, ENTER_GAME_WAIT(
39+
"<b>2. Enter Game Wait:</b><br>Wait this long for the game to load.",
40+
LockMode::LOCK_WHILE_RUNNING,
41+
TICKS_PER_SECOND,
42+
"3 * TICKS_PER_SECOND"
43+
)
44+
, m_shiny_audio_settings("<font size=4><b>Shiny Audio Settings:</b></font>")
45+
, SHINY_SOUND_THRESHOLD(
46+
"<b>Shiny Sound Threshold:</b><br>Maximum error coefficient to trigger a shiny detection.",
47+
LockMode::LOCK_WHILE_RUNNING,
48+
0.97, 0, 1.0
49+
)
50+
, SHINY_SOUND_LOW_FREQUENCY(
51+
"<b>Shiny Sound Low Frequency (Hz):</b><br>High pass filter frequency for shiny sound.",
52+
LockMode::LOCK_WHILE_RUNNING,
53+
5000, 0, 48000
54+
)
55+
{
56+
PA_ADD_STATIC(m_soft_reset_timings);
57+
PA_ADD_OPTION(START_BUTTON_MASH);
58+
PA_ADD_OPTION(ENTER_GAME_WAIT);
59+
PA_ADD_STATIC(m_shiny_audio_settings);
60+
PA_ADD_OPTION(SHINY_SOUND_THRESHOLD);
61+
PA_ADD_OPTION(SHINY_SOUND_LOW_FREQUENCY);
62+
}
63+
64+
65+
66+
67+
68+
GameSettings_Descriptor::GameSettings_Descriptor()
69+
: PanelDescriptor(
70+
Color(),
71+
"PokemonRSE:GlobalSettings",
72+
"Pokemon RSE", "Pokemon Settings",
73+
"ComputerControl/blob/master/Wiki/Programs/PokemonRSE/RSESettings.md",
74+
"Global Pokemon RSE Settings"
75+
)
76+
{}
77+
78+
79+
80+
GameSettingsPanel::GameSettingsPanel(const GameSettings_Descriptor& descriptor)
81+
: SettingsPanelInstance(descriptor)
82+
, settings(GameSettings::instance())
83+
{
84+
PA_ADD_OPTION(settings);
85+
}
86+
87+
88+
89+
90+
91+
}
92+
}
93+
}
94+
95+
96+
97+
98+
99+
Lines changed: 59 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,59 @@
1+
/* Pokemon RSE Settings
2+
*
3+
* From: https://github.com/PokemonAutomation/Arduino-Source
4+
*
5+
*/
6+
7+
#ifndef PokemonAutomation_PokemonRSE_Settings_H
8+
#define PokemonAutomation_PokemonRSE_Settings_H
9+
10+
#include "Common/Cpp/Options/StaticTextOption.h"
11+
#include "Common/Cpp/Options/BooleanCheckBoxOption.h"
12+
#include "Common/Cpp/Options/FloatingPointOption.h"
13+
#include "Common/Cpp/Options/TimeExpressionOption.h"
14+
#include "CommonFramework/Panels/SettingsPanel.h"
15+
16+
namespace PokemonAutomation{
17+
namespace NintendoSwitch{
18+
namespace PokemonRSE{
19+
20+
21+
class GameSettings : public BatchOption{
22+
GameSettings();
23+
public:
24+
static GameSettings& instance();
25+
26+
SectionDividerOption m_menu_navigation;
27+
TimeExpressionOption<uint16_t> GAME_TO_HOME_DELAY;
28+
29+
SectionDividerOption m_soft_reset_timings;
30+
TimeExpressionOption<uint16_t> START_BUTTON_MASH;
31+
TimeExpressionOption<uint16_t> ENTER_GAME_WAIT;
32+
33+
SectionDividerOption m_shiny_audio_settings;
34+
FloatingPointOption SHINY_SOUND_THRESHOLD;
35+
FloatingPointOption SHINY_SOUND_LOW_FREQUENCY;
36+
37+
};
38+
39+
40+
41+
42+
class GameSettings_Descriptor : public PanelDescriptor{
43+
public:
44+
GameSettings_Descriptor();
45+
};
46+
47+
48+
class GameSettingsPanel : public SettingsPanelInstance{
49+
public:
50+
GameSettingsPanel(const GameSettings_Descriptor& descriptor);
51+
private:
52+
GameSettings& settings;
53+
};
54+
55+
56+
}
57+
}
58+
}
59+
#endif

0 commit comments

Comments
 (0)