Skip to content

Commit 7a08baf

Browse files
authored
rse new panel and settings (#527)
* rse new panel and settings * remove GAME_TO_HOME_DELAY
1 parent 52b4510 commit 7a08baf

File tree

7 files changed

+242
-0
lines changed

7 files changed

+242
-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: 92 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,92 @@
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_soft_reset_timings("<font size=4><b>Soft Reset Timings:</b></font>")
25+
, START_BUTTON_MASH(
26+
"<b>Start Button Mash:</b><br>Mash Start for this long after a soft reset to get to the main menu.",
27+
LockMode::LOCK_WHILE_RUNNING,
28+
TICKS_PER_SECOND,
29+
"5 * TICKS_PER_SECOND"
30+
)
31+
, ENTER_GAME_WAIT(
32+
"<b>Enter Game Wait:</b><br>Wait this long for the game to load.",
33+
LockMode::LOCK_WHILE_RUNNING,
34+
TICKS_PER_SECOND,
35+
"3 * TICKS_PER_SECOND"
36+
)
37+
, m_shiny_audio_settings("<font size=4><b>Shiny Audio Settings:</b></font>")
38+
, SHINY_SOUND_THRESHOLD(
39+
"<b>Shiny Sound Threshold:</b><br>Maximum error coefficient to trigger a shiny detection.",
40+
LockMode::LOCK_WHILE_RUNNING,
41+
0.97, 0, 1.0
42+
)
43+
, SHINY_SOUND_LOW_FREQUENCY(
44+
"<b>Shiny Sound Low Frequency (Hz):</b><br>High pass filter frequency for shiny sound.",
45+
LockMode::LOCK_WHILE_RUNNING,
46+
5000, 0, 48000
47+
)
48+
{
49+
PA_ADD_STATIC(m_soft_reset_timings);
50+
PA_ADD_OPTION(START_BUTTON_MASH);
51+
PA_ADD_OPTION(ENTER_GAME_WAIT);
52+
PA_ADD_STATIC(m_shiny_audio_settings);
53+
PA_ADD_OPTION(SHINY_SOUND_THRESHOLD);
54+
PA_ADD_OPTION(SHINY_SOUND_LOW_FREQUENCY);
55+
}
56+
57+
58+
59+
60+
61+
GameSettings_Descriptor::GameSettings_Descriptor()
62+
: PanelDescriptor(
63+
Color(),
64+
"PokemonRSE:GlobalSettings",
65+
"Pokemon RSE", "Pokemon Settings",
66+
"ComputerControl/blob/master/Wiki/Programs/PokemonRSE/RSESettings.md",
67+
"Global Pokemon RSE Settings"
68+
)
69+
{}
70+
71+
72+
73+
GameSettingsPanel::GameSettingsPanel(const GameSettings_Descriptor& descriptor)
74+
: SettingsPanelInstance(descriptor)
75+
, settings(GameSettings::instance())
76+
{
77+
PA_ADD_OPTION(settings);
78+
}
79+
80+
81+
82+
83+
84+
}
85+
}
86+
}
87+
88+
89+
90+
91+
92+
Lines changed: 56 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,56 @@
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_soft_reset_timings;
27+
TimeExpressionOption<uint16_t> START_BUTTON_MASH;
28+
TimeExpressionOption<uint16_t> ENTER_GAME_WAIT;
29+
30+
SectionDividerOption m_shiny_audio_settings;
31+
FloatingPointOption SHINY_SOUND_THRESHOLD;
32+
FloatingPointOption SHINY_SOUND_LOW_FREQUENCY;
33+
34+
};
35+
36+
37+
38+
39+
class GameSettings_Descriptor : public PanelDescriptor{
40+
public:
41+
GameSettings_Descriptor();
42+
};
43+
44+
45+
class GameSettingsPanel : public SettingsPanelInstance{
46+
public:
47+
GameSettingsPanel(const GameSettings_Descriptor& descriptor);
48+
private:
49+
GameSettings& settings;
50+
};
51+
52+
53+
}
54+
}
55+
}
56+
#endif

0 commit comments

Comments
 (0)