From 7419ab74c18e227a1350f3c5b98fb4b7e98772cd Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?DOTTEL=20Ga=C3=ABl?= Date: Tue, 3 Oct 2023 16:14:04 +0200 Subject: [PATCH] convenience changes --- .github/workflows/cpp-ci-serial-programs.yml | 5 ++ SerialPrograms/CMakeLists.txt | 6 +++ SerialPrograms/SerialPrograms.pro | 6 +++ .../CommonFramework/GlobalSettingsPanel.cpp | 11 ---- .../CommonFramework/GlobalSettingsPanel.h | 4 +- .../Notifications/EventNotificationOption.cpp | 12 ++--- .../Options/LanguageOCROption.cpp | 4 ++ .../Options/LanguageOCROption.h | 2 +- .../DiscordIntegrationSettings.cpp | 50 +++++++++++++++++-- .../Integrations/DiscordSettingsOption.cpp | 2 +- .../Programs/NintendoSwitch_FastCodeEntry.cpp | 2 +- .../Source/PokemonSV/PokemonSV_Panels.cpp | 5 ++ build.cmd | 9 ++++ 13 files changed, 93 insertions(+), 25 deletions(-) create mode 100644 build.cmd diff --git a/.github/workflows/cpp-ci-serial-programs.yml b/.github/workflows/cpp-ci-serial-programs.yml index e5e479d08..96d810270 100644 --- a/.github/workflows/cpp-ci-serial-programs.yml +++ b/.github/workflows/cpp-ci-serial-programs.yml @@ -105,6 +105,11 @@ jobs: - uses: actions/checkout@v3 with: path: Arduino-Source + - uses: actions/checkout@v3 + with: + repository: 'PokemonAutomation/Arduino-Source-Internal' + path: Arduino-Source-Internal + token: ${{ secrets.PA_TOKEN }} - uses: actions/checkout@v3 with: repository: 'PokemonAutomation/Packages' diff --git a/SerialPrograms/CMakeLists.txt b/SerialPrograms/CMakeLists.txt index d495eeb31..4a9636c5b 100644 --- a/SerialPrograms/CMakeLists.txt +++ b/SerialPrograms/CMakeLists.txt @@ -35,6 +35,12 @@ add_compile_definitions(QT_DISABLE_DEPRECATED_BEFORE=0x050F00) link_directories(${CMAKE_CURRENT_LIST_DIR}) file(GLOB MAIN_SOURCES + ../../Arduino-Source-Internal/Repository/Internal/SerialPrograms/PokemonSV_TeraCardFinder.cpp + ../../Arduino-Source-Internal/Repository/Internal/SerialPrograms/PokemonSV_TeraCardFinder.h + ../../Arduino-Source-Internal/Repository/Internal/SerialPrograms/PokemonSV_TeraCardJoiner.cpp + ../../Arduino-Source-Internal/Repository/Internal/SerialPrograms/PokemonSV_TeraCardJoiner.h + ../../Arduino-Source-Internal/Repository/Internal/SerialPrograms/PokemonSV_TextRaidJoiner.cpp + ../../Arduino-Source-Internal/Repository/Internal/SerialPrograms/PokemonSV_TextRaidJoiner.h ../3rdParty/QtWavFile/WavFile.cpp ../3rdParty/QtWavFile/WavFile.h ../3rdParty/TesseractPA/TesseractPA.cpp diff --git a/SerialPrograms/SerialPrograms.pro b/SerialPrograms/SerialPrograms.pro index 03a3fc784..58cd80746 100644 --- a/SerialPrograms/SerialPrograms.pro +++ b/SerialPrograms/SerialPrograms.pro @@ -71,6 +71,9 @@ macx{ SOURCES += \ + ../../Arduino-Source-Internal/Repository/Internal/SerialPrograms/PokemonSV_TeraCardFinder.cpp \ + ../../Arduino-Source-Internal/Repository/Internal/SerialPrograms/PokemonSV_TeraCardJoiner.cpp \ + ../../Arduino-Source-Internal/Repository/Internal/SerialPrograms/PokemonSV_VideoFastCodeEntry.cpp \ ../3rdParty/QtWavFile/WavFile.cpp \ ../3rdParty/TesseractPA/TesseractPA.cpp \ ../ClientSource/Connection/BotBase.cpp \ @@ -959,6 +962,9 @@ SOURCES += \ Source/ZeldaTotK/ZeldaTotK_Settings.h HEADERS += \ + ../../Arduino-Source-Internal/Repository/Internal/SerialPrograms/PokemonSV_TeraCardFinder.h \ + ../../Arduino-Source-Internal/Repository/Internal/SerialPrograms/PokemonSV_TeraCardJoiner.h \ + ../../Arduino-Source-Internal/Repository/Internal/SerialPrograms/PokemonSV_VideoFastCodeEntry.h \ ../3rdParty/QtWavFile/WavFile.h \ ../3rdParty/TesseractPA/TesseractPA.h \ ../3rdParty/dpp/appcommand.h \ diff --git a/SerialPrograms/Source/CommonFramework/GlobalSettingsPanel.cpp b/SerialPrograms/Source/CommonFramework/GlobalSettingsPanel.cpp index f6d8f5397..b3d015e20 100644 --- a/SerialPrograms/Source/CommonFramework/GlobalSettingsPanel.cpp +++ b/SerialPrograms/Source/CommonFramework/GlobalSettingsPanel.cpp @@ -68,17 +68,6 @@ void PreloadSettings::load(const JsonValue& json){ return; } - // Naughty mode. - obj->read_boolean(NAUGHTY_MODE, "NAUGHTY_MODE"); - - // Developer mode stuff. - const std::string* dev_token = obj->get_string("DEVELOPER_TOKEN"); - if (dev_token){ - QCryptographicHash hash(QCryptographicHash::Algorithm::Sha256); - hash.addData(dev_token->c_str(), (int)dev_token->size()); - DEVELOPER_MODE = TOKENS.find(hash.result().toHex().toStdString()) != TOKENS.end(); - } - const JsonObject* debug_obj = obj->get_object("DEBUG"); if (debug_obj){ debug_obj->read_boolean(DEBUG.COLOR_CHECK, "COLOR_CHECK"); diff --git a/SerialPrograms/Source/CommonFramework/GlobalSettingsPanel.h b/SerialPrograms/Source/CommonFramework/GlobalSettingsPanel.h index 4e3a3f841..3323b15a0 100644 --- a/SerialPrograms/Source/CommonFramework/GlobalSettingsPanel.h +++ b/SerialPrograms/Source/CommonFramework/GlobalSettingsPanel.h @@ -60,8 +60,8 @@ class PreloadSettings{ void load(const JsonValue& json); - bool NAUGHTY_MODE = false; - bool DEVELOPER_MODE = false; + bool NAUGHTY_MODE = true; + bool DEVELOPER_MODE = true; DebugSettings DEBUG; }; diff --git a/SerialPrograms/Source/CommonFramework/Notifications/EventNotificationOption.cpp b/SerialPrograms/Source/CommonFramework/Notifications/EventNotificationOption.cpp index 762edfacb..103cb7f57 100644 --- a/SerialPrograms/Source/CommonFramework/Notifications/EventNotificationOption.cpp +++ b/SerialPrograms/Source/CommonFramework/Notifications/EventNotificationOption.cpp @@ -176,10 +176,10 @@ EventNotificationOption::~EventNotificationOption(){} EventNotificationOption::EventNotificationOption( std::string label, bool enabled, bool ping, - std::chrono::seconds rate_limit + [[maybe_unused]] std::chrono::seconds rate_limit ) : StaticTableRow(label) - , m_data(CONSTRUCT_TOKEN, std::move(label), enabled, ping, rate_limit) + , m_data(CONSTRUCT_TOKEN, std::move(label), enabled, ping, std::chrono::seconds(0)) , m_test_button(*this) { add_option(m_data->m_enabled, "Enabled"); @@ -196,10 +196,10 @@ EventNotificationOption::EventNotificationOption( std::string label, bool enabled, bool ping, std::vector tags, - std::chrono::seconds rate_limit + [[maybe_unused]] std::chrono::seconds rate_limit ) : StaticTableRow(label) - , m_data(CONSTRUCT_TOKEN, std::move(label), enabled, ping, std::move(tags), rate_limit) + , m_data(CONSTRUCT_TOKEN, std::move(label), enabled, ping, std::move(tags), std::chrono::seconds(0)) , m_test_button(*this) { add_option(m_data->m_enabled, "Enabled"); @@ -217,10 +217,10 @@ EventNotificationOption::EventNotificationOption( bool enabled, bool ping, ImageAttachmentMode screenshot, std::vector tags, - std::chrono::seconds rate_limit + [[maybe_unused]] std::chrono::seconds rate_limit ) : StaticTableRow(label) - , m_data(CONSTRUCT_TOKEN, std::move(label), enabled, ping, screenshot, std::move(tags), rate_limit) + , m_data(CONSTRUCT_TOKEN, std::move(label), enabled, ping, screenshot, std::move(tags), std::chrono::seconds(0)) , m_test_button(*this) { add_option(m_data->m_enabled, "Enabled"); diff --git a/SerialPrograms/Source/CommonFramework/Options/LanguageOCROption.cpp b/SerialPrograms/Source/CommonFramework/Options/LanguageOCROption.cpp index e5c01bedb..09cf4b2bd 100644 --- a/SerialPrograms/Source/CommonFramework/Options/LanguageOCROption.cpp +++ b/SerialPrograms/Source/CommonFramework/Options/LanguageOCROption.cpp @@ -51,6 +51,10 @@ LanguageOCRCell::LanguageOCRCell( std::forward_as_tuple(language), std::forward_as_tuple(index) ); + if (language == Language::French){ + m_default = index; + m_current = index; + } index++; } } diff --git a/SerialPrograms/Source/CommonFramework/Options/LanguageOCROption.h b/SerialPrograms/Source/CommonFramework/Options/LanguageOCROption.h index 2fc9b06ca..b50a1deb4 100644 --- a/SerialPrograms/Source/CommonFramework/Options/LanguageOCROption.h +++ b/SerialPrograms/Source/CommonFramework/Options/LanguageOCROption.h @@ -44,7 +44,7 @@ class LanguageOCRCell : public ConfigOption{ std::vector> m_case_list; std::map m_case_map; - const size_t m_default; + size_t m_default; std::atomic m_current; }; diff --git a/SerialPrograms/Source/Integrations/DiscordIntegrationSettings.cpp b/SerialPrograms/Source/Integrations/DiscordIntegrationSettings.cpp index bf61cc047..1ba82ffd0 100644 --- a/SerialPrograms/Source/Integrations/DiscordIntegrationSettings.cpp +++ b/SerialPrograms/Source/Integrations/DiscordIntegrationSettings.cpp @@ -28,12 +28,12 @@ DiscordIntegrationSettingsOption::~DiscordIntegrationSettingsOption(){ this->remove_listener(*this); } DiscordIntegrationSettingsOption::DiscordIntegrationSettingsOption() - : GroupOption("Discord Integration Settings", LockMode::LOCK_WHILE_RUNNING, true, false) + : GroupOption("Discord Integration Settings", LockMode::LOCK_WHILE_RUNNING, true, true) // , m_integration_enabled(integration_enabled) , run_on_start( "Run Discord Integration on Launch:
Automatically connect to Discord as soon as the program is launched.", LockMode::LOCK_WHILE_RUNNING, - false + true ) , library0( "Discord Integration Library:
Restart the program for this to take effect.", @@ -57,7 +57,7 @@ DiscordIntegrationSettingsOption::DiscordIntegrationSettingsOption() true, "Discord Token:
Enter your Discord bot's token. Keep it safe and don't share it with anyone.", LockMode::LOCK_WHILE_RUNNING, - "", "0123456789abcdefghijklmnopqrstuvwxyzABCDEGFHIJKLMNOPQRSTUVWXYZ" + std::getenv("DISCORD_BOT_TOKEN"), "0123456789abcdefghijklmnopqrstuvwxyzABCDEGFHIJKLMNOPQRSTUVWXYZ" ) , command_prefix( false, @@ -107,6 +107,50 @@ DiscordIntegrationSettingsOption::DiscordIntegrationSettingsOption() PA_ADD_OPTION(owner); PA_ADD_OPTION(channels); + { + std::unique_ptr channel = channels.make_row(); + DiscordIntegrationChannel* channel_casted = static_cast(channel.get()); + channel_casted->label.set("Alone#pokemonautomation"); + channel_casted->channel_id.set("907578334119071775"); + channels.insert_row(channels.current_rows(), std::move(channel)); + } + { + std::unique_ptr channel = channels.make_row(); + DiscordIntegrationChannel* channel_casted = static_cast(channel.get()); + channel_casted->label.set("PA#shiny-bot-logs"); + channel_casted->tags_text.set("Showcase"); + channel_casted->allow_commands = false; + channel_casted->channel_id.set("898882421129375835"); + channels.insert_row(channels.current_rows(), std::move(channel)); + } + { + std::unique_ptr channel = channels.make_row(); + DiscordIntegrationChannel* channel_casted = static_cast(channel.get()); + channel_casted->label.set("PA#live-hosting"); + channel_casted->tags_text.set("LiveHost"); + channel_casted->allow_commands = false; + channel_casted->channel_id.set("885388078066307102"); + channels.insert_row(channels.current_rows(), std::move(channel)); + } + { + std::unique_ptr channel = channels.make_row(); + DiscordIntegrationChannel* channel_casted = static_cast(channel.get()); + channel_casted->label.set("SHA#live-hosting"); + channel_casted->tags_text.set("LiveHost"); + channel_casted->allow_commands = false; + channel_casted->channel_id.set("885388760370520114"); + channels.insert_row(channels.current_rows(), std::move(channel)); + } + { + std::unique_ptr channel = channels.make_row(); + DiscordIntegrationChannel* channel_casted = static_cast(channel.get()); + channel_casted->label.set("PA#tera-join-reports"); + channel_casted->tags_text.set("Telemetry"); + channel_casted->allow_commands = false; + channel_casted->channel_id.set("1052784581809545327"); + channels.insert_row(channels.current_rows(), std::move(channel)); + } + DiscordIntegrationSettingsOption::value_changed(); this->add_listener(*this); diff --git a/SerialPrograms/Source/Integrations/DiscordSettingsOption.cpp b/SerialPrograms/Source/Integrations/DiscordSettingsOption.cpp index 113186172..4359e20d9 100644 --- a/SerialPrograms/Source/Integrations/DiscordSettingsOption.cpp +++ b/SerialPrograms/Source/Integrations/DiscordSettingsOption.cpp @@ -32,7 +32,7 @@ DiscordMessageSettingsOption::DiscordMessageSettingsOption() false, "Discord User ID:
Set this to your discord user ID to receive pings. Your ID is a number.", LockMode::LOCK_WHILE_RUNNING, - "", + "282197676982927375", "123456789012345678" ) , message( diff --git a/SerialPrograms/Source/NintendoSwitch/Programs/NintendoSwitch_FastCodeEntry.cpp b/SerialPrograms/Source/NintendoSwitch/Programs/NintendoSwitch_FastCodeEntry.cpp index 7bad1c779..2fbb62867 100644 --- a/SerialPrograms/Source/NintendoSwitch/Programs/NintendoSwitch_FastCodeEntry.cpp +++ b/SerialPrograms/Source/NintendoSwitch/Programs/NintendoSwitch_FastCodeEntry.cpp @@ -32,7 +32,7 @@ FastCodeEntrySettingsOption::FastCodeEntrySettingsOption(LockMode lock_while_pro {KeyboardLayout::AZERTY, "azerty", "AZERTY"}, }, LockMode::LOCK_WHILE_RUNNING, - KeyboardLayout::QWERTY + KeyboardLayout::AZERTY ) , SKIP_PLUS( "Skip the Plus:
Don't press + to finalize the code. Useful for testing.", diff --git a/SerialPrograms/Source/PokemonSV/PokemonSV_Panels.cpp b/SerialPrograms/Source/PokemonSV/PokemonSV_Panels.cpp index 7e934b3a9..73211e241 100644 --- a/SerialPrograms/Source/PokemonSV/PokemonSV_Panels.cpp +++ b/SerialPrograms/Source/PokemonSV/PokemonSV_Panels.cpp @@ -56,6 +56,9 @@ #include "../../Internal/SerialPrograms/NintendoSwitch_TestPrograms.h" #endif +#include "../../../Arduino-Source-Internal/Repository/Internal/SerialPrograms/PokemonSV_TeraCardJoiner.h" +#include "../../../Arduino-Source-Internal/Repository/Internal/SerialPrograms/PokemonSV_TextRaidJoiner.h" + namespace PokemonAutomation{ namespace NintendoSwitch{ namespace PokemonSV{ @@ -110,6 +113,8 @@ std::vector PanelListFactory::make_panels() const{ ret.emplace_back("---- Fast Code Entry ----"); ret.emplace_back(make_multi_switch_program()); ret.emplace_back(make_multi_switch_program()); + ret.emplace_back(make_multi_switch_program()); + ret.emplace_back(make_multi_switch_program()); ret.emplace_back(make_multi_switch_program()); ret.emplace_back("---- Stats Hunting ----"); diff --git a/build.cmd b/build.cmd new file mode 100644 index 000000000..63040e3e8 --- /dev/null +++ b/build.cmd @@ -0,0 +1,9 @@ +pushd %~dp0 +cd SerialPrograms +mkdir bin +cd bin +cmake ..\ -G "Visual Studio 17 2022" -DCMAKE_PREFIX_PATH=C:\Qt\6.5.3\msvc2019_64\ +MSBuild.exe .\SerialPrograms.vcxproj /p:Configuration=RelWithDebInfo /p:Platform=x64 +robocopy ..\..\..\Packages\SerialPrograms\Resources\ Resources\ /s +robocopy ..\..\..\CommandLineTests\ . /s +popd