diff --git a/Source/sys-clk/overlay/src/ui/gui/about_gui.cpp b/Source/sys-clk/overlay/src/ui/gui/about_gui.cpp index 1eabbb23..d28fbcc0 100644 --- a/Source/sys-clk/overlay/src/ui/gui/about_gui.cpp +++ b/Source/sys-clk/overlay/src/ui/gui/about_gui.cpp @@ -13,14 +13,21 @@ * You should have received a copy of the GNU General Public License * along with this program. If not, see . */ + + #include "about_gui.h" #include "../format.h" #include #include #include "cat.h" #include "ult_ext.h" + tsl::elm::ListItem* SpeedoItem = NULL; tsl::elm::ListItem* IddqItem = NULL; +ImageElement* CatImage = NULL; +HideableCategoryHeader* CatHeader = NULL; +HideableCustomDrawer* CatSpacer = NULL; +int lightosClickCount = 0; AboutGui::AboutGui() { @@ -57,9 +64,21 @@ void AboutGui::listUI() new tsl::elm::ListItem("Souldbminer") ); - this->listElement->addItem( - new tsl::elm::ListItem("Lightos_") - ); + // Create special clickable item for Lightos + auto lightosItem = new tsl::elm::ListItem("Lightos_"); + lightosItem->setClickListener([this](u64 keys) -> bool { + if (keys & HidNpadButton_A) { + lightosClickCount++; + if (lightosClickCount >= 10) { + if (CatImage != NULL) CatImage->setVisible(true); + if (CatHeader != NULL) CatHeader->setVisible(true); + if (CatSpacer != NULL) CatSpacer->setVisible(true); + } + return true; + } + return false; + }); + this->listElement->addItem(lightosItem); // ---- Contributors ---- this->listElement->addItem( @@ -172,15 +191,18 @@ void AboutGui::listUI() new tsl::elm::ListItem("MasaGratoR - Status Monitor") ); - this->listElement->addItem( - new tsl::elm::CategoryHeader("Cat") - ); - this->listElement->addItem( - new ImageElement(CAT_DATA, CAT_WIDTH, CAT_HEIGHT) - ); - - this->listElement->addItem(new tsl::elm::CustomDrawer([](tsl::gfx::Renderer*, s32, s32, s32, s32) {}), 75); // add a bit of space + // Create cat elements but hide them initially + CatHeader = new HideableCategoryHeader("Cat"); + CatHeader->setVisible(false); + this->listElement->addItem(CatHeader); + + CatImage = new ImageElement(CAT_DATA, CAT_WIDTH, CAT_HEIGHT); + CatImage->setVisible(false); + this->listElement->addItem(CatImage); + CatSpacer = new HideableCustomDrawer(75); + CatSpacer->setVisible(false); + this->listElement->addItem(CatSpacer); } void AboutGui::update() @@ -199,22 +221,4 @@ void AboutGui::refresh() sprintf(strings[1], "%u/%u/%u", this->context->iddq[HorizonOCSpeedo_CPU], this->context->iddq[HorizonOCSpeedo_GPU], this->context->iddq[HorizonOCSpeedo_SOC]); SpeedoItem->setValue(strings[0]); IddqItem->setValue(strings[1]); -} -/* -## Credits -* **Lightos's Cat** - Cat - -* **Souldbminer** – hoc-clk and loader development -* **Lightos** – loader patches development -* **SciresM** - Atmosphere CFW -* **KazushiMe** – Switch OC Suite -* **hanai3bi (meha)** – Switch OC Suite, EOS, sys-clk-eos -* **NaGaa95** – L4T-OC-kernel -* **B3711 (halop)** – EOS -* **sys-clk team (m4xw, p-sam, nautalis)** – sys-clk -* **b0rd2death** – Ultrahand sys-clk & Status Monitor fork -* **MasaGratoR and ZachyCatGames** - General help -* **MasaGratoR** - Status Monitor & Display Refresh Rate Driver -* **Dom, Samybigio, Arcdelta, Miki, Happy, Flopsider, Winnerboi77, Blaise, Alvise, TDRR, agjeococh and Xenshen** - Testing -* **Samybigio2011** - Italian translations -*/ \ No newline at end of file +} \ No newline at end of file diff --git a/Source/sys-clk/overlay/src/ui/gui/about_gui.h b/Source/sys-clk/overlay/src/ui/gui/about_gui.h index 7d9775c6..54956bcd 100644 --- a/Source/sys-clk/overlay/src/ui/gui/about_gui.h +++ b/Source/sys-clk/overlay/src/ui/gui/about_gui.h @@ -13,6 +13,7 @@ * You should have received a copy of the GNU General Public License * along with this program. If not, see . */ + #pragma once #include "../../ipc.h" #include "base_menu_gui.h" diff --git a/Source/sys-clk/overlay/src/ui/gui/cat.h b/Source/sys-clk/overlay/src/ui/gui/cat.h index af0a817c..0da7ef18 100644 --- a/Source/sys-clk/overlay/src/ui/gui/cat.h +++ b/Source/sys-clk/overlay/src/ui/gui/cat.h @@ -16,9 +16,9 @@ */ // cat.png - 96x128 -const unsigned int CAT_WIDTH = 96; -const unsigned int CAT_HEIGHT = 128; -const unsigned char CAT_DATA[] = { +static const unsigned int CAT_WIDTH = 96; +static const unsigned int CAT_HEIGHT = 128; +static const unsigned char CAT_DATA[] = { 0xE0, 0xE0, 0xDC, 0xFF, 0xE0, 0xE0, 0xDC, 0xFF, 0xE1, 0xE1, 0xDD, 0xFF, 0xE1, 0xE1, 0xDD, 0xFF, 0xE1, 0xE1, 0xDD, 0xFF, 0xE1, 0xE1, 0xDD, 0xFF, 0xE2, 0xE3, 0xDE, 0xFF, 0xE2, 0xE3, 0xDE, 0xFF, 0xE3, 0xE4, 0xDF, 0xFF, diff --git a/Source/sys-clk/overlay/src/ui/gui/ult_ext.h b/Source/sys-clk/overlay/src/ui/gui/ult_ext.h index 6f904b27..6e243bdc 100644 --- a/Source/sys-clk/overlay/src/ui/gui/ult_ext.h +++ b/Source/sys-clk/overlay/src/ui/gui/ult_ext.h @@ -22,12 +22,19 @@ class ImageElement : public tsl::elm::ListItem { private: const uint8_t* imgData; uint32_t imgWidth, imgHeight; + bool visible; public: ImageElement(const uint8_t* data, uint32_t w, uint32_t h) - : tsl::elm::ListItem(""), imgData(data), imgWidth(w), imgHeight(h) {} + : tsl::elm::ListItem(""), imgData(data), imgWidth(w), imgHeight(h), visible(true) {} + + void setVisible(bool v) { + visible = v; + } virtual void draw(tsl::gfx::Renderer *renderer) override { + if (!visible) return; + // Draw image centered horizontally u16 centerX = this->getX() + (this->getWidth() - imgWidth) / 2; renderer->drawBitmap( @@ -39,6 +46,16 @@ public: ); } + virtual void layout(u16 parentX, u16 parentY, u16 parentWidth, u16 parentHeight) override { + if (!visible) { + // Take up no space when hidden + this->setBoundaries(parentX, parentY, 0, 0); + } else { + // Normal layout when visible + tsl::elm::ListItem::layout(parentX, parentY, parentWidth, parentHeight); + } + } + virtual void drawHighlight(tsl::gfx::Renderer *renderer) override { // Do nothing - no highlight } @@ -48,6 +65,62 @@ public: } virtual Element* requestFocus(Element *oldFocus, tsl::FocusDirection direction) override { - return nullptr; // Make it non-focusable so it can't be selected + return nullptr; // Make it non-focusable + } +}; + +class HideableCategoryHeader : public tsl::elm::CategoryHeader { +private: + bool visible; + +public: + HideableCategoryHeader(const std::string& title) + : tsl::elm::CategoryHeader(title), visible(true) {} + + void setVisible(bool v) { + visible = v; + } + + virtual void draw(tsl::gfx::Renderer *renderer) override { + if (!visible) return; + tsl::elm::CategoryHeader::draw(renderer); + } + + virtual void layout(u16 parentX, u16 parentY, u16 parentWidth, u16 parentHeight) override { + if (!visible) { + this->setBoundaries(parentX, parentY, 0, 0); + } else { + tsl::elm::CategoryHeader::layout(parentX, parentY, parentWidth, parentHeight); + } + } +}; + +class HideableCustomDrawer : public tsl::elm::Element { +private: + bool visible; + u32 height; + +public: + HideableCustomDrawer(u32 h) + : Element(), visible(true), height(h) {} + + void setVisible(bool v) { + visible = v; + } + + virtual void draw(tsl::gfx::Renderer *renderer) override { + // Empty drawer - just for spacing + } + + virtual void layout(u16 parentX, u16 parentY, u16 parentWidth, u16 parentHeight) override { + if (!visible) { + this->setBoundaries(parentX, parentY, 0, 0); + } else { + this->setBoundaries(parentX, parentY, parentWidth, height); + } + } + + virtual Element* requestFocus(Element *oldFocus, tsl::FocusDirection direction) override { + return nullptr; } }; \ No newline at end of file