diff --git a/flash.toml b/flash.toml index ebfa4ede..06bce2ba 100644 --- a/flash.toml +++ b/flash.toml @@ -7,6 +7,7 @@ name = "Geode" version = "v1.0.0-beta" repository = "https://github.com/geode-sdk/geode" tree = "https://github.com/geode-sdk/geode/tree/main" +icon = "loader/resources/logos/geode-circle.png" [[sources]] name = "Geode" diff --git a/loader/CMakeLists.txt b/loader/CMakeLists.txt index b02159cb..98f35b75 100644 --- a/loader/CMakeLists.txt +++ b/loader/CMakeLists.txt @@ -23,6 +23,7 @@ file(GLOB SOURCES CONFIGURE_DEPENDS src/loader/*.cpp src/main.cpp src/utils/*.cpp + src/ui/*.cpp src/ui/nodes/*.cpp src/ui/internal/*.cpp src/ui/internal/credits/*.cpp diff --git a/loader/include/Geode/loader/ModInfo.hpp b/loader/include/Geode/loader/ModInfo.hpp index 058c42ef..9352866f 100644 --- a/loader/include/Geode/loader/ModInfo.hpp +++ b/loader/include/Geode/loader/ModInfo.hpp @@ -89,7 +89,7 @@ namespace geode { /** * Support info for the mod; this means anything to show ways to * support the mod's development, like donations. Written in Markdown - * (see ) for more info + * (see MDTextArea for more info) */ std::optional supportInfo; /** diff --git a/loader/include/Geode/ui/MDPopup.hpp b/loader/include/Geode/ui/MDPopup.hpp index 26dcb229..9ee55160 100644 --- a/loader/include/Geode/ui/MDPopup.hpp +++ b/loader/include/Geode/ui/MDPopup.hpp @@ -5,7 +5,7 @@ namespace geode { /** - * FLAlertLayer with support for Markdown. See + * FLAlertLayer with support for Markdown. See MDTextArea * for details on what features of MD are supported. */ class MDPopup : diff --git a/loader/include/Geode/ui/MDTextArea.hpp b/loader/include/Geode/ui/MDTextArea.hpp index fdb1b332..f13b4b78 100644 --- a/loader/include/Geode/ui/MDTextArea.hpp +++ b/loader/include/Geode/ui/MDTextArea.hpp @@ -24,6 +24,7 @@ namespace geode { * - Bold & italic * - Horizontal rules * - Lists + * * Note that links also have some special protocols. * Use `user:` or `user:` to link to a GD * account; `level:` to link to a GD level and diff --git a/loader/include/Geode/utils/cocos.hpp b/loader/include/Geode/utils/cocos.hpp index 4769ce6b..c592ebb9 100644 --- a/loader/include/Geode/utils/cocos.hpp +++ b/loader/include/Geode/utils/cocos.hpp @@ -196,12 +196,7 @@ namespace geode { * * @tparam T A type that inherits from CCObject. * - * @example[flash] - * #include - * - * USE_GEODE_NAMESPACE(); - * - * //!flash-snippet-start + * @example * class MyNode : public CCNode { * protected: * // no need to manually call retain or @@ -219,32 +214,15 @@ namespace geode { * return true; * } * }; - * //!flash-snippet-end * - * @example[flash] - * #include - * #include - * - * USE_GEODE_NAMESPACE(); - * - * class ModifyMenuLayer : public MenuLayer { - * bool init() { - * if (!MenuLayer::init()) - * return false; - * - * //!flash-snippet-start - * // Save a child from the current layer into a menu - * Ref menu = static_cast(this->getChildByID("main-menu")); + * @example + * // Save a child from the current layer into a menu + * Ref menu = static_cast(this->getChildByID("main-menu")); * - * // Remove the menu from its parent - * menu->removeFromParent(); + * // Remove the menu from its parent + * menu->removeFromParent(); * - * // Menu will still point to a valid CCMenu as long as the menu variable exist - * //!flash-snippet-end - * - * return true; - * } - * }; + * // Menu will still point to a valid CCMenu as long as the menu variable exist */ template class Ref final { diff --git a/loader/src/hooks/MenuLayer.cpp b/loader/src/hooks/MenuLayer.cpp index 770f6f78..412bada5 100644 --- a/loader/src/hooks/MenuLayer.cpp +++ b/loader/src/hooks/MenuLayer.cpp @@ -9,6 +9,7 @@ #include #include #include +#include #include #include #include @@ -68,14 +69,17 @@ struct CustomMenuLayer : Modify { CircleBaseColor::Green, CircleBaseSize::Medium2 ); + auto geodeBtnSelector = &CustomMenuLayer::onGeode; if (!m_fields->m_geodeButton) { + geodeBtnSelector = &CustomMenuLayer::onMissingTextures; m_fields->m_geodeButton = ButtonSprite::create("!!"); } auto bottomMenu = static_cast(this->getChildByID("bottom-menu")); auto btn = CCMenuItemSpriteExtra::create( - m_fields->m_geodeButton, this, menu_selector(CustomMenuLayer::onGeode) + m_fields->m_geodeButton, this, + static_cast(geodeBtnSelector) ); btn->setID("geode-button"_spr); bottomMenu->addChild(btn); @@ -193,6 +197,64 @@ struct CustomMenuLayer : Modify { } } + void onMissingTextures(CCObject*) { + static bool shownInfoPopup = false; + if (shownInfoPopup) { + return this->onGeode(nullptr); + } + shownInfoPopup = true; + + #ifdef GEODE_IS_DESKTOP + + try { + ghc::filesystem::create_directories(dirs::getGeodeDir() / "update" / "resources"); + } catch(...) {} + + createQuickPopup( + "Missing Textures", + "You appear to be missing textures, and the automatic texture fixer " + "hasn't fixed the issue.\n" + "Download resources.zip from the latest release on GitHub, " + "and unzip its contents into geode/update/resources.\n" + "Afterwards, restart the game.\n" + "You may also continue without installing resources, but be aware that " + "the game will crash.", + "Dismiss", "Open Github", + [](auto, bool btn2) { + if (btn2) { + web::openLinkInBrowser("https://github.com/geode-sdk/geode/releases/latest"); + file::openFolder(dirs::getGeodeDir() / "update" / "resources"); + FLAlertLayer::create( + "Info", + "Opened GitHub in your browser and the destination in " + "your file browser.\n" + "Download resources.zip, " + "and unzip its contents into the destination " + "folder.\n" + "Don't add any new folders to the destination!", + "OK" + )->show(); + } + } + ); + + #else + + // dunno if we can auto-create target directory on mobile, nor if the + // user has access to moving stuff there + + FLAlertLayer::create( + "Missing Textures", + "You appear to be missing textures, and the automatic texture fixer " + "hasn't fixed the issue.\n" + "**Report this bug to the Geode developers**. It is very likely " + "that your game will crash until the issue is resolved.", + "OK" + )->show(); + + #endif + } + void onGeode(CCObject*) { ModListLayer::scene(); }