From 97fe08955bb922a0aa97eaac71f49445d9fabdfe Mon Sep 17 00:00:00 2001 From: Alexander Yee Date: Thu, 10 Sep 2026 22:26:47 -0700 Subject: [PATCH 1/4] Make ConsolePanel. Refactor VirtualConsole to use it. --- SerialPrograms/Source/ConsoleInfra/ConsolePanel.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/SerialPrograms/Source/ConsoleInfra/ConsolePanel.h b/SerialPrograms/Source/ConsoleInfra/ConsolePanel.h index 394e614146..c64bd15f69 100644 --- a/SerialPrograms/Source/ConsoleInfra/ConsolePanel.h +++ b/SerialPrograms/Source/ConsoleInfra/ConsolePanel.h @@ -85,8 +85,8 @@ class ConsolePanelWrapper : public Descriptor{ public: virtual std::unique_ptr make_instance( ConsoleSystemSession& system - ) const override{ - if constexpr (std::is_constructible_v){ + ) const override{ + if constexpr (std::is_constructible_v){) return std::make_unique(system); }else{ return std::make_unique(); From 4195404b1ca0182fc022edbb0c661b8786c235cf Mon Sep 17 00:00:00 2001 From: Alexander Yee Date: Thu, 10 Sep 2026 22:37:39 -0700 Subject: [PATCH 2/4] fix --- SerialPrograms/Source/ConsoleInfra/ConsolePanel.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/SerialPrograms/Source/ConsoleInfra/ConsolePanel.h b/SerialPrograms/Source/ConsoleInfra/ConsolePanel.h index c64bd15f69..394e614146 100644 --- a/SerialPrograms/Source/ConsoleInfra/ConsolePanel.h +++ b/SerialPrograms/Source/ConsoleInfra/ConsolePanel.h @@ -85,8 +85,8 @@ class ConsolePanelWrapper : public Descriptor{ public: virtual std::unique_ptr make_instance( ConsoleSystemSession& system - ) const override{ - if constexpr (std::is_constructible_v){) + ) const override{ + if constexpr (std::is_constructible_v){ return std::make_unique(system); }else{ return std::make_unique(); From fcfaf5f257fb6dbadefc7cff412b687de160bcf2 Mon Sep 17 00:00:00 2001 From: Alexander Yee Date: Thu, 10 Sep 2026 23:23:57 -0700 Subject: [PATCH 3/4] Make box draw a ConsolePanel. --- .../Options/NestedBoxDrawOption.cpp | 224 +++++++----------- .../Options/NestedBoxDrawOption.h | 33 ++- .../Source/ConsoleInfra/ConsolePanel.h | 4 +- .../Source/ConsoleInfra/Panels/BoxDraw.cpp | 44 ++++ .../Source/ConsoleInfra/Panels/BoxDraw.h | 36 +++ .../{ => Panels}/VirtualConsole.h | 0 .../NintendoSwitch/DevPrograms/BoxDraw.cpp | 49 ---- .../NintendoSwitch/DevPrograms/BoxDraw.h | 43 ---- .../DevPrograms/WaterfillTemplateMaker.cpp | 37 +-- .../DevPrograms/WaterfillTemplateMaker.h | 13 +- .../NintendoSwitch/NintendoSwitch_Panels.cpp | 6 +- .../NintendoSwitch_SingleSwitchProgram.h | 2 +- SerialPrograms/cmake/SourceFiles.cmake | 7 +- 13 files changed, 211 insertions(+), 287 deletions(-) create mode 100644 SerialPrograms/Source/ConsoleInfra/Panels/BoxDraw.cpp create mode 100644 SerialPrograms/Source/ConsoleInfra/Panels/BoxDraw.h rename SerialPrograms/Source/ConsoleInfra/{ => Panels}/VirtualConsole.h (100%) delete mode 100644 SerialPrograms/Source/NintendoSwitch/DevPrograms/BoxDraw.cpp delete mode 100644 SerialPrograms/Source/NintendoSwitch/DevPrograms/BoxDraw.h diff --git a/SerialPrograms/Source/CommonFramework/Options/NestedBoxDrawOption.cpp b/SerialPrograms/Source/CommonFramework/Options/NestedBoxDrawOption.cpp index 15a7b2f8ce..8bc77c09ee 100644 --- a/SerialPrograms/Source/CommonFramework/Options/NestedBoxDrawOption.cpp +++ b/SerialPrograms/Source/CommonFramework/Options/NestedBoxDrawOption.cpp @@ -4,17 +4,22 @@ * */ -#include "Common/Cpp/Containers/Pimpl.tpp" -#include "Common/Cpp/Concurrency/Mutex.h" #include "CommonFramework/VideoPipeline/VideoOverlayScopes.h" #include "NestedBoxDrawOption.h" namespace PokemonAutomation{ -namespace NintendoSwitch{ -NestedBoxDrawOption::NestedBoxDrawOption(LockMode lock_while_program_is_running) +NestedBoxDrawOption::~NestedBoxDrawOption(){ + m_overlay.remove_hid_listener(*this); + CONTENT_BOX.remove_listener(*this); + INFERENCE_BOX.remove_listener(*this); +} +NestedBoxDrawOption::NestedBoxDrawOption( + LockMode lock_while_program_is_running, + VideoOverlay& overlay +) : BatchOption(lock_while_program_is_running) , INFERENCE_BOX( "Inference Box", @@ -29,157 +34,110 @@ NestedBoxDrawOption::NestedBoxDrawOption(LockMode lock_while_program_is_running) true, {0.1, 0.1, .8, .8} ) + , m_overlay(overlay) + , m_overlay_set(overlay) { PA_ADD_OPTION(INFERENCE_BOX); PA_ADD_OPTION(CONTENT_BOX); -} + INFERENCE_BOX.add_listener(*this); + CONTENT_BOX.add_listener(*this); + overlay.add_hid_listener(*this); +} -class NestedBoxDrawOption::DrawnBox final - : public ConfigOption::Listener - , public VideoDisplayHidListener -{ -public: - ~DrawnBox(){ - detach(); +void NestedBoxDrawOption::on_config_value_changed(void* object){ + if (this->visibility() != ConfigOptionState::ENABLED){ + return; } - DrawnBox( - VideoOverlay& overlay, - BoxOption& content_box, - BoxOption& inference_box - ) - : m_content_box(content_box) - , m_inference_box(inference_box) - , m_overlay(overlay) - , m_overlay_set(overlay) - { - // DrawnBox listens to changes in the config option (X, Y, WIDTH, HEIGHT) - // and mouse events on the video overlay layer. - try{ - m_inference_box.add_listener(*this); - m_content_box.add_listener(*this); - overlay.add_hid_listener(*this); - on_config_value_changed(nullptr); - }catch (...){ - detach(); - throw; - } + + std::lock_guard lg(m_lock); + m_overlay_set.clear(); + double ix = INFERENCE_BOX.X; + double iy = INFERENCE_BOX.Y; + double iw = INFERENCE_BOX.WIDTH; + double ih = INFERENCE_BOX.HEIGHT; + if (CONTENT_BOX.enabled()){ + double cx = CONTENT_BOX.X; + double cy = CONTENT_BOX.Y; + double cw = CONTENT_BOX.WIDTH; + double ch = CONTENT_BOX.HEIGHT; + m_overlay_set.add(COLOR_GREEN, {cx, cy, cw, ch}); + ix *= cw; + iy *= ch; + iw *= cw; + ih *= ch; + ix += cx; + iy += cy; } - virtual void on_config_value_changed(void* object) override{ - { - std::lock_guard lg(m_lock); - m_overlay_set.clear(); - double ix = m_inference_box.X; - double iy = m_inference_box.Y; - double iw = m_inference_box.WIDTH; - double ih = m_inference_box.HEIGHT; - if (m_content_box.enabled()){ - double cx = m_content_box.X; - double cy = m_content_box.Y; - double cw = m_content_box.WIDTH; - double ch = m_content_box.HEIGHT; - m_overlay_set.add(COLOR_GREEN, {cx, cy, cw, ch}); - ix *= cw; - iy *= ch; - iw *= cw; - ih *= ch; - ix += cx; - iy += cy; - } - m_overlay_set.add(COLOR_RED, {ix, iy, iw, ih}); - } -// if (object != &m_inference_box){ -// m_inference_box.on_config_value_changed(object); -// } + m_overlay_set.add(COLOR_RED, {ix, iy, iw, ih}); +} +void NestedBoxDrawOption::on_mouse_press(double x, double y){ + if (this->visibility() != ConfigOptionState::ENABLED){ + return; } - virtual void on_mouse_press(double x, double y) override{ - // m_parent.WIDTH.set(0); - // m_parent.HEIGHT.set(0); - // m_parent.X.set(x); - // m_parent.Y.set(y); - m_mouse_start.emplace(); - m_mouse_start->first = x; - m_mouse_start->second = y; + m_mouse_start.emplace(); + m_mouse_start->first = x; + m_mouse_start->second = y; +} +void NestedBoxDrawOption::on_mouse_release(double x, double y){ + if (this->visibility() != ConfigOptionState::ENABLED){ + return; } - virtual void on_mouse_release(double x, double y) override{ - m_mouse_start.reset(); + m_mouse_start.reset(); +} +void NestedBoxDrawOption::on_mouse_move(double x, double y){ + if (this->visibility() != ConfigOptionState::ENABLED){ + return; } - virtual void on_mouse_move(double x, double y) override{ - if (!m_mouse_start){ - return; - } - - double xl = m_mouse_start->first; - double xh = x; - double yl = m_mouse_start->second; - double yh = y; - - if (m_content_box.enabled()){ - double cx = m_content_box.X; - double cy = m_content_box.Y; - double cw = m_content_box.WIDTH; - double ch = m_content_box.HEIGHT; - - xl = (xl - cx) / cw; - xl = std::max(xl, 0.); - xl = std::min(xl, 1.); - - yl = (yl - cy) / ch; - yl = std::max(yl, 0.); - yl = std::min(yl, 1.); - - xh = (xh - cx) / cw; - xh = std::max(xh, 0.); - xh = std::min(xh, 1.); - - yh = (yh - cy) / ch; - yh = std::max(yh, 0.); - yh = std::min(yh, 1.); - } - - if (xl > xh){ - std::swap(xl, xh); - } - if (yl > yh){ - std::swap(yl, yh); - } - - m_inference_box.X.set(xl); - m_inference_box.Y.set(yl); - m_inference_box.WIDTH.set(xh - xl); - m_inference_box.HEIGHT.set(yh - yl); - // m_parent.update_box_coordinates(); + if (!m_mouse_start){ + return; } -private: - void detach(){ - m_overlay.remove_hid_listener(*this); - m_content_box.remove_listener(*this); - m_inference_box.remove_listener(*this); - } + double xl = m_mouse_start->first; + double xh = x; + double yl = m_mouse_start->second; + double yh = y; -private: - BoxOption& m_content_box; - BoxOption& m_inference_box; - VideoOverlay& m_overlay; - VideoOverlaySet m_overlay_set; - Mutex m_lock; + if (CONTENT_BOX.enabled()){ + double cx = CONTENT_BOX.X; + double cy = CONTENT_BOX.Y; + double cw = CONTENT_BOX.WIDTH; + double ch = CONTENT_BOX.HEIGHT; - std::optional> m_mouse_start; -}; + xl = (xl - cx) / cw; + xl = std::max(xl, 0.); + xl = std::min(xl, 1.); + yl = (yl - cy) / ch; + yl = std::max(yl, 0.); + yl = std::min(yl, 1.); + xh = (xh - cx) / cw; + xh = std::max(xh, 0.); + xh = std::min(xh, 1.); -Pimpl NestedBoxDrawOption::make_session(VideoOverlay& overlay){ - return Pimpl(CONSTRUCT_TOKEN, overlay, CONTENT_BOX, INFERENCE_BOX); -} + yh = (yh - cy) / ch; + yh = std::max(yh, 0.); + yh = std::min(yh, 1.); + } + if (xl > xh){ + std::swap(xl, xh); + } + if (yl > yh){ + std::swap(yl, yh); + } + INFERENCE_BOX.X.set(xl); + INFERENCE_BOX.Y.set(yl); + INFERENCE_BOX.WIDTH.set(xh - xl); + INFERENCE_BOX.HEIGHT.set(yh - yl); } -//template Pimpl::Pimpl(); -template Pimpl::~Pimpl(); + + + } diff --git a/SerialPrograms/Source/CommonFramework/Options/NestedBoxDrawOption.h b/SerialPrograms/Source/CommonFramework/Options/NestedBoxDrawOption.h index ff0696c594..11a84c7974 100644 --- a/SerialPrograms/Source/CommonFramework/Options/NestedBoxDrawOption.h +++ b/SerialPrograms/Source/CommonFramework/Options/NestedBoxDrawOption.h @@ -7,30 +7,43 @@ #ifndef PokemonAutomation_NestedBoxDrawOption_H #define PokemonAutomation_NestedBoxDrawOption_H -#include "Common/Cpp/Containers/Pimpl.h" +#include "Common/Cpp/Concurrency/Mutex.h" #include "CommonFramework/VideoPipeline/VideoOverlay.h" +#include "CommonFramework/VideoPipeline/VideoOverlayScopes.h" #include "BoxOption.h" namespace PokemonAutomation{ -namespace NintendoSwitch{ -class NestedBoxDrawOption : public BatchOption, public ConfigOption::Listener{ -public: - NestedBoxDrawOption(LockMode lock_while_program_is_running); - class DrawnBox; - Pimpl make_session(VideoOverlay& overlay); +class NestedBoxDrawOption + : public BatchOption + , public ConfigOption::Listener + , public VideoDisplayHidListener +{ +public: + ~NestedBoxDrawOption(); + NestedBoxDrawOption( + LockMode lock_while_program_is_running, + VideoOverlay& overlay + ); + virtual void on_config_value_changed(void* object) override; + virtual void on_mouse_press(double x, double y) override; + virtual void on_mouse_release(double x, double y) override; + virtual void on_mouse_move(double x, double y) override; public: BoxOption INFERENCE_BOX; BoxOption CONTENT_BOX; -}; - +private: + VideoOverlay& m_overlay; + Mutex m_lock; + std::optional> m_mouse_start; + VideoOverlaySet m_overlay_set; +}; -} } #endif diff --git a/SerialPrograms/Source/ConsoleInfra/ConsolePanel.h b/SerialPrograms/Source/ConsoleInfra/ConsolePanel.h index 394e614146..958f514851 100644 --- a/SerialPrograms/Source/ConsoleInfra/ConsolePanel.h +++ b/SerialPrograms/Source/ConsoleInfra/ConsolePanel.h @@ -27,7 +27,7 @@ class ConsolePanelDescriptor : public PanelDescriptor{ std::string category, std::string display_name, std::string doc_link, std::string description, - size_t num_controllers, + size_t num_controllers = 1, bool deprecated = false, std::vector required_resources = {} ); @@ -86,7 +86,7 @@ class ConsolePanelWrapper : public Descriptor{ virtual std::unique_ptr make_instance( ConsoleSystemSession& system ) const override{ - if constexpr (std::is_constructible_v){ + if constexpr (std::is_constructible_v){ return std::make_unique(system); }else{ return std::make_unique(); diff --git a/SerialPrograms/Source/ConsoleInfra/Panels/BoxDraw.cpp b/SerialPrograms/Source/ConsoleInfra/Panels/BoxDraw.cpp new file mode 100644 index 0000000000..984d916fbd --- /dev/null +++ b/SerialPrograms/Source/ConsoleInfra/Panels/BoxDraw.cpp @@ -0,0 +1,44 @@ +/* Box Draw + * + * From: https://github.com/PokemonAutomation/ + * + */ + +#include "ConsoleInfra/ConsoleSystemSession.h" +#include "BoxDraw.h" + +//#include +//using std::cout; +//using std::endl; + +namespace PokemonAutomation{ +namespace ConsoleInfra{ + + + +BoxDraw_Descriptor::BoxDraw_Descriptor() + : ConsolePanelDescriptor( + Color(), + "NintendoSwitch:BoxDraw", + "Nintendo Switch", "Box Draw", + "", + "Test box coordinates for development." + ) +{} + + +BoxDraw::BoxDraw(ConsoleSystemSession& system) + : BOX_DRAW(LockMode::UNLOCK_WHILE_RUNNING, system.overlay()) +{ + PA_ADD_OPTION(BOX_DRAW); +} + + + + + + + + +} +} diff --git a/SerialPrograms/Source/ConsoleInfra/Panels/BoxDraw.h b/SerialPrograms/Source/ConsoleInfra/Panels/BoxDraw.h new file mode 100644 index 0000000000..6d8daec2e6 --- /dev/null +++ b/SerialPrograms/Source/ConsoleInfra/Panels/BoxDraw.h @@ -0,0 +1,36 @@ +/* Box Draw + * + * From: https://github.com/PokemonAutomation/ + * + */ + +#ifndef PokemonAutomation_ConsoleInfra_BoxDraw_H +#define PokemonAutomation_ConsoleInfra_BoxDraw_H + +#include "CommonFramework/Options/NestedBoxDrawOption.h" +#include "ConsoleInfra/ConsolePanel.h" + +namespace PokemonAutomation{ +namespace ConsoleInfra{ + + +class BoxDraw_Descriptor : public ConsolePanelDescriptor{ +public: + BoxDraw_Descriptor(); +}; + +class BoxDraw : public ConsolePanelInstance{ +public: + BoxDraw(ConsoleSystemSession& system); + +private: + NestedBoxDrawOption BOX_DRAW; +}; + + + + + +} +} +#endif diff --git a/SerialPrograms/Source/ConsoleInfra/VirtualConsole.h b/SerialPrograms/Source/ConsoleInfra/Panels/VirtualConsole.h similarity index 100% rename from SerialPrograms/Source/ConsoleInfra/VirtualConsole.h rename to SerialPrograms/Source/ConsoleInfra/Panels/VirtualConsole.h diff --git a/SerialPrograms/Source/NintendoSwitch/DevPrograms/BoxDraw.cpp b/SerialPrograms/Source/NintendoSwitch/DevPrograms/BoxDraw.cpp deleted file mode 100644 index 0920185423..0000000000 --- a/SerialPrograms/Source/NintendoSwitch/DevPrograms/BoxDraw.cpp +++ /dev/null @@ -1,49 +0,0 @@ -/* Box Draw - * - * From: https://github.com/PokemonAutomation/ - * - */ - -#include "BoxDraw.h" - -//#include -//using std::cout; -//using std::endl; - -namespace PokemonAutomation{ -namespace NintendoSwitch{ - - - - -BoxDraw_Descriptor::BoxDraw_Descriptor() - : SingleSwitchProgramDescriptor( - "NintendoSwitch:BoxDraw", - "Nintendo Switch", "Box Draw", - "", - "Test box coordinates for development.", - ProgramControllerClass::StandardController_NoRestrictions, - FeedbackType::NONE, - AllowCommandsWhenRunning::ENABLE_COMMANDS - ) -{} - -BoxDraw::BoxDraw() - : BOX_DRAW(LockMode::UNLOCK_WHILE_RUNNING) -{ - PA_ADD_OPTION(BOX_DRAW); -} - - - - -void BoxDraw::program(SingleSwitchProgramEnvironment& env, CancellableScope& scope){ - auto drawn_box = BOX_DRAW.make_session(env.console.overlay()); - scope.wait_until_cancel(); -} - - - - -} -} diff --git a/SerialPrograms/Source/NintendoSwitch/DevPrograms/BoxDraw.h b/SerialPrograms/Source/NintendoSwitch/DevPrograms/BoxDraw.h deleted file mode 100644 index 3e560cf473..0000000000 --- a/SerialPrograms/Source/NintendoSwitch/DevPrograms/BoxDraw.h +++ /dev/null @@ -1,43 +0,0 @@ -/* Box Draw - * - * From: https://github.com/PokemonAutomation/ - * - */ - -#ifndef PokemonAutomation_NintendoSwitch_BoxDraw_H -#define PokemonAutomation_NintendoSwitch_BoxDraw_H - -#include "CommonFramework/Options/NestedBoxDrawOption.h" -#include "NintendoSwitch/NintendoSwitch_SingleSwitchProgram.h" - -namespace PokemonAutomation{ -namespace NintendoSwitch{ - - - - -class BoxDraw_Descriptor : public SingleSwitchProgramDescriptor{ -public: - BoxDraw_Descriptor(); -}; - - -// Draw box on the video stream -class BoxDraw : public SingleSwitchProgramInstance{ -public: - BoxDraw(); - - virtual void start_program_controller_check(ControllerSession& session) override{} - virtual void program(SingleSwitchProgramEnvironment& env, CancellableScope& scope) override; - -private: - NestedBoxDrawOption BOX_DRAW; -}; - - - - - -} -} -#endif diff --git a/SerialPrograms/Source/NintendoSwitch/DevPrograms/WaterfillTemplateMaker.cpp b/SerialPrograms/Source/NintendoSwitch/DevPrograms/WaterfillTemplateMaker.cpp index 79cd0c0649..6f48f11002 100644 --- a/SerialPrograms/Source/NintendoSwitch/DevPrograms/WaterfillTemplateMaker.cpp +++ b/SerialPrograms/Source/NintendoSwitch/DevPrograms/WaterfillTemplateMaker.cpp @@ -9,6 +9,7 @@ #include "CommonFramework/Logging/Logger.h" #include "CommonFramework/VideoPipeline/VideoFeed.h" #include "CommonTools/Images/BinaryImage_FilterRgb32.h" +#include "ConsoleInfra/ConsoleSystemSession.h" #include "WaterfillTemplateMaker.h" //#include @@ -35,51 +36,26 @@ WaterfillTemplateMaker_Descriptor::WaterfillTemplateMaker_Descriptor() -WaterfillTemplateMaker::~WaterfillTemplateMaker(){ - BUTTON.remove_listener(*this); -} -WaterfillTemplateMaker::WaterfillTemplateMaker() - : BUTTON("Make Template:", "Make Template") - , MIN_AREA("Min Area (in pixels):", LockMode::UNLOCK_WHILE_RUNNING, 100) +WaterfillTemplateMaker::WaterfillTemplateMaker(ConsoleInfra::ConsoleSystemSession& system) + : MIN_AREA("Min Area (in pixels):", LockMode::UNLOCK_WHILE_RUNNING, 100) , FILTER_LOWER("Filter (lower):", LockMode::UNLOCK_WHILE_RUNNING, false, 0xff000000, 0xff000000) , FILTER_UPPER("Filter (upper):", LockMode::UNLOCK_WHILE_RUNNING, false, 0xffffffff, 0xffffffff) - , BOX_DRAW(LockMode::UNLOCK_WHILE_RUNNING) + , BOX_DRAW(LockMode::UNLOCK_WHILE_RUNNING, system.overlay()) { - PA_ADD_OPTION(BUTTON); PA_ADD_OPTION(MIN_AREA); PA_ADD_OPTION(FILTER_LOWER); PA_ADD_OPTION(FILTER_UPPER); PA_ADD_OPTION(BOX_DRAW); - BUTTON.add_listener(*this); } void WaterfillTemplateMaker::program(SingleSwitchProgramEnvironment& env, CancellableScope& scope){ - { - std::lock_guard lg(m_lock); - m_stream = &env.console; - } - ScopeExit on_exit([this]{ - std::lock_guard lg(m_lock); - m_stream = nullptr; - }); - auto drawn_box = BOX_DRAW.make_session(env.console.overlay()); - scope.wait_until_cancel(); -} - - -void WaterfillTemplateMaker::on_press(ButtonCell& button){ - using namespace Kernels; using namespace Kernels::Waterfill; - global_logger_tagged().log("Button pressed. Attempting to make template."); - std::lock_guard lg(m_lock); - if (m_stream == nullptr){ - global_logger_tagged().log("Program isn't running.", COLOR_RED); - } + global_logger_tagged().log("Attempting to make template."); - VideoSnapshot screenshot = m_stream->video().snapshot_latest_blocking(); + VideoSnapshot screenshot = env.console.video().snapshot_latest_blocking(); ImageViewRGB32 image; if (BOX_DRAW.CONTENT_BOX.enabled()){ image = extract_box_reference(*screenshot.frame, BOX_DRAW.CONTENT_BOX); @@ -171,7 +147,6 @@ void WaterfillTemplateMaker::on_press(ButtonCell& button){ // filter_by_mask(*largest_object->object., filtered, Color(0), true); #endif - } diff --git a/SerialPrograms/Source/NintendoSwitch/DevPrograms/WaterfillTemplateMaker.h b/SerialPrograms/Source/NintendoSwitch/DevPrograms/WaterfillTemplateMaker.h index 1db4506c9d..1effe17d32 100644 --- a/SerialPrograms/Source/NintendoSwitch/DevPrograms/WaterfillTemplateMaker.h +++ b/SerialPrograms/Source/NintendoSwitch/DevPrograms/WaterfillTemplateMaker.h @@ -7,10 +7,8 @@ #ifndef PokemonAutomation_NintendoSwitch_WaterfillTemplateMaker_H #define PokemonAutomation_NintendoSwitch_WaterfillTemplateMaker_H -#include "Common/Cpp/Concurrency/Mutex.h" #include "Common/Cpp/Options/SimpleIntegerOption.h" #include "Common/Cpp/Options/ColorOption.h" -#include "Common/Cpp/Options/ButtonOption.h" #include "CommonFramework/Options/NestedBoxDrawOption.h" #include "NintendoSwitch/NintendoSwitch_SingleSwitchProgram.h" @@ -26,25 +24,18 @@ class WaterfillTemplateMaker_Descriptor : public SingleSwitchProgramDescriptor{ }; -class WaterfillTemplateMaker : public SingleSwitchProgramInstance, public ButtonListener{ +class WaterfillTemplateMaker : public SingleSwitchProgramInstance{ public: - ~WaterfillTemplateMaker(); - WaterfillTemplateMaker(); + WaterfillTemplateMaker(ConsoleInfra::ConsoleSystemSession& system); virtual void start_program_controller_check(ControllerSession& session) override{} virtual void program(SingleSwitchProgramEnvironment& env, CancellableScope& scope) override; - virtual void on_press(ButtonCell& button) override; - private: - ButtonOption BUTTON; SimpleIntegerOption MIN_AREA; ColorOption FILTER_LOWER; ColorOption FILTER_UPPER; NestedBoxDrawOption BOX_DRAW; - - Mutex m_lock; - VideoStream* m_stream; }; diff --git a/SerialPrograms/Source/NintendoSwitch/NintendoSwitch_Panels.cpp b/SerialPrograms/Source/NintendoSwitch/NintendoSwitch_Panels.cpp index a35340b241..35072b9607 100644 --- a/SerialPrograms/Source/NintendoSwitch/NintendoSwitch_Panels.cpp +++ b/SerialPrograms/Source/NintendoSwitch/NintendoSwitch_Panels.cpp @@ -10,7 +10,8 @@ #include "NintendoSwitch_SettingsPanel.h" -#include "ConsoleInfra/VirtualConsole.h" +#include "ConsoleInfra/Panels/VirtualConsole.h" +#include "ConsoleInfra/Panels/BoxDraw.h" #include "Programs/NintendoSwitch_SwitchViewer.h" #include "Programs/NintendoSwitch_TurboA.h" @@ -22,7 +23,6 @@ #include "Programs/NintendoSwitch_FriendDelete.h" #include "Programs/NintendoSwitch_RecordKeyboardController.h" -#include "DevPrograms/BoxDraw.h" #include "Programs/NintendoSwitch_SnapshotDumper.h" #include "Programs/NintendoSwitch_MenuStabilityTester.h" @@ -74,7 +74,7 @@ std::vector PanelListFactory::make_panels() const{ ret.emplace_back(make_single_switch_program()); ret.emplace_back("---- Testing ----"); - ret.emplace_back(make_single_switch_program()); + ret.emplace_back(ConsoleInfra::make_ConsolePanel()); ret.emplace_back(make_single_switch_program()); if (STATIC_GLOBALS.DEVELOPER_MODE){ diff --git a/SerialPrograms/Source/NintendoSwitch/NintendoSwitch_SingleSwitchProgram.h b/SerialPrograms/Source/NintendoSwitch/NintendoSwitch_SingleSwitchProgram.h index 526d7f8dc6..db55b89c32 100644 --- a/SerialPrograms/Source/NintendoSwitch/NintendoSwitch_SingleSwitchProgram.h +++ b/SerialPrograms/Source/NintendoSwitch/NintendoSwitch_SingleSwitchProgram.h @@ -176,7 +176,7 @@ class SingleSwitchProgramWrapper : public Descriptor{ virtual std::unique_ptr make_instance( SwitchSystemSession& system ) const override{ - if constexpr (std::is_constructible_v){ + if constexpr (std::is_constructible_v){ return std::make_unique(system); }else{ return std::make_unique(); diff --git a/SerialPrograms/cmake/SourceFiles.cmake b/SerialPrograms/cmake/SourceFiles.cmake index 7ef83e4ac5..99fb6c3024 100644 --- a/SerialPrograms/cmake/SourceFiles.cmake +++ b/SerialPrograms/cmake/SourceFiles.cmake @@ -877,8 +877,9 @@ file(GLOB LIBRARY_SOURCES Source/ConsoleInfra/ConsoleSystemOption.h Source/ConsoleInfra/ConsoleSystemSession.cpp Source/ConsoleInfra/ConsoleSystemSession.h - Source/ConsoleInfra/VirtualConsole.cpp - Source/ConsoleInfra/VirtualConsole.h + Source/ConsoleInfra/Panels/BoxDraw.cpp + Source/ConsoleInfra/Panels/BoxDraw.h + Source/ConsoleInfra/Panels/VirtualConsole.h Source/ConsoleInfra/UI/CommandRowWidget.cpp Source/ConsoleInfra/UI/CommandRowWidget.h Source/ConsoleInfra/UI/ConsolePanelWidget.cpp @@ -1171,8 +1172,6 @@ file(GLOB LIBRARY_SOURCES Source/NintendoSwitch/Controllers/SysbotBase/SysbotBase_Descriptor.h Source/NintendoSwitch/Controllers/SysbotBase/SysbotBase_SelectorWidget.cpp Source/NintendoSwitch/Controllers/SysbotBase/SysbotBase_SelectorWidget.h - Source/NintendoSwitch/DevPrograms/BoxDraw.cpp - Source/NintendoSwitch/DevPrograms/BoxDraw.h Source/NintendoSwitch/DevPrograms/JoyconProgram.cpp Source/NintendoSwitch/DevPrograms/JoyconProgram.h Source/NintendoSwitch/DevPrograms/TestDudunsparceFormDetector.cpp From d2d8732e5e6761a12ead3f02649c73020b83b0cc Mon Sep 17 00:00:00 2001 From: Alexander Yee Date: Thu, 10 Sep 2026 23:58:01 -0700 Subject: [PATCH 4/4] comments --- SerialPrograms/Source/ConsoleInfra/ConsolePanel.h | 2 ++ 1 file changed, 2 insertions(+) diff --git a/SerialPrograms/Source/ConsoleInfra/ConsolePanel.h b/SerialPrograms/Source/ConsoleInfra/ConsolePanel.h index 958f514851..195a47dde3 100644 --- a/SerialPrograms/Source/ConsoleInfra/ConsolePanel.h +++ b/SerialPrograms/Source/ConsoleInfra/ConsolePanel.h @@ -2,6 +2,8 @@ * * From: https://github.com/PokemonAutomation/ * + * ConsolePanel is a panel with a console and options. It cannot be run. + * */ #ifndef PokemonAutomation_ConsoleInfra_ConsolePanel_H