Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions SerialPrograms/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -1360,6 +1360,12 @@ file(GLOB MAIN_SOURCES
Source/PokemonLA/Resources/PokemonLA_PokemonSprites.h
Source/PokemonLA/Resources/PokemonLA_WeatherAndTimeIcons.cpp
Source/PokemonLA/Resources/PokemonLA_WeatherAndTimeIcons.h
Source/PokemonLGPE/Inference/PokemonLGPE_ShinySymbolDetector.cpp
Source/PokemonLGPE/Inference/PokemonLGPE_ShinySymbolDetector.h
Source/PokemonLGPE/Programs/PokemonLGPE_AlolanTrade.cpp
Source/PokemonLGPE/Programs/PokemonLGPE_AlolanTrade.h
Source/PokemonLGPE/PokemonLGPE_Panels.cpp
Source/PokemonLGPE/PokemonLGPE_Panels.h
Source/PokemonRSE/Inference/Dialogs/PokemonRSE_DialogDetector.cpp
Source/PokemonRSE/Inference/Dialogs/PokemonRSE_DialogDetector.h
Source/PokemonRSE/Inference/Sounds/PokemonRSE_ShinySoundDetector.cpp
Expand Down
6 changes: 6 additions & 0 deletions SerialPrograms/SerialPrograms.pro
Original file line number Diff line number Diff line change
Expand Up @@ -667,6 +667,9 @@ SOURCES += \
Source/PokemonLA/Resources/PokemonLA_NameDatabase.cpp \
Source/PokemonLA/Resources/PokemonLA_PokemonSprites.cpp \
Source/PokemonLA/Resources/PokemonLA_WeatherAndTimeIcons.cpp \
Source/PokemonLGPE/Inference/PokemonLGPE_ShinySymbolDetector.cpp \
Source/PokemonLGPE/Programs/PokemonLGPE_AlolanTrade.cpp \
Source/PokemonLGPE/PokemonLGPE_Panels.cpp \
Source/PokemonRSE/Inference/Dialogs/PokemonRSE_DialogDetector.cpp \
Source/PokemonRSE/Inference/PokemonRSE_ShinyNumberDetector.cpp \
Source/PokemonRSE/Inference/Sounds/PokemonRSE_ShinySoundDetector.cpp \
Expand Down Expand Up @@ -1846,6 +1849,9 @@ HEADERS += \
Source/PokemonLA/Resources/PokemonLA_NameDatabase.h \
Source/PokemonLA/Resources/PokemonLA_PokemonSprites.h \
Source/PokemonLA/Resources/PokemonLA_WeatherAndTimeIcons.h \
Source/PokemonLGPE/Inference/PokemonLGPE_ShinySymbolDetector.h \
Source/PokemonLGPE/Programs/PokemonLGPE_AlolanTrade.h \
Source/PokemonLGPE/PokemonLGPE_Panels.h \
Source/PokemonRSE/Inference/Dialogs/PokemonRSE_DialogDetector.h \
Source/PokemonRSE/Inference/PokemonRSE_ShinyNumberDetector.h \
Source/PokemonRSE/Inference/Sounds/PokemonRSE_ShinySoundDetector.h \
Expand Down
2 changes: 2 additions & 0 deletions SerialPrograms/Source/PanelLists.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
#include "PokemonHome/PokemonHome_Panels.h"
#include "PokemonBDSP/PokemonBDSP_Panels.h"
#include "PokemonLA/PokemonLA_Panels.h"
#include "PokemonLGPE/PokemonLGPE_Panels.h"
#include "PokemonRSE/PokemonRSE_Panels.h"
#include "PokemonSV/PokemonSV_Panels.h"
#include "ZeldaTotK/ZeldaTotK_Panels.h"
Expand Down Expand Up @@ -51,6 +52,7 @@ ProgramSelect::ProgramSelect(QWidget& parent, PanelHolder& holder)
add(std::make_unique<NintendoSwitch::PokemonSV::PanelListFactory>());
if (PreloadSettings::instance().DEVELOPER_MODE) {
add(std::make_unique<NintendoSwitch::PokemonRSE::PanelListFactory>());
add(std::make_unique<NintendoSwitch::PokemonLGPE::PanelListFactory>());
}
add(std::make_unique<NintendoSwitch::ZeldaTotK::PanelListFactory>());

Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
/* Shiny Symbol Detector
*
* From: https://github.com/PokemonAutomation/Arduino-Source
*
*/

#include "Common/Cpp/Color.h"
#include "CommonFramework/ImageTools/ImageBoxes.h"
#include "CommonFramework/ImageTools/ImageStats.h"
#include "CommonFramework/ImageTypes/ImageRGB32.h"
#include "CommonFramework/ImageTypes/ImageViewRGB32.h"
#include "CommonFramework/VideoPipeline/VideoOverlayScopes.h"
#include "CommonTools/Images/ImageFilter.h"
#include "PokemonLGPE_ShinySymbolDetector.h"

#include <iostream>
using std::cout;
using std::endl;

namespace PokemonAutomation{
namespace NintendoSwitch{
namespace PokemonLGPE{

ShinySymbolDetector::ShinySymbolDetector(Color color)
: m_box_star(0.666, 0.779, 0.028, 0.044)
{}
void ShinySymbolDetector::make_overlays(VideoOverlaySet& items) const{
items.add(COLOR_RED, m_box_star);
}
bool ShinySymbolDetector::read(Logger& logger, const ImageViewRGB32& frame){
/*
Shiny (charizard):
Add infer box: (0.6660, 0.7790, 0.0280, 0.0440), RGB avg [159, 123, 125] avg sum 408 ratio [0.391, 0.301, 0.308] stddev [74.898, 54.696, 53.354] sum 182.948 crop size (54, 48)

Not shiny (chansey):
Add infer box: (0.6660, 0.7790, 0.0280, 0.0440), RGB avg [82, 113, 100] avg sum 295 ratio [0.276, 0.384, 0.340] stddev [15.477, 2.178, 2.648] sum 20.303 crop size (54, 48)

Only had the two to test with for now.
*/

const auto stats = image_stats(extract_box_reference(frame, m_box_star));
return stats.stddev.sum() > 100;
}


}
}
}

Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
/* Shiny Symbol Detector
*
* From: https://github.com/PokemonAutomation/Arduino-Source
*
*/

#ifndef PokemonAutomation_PokemonRSE_ShinyNumberDetector_H
#define PokemonAutomation_PokemonRSE_ShinyNumberDetector_H

#include "Common/Cpp/AbstractLogger.h"
#include "CommonFramework/VideoPipeline/VideoOverlayScopes.h"

namespace PokemonAutomation{
namespace NintendoSwitch{
namespace PokemonLGPE{

//Check for the red shiny star on a Pokemon's summary from the Party/Box menu.
//This does not work for the summary that appears after a catch.
class ShinySymbolDetector{
public:
ShinySymbolDetector(Color color);

virtual void make_overlays(VideoOverlaySet& items) const;
bool read(Logger& logger, const ImageViewRGB32& frame);

private:
ImageFloatBox m_box_star;
};



}
}
}
#endif
40 changes: 40 additions & 0 deletions SerialPrograms/Source/PokemonLGPE/PokemonLGPE_Panels.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
/* Pokemon LGPE Panels
*
* From: https://github.com/PokemonAutomation/Arduino-Source
*
*/

#include "CommonFramework/GlobalSettingsPanel.h"
#include "Pokemon/Pokemon_Strings.h"
#include "PokemonLGPE_Panels.h"

#include "Programs/PokemonLGPE_AlolanTrade.h"

namespace PokemonAutomation{
namespace NintendoSwitch{
namespace PokemonLGPE{

PanelListFactory::PanelListFactory()
: PanelListDescriptor(Pokemon::STRING_POKEMON + " Let's Go Pikachu and Eevee")
{}

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

ret.emplace_back("---- Settings ----");
//ret.emplace_back(make_settings<GameSettings_Descriptor, GameSettingsPanel>());

//ret.emplace_back("---- General ----");

ret.emplace_back("---- Shiny Hunting ----");
ret.emplace_back(make_single_switch_program<AlolanTrade_Descriptor, AlolanTrade>());

return ret;
}




}
}
}
27 changes: 27 additions & 0 deletions SerialPrograms/Source/PokemonLGPE/PokemonLGPE_Panels.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
/* Pokemon LGPE Panels
*
* From: https://github.com/PokemonAutomation/Arduino-Source
*
*/

#ifndef PokemonAutomation_PokemonLGPE_Panels_H
#define PokemonAutomation_PokemonLGPE_Panels_H

#include "CommonFramework/Panels/PanelList.h"

namespace PokemonAutomation{
namespace NintendoSwitch{
namespace PokemonLGPE{

class PanelListFactory : public PanelListDescriptor{
public:
PanelListFactory();
virtual std::vector<PanelEntry> make_panels() const;
};



}
}
}
#endif
Loading