Skip to content

Commit eb36c8d

Browse files
committed
rename to rse, starter reset test
1 parent 96efeb1 commit eb36c8d

File tree

13 files changed

+406
-151
lines changed

13 files changed

+406
-151
lines changed

SerialPrograms/CMakeLists.txt

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1075,12 +1075,6 @@ file(GLOB MAIN_SOURCES
10751075
Source/PokemonBDSP/Programs/Trading/PokemonBDSP_TradeRoutines.h
10761076
Source/PokemonBDSP/Resources/PokemonBDSP_NameDatabase.cpp
10771077
Source/PokemonBDSP/Resources/PokemonBDSP_NameDatabase.h
1078-
Source/PokemonEmerald/Programs/ShinyHunting/PokemonEmerald_StarterReset.cpp
1079-
Source/PokemonEmerald/Programs/ShinyHunting/PokemonEmerald_StarterReset.h
1080-
Source/PokemonEmerald/PokemonEmerald_Panels.cpp
1081-
Source/PokemonEmerald/PokemonEmerald_Panels.h
1082-
Source/PokemonEmerald/PokemonEmerald_Settings.cpp
1083-
Source/PokemonEmerald/PokemonEmerald_Settings.h
10841078
Source/PokemonHome/Inference/PokemonHome_BallReader.cpp
10851079
Source/PokemonHome/Inference/PokemonHome_BallReader.h
10861080
Source/PokemonHome/Inference/PokemonHome_BoxGenderDetector.cpp
@@ -1297,6 +1291,16 @@ file(GLOB MAIN_SOURCES
12971291
Source/PokemonLA/Resources/PokemonLA_PokemonSprites.h
12981292
Source/PokemonLA/Resources/PokemonLA_WeatherAndTimeIcons.cpp
12991293
Source/PokemonLA/Resources/PokemonLA_WeatherAndTimeIcons.h
1294+
Source/PokemonRSE/Inference/Sounds/PokemonRSE_ShinySoundDetector.cpp
1295+
Source/PokemonRSE/Inference/Sounds/PokemonRSE_ShinySoundDetector.h
1296+
Source/PokemonRSE/Programs/ShinyHunting/PokemonRSE_StarterReset.cpp
1297+
Source/PokemonRSE/Programs/ShinyHunting/PokemonRSE_StarterReset.h
1298+
Source/PokemonRSE/PokemonRSE_Navigation.cpp
1299+
Source/PokemonRSE/PokemonRSE_Navigation.h
1300+
Source/PokemonRSE/PokemonRSE_Panels.cpp
1301+
Source/PokemonRSE/PokemonRSE_Panels.h
1302+
Source/PokemonRSE/PokemonRSE_Settings.cpp
1303+
Source/PokemonRSE/PokemonRSE_Settings.h
13001304
Source/PokemonSV/Inference/Battles/PokemonSV_BattleBallReader.cpp
13011305
Source/PokemonSV/Inference/Battles/PokemonSV_BattleBallReader.h
13021306
Source/PokemonSV/Inference/Battles/PokemonSV_EncounterWatcher.cpp

SerialPrograms/Source/PanelLists.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,8 +16,8 @@
1616
#include "PokemonSwSh/PokemonSwSh_Panels.h"
1717
#include "PokemonHome/PokemonHome_Panels.h"
1818
#include "PokemonBDSP/PokemonBDSP_Panels.h"
19-
#include "PokemonEmerald/PokemonEmerald_Panels.h"
2019
#include "PokemonLA/PokemonLA_Panels.h"
20+
#include "PokemonRSE/PokemonRSE_Panels.h"
2121
#include "PokemonSV/PokemonSV_Panels.h"
2222
#include "ZeldaTotK/ZeldaTotK_Panels.h"
2323
#include "PanelLists.h"
@@ -48,7 +48,7 @@ ProgramSelect::ProgramSelect(QWidget& parent, PanelHolder& holder)
4848
add(std::make_unique<NintendoSwitch::PokemonBDSP::PanelListFactory>());
4949
add(std::make_unique<NintendoSwitch::PokemonLA::PanelListFactory>());
5050
add(std::make_unique<NintendoSwitch::PokemonSV::PanelListFactory>());
51-
add(std::make_unique<NintendoSwitch::PokemonEmerald::PanelListFactory>());
51+
add(std::make_unique<NintendoSwitch::PokemonRSE::PanelListFactory>());
5252
add(std::make_unique<NintendoSwitch::ZeldaTotK::PanelListFactory>());
5353

5454

SerialPrograms/Source/PokemonEmerald/Programs/ShinyHunting/PokemonEmerald_StarterReset.cpp

Lines changed: 0 additions & 116 deletions
This file was deleted.
Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
/* Shiny Sound Detector
2+
*
3+
* From: https://github.com/PokemonAutomation/Arduino-Source
4+
*
5+
*/
6+
7+
#include "CommonFramework/Inference/SpectrogramMatcher.h"
8+
#include "CommonFramework/Inference/AudioTemplateCache.h"
9+
#include "CommonFramework/Tools/ConsoleHandle.h"
10+
#include "PokemonRSE/PokemonRSE_Settings.h"
11+
#include "PokemonRSE_ShinySoundDetector.h"
12+
13+
namespace PokemonAutomation{
14+
namespace NintendoSwitch{
15+
namespace PokemonRSE{
16+
17+
18+
ShinySoundDetector::ShinySoundDetector(ConsoleHandle& console, DetectedCallback detected_callback)
19+
// Use a yellow as the detection color because the shiny animation is yellow.
20+
: AudioPerSpectrumDetectorBase("ShinySoundDetector", "Shiny sound", COLOR_YELLOW, console, detected_callback)
21+
{}
22+
23+
24+
float ShinySoundDetector::get_score_threshold() const{
25+
return (float)GameSettings::instance().SHINY_SOUND_THRESHOLD;
26+
}
27+
28+
std::unique_ptr<SpectrogramMatcher> ShinySoundDetector::build_spectrogram_matcher(size_t sample_rate){
29+
return std::make_unique<SpectrogramMatcher>(
30+
"Shiny Sound",
31+
AudioTemplateCache::instance().get_throw("PokemonRSE/ShinySound", sample_rate),
32+
SpectrogramMatcher::Mode::SPIKE_CONV, sample_rate,
33+
GameSettings::instance().SHINY_SOUND_LOW_FREQUENCY
34+
);
35+
}
36+
37+
38+
39+
}
40+
}
41+
}
Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
/* Shiny Sound Detector
2+
*
3+
* From: https://github.com/PokemonAutomation/Arduino-Source
4+
*
5+
*/
6+
7+
#ifndef PokemonAutomation_PokemonRSE_ShinySoundDetector_H
8+
#define PokemonAutomation_PokemonRSE_ShinySoundDetector_H
9+
10+
#include "CommonFramework/Inference/AudioPerSpectrumDetectorBase.h"
11+
12+
namespace PokemonAutomation{
13+
namespace NintendoSwitch{
14+
namespace PokemonRSE{
15+
16+
17+
class ShinySoundDetector : public AudioPerSpectrumDetectorBase{
18+
public:
19+
// Warning: The callback will be called from the audio inference thread.
20+
ShinySoundDetector(ConsoleHandle& console, DetectedCallback detected_callback);
21+
22+
// Implement AudioPerSpectrumDetectorBase::get_score_threshold()
23+
virtual float get_score_threshold() const override;
24+
25+
protected:
26+
// Implement AudioPerSpectrumDetectorBase::build_spectrogram_matcher()
27+
virtual std::unique_ptr<SpectrogramMatcher> build_spectrogram_matcher(size_t sample_rate) override;
28+
};
29+
30+
31+
32+
33+
}
34+
}
35+
}
36+
#endif
Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
/* Pokemon RSE Navigation
2+
*
3+
* From: https://github.com/PokemonAutomation/Arduino-Source
4+
*
5+
* Soft reset, menus, etc.
6+
*
7+
*/
8+
9+
#include "CommonFramework/Exceptions/OperationFailedException.h"
10+
#include "CommonFramework/Exceptions/UnexpectedBattleException.h"
11+
#include "CommonFramework/InferenceInfra/InferenceRoutines.h"
12+
#include "NintendoSwitch/NintendoSwitch_Settings.h"
13+
#include "NintendoSwitch/Commands/NintendoSwitch_Commands_PushButtons.h"
14+
#include "NintendoSwitch/Commands/NintendoSwitch_Commands_Superscalar.h"
15+
#include "PokemonRSE_Navigation.h"
16+
17+
namespace PokemonAutomation{
18+
namespace NintendoSwitch{
19+
namespace PokemonRSE{
20+
21+
22+
void soft_reset(const ProgramInfo& info, ConsoleHandle& console, BotBaseContext& context){
23+
// A + B + Select + Start
24+
pbf_press_button(context, BUTTON_B | BUTTON_Y | BUTTON_MINUS | BUTTON_PLUS, 10, 180);
25+
26+
pbf_mash_button(context, BUTTON_PLUS, 500);
27+
context.wait_for_all_requests();
28+
29+
pbf_press_button(context, BUTTON_A, 20, 40);
30+
31+
//Wait for game to load in
32+
pbf_wait(context, 300);
33+
context.wait_for_all_requests();
34+
}
35+
36+
37+
38+
39+
40+
41+
42+
43+
44+
}
45+
}
46+
}
Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
/* Pokemon RSE Navigation
2+
*
3+
* From: https://github.com/PokemonAutomation/Arduino-Source
4+
*
5+
* Soft reset, menus, etc.
6+
*
7+
*/
8+
9+
#ifndef PokemonAutomation_PokemonRSE_Navigation_H
10+
#define PokemonAutomation_PokemonRSE_Navigation_H
11+
12+
#include "Common/NintendoSwitch/NintendoSwitch_ControllerDefs.h"
13+
14+
namespace PokemonAutomation{
15+
struct ProgramInfo;
16+
class ConsoleHandle;
17+
class BotBaseContext;
18+
namespace NintendoSwitch{
19+
namespace PokemonRSE{
20+
21+
// Press A+B+Select+Start at the same time to soft reset, then re-enters the game.
22+
// This assumes no dry battery. Adding detection for that is a TODO.
23+
void soft_reset(const ProgramInfo& info, ConsoleHandle& console, BotBaseContext& context);
24+
25+
26+
}
27+
}
28+
}
29+
#endif

SerialPrograms/Source/PokemonEmerald/PokemonEmerald_Panels.cpp renamed to SerialPrograms/Source/PokemonRSE/PokemonRSE_Panels.cpp

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,24 +1,24 @@
1-
/* Pokemon Emerald Panels
1+
/* Pokemon RSE Panels
22
*
33
* From: https://github.com/PokemonAutomation/Arduino-Source
44
*
55
*/
66

77
#include "Pokemon/Pokemon_Strings.h"
8-
#include "PokemonEmerald_Panels.h"
8+
#include "PokemonRSE_Panels.h"
99

1010
//#include "PokemonSV_Settings.h"
1111

12-
#include "Programs/ShinyHunting/PokemonEmerald_StarterReset.h"
12+
#include "Programs/ShinyHunting/PokemonRSE_StarterReset.h"
1313

1414
namespace PokemonAutomation{
1515
namespace NintendoSwitch{
16-
namespace PokemonEmerald{
16+
namespace PokemonRSE{
1717

1818

1919

2020
PanelListFactory::PanelListFactory()
21-
: PanelListDescriptor("Pokemon Emerald")
21+
: PanelListDescriptor("Pokemon Ruby, Sapphire, and Emerald")
2222
{}
2323

2424
std::vector<PanelEntry> PanelListFactory::make_panels() const{

SerialPrograms/Source/PokemonEmerald/PokemonEmerald_Panels.h renamed to SerialPrograms/Source/PokemonRSE/PokemonRSE_Panels.h

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,17 @@
1-
/* Pokemon Emerald Panels
1+
/* Pokemon RSE Panels
22
*
33
* From: https://github.com/PokemonAutomation/Arduino-Source
44
*
55
*/
66

7-
#ifndef PokemonAutomation_PokemonEmerald_Panels_H
8-
#define PokemonAutomation_PokemonEmerald_Panels_H
7+
#ifndef PokemonAutomation_PokemonRSE_Panels_H
8+
#define PokemonAutomation_PokemonRSE_Panels_H
99

1010
#include "CommonFramework/Panels/PanelList.h"
1111

1212
namespace PokemonAutomation{
1313
namespace NintendoSwitch{
14-
namespace PokemonEmerald{
14+
namespace PokemonRSE{
1515

1616

1717

0 commit comments

Comments
 (0)