From 0af95ab766c290f9e4bd22d365f96fbc27757933 Mon Sep 17 00:00:00 2001 From: ConfiG Date: Tue, 12 Sep 2023 15:53:35 +0300 Subject: [PATCH 01/98] add ccGLUseProgram on mac --- bindings/Cocos2d.bro | 1 + 1 file changed, 1 insertion(+) diff --git a/bindings/Cocos2d.bro b/bindings/Cocos2d.bro index fac0c9fe..66f33a2e 100644 --- a/bindings/Cocos2d.bro +++ b/bindings/Cocos2d.bro @@ -1250,6 +1250,7 @@ class cocos2d::extension::CCScrollView { [[link(win)]] class cocos2d { static auto FNTConfigLoadFile(char const*) = mac 0x344f10; + static auto ccGLUseProgram(GLuint) = mac 0x1ae540; static auto ccGLBlendFunc(GLenum, GLenum) = mac 0x1ae560; static auto ccDrawSolidRect(cocos2d::CCPoint, cocos2d::CCPoint, cocos2d::_ccColor4F) = mac 0xecf00; static auto ccGLEnableVertexAttribs(unsigned int) = mac 0x1ae740; From 8f7f9a1146f3971ba333f2330c412c79c2c110bd Mon Sep 17 00:00:00 2001 From: altalk23 <45172705+altalk23@users.noreply.github.com> Date: Tue, 12 Sep 2023 16:26:42 +0300 Subject: [PATCH 02/98] add compileshader --- bindings/Cocos2d.bro | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/bindings/Cocos2d.bro b/bindings/Cocos2d.bro index b26400b2..9217537d 100644 --- a/bindings/Cocos2d.bro +++ b/bindings/Cocos2d.bro @@ -318,7 +318,7 @@ class cocos2d::CCFileUtils : cocos2d::TypeInfo { class cocos2d::CCGLProgram { auto setUniformsForBuiltins() = mac 0x232c70; auto use() = mac 0x231d70; - bool compileShader(unsigned int* shader, unsigned int type, const char* source); + bool compileShader(unsigned int* shader, unsigned int type, const char* source) = mac 0x231a30; } [[link(win)]] @@ -1258,6 +1258,7 @@ class cocos2d { static void ccDrawPoly(cocos2d::CCPoint const*, unsigned int, bool) = mac 0xed0a0; static void ccDrawColor4B(GLubyte, GLubyte, GLubyte, GLubyte) = mac 0xeddd0; static void CCMessageBox(const char* msg, const char* title) = mac 0xbabc0; + static void ccGLUseProgram(GLuint program) = mac 0x1ae540; } [[link(win)]] From 66227141f6409110e3c0c9dc3d51536cbe7edf21 Mon Sep 17 00:00:00 2001 From: altalk23 <45172705+altalk23@users.noreply.github.com> Date: Tue, 12 Sep 2023 16:28:47 +0300 Subject: [PATCH 03/98] remove duplicate useprogram --- bindings/Cocos2d.bro | 1 - 1 file changed, 1 deletion(-) diff --git a/bindings/Cocos2d.bro b/bindings/Cocos2d.bro index d7382460..632ce503 100644 --- a/bindings/Cocos2d.bro +++ b/bindings/Cocos2d.bro @@ -1259,7 +1259,6 @@ class cocos2d { static void ccDrawPoly(cocos2d::CCPoint const*, unsigned int, bool) = mac 0xed0a0; static void ccDrawColor4B(GLubyte, GLubyte, GLubyte, GLubyte) = mac 0xeddd0; static void CCMessageBox(const char* msg, const char* title) = mac 0xbabc0; - static void ccGLUseProgram(GLuint program) = mac 0x1ae540; } [[link(win)]] From ef4764728b4fc858a57db9a9514863ecc2240126 Mon Sep 17 00:00:00 2001 From: altalk23 <45172705+altalk23@users.noreply.github.com> Date: Tue, 12 Sep 2023 18:12:46 +0300 Subject: [PATCH 04/98] change loadinglayer, fix macos spritesheet issue, separate user disabled & problem disabled, fix not enabling a disabled mod that has dependency disabled, --- loader/include/Geode/loader/Mod.hpp | 2 + loader/src/hooks/LoadingLayer.cpp | 151 +++++++++++++------- loader/src/hooks/updateResources.cpp | 15 -- loader/src/loader/LoaderImpl.cpp | 8 +- loader/src/loader/Mod.cpp | 4 + loader/src/loader/ModImpl.cpp | 8 +- loader/src/loader/ModImpl.hpp | 2 + loader/src/ui/internal/list/ModListCell.cpp | 3 +- 8 files changed, 126 insertions(+), 67 deletions(-) delete mode 100644 loader/src/hooks/updateResources.cpp diff --git a/loader/include/Geode/loader/Mod.hpp b/loader/include/Geode/loader/Mod.hpp index bede828d..a51af6b9 100644 --- a/loader/include/Geode/loader/Mod.hpp +++ b/loader/include/Geode/loader/Mod.hpp @@ -406,6 +406,8 @@ namespace geode { bool isLoggingEnabled() const; void setLoggingEnabled(bool enabled); + bool shouldLoad() const; + friend class ModImpl; }; } diff --git a/loader/src/hooks/LoadingLayer.cpp b/loader/src/hooks/LoadingLayer.cpp index b3a24bd0..93e82f07 100644 --- a/loader/src/hooks/LoadingLayer.cpp +++ b/loader/src/hooks/LoadingLayer.cpp @@ -8,68 +8,77 @@ using namespace geode::prelude; struct CustomLoadingLayer : Modify { - CCLabelBMFont* m_loadedModsLabel; - bool m_updatingResources; - - CustomLoadingLayer() : m_loadedModsLabel(nullptr), m_updatingResources(false) {} + CCLabelBMFont* m_smallLabel = nullptr; + int m_geodeLoadStep = 0; void updateLoadedModsLabel() { auto allMods = Loader::get()->getAllMods(); auto count = std::count_if(allMods.begin(), allMods.end(), [&](auto& item) { return item->isEnabled(); }); - auto str = fmt::format("Geode: Loaded {}/{} mods", count, allMods.size()); - m_fields->m_loadedModsLabel->setCString(str.c_str()); + auto totalCount = std::count_if(allMods.begin(), allMods.end(), [&](auto& item) { + return item->shouldLoad(); + }); + auto str = fmt::format("Geode: Loaded {}/{} mods", count, totalCount); + this->setSmallText(str); } + void setSmallText(std::string const& text) { + m_fields->m_smallLabel->setString(text.c_str()); + } + + // hook bool init(bool fromReload) { CCFileUtils::get()->updatePaths(); if (!LoadingLayer::init(fromReload)) return false; - if (fromReload) return true; - auto winSize = CCDirector::sharedDirector()->getWinSize(); - m_fields->m_loadedModsLabel = CCLabelBMFont::create("Geode: Loaded 0/0 mods", "goldFont.fnt"); - m_fields->m_loadedModsLabel->setPosition(winSize.width / 2, 30.f); - m_fields->m_loadedModsLabel->setScale(.45f); - m_fields->m_loadedModsLabel->setID("geode-loaded-info"); - this->addChild(m_fields->m_loadedModsLabel); - this->updateLoadedModsLabel(); - - // fields have unpredictable destructors - this->addChild(EventListenerNode::create( - this, &CustomLoadingLayer::updateResourcesProgress - )); - - // verify loader resources - if (!LoaderImpl::get()->verifyLoaderResources()) { - m_fields->m_updatingResources = true; - this->setUpdateText("Downloading Resources"); - } - else { - LoaderImpl::get()->updateSpecialFiles(); - } + m_fields->m_smallLabel = CCLabelBMFont::create("", "goldFont.fnt"); + m_fields->m_smallLabel->setPosition(winSize.width / 2, 30.f); + m_fields->m_smallLabel->setScale(.45f); + m_fields->m_smallLabel->setID("geode-small-label"); + this->addChild(m_fields->m_smallLabel); return true; } - void setUpdateText(std::string const& text) { - m_textArea->setString(text.c_str()); + void setupLoadingMods() { + if (Loader::get()->getLoadingState() != Loader::LoadingState::Done) { + this->updateLoadedModsLabel(); + this->waitLoadAssets(); + } + else { + this->continueLoadAssets(); + } + } + + void setupLoaderResources() { + // verify loader resources + if (!LoaderImpl::get()->verifyLoaderResources()) { + this->setSmallText("Downloading Loader Resources"); + this->addChild(EventListenerNode::create( + this, &CustomLoadingLayer::updateResourcesProgress + )); + } + else { + this->setSmallText("Loading Loader Resources"); + LoaderImpl::get()->updateSpecialFiles(); + this->continueLoadAssets(); + } } void updateResourcesProgress(ResourceDownloadEvent* event) { std::visit(makeVisitor { [&](UpdateProgress const& progress) { - this->setUpdateText(fmt::format( - "Downloading Resources: {}%", progress.first + this->setSmallText(fmt::format( + "Downloading Loader Resources: {}%", progress.first )); }, [&](UpdateFinished) { - this->setUpdateText("Resources Downloaded"); - m_fields->m_updatingResources = false; - this->loadAssets(); + this->setSmallText("Downloaded Loader Resources"); + this->continueLoadAssets(); }, [&](UpdateFailed const& error) { LoaderImpl::get()->platformMessageBox( @@ -81,24 +90,70 @@ struct CustomLoadingLayer : Modify { "The game will be loaded as normal, but please be aware " "that it is very likely to crash. " ); - this->setUpdateText("Resource Download Failed"); - m_fields->m_updatingResources = false; - this->loadAssets(); + this->setSmallText("Failed Loader Resources"); + this->continueLoadAssets(); } }, event->status); } - void loadAssets() { - if (Loader::get()->getLoadingState() != Loader::LoadingState::Done) { - this->updateLoadedModsLabel(); - Loader::get()->queueInMainThread([this]() { - this->loadAssets(); - }); - return; + void setupModResources() { + log::debug("Loading mod resources"); + this->setSmallText("Loading mod resources"); + Loader::get()->updateResources(true); + this->continueLoadAssets(); + } + + int getCurrentStep() { + return m_fields->m_geodeLoadStep + m_loadStep + 1; + } + + int getTotalStep() { + return 18; + } + + void updateLoadingBar() { + auto length = m_sliderGrooveXPos * this->getCurrentStep() / this->getTotalStep(); + m_sliderBar->setTextureRect({0, 0, length, m_sliderGrooveHeight}); + } + + void waitLoadAssets() { + Loader::get()->queueInMainThread([this]() { + this->loadAssets(); + }); + } + + void continueLoadAssets() { + ++m_fields->m_geodeLoadStep; + Loader::get()->queueInMainThread([this]() { + this->loadAssets(); + }); + } + + bool skipOnRefresh() { + if (m_fromRefresh) { + this->continueLoadAssets(); } - if (m_fields->m_updatingResources) { - return; + return !m_fromRefresh; + } + + // hook + void loadAssets() { + switch (m_fields->m_geodeLoadStep) { + case 0: + if (this->skipOnRefresh()) this->setupLoadingMods(); + break; + case 1: + if (this->skipOnRefresh()) this->setupLoaderResources(); + break; + case 2: + this->setupModResources(); + break; + case 3: + default: + this->setSmallText("Loading game resources"); + LoadingLayer::loadAssets(); + break; } - LoadingLayer::loadAssets(); + this->updateLoadingBar(); } }; diff --git a/loader/src/hooks/updateResources.cpp b/loader/src/hooks/updateResources.cpp deleted file mode 100644 index 85817635..00000000 --- a/loader/src/hooks/updateResources.cpp +++ /dev/null @@ -1,15 +0,0 @@ -#include -#include -#include - -using namespace geode::prelude; - -struct ResourcesUpdate : Modify { - void loadAssets() { - LoadingLayer::loadAssets(); - // this is in case the user refreshes texture quality at runtime - if (m_loadStep == 10) { - Loader::get()->updateResources(true); - } - } -}; diff --git a/loader/src/loader/LoaderImpl.cpp b/loader/src/loader/LoaderImpl.cpp index 197676f5..8b955b53 100644 --- a/loader/src/loader/LoaderImpl.cpp +++ b/loader/src/loader/LoaderImpl.cpp @@ -408,7 +408,7 @@ void Loader::Impl::loadModGraph(Mod* node, bool early) { return; } - if (Mod::get()->getSavedValue("should-load-" + node->getID(), true)) { + if (node->shouldLoad()) { log::debug("Load"); auto res = node->m_impl->loadBinary(); if (!res) { @@ -432,6 +432,10 @@ void Loader::Impl::loadModGraph(Mod* node, bool early) { void Loader::Impl::findProblems() { for (auto const& [id, mod] : m_mods) { + if (!mod->shouldLoad()) { + log::debug("{} is not enabled", id); + continue; + } log::debug(id); log::pushNest(); @@ -492,7 +496,7 @@ void Loader::Impl::findProblems() { Mod* myEpicMod = mod; // clang fix // if the mod is not loaded but there are no problems related to it if (!mod->isEnabled() && - Mod::get()->getSavedValue("should-load-" + mod->getID(), true) && + mod->shouldLoad() && !std::any_of(m_problems.begin(), m_problems.end(), [myEpicMod](auto& item) { return std::holds_alternative(item.cause) && std::get(item.cause).getID() == myEpicMod->getID() || diff --git a/loader/src/loader/Mod.cpp b/loader/src/loader/Mod.cpp index 77b551a4..0408ef10 100644 --- a/loader/src/loader/Mod.cpp +++ b/loader/src/loader/Mod.cpp @@ -245,3 +245,7 @@ void Mod::setLoggingEnabled(bool enabled) { bool Mod::hasSavedValue(std::string const& key) { return this->getSaveContainer().contains(key); } + +bool Mod::shouldLoad() const { + return m_impl->shouldLoad(); +} \ No newline at end of file diff --git a/loader/src/loader/ModImpl.cpp b/loader/src/loader/ModImpl.cpp index 510693d1..43a94026 100644 --- a/loader/src/loader/ModImpl.cpp +++ b/loader/src/loader/ModImpl.cpp @@ -43,7 +43,9 @@ Result<> Mod::Impl::setup() { log::warn("Unable to load data for \"{}\": {}", m_metadata.getID(), loadRes.unwrapErr()); } if (!m_resourcesLoaded) { - LoaderImpl::get()->updateModResources(m_self); + auto searchPathRoot = dirs::getModRuntimeDir() / m_metadata.getID() / "resources"; + CCFileUtils::get()->addSearchPath(searchPathRoot.string().c_str()); + m_resourcesLoaded = true; } @@ -633,6 +635,10 @@ void Mod::Impl::setLoggingEnabled(bool enabled) { m_loggingEnabled = enabled; } +bool Mod::Impl::shouldLoad() const { + return Mod::get()->getSavedValue("should-load-" + m_metadata.getID(), true); +} + static Result getModImplInfo() { std::string err; json::Value json; diff --git a/loader/src/loader/ModImpl.hpp b/loader/src/loader/ModImpl.hpp index c7a82dfe..ff5084d6 100644 --- a/loader/src/loader/ModImpl.hpp +++ b/loader/src/loader/ModImpl.hpp @@ -137,6 +137,8 @@ namespace geode { bool isLoggingEnabled() const; void setLoggingEnabled(bool enabled); + + bool shouldLoad() const; }; class ModImpl : public Mod::Impl { diff --git a/loader/src/ui/internal/list/ModListCell.cpp b/loader/src/ui/internal/list/ModListCell.cpp index 5b883959..b4f1923b 100644 --- a/loader/src/ui/internal/list/ModListCell.cpp +++ b/loader/src/ui/internal/list/ModListCell.cpp @@ -250,9 +250,10 @@ void ModCell::onRestart(CCObject*) { void ModCell::updateState() { bool unresolved = m_mod->hasUnresolvedDependencies(); + bool shouldLoad = m_mod->shouldLoad(); if (m_enableToggle) { m_enableToggle->toggle(m_mod->isEnabled()); - m_enableToggle->setEnabled(!unresolved); + m_enableToggle->setEnabled(!unresolved || shouldLoad); m_enableToggle->m_offButton->setOpacity(unresolved ? 100 : 255); m_enableToggle->m_offButton->setColor(unresolved ? cc3x(155) : cc3x(255)); m_enableToggle->m_onButton->setOpacity(unresolved ? 100 : 255); From cd89ef190901c77cc0db78b39887c4140696f967 Mon Sep 17 00:00:00 2001 From: altalk23 <45172705+altalk23@users.noreply.github.com> Date: Tue, 12 Sep 2023 18:15:17 +0300 Subject: [PATCH 05/98] fix the toggling thing with dependencies --- loader/src/ui/internal/list/ModListCell.cpp | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/loader/src/ui/internal/list/ModListCell.cpp b/loader/src/ui/internal/list/ModListCell.cpp index b4f1923b..766ba83e 100644 --- a/loader/src/ui/internal/list/ModListCell.cpp +++ b/loader/src/ui/internal/list/ModListCell.cpp @@ -251,13 +251,14 @@ void ModCell::onRestart(CCObject*) { void ModCell::updateState() { bool unresolved = m_mod->hasUnresolvedDependencies(); bool shouldLoad = m_mod->shouldLoad(); + auto toggleable = !unresolved || !shouldLoad; if (m_enableToggle) { m_enableToggle->toggle(m_mod->isEnabled()); - m_enableToggle->setEnabled(!unresolved || shouldLoad); - m_enableToggle->m_offButton->setOpacity(unresolved ? 100 : 255); - m_enableToggle->m_offButton->setColor(unresolved ? cc3x(155) : cc3x(255)); - m_enableToggle->m_onButton->setOpacity(unresolved ? 100 : 255); - m_enableToggle->m_onButton->setColor(unresolved ? cc3x(155) : cc3x(255)); + m_enableToggle->setEnabled(toggleable); + m_enableToggle->m_offButton->setOpacity(toggleable ? 100 : 255); + m_enableToggle->m_offButton->setColor(toggleable ? cc3x(155) : cc3x(255)); + m_enableToggle->m_onButton->setOpacity(toggleable ? 100 : 255); + m_enableToggle->m_onButton->setColor(toggleable ? cc3x(155) : cc3x(255)); } bool hasProblems = false; for (auto const& item : Loader::get()->getProblems()) { From e8b6c57c219df84ed30c1fa673124178c6d6a1af Mon Sep 17 00:00:00 2001 From: altalk23 <45172705+altalk23@users.noreply.github.com> Date: Tue, 12 Sep 2023 18:16:03 +0300 Subject: [PATCH 06/98] fix grayed out --- loader/src/ui/internal/list/ModListCell.cpp | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/loader/src/ui/internal/list/ModListCell.cpp b/loader/src/ui/internal/list/ModListCell.cpp index 766ba83e..d98d9218 100644 --- a/loader/src/ui/internal/list/ModListCell.cpp +++ b/loader/src/ui/internal/list/ModListCell.cpp @@ -255,10 +255,10 @@ void ModCell::updateState() { if (m_enableToggle) { m_enableToggle->toggle(m_mod->isEnabled()); m_enableToggle->setEnabled(toggleable); - m_enableToggle->m_offButton->setOpacity(toggleable ? 100 : 255); - m_enableToggle->m_offButton->setColor(toggleable ? cc3x(155) : cc3x(255)); - m_enableToggle->m_onButton->setOpacity(toggleable ? 100 : 255); - m_enableToggle->m_onButton->setColor(toggleable ? cc3x(155) : cc3x(255)); + m_enableToggle->m_offButton->setOpacity(!toggleable ? 100 : 255); + m_enableToggle->m_offButton->setColor(!toggleable ? cc3x(155) : cc3x(255)); + m_enableToggle->m_onButton->setOpacity(!toggleable ? 100 : 255); + m_enableToggle->m_onButton->setColor(!toggleable ? cc3x(155) : cc3x(255)); } bool hasProblems = false; for (auto const& item : Loader::get()->getProblems()) { From 607adc8fd0fa68a4fc8d8eacbe4e1479c9fb4805 Mon Sep 17 00:00:00 2001 From: altalk23 <45172705+altalk23@users.noreply.github.com> Date: Tue, 12 Sep 2023 18:24:31 +0300 Subject: [PATCH 07/98] Fix disabling problem mods from view popup --- loader/src/ui/internal/info/ModInfoPopup.cpp | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/loader/src/ui/internal/info/ModInfoPopup.cpp b/loader/src/ui/internal/info/ModInfoPopup.cpp index ebe9ac9b..4c33f1c3 100644 --- a/loader/src/ui/internal/info/ModInfoPopup.cpp +++ b/loader/src/ui/internal/info/ModInfoPopup.cpp @@ -425,7 +425,7 @@ bool LocalModInfoPopup::init(Mod* mod, ModListLayer* list) { disableBtnSpr, enableBtnSpr, this, menu_selector(LocalModInfoPopup::onEnableMod) ); enableBtn->setPosition(-155.f, 75.f); - enableBtn->toggle(!mod->isEnabled()); + enableBtn->toggle(!mod->shouldLoad()); m_buttonMenu->addChild(enableBtn); if (!mod->supportsDisabling()) { @@ -629,9 +629,9 @@ void LocalModInfoPopup::onEnableMod(CCObject* sender) { } } if (m_layer) { - m_layer->updateAllStates(); + m_layer->reloadList(); } - as(sender)->toggle(m_mod->isEnabled()); + as(sender)->toggle(m_mod->shouldLoad()); } void LocalModInfoPopup::onOpenConfigDir(CCObject*) { @@ -640,7 +640,7 @@ void LocalModInfoPopup::onOpenConfigDir(CCObject*) { void LocalModInfoPopup::onDisablingNotSupported(CCObject* pSender) { FLAlertLayer::create("Unsupported", "Disabling is not supported for this mod.", "OK")->show(); - as(pSender)->toggle(m_mod->isEnabled()); + as(pSender)->toggle(m_mod->shouldLoad()); } void LocalModInfoPopup::onSettings(CCObject*) { From dd806e0532085972facb5ed33450a4e28c791bba Mon Sep 17 00:00:00 2001 From: altalk23 <45172705+altalk23@users.noreply.github.com> Date: Tue, 12 Sep 2023 18:42:17 +0300 Subject: [PATCH 08/98] Make mod info popup top a layout --- loader/src/ui/internal/info/ModInfoPopup.cpp | 60 +++++++++++--------- 1 file changed, 33 insertions(+), 27 deletions(-) diff --git a/loader/src/ui/internal/info/ModInfoPopup.cpp b/loader/src/ui/internal/info/ModInfoPopup.cpp index 4c33f1c3..7b8902ca 100644 --- a/loader/src/ui/internal/info/ModInfoPopup.cpp +++ b/loader/src/ui/internal/info/ModInfoPopup.cpp @@ -49,45 +49,51 @@ bool ModInfoPopup::init(ModMetadata const& metadata, ModListLayer* list) { constexpr float logoSize = 40.f; constexpr float logoOffset = 10.f; - auto nameLabel = CCLabelBMFont::create(metadata.getName().c_str(), "bigFont.fnt"); - nameLabel->setAnchorPoint({ .0f, .5f }); - nameLabel->limitLabelWidth(200.f, .7f, .1f); - m_mainLayer->addChild(nameLabel, 2); + auto topNode = CCNode::create(); + topNode->setContentSize({350.f, 80.f}); + topNode->setLayout( + RowLayout::create() + ->setAxisAlignment(AxisAlignment::Center) + ->setAutoScale(false) + ->setCrossAxisOverflow(true) + ); + m_mainLayer->addChild(topNode); + topNode->setAnchorPoint({.5f, .5f}); + topNode->setPosition(winSize.width / 2, winSize.height / 2 + 115.f); auto logoSpr = this->createLogo({logoSize, logoSize}); - m_mainLayer->addChild(logoSpr); + topNode->addChild(logoSpr); + + auto labelNode = CCNode::create(); + labelNode->setLayout( + ColumnLayout::create() + ->setAxisAlignment(AxisAlignment::Center) + ->setCrossAxisLineAlignment(AxisAlignment::Start) + ->setGap(0.f) + ->setAutoScale(false) + ->setCrossAxisOverflow(true) + ); + labelNode->setContentSize({200.f, 80.f}); + topNode->addChild(labelNode); + + auto nameLabel = CCLabelBMFont::create(metadata.getName().c_str(), "bigFont.fnt"); + nameLabel->limitLabelWidth(200.f, .7f, .1f); + labelNode->addChild(nameLabel, 2); auto developerStr = "by " + metadata.getDeveloper(); auto developerLabel = CCLabelBMFont::create(developerStr.c_str(), "goldFont.fnt"); developerLabel->setScale(.5f); - developerLabel->setAnchorPoint({.0f, .5f}); - m_mainLayer->addChild(developerLabel); - - auto logoTitleWidth = - std::max(nameLabel->getScaledContentSize().width, developerLabel->getScaledContentSize().width) + - logoSize + logoOffset; - - nameLabel->setPosition( - winSize.width / 2 - logoTitleWidth / 2 + logoSize + logoOffset, winSize.height / 2 + 125.f - ); - logoSpr->setPosition( - {winSize.width / 2 - logoTitleWidth / 2 + logoSize / 2, winSize.height / 2 + 115.f} - ); - developerLabel->setPosition( - winSize.width / 2 - logoTitleWidth / 2 + logoSize + logoOffset, winSize.height / 2 + 105.f - ); + labelNode->addChild(developerLabel); auto versionLabel = CCLabelBMFont::create(metadata.getVersion().toString().c_str(), "bigFont.fnt" ); - versionLabel->setAnchorPoint({ .0f, .5f }); versionLabel->setScale(.4f); - versionLabel->setPosition( - nameLabel->getPositionX() + nameLabel->getScaledContentSize().width + 5.f, - winSize.height / 2 + 125.f - ); versionLabel->setColor({0, 255, 0}); - m_mainLayer->addChild(versionLabel); + topNode->addChild(versionLabel); + + labelNode->updateLayout(); + topNode->updateLayout(); this->setTouchEnabled(true); From ac74e056cfb1367989b2bc3c3ed98813dc9bb547 Mon Sep 17 00:00:00 2001 From: altalk23 <45172705+altalk23@users.noreply.github.com> Date: Tue, 12 Sep 2023 18:46:14 +0300 Subject: [PATCH 09/98] fix blue view spacing --- loader/src/ui/internal/list/ModListCell.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/loader/src/ui/internal/list/ModListCell.cpp b/loader/src/ui/internal/list/ModListCell.cpp index d98d9218..95e90386 100644 --- a/loader/src/ui/internal/list/ModListCell.cpp +++ b/loader/src/ui/internal/list/ModListCell.cpp @@ -311,9 +311,6 @@ bool ModCell::init( auto viewSpr = ButtonSprite::create("View", "bigFont.fnt", "GJ_button_01.png", .8f); viewSpr->setScale(.65f); - auto viewBtn = CCMenuItemSpriteExtra::create(viewSpr, this, menu_selector(ModCell::onInfo)); - m_menu->addChild(viewBtn); - if (m_mod->isEnabled()) { auto latestIndexItem = Index::get()->getMajorItem( mod->getMetadata().getID() @@ -335,6 +332,9 @@ bool ModCell::init( } } } + + auto viewBtn = CCMenuItemSpriteExtra::create(viewSpr, this, menu_selector(ModCell::onInfo)); + m_menu->addChild(viewBtn); } this->updateState(); From f64c74a128f49b062b8eedab5bf3b8160e066802 Mon Sep 17 00:00:00 2001 From: altalk23 <45172705+altalk23@users.noreply.github.com> Date: Tue, 12 Sep 2023 19:46:26 +0300 Subject: [PATCH 10/98] Fix nested lists in md --- loader/src/ui/nodes/MDTextArea.cpp | 20 ++++++++++++++++++-- loader/src/ui/nodes/TextRenderer.cpp | 6 +++--- 2 files changed, 21 insertions(+), 5 deletions(-) diff --git a/loader/src/ui/nodes/MDTextArea.cpp b/loader/src/ui/nodes/MDTextArea.cpp index 051d5bcd..c6afcda2 100644 --- a/loader/src/ui/nodes/MDTextArea.cpp +++ b/loader/src/ui/nodes/MDTextArea.cpp @@ -209,6 +209,7 @@ struct MDParser { static float s_codeStart; static size_t s_orderedListNum; static std::vector s_codeSpans; + static bool s_breakListLine; static int parseText(MD_TEXTTYPE type, MD_CHAR const* rawText, MD_SIZE size, void* mdtextarea) { auto textarea = static_cast(mdtextarea); @@ -364,6 +365,10 @@ struct MDParser { renderer->pushIndent(g_indent); s_isOrderedList = type == MD_BLOCKTYPE::MD_BLOCK_OL; s_orderedListNum = 0; + if (s_breakListLine) { + renderer->breakLine(); + s_breakListLine = false; + } } break; @@ -377,6 +382,10 @@ struct MDParser { case MD_BLOCKTYPE::MD_BLOCK_LI: { + if (s_breakListLine) { + renderer->breakLine(); + s_breakListLine = false; + } renderer->pushOpacity(renderer->getCurrentOpacity() / 2); auto lidetail = static_cast(detail); if (s_isOrderedList) { @@ -387,6 +396,7 @@ struct MDParser { renderer->renderString("• "); } renderer->popOpacity(); + s_breakListLine = true; } break; @@ -446,7 +456,13 @@ struct MDParser { case MD_BLOCKTYPE::MD_BLOCK_UL: { renderer->popIndent(); - renderer->breakLine(); + if (s_breakListLine) { + renderer->breakLine(); + s_breakListLine = false; + } + if (renderer->getCurrentIndent() == 0) { + renderer->breakLine(); + } } break; @@ -489,7 +505,6 @@ struct MDParser { case MD_BLOCKTYPE::MD_BLOCK_LI: { - renderer->breakLine(); } break; @@ -626,6 +641,7 @@ size_t MDParser::s_orderedListNum = 0; bool MDParser::s_isCodeBlock = false; float MDParser::s_codeStart = 0; decltype(MDParser::s_codeSpans) MDParser::s_codeSpans = {}; +bool MDParser::s_breakListLine = false; void MDTextArea::updateLabel() { m_renderer->begin(m_content, CCPointZero, m_size); diff --git a/loader/src/ui/nodes/TextRenderer.cpp b/loader/src/ui/nodes/TextRenderer.cpp index fe2c712d..ca7396b3 100644 --- a/loader/src/ui/nodes/TextRenderer.cpp +++ b/loader/src/ui/nodes/TextRenderer.cpp @@ -341,8 +341,8 @@ std::vector TextRenderer::renderStringEx( auto lastIndent = m_indentationStack.size() > 1 ? m_indentationStack.at(m_indentationStack.size() - 1) : .0f; - if (m_cursor.x == m_origin.x + lastIndent && this->getCurrentIndent() > .0f) { - m_cursor.x += this->getCurrentIndent(); + if (m_cursor.x < m_origin.x + this->getCurrentIndent()) { + m_cursor.x = this->getCurrentIndent(); } auto createLabel = [&]() -> bool { @@ -487,7 +487,7 @@ void TextRenderer::breakLine(float incY) { } if (h > y) y = h; m_cursor.y -= y; - m_cursor.x = m_origin.x + getCurrentIndent(); + m_cursor.x = m_origin.x; } float TextRenderer::adjustLineAlignment() { From 71a79ab4dd59b419ada7516036e98296d47a96e3 Mon Sep 17 00:00:00 2001 From: altalk23 <45172705+altalk23@users.noreply.github.com> Date: Tue, 12 Sep 2023 21:07:53 +0300 Subject: [PATCH 11/98] add GEODE_HIDDEN to _spr --- loader/include/Geode/loader/Mod.hpp | 2 +- loader/src/loader/ModImpl.cpp | 6 +++--- loader/src/loader/ModImpl.hpp | 2 ++ 3 files changed, 6 insertions(+), 4 deletions(-) diff --git a/loader/include/Geode/loader/Mod.hpp b/loader/include/Geode/loader/Mod.hpp index a51af6b9..01f9380a 100644 --- a/loader/include/Geode/loader/Mod.hpp +++ b/loader/include/Geode/loader/Mod.hpp @@ -412,6 +412,6 @@ namespace geode { }; } -inline char const* operator"" _spr(char const* str, size_t) { +GEODE_HIDDEN inline char const* operator"" _spr(char const* str, size_t) { return geode::Mod::get()->expandSpriteName(str); } diff --git a/loader/src/loader/ModImpl.cpp b/loader/src/loader/ModImpl.cpp index 43a94026..1f2a8573 100644 --- a/loader/src/loader/ModImpl.cpp +++ b/loader/src/loader/ModImpl.cpp @@ -592,14 +592,14 @@ ghc::filesystem::path Mod::Impl::getConfigDir(bool create) const { } char const* Mod::Impl::expandSpriteName(char const* name) { - static std::unordered_map expanded = {}; - if (expanded.count(name)) return expanded[name]; + log::debug("Expanding sprite name {} for {}", name, m_metadata.getID()); + if (m_expandedSprites.count(name)) return m_expandedSprites[name]; auto exp = new char[strlen(name) + 2 + m_metadata.getID().size()]; auto exps = m_metadata.getID() + "/" + name; memcpy(exp, exps.c_str(), exps.size() + 1); - expanded[name] = exp; + m_expandedSprites[name] = exp; return exp; } diff --git a/loader/src/loader/ModImpl.hpp b/loader/src/loader/ModImpl.hpp index ff5084d6..55e5c88d 100644 --- a/loader/src/loader/ModImpl.hpp +++ b/loader/src/loader/ModImpl.hpp @@ -61,6 +61,8 @@ namespace geode { */ bool m_loggingEnabled = true; + std::unordered_map m_expandedSprites; + ModRequestedAction m_requestedAction = ModRequestedAction::None; From 26a6c7e96d2df0c80656932b0a7c994239a9ca1d Mon Sep 17 00:00:00 2001 From: altalk23 <45172705+altalk23@users.noreply.github.com> Date: Tue, 12 Sep 2023 22:11:16 +0300 Subject: [PATCH 12/98] fix too big mod icons :fire: --- loader/src/ui/internal/GeodeUI.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/loader/src/ui/internal/GeodeUI.cpp b/loader/src/ui/internal/GeodeUI.cpp index 5bc6705a..99d936b2 100644 --- a/loader/src/ui/internal/GeodeUI.cpp +++ b/loader/src/ui/internal/GeodeUI.cpp @@ -68,7 +68,7 @@ CCNode* geode::createDefaultLogo(CCSize const& size) { if (!spr) { spr = CCLabelBMFont::create("OwO", "goldFont.fnt"); } - limitNodeSize(spr, size, 1.f, .1f); + limitNodeSize(spr, size, 1.f, .01f); return spr; } @@ -78,7 +78,7 @@ CCNode* geode::createModLogo(Mod* mod, CCSize const& size) { CCSprite::create(fmt::format("{}/logo.png", mod->getID()).c_str()); if (!spr) spr = CCSprite::createWithSpriteFrameName("no-logo.png"_spr); if (!spr) spr = CCLabelBMFont::create("N/A", "goldFont.fnt"); - limitNodeSize(spr, size, 1.f, .1f); + limitNodeSize(spr, size, 1.f, .01f); spr->setPosition(size/2); spr->setAnchorPoint({.5f, .5f}); @@ -116,7 +116,7 @@ CCNode* geode::createIndexItemLogo(IndexItemHandle item, CCSize const& size) { spr = logoGlow; } else { - limitNodeSize(spr, size, 1.f, .1f); + limitNodeSize(spr, size, 1.f, .01f); } spr->setPosition(size/2); spr->setAnchorPoint({.5f, .5f}); From 93482eb7c2c0f82718c4ea918f8e1189964a62e6 Mon Sep 17 00:00:00 2001 From: altalk23 <45172705+altalk23@users.noreply.github.com> Date: Thu, 14 Sep 2023 14:05:23 +0300 Subject: [PATCH 13/98] ninx was lazy to make a pr --- bindings/GeometryDash.bro | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/bindings/GeometryDash.bro b/bindings/GeometryDash.bro index ab336f38..d67e0028 100644 --- a/bindings/GeometryDash.bro +++ b/bindings/GeometryDash.bro @@ -4320,7 +4320,7 @@ class MoreOptionsLayer : FLAlertLayer, TextInputDelegate, GooglePlayDelegate { static MoreOptionsLayer* create() = win 0x1de850; virtual bool init() = mac 0x43f470, win 0x1DE8F0; void addToggle(const char* name, const char* key, const char* info) = mac 0x440430, win 0x1df6b0; - void onKeybindings(cocos2d::CCObject* sender) = win 0x749d0; + void onKeybindings(cocos2d::CCObject* sender) = mac 0x4410e0, win 0x749d0; void onToggle(cocos2d::CCObject* sender) = mac 0x441370; } From 21866a033a1a9e8ace36403baa6e62285e1272a0 Mon Sep 17 00:00:00 2001 From: ConfiG Date: Thu, 14 Sep 2023 17:38:31 +0300 Subject: [PATCH 14/98] improve utils::file::read* error checking --- loader/src/utils/file.cpp | 71 ++++++++++++++++++++------------------- 1 file changed, 37 insertions(+), 34 deletions(-) diff --git a/loader/src/utils/file.cpp b/loader/src/utils/file.cpp index 8df76c0d..1f8a7ad6 100644 --- a/loader/src/utils/file.cpp +++ b/loader/src/utils/file.cpp @@ -21,48 +21,51 @@ using namespace geode::prelude; using namespace geode::utils::file; Result utils::file::readString(ghc::filesystem::path const& path) { + if (!ghc::filesystem::exists(path)) + return Err("File does not exist"); + #if _WIN32 std::ifstream in(path.wstring(), std::ios::in | std::ios::binary); #else std::ifstream in(path.string(), std::ios::in | std::ios::binary); #endif - if (in) { - std::string contents; - in.seekg(0, std::ios::end); - contents.resize((const size_t)in.tellg()); - in.seekg(0, std::ios::beg); - in.read(&contents[0], contents.size()); - in.close(); - return Ok(contents); - } - return Err("Unable to open file"); + if (!in) + return Err("Unable to open file"); + + std::string contents; + in.seekg(0, std::ios::end); + contents.resize((const size_t)in.tellg()); + in.seekg(0, std::ios::beg); + in.read(&contents[0], contents.size()); + in.close(); + return Ok(contents); } Result utils::file::readJson(ghc::filesystem::path const& path) { - auto str = utils::file::readString(path); - - if (str) { - try { - return Ok(json::parse(str.value())); - } catch(std::exception const& e) { - return Err("Unable to parse JSON: " + std::string(e.what())); - } - } else { - return Err("Unable to open file"); + if (!str) + return Err(str.unwrapErr()); + try { + return Ok(json::parse(str.value())); + } + catch(std::exception const& e) { + return Err("Unable to parse JSON: " + std::string(e.what())); } } Result utils::file::readBinary(ghc::filesystem::path const& path) { + if (!ghc::filesystem::exists(path)) + return Err("File does not exist"); + #if _WIN32 std::ifstream in(path.wstring(), std::ios::in | std::ios::binary); #else std::ifstream in(path.string(), std::ios::in | std::ios::binary); #endif - if (in) { - return Ok(ByteVector(std::istreambuf_iterator(in), {})); - } - return Err("Unable to open file"); + if (!in) + return Err("Unable to open file"); + + return Ok(ByteVector(std::istreambuf_iterator(in), {})); } Result<> utils::file::writeString(ghc::filesystem::path const& path, std::string const& data) { @@ -72,14 +75,14 @@ Result<> utils::file::writeString(ghc::filesystem::path const& path, std::string #else file.open(path.string()); #endif - if (file.is_open()) { - file << data; + if (!file.is_open()) { file.close(); - - return Ok(); + return Err("Unable to open file"); } + + file << data; file.close(); - return Err("Unable to open file"); + return Ok(); } Result<> utils::file::writeBinary(ghc::filesystem::path const& path, ByteVector const& data) { @@ -89,14 +92,14 @@ Result<> utils::file::writeBinary(ghc::filesystem::path const& path, ByteVector #else file.open(path.string(), std::ios::out | std::ios::binary); #endif - if (file.is_open()) { - file.write(reinterpret_cast(data.data()), data.size()); + if (!file.is_open()) { file.close(); - - return Ok(); + return Err("Unable to open file"); } + + file.write(reinterpret_cast(data.data()), data.size()); file.close(); - return Err("Unable to open file"); + return Ok(); } Result<> utils::file::createDirectory(ghc::filesystem::path const& path) { From 9a28e58639db72526b7e50d684b52ae31333fc6d Mon Sep 17 00:00:00 2001 From: altalk23 <45172705+altalk23@users.noreply.github.com> Date: Tue, 12 Sep 2023 21:07:53 +0300 Subject: [PATCH 15/98] add GEODE_HIDDEN to _spr --- loader/include/Geode/loader/Mod.hpp | 2 +- loader/src/loader/ModImpl.cpp | 5 ++--- loader/src/loader/ModImpl.hpp | 7 +++++++ 3 files changed, 10 insertions(+), 4 deletions(-) diff --git a/loader/include/Geode/loader/Mod.hpp b/loader/include/Geode/loader/Mod.hpp index bdc57981..0cf2ed64 100644 --- a/loader/include/Geode/loader/Mod.hpp +++ b/loader/include/Geode/loader/Mod.hpp @@ -398,6 +398,6 @@ namespace geode { }; } -inline char const* operator"" _spr(char const* str, size_t) { +GEODE_HIDDEN inline char const* operator"" _spr(char const* str, size_t) { return geode::Mod::get()->expandSpriteName(str); } diff --git a/loader/src/loader/ModImpl.cpp b/loader/src/loader/ModImpl.cpp index dcb8e662..6ffacdc0 100644 --- a/loader/src/loader/ModImpl.cpp +++ b/loader/src/loader/ModImpl.cpp @@ -572,14 +572,13 @@ ghc::filesystem::path Mod::Impl::getConfigDir(bool create) const { } char const* Mod::Impl::expandSpriteName(char const* name) { - static std::unordered_map expanded = {}; - if (expanded.count(name)) return expanded[name]; + if (m_expandedSprites.count(name)) return m_expandedSprites[name]; auto exp = new char[strlen(name) + 2 + m_metadata.getID().size()]; auto exps = m_metadata.getID() + "/" + name; memcpy(exp, exps.c_str(), exps.size() + 1); - expanded[name] = exp; + m_expandedSprites[name] = exp; return exp; } diff --git a/loader/src/loader/ModImpl.hpp b/loader/src/loader/ModImpl.hpp index 7e983d09..a8bdc09f 100644 --- a/loader/src/loader/ModImpl.hpp +++ b/loader/src/loader/ModImpl.hpp @@ -57,6 +57,13 @@ namespace geode { * Whether the mod resources are loaded or not */ bool m_resourcesLoaded = false; + /** + * Whether logging is enabled for this mod + */ + bool m_loggingEnabled = true; + + std::unordered_map m_expandedSprites; + ModRequestedAction m_requestedAction = ModRequestedAction::None; From a571fbbcaee0e8ffb4b5ad19c2073698c94908f4 Mon Sep 17 00:00:00 2001 From: altalk23 <45172705+altalk23@users.noreply.github.com> Date: Thu, 14 Sep 2023 18:13:12 +0300 Subject: [PATCH 16/98] Macos updateModifierKeys --- bindings/Cocos2d.bro | 1 + 1 file changed, 1 insertion(+) diff --git a/bindings/Cocos2d.bro b/bindings/Cocos2d.bro index 632ce503..4d1d2dab 100644 --- a/bindings/Cocos2d.bro +++ b/bindings/Cocos2d.bro @@ -360,6 +360,7 @@ class cocos2d::CCImage { class cocos2d::CCKeyboardDispatcher { bool dispatchKeyboardMSG(cocos2d::enumKeyCodes, bool) = mac 0xe8190; const char* keyToString(cocos2d::enumKeyCodes) = mac 0xe8450; + void updateModifierKeys(bool shft, bool ctrl, bool alt, bool cmd) = mac 0xe8430; } [[link(win)]] From 372ea0e78c49527396f642b04449dea424820905 Mon Sep 17 00:00:00 2001 From: altalk23 <45172705+altalk23@users.noreply.github.com> Date: Fri, 15 Sep 2023 08:17:40 +0300 Subject: [PATCH 17/98] remove the expand sprite log --- codegen/src/SourceGen.cpp | 2 +- loader/src/loader/ModImpl.cpp | 1 - 2 files changed, 1 insertion(+), 2 deletions(-) diff --git a/codegen/src/SourceGen.cpp b/codegen/src/SourceGen.cpp index 35f58962..26a911a1 100644 --- a/codegen/src/SourceGen.cpp +++ b/codegen/src/SourceGen.cpp @@ -198,7 +198,7 @@ std::string generateBindingSource(Root const& root) { ) { used_declare_format = format_strings::declare_virtual_error; } - else if (codegen::getStatus(f) != BindStatus::NeedsBinding) { + else if (codegen::getStatus(f) != BindStatus::NeedsBinding && !android_has_boobs(f)) { continue; } diff --git a/loader/src/loader/ModImpl.cpp b/loader/src/loader/ModImpl.cpp index 1f2a8573..bc21fc9f 100644 --- a/loader/src/loader/ModImpl.cpp +++ b/loader/src/loader/ModImpl.cpp @@ -592,7 +592,6 @@ ghc::filesystem::path Mod::Impl::getConfigDir(bool create) const { } char const* Mod::Impl::expandSpriteName(char const* name) { - log::debug("Expanding sprite name {} for {}", name, m_metadata.getID()); if (m_expandedSprites.count(name)) return m_expandedSprites[name]; auto exp = new char[strlen(name) + 2 + m_metadata.getID().size()]; From 3b359726f86e943e74cfc8e269ebe815e67b7686 Mon Sep 17 00:00:00 2001 From: altalk23 <45172705+altalk23@users.noreply.github.com> Date: Fri, 15 Sep 2023 08:20:18 +0300 Subject: [PATCH 18/98] Remove the thing that was left when i was explaining to mat what to edit on the codegen to support android --- codegen/src/SourceGen.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/codegen/src/SourceGen.cpp b/codegen/src/SourceGen.cpp index 26a911a1..35f58962 100644 --- a/codegen/src/SourceGen.cpp +++ b/codegen/src/SourceGen.cpp @@ -198,7 +198,7 @@ std::string generateBindingSource(Root const& root) { ) { used_declare_format = format_strings::declare_virtual_error; } - else if (codegen::getStatus(f) != BindStatus::NeedsBinding && !android_has_boobs(f)) { + else if (codegen::getStatus(f) != BindStatus::NeedsBinding) { continue; } From 889bb77e6d95321a2f9bba1b09a41ae048748bf7 Mon Sep 17 00:00:00 2001 From: altalk23 <45172705+altalk23@users.noreply.github.com> Date: Fri, 15 Sep 2023 14:08:38 +0300 Subject: [PATCH 19/98] make cc_dll attribute hidden on mac --- .../Geode/cocos/platform/android/CCPlatformDefine.h | 8 ++------ .../include/Geode/cocos/platform/ios/CCPlatformDefine.h | 8 ++------ .../include/Geode/cocos/platform/mac/CCPlatformDefine.h | 8 ++------ 3 files changed, 6 insertions(+), 18 deletions(-) diff --git a/loader/include/Geode/cocos/platform/android/CCPlatformDefine.h b/loader/include/Geode/cocos/platform/android/CCPlatformDefine.h index 93fe1c46..3f9a88d1 100644 --- a/loader/include/Geode/cocos/platform/android/CCPlatformDefine.h +++ b/loader/include/Geode/cocos/platform/android/CCPlatformDefine.h @@ -3,12 +3,8 @@ #include -#ifdef GEODE_EXPORTING - #define CC_DLL __attribute__((visibility("default"))) -#else - #define CC_DLL -#endif -#define ACTUAL_CC_DLL CC_DLL +#define CC_DLL +#define ACTUAL_CC_DLL #define CC_NO_MESSAGE_PSEUDOASSERT(cond) \ if (!(cond)) { \ diff --git a/loader/include/Geode/cocos/platform/ios/CCPlatformDefine.h b/loader/include/Geode/cocos/platform/ios/CCPlatformDefine.h index 74bc5d07..4ebf2830 100644 --- a/loader/include/Geode/cocos/platform/ios/CCPlatformDefine.h +++ b/loader/include/Geode/cocos/platform/ios/CCPlatformDefine.h @@ -3,12 +3,8 @@ #include -#ifdef GEODE_EXPORTING - #define CC_DLL __attribute__((visibility("default"))) -#else - #define CC_DLL -#endif -#define ACTUAL_CC_DLL CC_DLL +#define CC_DLL __attribute__((visibility("hidden"))) +#define ACTUAL_CC_DLL #define CC_ASSERT(cond) assert(cond) diff --git a/loader/include/Geode/cocos/platform/mac/CCPlatformDefine.h b/loader/include/Geode/cocos/platform/mac/CCPlatformDefine.h index e542eecb..0b2e2623 100644 --- a/loader/include/Geode/cocos/platform/mac/CCPlatformDefine.h +++ b/loader/include/Geode/cocos/platform/mac/CCPlatformDefine.h @@ -3,12 +3,8 @@ #include -#ifdef GEODE_EXPORTING - #define CC_DLL __attribute__((visibility("default"))) -#else - #define CC_DLL -#endif -#define ACTUAL_CC_DLL CC_DLL +#define CC_DLL __attribute__((visibility("hidden"))) +#define ACTUAL_CC_DLL #if CC_DISABLE_ASSERT > 0 From 7cc534aaf90ff34e052b18745824e019e2c729f7 Mon Sep 17 00:00:00 2001 From: altalk23 <45172705+altalk23@users.noreply.github.com> Date: Fri, 15 Sep 2023 14:16:45 +0300 Subject: [PATCH 20/98] add geodehidden to gd classes for macos --- codegen/src/BindingGen.cpp | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/codegen/src/BindingGen.cpp b/codegen/src/BindingGen.cpp index eb4359c3..6969f4a6 100644 --- a/codegen/src/BindingGen.cpp +++ b/codegen/src/BindingGen.cpp @@ -29,7 +29,7 @@ namespace { namespace format_strings { )GEN"; char const* class_start = R"GEN( -class {class_name}{base_classes} {{ +class {hidden}{class_name}{base_classes} {{ public: static constexpr auto CLASS_NAME = "{class_name}"; )GEN"; @@ -185,7 +185,8 @@ std::string generateBindingHeader(Root const& root, ghc::filesystem::path const& single_output += fmt::format(::format_strings::class_start, fmt::arg("class_name", cls.name), - fmt::arg("base_classes", supers) + fmt::arg("base_classes", supers), + fmt::arg("hidden", str_if("GEODE_HIDDEN ", (codegen::platform & (Platform::Mac | Platform::iOS)) != Platform::None)) ); // what. From a6a47bf6cff23c64f44adb6b1e9f164035efccbc Mon Sep 17 00:00:00 2001 From: altalk23 <45172705+altalk23@users.noreply.github.com> Date: Sat, 16 Sep 2023 09:48:48 +0300 Subject: [PATCH 21/98] Fix #239 and revert GEODE_HIDDENs --- codegen/src/BindingGen.cpp | 6 +++--- .../cocos/platform/ios/CCPlatformDefine.h | 2 +- .../cocos/platform/mac/CCPlatformDefine.h | 2 +- .../src/ui/internal/info/DevProfilePopup.cpp | 17 ++++++++------- .../src/ui/internal/info/DevProfilePopup.hpp | 10 ++++++--- .../src/ui/internal/list/InstallListCell.cpp | 21 ++++++++----------- .../src/ui/internal/list/InstallListCell.hpp | 2 +- loader/src/ui/internal/list/ModListCell.cpp | 6 ++++-- 8 files changed, 35 insertions(+), 31 deletions(-) diff --git a/codegen/src/BindingGen.cpp b/codegen/src/BindingGen.cpp index 6969f4a6..199e2555 100644 --- a/codegen/src/BindingGen.cpp +++ b/codegen/src/BindingGen.cpp @@ -29,7 +29,7 @@ namespace { namespace format_strings { )GEN"; char const* class_start = R"GEN( -class {hidden}{class_name}{base_classes} {{ +class {class_name}{base_classes} {{ public: static constexpr auto CLASS_NAME = "{class_name}"; )GEN"; @@ -185,8 +185,8 @@ std::string generateBindingHeader(Root const& root, ghc::filesystem::path const& single_output += fmt::format(::format_strings::class_start, fmt::arg("class_name", cls.name), - fmt::arg("base_classes", supers), - fmt::arg("hidden", str_if("GEODE_HIDDEN ", (codegen::platform & (Platform::Mac | Platform::iOS)) != Platform::None)) + fmt::arg("base_classes", supers)//, + // fmt::arg("hidden", str_if("GEODE_HIDDEN ", (codegen::platform & (Platform::Mac | Platform::iOS)) != Platform::None)) ); // what. diff --git a/loader/include/Geode/cocos/platform/ios/CCPlatformDefine.h b/loader/include/Geode/cocos/platform/ios/CCPlatformDefine.h index 4ebf2830..df4e4242 100644 --- a/loader/include/Geode/cocos/platform/ios/CCPlatformDefine.h +++ b/loader/include/Geode/cocos/platform/ios/CCPlatformDefine.h @@ -3,7 +3,7 @@ #include -#define CC_DLL __attribute__((visibility("hidden"))) +#define CC_DLL //__attribute__((visibility("hidden"))) #define ACTUAL_CC_DLL #define CC_ASSERT(cond) assert(cond) diff --git a/loader/include/Geode/cocos/platform/mac/CCPlatformDefine.h b/loader/include/Geode/cocos/platform/mac/CCPlatformDefine.h index 0b2e2623..8ccb4edd 100644 --- a/loader/include/Geode/cocos/platform/mac/CCPlatformDefine.h +++ b/loader/include/Geode/cocos/platform/mac/CCPlatformDefine.h @@ -3,7 +3,7 @@ #include -#define CC_DLL __attribute__((visibility("hidden"))) +#define CC_DLL //__attribute__((visibility("hidden"))) #define ACTUAL_CC_DLL diff --git a/loader/src/ui/internal/info/DevProfilePopup.cpp b/loader/src/ui/internal/info/DevProfilePopup.cpp index f5146e84..6571b078 100644 --- a/loader/src/ui/internal/info/DevProfilePopup.cpp +++ b/loader/src/ui/internal/info/DevProfilePopup.cpp @@ -5,8 +5,9 @@ #include "../list/ModListCell.hpp" #include "../list/ModListLayer.hpp" -bool DevProfilePopup::setup(std::string const& developer) { +bool DevProfilePopup::setup(std::string const& developer, ModListLayer* list) { m_noElasticity = true; + m_layer = list; this->setTitle("Mods by " + developer); @@ -18,7 +19,7 @@ bool DevProfilePopup::setup(std::string const& developer) { for (auto& mod : Loader::get()->getAllMods()) { if (mod->getDeveloper() == developer) { auto cell = ModCell::create( - mod, nullptr, ModListDisplay::Concise, { 358.f, 40.f } + mod, m_layer, ModListDisplay::Concise, { 358.f, 40.f } ); cell->disableDeveloperButton(); items->addObject(cell); @@ -31,7 +32,7 @@ bool DevProfilePopup::setup(std::string const& developer) { continue; } auto cell = IndexItemCell::create( - item, nullptr, ModListDisplay::Concise, { 358.f, 40.f } + item, m_layer, ModListDisplay::Concise, { 358.f, 40.f } ); cell->disableDeveloperButton(); items->addObject(cell); @@ -39,18 +40,18 @@ bool DevProfilePopup::setup(std::string const& developer) { // mods list auto listSize = CCSize { 358.f, 160.f }; - auto list = ListView::create(items, 40.f, listSize.width, listSize.height); - list->setPosition(winSize / 2 - listSize / 2); - m_mainLayer->addChild(list); + auto cellList = ListView::create(items, 40.f, listSize.width, listSize.height); + cellList->setPosition(winSize / 2 - listSize / 2); + m_mainLayer->addChild(cellList); addListBorders(m_mainLayer, winSize / 2, listSize); return true; } -DevProfilePopup* DevProfilePopup::create(std::string const& developer) { +DevProfilePopup* DevProfilePopup::create(std::string const& developer, ModListLayer* list) { auto ret = new DevProfilePopup(); - if (ret && ret->init(420.f, 260.f, developer)) { + if (ret && ret->init(420.f, 260.f, developer, list)) { ret->autorelease(); return ret; } diff --git a/loader/src/ui/internal/info/DevProfilePopup.hpp b/loader/src/ui/internal/info/DevProfilePopup.hpp index af47a572..5ff3b631 100644 --- a/loader/src/ui/internal/info/DevProfilePopup.hpp +++ b/loader/src/ui/internal/info/DevProfilePopup.hpp @@ -4,10 +4,14 @@ using namespace geode::prelude; -class DevProfilePopup : public Popup { +class ModListLayer; + +class DevProfilePopup : public Popup { protected: - bool setup(std::string const& developer) override; + ModListLayer* m_layer; + + bool setup(std::string const& developer, ModListLayer* list) override; public: - static DevProfilePopup* create(std::string const& developer); + static DevProfilePopup* create(std::string const& developer, ModListLayer* list); }; diff --git a/loader/src/ui/internal/list/InstallListCell.cpp b/loader/src/ui/internal/list/InstallListCell.cpp index 07daca20..352d8aaf 100644 --- a/loader/src/ui/internal/list/InstallListCell.cpp +++ b/loader/src/ui/internal/list/InstallListCell.cpp @@ -53,24 +53,21 @@ void InstallListCell::setupInfo( } this->addChild(m_titleLabel); - m_developerBtn = nullptr; + m_creatorLabel = nullptr; if (developer) { auto creatorStr = "by " + *developer; - auto creatorLabel = CCLabelBMFont::create(creatorStr.c_str(), "goldFont.fnt"); - creatorLabel->setScale(.34f); + m_creatorLabel = CCLabelBMFont::create(creatorStr.c_str(), "goldFont.fnt"); + m_creatorLabel->setScale(.34f); if (inactive) { - creatorLabel->setColor({ 163, 163, 163 }); + m_creatorLabel->setColor({ 163, 163, 163 }); } - m_developerBtn = CCMenuItemSpriteExtra::create( - creatorLabel, this, menu_selector(InstallListCell::onViewDev) - ); - m_developerBtn->setPosition( + m_creatorLabel->setPosition( m_titleLabel->getPositionX() + m_titleLabel->getScaledContentSize().width + 3.f + - creatorLabel->getScaledContentSize().width / 2, + m_creatorLabel->getScaledContentSize().width / 2, m_height / 2 ); - m_menu->addChild(m_developerBtn); + m_menu->addChild(m_creatorLabel); } this->setupVersion(version); @@ -96,7 +93,7 @@ void InstallListCell::setupVersion(std::variantsetScale(.2f); m_versionLabel->setPosition( m_titleLabel->getPositionX() + m_titleLabel->getScaledContentSize().width + 3.f + - (m_developerBtn ? m_developerBtn->getScaledContentSize().width + 3.f : 0.f), + (m_creatorLabel ? m_creatorLabel->getScaledContentSize().width + 3.f : 0.f), m_titleLabel->getPositionY() - 1.f ); m_versionLabel->setColor({ 0, 255, 0 }); @@ -123,7 +120,7 @@ void InstallListCell::setupInfo(ModMetadata const& metadata, bool inactive) { } void InstallListCell::onViewDev(CCObject*) { - DevProfilePopup::create(getDeveloper())->show(); + // DevProfilePopup::create(getDeveloper(), m_layer)->show(); } bool InstallListCell::init(InstallListPopup* list, CCSize const& size) { diff --git a/loader/src/ui/internal/list/InstallListCell.hpp b/loader/src/ui/internal/list/InstallListCell.hpp index f2fd677c..ce5927ea 100644 --- a/loader/src/ui/internal/list/InstallListCell.hpp +++ b/loader/src/ui/internal/list/InstallListCell.hpp @@ -21,7 +21,7 @@ protected: float m_height; InstallListPopup* m_layer = nullptr; CCMenu* m_menu = nullptr; - CCMenuItemSpriteExtra* m_developerBtn = nullptr; + CCLabelBMFont* m_creatorLabel = nullptr; CCLabelBMFont* m_titleLabel = nullptr; CCLabelBMFont* m_versionLabel = nullptr; TagNode* m_tagLabel = nullptr; diff --git a/loader/src/ui/internal/list/ModListCell.cpp b/loader/src/ui/internal/list/ModListCell.cpp index bb855607..f715132f 100644 --- a/loader/src/ui/internal/list/ModListCell.cpp +++ b/loader/src/ui/internal/list/ModListCell.cpp @@ -178,7 +178,7 @@ void ModListCell::setupInfo( } void ModListCell::onViewDev(CCObject*) { - DevProfilePopup::create(this->getDeveloper())->show(); + DevProfilePopup::create(this->getDeveloper(), m_layer)->show(); } bool ModListCell::init(ModListLayer* list, CCSize const& size) { @@ -227,7 +227,9 @@ void ModCell::onEnable(CCObject* sender) { else { tryOrAlert(m_mod->disable(), "Error disabling mod"); } - m_layer->reloadList(); + if (m_layer) { + m_layer->reloadList(); + } } void ModCell::onUnresolvedInfo(CCObject*) { From 2723588f212e126b96655052926d6d7e0cd77811 Mon Sep 17 00:00:00 2001 From: altalk23 <45172705+altalk23@users.noreply.github.com> Date: Tue, 12 Sep 2023 19:46:26 +0300 Subject: [PATCH 22/98] Fix nested lists in md --- loader/src/ui/nodes/MDTextArea.cpp | 20 ++++++++++++++++++-- loader/src/ui/nodes/TextRenderer.cpp | 6 +++--- 2 files changed, 21 insertions(+), 5 deletions(-) diff --git a/loader/src/ui/nodes/MDTextArea.cpp b/loader/src/ui/nodes/MDTextArea.cpp index 051d5bcd..c6afcda2 100644 --- a/loader/src/ui/nodes/MDTextArea.cpp +++ b/loader/src/ui/nodes/MDTextArea.cpp @@ -209,6 +209,7 @@ struct MDParser { static float s_codeStart; static size_t s_orderedListNum; static std::vector s_codeSpans; + static bool s_breakListLine; static int parseText(MD_TEXTTYPE type, MD_CHAR const* rawText, MD_SIZE size, void* mdtextarea) { auto textarea = static_cast(mdtextarea); @@ -364,6 +365,10 @@ struct MDParser { renderer->pushIndent(g_indent); s_isOrderedList = type == MD_BLOCKTYPE::MD_BLOCK_OL; s_orderedListNum = 0; + if (s_breakListLine) { + renderer->breakLine(); + s_breakListLine = false; + } } break; @@ -377,6 +382,10 @@ struct MDParser { case MD_BLOCKTYPE::MD_BLOCK_LI: { + if (s_breakListLine) { + renderer->breakLine(); + s_breakListLine = false; + } renderer->pushOpacity(renderer->getCurrentOpacity() / 2); auto lidetail = static_cast(detail); if (s_isOrderedList) { @@ -387,6 +396,7 @@ struct MDParser { renderer->renderString("• "); } renderer->popOpacity(); + s_breakListLine = true; } break; @@ -446,7 +456,13 @@ struct MDParser { case MD_BLOCKTYPE::MD_BLOCK_UL: { renderer->popIndent(); - renderer->breakLine(); + if (s_breakListLine) { + renderer->breakLine(); + s_breakListLine = false; + } + if (renderer->getCurrentIndent() == 0) { + renderer->breakLine(); + } } break; @@ -489,7 +505,6 @@ struct MDParser { case MD_BLOCKTYPE::MD_BLOCK_LI: { - renderer->breakLine(); } break; @@ -626,6 +641,7 @@ size_t MDParser::s_orderedListNum = 0; bool MDParser::s_isCodeBlock = false; float MDParser::s_codeStart = 0; decltype(MDParser::s_codeSpans) MDParser::s_codeSpans = {}; +bool MDParser::s_breakListLine = false; void MDTextArea::updateLabel() { m_renderer->begin(m_content, CCPointZero, m_size); diff --git a/loader/src/ui/nodes/TextRenderer.cpp b/loader/src/ui/nodes/TextRenderer.cpp index fe2c712d..ca7396b3 100644 --- a/loader/src/ui/nodes/TextRenderer.cpp +++ b/loader/src/ui/nodes/TextRenderer.cpp @@ -341,8 +341,8 @@ std::vector TextRenderer::renderStringEx( auto lastIndent = m_indentationStack.size() > 1 ? m_indentationStack.at(m_indentationStack.size() - 1) : .0f; - if (m_cursor.x == m_origin.x + lastIndent && this->getCurrentIndent() > .0f) { - m_cursor.x += this->getCurrentIndent(); + if (m_cursor.x < m_origin.x + this->getCurrentIndent()) { + m_cursor.x = this->getCurrentIndent(); } auto createLabel = [&]() -> bool { @@ -487,7 +487,7 @@ void TextRenderer::breakLine(float incY) { } if (h > y) y = h; m_cursor.y -= y; - m_cursor.x = m_origin.x + getCurrentIndent(); + m_cursor.x = m_origin.x; } float TextRenderer::adjustLineAlignment() { From 9eadc2a577d57495eeb261288c87b782de2591b8 Mon Sep 17 00:00:00 2001 From: altalk23 <45172705+altalk23@users.noreply.github.com> Date: Sat, 16 Sep 2023 09:57:40 +0300 Subject: [PATCH 23/98] oh right i need to fix the search paths again --- CHANGELOG.md | 9 +++++++++ VERSION | 2 +- 2 files changed, 10 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 180b2d85..62ac6b63 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,14 @@ # Geode Changelog +## v1.3.2 + * Fix alignment of some textures (8f39c38) + * Bring back unknown problems (0663569) + * Fix some Windows 7 incompatibility (2d2bdd1) + * Remove enabled from the crashlogs (5b7d318) + * Make index unzipping async (7c582f1) + * Fix mods by developer crashing when mod was toggled (a6a47bf) + * Fix nested lists in the markdown (2723588) + ## v1.3.1 * Fix TulipHook not relocating RIP relative operands on MacOS (6cad19d) diff --git a/VERSION b/VERSION index 6261a05b..d5e98f72 100644 --- a/VERSION +++ b/VERSION @@ -1 +1 @@ -1.3.1 \ No newline at end of file +1.3.2 \ No newline at end of file From aa55ebe8aa2920968c0262305f647dbf072f0db0 Mon Sep 17 00:00:00 2001 From: altalk23 <45172705+altalk23@users.noreply.github.com> Date: Sat, 16 Sep 2023 10:01:45 +0300 Subject: [PATCH 24/98] fix search paths - season 1 episode 4 --- loader/src/loader/ModImpl.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/loader/src/loader/ModImpl.cpp b/loader/src/loader/ModImpl.cpp index 6ffacdc0..73849f7a 100644 --- a/loader/src/loader/ModImpl.cpp +++ b/loader/src/loader/ModImpl.cpp @@ -43,7 +43,8 @@ Result<> Mod::Impl::setup() { log::warn("Unable to load data for \"{}\": {}", m_metadata.getID(), loadRes.unwrapErr()); } if (!m_resourcesLoaded) { - LoaderImpl::get()->updateModResources(m_self); + auto searchPathRoot = dirs::getModRuntimeDir() / m_metadata.getID() / "resources"; + CCFileUtils::get()->addSearchPath(searchPathRoot.string().c_str()); m_resourcesLoaded = true; } From 9498ae23d1bb4f81237abdc7018e8d809cb15416 Mon Sep 17 00:00:00 2001 From: altalk23 <45172705+altalk23@users.noreply.github.com> Date: Sat, 16 Sep 2023 10:02:47 +0300 Subject: [PATCH 25/98] Update changelog --- CHANGELOG.md | 1 + 1 file changed, 1 insertion(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 62ac6b63..f454003e 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -8,6 +8,7 @@ * Make index unzipping async (7c582f1) * Fix mods by developer crashing when mod was toggled (a6a47bf) * Fix nested lists in the markdown (2723588) + * Fix search paths (8f39c38, aa55ebe) ## v1.3.1 * Fix TulipHook not relocating RIP relative operands on MacOS (6cad19d) From e9502be4235b5d42dba2a3723e3546fe509b4062 Mon Sep 17 00:00:00 2001 From: altalk23 <45172705+altalk23@users.noreply.github.com> Date: Sat, 16 Sep 2023 11:14:08 +0300 Subject: [PATCH 26/98] github actions test --- cmake/GeodeFile.cmake | 2 ++ 1 file changed, 2 insertions(+) diff --git a/cmake/GeodeFile.cmake b/cmake/GeodeFile.cmake index 4c7efaff..f44b7d26 100644 --- a/cmake/GeodeFile.cmake +++ b/cmake/GeodeFile.cmake @@ -307,6 +307,8 @@ function(package_geode_resources_now proname src dest header_dest) if (NOT FILE_NAME STREQUAL ".geode_cache" AND NOT FILE_SHOULD_HASH EQUAL -1) file(SHA256 ${file} COMPUTED_HASH) + file(SIZE ${file} FILE_SIZE) + message(STATUS "Hashed ${file} to ${COMPUTED_HASH} (${FILE_SIZE} bytes)") list(APPEND HEADER_FILE "\t{ \"${FILE_NAME}\", \"${COMPUTED_HASH}\" },\n") # list(APPEND HEADER_FILE "\t\"${FILE_NAME}\",\n") From 5856f5fde080e89c55c2ef71dafa4accc2d1c9a9 Mon Sep 17 00:00:00 2001 From: altalk23 <45172705+altalk23@users.noreply.github.com> Date: Sat, 16 Sep 2023 11:38:11 +0300 Subject: [PATCH 27/98] Trying to fix hashes by enforcing LF --- .gitignore | 17 +++++++++++++---- loader/CMakeLists.txt | 7 +++++-- loader/resources/{about.md => about.md.in} | 0 loader/resources/{support.md => support.md.in} | 0 loader/src/loader/LoaderImpl.hpp | 1 - loader/src/ui/internal/info/ModInfoPopup.cpp | 1 + 6 files changed, 19 insertions(+), 7 deletions(-) rename loader/resources/{about.md => about.md.in} (100%) rename loader/resources/{support.md => support.md.in} (100%) diff --git a/.gitignore b/.gitignore index 6149f067..e8badae0 100644 --- a/.gitignore +++ b/.gitignore @@ -45,20 +45,29 @@ build2 build-docs/ bin +# Ignore docs folders docs/** docs +# Ignore codegenned files loader/src/internal/about.hpp loader/src/internal/resources.hpp loader/resources/mod.json loader/resources/version loader/resources/blanks/rename.js +loader/resources/about.md loader/resources/changelog.md +loader/resources/support.md + +# Ignore generated files +installer/mac/*.pkg +installer/windows/*.exe + +# Ignore fod's include directories which are stored in this funny file fods-catgirl-hideout.txt + +# Ignore I don't even know what that is probably fod's flash testing script test-docs.bat -# krita files too because alk is funny +# Ignore krita files too because we don't want our project files shaking my head **/*.kra - -installer/mac/*.pkg -installer/windows/*.exe \ No newline at end of file diff --git a/loader/CMakeLists.txt b/loader/CMakeLists.txt index 4258f77a..422bf8d5 100644 --- a/loader/CMakeLists.txt +++ b/loader/CMakeLists.txt @@ -27,10 +27,13 @@ execute_process( ) # Package info file for internal representation +set(GEODE_RESOURCES_PATH ${CMAKE_CURRENT_SOURCE_DIR}/resources) configure_file(resources/mod.json.in ${CMAKE_CURRENT_SOURCE_DIR}/resources/mod.json) file(READ resources/mod.json LOADER_MOD_JSON) -configure_file(${GEODE_ROOT_PATH}/VERSION ${CMAKE_CURRENT_SOURCE_DIR}/resources/version COPYONLY) -configure_file(${GEODE_ROOT_PATH}/CHANGELOG.md ${CMAKE_CURRENT_SOURCE_DIR}/resources/changelog.md COPYONLY) +configure_file(${GEODE_ROOT_PATH}/VERSION ${GEODE_RESOURCES_PATH}/version COPYONLY) +configure_file(${GEODE_RESOURCES_PATH}/about.md.in ${GEODE_RESOURCES_PATH}/about.md NEWLINE_STYLE LF) +configure_file(${GEODE_ROOT_PATH}/CHANGELOG.md ${GEODE_RESOURCES_PATH}/changelog.md NEWLINE_STYLE LF) +configure_file(${GEODE_RESOURCES_PATH}/support.md.in ${GEODE_RESOURCES_PATH}/support.md NEWLINE_STYLE LF) configure_file(src/internal/about.hpp.in ${CMAKE_CURRENT_SOURCE_DIR}/src/internal/about.hpp) # Source files diff --git a/loader/resources/about.md b/loader/resources/about.md.in similarity index 100% rename from loader/resources/about.md rename to loader/resources/about.md.in diff --git a/loader/resources/support.md b/loader/resources/support.md.in similarity index 100% rename from loader/resources/support.md rename to loader/resources/support.md.in diff --git a/loader/src/loader/LoaderImpl.hpp b/loader/src/loader/LoaderImpl.hpp index 92468f2a..38d618eb 100644 --- a/loader/src/loader/LoaderImpl.hpp +++ b/loader/src/loader/LoaderImpl.hpp @@ -13,7 +13,6 @@ #include #include #include "ModImpl.hpp" -#include #include #include #include diff --git a/loader/src/ui/internal/info/ModInfoPopup.cpp b/loader/src/ui/internal/info/ModInfoPopup.cpp index 1ec147d1..10c0ab37 100644 --- a/loader/src/ui/internal/info/ModInfoPopup.cpp +++ b/loader/src/ui/internal/info/ModInfoPopup.cpp @@ -4,6 +4,7 @@ #include "../list/ModListLayer.hpp" #include "../settings/ModSettingsPopup.hpp" #include +#include #include #include From 81de161b3e112e47ad283a20fe3ce1305604c8f8 Mon Sep 17 00:00:00 2001 From: altalk23 <45172705+altalk23@users.noreply.github.com> Date: Sat, 16 Sep 2023 14:09:05 +0300 Subject: [PATCH 28/98] reunify resources.zip --- .github/workflows/build.yml | 13 ++----------- .github/workflows/draft.yml | 6 ++---- loader/src/loader/LoaderImpl.cpp | 4 ++-- 3 files changed, 6 insertions(+), 17 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 8597aa34..ab892a8c 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -146,19 +146,11 @@ jobs: files: geode-win/XInput9_1_0.dll geode-win/Geode.dll geode-win/GeodeUpdater.exe geode-win/Geode.lib geode-win/Geode.pdb dest: geode-${{ steps.ref.outputs.hash }}-win.zip - # TODO change in 2.0.0 - name: Zip Windows Resources - uses: vimtor/action-zip@v1.1 - with: - files: geode-win/resources - dest: resources-win.zip - - # This is basically a hack because of line endings. Blame windows. - - name: Zip MacOS Resources uses: vimtor/action-zip@v1.1 with: files: geode-mac/resources - dest: resources-mac.zip + dest: resources.zip - name: Update Nightly Release uses: andelf/nightly-release@main @@ -174,5 +166,4 @@ jobs: ./geode-installer-${{ steps.ref.outputs.hash }}-win.exe ./geode-${{ steps.ref.outputs.hash }}-mac.zip ./geode-${{ steps.ref.outputs.hash }}-win.zip - ./resources-win.zip - ./resources-mac.zip + ./resources.zip diff --git a/.github/workflows/draft.yml b/.github/workflows/draft.yml index 34f757d2..d6051f79 100644 --- a/.github/workflows/draft.yml +++ b/.github/workflows/draft.yml @@ -28,8 +28,7 @@ jobs: mv dev/geode-installer-*-win.exe geode-installer-v${{ steps.ref.outputs.version }}-win.exe mv dev/geode-*-mac.zip geode-v${{ steps.ref.outputs.version }}-mac.zip mv dev/geode-*-win.zip geode-v${{ steps.ref.outputs.version }}-win.zip - mv dev/resources-win.zip resources-win.zip - mv dev/resources-mac.zip resources-mac.zip + mv dev/resources.zip resources.zip - name: Create Draft Release uses: softprops/action-gh-release@v1 @@ -49,5 +48,4 @@ jobs: ./geode-installer-v${{ steps.ref.outputs.version }}-win.exe ./geode-v${{ steps.ref.outputs.version }}-mac.zip ./geode-v${{ steps.ref.outputs.version }}-win.zip - ./resources-win.zip - ./resources-mac.zip + ./resources.zip diff --git a/loader/src/loader/LoaderImpl.cpp b/loader/src/loader/LoaderImpl.cpp index 197676f5..52727ff0 100644 --- a/loader/src/loader/LoaderImpl.cpp +++ b/loader/src/loader/LoaderImpl.cpp @@ -777,7 +777,7 @@ void Loader::Impl::downloadLoaderResources(bool useLatestRelease) { .json() .then([this](json::Value const& json) { this->tryDownloadLoaderResources(fmt::format( - "https://github.com/geode-sdk/geode/releases/download/{}/resources-" GEODE_PLATFORM_SHORT_IDENTIFIER ".zip", + "https://github.com/geode-sdk/geode/releases/download/{}/resources.zip", this->getVersion().toString() ), true); }) @@ -805,7 +805,7 @@ void Loader::Impl::downloadLoaderResources(bool useLatestRelease) { // find release asset for (auto asset : root.needs("assets").iterate()) { auto obj = asset.obj(); - if (obj.needs("name").template get() == "resources-" GEODE_PLATFORM_SHORT_IDENTIFIER ".zip") { + if (obj.needs("name").template get() == "resources.zip") { this->tryDownloadLoaderResources( obj.needs("browser_download_url").template get(), false From 444fd0b2c152989eb2a83ded461a4d529562cb59 Mon Sep 17 00:00:00 2001 From: altalk23 <45172705+altalk23@users.noreply.github.com> Date: Sat, 16 Sep 2023 14:10:06 +0300 Subject: [PATCH 29/98] Update version and changelog --- CHANGELOG.md | 3 +++ VERSION | 2 +- 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index f454003e..307f1b5a 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,8 @@ # Geode Changelog +## v1.3.3 + * Reunify resources.zip (81de161) + ## v1.3.2 * Fix alignment of some textures (8f39c38) * Bring back unknown problems (0663569) diff --git a/VERSION b/VERSION index d5e98f72..785cda80 100644 --- a/VERSION +++ b/VERSION @@ -1 +1 @@ -1.3.2 \ No newline at end of file +1.3.3 \ No newline at end of file From 2e7a30597022d752cfe27233d47a8bf4cb19480f Mon Sep 17 00:00:00 2001 From: ConfiG Date: Sat, 16 Sep 2023 14:19:31 +0300 Subject: [PATCH 30/98] fix job names in build.yml --- .github/workflows/build.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index ab892a8c..a0cdd586 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -146,13 +146,13 @@ jobs: files: geode-win/XInput9_1_0.dll geode-win/Geode.dll geode-win/GeodeUpdater.exe geode-win/Geode.lib geode-win/Geode.pdb dest: geode-${{ steps.ref.outputs.hash }}-win.zip - - name: Zip Windows Resources + - name: Zip Resources uses: vimtor/action-zip@v1.1 with: files: geode-mac/resources dest: resources.zip - - name: Update Nightly Release + - name: Update Development Release uses: andelf/nightly-release@main env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} From ed46326159fb0b31861022b6779c1123b4f41dc0 Mon Sep 17 00:00:00 2001 From: alk <45172705+altalk23@users.noreply.github.com> Date: Sat, 16 Sep 2023 14:58:46 +0300 Subject: [PATCH 31/98] I will calmly talk to whoever decided no break space to be alt + space --- CHANGELOG.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 307f1b5a..64e9486b 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -3,7 +3,7 @@ ## v1.3.3 * Reunify resources.zip (81de161) -## v1.3.2 +## v1.3.2 * Fix alignment of some textures (8f39c38) * Bring back unknown problems (0663569) * Fix some Windows 7 incompatibility (2d2bdd1) From 418e1be2f62b51f581c2600ca6d3345e77891b84 Mon Sep 17 00:00:00 2001 From: SMJS <38814077+SMJSGaming@users.noreply.github.com> Date: Sat, 16 Sep 2023 23:38:26 +0200 Subject: [PATCH 32/98] Replaced the unknown in Slider with the accurate name Note for other occurences, if it's a node and it has 2 floats as fields, 99% of the time it's rob adding the accurate width and height rather than fixing the content size --- bindings/GeometryDash.bro | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/bindings/GeometryDash.bro b/bindings/GeometryDash.bro index d67e0028..8062f47d 100644 --- a/bindings/GeometryDash.bro +++ b/bindings/GeometryDash.bro @@ -5465,7 +5465,7 @@ class Slider : cocos2d::CCLayer { SliderTouchLogic* m_touchLogic; cocos2d::CCSprite* m_sliderBar; cocos2d::CCSprite* m_groove; - float m_unknown; + float m_width; float m_height; } From 23cd456860589eb6c3dd13891231dcf0a7b7ab24 Mon Sep 17 00:00:00 2001 From: mat <26722564+matcool@users.noreply.github.com> Date: Sun, 17 Sep 2023 14:23:13 -0300 Subject: [PATCH 33/98] fix CCNode::removeChildByID not being exported properly --- loader/include/Geode/cocos/base_nodes/CCNode.h | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/loader/include/Geode/cocos/base_nodes/CCNode.h b/loader/include/Geode/cocos/base_nodes/CCNode.h index 51817e3c..944001e0 100644 --- a/loader/include/Geode/cocos/base_nodes/CCNode.h +++ b/loader/include/Geode/cocos/base_nodes/CCNode.h @@ -700,12 +700,6 @@ public: * @param cleanup true if all running actions and callbacks on the child node will be cleanup, false otherwise. */ virtual void removeChildByTag(int tag, bool cleanup); - /** - * Removes a child from the container by its ID. - * @param id The ID of the node - * @note Geode addition - */ - void removeChildByID(std::string const& id); /** * Removes all children from the container with a cleanup. * @@ -890,6 +884,13 @@ public: */ GEODE_DLL CCNode* getChildByIDRecursive(std::string const& id); + /** + * Removes a child from the container by its ID. + * @param id The ID of the node + * @note Geode addition + */ + GEODE_DLL void removeChildByID(std::string const& id); + /** * Add a child before a specified existing child * @param child The node to add. The node may not be a child of another From 07c627825343b0ba8f7353c74c0147b1ce37a402 Mon Sep 17 00:00:00 2001 From: ConfiG Date: Mon, 18 Sep 2023 10:09:17 +0300 Subject: [PATCH 34/98] fix CCArrayExt::operator[] return type --- loader/include/Geode/utils/cocos.hpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/loader/include/Geode/utils/cocos.hpp b/loader/include/Geode/utils/cocos.hpp index d8a66905..edc4fd2e 100644 --- a/loader/include/Geode/utils/cocos.hpp +++ b/loader/include/Geode/utils/cocos.hpp @@ -953,7 +953,7 @@ namespace geode::cocos { return m_arr ? m_arr->count() : 0; } - T operator[](size_t index) { + T* operator[](size_t index) { return static_cast(m_arr->objectAtIndex(index)); } From ca4010e3e3364b612aa9e750618c9fe5da91034b Mon Sep 17 00:00:00 2001 From: ConfiG Date: Mon, 18 Sep 2023 15:40:04 +0300 Subject: [PATCH 35/98] ccGLBindTexture2DN, macNumberOfDraws, ccIncrementGLDraws --- bindings/Cocos2d.bro | 5 +++++ loader/include/Geode/cocos/include/ccMacros.h | 7 +++++++ 2 files changed, 12 insertions(+) diff --git a/bindings/Cocos2d.bro b/bindings/Cocos2d.bro index 4d1d2dab..8a2f037b 100644 --- a/bindings/Cocos2d.bro +++ b/bindings/Cocos2d.bro @@ -1256,10 +1256,15 @@ class cocos2d { static auto ccDrawSolidRect(cocos2d::CCPoint, cocos2d::CCPoint, cocos2d::_ccColor4F) = mac 0xecf00; static auto ccGLEnableVertexAttribs(unsigned int) = mac 0x1ae740; static auto ccGLBindTexture2D(GLuint) = mac 0x1ae610; + static auto ccGLBindTexture2DN(GLuint, GLuint) = mac 0x1ae650; static float ccpDistance(cocos2d::CCPoint const&, cocos2d::CCPoint const&) = mac 0x1aaf90; static void ccDrawPoly(cocos2d::CCPoint const*, unsigned int, bool) = mac 0xed0a0; static void ccDrawColor4B(GLubyte, GLubyte, GLubyte, GLubyte) = mac 0xeddd0; static void CCMessageBox(const char* msg, const char* title) = mac 0xbabc0; + + static uintptr_t macNumberOfDraws() { + return geode::base::get() + 0x69ae90; + } } [[link(win)]] diff --git a/loader/include/Geode/cocos/include/ccMacros.h b/loader/include/Geode/cocos/include/ccMacros.h index 0c98e27a..e2e61514 100644 --- a/loader/include/Geode/cocos/include/ccMacros.h +++ b/loader/include/Geode/cocos/include/ccMacros.h @@ -247,6 +247,13 @@ It should work same as apples CFSwapInt32LittleToHost(..) */ extern unsigned int ACTUAL_CC_DLL g_uNumberOfDraws; #define CC_INCREMENT_GL_DRAWS(__n__) g_uNumberOfDraws += __n__ +static inline GEODE_INLINE void ccIncrementGLDraws(int n) { +#ifdef GEODE_IS_MACOS + *reinterpret_cast(macNumberOfDraws()) += n; +#else + CC_INCREMENT_GL_DRAWS(n); +#endif +} /*******************/ /** Notifications **/ From 2726a82e64543550be6ce02dfc60bbcbec05d93a Mon Sep 17 00:00:00 2001 From: ConfiG Date: Mon, 18 Sep 2023 16:15:45 +0300 Subject: [PATCH 36/98] Please Die --- loader/include/Geode/cocos/include/ccMacros.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/loader/include/Geode/cocos/include/ccMacros.h b/loader/include/Geode/cocos/include/ccMacros.h index e2e61514..ada46fa8 100644 --- a/loader/include/Geode/cocos/include/ccMacros.h +++ b/loader/include/Geode/cocos/include/ccMacros.h @@ -247,9 +247,9 @@ It should work same as apples CFSwapInt32LittleToHost(..) */ extern unsigned int ACTUAL_CC_DLL g_uNumberOfDraws; #define CC_INCREMENT_GL_DRAWS(__n__) g_uNumberOfDraws += __n__ -static inline GEODE_INLINE void ccIncrementGLDraws(int n) { +static GEODE_INLINE void ccIncrementGLDraws(int n) { #ifdef GEODE_IS_MACOS - *reinterpret_cast(macNumberOfDraws()) += n; + *reinterpret_cast(geode::cocos2d::macNumberOfDraws()) += n; #else CC_INCREMENT_GL_DRAWS(n); #endif From 264c9e4a6453b63b5eefbe67a9151bfbfe107a7f Mon Sep 17 00:00:00 2001 From: ConfiG Date: Mon, 18 Sep 2023 16:18:55 +0300 Subject: [PATCH 37/98] bet its this --- loader/include/Geode/cocos/include/ccMacros.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/loader/include/Geode/cocos/include/ccMacros.h b/loader/include/Geode/cocos/include/ccMacros.h index ada46fa8..e18e2580 100644 --- a/loader/include/Geode/cocos/include/ccMacros.h +++ b/loader/include/Geode/cocos/include/ccMacros.h @@ -249,7 +249,7 @@ extern unsigned int ACTUAL_CC_DLL g_uNumberOfDraws; #define CC_INCREMENT_GL_DRAWS(__n__) g_uNumberOfDraws += __n__ static GEODE_INLINE void ccIncrementGLDraws(int n) { #ifdef GEODE_IS_MACOS - *reinterpret_cast(geode::cocos2d::macNumberOfDraws()) += n; + *reinterpret_cast(cocos2d::macNumberOfDraws()) += n; #else CC_INCREMENT_GL_DRAWS(n); #endif From 7d1897dbd6c80f0c9a6e4e07cf0c5d8b3232a347 Mon Sep 17 00:00:00 2001 From: ConfiG Date: Mon, 18 Sep 2023 16:24:27 +0300 Subject: [PATCH 38/98] ifx hope --- bindings/Cocos2d.bro | 3 +++ loader/include/Geode/cocos/include/ccMacros.h | 7 +------ 2 files changed, 4 insertions(+), 6 deletions(-) diff --git a/bindings/Cocos2d.bro b/bindings/Cocos2d.bro index 8a2f037b..4202a171 100644 --- a/bindings/Cocos2d.bro +++ b/bindings/Cocos2d.bro @@ -1265,6 +1265,9 @@ class cocos2d { static uintptr_t macNumberOfDraws() { return geode::base::get() + 0x69ae90; } + static void CC_INCREMENT_GL_DRAWS(int n) { + *reinterpret_cast(macNumberOfDraws()) += n; + } } [[link(win)]] diff --git a/loader/include/Geode/cocos/include/ccMacros.h b/loader/include/Geode/cocos/include/ccMacros.h index e18e2580..b675bd7c 100644 --- a/loader/include/Geode/cocos/include/ccMacros.h +++ b/loader/include/Geode/cocos/include/ccMacros.h @@ -246,14 +246,9 @@ It should work same as apples CFSwapInt32LittleToHost(..) The number of calls per frame are displayed on the screen when the CCDirector's stats are enabled. */ extern unsigned int ACTUAL_CC_DLL g_uNumberOfDraws; +#ifndef GEODE_IS_MACOS #define CC_INCREMENT_GL_DRAWS(__n__) g_uNumberOfDraws += __n__ -static GEODE_INLINE void ccIncrementGLDraws(int n) { -#ifdef GEODE_IS_MACOS - *reinterpret_cast(cocos2d::macNumberOfDraws()) += n; -#else - CC_INCREMENT_GL_DRAWS(n); #endif -} /*******************/ /** Notifications **/ From 07f3acb0f9bcc17a0c1bbb71c5a87ab8acb847d7 Mon Sep 17 00:00:00 2001 From: ConfiG Date: Mon, 18 Sep 2023 16:42:23 +0300 Subject: [PATCH 39/98] revert cc increment gl draws let someone else do it i dont have a mac to test --- bindings/Cocos2d.bro | 18 +++++++++++------- loader/include/Geode/cocos/include/ccMacros.h | 2 -- 2 files changed, 11 insertions(+), 9 deletions(-) diff --git a/bindings/Cocos2d.bro b/bindings/Cocos2d.bro index 4202a171..4a269ead 100644 --- a/bindings/Cocos2d.bro +++ b/bindings/Cocos2d.bro @@ -1261,15 +1261,19 @@ class cocos2d { static void ccDrawPoly(cocos2d::CCPoint const*, unsigned int, bool) = mac 0xed0a0; static void ccDrawColor4B(GLubyte, GLubyte, GLubyte, GLubyte) = mac 0xeddd0; static void CCMessageBox(const char* msg, const char* title) = mac 0xbabc0; - - static uintptr_t macNumberOfDraws() { - return geode::base::get() + 0x69ae90; - } - static void CC_INCREMENT_GL_DRAWS(int n) { - *reinterpret_cast(macNumberOfDraws()) += n; - } } +//uintptr_t macNumberOfDraws() { +// return geode::base::get() + 0x69ae90; +//} +//void ccIncrementGLDraws(int n) { +//#ifdef GEODE_IS_MACOS +// *reinterpret_cast(macNumberOfDraws()) += n; +//#else +// CC_INCREMENT_GL_DRAWS(n); +//#endif +//} + [[link(win)]] class DS_Dictionary { DS_Dictionary() = mac 0xbe9a0; diff --git a/loader/include/Geode/cocos/include/ccMacros.h b/loader/include/Geode/cocos/include/ccMacros.h index b675bd7c..0c98e27a 100644 --- a/loader/include/Geode/cocos/include/ccMacros.h +++ b/loader/include/Geode/cocos/include/ccMacros.h @@ -246,9 +246,7 @@ It should work same as apples CFSwapInt32LittleToHost(..) The number of calls per frame are displayed on the screen when the CCDirector's stats are enabled. */ extern unsigned int ACTUAL_CC_DLL g_uNumberOfDraws; -#ifndef GEODE_IS_MACOS #define CC_INCREMENT_GL_DRAWS(__n__) g_uNumberOfDraws += __n__ -#endif /*******************/ /** Notifications **/ From 100fc665008a636705ded9bbb1798b48548ac199 Mon Sep 17 00:00:00 2001 From: Fire <17692105+FireMario211@users.noreply.github.com> Date: Mon, 18 Sep 2023 14:48:06 +0000 Subject: [PATCH 40/98] Add new class (SecretLayer2) only win offsets because I dont have a mac. `onSubmit` and `updateSearchLabel` from @Jouca, everything else found by me. --- bindings/GeometryDash.bro | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/bindings/GeometryDash.bro b/bindings/GeometryDash.bro index 8062f47d..371ed416 100644 --- a/bindings/GeometryDash.bro +++ b/bindings/GeometryDash.bro @@ -4089,6 +4089,15 @@ class LevelSettingsDelegate { virtual void levelSettingsUpdated() {} } +class SecretLayer2 : cocos2d::CCLayer, TextInputDelegate, FLAlertLayerProtocol, DialogDelegate { + static SecretLayer2* create() = win 0x21FD70; + + bool init() = win 0x21FE10; + bool onSubmit(cocos2d::CCObject*) = win 0x221ac0; + void updateSearchLabel(const char* text) = win 0x222FC0; + void showCompletedLevel() = win 0x220C10; +} + class SecretLayer4 : cocos2d::CCLayer, TextInputDelegate, FLAlertLayerProtocol, DialogDelegate { static SecretLayer4* create() = mac 0x1ed500; static cocos2d::CCScene* scene() = mac 0x1ed4c0; From 266bdc3491e36ed279337eba32e7accc1038be6f Mon Sep 17 00:00:00 2001 From: Cvolton Date: Fri, 15 Sep 2023 13:24:50 +0200 Subject: [PATCH 41/98] Update LevelInfoLayer bindings --- bindings/GeometryDash.bro | 17 ++++++++++------- 1 file changed, 10 insertions(+), 7 deletions(-) diff --git a/bindings/GeometryDash.bro b/bindings/GeometryDash.bro index d67e0028..9f368269 100644 --- a/bindings/GeometryDash.bro +++ b/bindings/GeometryDash.bro @@ -4022,6 +4022,7 @@ class LevelInfoLayer : cocos2d::CCLayer, LevelDownloadDelegate, LevelUpdateDeleg virtual void levelDownloadFinished(GJGameLevel*) = mac 0x164C00, win 0x1790C0; virtual void levelUpdateFinished(GJGameLevel*, UpdateResponse) = mac 0x164E60, win 0x1792B0; void showUpdateAlert(UpdateResponse) = mac 0x164ED0, win 0x179300; + void updateLabelValues() = mac 0x164090, win 0x17b170; PAD = win 0x4, mac 0x8; cocos2d::CCMenu* m_playBtnMenu; @@ -4031,13 +4032,13 @@ class LevelInfoLayer : cocos2d::CCLayer, LevelDownloadDelegate, LevelUpdateDeleg CCMenuItemSpriteExtra* m_starRateBtn; CCMenuItemSpriteExtra* m_demonRateBtn; PAD = win 0x4, mac 0x8; - CCMenuItemToggler* m_toggler; - cocos2d::CCLabelBMFont* m_label0; - cocos2d::CCLabelBMFont* m_label1; - cocos2d::CCLabelBMFont* m_label2; - cocos2d::CCLabelBMFont* m_label3; - cocos2d::CCLabelBMFont* m_label4; - cocos2d::CCLabelBMFont* m_label5; + CCMenuItemToggler* m_ldmToggler; + cocos2d::CCLabelBMFont* m_ldmLabel; + cocos2d::CCLabelBMFont* m_lengthLabel; + cocos2d::CCLabelBMFont* m_downloadsLabel; + cocos2d::CCLabelBMFont* m_likesLabel; + cocos2d::CCLabelBMFont* m_orbsLabel; + cocos2d::CCLabelBMFont* m_folderLabel; CCMenuItemSpriteExtra* m_cloneBtn; PAD = win 0x4, mac 0x8; } @@ -5542,6 +5543,8 @@ class SpeedObject : cocos2d::CCNode { float m_somethingToCompare; float m_idk3; float m_idk4; + + static SpeedObject* create(GameObject*, int, float) = win 0x20DE70; } class SpritePartDelegate {} From cf8fbbad7160bac376947f015f9f6ab6fb87fe2d Mon Sep 17 00:00:00 2001 From: FigmentBoy <17240592+FigmentBoy@users.noreply.github.com> Date: Mon, 18 Sep 2023 23:01:03 -0400 Subject: [PATCH 42/98] Allow for StringSetting character filters --- loader/include/Geode/loader/Setting.hpp | 5 +++++ loader/src/loader/Setting.cpp | 1 + loader/src/ui/internal/settings/GeodeSettingNode.cpp | 5 +++++ 3 files changed, 11 insertions(+) diff --git a/loader/include/Geode/loader/Setting.hpp b/loader/include/Geode/loader/Setting.hpp index fca764c9..5425687a 100644 --- a/loader/include/Geode/loader/Setting.hpp +++ b/loader/include/Geode/loader/Setting.hpp @@ -96,6 +96,11 @@ namespace geode { */ std::optional match; + /** + * The CCTextInputNode's allowed character filter + */ + std::optional filter; + static Result parse(JsonMaybeObject& obj); }; diff --git a/loader/src/loader/Setting.cpp b/loader/src/loader/Setting.cpp index ccce4622..e5dcda72 100644 --- a/loader/src/loader/Setting.cpp +++ b/loader/src/loader/Setting.cpp @@ -62,6 +62,7 @@ Result StringSetting::parse(JsonMaybeObject& obj) { StringSetting sett; parseCommon(sett, obj); obj.has("match").into(sett.match); + obj.has("filter").into(sett.filter); return Ok(sett); } diff --git a/loader/src/ui/internal/settings/GeodeSettingNode.cpp b/loader/src/ui/internal/settings/GeodeSettingNode.cpp index 70b14542..28a37e1e 100644 --- a/loader/src/ui/internal/settings/GeodeSettingNode.cpp +++ b/loader/src/ui/internal/settings/GeodeSettingNode.cpp @@ -324,6 +324,11 @@ bool StringSettingNode::setup(StringSettingValue* setting, float width) { m_input = InputNode::create(width / 2 - 10.f, "Text", "chatFont.fnt"); m_input->setPosition({ -(width / 2 - 70.f) / 2, .0f }); m_input->setScale(.65f); + + if (setting->castDefinition().filter.has_value()) { + m_input->getInput()->setAllowedChars(setting->castDefinition().filter.value()); + } + m_input->getInput()->setDelegate(this); m_menu->addChild(m_input); From 140f38bee0d0d7a0e5ae77280e0e07ebe992195c Mon Sep 17 00:00:00 2001 From: FigmentBoy <17240592+FigmentBoy@users.noreply.github.com> Date: Tue, 19 Sep 2023 15:14:59 -0400 Subject: [PATCH 43/98] Make MDTextArea fit within provided size (and look better) --- loader/src/ui/nodes/MDTextArea.cpp | 19 ++++++++++++++----- 1 file changed, 14 insertions(+), 5 deletions(-) diff --git a/loader/src/ui/nodes/MDTextArea.cpp b/loader/src/ui/nodes/MDTextArea.cpp index c6afcda2..fb5e2046 100644 --- a/loader/src/ui/nodes/MDTextArea.cpp +++ b/loader/src/ui/nodes/MDTextArea.cpp @@ -109,8 +109,8 @@ bool MDTextArea::init(std::string const& str, CCSize const& size) { if (!CCLayer::init()) return false; m_text = str; - m_size = size; - this->setContentSize(size); + m_size = size - CCSize { 15.f, 0.f }; + this->setContentSize(m_size); m_renderer = TextRenderer::create(); CC_SAFE_RETAIN(m_renderer); @@ -118,8 +118,8 @@ bool MDTextArea::init(std::string const& str, CCSize const& size) { m_bgSprite->setScale(.5f); m_bgSprite->setColor({ 0, 0, 0 }); m_bgSprite->setOpacity(75); - m_bgSprite->setContentSize(size * 2 + CCSize { 25.f, 25.f }); - m_bgSprite->setPosition(size / 2); + m_bgSprite->setContentSize(size * 2); + m_bgSprite->setPosition(m_size / 2); this->addChild(m_bgSprite); m_scrollLayer = ScrollLayer::create({ 0, 0, m_size.width, m_size.height }, true); @@ -695,7 +695,16 @@ void MDTextArea::updateLabel() { m_renderer->end(); - m_scrollLayer->m_contentLayer->setContentSize(m_content->getContentSize()); + if (m_content->getContentSize().height > m_size.height) { + // Generate bottom padding + m_scrollLayer->m_contentLayer->setContentSize(m_content->getContentSize() + CCSize { 0.f, 12.5 }); + m_content->setPositionY(10.f); + } else { + m_scrollLayer->m_contentLayer->setContentSize(m_content->getContentSize()); + m_content->setPositionY(-2.5f); + } + + m_scrollLayer->moveToTop(); } From 3ee606e7b95b172e3d14cd39d11eb55d26e90082 Mon Sep 17 00:00:00 2001 From: FigmentBoy <17240592+FigmentBoy@users.noreply.github.com> Date: Tue, 19 Sep 2023 17:18:21 -0400 Subject: [PATCH 44/98] Update patchnotes and set version to 1.3.4 --- CHANGELOG.md | 4 ++++ VERSION | 2 +- 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 64e9486b..ed989299 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,9 @@ # Geode Changelog +## v1.3.4 + * Implement string setting character filters (cf8fbba) + * Update bindings + ## v1.3.3 * Reunify resources.zip (81de161) diff --git a/VERSION b/VERSION index 785cda80..8c9698aa 100644 --- a/VERSION +++ b/VERSION @@ -1 +1 @@ -1.3.3 \ No newline at end of file +1.3.4 \ No newline at end of file From a942a45adc4f28e39aa61a096f6019d6c457903e Mon Sep 17 00:00:00 2001 From: Fleeym <61891787+Fleeym@users.noreply.github.com> Date: Wed, 20 Sep 2023 00:56:55 +0300 Subject: [PATCH 45/98] follow redirects on all util::web requests --- loader/src/utils/web.cpp | 2 ++ 1 file changed, 2 insertions(+) diff --git a/loader/src/utils/web.cpp b/loader/src/utils/web.cpp index 9bc7cd99..8dccd048 100644 --- a/loader/src/utils/web.cpp +++ b/loader/src/utils/web.cpp @@ -79,6 +79,7 @@ Result web::fetchBytes(std::string const& url) { curl_easy_setopt(curl, CURLOPT_SSL_VERIFYPEER, 0); curl_easy_setopt(curl, CURLOPT_SSL_VERIFYHOST, 0); curl_easy_setopt(curl, CURLOPT_WRITEDATA, &ret); + curl_easy_setopt(curl, CURLOPT_FOLLOWLOCATION, 1); curl_easy_setopt(curl, CURLOPT_WRITEFUNCTION, utils::fetch::writeBytes); auto res = curl_easy_perform(curl); if (res != CURLE_OK) { @@ -118,6 +119,7 @@ Result web::fetch(std::string const& url) { curl_easy_setopt(curl, CURLOPT_SSL_VERIFYHOST, 0); curl_easy_setopt(curl, CURLOPT_WRITEDATA, &ret); curl_easy_setopt(curl, CURLOPT_WRITEFUNCTION, utils::fetch::writeString); + curl_easy_setopt(curl, CURLOPT_FOLLOWLOCATION, 1); auto res = curl_easy_perform(curl); if (res != CURLE_OK) { curl_easy_cleanup(curl); From b71bfb921a238fca6cbbb10910fc40a7b2c8ea30 Mon Sep 17 00:00:00 2001 From: Fire <17692105+FireMario211@users.noreply.github.com> Date: Wed, 20 Sep 2023 03:17:10 +0000 Subject: [PATCH 46/98] Add more funcs to EndLevelLayer also inherit CCLayer in case someone wants to hook customSetup and do stuff there again only win offsets because i dont have a mac --- bindings/GeometryDash.bro | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/bindings/GeometryDash.bro b/bindings/GeometryDash.bro index cd058ffd..1a4848bb 100644 --- a/bindings/GeometryDash.bro +++ b/bindings/GeometryDash.bro @@ -1628,9 +1628,12 @@ class EffectGameObject : GameObject { PAD = mac 0x28, win 0x24; } -class EndLevelLayer { +class EndLevelLayer : cocos2d::CCLayer { static EndLevelLayer* create() = mac 0x2787d0, win 0x94b50; + void customSetup() = win 0x94cb0; + const char* getCoinString(void* p0) = win 0x96270; + const char* getEndText() = win 0x964A0; void onMenu(cocos2d::CCObject* sender) = mac 0x27a500, win 0x96c10; void onEdit(cocos2d::CCObject* sender) = mac 0x27a640, win 0x96d30; } From 6502285dd02650dd2803f93d6913ff10ac1b8494 Mon Sep 17 00:00:00 2001 From: altalk23 <45172705+altalk23@users.noreply.github.com> Date: Wed, 20 Sep 2023 15:29:49 +0300 Subject: [PATCH 47/98] add ccconfig --- bindings/Cocos2d.bro | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/bindings/Cocos2d.bro b/bindings/Cocos2d.bro index 4d1d2dab..fafc9eed 100644 --- a/bindings/Cocos2d.bro +++ b/bindings/Cocos2d.bro @@ -121,6 +121,11 @@ class cocos2d::CCClippingNode { // void updateConnected() = win 0xc7fb0; //} +[[link(win)]] +class cocos2d::CCConfiguration { + void gatherGPUInfo() = mac 0x2a6e10; +} + [[link(win)]] class cocos2d::CCDelayTime { static cocos2d::CCDelayTime* create(float) = mac 0x1f4380; From 152dc7edcf31691cd5d9a923b70387b4a562d40c Mon Sep 17 00:00:00 2001 From: altalk23 <45172705+altalk23@users.noreply.github.com> Date: Wed, 20 Sep 2023 17:07:25 +0300 Subject: [PATCH 48/98] Add MenuItemSprite --- bindings/Cocos2d.bro | 5 + loader/include/Geode/ui/MenuItemSprite.hpp | 47 ++++++++++ loader/include/Geode/ui/MenuItemToggle.hpp | 43 +++++++++ loader/include/Geode/utils/MiniFunction.hpp | 24 +++++ loader/src/ui/internal/list/ModListLayer.cpp | 4 +- loader/src/ui/nodes/MenuItemSprite.cpp | 98 ++++++++++++++++++++ 6 files changed, 220 insertions(+), 1 deletion(-) create mode 100644 loader/include/Geode/ui/MenuItemSprite.hpp create mode 100644 loader/include/Geode/ui/MenuItemToggle.hpp create mode 100644 loader/src/ui/nodes/MenuItemSprite.cpp diff --git a/bindings/Cocos2d.bro b/bindings/Cocos2d.bro index bde65aff..6f617e76 100644 --- a/bindings/Cocos2d.bro +++ b/bindings/Cocos2d.bro @@ -264,6 +264,11 @@ class cocos2d::CCEaseOut { static cocos2d::CCEaseOut* create(cocos2d::CCActionInterval*, float) = mac 0x2a1b70; } +[[link(win)]] +class cocos2d::CCEaseBounceOut { + static cocos2d::CCEaseBounceOut* create(cocos2d::CCActionInterval*) = mac 0x2a3b40; +} + [[link(win)]] class cocos2d::CCEGLView { CCEGLView(); diff --git a/loader/include/Geode/ui/MenuItemSprite.hpp b/loader/include/Geode/ui/MenuItemSprite.hpp new file mode 100644 index 00000000..113eb80d --- /dev/null +++ b/loader/include/Geode/ui/MenuItemSprite.hpp @@ -0,0 +1,47 @@ +#pragma once + +#include +#include "../utils/MiniFunction.hpp" + +#pragma warning(disable : 4275) + +namespace geode { + class GEODE_DLL MenuItemSprite : public cocos2d::CCMenuItemSprite { + protected: + + MenuItemSprite(); + ~MenuItemSprite() override; + + public: + static MenuItemSprite* create( + cocos2d::CCNode* normalSprite, cocos2d::CCNode* disabledSprite, + cocos2d::CCObject* target, cocos2d::SEL_MenuHandler callback + ); + + static MenuItemSprite* create( + cocos2d::CCNode* normalSprite, + cocos2d::CCObject* target, cocos2d::SEL_MenuHandler callback + ); + + bool init( + cocos2d::CCNode* normalSprite, cocos2d::CCNode* disabledSprite, + cocos2d::CCObject* target, cocos2d::SEL_MenuHandler callback + ); + + void runActionOnSprite(cocos2d::CCNode* sprite, cocos2d::CCAction* generator); + void runActionOnSprites(utils::MiniFunction generator); + + utils::MiniFunction m_selectedAction; + utils::MiniFunction m_unselectedAction; + utils::MiniFunction m_activateAction; + + void activate() override; + void selected() override; + void unselected() override; + + void setImage(cocos2d::CCNode* image); + void setNormalImage(cocos2d::CCNode* image) override; + void setDisabledImage(cocos2d::CCNode* image) override; + void setSelectedImage(cocos2d::CCNode* image) override; + }; +} diff --git a/loader/include/Geode/ui/MenuItemToggle.hpp b/loader/include/Geode/ui/MenuItemToggle.hpp new file mode 100644 index 00000000..6399773a --- /dev/null +++ b/loader/include/Geode/ui/MenuItemToggle.hpp @@ -0,0 +1,43 @@ +#pragma once + +#include +#include "MenuItemSprite.hpp" + +#pragma warning(disable : 4275) + +namespace geode { + class GEODE_DLL MenuItemToggle : public cocos2d::CCMenuItem { + protected: + MenuItemSprite* m_offButton; + MenuItemSprite* m_onButton; + bool m_toggled; + + MenuItemToggle(); + ~MenuItemToggle() override; + + public: + static MenuItemToggle* create( + cocos2d::CCNode* onSprite, cocos2d::CCNode* offSprite, + cocos2d::CCObject* target, cocos2d::SEL_MenuHandler callback + ); + + bool init( + cocos2d::CCNode* onSprite, cocos2d::CCNode* offSprite, + cocos2d::CCObject* target, cocos2d::SEL_MenuHandler callback + ); + + void setOffButton(MenuItemSprite* button); + void setOnButton(MenuItemSprite* button); + MenuItemSprite* getOffButton() const; + MenuItemSprite* getOnButton() const; + + bool isToggled() const; + void toggle(bool enabled); + + void setScale(float scale) override; + void activate() override; + void selected() override; + void unselected() override; + void setEnabled(bool enabled) override; + }; +} diff --git a/loader/include/Geode/utils/MiniFunction.hpp b/loader/include/Geode/utils/MiniFunction.hpp index edb66052..72cf1e19 100644 --- a/loader/include/Geode/utils/MiniFunction.hpp +++ b/loader/include/Geode/utils/MiniFunction.hpp @@ -123,6 +123,30 @@ namespace geode::utils { return *this; } + template + requires(MiniFunctionCallable && !std::is_same_v, MiniFunction>) + MiniFunction& operator=(Callable&& func) { + delete m_state; + m_state = new MiniFunctionState, Ret, Args...>(std::forward(func)); + return *this; + } + + template + requires(!MiniFunctionCallable && std::is_pointer_v && std::is_function_v>) + MiniFunction& operator=(FunctionPointer func) { + delete m_state; + m_state = new MiniFunctionStatePointer(func); + return *this; + } + + template + requires(std::is_member_function_pointer_v) + MiniFunction& operator=(MemberFunctionPointer func) { + delete m_state; + m_state = new MiniFunctionStateMemberPointer(func); + return *this; + } + Ret operator()(Args... args) const { if (!m_state) return Ret(); return m_state->call(args...); diff --git a/loader/src/ui/internal/list/ModListLayer.cpp b/loader/src/ui/internal/list/ModListLayer.cpp index a06e745c..e950a521 100644 --- a/loader/src/ui/internal/list/ModListLayer.cpp +++ b/loader/src/ui/internal/list/ModListLayer.cpp @@ -16,6 +16,8 @@ #include #include +#include + #define FTS_FUZZY_MATCH_IMPLEMENTATION #include @@ -259,7 +261,7 @@ bool ModListLayer::init() { m_topMenu = CCMenu::create(); // add back button - auto backBtn = CCMenuItemSpriteExtra::create( + auto backBtn = MenuItemSprite::create( CCSprite::createWithSpriteFrameName("GJ_arrow_01_001.png"), this, menu_selector(ModListLayer::onExit) ); diff --git a/loader/src/ui/nodes/MenuItemSprite.cpp b/loader/src/ui/nodes/MenuItemSprite.cpp new file mode 100644 index 00000000..cb6ec2a2 --- /dev/null +++ b/loader/src/ui/nodes/MenuItemSprite.cpp @@ -0,0 +1,98 @@ +#include + +using namespace geode::prelude; + +MenuItemSprite* MenuItemSprite::create( + cocos2d::CCNode* normalSprite, + cocos2d::CCObject* target, cocos2d::SEL_MenuHandler callback +) { + return MenuItemSprite::create(normalSprite, nullptr, target, callback); +} + +MenuItemSprite* MenuItemSprite::create( + cocos2d::CCNode* normalSprite, cocos2d::CCNode* disabledSprite, + cocos2d::CCObject* target, cocos2d::SEL_MenuHandler callback +) { + auto ret = new MenuItemSprite(); + if (ret && ret->init(normalSprite, disabledSprite, target, callback)) { + ret->autorelease(); + return ret; + } + CC_SAFE_DELETE(ret); + return nullptr; +} + +MenuItemSprite::MenuItemSprite() {} + +MenuItemSprite::~MenuItemSprite() { +} + +void MenuItemSprite::setImage(cocos2d::CCNode* image) { + if (image) { + image->setAnchorPoint({ 0.5f, 0.5f }); + image->setPosition(image->getContentSize() / 2); + } +} + +// why are the members private like what +void MenuItemSprite::setNormalImage(cocos2d::CCNode* image) { + CCMenuItemSprite::setNormalImage(image); + this->setImage(image); +} +void MenuItemSprite::setDisabledImage(cocos2d::CCNode* image) { + CCMenuItemSprite::setDisabledImage(image); + this->setImage(image); +} +void MenuItemSprite::setSelectedImage(cocos2d::CCNode* image) { + CCMenuItemSprite::setSelectedImage(image); + this->setImage(image); +} + +bool MenuItemSprite::init( + cocos2d::CCNode* normalSprite, cocos2d::CCNode* disabledSprite, + cocos2d::CCObject* target, cocos2d::SEL_MenuHandler callback +) { + if (!CCMenuItemSprite::initWithNormalSprite(normalSprite, disabledSprite, nullptr, target, callback)) return false; + + m_selectedAction = []() -> cocos2d::CCAction* { + return cocos2d::CCEaseBounceOut::create(cocos2d::CCScaleTo::create(0.3f, 1.26f)); + }; + m_unselectedAction = []() -> cocos2d::CCAction* { + return cocos2d::CCEaseBounceOut::create(cocos2d::CCScaleTo::create(0.4f, 1.0f)); + }; + m_activateAction = []() -> cocos2d::CCAction* { + return cocos2d::CCScaleTo::create(0.f, 1.0f); + }; + + return true; +} + +void MenuItemSprite::runActionOnSprite(cocos2d::CCNode* sprite, cocos2d::CCAction* generator) { + if (sprite) { + sprite->stopAllActions(); + if (generator) sprite->runAction(generator); + } +} + +void MenuItemSprite::runActionOnSprites(MiniFunction generator) { + this->runActionOnSprite(this->getNormalImage(), generator()); + this->runActionOnSprite(this->getDisabledImage(), generator()); + this->runActionOnSprite(this->getSelectedImage(), generator()); +} + +void MenuItemSprite::activate() { + this->runActionOnSprites(m_activateAction); + CCMenuItem::activate(); +} +void MenuItemSprite::selected() { + if (!m_bEnabled) return; + CCMenuItem::selected(); + + this->runActionOnSprites(m_selectedAction); +} +void MenuItemSprite::unselected() { + if (!m_bEnabled) return; + CCMenuItem::unselected(); + + this->runActionOnSprites(m_unselectedAction); +} \ No newline at end of file From e8b98e48f558af95ea14fc902a0a26967be24fc5 Mon Sep 17 00:00:00 2001 From: altalk23 <45172705+altalk23@users.noreply.github.com> Date: Wed, 20 Sep 2023 17:37:20 +0300 Subject: [PATCH 49/98] Fix some stuff related to menuitemspriteextra but gonna revert --- loader/include/Geode/UI.hpp | 1 + ...ItemSprite.hpp => MenuItemSpriteExtra.hpp} | 13 +++-- loader/include/Geode/ui/MenuItemToggle.hpp | 14 +++--- loader/src/hooks/MenuLayer.cpp | 2 +- loader/src/ui/internal/info/ModInfoPopup.cpp | 20 ++++---- loader/src/ui/internal/info/ModInfoPopup.hpp | 5 +- .../src/ui/internal/list/InstallListCell.cpp | 5 +- .../src/ui/internal/list/InstallListPopup.cpp | 2 +- loader/src/ui/internal/list/ModListCell.cpp | 17 +++---- loader/src/ui/internal/list/ModListCell.hpp | 5 +- loader/src/ui/internal/list/ModListLayer.cpp | 16 +++--- loader/src/ui/internal/list/ModListLayer.hpp | 9 ++-- .../src/ui/internal/list/ProblemsListCell.cpp | 4 +- .../ui/internal/settings/GeodeSettingNode.cpp | 12 ++--- .../ui/internal/settings/GeodeSettingNode.hpp | 24 ++++----- .../ui/internal/settings/ModSettingsPopup.cpp | 6 +-- .../ui/internal/settings/ModSettingsPopup.hpp | 2 +- loader/src/ui/nodes/ColorPickPopup.cpp | 2 +- loader/src/ui/nodes/MDPopup.cpp | 4 +- ...ItemSprite.cpp => MenuItemSpriteExtra.cpp} | 49 +++++++++++-------- loader/test/dependency/main.cpp | 6 +-- 21 files changed, 115 insertions(+), 103 deletions(-) rename loader/include/Geode/ui/{MenuItemSprite.hpp => MenuItemSpriteExtra.hpp} (81%) rename loader/src/ui/nodes/{MenuItemSprite.cpp => MenuItemSpriteExtra.cpp} (58%) diff --git a/loader/include/Geode/UI.hpp b/loader/include/Geode/UI.hpp index 2330064c..fc326ce6 100644 --- a/loader/include/Geode/UI.hpp +++ b/loader/include/Geode/UI.hpp @@ -10,6 +10,7 @@ #include "ui/ListView.hpp" #include "ui/MDPopup.hpp" #include "ui/MDTextArea.hpp" +#include "ui/MenuItemSpriteExtra.hpp" #include "ui/Notification.hpp" #include "ui/Popup.hpp" #include "ui/SceneManager.hpp" diff --git a/loader/include/Geode/ui/MenuItemSprite.hpp b/loader/include/Geode/ui/MenuItemSpriteExtra.hpp similarity index 81% rename from loader/include/Geode/ui/MenuItemSprite.hpp rename to loader/include/Geode/ui/MenuItemSpriteExtra.hpp index 113eb80d..776519ed 100644 --- a/loader/include/Geode/ui/MenuItemSprite.hpp +++ b/loader/include/Geode/ui/MenuItemSpriteExtra.hpp @@ -6,19 +6,20 @@ #pragma warning(disable : 4275) namespace geode { - class GEODE_DLL MenuItemSprite : public cocos2d::CCMenuItemSprite { + class GEODE_DLL MenuItemSpriteExtra : public cocos2d::CCMenuItemSprite { protected: + bool m_scaleSprites; - MenuItemSprite(); - ~MenuItemSprite() override; + MenuItemSpriteExtra(); + ~MenuItemSpriteExtra() override; public: - static MenuItemSprite* create( + static MenuItemSpriteExtra* create( cocos2d::CCNode* normalSprite, cocos2d::CCNode* disabledSprite, cocos2d::CCObject* target, cocos2d::SEL_MenuHandler callback ); - static MenuItemSprite* create( + static MenuItemSpriteExtra* create( cocos2d::CCNode* normalSprite, cocos2d::CCObject* target, cocos2d::SEL_MenuHandler callback ); @@ -39,6 +40,8 @@ namespace geode { void selected() override; void unselected() override; + void setScaleSprites(bool scale); + void setImage(cocos2d::CCNode* image); void setNormalImage(cocos2d::CCNode* image) override; void setDisabledImage(cocos2d::CCNode* image) override; diff --git a/loader/include/Geode/ui/MenuItemToggle.hpp b/loader/include/Geode/ui/MenuItemToggle.hpp index 6399773a..2e704c8a 100644 --- a/loader/include/Geode/ui/MenuItemToggle.hpp +++ b/loader/include/Geode/ui/MenuItemToggle.hpp @@ -1,15 +1,15 @@ #pragma once #include -#include "MenuItemSprite.hpp" +#include "MenuItemSpriteExtra.hpp" #pragma warning(disable : 4275) namespace geode { class GEODE_DLL MenuItemToggle : public cocos2d::CCMenuItem { protected: - MenuItemSprite* m_offButton; - MenuItemSprite* m_onButton; + MenuItemSpriteExtra* m_offButton; + MenuItemSpriteExtra* m_onButton; bool m_toggled; MenuItemToggle(); @@ -26,10 +26,10 @@ namespace geode { cocos2d::CCObject* target, cocos2d::SEL_MenuHandler callback ); - void setOffButton(MenuItemSprite* button); - void setOnButton(MenuItemSprite* button); - MenuItemSprite* getOffButton() const; - MenuItemSprite* getOnButton() const; + void setOffButton(MenuItemSpriteExtra* button); + void setOnButton(MenuItemSpriteExtra* button); + MenuItemSpriteExtra* getOffButton() const; + MenuItemSpriteExtra* getOnButton() const; bool isToggled() const; void toggle(bool enabled); diff --git a/loader/src/hooks/MenuLayer.cpp b/loader/src/hooks/MenuLayer.cpp index 869d1bce..4bddc8f1 100644 --- a/loader/src/hooks/MenuLayer.cpp +++ b/loader/src/hooks/MenuLayer.cpp @@ -77,7 +77,7 @@ struct CustomMenuLayer : Modify { auto bottomMenu = static_cast(this->getChildByID("bottom-menu")); - auto btn = CCMenuItemSpriteExtra::create( + auto btn = MenuItemSpriteExtra::create( m_fields->m_geodeButton, this, static_cast(geodeBtnSelector) ); diff --git a/loader/src/ui/internal/info/ModInfoPopup.cpp b/loader/src/ui/internal/info/ModInfoPopup.cpp index 945e5ec4..d1c5c230 100644 --- a/loader/src/ui/internal/info/ModInfoPopup.cpp +++ b/loader/src/ui/internal/info/ModInfoPopup.cpp @@ -151,13 +151,13 @@ bool ModInfoPopup::init(ModMetadata const& metadata, ModListLayer* list) { auto infoSpr = CCSprite::createWithSpriteFrameName("GJ_infoIcon_001.png"); infoSpr->setScale(.85f); - m_infoBtn = CCMenuItemSpriteExtra::create(infoSpr, this, menu_selector(ModInfoPopup::onInfo)); + m_infoBtn = MenuItemSpriteExtra::create(infoSpr, this, menu_selector(ModInfoPopup::onInfo)); m_infoBtn->setPosition(LAYER_SIZE.width / 2 - 25.f, LAYER_SIZE.height / 2 - 25.f); m_buttonMenu->addChild(m_infoBtn); // repo button if (metadata.getRepository()) { - auto repoBtn = CCMenuItemSpriteExtra::create( + auto repoBtn = MenuItemSpriteExtra::create( CCSprite::createWithSpriteFrameName("github.png"_spr), this, menu_selector(ModInfoPopup::onRepository) @@ -168,7 +168,7 @@ bool ModInfoPopup::init(ModMetadata const& metadata, ModListLayer* list) { // support button if (metadata.getSupportInfo()) { - auto supportBtn = CCMenuItemSpriteExtra::create( + auto supportBtn = MenuItemSpriteExtra::create( CCSprite::createWithSpriteFrameName("gift.png"_spr), this, menu_selector(ModInfoPopup::onSupport) @@ -181,7 +181,7 @@ bool ModInfoPopup::init(ModMetadata const& metadata, ModListLayer* list) { closeSpr->setScale(.8f); auto closeBtn = - CCMenuItemSpriteExtra::create(closeSpr, this, menu_selector(ModInfoPopup::onClose)); + MenuItemSpriteExtra::create(closeSpr, this, menu_selector(ModInfoPopup::onClose)); closeBtn->setPosition(-LAYER_SIZE.width / 2 + 3.f, LAYER_SIZE.height / 2 - 3.f); m_buttonMenu->addChild(closeBtn); @@ -399,7 +399,7 @@ bool LocalModInfoPopup::init(Mod* mod, ModListLayer* list) { settingsSpr->setScale(.65f); auto settingsBtn = - CCMenuItemSpriteExtra::create(settingsSpr, this, menu_selector(LocalModInfoPopup::onSettings)); + MenuItemSpriteExtra::create(settingsSpr, this, menu_selector(LocalModInfoPopup::onSettings)); settingsBtn->setPosition(-LAYER_SIZE.width / 2 + 25.f, -LAYER_SIZE.height / 2 + 25.f); m_buttonMenu->addChild(settingsBtn); @@ -410,7 +410,7 @@ bool LocalModInfoPopup::init(Mod* mod, ModListLayer* list) { ); configSpr->setScale(.65f); - auto configBtn = CCMenuItemSpriteExtra::create( + auto configBtn = MenuItemSpriteExtra::create( configSpr, this, menu_selector(LocalModInfoPopup::onOpenConfigDir) ); configBtn->setPosition(-LAYER_SIZE.width / 2 + 65.f, -LAYER_SIZE.height / 2 + 25.f); @@ -451,7 +451,7 @@ bool LocalModInfoPopup::init(Mod* mod, ModListLayer* list) { ButtonSprite::create("Uninstall", "bigFont.fnt", "GJ_button_05.png", .6f); uninstallBtnSpr->setScale(.6f); - auto uninstallBtn = CCMenuItemSpriteExtra::create( + auto uninstallBtn = MenuItemSpriteExtra::create( uninstallBtnSpr, this, menu_selector(LocalModInfoPopup::onUninstall) ); uninstallBtn->setPosition(-85.f, 75.f); @@ -467,7 +467,7 @@ bool LocalModInfoPopup::init(Mod* mod, ModListLayer* list) { ); m_installBtnSpr->setScale(.6f); - m_installBtn = CCMenuItemSpriteExtra::create(m_installBtnSpr, this, menu_selector(LocalModInfoPopup::onUpdate)); + m_installBtn = MenuItemSpriteExtra::create(m_installBtnSpr, this, menu_selector(LocalModInfoPopup::onUpdate)); m_installBtn->setPosition(-8.0f, 75.f); m_buttonMenu->addChild(m_installBtn); @@ -536,7 +536,7 @@ bool LocalModInfoPopup::init(Mod* mod, ModListLayer* list) { ); issuesBtnSpr->setScale(.75f); - auto issuesBtn = CCMenuItemSpriteExtra::create( + auto issuesBtn = MenuItemSpriteExtra::create( issuesBtnSpr, this, menu_selector(LocalModInfoPopup::onIssues) ); issuesBtn->setPosition(0.f, -LAYER_SIZE.height / 2 + 25.f); @@ -726,7 +726,7 @@ bool IndexItemInfoPopup::init(IndexItemHandle item, ModListLayer* list) { ); m_installBtnSpr->setScale(.6f); - m_installBtn = CCMenuItemSpriteExtra::create( + m_installBtn = MenuItemSpriteExtra::create( m_installBtnSpr, this, menu_selector(IndexItemInfoPopup::onInstall) ); m_installBtn->setPosition(-143.0f, 75.f); diff --git a/loader/src/ui/internal/info/ModInfoPopup.hpp b/loader/src/ui/internal/info/ModInfoPopup.hpp index 808cd918..e9ab045a 100644 --- a/loader/src/ui/internal/info/ModInfoPopup.hpp +++ b/loader/src/ui/internal/info/ModInfoPopup.hpp @@ -6,6 +6,7 @@ #include #include #include +#include using namespace geode::prelude; @@ -31,8 +32,8 @@ protected: ModListLayer* m_layer = nullptr; DownloadStatusNode* m_installStatus = nullptr; IconButtonSprite* m_installBtnSpr; - CCMenuItemSpriteExtra* m_installBtn; - CCMenuItemSpriteExtra* m_infoBtn; + MenuItemSpriteExtra* m_installBtn; + MenuItemSpriteExtra* m_infoBtn; CCLabelBMFont* m_latestVersionLabel = nullptr; CCLabelBMFont* m_minorVersionLabel = nullptr; MDTextArea* m_detailsArea; diff --git a/loader/src/ui/internal/list/InstallListCell.cpp b/loader/src/ui/internal/list/InstallListCell.cpp index 352d8aaf..ce309181 100644 --- a/loader/src/ui/internal/list/InstallListCell.cpp +++ b/loader/src/ui/internal/list/InstallListCell.cpp @@ -1,7 +1,6 @@ #include "InstallListCell.hpp" #include "InstallListPopup.hpp" #include -#include #include #include #include @@ -213,7 +212,7 @@ bool IndexItemInstallListCell::init( versionSelectSpr->setScale(.7f); auto versionSelectBtn = - CCMenuItemSpriteExtra::create(versionSelectSpr, this, menu_selector(IndexItemInstallListCell::onSelectVersion)); + MenuItemSpriteExtra::create(versionSelectSpr, this, menu_selector(IndexItemInstallListCell::onSelectVersion)); versionSelectBtn->setAnchorPoint({1.f, .5f}); versionSelectBtn->setPosition({m_toggle->getPositionX() - m_toggle->getContentSize().width - 5, m_height / 2}); m_menu->addChild(versionSelectBtn); @@ -372,7 +371,7 @@ bool SelectVersionCell::init(IndexItemHandle item, SelectVersionPopup* versionPo ); selectSpr->setScale(.6f); - auto selectBtn = CCMenuItemSpriteExtra::create( + auto selectBtn = MenuItemSpriteExtra::create( selectSpr, this, menu_selector(SelectVersionCell::onSelected) ); selectBtn->setAnchorPoint({1.f, .5f}); diff --git a/loader/src/ui/internal/list/InstallListPopup.cpp b/loader/src/ui/internal/list/InstallListPopup.cpp index e561ca9b..2acbb670 100644 --- a/loader/src/ui/internal/list/InstallListPopup.cpp +++ b/loader/src/ui/internal/list/InstallListPopup.cpp @@ -22,7 +22,7 @@ bool InstallListPopup::setup(IndexItemHandle item, MiniFunctionsetScale(.6f); - auto installBtn = CCMenuItemSpriteExtra::create( + auto installBtn = MenuItemSpriteExtra::create( installBtnSpr, this, menu_selector(InstallListPopup::onInstall) diff --git a/loader/src/ui/internal/list/ModListCell.cpp b/loader/src/ui/internal/list/ModListCell.cpp index 061e6dcb..b1614011 100644 --- a/loader/src/ui/internal/list/ModListCell.cpp +++ b/loader/src/ui/internal/list/ModListCell.cpp @@ -2,7 +2,6 @@ #include "ModListLayer.hpp" #include "../info/ModInfoPopup.hpp" #include -#include #include #include #include @@ -144,7 +143,7 @@ void ModListCell::setupInfo( creatorLabel->setColor({ 163, 163, 163 }); } - m_developerBtn = CCMenuItemSpriteExtra::create( + m_developerBtn = MenuItemSpriteExtra::create( creatorLabel, this, menu_selector(ModListCell::onViewDev) ); m_columnMenu->addChild(m_developerBtn); @@ -292,7 +291,7 @@ bool ModCell::init( exMark->setScale(.5f); m_unresolvedExMark = - CCMenuItemSpriteExtra::create(exMark, this, menu_selector(ModCell::onUnresolvedInfo)); + MenuItemSpriteExtra::create(exMark, this, menu_selector(ModCell::onUnresolvedInfo)); m_unresolvedExMark->setVisible(false); m_menu->addChild(m_unresolvedExMark); @@ -300,7 +299,7 @@ bool ModCell::init( auto restartSpr = ButtonSprite::create("Restart", "bigFont.fnt", "GJ_button_03.png", .8f); restartSpr->setScale(.65f); - auto restartBtn = CCMenuItemSpriteExtra::create(restartSpr, this, menu_selector(ModCell::onRestart)); + auto restartBtn = MenuItemSpriteExtra::create(restartSpr, this, menu_selector(ModCell::onRestart)); m_menu->addChild(restartBtn); } else { @@ -335,7 +334,7 @@ bool ModCell::init( } } - auto viewBtn = CCMenuItemSpriteExtra::create(viewSpr, this, menu_selector(ModCell::onInfo)); + auto viewBtn = MenuItemSpriteExtra::create(viewSpr, this, menu_selector(ModCell::onInfo)); m_menu->addChild(viewBtn); } @@ -395,7 +394,7 @@ bool IndexItemCell::init( auto restartSpr = ButtonSprite::create("Restart", "bigFont.fnt", "GJ_button_03.png", .8f); restartSpr->setScale(.65f); - auto restartBtn = CCMenuItemSpriteExtra::create(restartSpr, this, menu_selector(IndexItemCell::onRestart)); + auto restartBtn = MenuItemSpriteExtra::create(restartSpr, this, menu_selector(IndexItemCell::onRestart)); m_menu->addChild(restartBtn); } else { @@ -403,7 +402,7 @@ bool IndexItemCell::init( viewSpr->setScale(.65f); auto viewBtn = - CCMenuItemSpriteExtra::create(viewSpr, this, menu_selector(IndexItemCell::onInfo)); + MenuItemSpriteExtra::create(viewSpr, this, menu_selector(IndexItemCell::onInfo)); m_menu->addChild(viewBtn); } @@ -517,7 +516,7 @@ bool InvalidGeodeFileCell::init( whySpr->setScale(.65f); auto viewBtn = - CCMenuItemSpriteExtra::create(whySpr, this, menu_selector(InvalidGeodeFileCell::onInfo)); + MenuItemSpriteExtra::create(whySpr, this, menu_selector(InvalidGeodeFileCell::onInfo)); menu->addChild(viewBtn); return true; @@ -635,7 +634,7 @@ bool ProblemsCell::init( viewSpr->setScale(.65f); auto viewBtn = - CCMenuItemSpriteExtra::create(viewSpr, this, menu_selector(ProblemsCell::onInfo)); + MenuItemSpriteExtra::create(viewSpr, this, menu_selector(ProblemsCell::onInfo)); m_menu->addChild(viewBtn); m_menu->updateLayout(); diff --git a/loader/src/ui/internal/list/ModListCell.hpp b/loader/src/ui/internal/list/ModListCell.hpp index 28e253d9..446f5b06 100644 --- a/loader/src/ui/internal/list/ModListCell.hpp +++ b/loader/src/ui/internal/list/ModListCell.hpp @@ -5,6 +5,7 @@ #include #include #include +#include using namespace geode::prelude; @@ -22,8 +23,8 @@ protected: CCMenu* m_menu; CCLabelBMFont* m_description; CCMenuItemToggler* m_enableToggle = nullptr; - CCMenuItemSpriteExtra* m_unresolvedExMark; - CCMenuItemSpriteExtra* m_developerBtn; + MenuItemSpriteExtra* m_unresolvedExMark; + MenuItemSpriteExtra* m_developerBtn; SpacerNode* m_spacer = nullptr; CCMenu* m_columnMenu = nullptr; CCMenu* m_labelMenu = nullptr; diff --git a/loader/src/ui/internal/list/ModListLayer.cpp b/loader/src/ui/internal/list/ModListLayer.cpp index e950a521..7f44d9ae 100644 --- a/loader/src/ui/internal/list/ModListLayer.cpp +++ b/loader/src/ui/internal/list/ModListLayer.cpp @@ -16,8 +16,6 @@ #include #include -#include - #define FTS_FUZZY_MATCH_IMPLEMENTATION #include @@ -261,7 +259,7 @@ bool ModListLayer::init() { m_topMenu = CCMenu::create(); // add back button - auto backBtn = MenuItemSprite::create( + auto backBtn = MenuItemSpriteExtra::create( CCSprite::createWithSpriteFrameName("GJ_arrow_01_001.png"), this, menu_selector(ModListLayer::onExit) ); @@ -272,7 +270,7 @@ bool ModListLayer::init() { auto reloadSpr = CCSprite::createWithSpriteFrameName("GJ_updateBtn_001.png"); reloadSpr->setScale(.8f); auto reloadBtn = - CCMenuItemSpriteExtra::create(reloadSpr, this, menu_selector(ModListLayer::onReload)); + MenuItemSpriteExtra::create(reloadSpr, this, menu_selector(ModListLayer::onReload)); reloadBtn->setPosition(-winSize.width / 2 + 30.0f, -winSize.height / 2 + 30.0f); m_menu->addChild(reloadBtn); @@ -281,7 +279,7 @@ bool ModListLayer::init() { "gj_folderBtn_001.png", .7f, CircleBaseColor::Green, CircleBaseSize::Small ); auto openBtn = - CCMenuItemSpriteExtra::create(openSpr, this, menu_selector(ModListLayer::onOpenFolder)); + MenuItemSpriteExtra::create(openSpr, this, menu_selector(ModListLayer::onOpenFolder)); openBtn->setPosition(-winSize.width / 2 + 30.0f, -winSize.height / 2 + 80.0f); m_menu->addChild(openBtn); @@ -396,7 +394,7 @@ void ModListLayer::createSearchControl() { filterSpr->setScale(.7f); m_filterBtn = - CCMenuItemSpriteExtra::create(filterSpr, this, menu_selector(ModListLayer::onFilters)); + MenuItemSpriteExtra::create(filterSpr, this, menu_selector(ModListLayer::onFilters)); m_filterBtn->setPosition(-10.f, 0.f); menu->addChild(m_filterBtn); @@ -404,14 +402,14 @@ void ModListLayer::createSearchControl() { auto searchSpr = CCSprite::createWithSpriteFrameName("gj_findBtn_001.png"); searchSpr->setScale(.7f); - m_searchBtn = CCMenuItemSpriteExtra::create(searchSpr, this, nullptr); + m_searchBtn = MenuItemSpriteExtra::create(searchSpr, this, nullptr); m_searchBtn->setPosition(-35.f, 0.f); menu->addChild(m_searchBtn); auto searchClearSpr = CCSprite::createWithSpriteFrameName("gj_findBtnOff_001.png"); searchClearSpr->setScale(.7f); - m_searchClearBtn = CCMenuItemSpriteExtra::create( + m_searchClearBtn = MenuItemSpriteExtra::create( searchClearSpr, this, menu_selector(ModListLayer::onResetSearch) ); m_searchClearBtn->setPosition(-35.f, 0.f); @@ -563,7 +561,7 @@ void ModListLayer::reloadList(bool keepScroll, std::optional const if (!m_checkForUpdatesBtn) { auto checkSpr = ButtonSprite::create("Check for Updates"); checkSpr->setScale(.7f); - m_checkForUpdatesBtn = CCMenuItemSpriteExtra::create( + m_checkForUpdatesBtn = MenuItemSpriteExtra::create( checkSpr, this, menu_selector(ModListLayer::onCheckForUpdates) ); m_checkForUpdatesBtn->setPosition(0, -winSize.height / 2 + 40.f); diff --git a/loader/src/ui/internal/list/ModListLayer.hpp b/loader/src/ui/internal/list/ModListLayer.hpp index 0afa2839..f9a3780a 100644 --- a/loader/src/ui/internal/list/ModListLayer.hpp +++ b/loader/src/ui/internal/list/ModListLayer.hpp @@ -1,6 +1,7 @@ #pragma once #include +#include #include using namespace geode::prelude; @@ -54,13 +55,13 @@ protected: CCMenuItemToggler* m_installedTabBtn; CCMenuItemToggler* m_downloadTabBtn; CCMenuItemToggler* m_featuredTabBtn; - CCMenuItemSpriteExtra* m_searchBtn; - CCMenuItemSpriteExtra* m_searchClearBtn; - CCMenuItemSpriteExtra* m_checkForUpdatesBtn = nullptr; + MenuItemSpriteExtra* m_searchBtn; + MenuItemSpriteExtra* m_searchClearBtn; + MenuItemSpriteExtra* m_checkForUpdatesBtn = nullptr; CCNode* m_searchBG = nullptr; CCTextInputNode* m_searchInput = nullptr; LoadingCircle* m_loadingCircle = nullptr; - CCMenuItemSpriteExtra* m_filterBtn; + MenuItemSpriteExtra* m_filterBtn; ModListQuery m_query; ModListDisplay m_display = ModListDisplay::Concise; EventListener m_indexListener; diff --git a/loader/src/ui/internal/list/ProblemsListCell.cpp b/loader/src/ui/internal/list/ProblemsListCell.cpp index faa2086b..4b545b70 100644 --- a/loader/src/ui/internal/list/ProblemsListCell.cpp +++ b/loader/src/ui/internal/list/ProblemsListCell.cpp @@ -1,7 +1,7 @@ #include "ProblemsListCell.hpp" #include "ProblemsListPopup.hpp" #include -#include +#include #include #include #include @@ -115,7 +115,7 @@ bool ProblemsListCell::init(LoadProblem problem, ProblemsListPopup* list, CCSize viewSpr->setScale(.65f); auto viewBtn = - CCMenuItemSpriteExtra::create(viewSpr, this, menu_selector(ProblemsListCell::onMore)); + MenuItemSpriteExtra::create(viewSpr, this, menu_selector(ProblemsListCell::onMore)); m_menu->addChild(viewBtn); } diff --git a/loader/src/ui/internal/settings/GeodeSettingNode.cpp b/loader/src/ui/internal/settings/GeodeSettingNode.cpp index 28a37e1e..4f603e5d 100644 --- a/loader/src/ui/internal/settings/GeodeSettingNode.cpp +++ b/loader/src/ui/internal/settings/GeodeSettingNode.cpp @@ -74,7 +74,7 @@ Slider* createSlider(C* node, GeodeSettingValue* setting, float width) { template std::pair< - CCMenuItemSpriteExtra*, CCMenuItemSpriteExtra* + MenuItemSpriteExtra*, MenuItemSpriteExtra* > createArrows(C* node, GeodeSettingValue* setting, float width, bool big) { auto yPos = setting->castDefinition().controls.slider ? 5.f : 0.f; auto decArrowSpr = CCSprite::createWithSpriteFrameName( @@ -83,7 +83,7 @@ std::pair< decArrowSpr->setFlipX(true); decArrowSpr->setScale(.3f); - auto decArrow = CCMenuItemSpriteExtra::create( + auto decArrow = MenuItemSpriteExtra::create( decArrowSpr, node, menu_selector(C::onArrow) ); decArrow->setPosition(-width / 2 + (big ? 65.f : 80.f), yPos); @@ -97,7 +97,7 @@ std::pair< ); incArrowSpr->setScale(.3f); - auto incArrow = CCMenuItemSpriteExtra::create( + auto incArrow = MenuItemSpriteExtra::create( incArrowSpr, node, menu_selector(C::onArrow) ); incArrow->setTag(big ? @@ -377,7 +377,7 @@ bool FileSettingNode::setup(FileSettingValue* setting, float width) { auto fileBtnSpr = CCSprite::createWithSpriteFrameName("gj_folderBtn_001.png"); fileBtnSpr->setScale(.5f); - auto fileBtn = CCMenuItemSpriteExtra::create( + auto fileBtn = MenuItemSpriteExtra::create( fileBtnSpr, this, menu_selector(FileSettingNode::onPickFile) ); fileBtn->setPosition(.0f, .0f); @@ -410,7 +410,7 @@ bool ColorSettingNode::setup(ColorSettingValue* setting, float width) { m_colorSpr->setColor(m_uncommittedValue); m_colorSpr->setScale(.65f); - auto button = CCMenuItemSpriteExtra::create( + auto button = MenuItemSpriteExtra::create( m_colorSpr, this, menu_selector(ColorSettingNode::onSelectColor) ); button->setPositionX(-10.f); @@ -445,7 +445,7 @@ bool ColorAlphaSettingNode::setup(ColorAlphaSettingValue* setting, float width) m_colorSpr->updateOpacity(m_uncommittedValue.a / 255.f); m_colorSpr->setScale(.65f); - auto button = CCMenuItemSpriteExtra::create( + auto button = MenuItemSpriteExtra::create( m_colorSpr, this, menu_selector(ColorAlphaSettingNode::onSelectColor) ); button->setPositionX(-10.f); diff --git a/loader/src/ui/internal/settings/GeodeSettingNode.hpp b/loader/src/ui/internal/settings/GeodeSettingNode.hpp index c32a6066..2a320b53 100644 --- a/loader/src/ui/internal/settings/GeodeSettingNode.hpp +++ b/loader/src/ui/internal/settings/GeodeSettingNode.hpp @@ -1,6 +1,6 @@ #pragma once -#include +#include #include #include #include @@ -40,7 +40,7 @@ protected: CCMenu* m_menu; CCLabelBMFont* m_nameLabel; CCLabelBMFont* m_errorLabel; - CCMenuItemSpriteExtra* m_resetBtn; + MenuItemSpriteExtra* m_resetBtn; bool init(GeodeSettingValue* setting, float width) { if (!SettingNode::init(setting)) @@ -81,7 +81,7 @@ protected: auto infoSpr = CCSprite::createWithSpriteFrameName("GJ_infoIcon_001.png"); infoSpr->setScale(.6f); - auto infoBtn = CCMenuItemSpriteExtra::create( + auto infoBtn = MenuItemSpriteExtra::create( infoSpr, this, menu_selector(GeodeSettingNode::onDescription) ); infoBtn->setPosition( @@ -97,7 +97,7 @@ protected: auto resetBtnSpr = CCSprite::createWithSpriteFrameName("reset-gold.png"_spr); resetBtnSpr->setScale(.5f); - m_resetBtn = CCMenuItemSpriteExtra::create( + m_resetBtn = MenuItemSpriteExtra::create( resetBtnSpr, this, menu_selector(GeodeSettingNode::onReset) ); m_resetBtn->setPosition( @@ -210,10 +210,10 @@ protected: InputNode* m_input = nullptr; CCLabelBMFont* m_label = nullptr; Slider* m_slider = nullptr; - CCMenuItemSpriteExtra* m_decArrow = nullptr; - CCMenuItemSpriteExtra* m_incArrow = nullptr; - CCMenuItemSpriteExtra* m_bigDecArrow = nullptr; - CCMenuItemSpriteExtra* m_bigIncArrow = nullptr; + MenuItemSpriteExtra* m_decArrow = nullptr; + MenuItemSpriteExtra* m_incArrow = nullptr; + MenuItemSpriteExtra* m_bigDecArrow = nullptr; + MenuItemSpriteExtra* m_bigIncArrow = nullptr; void valueChanged(bool updateText) override; void textChanged(CCTextInputNode* input) override; @@ -239,10 +239,10 @@ protected: InputNode* m_input = nullptr; CCLabelBMFont* m_label = nullptr; Slider* m_slider = nullptr; - CCMenuItemSpriteExtra* m_decArrow = nullptr; - CCMenuItemSpriteExtra* m_incArrow = nullptr; - CCMenuItemSpriteExtra* m_bigDecArrow = nullptr; - CCMenuItemSpriteExtra* m_bigIncArrow = nullptr; + MenuItemSpriteExtra* m_decArrow = nullptr; + MenuItemSpriteExtra* m_incArrow = nullptr; + MenuItemSpriteExtra* m_bigDecArrow = nullptr; + MenuItemSpriteExtra* m_bigIncArrow = nullptr; void valueChanged(bool updateText) override; void textChanged(CCTextInputNode* input) override; diff --git a/loader/src/ui/internal/settings/ModSettingsPopup.cpp b/loader/src/ui/internal/settings/ModSettingsPopup.cpp index 60f4b6f6..369041a1 100644 --- a/loader/src/ui/internal/settings/ModSettingsPopup.cpp +++ b/loader/src/ui/internal/settings/ModSettingsPopup.cpp @@ -90,7 +90,7 @@ bool ModSettingsPopup::setup(Mod* mod) { m_applyBtnSpr = ButtonSprite::create("Apply", "goldFont.fnt", "GJ_button_01.png", .7f); m_applyBtnSpr->setScale(.7f); - m_applyBtn = CCMenuItemSpriteExtra::create( + m_applyBtn = MenuItemSpriteExtra::create( m_applyBtnSpr, this, menu_selector(ModSettingsPopup::onApply) ); m_applyBtn->setPosition(.0f, -m_size.height / 2 + 20.f); @@ -99,7 +99,7 @@ bool ModSettingsPopup::setup(Mod* mod) { auto resetBtnSpr = ButtonSprite::create("Reset All", "goldFont.fnt", "GJ_button_05.png", .7f); resetBtnSpr->setScale(.7f); - auto resetBtn = CCMenuItemSpriteExtra::create( + auto resetBtn = MenuItemSpriteExtra::create( resetBtnSpr, this, menu_selector(ModSettingsPopup::onResetAll) ); resetBtn->setPosition(-m_size.width / 2 + 45.f, -m_size.height / 2 + 20.f); @@ -109,7 +109,7 @@ bool ModSettingsPopup::setup(Mod* mod) { ButtonSprite::create("Open Folder", "goldFont.fnt", "GJ_button_05.png", .7f); openDirBtnSpr->setScale(.7f); - auto openDirBtn = CCMenuItemSpriteExtra::create( + auto openDirBtn = MenuItemSpriteExtra::create( openDirBtnSpr, this, menu_selector(ModSettingsPopup::onOpenSaveDirectory) ); openDirBtn->setPosition(m_size.width / 2 - 53.f, -m_size.height / 2 + 20.f); diff --git a/loader/src/ui/internal/settings/ModSettingsPopup.hpp b/loader/src/ui/internal/settings/ModSettingsPopup.hpp index 834214d5..d861e241 100644 --- a/loader/src/ui/internal/settings/ModSettingsPopup.hpp +++ b/loader/src/ui/internal/settings/ModSettingsPopup.hpp @@ -10,7 +10,7 @@ class ModSettingsPopup : public Popup, public SettingNodeDelegate { protected: Mod* m_mod; std::vector m_settings; - CCMenuItemSpriteExtra* m_applyBtn; + MenuItemSpriteExtra* m_applyBtn; ButtonSprite* m_applyBtnSpr; void settingValueChanged(SettingNode*) override; diff --git a/loader/src/ui/nodes/ColorPickPopup.cpp b/loader/src/ui/nodes/ColorPickPopup.cpp index 0fafb50f..db7b6a10 100644 --- a/loader/src/ui/nodes/ColorPickPopup.cpp +++ b/loader/src/ui/nodes/ColorPickPopup.cpp @@ -157,7 +157,7 @@ bool ColorPickPopup::setup(ccColor4B const& color, bool isRGBA) { okBtnSpr->setScale(.7f); auto okBtn = - CCMenuItemSpriteExtra::create(okBtnSpr, this, menu_selector(ColorPickPopup::onClose)); + MenuItemSpriteExtra::create(okBtnSpr, this, menu_selector(ColorPickPopup::onClose)); okBtn->setPosition(.0f, -m_size.height / 2 + 20.f); m_buttonMenu->addChild(okBtn); diff --git a/loader/src/ui/nodes/MDPopup.cpp b/loader/src/ui/nodes/MDPopup.cpp index 2f0929da..39d5153e 100644 --- a/loader/src/ui/nodes/MDPopup.cpp +++ b/loader/src/ui/nodes/MDPopup.cpp @@ -24,14 +24,14 @@ bool MDPopup::setup( auto btnSpr = ButtonSprite::create(btn1Text); - auto btn = CCMenuItemSpriteExtra::create(btnSpr, this, menu_selector(MDPopup::onBtn)); + auto btn = MenuItemSpriteExtra::create(btnSpr, this, menu_selector(MDPopup::onBtn)); btn->setTag(0); m_buttonMenu->addChild(btn); if (btn2Text) { auto btn2Spr = ButtonSprite::create(btn2Text); - auto btn2 = CCMenuItemSpriteExtra::create(btn2Spr, this, menu_selector(MDPopup::onBtn)); + auto btn2 = MenuItemSpriteExtra::create(btn2Spr, this, menu_selector(MDPopup::onBtn)); btn2->setTag(1); m_buttonMenu->addChild(btn2); diff --git a/loader/src/ui/nodes/MenuItemSprite.cpp b/loader/src/ui/nodes/MenuItemSpriteExtra.cpp similarity index 58% rename from loader/src/ui/nodes/MenuItemSprite.cpp rename to loader/src/ui/nodes/MenuItemSpriteExtra.cpp index cb6ec2a2..64a71e64 100644 --- a/loader/src/ui/nodes/MenuItemSprite.cpp +++ b/loader/src/ui/nodes/MenuItemSpriteExtra.cpp @@ -1,19 +1,19 @@ -#include +#include using namespace geode::prelude; -MenuItemSprite* MenuItemSprite::create( +MenuItemSpriteExtra* MenuItemSpriteExtra::create( cocos2d::CCNode* normalSprite, cocos2d::CCObject* target, cocos2d::SEL_MenuHandler callback ) { - return MenuItemSprite::create(normalSprite, nullptr, target, callback); + return MenuItemSpriteExtra::create(normalSprite, nullptr, target, callback); } -MenuItemSprite* MenuItemSprite::create( +MenuItemSpriteExtra* MenuItemSpriteExtra::create( cocos2d::CCNode* normalSprite, cocos2d::CCNode* disabledSprite, cocos2d::CCObject* target, cocos2d::SEL_MenuHandler callback ) { - auto ret = new MenuItemSprite(); + auto ret = new MenuItemSpriteExtra(); if (ret && ret->init(normalSprite, disabledSprite, target, callback)) { ret->autorelease(); return ret; @@ -22,12 +22,12 @@ MenuItemSprite* MenuItemSprite::create( return nullptr; } -MenuItemSprite::MenuItemSprite() {} +MenuItemSpriteExtra::MenuItemSpriteExtra() : m_scaleSprites(false) {} -MenuItemSprite::~MenuItemSprite() { +MenuItemSpriteExtra::~MenuItemSpriteExtra() { } -void MenuItemSprite::setImage(cocos2d::CCNode* image) { +void MenuItemSpriteExtra::setImage(cocos2d::CCNode* image) { if (image) { image->setAnchorPoint({ 0.5f, 0.5f }); image->setPosition(image->getContentSize() / 2); @@ -35,20 +35,20 @@ void MenuItemSprite::setImage(cocos2d::CCNode* image) { } // why are the members private like what -void MenuItemSprite::setNormalImage(cocos2d::CCNode* image) { +void MenuItemSpriteExtra::setNormalImage(cocos2d::CCNode* image) { CCMenuItemSprite::setNormalImage(image); this->setImage(image); } -void MenuItemSprite::setDisabledImage(cocos2d::CCNode* image) { +void MenuItemSpriteExtra::setDisabledImage(cocos2d::CCNode* image) { CCMenuItemSprite::setDisabledImage(image); this->setImage(image); } -void MenuItemSprite::setSelectedImage(cocos2d::CCNode* image) { +void MenuItemSpriteExtra::setSelectedImage(cocos2d::CCNode* image) { CCMenuItemSprite::setSelectedImage(image); this->setImage(image); } -bool MenuItemSprite::init( +bool MenuItemSpriteExtra::init( cocos2d::CCNode* normalSprite, cocos2d::CCNode* disabledSprite, cocos2d::CCObject* target, cocos2d::SEL_MenuHandler callback ) { @@ -67,32 +67,41 @@ bool MenuItemSprite::init( return true; } -void MenuItemSprite::runActionOnSprite(cocos2d::CCNode* sprite, cocos2d::CCAction* generator) { +void MenuItemSpriteExtra::runActionOnSprite(cocos2d::CCNode* sprite, cocos2d::CCAction* generator) { if (sprite) { sprite->stopAllActions(); if (generator) sprite->runAction(generator); } } -void MenuItemSprite::runActionOnSprites(MiniFunction generator) { - this->runActionOnSprite(this->getNormalImage(), generator()); - this->runActionOnSprite(this->getDisabledImage(), generator()); - this->runActionOnSprite(this->getSelectedImage(), generator()); +void MenuItemSpriteExtra::runActionOnSprites(MiniFunction generator) { + if (m_scaleSprites) { + this->runActionOnSprite(this->getNormalImage(), generator()); + this->runActionOnSprite(this->getDisabledImage(), generator()); + this->runActionOnSprite(this->getSelectedImage(), generator()); + } + else { + if (auto action = generator()) this->runAction(action); + } } -void MenuItemSprite::activate() { +void MenuItemSpriteExtra::activate() { this->runActionOnSprites(m_activateAction); CCMenuItem::activate(); } -void MenuItemSprite::selected() { +void MenuItemSpriteExtra::selected() { if (!m_bEnabled) return; CCMenuItem::selected(); this->runActionOnSprites(m_selectedAction); } -void MenuItemSprite::unselected() { +void MenuItemSpriteExtra::unselected() { if (!m_bEnabled) return; CCMenuItem::unselected(); this->runActionOnSprites(m_unselectedAction); +} + +void MenuItemSpriteExtra::setScaleSprites(bool scale) { + m_scaleSprites = scale; } \ No newline at end of file diff --git a/loader/test/dependency/main.cpp b/loader/test/dependency/main.cpp index 2f6bd35d..4a2713b6 100644 --- a/loader/test/dependency/main.cpp +++ b/loader/test/dependency/main.cpp @@ -2,7 +2,7 @@ #include #include #include -#include +#include #include #include "main.hpp" @@ -92,7 +92,7 @@ protected: } else { btnSpr->setColor({ 200, 200, 200 }); } - auto btn = CCMenuItemSpriteExtra::create( + auto btn = MenuItemSpriteExtra::create( btnSpr, this, menu_selector(MySettingNode::onSelect) ); btn->setTag(static_cast(icon)); @@ -113,7 +113,7 @@ protected: } m_currentIcon = static_cast(sender->getTag()); static_cast( - static_cast(sender)->getNormalImage() + static_cast(sender)->getNormalImage() )->setColor({ 0, 255, 0 }); this->dispatchChanged(); } From dcc40f11e1161cfd6e7dcb6512e3b2be72e6068f Mon Sep 17 00:00:00 2001 From: altalk23 <45172705+altalk23@users.noreply.github.com> Date: Wed, 20 Sep 2023 17:37:30 +0300 Subject: [PATCH 50/98] Revert "Fix some stuff related to menuitemspriteextra but gonna revert" This reverts commit e8b98e48f558af95ea14fc902a0a26967be24fc5. --- loader/include/Geode/UI.hpp | 1 - ...ItemSpriteExtra.hpp => MenuItemSprite.hpp} | 13 ++--- loader/include/Geode/ui/MenuItemToggle.hpp | 14 +++--- loader/src/hooks/MenuLayer.cpp | 2 +- loader/src/ui/internal/info/ModInfoPopup.cpp | 20 ++++---- loader/src/ui/internal/info/ModInfoPopup.hpp | 5 +- .../src/ui/internal/list/InstallListCell.cpp | 5 +- .../src/ui/internal/list/InstallListPopup.cpp | 2 +- loader/src/ui/internal/list/ModListCell.cpp | 17 ++++--- loader/src/ui/internal/list/ModListCell.hpp | 5 +- loader/src/ui/internal/list/ModListLayer.cpp | 16 +++--- loader/src/ui/internal/list/ModListLayer.hpp | 9 ++-- .../src/ui/internal/list/ProblemsListCell.cpp | 4 +- .../ui/internal/settings/GeodeSettingNode.cpp | 12 ++--- .../ui/internal/settings/GeodeSettingNode.hpp | 24 ++++----- .../ui/internal/settings/ModSettingsPopup.cpp | 6 +-- .../ui/internal/settings/ModSettingsPopup.hpp | 2 +- loader/src/ui/nodes/ColorPickPopup.cpp | 2 +- loader/src/ui/nodes/MDPopup.cpp | 4 +- ...ItemSpriteExtra.cpp => MenuItemSprite.cpp} | 49 ++++++++----------- loader/test/dependency/main.cpp | 6 +-- 21 files changed, 103 insertions(+), 115 deletions(-) rename loader/include/Geode/ui/{MenuItemSpriteExtra.hpp => MenuItemSprite.hpp} (81%) rename loader/src/ui/nodes/{MenuItemSpriteExtra.cpp => MenuItemSprite.cpp} (58%) diff --git a/loader/include/Geode/UI.hpp b/loader/include/Geode/UI.hpp index fc326ce6..2330064c 100644 --- a/loader/include/Geode/UI.hpp +++ b/loader/include/Geode/UI.hpp @@ -10,7 +10,6 @@ #include "ui/ListView.hpp" #include "ui/MDPopup.hpp" #include "ui/MDTextArea.hpp" -#include "ui/MenuItemSpriteExtra.hpp" #include "ui/Notification.hpp" #include "ui/Popup.hpp" #include "ui/SceneManager.hpp" diff --git a/loader/include/Geode/ui/MenuItemSpriteExtra.hpp b/loader/include/Geode/ui/MenuItemSprite.hpp similarity index 81% rename from loader/include/Geode/ui/MenuItemSpriteExtra.hpp rename to loader/include/Geode/ui/MenuItemSprite.hpp index 776519ed..113eb80d 100644 --- a/loader/include/Geode/ui/MenuItemSpriteExtra.hpp +++ b/loader/include/Geode/ui/MenuItemSprite.hpp @@ -6,20 +6,19 @@ #pragma warning(disable : 4275) namespace geode { - class GEODE_DLL MenuItemSpriteExtra : public cocos2d::CCMenuItemSprite { + class GEODE_DLL MenuItemSprite : public cocos2d::CCMenuItemSprite { protected: - bool m_scaleSprites; - MenuItemSpriteExtra(); - ~MenuItemSpriteExtra() override; + MenuItemSprite(); + ~MenuItemSprite() override; public: - static MenuItemSpriteExtra* create( + static MenuItemSprite* create( cocos2d::CCNode* normalSprite, cocos2d::CCNode* disabledSprite, cocos2d::CCObject* target, cocos2d::SEL_MenuHandler callback ); - static MenuItemSpriteExtra* create( + static MenuItemSprite* create( cocos2d::CCNode* normalSprite, cocos2d::CCObject* target, cocos2d::SEL_MenuHandler callback ); @@ -40,8 +39,6 @@ namespace geode { void selected() override; void unselected() override; - void setScaleSprites(bool scale); - void setImage(cocos2d::CCNode* image); void setNormalImage(cocos2d::CCNode* image) override; void setDisabledImage(cocos2d::CCNode* image) override; diff --git a/loader/include/Geode/ui/MenuItemToggle.hpp b/loader/include/Geode/ui/MenuItemToggle.hpp index 2e704c8a..6399773a 100644 --- a/loader/include/Geode/ui/MenuItemToggle.hpp +++ b/loader/include/Geode/ui/MenuItemToggle.hpp @@ -1,15 +1,15 @@ #pragma once #include -#include "MenuItemSpriteExtra.hpp" +#include "MenuItemSprite.hpp" #pragma warning(disable : 4275) namespace geode { class GEODE_DLL MenuItemToggle : public cocos2d::CCMenuItem { protected: - MenuItemSpriteExtra* m_offButton; - MenuItemSpriteExtra* m_onButton; + MenuItemSprite* m_offButton; + MenuItemSprite* m_onButton; bool m_toggled; MenuItemToggle(); @@ -26,10 +26,10 @@ namespace geode { cocos2d::CCObject* target, cocos2d::SEL_MenuHandler callback ); - void setOffButton(MenuItemSpriteExtra* button); - void setOnButton(MenuItemSpriteExtra* button); - MenuItemSpriteExtra* getOffButton() const; - MenuItemSpriteExtra* getOnButton() const; + void setOffButton(MenuItemSprite* button); + void setOnButton(MenuItemSprite* button); + MenuItemSprite* getOffButton() const; + MenuItemSprite* getOnButton() const; bool isToggled() const; void toggle(bool enabled); diff --git a/loader/src/hooks/MenuLayer.cpp b/loader/src/hooks/MenuLayer.cpp index 4bddc8f1..869d1bce 100644 --- a/loader/src/hooks/MenuLayer.cpp +++ b/loader/src/hooks/MenuLayer.cpp @@ -77,7 +77,7 @@ struct CustomMenuLayer : Modify { auto bottomMenu = static_cast(this->getChildByID("bottom-menu")); - auto btn = MenuItemSpriteExtra::create( + auto btn = CCMenuItemSpriteExtra::create( m_fields->m_geodeButton, this, static_cast(geodeBtnSelector) ); diff --git a/loader/src/ui/internal/info/ModInfoPopup.cpp b/loader/src/ui/internal/info/ModInfoPopup.cpp index d1c5c230..945e5ec4 100644 --- a/loader/src/ui/internal/info/ModInfoPopup.cpp +++ b/loader/src/ui/internal/info/ModInfoPopup.cpp @@ -151,13 +151,13 @@ bool ModInfoPopup::init(ModMetadata const& metadata, ModListLayer* list) { auto infoSpr = CCSprite::createWithSpriteFrameName("GJ_infoIcon_001.png"); infoSpr->setScale(.85f); - m_infoBtn = MenuItemSpriteExtra::create(infoSpr, this, menu_selector(ModInfoPopup::onInfo)); + m_infoBtn = CCMenuItemSpriteExtra::create(infoSpr, this, menu_selector(ModInfoPopup::onInfo)); m_infoBtn->setPosition(LAYER_SIZE.width / 2 - 25.f, LAYER_SIZE.height / 2 - 25.f); m_buttonMenu->addChild(m_infoBtn); // repo button if (metadata.getRepository()) { - auto repoBtn = MenuItemSpriteExtra::create( + auto repoBtn = CCMenuItemSpriteExtra::create( CCSprite::createWithSpriteFrameName("github.png"_spr), this, menu_selector(ModInfoPopup::onRepository) @@ -168,7 +168,7 @@ bool ModInfoPopup::init(ModMetadata const& metadata, ModListLayer* list) { // support button if (metadata.getSupportInfo()) { - auto supportBtn = MenuItemSpriteExtra::create( + auto supportBtn = CCMenuItemSpriteExtra::create( CCSprite::createWithSpriteFrameName("gift.png"_spr), this, menu_selector(ModInfoPopup::onSupport) @@ -181,7 +181,7 @@ bool ModInfoPopup::init(ModMetadata const& metadata, ModListLayer* list) { closeSpr->setScale(.8f); auto closeBtn = - MenuItemSpriteExtra::create(closeSpr, this, menu_selector(ModInfoPopup::onClose)); + CCMenuItemSpriteExtra::create(closeSpr, this, menu_selector(ModInfoPopup::onClose)); closeBtn->setPosition(-LAYER_SIZE.width / 2 + 3.f, LAYER_SIZE.height / 2 - 3.f); m_buttonMenu->addChild(closeBtn); @@ -399,7 +399,7 @@ bool LocalModInfoPopup::init(Mod* mod, ModListLayer* list) { settingsSpr->setScale(.65f); auto settingsBtn = - MenuItemSpriteExtra::create(settingsSpr, this, menu_selector(LocalModInfoPopup::onSettings)); + CCMenuItemSpriteExtra::create(settingsSpr, this, menu_selector(LocalModInfoPopup::onSettings)); settingsBtn->setPosition(-LAYER_SIZE.width / 2 + 25.f, -LAYER_SIZE.height / 2 + 25.f); m_buttonMenu->addChild(settingsBtn); @@ -410,7 +410,7 @@ bool LocalModInfoPopup::init(Mod* mod, ModListLayer* list) { ); configSpr->setScale(.65f); - auto configBtn = MenuItemSpriteExtra::create( + auto configBtn = CCMenuItemSpriteExtra::create( configSpr, this, menu_selector(LocalModInfoPopup::onOpenConfigDir) ); configBtn->setPosition(-LAYER_SIZE.width / 2 + 65.f, -LAYER_SIZE.height / 2 + 25.f); @@ -451,7 +451,7 @@ bool LocalModInfoPopup::init(Mod* mod, ModListLayer* list) { ButtonSprite::create("Uninstall", "bigFont.fnt", "GJ_button_05.png", .6f); uninstallBtnSpr->setScale(.6f); - auto uninstallBtn = MenuItemSpriteExtra::create( + auto uninstallBtn = CCMenuItemSpriteExtra::create( uninstallBtnSpr, this, menu_selector(LocalModInfoPopup::onUninstall) ); uninstallBtn->setPosition(-85.f, 75.f); @@ -467,7 +467,7 @@ bool LocalModInfoPopup::init(Mod* mod, ModListLayer* list) { ); m_installBtnSpr->setScale(.6f); - m_installBtn = MenuItemSpriteExtra::create(m_installBtnSpr, this, menu_selector(LocalModInfoPopup::onUpdate)); + m_installBtn = CCMenuItemSpriteExtra::create(m_installBtnSpr, this, menu_selector(LocalModInfoPopup::onUpdate)); m_installBtn->setPosition(-8.0f, 75.f); m_buttonMenu->addChild(m_installBtn); @@ -536,7 +536,7 @@ bool LocalModInfoPopup::init(Mod* mod, ModListLayer* list) { ); issuesBtnSpr->setScale(.75f); - auto issuesBtn = MenuItemSpriteExtra::create( + auto issuesBtn = CCMenuItemSpriteExtra::create( issuesBtnSpr, this, menu_selector(LocalModInfoPopup::onIssues) ); issuesBtn->setPosition(0.f, -LAYER_SIZE.height / 2 + 25.f); @@ -726,7 +726,7 @@ bool IndexItemInfoPopup::init(IndexItemHandle item, ModListLayer* list) { ); m_installBtnSpr->setScale(.6f); - m_installBtn = MenuItemSpriteExtra::create( + m_installBtn = CCMenuItemSpriteExtra::create( m_installBtnSpr, this, menu_selector(IndexItemInfoPopup::onInstall) ); m_installBtn->setPosition(-143.0f, 75.f); diff --git a/loader/src/ui/internal/info/ModInfoPopup.hpp b/loader/src/ui/internal/info/ModInfoPopup.hpp index e9ab045a..808cd918 100644 --- a/loader/src/ui/internal/info/ModInfoPopup.hpp +++ b/loader/src/ui/internal/info/ModInfoPopup.hpp @@ -6,7 +6,6 @@ #include #include #include -#include using namespace geode::prelude; @@ -32,8 +31,8 @@ protected: ModListLayer* m_layer = nullptr; DownloadStatusNode* m_installStatus = nullptr; IconButtonSprite* m_installBtnSpr; - MenuItemSpriteExtra* m_installBtn; - MenuItemSpriteExtra* m_infoBtn; + CCMenuItemSpriteExtra* m_installBtn; + CCMenuItemSpriteExtra* m_infoBtn; CCLabelBMFont* m_latestVersionLabel = nullptr; CCLabelBMFont* m_minorVersionLabel = nullptr; MDTextArea* m_detailsArea; diff --git a/loader/src/ui/internal/list/InstallListCell.cpp b/loader/src/ui/internal/list/InstallListCell.cpp index ce309181..352d8aaf 100644 --- a/loader/src/ui/internal/list/InstallListCell.cpp +++ b/loader/src/ui/internal/list/InstallListCell.cpp @@ -1,6 +1,7 @@ #include "InstallListCell.hpp" #include "InstallListPopup.hpp" #include +#include #include #include #include @@ -212,7 +213,7 @@ bool IndexItemInstallListCell::init( versionSelectSpr->setScale(.7f); auto versionSelectBtn = - MenuItemSpriteExtra::create(versionSelectSpr, this, menu_selector(IndexItemInstallListCell::onSelectVersion)); + CCMenuItemSpriteExtra::create(versionSelectSpr, this, menu_selector(IndexItemInstallListCell::onSelectVersion)); versionSelectBtn->setAnchorPoint({1.f, .5f}); versionSelectBtn->setPosition({m_toggle->getPositionX() - m_toggle->getContentSize().width - 5, m_height / 2}); m_menu->addChild(versionSelectBtn); @@ -371,7 +372,7 @@ bool SelectVersionCell::init(IndexItemHandle item, SelectVersionPopup* versionPo ); selectSpr->setScale(.6f); - auto selectBtn = MenuItemSpriteExtra::create( + auto selectBtn = CCMenuItemSpriteExtra::create( selectSpr, this, menu_selector(SelectVersionCell::onSelected) ); selectBtn->setAnchorPoint({1.f, .5f}); diff --git a/loader/src/ui/internal/list/InstallListPopup.cpp b/loader/src/ui/internal/list/InstallListPopup.cpp index 2acbb670..e561ca9b 100644 --- a/loader/src/ui/internal/list/InstallListPopup.cpp +++ b/loader/src/ui/internal/list/InstallListPopup.cpp @@ -22,7 +22,7 @@ bool InstallListPopup::setup(IndexItemHandle item, MiniFunctionsetScale(.6f); - auto installBtn = MenuItemSpriteExtra::create( + auto installBtn = CCMenuItemSpriteExtra::create( installBtnSpr, this, menu_selector(InstallListPopup::onInstall) diff --git a/loader/src/ui/internal/list/ModListCell.cpp b/loader/src/ui/internal/list/ModListCell.cpp index b1614011..061e6dcb 100644 --- a/loader/src/ui/internal/list/ModListCell.cpp +++ b/loader/src/ui/internal/list/ModListCell.cpp @@ -2,6 +2,7 @@ #include "ModListLayer.hpp" #include "../info/ModInfoPopup.hpp" #include +#include #include #include #include @@ -143,7 +144,7 @@ void ModListCell::setupInfo( creatorLabel->setColor({ 163, 163, 163 }); } - m_developerBtn = MenuItemSpriteExtra::create( + m_developerBtn = CCMenuItemSpriteExtra::create( creatorLabel, this, menu_selector(ModListCell::onViewDev) ); m_columnMenu->addChild(m_developerBtn); @@ -291,7 +292,7 @@ bool ModCell::init( exMark->setScale(.5f); m_unresolvedExMark = - MenuItemSpriteExtra::create(exMark, this, menu_selector(ModCell::onUnresolvedInfo)); + CCMenuItemSpriteExtra::create(exMark, this, menu_selector(ModCell::onUnresolvedInfo)); m_unresolvedExMark->setVisible(false); m_menu->addChild(m_unresolvedExMark); @@ -299,7 +300,7 @@ bool ModCell::init( auto restartSpr = ButtonSprite::create("Restart", "bigFont.fnt", "GJ_button_03.png", .8f); restartSpr->setScale(.65f); - auto restartBtn = MenuItemSpriteExtra::create(restartSpr, this, menu_selector(ModCell::onRestart)); + auto restartBtn = CCMenuItemSpriteExtra::create(restartSpr, this, menu_selector(ModCell::onRestart)); m_menu->addChild(restartBtn); } else { @@ -334,7 +335,7 @@ bool ModCell::init( } } - auto viewBtn = MenuItemSpriteExtra::create(viewSpr, this, menu_selector(ModCell::onInfo)); + auto viewBtn = CCMenuItemSpriteExtra::create(viewSpr, this, menu_selector(ModCell::onInfo)); m_menu->addChild(viewBtn); } @@ -394,7 +395,7 @@ bool IndexItemCell::init( auto restartSpr = ButtonSprite::create("Restart", "bigFont.fnt", "GJ_button_03.png", .8f); restartSpr->setScale(.65f); - auto restartBtn = MenuItemSpriteExtra::create(restartSpr, this, menu_selector(IndexItemCell::onRestart)); + auto restartBtn = CCMenuItemSpriteExtra::create(restartSpr, this, menu_selector(IndexItemCell::onRestart)); m_menu->addChild(restartBtn); } else { @@ -402,7 +403,7 @@ bool IndexItemCell::init( viewSpr->setScale(.65f); auto viewBtn = - MenuItemSpriteExtra::create(viewSpr, this, menu_selector(IndexItemCell::onInfo)); + CCMenuItemSpriteExtra::create(viewSpr, this, menu_selector(IndexItemCell::onInfo)); m_menu->addChild(viewBtn); } @@ -516,7 +517,7 @@ bool InvalidGeodeFileCell::init( whySpr->setScale(.65f); auto viewBtn = - MenuItemSpriteExtra::create(whySpr, this, menu_selector(InvalidGeodeFileCell::onInfo)); + CCMenuItemSpriteExtra::create(whySpr, this, menu_selector(InvalidGeodeFileCell::onInfo)); menu->addChild(viewBtn); return true; @@ -634,7 +635,7 @@ bool ProblemsCell::init( viewSpr->setScale(.65f); auto viewBtn = - MenuItemSpriteExtra::create(viewSpr, this, menu_selector(ProblemsCell::onInfo)); + CCMenuItemSpriteExtra::create(viewSpr, this, menu_selector(ProblemsCell::onInfo)); m_menu->addChild(viewBtn); m_menu->updateLayout(); diff --git a/loader/src/ui/internal/list/ModListCell.hpp b/loader/src/ui/internal/list/ModListCell.hpp index 446f5b06..28e253d9 100644 --- a/loader/src/ui/internal/list/ModListCell.hpp +++ b/loader/src/ui/internal/list/ModListCell.hpp @@ -5,7 +5,6 @@ #include #include #include -#include using namespace geode::prelude; @@ -23,8 +22,8 @@ protected: CCMenu* m_menu; CCLabelBMFont* m_description; CCMenuItemToggler* m_enableToggle = nullptr; - MenuItemSpriteExtra* m_unresolvedExMark; - MenuItemSpriteExtra* m_developerBtn; + CCMenuItemSpriteExtra* m_unresolvedExMark; + CCMenuItemSpriteExtra* m_developerBtn; SpacerNode* m_spacer = nullptr; CCMenu* m_columnMenu = nullptr; CCMenu* m_labelMenu = nullptr; diff --git a/loader/src/ui/internal/list/ModListLayer.cpp b/loader/src/ui/internal/list/ModListLayer.cpp index 7f44d9ae..e950a521 100644 --- a/loader/src/ui/internal/list/ModListLayer.cpp +++ b/loader/src/ui/internal/list/ModListLayer.cpp @@ -16,6 +16,8 @@ #include #include +#include + #define FTS_FUZZY_MATCH_IMPLEMENTATION #include @@ -259,7 +261,7 @@ bool ModListLayer::init() { m_topMenu = CCMenu::create(); // add back button - auto backBtn = MenuItemSpriteExtra::create( + auto backBtn = MenuItemSprite::create( CCSprite::createWithSpriteFrameName("GJ_arrow_01_001.png"), this, menu_selector(ModListLayer::onExit) ); @@ -270,7 +272,7 @@ bool ModListLayer::init() { auto reloadSpr = CCSprite::createWithSpriteFrameName("GJ_updateBtn_001.png"); reloadSpr->setScale(.8f); auto reloadBtn = - MenuItemSpriteExtra::create(reloadSpr, this, menu_selector(ModListLayer::onReload)); + CCMenuItemSpriteExtra::create(reloadSpr, this, menu_selector(ModListLayer::onReload)); reloadBtn->setPosition(-winSize.width / 2 + 30.0f, -winSize.height / 2 + 30.0f); m_menu->addChild(reloadBtn); @@ -279,7 +281,7 @@ bool ModListLayer::init() { "gj_folderBtn_001.png", .7f, CircleBaseColor::Green, CircleBaseSize::Small ); auto openBtn = - MenuItemSpriteExtra::create(openSpr, this, menu_selector(ModListLayer::onOpenFolder)); + CCMenuItemSpriteExtra::create(openSpr, this, menu_selector(ModListLayer::onOpenFolder)); openBtn->setPosition(-winSize.width / 2 + 30.0f, -winSize.height / 2 + 80.0f); m_menu->addChild(openBtn); @@ -394,7 +396,7 @@ void ModListLayer::createSearchControl() { filterSpr->setScale(.7f); m_filterBtn = - MenuItemSpriteExtra::create(filterSpr, this, menu_selector(ModListLayer::onFilters)); + CCMenuItemSpriteExtra::create(filterSpr, this, menu_selector(ModListLayer::onFilters)); m_filterBtn->setPosition(-10.f, 0.f); menu->addChild(m_filterBtn); @@ -402,14 +404,14 @@ void ModListLayer::createSearchControl() { auto searchSpr = CCSprite::createWithSpriteFrameName("gj_findBtn_001.png"); searchSpr->setScale(.7f); - m_searchBtn = MenuItemSpriteExtra::create(searchSpr, this, nullptr); + m_searchBtn = CCMenuItemSpriteExtra::create(searchSpr, this, nullptr); m_searchBtn->setPosition(-35.f, 0.f); menu->addChild(m_searchBtn); auto searchClearSpr = CCSprite::createWithSpriteFrameName("gj_findBtnOff_001.png"); searchClearSpr->setScale(.7f); - m_searchClearBtn = MenuItemSpriteExtra::create( + m_searchClearBtn = CCMenuItemSpriteExtra::create( searchClearSpr, this, menu_selector(ModListLayer::onResetSearch) ); m_searchClearBtn->setPosition(-35.f, 0.f); @@ -561,7 +563,7 @@ void ModListLayer::reloadList(bool keepScroll, std::optional const if (!m_checkForUpdatesBtn) { auto checkSpr = ButtonSprite::create("Check for Updates"); checkSpr->setScale(.7f); - m_checkForUpdatesBtn = MenuItemSpriteExtra::create( + m_checkForUpdatesBtn = CCMenuItemSpriteExtra::create( checkSpr, this, menu_selector(ModListLayer::onCheckForUpdates) ); m_checkForUpdatesBtn->setPosition(0, -winSize.height / 2 + 40.f); diff --git a/loader/src/ui/internal/list/ModListLayer.hpp b/loader/src/ui/internal/list/ModListLayer.hpp index f9a3780a..0afa2839 100644 --- a/loader/src/ui/internal/list/ModListLayer.hpp +++ b/loader/src/ui/internal/list/ModListLayer.hpp @@ -1,7 +1,6 @@ #pragma once #include -#include #include using namespace geode::prelude; @@ -55,13 +54,13 @@ protected: CCMenuItemToggler* m_installedTabBtn; CCMenuItemToggler* m_downloadTabBtn; CCMenuItemToggler* m_featuredTabBtn; - MenuItemSpriteExtra* m_searchBtn; - MenuItemSpriteExtra* m_searchClearBtn; - MenuItemSpriteExtra* m_checkForUpdatesBtn = nullptr; + CCMenuItemSpriteExtra* m_searchBtn; + CCMenuItemSpriteExtra* m_searchClearBtn; + CCMenuItemSpriteExtra* m_checkForUpdatesBtn = nullptr; CCNode* m_searchBG = nullptr; CCTextInputNode* m_searchInput = nullptr; LoadingCircle* m_loadingCircle = nullptr; - MenuItemSpriteExtra* m_filterBtn; + CCMenuItemSpriteExtra* m_filterBtn; ModListQuery m_query; ModListDisplay m_display = ModListDisplay::Concise; EventListener m_indexListener; diff --git a/loader/src/ui/internal/list/ProblemsListCell.cpp b/loader/src/ui/internal/list/ProblemsListCell.cpp index 4b545b70..faa2086b 100644 --- a/loader/src/ui/internal/list/ProblemsListCell.cpp +++ b/loader/src/ui/internal/list/ProblemsListCell.cpp @@ -1,7 +1,7 @@ #include "ProblemsListCell.hpp" #include "ProblemsListPopup.hpp" #include -#include +#include #include #include #include @@ -115,7 +115,7 @@ bool ProblemsListCell::init(LoadProblem problem, ProblemsListPopup* list, CCSize viewSpr->setScale(.65f); auto viewBtn = - MenuItemSpriteExtra::create(viewSpr, this, menu_selector(ProblemsListCell::onMore)); + CCMenuItemSpriteExtra::create(viewSpr, this, menu_selector(ProblemsListCell::onMore)); m_menu->addChild(viewBtn); } diff --git a/loader/src/ui/internal/settings/GeodeSettingNode.cpp b/loader/src/ui/internal/settings/GeodeSettingNode.cpp index 4f603e5d..28a37e1e 100644 --- a/loader/src/ui/internal/settings/GeodeSettingNode.cpp +++ b/loader/src/ui/internal/settings/GeodeSettingNode.cpp @@ -74,7 +74,7 @@ Slider* createSlider(C* node, GeodeSettingValue* setting, float width) { template std::pair< - MenuItemSpriteExtra*, MenuItemSpriteExtra* + CCMenuItemSpriteExtra*, CCMenuItemSpriteExtra* > createArrows(C* node, GeodeSettingValue* setting, float width, bool big) { auto yPos = setting->castDefinition().controls.slider ? 5.f : 0.f; auto decArrowSpr = CCSprite::createWithSpriteFrameName( @@ -83,7 +83,7 @@ std::pair< decArrowSpr->setFlipX(true); decArrowSpr->setScale(.3f); - auto decArrow = MenuItemSpriteExtra::create( + auto decArrow = CCMenuItemSpriteExtra::create( decArrowSpr, node, menu_selector(C::onArrow) ); decArrow->setPosition(-width / 2 + (big ? 65.f : 80.f), yPos); @@ -97,7 +97,7 @@ std::pair< ); incArrowSpr->setScale(.3f); - auto incArrow = MenuItemSpriteExtra::create( + auto incArrow = CCMenuItemSpriteExtra::create( incArrowSpr, node, menu_selector(C::onArrow) ); incArrow->setTag(big ? @@ -377,7 +377,7 @@ bool FileSettingNode::setup(FileSettingValue* setting, float width) { auto fileBtnSpr = CCSprite::createWithSpriteFrameName("gj_folderBtn_001.png"); fileBtnSpr->setScale(.5f); - auto fileBtn = MenuItemSpriteExtra::create( + auto fileBtn = CCMenuItemSpriteExtra::create( fileBtnSpr, this, menu_selector(FileSettingNode::onPickFile) ); fileBtn->setPosition(.0f, .0f); @@ -410,7 +410,7 @@ bool ColorSettingNode::setup(ColorSettingValue* setting, float width) { m_colorSpr->setColor(m_uncommittedValue); m_colorSpr->setScale(.65f); - auto button = MenuItemSpriteExtra::create( + auto button = CCMenuItemSpriteExtra::create( m_colorSpr, this, menu_selector(ColorSettingNode::onSelectColor) ); button->setPositionX(-10.f); @@ -445,7 +445,7 @@ bool ColorAlphaSettingNode::setup(ColorAlphaSettingValue* setting, float width) m_colorSpr->updateOpacity(m_uncommittedValue.a / 255.f); m_colorSpr->setScale(.65f); - auto button = MenuItemSpriteExtra::create( + auto button = CCMenuItemSpriteExtra::create( m_colorSpr, this, menu_selector(ColorAlphaSettingNode::onSelectColor) ); button->setPositionX(-10.f); diff --git a/loader/src/ui/internal/settings/GeodeSettingNode.hpp b/loader/src/ui/internal/settings/GeodeSettingNode.hpp index 2a320b53..c32a6066 100644 --- a/loader/src/ui/internal/settings/GeodeSettingNode.hpp +++ b/loader/src/ui/internal/settings/GeodeSettingNode.hpp @@ -1,6 +1,6 @@ #pragma once -#include +#include #include #include #include @@ -40,7 +40,7 @@ protected: CCMenu* m_menu; CCLabelBMFont* m_nameLabel; CCLabelBMFont* m_errorLabel; - MenuItemSpriteExtra* m_resetBtn; + CCMenuItemSpriteExtra* m_resetBtn; bool init(GeodeSettingValue* setting, float width) { if (!SettingNode::init(setting)) @@ -81,7 +81,7 @@ protected: auto infoSpr = CCSprite::createWithSpriteFrameName("GJ_infoIcon_001.png"); infoSpr->setScale(.6f); - auto infoBtn = MenuItemSpriteExtra::create( + auto infoBtn = CCMenuItemSpriteExtra::create( infoSpr, this, menu_selector(GeodeSettingNode::onDescription) ); infoBtn->setPosition( @@ -97,7 +97,7 @@ protected: auto resetBtnSpr = CCSprite::createWithSpriteFrameName("reset-gold.png"_spr); resetBtnSpr->setScale(.5f); - m_resetBtn = MenuItemSpriteExtra::create( + m_resetBtn = CCMenuItemSpriteExtra::create( resetBtnSpr, this, menu_selector(GeodeSettingNode::onReset) ); m_resetBtn->setPosition( @@ -210,10 +210,10 @@ protected: InputNode* m_input = nullptr; CCLabelBMFont* m_label = nullptr; Slider* m_slider = nullptr; - MenuItemSpriteExtra* m_decArrow = nullptr; - MenuItemSpriteExtra* m_incArrow = nullptr; - MenuItemSpriteExtra* m_bigDecArrow = nullptr; - MenuItemSpriteExtra* m_bigIncArrow = nullptr; + CCMenuItemSpriteExtra* m_decArrow = nullptr; + CCMenuItemSpriteExtra* m_incArrow = nullptr; + CCMenuItemSpriteExtra* m_bigDecArrow = nullptr; + CCMenuItemSpriteExtra* m_bigIncArrow = nullptr; void valueChanged(bool updateText) override; void textChanged(CCTextInputNode* input) override; @@ -239,10 +239,10 @@ protected: InputNode* m_input = nullptr; CCLabelBMFont* m_label = nullptr; Slider* m_slider = nullptr; - MenuItemSpriteExtra* m_decArrow = nullptr; - MenuItemSpriteExtra* m_incArrow = nullptr; - MenuItemSpriteExtra* m_bigDecArrow = nullptr; - MenuItemSpriteExtra* m_bigIncArrow = nullptr; + CCMenuItemSpriteExtra* m_decArrow = nullptr; + CCMenuItemSpriteExtra* m_incArrow = nullptr; + CCMenuItemSpriteExtra* m_bigDecArrow = nullptr; + CCMenuItemSpriteExtra* m_bigIncArrow = nullptr; void valueChanged(bool updateText) override; void textChanged(CCTextInputNode* input) override; diff --git a/loader/src/ui/internal/settings/ModSettingsPopup.cpp b/loader/src/ui/internal/settings/ModSettingsPopup.cpp index 369041a1..60f4b6f6 100644 --- a/loader/src/ui/internal/settings/ModSettingsPopup.cpp +++ b/loader/src/ui/internal/settings/ModSettingsPopup.cpp @@ -90,7 +90,7 @@ bool ModSettingsPopup::setup(Mod* mod) { m_applyBtnSpr = ButtonSprite::create("Apply", "goldFont.fnt", "GJ_button_01.png", .7f); m_applyBtnSpr->setScale(.7f); - m_applyBtn = MenuItemSpriteExtra::create( + m_applyBtn = CCMenuItemSpriteExtra::create( m_applyBtnSpr, this, menu_selector(ModSettingsPopup::onApply) ); m_applyBtn->setPosition(.0f, -m_size.height / 2 + 20.f); @@ -99,7 +99,7 @@ bool ModSettingsPopup::setup(Mod* mod) { auto resetBtnSpr = ButtonSprite::create("Reset All", "goldFont.fnt", "GJ_button_05.png", .7f); resetBtnSpr->setScale(.7f); - auto resetBtn = MenuItemSpriteExtra::create( + auto resetBtn = CCMenuItemSpriteExtra::create( resetBtnSpr, this, menu_selector(ModSettingsPopup::onResetAll) ); resetBtn->setPosition(-m_size.width / 2 + 45.f, -m_size.height / 2 + 20.f); @@ -109,7 +109,7 @@ bool ModSettingsPopup::setup(Mod* mod) { ButtonSprite::create("Open Folder", "goldFont.fnt", "GJ_button_05.png", .7f); openDirBtnSpr->setScale(.7f); - auto openDirBtn = MenuItemSpriteExtra::create( + auto openDirBtn = CCMenuItemSpriteExtra::create( openDirBtnSpr, this, menu_selector(ModSettingsPopup::onOpenSaveDirectory) ); openDirBtn->setPosition(m_size.width / 2 - 53.f, -m_size.height / 2 + 20.f); diff --git a/loader/src/ui/internal/settings/ModSettingsPopup.hpp b/loader/src/ui/internal/settings/ModSettingsPopup.hpp index d861e241..834214d5 100644 --- a/loader/src/ui/internal/settings/ModSettingsPopup.hpp +++ b/loader/src/ui/internal/settings/ModSettingsPopup.hpp @@ -10,7 +10,7 @@ class ModSettingsPopup : public Popup, public SettingNodeDelegate { protected: Mod* m_mod; std::vector m_settings; - MenuItemSpriteExtra* m_applyBtn; + CCMenuItemSpriteExtra* m_applyBtn; ButtonSprite* m_applyBtnSpr; void settingValueChanged(SettingNode*) override; diff --git a/loader/src/ui/nodes/ColorPickPopup.cpp b/loader/src/ui/nodes/ColorPickPopup.cpp index db7b6a10..0fafb50f 100644 --- a/loader/src/ui/nodes/ColorPickPopup.cpp +++ b/loader/src/ui/nodes/ColorPickPopup.cpp @@ -157,7 +157,7 @@ bool ColorPickPopup::setup(ccColor4B const& color, bool isRGBA) { okBtnSpr->setScale(.7f); auto okBtn = - MenuItemSpriteExtra::create(okBtnSpr, this, menu_selector(ColorPickPopup::onClose)); + CCMenuItemSpriteExtra::create(okBtnSpr, this, menu_selector(ColorPickPopup::onClose)); okBtn->setPosition(.0f, -m_size.height / 2 + 20.f); m_buttonMenu->addChild(okBtn); diff --git a/loader/src/ui/nodes/MDPopup.cpp b/loader/src/ui/nodes/MDPopup.cpp index 39d5153e..2f0929da 100644 --- a/loader/src/ui/nodes/MDPopup.cpp +++ b/loader/src/ui/nodes/MDPopup.cpp @@ -24,14 +24,14 @@ bool MDPopup::setup( auto btnSpr = ButtonSprite::create(btn1Text); - auto btn = MenuItemSpriteExtra::create(btnSpr, this, menu_selector(MDPopup::onBtn)); + auto btn = CCMenuItemSpriteExtra::create(btnSpr, this, menu_selector(MDPopup::onBtn)); btn->setTag(0); m_buttonMenu->addChild(btn); if (btn2Text) { auto btn2Spr = ButtonSprite::create(btn2Text); - auto btn2 = MenuItemSpriteExtra::create(btn2Spr, this, menu_selector(MDPopup::onBtn)); + auto btn2 = CCMenuItemSpriteExtra::create(btn2Spr, this, menu_selector(MDPopup::onBtn)); btn2->setTag(1); m_buttonMenu->addChild(btn2); diff --git a/loader/src/ui/nodes/MenuItemSpriteExtra.cpp b/loader/src/ui/nodes/MenuItemSprite.cpp similarity index 58% rename from loader/src/ui/nodes/MenuItemSpriteExtra.cpp rename to loader/src/ui/nodes/MenuItemSprite.cpp index 64a71e64..cb6ec2a2 100644 --- a/loader/src/ui/nodes/MenuItemSpriteExtra.cpp +++ b/loader/src/ui/nodes/MenuItemSprite.cpp @@ -1,19 +1,19 @@ -#include +#include using namespace geode::prelude; -MenuItemSpriteExtra* MenuItemSpriteExtra::create( +MenuItemSprite* MenuItemSprite::create( cocos2d::CCNode* normalSprite, cocos2d::CCObject* target, cocos2d::SEL_MenuHandler callback ) { - return MenuItemSpriteExtra::create(normalSprite, nullptr, target, callback); + return MenuItemSprite::create(normalSprite, nullptr, target, callback); } -MenuItemSpriteExtra* MenuItemSpriteExtra::create( +MenuItemSprite* MenuItemSprite::create( cocos2d::CCNode* normalSprite, cocos2d::CCNode* disabledSprite, cocos2d::CCObject* target, cocos2d::SEL_MenuHandler callback ) { - auto ret = new MenuItemSpriteExtra(); + auto ret = new MenuItemSprite(); if (ret && ret->init(normalSprite, disabledSprite, target, callback)) { ret->autorelease(); return ret; @@ -22,12 +22,12 @@ MenuItemSpriteExtra* MenuItemSpriteExtra::create( return nullptr; } -MenuItemSpriteExtra::MenuItemSpriteExtra() : m_scaleSprites(false) {} +MenuItemSprite::MenuItemSprite() {} -MenuItemSpriteExtra::~MenuItemSpriteExtra() { +MenuItemSprite::~MenuItemSprite() { } -void MenuItemSpriteExtra::setImage(cocos2d::CCNode* image) { +void MenuItemSprite::setImage(cocos2d::CCNode* image) { if (image) { image->setAnchorPoint({ 0.5f, 0.5f }); image->setPosition(image->getContentSize() / 2); @@ -35,20 +35,20 @@ void MenuItemSpriteExtra::setImage(cocos2d::CCNode* image) { } // why are the members private like what -void MenuItemSpriteExtra::setNormalImage(cocos2d::CCNode* image) { +void MenuItemSprite::setNormalImage(cocos2d::CCNode* image) { CCMenuItemSprite::setNormalImage(image); this->setImage(image); } -void MenuItemSpriteExtra::setDisabledImage(cocos2d::CCNode* image) { +void MenuItemSprite::setDisabledImage(cocos2d::CCNode* image) { CCMenuItemSprite::setDisabledImage(image); this->setImage(image); } -void MenuItemSpriteExtra::setSelectedImage(cocos2d::CCNode* image) { +void MenuItemSprite::setSelectedImage(cocos2d::CCNode* image) { CCMenuItemSprite::setSelectedImage(image); this->setImage(image); } -bool MenuItemSpriteExtra::init( +bool MenuItemSprite::init( cocos2d::CCNode* normalSprite, cocos2d::CCNode* disabledSprite, cocos2d::CCObject* target, cocos2d::SEL_MenuHandler callback ) { @@ -67,41 +67,32 @@ bool MenuItemSpriteExtra::init( return true; } -void MenuItemSpriteExtra::runActionOnSprite(cocos2d::CCNode* sprite, cocos2d::CCAction* generator) { +void MenuItemSprite::runActionOnSprite(cocos2d::CCNode* sprite, cocos2d::CCAction* generator) { if (sprite) { sprite->stopAllActions(); if (generator) sprite->runAction(generator); } } -void MenuItemSpriteExtra::runActionOnSprites(MiniFunction generator) { - if (m_scaleSprites) { - this->runActionOnSprite(this->getNormalImage(), generator()); - this->runActionOnSprite(this->getDisabledImage(), generator()); - this->runActionOnSprite(this->getSelectedImage(), generator()); - } - else { - if (auto action = generator()) this->runAction(action); - } +void MenuItemSprite::runActionOnSprites(MiniFunction generator) { + this->runActionOnSprite(this->getNormalImage(), generator()); + this->runActionOnSprite(this->getDisabledImage(), generator()); + this->runActionOnSprite(this->getSelectedImage(), generator()); } -void MenuItemSpriteExtra::activate() { +void MenuItemSprite::activate() { this->runActionOnSprites(m_activateAction); CCMenuItem::activate(); } -void MenuItemSpriteExtra::selected() { +void MenuItemSprite::selected() { if (!m_bEnabled) return; CCMenuItem::selected(); this->runActionOnSprites(m_selectedAction); } -void MenuItemSpriteExtra::unselected() { +void MenuItemSprite::unselected() { if (!m_bEnabled) return; CCMenuItem::unselected(); this->runActionOnSprites(m_unselectedAction); -} - -void MenuItemSpriteExtra::setScaleSprites(bool scale) { - m_scaleSprites = scale; } \ No newline at end of file diff --git a/loader/test/dependency/main.cpp b/loader/test/dependency/main.cpp index 4a2713b6..2f6bd35d 100644 --- a/loader/test/dependency/main.cpp +++ b/loader/test/dependency/main.cpp @@ -2,7 +2,7 @@ #include #include #include -#include +#include #include #include "main.hpp" @@ -92,7 +92,7 @@ protected: } else { btnSpr->setColor({ 200, 200, 200 }); } - auto btn = MenuItemSpriteExtra::create( + auto btn = CCMenuItemSpriteExtra::create( btnSpr, this, menu_selector(MySettingNode::onSelect) ); btn->setTag(static_cast(icon)); @@ -113,7 +113,7 @@ protected: } m_currentIcon = static_cast(sender->getTag()); static_cast( - static_cast(sender)->getNormalImage() + static_cast(sender)->getNormalImage() )->setColor({ 0, 255, 0 }); this->dispatchChanged(); } From a43dcc84cbd6aaab508e38273cfca1597e1dbae0 Mon Sep 17 00:00:00 2001 From: altalk23 <45172705+altalk23@users.noreply.github.com> Date: Wed, 20 Sep 2023 17:37:42 +0300 Subject: [PATCH 51/98] Revert "Add MenuItemSprite" This reverts commit 152dc7edcf31691cd5d9a923b70387b4a562d40c. --- bindings/Cocos2d.bro | 5 - loader/include/Geode/ui/MenuItemSprite.hpp | 47 ---------- loader/include/Geode/ui/MenuItemToggle.hpp | 43 --------- loader/include/Geode/utils/MiniFunction.hpp | 24 ----- loader/src/ui/internal/list/ModListLayer.cpp | 4 +- loader/src/ui/nodes/MenuItemSprite.cpp | 98 -------------------- 6 files changed, 1 insertion(+), 220 deletions(-) delete mode 100644 loader/include/Geode/ui/MenuItemSprite.hpp delete mode 100644 loader/include/Geode/ui/MenuItemToggle.hpp delete mode 100644 loader/src/ui/nodes/MenuItemSprite.cpp diff --git a/bindings/Cocos2d.bro b/bindings/Cocos2d.bro index 6f617e76..bde65aff 100644 --- a/bindings/Cocos2d.bro +++ b/bindings/Cocos2d.bro @@ -264,11 +264,6 @@ class cocos2d::CCEaseOut { static cocos2d::CCEaseOut* create(cocos2d::CCActionInterval*, float) = mac 0x2a1b70; } -[[link(win)]] -class cocos2d::CCEaseBounceOut { - static cocos2d::CCEaseBounceOut* create(cocos2d::CCActionInterval*) = mac 0x2a3b40; -} - [[link(win)]] class cocos2d::CCEGLView { CCEGLView(); diff --git a/loader/include/Geode/ui/MenuItemSprite.hpp b/loader/include/Geode/ui/MenuItemSprite.hpp deleted file mode 100644 index 113eb80d..00000000 --- a/loader/include/Geode/ui/MenuItemSprite.hpp +++ /dev/null @@ -1,47 +0,0 @@ -#pragma once - -#include -#include "../utils/MiniFunction.hpp" - -#pragma warning(disable : 4275) - -namespace geode { - class GEODE_DLL MenuItemSprite : public cocos2d::CCMenuItemSprite { - protected: - - MenuItemSprite(); - ~MenuItemSprite() override; - - public: - static MenuItemSprite* create( - cocos2d::CCNode* normalSprite, cocos2d::CCNode* disabledSprite, - cocos2d::CCObject* target, cocos2d::SEL_MenuHandler callback - ); - - static MenuItemSprite* create( - cocos2d::CCNode* normalSprite, - cocos2d::CCObject* target, cocos2d::SEL_MenuHandler callback - ); - - bool init( - cocos2d::CCNode* normalSprite, cocos2d::CCNode* disabledSprite, - cocos2d::CCObject* target, cocos2d::SEL_MenuHandler callback - ); - - void runActionOnSprite(cocos2d::CCNode* sprite, cocos2d::CCAction* generator); - void runActionOnSprites(utils::MiniFunction generator); - - utils::MiniFunction m_selectedAction; - utils::MiniFunction m_unselectedAction; - utils::MiniFunction m_activateAction; - - void activate() override; - void selected() override; - void unselected() override; - - void setImage(cocos2d::CCNode* image); - void setNormalImage(cocos2d::CCNode* image) override; - void setDisabledImage(cocos2d::CCNode* image) override; - void setSelectedImage(cocos2d::CCNode* image) override; - }; -} diff --git a/loader/include/Geode/ui/MenuItemToggle.hpp b/loader/include/Geode/ui/MenuItemToggle.hpp deleted file mode 100644 index 6399773a..00000000 --- a/loader/include/Geode/ui/MenuItemToggle.hpp +++ /dev/null @@ -1,43 +0,0 @@ -#pragma once - -#include -#include "MenuItemSprite.hpp" - -#pragma warning(disable : 4275) - -namespace geode { - class GEODE_DLL MenuItemToggle : public cocos2d::CCMenuItem { - protected: - MenuItemSprite* m_offButton; - MenuItemSprite* m_onButton; - bool m_toggled; - - MenuItemToggle(); - ~MenuItemToggle() override; - - public: - static MenuItemToggle* create( - cocos2d::CCNode* onSprite, cocos2d::CCNode* offSprite, - cocos2d::CCObject* target, cocos2d::SEL_MenuHandler callback - ); - - bool init( - cocos2d::CCNode* onSprite, cocos2d::CCNode* offSprite, - cocos2d::CCObject* target, cocos2d::SEL_MenuHandler callback - ); - - void setOffButton(MenuItemSprite* button); - void setOnButton(MenuItemSprite* button); - MenuItemSprite* getOffButton() const; - MenuItemSprite* getOnButton() const; - - bool isToggled() const; - void toggle(bool enabled); - - void setScale(float scale) override; - void activate() override; - void selected() override; - void unselected() override; - void setEnabled(bool enabled) override; - }; -} diff --git a/loader/include/Geode/utils/MiniFunction.hpp b/loader/include/Geode/utils/MiniFunction.hpp index 72cf1e19..edb66052 100644 --- a/loader/include/Geode/utils/MiniFunction.hpp +++ b/loader/include/Geode/utils/MiniFunction.hpp @@ -123,30 +123,6 @@ namespace geode::utils { return *this; } - template - requires(MiniFunctionCallable && !std::is_same_v, MiniFunction>) - MiniFunction& operator=(Callable&& func) { - delete m_state; - m_state = new MiniFunctionState, Ret, Args...>(std::forward(func)); - return *this; - } - - template - requires(!MiniFunctionCallable && std::is_pointer_v && std::is_function_v>) - MiniFunction& operator=(FunctionPointer func) { - delete m_state; - m_state = new MiniFunctionStatePointer(func); - return *this; - } - - template - requires(std::is_member_function_pointer_v) - MiniFunction& operator=(MemberFunctionPointer func) { - delete m_state; - m_state = new MiniFunctionStateMemberPointer(func); - return *this; - } - Ret operator()(Args... args) const { if (!m_state) return Ret(); return m_state->call(args...); diff --git a/loader/src/ui/internal/list/ModListLayer.cpp b/loader/src/ui/internal/list/ModListLayer.cpp index e950a521..a06e745c 100644 --- a/loader/src/ui/internal/list/ModListLayer.cpp +++ b/loader/src/ui/internal/list/ModListLayer.cpp @@ -16,8 +16,6 @@ #include #include -#include - #define FTS_FUZZY_MATCH_IMPLEMENTATION #include @@ -261,7 +259,7 @@ bool ModListLayer::init() { m_topMenu = CCMenu::create(); // add back button - auto backBtn = MenuItemSprite::create( + auto backBtn = CCMenuItemSpriteExtra::create( CCSprite::createWithSpriteFrameName("GJ_arrow_01_001.png"), this, menu_selector(ModListLayer::onExit) ); diff --git a/loader/src/ui/nodes/MenuItemSprite.cpp b/loader/src/ui/nodes/MenuItemSprite.cpp deleted file mode 100644 index cb6ec2a2..00000000 --- a/loader/src/ui/nodes/MenuItemSprite.cpp +++ /dev/null @@ -1,98 +0,0 @@ -#include - -using namespace geode::prelude; - -MenuItemSprite* MenuItemSprite::create( - cocos2d::CCNode* normalSprite, - cocos2d::CCObject* target, cocos2d::SEL_MenuHandler callback -) { - return MenuItemSprite::create(normalSprite, nullptr, target, callback); -} - -MenuItemSprite* MenuItemSprite::create( - cocos2d::CCNode* normalSprite, cocos2d::CCNode* disabledSprite, - cocos2d::CCObject* target, cocos2d::SEL_MenuHandler callback -) { - auto ret = new MenuItemSprite(); - if (ret && ret->init(normalSprite, disabledSprite, target, callback)) { - ret->autorelease(); - return ret; - } - CC_SAFE_DELETE(ret); - return nullptr; -} - -MenuItemSprite::MenuItemSprite() {} - -MenuItemSprite::~MenuItemSprite() { -} - -void MenuItemSprite::setImage(cocos2d::CCNode* image) { - if (image) { - image->setAnchorPoint({ 0.5f, 0.5f }); - image->setPosition(image->getContentSize() / 2); - } -} - -// why are the members private like what -void MenuItemSprite::setNormalImage(cocos2d::CCNode* image) { - CCMenuItemSprite::setNormalImage(image); - this->setImage(image); -} -void MenuItemSprite::setDisabledImage(cocos2d::CCNode* image) { - CCMenuItemSprite::setDisabledImage(image); - this->setImage(image); -} -void MenuItemSprite::setSelectedImage(cocos2d::CCNode* image) { - CCMenuItemSprite::setSelectedImage(image); - this->setImage(image); -} - -bool MenuItemSprite::init( - cocos2d::CCNode* normalSprite, cocos2d::CCNode* disabledSprite, - cocos2d::CCObject* target, cocos2d::SEL_MenuHandler callback -) { - if (!CCMenuItemSprite::initWithNormalSprite(normalSprite, disabledSprite, nullptr, target, callback)) return false; - - m_selectedAction = []() -> cocos2d::CCAction* { - return cocos2d::CCEaseBounceOut::create(cocos2d::CCScaleTo::create(0.3f, 1.26f)); - }; - m_unselectedAction = []() -> cocos2d::CCAction* { - return cocos2d::CCEaseBounceOut::create(cocos2d::CCScaleTo::create(0.4f, 1.0f)); - }; - m_activateAction = []() -> cocos2d::CCAction* { - return cocos2d::CCScaleTo::create(0.f, 1.0f); - }; - - return true; -} - -void MenuItemSprite::runActionOnSprite(cocos2d::CCNode* sprite, cocos2d::CCAction* generator) { - if (sprite) { - sprite->stopAllActions(); - if (generator) sprite->runAction(generator); - } -} - -void MenuItemSprite::runActionOnSprites(MiniFunction generator) { - this->runActionOnSprite(this->getNormalImage(), generator()); - this->runActionOnSprite(this->getDisabledImage(), generator()); - this->runActionOnSprite(this->getSelectedImage(), generator()); -} - -void MenuItemSprite::activate() { - this->runActionOnSprites(m_activateAction); - CCMenuItem::activate(); -} -void MenuItemSprite::selected() { - if (!m_bEnabled) return; - CCMenuItem::selected(); - - this->runActionOnSprites(m_selectedAction); -} -void MenuItemSprite::unselected() { - if (!m_bEnabled) return; - CCMenuItem::unselected(); - - this->runActionOnSprites(m_unselectedAction); -} \ No newline at end of file From e87d52b7f02768c520392defac0e121a929f29cf Mon Sep 17 00:00:00 2001 From: Cvolton Date: Sat, 23 Sep 2023 14:34:35 +0200 Subject: [PATCH 52/98] Add Windows bindings for PauseLayer buttons --- bindings/GeometryDash.bro | 3 +++ 1 file changed, 3 insertions(+) diff --git a/bindings/GeometryDash.bro b/bindings/GeometryDash.bro index 9f368269..3e93e98b 100644 --- a/bindings/GeometryDash.bro +++ b/bindings/GeometryDash.bro @@ -4470,6 +4470,9 @@ class PauseLayer : CCBlockLayer { virtual void customSetup() = mac 0x20b300, win 0x1e4620; void onRestart(cocos2d::CCObject* sender) = win 0x1e6040; + void onPracticeMode(cocos2d::CCObject* sender) = win 0x1e5f30; + void onNormalMode(cocos2d::CCObject* sender) = win 0x1e5f60; + void onResume(cocos2d::CCObject* sender) = win 0x1e5fa0; virtual void keyDown(cocos2d::enumKeyCodes) = mac 0x20cc80, win 0x1E6580; void musicSliderChanged(cocos2d::CCObject* sender) = win 0x1e5ce0; From c60728446e69e29d13b41e3d83bac05570482bbf Mon Sep 17 00:00:00 2001 From: Cvolton Date: Sat, 23 Sep 2023 15:10:03 +0200 Subject: [PATCH 53/98] Add Mac bindings for PauseLayer --- bindings/GeometryDash.bro | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/bindings/GeometryDash.bro b/bindings/GeometryDash.bro index 3e93e98b..86438325 100644 --- a/bindings/GeometryDash.bro +++ b/bindings/GeometryDash.bro @@ -4469,10 +4469,10 @@ class PauseLayer : CCBlockLayer { void createToggleButton(gd::string caption, cocos2d::SEL_MenuHandler callback, bool on, cocos2d::CCMenu* menu, cocos2d::CCPoint pos) = mac 0x20c890, win 0x1e5570; virtual void customSetup() = mac 0x20b300, win 0x1e4620; - void onRestart(cocos2d::CCObject* sender) = win 0x1e6040; - void onPracticeMode(cocos2d::CCObject* sender) = win 0x1e5f30; - void onNormalMode(cocos2d::CCObject* sender) = win 0x1e5f60; - void onResume(cocos2d::CCObject* sender) = win 0x1e5fa0; + void onRestart(cocos2d::CCObject* sender) = mac 0x20c860, win 0x1e6040; + void onPracticeMode(cocos2d::CCObject* sender) = mac 0x20c6d0, win 0x1e5f30; + void onNormalMode(cocos2d::CCObject* sender) = mac 0x20c720, win 0x1e5f60; + void onResume(cocos2d::CCObject* sender) = mac 0x20c760, win 0x1e5fa0; virtual void keyDown(cocos2d::enumKeyCodes) = mac 0x20cc80, win 0x1E6580; void musicSliderChanged(cocos2d::CCObject* sender) = win 0x1e5ce0; From 2a85c41eed7c6f260a8fd9e1a26183031caeb407 Mon Sep 17 00:00:00 2001 From: Cvolton Date: Sat, 23 Sep 2023 16:45:05 +0200 Subject: [PATCH 54/98] Add EditorPauseLayer::onResume to bindings --- bindings/GeometryDash.bro | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/bindings/GeometryDash.bro b/bindings/GeometryDash.bro index 86438325..424993cd 100644 --- a/bindings/GeometryDash.bro +++ b/bindings/GeometryDash.bro @@ -1272,7 +1272,7 @@ class EditorPauseLayer : CCBlockLayer, FLAlertLayerProtocol { bool init(LevelEditorLayer*) = mac 0x13c7a0, win 0x730e0, ios 0x280cb8; void onExitEditor(cocos2d::CCObject* sender) = mac 0x13f180, win 0x75660; void playStep2() = mac 0x13f040, win 0x75440; - void onResume(cocos2d::CCObject* sender) = win 0x74fe0; + void onResume(cocos2d::CCObject* sender) = mac 0x13e170, win 0x74fe0; void onSaveAndPlay(cocos2d::CCObject* sender) = mac 0x13e1b0, win 0x753d0; void onSaveAndExit(cocos2d::CCObject* sender) = mac 0x13e230, win 0x75620; void onSave(cocos2d::CCObject* sender) = mac 0x13e290, win 0x755a0; From e98c1128968884d658ed8025467659d0459942da Mon Sep 17 00:00:00 2001 From: SMJS <38814077+SMJSGaming@users.noreply.github.com> Date: Sat, 23 Sep 2023 18:44:59 +0200 Subject: [PATCH 55/98] Added 3 missing members to CCAnimateFrameCache I'm not entirely sure what they're for, I simply found that they exist --- bindings/GeometryDash.bro | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/bindings/GeometryDash.bro b/bindings/GeometryDash.bro index 6277683a..b6f7a3eb 100644 --- a/bindings/GeometryDash.bro +++ b/bindings/GeometryDash.bro @@ -280,6 +280,10 @@ class CCAnimatedSprite : cocos2d::CCSprite { class CCAnimateFrameCache : cocos2d::CCObject { static CCAnimateFrameCache* sharedSpriteFrameCache() = mac 0x2e4df0, win 0x158f0; void addSpriteFramesWithFile(const char* file) = win 0x159b0; + + cocos2d::CCDictionary* m_unknown1; + cocos2d::CCDictionary* m_unknown2; + cocos2d::CCDictionary* m_unknown3; } class CCBlockLayer : cocos2d::CCLayerColor { From 78e0e15e13dede1810c32c2a46cda8a8c2e25d0a Mon Sep 17 00:00:00 2001 From: mat <26722564+matcool@users.noreply.github.com> Date: Sat, 23 Sep 2023 18:59:28 -0300 Subject: [PATCH 56/98] fix debug on windows --- CMakeLists.txt | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/CMakeLists.txt b/CMakeLists.txt index 99b5201f..657a3d52 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -218,6 +218,11 @@ else() set(GEODE_PLATFORM_BIN_PATH ${GEODE_BIN_PATH}/${PROJECT_VERSION}/${GEODE_PLATFORM_BINARY}) endif() +if (WIN32) + # This allows you to compile in debug mode + add_compile_definitions(_HAS_ITERATOR_DEBUGGING=0) +endif() + if (PROJECT_IS_TOP_LEVEL) add_subdirectory(loader) From 9fa76b41ea8a8124b229484651145cab1a5c0f68 Mon Sep 17 00:00:00 2001 From: Cvolton Date: Sun, 24 Sep 2023 01:20:14 +0200 Subject: [PATCH 57/98] Remove pad in LLM --- bindings/GeometryDash.bro | 1 - 1 file changed, 1 deletion(-) diff --git a/bindings/GeometryDash.bro b/bindings/GeometryDash.bro index b6f7a3eb..ba25be6c 100644 --- a/bindings/GeometryDash.bro +++ b/bindings/GeometryDash.bro @@ -4275,7 +4275,6 @@ class LocalLevelManager : GManager { cocos2d::CCDictionary* getAllLevelsInDict() = mac 0x35e3d0, win 0x18d7c0; - PAD = mac 0x4, win 0x1C; cocos2d::CCDictionary* m_loadData; cocos2d::CCDictionary* m_levelData; cocos2d::CCArray* m_localLevels; From 696a2caf1fcb5050d6ba827322e4f42f108a2ad4 Mon Sep 17 00:00:00 2001 From: altalk23 <45172705+altalk23@users.noreply.github.com> Date: Sun, 24 Sep 2023 12:16:33 +0300 Subject: [PATCH 58/98] Make codegen sources private visibility --- CMakeLists.txt | 1 + loader/include/Geode/modify/Addresses.hpp | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 657a3d52..40e286c3 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -185,6 +185,7 @@ target_include_directories(GeodeCodegenSources PRIVATE ${GEODE_LOADER_PATH}/include/Geode/cocos/extensions ${GEODE_LOADER_PATH}/include/Geode/fmod ) +set_target_properties(GeodeCodegenSources PROPERTIES CXX_VISIBILITY_PRESET hidden) target_compile_features(GeodeCodegenSources PUBLIC cxx_std_20) if (NOT GEODE_DISABLE_PRECOMPILED_HEADERS) target_precompile_headers(GeodeCodegenSources INTERFACE diff --git a/loader/include/Geode/modify/Addresses.hpp b/loader/include/Geode/modify/Addresses.hpp index 4f0d9518..bea14fdf 100644 --- a/loader/include/Geode/modify/Addresses.hpp +++ b/loader/include/Geode/modify/Addresses.hpp @@ -5,7 +5,7 @@ namespace geode::modifier { template - uintptr_t address(); + GEODE_HIDDEN uintptr_t address(); Result handlerMetadataForAddress(uintptr_t address); } From 0d62940c895a1cb4df34d2fc7d79805f150a163c Mon Sep 17 00:00:00 2001 From: altalk23 <45172705+altalk23@users.noreply.github.com> Date: Sun, 24 Sep 2023 13:25:59 +0300 Subject: [PATCH 59/98] add deadstrip to stripping macos strips in strip --- CMakeLists.txt | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/CMakeLists.txt b/CMakeLists.txt index 40e286c3..fd0548ef 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -187,6 +187,12 @@ target_include_directories(GeodeCodegenSources PRIVATE ) set_target_properties(GeodeCodegenSources PROPERTIES CXX_VISIBILITY_PRESET hidden) target_compile_features(GeodeCodegenSources PUBLIC cxx_std_20) + +if (APPLE) + target_compile_options(GeodeCodegenSources PUBLIC -ffunction-sections -fdata-sections) + target_link_options(GeodeCodegenSources PUBLIC -dead_strip) +endif() + if (NOT GEODE_DISABLE_PRECOMPILED_HEADERS) target_precompile_headers(GeodeCodegenSources INTERFACE "${GEODE_LOADER_PATH}/include/Geode/Bindings.hpp" From e189e89ff2dada9a2fec08bde1adb6f45dd14854 Mon Sep 17 00:00:00 2001 From: alk <45172705+altalk23@users.noreply.github.com> Date: Sun, 24 Sep 2023 20:30:11 +0300 Subject: [PATCH 60/98] Aggressive issue template changes --- .github/ISSUE_TEMPLATE/crash-report.yml | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/.github/ISSUE_TEMPLATE/crash-report.yml b/.github/ISSUE_TEMPLATE/crash-report.yml index a0f69868..1876861b 100644 --- a/.github/ISSUE_TEMPLATE/crash-report.yml +++ b/.github/ISSUE_TEMPLATE/crash-report.yml @@ -1,7 +1,14 @@ name: Crash Report -description: Report a bug that crashes the game or prevents startup caused by Geode Loader (not individual mods). +description: Report a Geode bug (not mods themselves) that crashes the game or prevents startup caused by Geode Loader (not mods created by others). labels: [ "unverified", "crash" ] body: + - type: checkboxes + attributes: + label: Geode Issue + description: The Geode repository is for issues of Geode Loader, not individual mods created by other developers. + options: + - label: I confirm that this crash is directly related to Geode Loader. + required: true - type: dropdown id: platform attributes: From 0b5c9c9b5ad24957631593995f2f35bb29b4dce7 Mon Sep 17 00:00:00 2001 From: mat <26722564+matcool@users.noreply.github.com> Date: Sun, 24 Sep 2023 14:37:25 -0300 Subject: [PATCH 61/98] fix callconv on this one function for some reason the fmod c functions arent stdcall on the dll, need to fix this for the other functions later --- loader/include/Geode/fmod/fmod.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/loader/include/Geode/fmod/fmod.h b/loader/include/Geode/fmod/fmod.h index c12bc9e4..43f26439 100644 --- a/loader/include/Geode/fmod/fmod.h +++ b/loader/include/Geode/fmod/fmod.h @@ -31,7 +31,7 @@ FMOD_RESULT F_API FMOD_File_GetDiskBusy (int *busy); /* FMOD System factory functions. Use this to create an FMOD System Instance. below you will see FMOD_System_Init/Close to get started. */ -FMOD_RESULT F_API FMOD_System_Create (FMOD_SYSTEM **system); +FMOD_RESULT /*F_API*/ FMOD_System_Create (FMOD_SYSTEM **system); FMOD_RESULT F_API FMOD_System_Release (FMOD_SYSTEM *system); /* From a20ee0d1fe4216266e97a60ac02db31c83a008cb Mon Sep 17 00:00:00 2001 From: altalk23 <45172705+altalk23@users.noreply.github.com> Date: Sun, 24 Sep 2023 21:00:26 +0300 Subject: [PATCH 62/98] add some betteredit funcs --- bindings/Cocos2d.bro | 4 +++- bindings/GeometryDash.bro | 33 +++++++++++++++++++++------------ 2 files changed, 24 insertions(+), 13 deletions(-) diff --git a/bindings/Cocos2d.bro b/bindings/Cocos2d.bro index bde65aff..4ded4041 100644 --- a/bindings/Cocos2d.bro +++ b/bindings/Cocos2d.bro @@ -386,6 +386,7 @@ class cocos2d::CCKeypadHandler { [[link(win)]] class cocos2d::CCLabelBMFont { + CCLabelBMFont() = mac 0x347b60; static cocos2d::CCLabelBMFont* create(char const*, char const*) = mac 0x347660; auto limitLabelWidth(float, float, float) = mac 0x34a6e0, ios 0x21b740; auto setFntFile(char const*) = mac 0x34a5f0; @@ -393,7 +394,7 @@ class cocos2d::CCLabelBMFont { static auto create() = mac 0x3473f0; virtual auto init() = mac 0x347b10, ios 0x2198e0; - bool initWithString(const char* str, const char* fnt, float width, cocos2d::CCTextAlignment align, cocos2d::CCPoint offset); + bool initWithString(const char* str, const char* fnt, float width, cocos2d::CCTextAlignment align, cocos2d::CCPoint offset) = mac 0x347710; virtual auto setScaleX(float) = mac 0x34a5b0, ios 0x21b6e8; virtual auto setScaleY(float) = mac 0x34a5d0, ios 0x21b714; virtual auto setScale(float) = mac 0x34a590, ios 0x21b6bc; @@ -1263,6 +1264,7 @@ class cocos2d { static auto ccGLBindTexture2D(GLuint) = mac 0x1ae610; static auto ccGLBindTexture2DN(GLuint, GLuint) = mac 0x1ae650; static float ccpDistance(cocos2d::CCPoint const&, cocos2d::CCPoint const&) = mac 0x1aaf90; + static auto ccDrawLine(cocos2d::CCPoint const&, cocos2d::CCPoint const&) = mac 0xeccc0; static void ccDrawPoly(cocos2d::CCPoint const*, unsigned int, bool) = mac 0xed0a0; static void ccDrawColor4B(GLubyte, GLubyte, GLubyte, GLubyte) = mac 0xeddd0; static void CCMessageBox(const char* msg, const char* title) = mac 0xbabc0; diff --git a/bindings/GeometryDash.bro b/bindings/GeometryDash.bro index ba25be6c..cb619b42 100644 --- a/bindings/GeometryDash.bro +++ b/bindings/GeometryDash.bro @@ -909,6 +909,8 @@ class CommentUploadDelegate { } class ConfigureHSVWidget : cocos2d::CCNode { + bool init(int abs, cocos2d::ccHSVValue val) = win 0x4a3f0, mac 0x237310; + void updateLabels() = win 0x4adf0, mac 0x237df0; cocos2d::CCLabelBMFont* m_hueLabel; cocos2d::CCLabelBMFont* m_saturationLabel; cocos2d::CCLabelBMFont* m_brightnessLabel; @@ -1030,7 +1032,7 @@ class CustomizeObjectLayer : FLAlertLayer, TextInputDelegate, HSVWidgetPopupDele void onClose(cocos2d::CCObject*) = mac 0xdf660, win 0x57ac0; void updateSelected(int channelID) = mac 0xe0970, win 0x57850; bool init(GameObject* target, cocos2d::CCArray* targets) = mac 0xdd560, win 0x53e00; - void onHSV(cocos2d::CCObject* sender) = win 0x567c0; + void onHSV(cocos2d::CCObject* sender) = win 0x567c0, mac 0xdfa00; void toggleVisible() = mac 0xe1140, win 0x56fb0; void highlightSelected(ButtonSprite* target) = mac 0xe0aa0, win 0x579d0; void updateCustomColorLabels() = mac 0xdff40, win 0x576d0; @@ -1039,8 +1041,8 @@ class CustomizeObjectLayer : FLAlertLayer, TextInputDelegate, HSVWidgetPopupDele // inlined in most places void updateChannelLabel(int channel) = mac 0xe06e0, win 0x56f50; virtual void hsvPopupClosed(HSVWidgetPopup* popup, cocos2d::ccHSVValue value) = win 0x56990; - virtual void colorSelectClosed(cocos2d::CCNode*) = mac 0xe0c70, win 0x564a0; - virtual void textChanged(CCTextInputNode* input) = mac 0xe16a0, win 0x574d0; + virtual void colorSelectClosed(cocos2d::CCNode*) = mac 0xe0610, win 0x564a0; + virtual void textChanged(CCTextInputNode* input) = mac 0xe1470, win 0x574d0; inline CustomizeObjectLayer() {} ~CustomizeObjectLayer() = win 0x53c30; @@ -1140,7 +1142,7 @@ class DrawGridLayer : cocos2d::CCLayer { } bool init(cocos2d::CCNode* grid, LevelEditorLayer* editor) = win 0x16c4d0; - void draw() = win 0x16ce90; + virtual void draw() = win 0x16ce90, mac 0xa3c40; virtual void update(float) = win 0x16cd80; void clearPlayerPoints() { m_playerNodePoints->removeAllObjects(); @@ -1356,8 +1358,8 @@ class EditorUI : cocos2d::CCLayer, FLAlertLayerProtocol, ColorSelectDelegate, GJ void onCreateButton(cocos2d::CCObject* sender) = mac 0x1fd70, win 0x854f0; CCMenuItemSpriteExtra* getSpriteButton(const char* sprite, cocos2d::SEL_MenuHandler callback, cocos2d::CCMenu* menu, float scale) = mac 0xb500, win 0x78bf0; cocos2d::CCPoint offsetForKey(int objID) = win 0x92310; - void updateDeleteMenu() = win 0x7c5d0; - void updateCreateMenu(bool updateTab) = mac 0x1e960, win 0x85530; + void updateDeleteMenu() = win 0x7c5d0, mac 0x1e960; + void updateCreateMenu(bool updateTab) = mac 0x1ba80, win 0x85530; void toggleMode(cocos2d::CCObject* sender) = mac 0x187b0, win 0x7ad20; void zoomIn(cocos2d::CCObject* sender) = mac 0xc0c0, win 0x877c0; void zoomOut(cocos2d::CCObject* sender) = mac 0xc120, win 0x87830; @@ -1425,6 +1427,7 @@ class EditorUI : cocos2d::CCLayer, FLAlertLayerProtocol, ColorSelectDelegate, GJ void sliderChanged(cocos2d::CCObject* slider) = mac 0xaed0, win 0x78cc0; void repositionObjectsToCenter(cocos2d::CCArray* objs, cocos2d::CCPoint center, bool ignoreGroupParent) = mac 0x1fcd0, win 0x88410; virtual void draw() = win 0x8fbe0; + float valueFromXPos(float val) = win 0x78e30, mac 0x1c810; bool m_isPlayingMusic; EditButtonBar* m_buttonBar; @@ -3602,7 +3605,7 @@ class GameToolbox { static cocos2d::CCDictionary* stringSetupToDict(gd::string text, char const* delimeter) = mac 0x28d700, win 0x272a0; static CCMenuItemToggler* createToggleButton(gd::string text, cocos2d::SEL_MenuHandler onToggled, bool isToggled, cocos2d::CCMenu* toggleMenu, cocos2d::CCPoint position, cocos2d::CCNode* callbackTarget, cocos2d::CCNode* labelParent, cocos2d::CCArray* toggleArray) = mac 0x28bc90, win 0x25fe0; static CCMenuItemToggler* createToggleButton(gd::string text, cocos2d::SEL_MenuHandler onToggled, bool isToggled, cocos2d::CCMenu* toggleMenu, cocos2d::CCPoint position, cocos2d::CCNode* callbackTarget, cocos2d::CCNode* labelParent, float checkboxScale, float labelSize, float maxWidth, cocos2d::CCPoint labelOffset, const char* unknown, bool anchorHorizontally, int toggleTag, cocos2d::CCArray* toggleArray) = mac 0x28bdd0, win 0x25fe0; - static cocos2d::ccColor3B transformColor(cocos2d::ccColor3B const& src, cocos2d::ccHSVValue hsv) = win 0x26a60; + static cocos2d::ccColor3B transformColor(cocos2d::ccColor3B const& src, cocos2d::ccHSVValue hsv) = win 0x26a60, mac 0x28c950; static void alignItemsHorisontally(cocos2d::CCArray* array, float pad, cocos2d::CCPoint start, bool idk) = win 0x25b20; static gd::map stringSetupToMap(gd::string, char const*) = mac 0x28d4c0; static cocos2d::ccColor3B multipliedColorValue(cocos2d::ccColor3B color1, cocos2d::ccColor3B color2, float factor) = win 0x26CE0; @@ -3641,7 +3644,7 @@ class GauntletSelectLayer { class GhostTrailEffect {} class HSVWidgetPopup : FLAlertLayer { - bool init(cocos2d::_ccHSVValue value, HSVWidgetPopupDelegate* delegate, gd::string title); + bool init(cocos2d::_ccHSVValue value, HSVWidgetPopupDelegate* delegate, gd::string title) = win 0x49f10, mac 0x236d30; void onClose(cocos2d::CCObject* sender) = win 0x4a280; ConfigureHSVWidget* m_configureWidget; @@ -3760,6 +3763,7 @@ class LevelBrowserLayer : cocos2d::CCLayer, LevelManagerDelegate, FLAlertLayerPr void updateLevelsLabel() = mac 0x255450, win 0x15c350; void onRefresh(cocos2d::CCObject* sender) = mac 0x253090; void onInfo(cocos2d::CCObject* sender) = mac 0x253170, win 0x15cb00; + void onNew(cocos2d::CCObject* sender) = win 0x15cbf0, mac 0x252ac0; static LevelBrowserLayer* create(GJSearchObject* search) = mac 0x251210, win 0x159fa0, ios 0x2d0a00; PAD = win 0x4, mac 0x8; @@ -4019,7 +4023,7 @@ class LevelEditorLayer : GJBaseGameLayer, LevelSettingsDelegate { class LevelInfoLayer : cocos2d::CCLayer, LevelDownloadDelegate, LevelUpdateDelegate, RateLevelDelegate, LikeItemDelegate, FLAlertLayerProtocol, LevelDeleteDelegate, NumberInputDelegate, SetIDPopupDelegate { static LevelInfoLayer* create(GJGameLevel* level) = mac 0x15f290, win 0x175d50; bool init(GJGameLevel* level) = win 0x175df0, mac 0x15f520; - void onGarage(cocos2d::CCObject* sender) = win 0x177c10; + void onGarage(cocos2d::CCObject* sender) = win 0x177c10, mac 0x163ac0; void onViewProfile(cocos2d::CCObject* sender) = mac 0x1617d0, win 0x17ac90; void onLevelInfo(cocos2d::CCObject* sender) = mac 0x163880, win 0x17acf0; void setupProgressBars() = win 0x177fc0; @@ -4490,8 +4494,8 @@ class PauseLayer : CCBlockLayer { void onResume(cocos2d::CCObject* sender) = mac 0x20c760, win 0x1e5fa0; virtual void keyDown(cocos2d::enumKeyCodes) = mac 0x20cc80, win 0x1E6580; - void musicSliderChanged(cocos2d::CCObject* sender) = win 0x1e5ce0; - void sfxSliderChanged(cocos2d::CCObject* sender) = win 0x1ddfa0; + void musicSliderChanged(cocos2d::CCObject* sender) = win 0x1e5ce0, mac 0x20cb00; + void sfxSliderChanged(cocos2d::CCObject* sender) = win 0x1ddfa0, mac 0x20cb40; bool m_unknown; bool m_unknown2; @@ -5259,6 +5263,9 @@ class SetGroupIDLayer : FLAlertLayer, TextInputDelegate { void updateZOrder() = win 0x22e3d0; void onAddGroup(cocos2d::CCObject* sender) = mac 0x1967d0, win 0x22de20; void onClose(cocos2d::CCObject* sender) = mac 0x1966a0, win 0x22e830; + void onEditorLayer(CCObject* sender) = win 0x22d690, mac 0x196800; + void onEditorLayer2(CCObject* sender) = win 0x22d710, mac 0x196a40; + void onZOrder(CCObject* sender) = win 0x22de80, mac 0x196920; GameObject* m_targetObject; cocos2d::CCArray* m_targetObjects; @@ -5369,12 +5376,14 @@ class SetupOpacityPopup : FLAlertLayer { class SetupPickupTriggerPopup : FLAlertLayer { static SetupPickupTriggerPopup* create(EffectGameObject*, cocos2d::CCArray*) = mac 0x35e70, win 0x23d4a0; + bool init(EffectGameObject* obj, cocos2d::CCArray* arr) = win 0x23d550, mac 0x36070; void onItemIDArrow(cocos2d::CCObject*) = mac 0x37100; void onNextItemID(cocos2d::CCObject*) = mac 0x37260; void textChanged(CCTextInputNode*) = mac 0x37ca0; void updateItemID() = mac 0x37ab0, win 0x23e4f0; - PAD = win 0xc; + PAD = win 0xc, mac 0x18; + CCTextInputNode* m_itemIDInput; CCTextInputNode* m_countInput; } From 3a319394e30cfa18295b8689e9289dfb7cb6e42e Mon Sep 17 00:00:00 2001 From: mat <26722564+matcool@users.noreply.github.com> Date: Sun, 24 Sep 2023 15:16:43 -0300 Subject: [PATCH 63/98] fix HardStreak::updateStroke --- bindings/GeometryDash.bro | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/bindings/GeometryDash.bro b/bindings/GeometryDash.bro index cb619b42..af6bb748 100644 --- a/bindings/GeometryDash.bro +++ b/bindings/GeometryDash.bro @@ -3667,7 +3667,7 @@ class HardStreak : cocos2d::CCDrawNode { void reset() = mac 0x5c930; void resumeStroke() = mac 0x5c210; void stopStroke() = mac 0x5c8f0, win 0x14e460; - void updateStroke(float) = mac 0x5c240, win 0x14e530; + callback void updateStroke(float) = mac 0x5c240, win 0x14e530; cocos2d::CCArray* m_pointsArr; cocos2d::CCPoint m_currentPoint; From 53b533f1d8516fdefa39eba9089083d47b2e70e6 Mon Sep 17 00:00:00 2001 From: mat <26722564+matcool@users.noreply.github.com> Date: Sun, 24 Sep 2023 15:40:42 -0300 Subject: [PATCH 64/98] fix missing cocos2d:: --- bindings/GeometryDash.bro | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/bindings/GeometryDash.bro b/bindings/GeometryDash.bro index af6bb748..6937aed5 100644 --- a/bindings/GeometryDash.bro +++ b/bindings/GeometryDash.bro @@ -5263,9 +5263,9 @@ class SetGroupIDLayer : FLAlertLayer, TextInputDelegate { void updateZOrder() = win 0x22e3d0; void onAddGroup(cocos2d::CCObject* sender) = mac 0x1967d0, win 0x22de20; void onClose(cocos2d::CCObject* sender) = mac 0x1966a0, win 0x22e830; - void onEditorLayer(CCObject* sender) = win 0x22d690, mac 0x196800; - void onEditorLayer2(CCObject* sender) = win 0x22d710, mac 0x196a40; - void onZOrder(CCObject* sender) = win 0x22de80, mac 0x196920; + void onEditorLayer(cocos2d::CCObject* sender) = win 0x22d690, mac 0x196800; + void onEditorLayer2(cocos2d::CCObject* sender) = win 0x22d710, mac 0x196a40; + void onZOrder(cocos2d::CCObject* sender) = win 0x22de80, mac 0x196920; GameObject* m_targetObject; cocos2d::CCArray* m_targetObjects; From 30a41e54b7aaabc43a55a11169c8e4b883bf1d6c Mon Sep 17 00:00:00 2001 From: Cvolton Date: Sun, 24 Sep 2023 20:49:20 +0200 Subject: [PATCH 65/98] Add GJGameLevel::savePercentage This commit is dedicated to Crystal Client ninXout Windows 7, Windows 8, Windows 9, Windows 10, and Windows 11 --- bindings/GeometryDash.bro | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/bindings/GeometryDash.bro b/bindings/GeometryDash.bro index 6937aed5..b097d128 100644 --- a/bindings/GeometryDash.bro +++ b/bindings/GeometryDash.bro @@ -2291,7 +2291,7 @@ class GJGameLevel : cocos2d::CCNode { void getLengthKey(int) = mac 0x2dbba0; void getNormalPercent() = mac 0x2b8b20; void levelWasAltered() = mac 0x2db530, win 0xbd550; - void savePercentage(int, bool, int, int, bool) = mac 0x2db700; + void savePercentage(int, bool, int, int, bool) = mac 0x2db700, win 0xbd5c0; void dataLoaded(DS_Dictionary* dict) = mac 0x2dc0e0, win 0xbded0, ios 0x6fca4; GJDifficulty getAverageDifficulty() = win 0xbd9b0; gd::string getUnpackedLevelDescription() = mac 0x2DDB50, win 0xbf890; From 0ac539788464e49efdbc8e6fd9a25666e45de0b4 Mon Sep 17 00:00:00 2001 From: matcool <26722564+matcool@users.noreply.github.com> Date: Sun, 24 Sep 2023 21:46:41 -0300 Subject: [PATCH 66/98] add PlayLayer::startGame --- bindings/GeometryDash.bro | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/bindings/GeometryDash.bro b/bindings/GeometryDash.bro index b097d128..d90c5274 100644 --- a/bindings/GeometryDash.bro +++ b/bindings/GeometryDash.bro @@ -4648,7 +4648,7 @@ class PlayLayer : GJBaseGameLayer, CCCircleWaveDelegate, CurrencyRewardDelegate, void spawnFirework() = mac 0x74200; void spawnParticle(char const*, int, cocos2d::tCCPositionType, cocos2d::CCPoint) = mac 0x76330; void spawnPlayer2() = mac 0x7d170, win 0x2089e0; - void startGame() = mac 0x726b0; + void startGame() = mac 0x726b0, win 0x1fd390; void startMusic() = mac 0x72910, win 0x20C8F0; void startRecording() = mac 0x7fec0; void startRecordingDelayed() = mac 0x7fed0; From 60e707d6a492f44e0f279f96550735cec7e99be2 Mon Sep 17 00:00:00 2001 From: matcool <26722564+matcool@users.noreply.github.com> Date: Sun, 24 Sep 2023 22:11:27 -0300 Subject: [PATCH 67/98] add PlayLayer::toggleGhostEffect --- bindings/GeometryDash.bro | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/bindings/GeometryDash.bro b/bindings/GeometryDash.bro index d90c5274..345401cd 100644 --- a/bindings/GeometryDash.bro +++ b/bindings/GeometryDash.bro @@ -4664,7 +4664,7 @@ class PlayLayer : GJBaseGameLayer, CCCircleWaveDelegate, CurrencyRewardDelegate, void toggleBGEffectVisibility(bool) = mac 0x7fe80; void toggleDualMode(GameObject*, bool, PlayerObject*, bool) = mac 0x7bf90, win 0x208880; void toggleFlipped(bool, bool) = mac 0x7bdc0, win 0x20ab20; - void toggleGhostEffect(int) = mac 0x7fe40; + void toggleGhostEffect(int) = mac 0x7fe40, win 0x1f8930; void toggleGlitter(bool) = mac 0x70e00, win 0x20a0d0; void togglePracticeMode(bool) = mac 0x7f9e0, win 0x20d0d0; void toggleProgressbar() = mac 0x6eeb0, win 0x208160; From 0949d86b32fd1a18947cd810b909ce1e6f0d057c Mon Sep 17 00:00:00 2001 From: ninXout Date: Mon, 25 Sep 2023 18:03:41 -0400 Subject: [PATCH 68/98] Add CCTransitionFade::initWithDuration for mac --- bindings/Cocos2d.bro | 1 + 1 file changed, 1 insertion(+) diff --git a/bindings/Cocos2d.bro b/bindings/Cocos2d.bro index 4ded4041..b31a8d3a 100644 --- a/bindings/Cocos2d.bro +++ b/bindings/Cocos2d.bro @@ -1136,6 +1136,7 @@ class cocos2d::CCTouchHandler { [[link(win)]] class cocos2d::CCTransitionFade { static cocos2d::CCTransitionFade* create(float, cocos2d::CCScene*) = mac 0x8ea30, ios 0x12c244; + virtual bool initWithDuration(float t, cocos2d::CCScene* scene, cocos2d::ccColor3B const& color) = mac 0x8e930; } [[link(win)]] From ea4341b38ad70130c0324c67a57da56b2d34fc21 Mon Sep 17 00:00:00 2001 From: mat <26722564+matcool@users.noreply.github.com> Date: Mon, 25 Sep 2023 19:23:29 -0300 Subject: [PATCH 69/98] some missing geode custom ctors --- .../cocos/layers_scenes_transitions_nodes/CCTransition.h | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/loader/include/Geode/cocos/layers_scenes_transitions_nodes/CCTransition.h b/loader/include/Geode/cocos/layers_scenes_transitions_nodes/CCTransition.h index 8ebcda4e..d55ec10d 100644 --- a/loader/include/Geode/cocos/layers_scenes_transitions_nodes/CCTransition.h +++ b/loader/include/Geode/cocos/layers_scenes_transitions_nodes/CCTransition.h @@ -90,6 +90,7 @@ protected: bool m_bIsSendCleanupToScene; public: + GEODE_CUSTOM_CONSTRUCTOR_COCOS(CCTransitionScene, CCScene) /** * @js ctor */ @@ -147,6 +148,7 @@ public: * @js ctor */ CCTransitionSceneOriented(); + GEODE_CUSTOM_CONSTRUCTOR_COCOS(CCTransitionSceneOriented, CCTransitionScene) /** * @js NA * @lua NA @@ -171,6 +173,7 @@ public: * @js ctor */ CCTransitionRotoZoom(); + GEODE_CUSTOM_CONSTRUCTOR_COCOS(CCTransitionRotoZoom, CCTransitionScene) /** * @js NA * @lua NA @@ -623,6 +626,7 @@ public: * @js ctor */ CCTransitionFade(); + GEODE_CUSTOM_CONSTRUCTOR_COCOS(CCTransitionFade, CCTransitionScene) /** * @js NA * @lua NA From 90ea3920345937f9c43508a756021e190fd7c827 Mon Sep 17 00:00:00 2001 From: Fire <17692105+FireMario211@users.noreply.github.com> Date: Tue, 26 Sep 2023 21:30:26 +0000 Subject: [PATCH 70/98] Add a bunch of mac offsets might add more but this is necessary for a mod im doing --- bindings/GeometryDash.bro | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/bindings/GeometryDash.bro b/bindings/GeometryDash.bro index 345401cd..dd72341d 100644 --- a/bindings/GeometryDash.bro +++ b/bindings/GeometryDash.bro @@ -1765,8 +1765,8 @@ class FMODSound : cocos2d::CCNode { class FriendRequestDelegate {} class FriendsProfilePage : FLAlertLayer, FLAlertLayerProtocol, UploadActionDelegate, UploadPopupDelegate, UserListDelegate { - static FriendsProfilePage* create(UserListType) = win 0x9ce80; - bool init(UserListType) = win 0x9cf30; + static FriendsProfilePage* create(UserListType) = win 0x9ce80, mac 0x3a9570; + bool init(UserListType) = win 0x9cf30, mac 0x3a9770; } class GJAccountBackupDelegate { @@ -4026,9 +4026,9 @@ class LevelInfoLayer : cocos2d::CCLayer, LevelDownloadDelegate, LevelUpdateDeleg void onGarage(cocos2d::CCObject* sender) = win 0x177c10, mac 0x163ac0; void onViewProfile(cocos2d::CCObject* sender) = mac 0x1617d0, win 0x17ac90; void onLevelInfo(cocos2d::CCObject* sender) = mac 0x163880, win 0x17acf0; - void setupProgressBars() = win 0x177fc0; + void setupProgressBars() = win 0x177fc0, mac 0x1627e0; void setupLevelInfo() = mac 0x161C80, win 0x178680; - void downloadLevel() = win 0x177d90; + void downloadLevel() = win 0x177d90, mac 0x161b90; void onPlay(cocos2d::CCObject* sender) = mac 0x161840, win 0x179730; virtual void levelDownloadFinished(GJGameLevel*) = mac 0x164C00, win 0x1790C0; virtual void levelUpdateFinished(GJGameLevel*, UpdateResponse) = mac 0x164E60, win 0x1792B0; @@ -4104,9 +4104,9 @@ class LevelSettingsDelegate { class SecretLayer2 : cocos2d::CCLayer, TextInputDelegate, FLAlertLayerProtocol, DialogDelegate { static SecretLayer2* create() = win 0x21FD70; - bool init() = win 0x21FE10; - bool onSubmit(cocos2d::CCObject*) = win 0x221ac0; - void updateSearchLabel(const char* text) = win 0x222FC0; + bool init() = win 0x21FE10, mac 0x25fe70; + bool onSubmit(cocos2d::CCObject*) = win 0x221ac0, mac 0x2611a0; + void updateSearchLabel(const char* text) = win 0x222FC0, mac 0x260e10; void showCompletedLevel() = win 0x220C10; } From c0947265e0be7081c066e7fb1f6052bbdbef15fd Mon Sep 17 00:00:00 2001 From: dankmeme01 <42031238+dankmeme01@users.noreply.github.com> Date: Wed, 27 Sep 2023 00:22:35 +0200 Subject: [PATCH 71/98] add GJAccountManager::getGJP i didn't find either of those but thanks Coloride for win and Firee for mac --- bindings/GeometryDash.bro | 1 + 1 file changed, 1 insertion(+) diff --git a/bindings/GeometryDash.bro b/bindings/GeometryDash.bro index dd72341d..f174b9a1 100644 --- a/bindings/GeometryDash.bro +++ b/bindings/GeometryDash.bro @@ -1795,6 +1795,7 @@ class GJAccountLoginDelegate { class GJAccountManager : cocos2d::CCNode { static GJAccountManager* sharedState() = mac 0x85070, win 0x107d50; + gd::string getGJP() = mac 0x89520, win 0x10abb0; PAD = mac 0x8, win 0x4; gd::string m_password; From 5c0369109b91da9ca8606450feef9e9fc3a0b21c Mon Sep 17 00:00:00 2001 From: Fire <17692105+FireMario211@users.noreply.github.com> Date: Wed, 27 Sep 2023 00:57:34 +0000 Subject: [PATCH 72/98] Update SimplePlayer bindings why werent these found earlier --- bindings/GeometryDash.bro | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/bindings/GeometryDash.bro b/bindings/GeometryDash.bro index f174b9a1..c99ca6ef 100644 --- a/bindings/GeometryDash.bro +++ b/bindings/GeometryDash.bro @@ -5461,9 +5461,9 @@ class SimplePlayer : cocos2d::CCSprite { static SimplePlayer* create(int iconID) = mac 0x1b6140, win 0x12bd80; void updatePlayerFrame(int iconID, IconType iconType) = mac 0x1b62f0, win 0x12c650; void updateColors() = mac 0x1ba1f0, win 0x12c440, ios 0x224f2c; - void setFrames(const char* firstLayer, const char* secondLayer, const char* birdDome, const char* outlineSprite, const char* detailSprite) = win 0x12c9e0; + void setFrames(const char* firstLayer, const char* secondLayer, const char* birdDome, const char* outlineSprite, const char* detailSprite) = mac 0x1bca10, win 0x12c9e0; virtual void setColor(const cocos2d::ccColor3B& color) = mac 0x1bc9b0, win 0x12c410; - virtual void setOpacity(unsigned char opacity) = win 0x12cb90; + virtual void setOpacity(unsigned char opacity) = mac 0x135370, win 0x12cb90; cocos2d::CCSprite* m_firstLayer; cocos2d::CCSprite* m_secondLayer; From 499f2569cbe7e413835039e4dfff0442c7fca7c5 Mon Sep 17 00:00:00 2001 From: altalk23 <45172705+altalk23@users.noreply.github.com> Date: Wed, 27 Sep 2023 15:12:00 +0300 Subject: [PATCH 73/98] readd the nullptr check in InstallListPopup::createCells --- loader/src/ui/internal/list/InstallListPopup.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/loader/src/ui/internal/list/InstallListPopup.cpp b/loader/src/ui/internal/list/InstallListPopup.cpp index e561ca9b..42beb812 100644 --- a/loader/src/ui/internal/list/InstallListPopup.cpp +++ b/loader/src/ui/internal/list/InstallListPopup.cpp @@ -113,7 +113,7 @@ CCArray* InstallListPopup::createCells(std::unordered_mapisUninstalled()*/item.mod->getMetadata().getID() == "geode.loader") { + if (item.mod && /*!item.mod->isUninstalled()*/item.mod->getMetadata().getID() == "geode.loader") { bottom.push_back(ModInstallListCell::create(item.mod, this, this->getCellSize())); for (auto const& dep : item.mod->getMetadata().getDependencies()) { queue.push(dep); From dd0179c42ae1bbc3b626e55d58bd475bcc400b5e Mon Sep 17 00:00:00 2001 From: altalk23 <45172705+altalk23@users.noreply.github.com> Date: Wed, 27 Sep 2023 15:27:11 +0300 Subject: [PATCH 74/98] Fix garagelayer ids on not logged in users --- bindings/GeometryDash.bro | 1 + loader/src/ids/GJGarageLayer.cpp | 7 +++++-- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/bindings/GeometryDash.bro b/bindings/GeometryDash.bro index c99ca6ef..e4088c89 100644 --- a/bindings/GeometryDash.bro +++ b/bindings/GeometryDash.bro @@ -1801,6 +1801,7 @@ class GJAccountManager : cocos2d::CCNode { gd::string m_password; gd::string m_username; int m_accountID; + int m_playerID; } class GJAccountSyncDelegate { diff --git a/loader/src/ids/GJGarageLayer.cpp b/loader/src/ids/GJGarageLayer.cpp index 57d644c5..b4ea8425 100644 --- a/loader/src/ids/GJGarageLayer.cpp +++ b/loader/src/ids/GJGarageLayer.cpp @@ -7,8 +7,11 @@ using namespace geode::prelude; $register_ids(GJGarageLayer) { + // the lock does not exist for not logged in users + auto loggedInOffset = GJAccountManager::get()->m_accountID == GJAccountManager::get()->m_playerID ? -1 : 0; + setIDSafe(this, 2, "username-label"); - setIDSafe(this, 6, "player-icon"); + setIDSafe(this, 6 + loggedInOffset, "player-icon"); auto winSize = CCDirector::get()->getWinSize(); @@ -39,7 +42,7 @@ $register_ids(GJGarageLayer) { setIDs( this, - 10, + 10 + loggedInOffset, "cube-selection-menu", "ship-selection-menu", "ball-selection-menu", From 9a1e085d185eed679c374c9eb6be96c573bd7a5a Mon Sep 17 00:00:00 2001 From: altalk23 <45172705+altalk23@users.noreply.github.com> Date: Wed, 27 Sep 2023 15:35:14 +0300 Subject: [PATCH 75/98] add GJAccountManager::get --- bindings/GeometryDash.bro | 3 +++ 1 file changed, 3 insertions(+) diff --git a/bindings/GeometryDash.bro b/bindings/GeometryDash.bro index e4088c89..e652c130 100644 --- a/bindings/GeometryDash.bro +++ b/bindings/GeometryDash.bro @@ -1795,6 +1795,9 @@ class GJAccountLoginDelegate { class GJAccountManager : cocos2d::CCNode { static GJAccountManager* sharedState() = mac 0x85070, win 0x107d50; + static GJAccountManager* get() { + return GJAccountManager::sharedState(); + } gd::string getGJP() = mac 0x89520, win 0x10abb0; PAD = mac 0x8, win 0x4; From a5c626647e379e82f702867644aab008e480004f Mon Sep 17 00:00:00 2001 From: altalk23 <45172705+altalk23@users.noreply.github.com> Date: Fri, 29 Sep 2023 13:04:26 +0300 Subject: [PATCH 76/98] add some be bindings --- bindings/GeometryDash.bro | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/bindings/GeometryDash.bro b/bindings/GeometryDash.bro index e652c130..2f8bbeba 100644 --- a/bindings/GeometryDash.bro +++ b/bindings/GeometryDash.bro @@ -1309,6 +1309,8 @@ class EditorUI : cocos2d::CCLayer, FLAlertLayerProtocol, ColorSelectDelegate, GJ void create(LevelEditorLayer*) = mac 0x8a80, win 0x76270; cocos2d::CCArray* createCustomItems() = mac 0x1ddf0, win 0x7a370; + void onDeleteCustomItem(CCObject* pSender) = win 0x7a280, mac 0x29860; + void onNewCustomItem(CCObject* pSender) = win 0x79fd0, mac 0x24480; void deselectAll() = mac 0x1f300, win 0x86af0; void onDeselectAll(cocos2d::CCObject*) = mac 0x19cd0, win 0x86ac0; void disableButton(CreateMenuItem*) = mac 0x1c0f0, win 0x78af0; @@ -2596,21 +2598,21 @@ class GJScaleControl : cocos2d::CCLayer { virtual void ccTouchMoved(cocos2d::CCTouch*, cocos2d::CCEvent*) = mac 0x31e60, win 0x94840; virtual void ccTouchEnded(cocos2d::CCTouch*, cocos2d::CCEvent*) = mac 0x31fb0, win 0x94940; virtual void ccTouchCancelled(cocos2d::CCTouch*, cocos2d::CCEvent*) = mac 0x32060, win 0x2dea0; // shared with many others - void updateLabel(float value) = win 0x94990; + void updateLabel(float value) = win 0x94990, mac 0x31c90; void loadValues(GameObject* obj, cocos2d::CCArray* objs) = win 0x94590, mac 0x24f40; Slider* m_slider; unsigned int m_touchID; float m_value; - PAD = mac 0x8, win 0x4; + bool m_shouldSnapAt1; cocos2d::CCLabelBMFont* m_label; GJScaleControlDelegate* m_delegate; } class GJScaleControlDelegate { + virtual void scaleChanged(float) {} virtual void scaleChangeBegin() {} virtual void scaleChangeEnded() {} - virtual void scaleChanged(float) {} } class GJScoreCell : TableViewCell, FLAlertLayerProtocol { From ccde9a28b00c0c43895d27f96f83c97c537473b8 Mon Sep 17 00:00:00 2001 From: ConfiG Date: Fri, 29 Sep 2023 18:27:37 +0300 Subject: [PATCH 77/98] update crash report issue template --- .github/ISSUE_TEMPLATE/crash-report.yml | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/.github/ISSUE_TEMPLATE/crash-report.yml b/.github/ISSUE_TEMPLATE/crash-report.yml index 1876861b..3b75839c 100644 --- a/.github/ISSUE_TEMPLATE/crash-report.yml +++ b/.github/ISSUE_TEMPLATE/crash-report.yml @@ -7,7 +7,10 @@ body: label: Geode Issue description: The Geode repository is for issues of Geode Loader, not individual mods created by other developers. options: - - label: I confirm that this crash is directly related to Geode Loader. + - label: I confirm that this crash is **NOT** related to a *mod* but directly to *Geode Loader* itself. + description: | + Please make sure that the crash is *actually* related to ***Geode Loader itself*** and not to a mod or mod combination. + Failing to do this will get your issue *closed without explanation*. required: true - type: dropdown id: platform From 20733278af129fef2f49752bb21f083fcc59578e Mon Sep 17 00:00:00 2001 From: ConfiG Date: Fri, 29 Sep 2023 18:28:53 +0300 Subject: [PATCH 78/98] fix last commit --- .github/ISSUE_TEMPLATE/crash-report.yml | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/.github/ISSUE_TEMPLATE/crash-report.yml b/.github/ISSUE_TEMPLATE/crash-report.yml index 3b75839c..a5d6a8aa 100644 --- a/.github/ISSUE_TEMPLATE/crash-report.yml +++ b/.github/ISSUE_TEMPLATE/crash-report.yml @@ -5,12 +5,12 @@ body: - type: checkboxes attributes: label: Geode Issue - description: The Geode repository is for issues of Geode Loader, not individual mods created by other developers. + description: | + The Geode repository is for issues of *Geode Loader*, not individual mods created by other developers. + When submitting a crash report, please make sure that the crash is *actually* related to ***Geode Loader itself*** and not to a mod or mod combination. + Failing to do this will get your issue *closed without explanation*. options: - label: I confirm that this crash is **NOT** related to a *mod* but directly to *Geode Loader* itself. - description: | - Please make sure that the crash is *actually* related to ***Geode Loader itself*** and not to a mod or mod combination. - Failing to do this will get your issue *closed without explanation*. required: true - type: dropdown id: platform From 51c2546e12d2c146973c8a6a786fae5fad481fe9 Mon Sep 17 00:00:00 2001 From: ConfiG Date: Fri, 29 Sep 2023 18:30:02 +0300 Subject: [PATCH 79/98] label doesnt support markdown github please add a way to preview issue templates smh --- .github/ISSUE_TEMPLATE/crash-report.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/ISSUE_TEMPLATE/crash-report.yml b/.github/ISSUE_TEMPLATE/crash-report.yml index a5d6a8aa..9e882af8 100644 --- a/.github/ISSUE_TEMPLATE/crash-report.yml +++ b/.github/ISSUE_TEMPLATE/crash-report.yml @@ -10,7 +10,7 @@ body: When submitting a crash report, please make sure that the crash is *actually* related to ***Geode Loader itself*** and not to a mod or mod combination. Failing to do this will get your issue *closed without explanation*. options: - - label: I confirm that this crash is **NOT** related to a *mod* but directly to *Geode Loader* itself. + - label: I confirm that this crash is NOT related to a mod but directly to Geode Loader itself. required: true - type: dropdown id: platform From 381e0ec43ac7c31e687b0eaafeb807ce252308fc Mon Sep 17 00:00:00 2001 From: altalk23 <45172705+altalk23@users.noreply.github.com> Date: Sat, 30 Sep 2023 08:13:54 +0300 Subject: [PATCH 80/98] uilayer --- bindings/GeometryDash.bro | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/bindings/GeometryDash.bro b/bindings/GeometryDash.bro index 2f8bbeba..4149adcf 100644 --- a/bindings/GeometryDash.bro +++ b/bindings/GeometryDash.bro @@ -5778,7 +5778,7 @@ class UILayer : cocos2d::CCLayerColor { virtual void keyDown(cocos2d::enumKeyCodes key) = mac 0x280470, win 0x25f890; virtual void keyUp(cocos2d::enumKeyCodes key) = mac 0x280600, win 0x25fa10; UILayer() = win 0x25f230; - ~UILayer() = win 0x25fef0; + ~UILayer() = win 0x25fef0, mac 0x280c90; PAD = mac 0x16, win 0x8, android 0x8; cocos2d::CCMenu* m_checkPointMenu; From 5d5b90e67cbc501423b4cdb1786f95309959b880 Mon Sep 17 00:00:00 2001 From: altalk23 <45172705+altalk23@users.noreply.github.com> Date: Sat, 30 Sep 2023 08:14:50 +0300 Subject: [PATCH 81/98] add the cocos namespace --- bindings/GeometryDash.bro | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/bindings/GeometryDash.bro b/bindings/GeometryDash.bro index 4149adcf..ac814eef 100644 --- a/bindings/GeometryDash.bro +++ b/bindings/GeometryDash.bro @@ -1309,8 +1309,8 @@ class EditorUI : cocos2d::CCLayer, FLAlertLayerProtocol, ColorSelectDelegate, GJ void create(LevelEditorLayer*) = mac 0x8a80, win 0x76270; cocos2d::CCArray* createCustomItems() = mac 0x1ddf0, win 0x7a370; - void onDeleteCustomItem(CCObject* pSender) = win 0x7a280, mac 0x29860; - void onNewCustomItem(CCObject* pSender) = win 0x79fd0, mac 0x24480; + void onDeleteCustomItem(cocos2d::CCObject* pSender) = win 0x7a280, mac 0x29860; + void onNewCustomItem(cocos2d::CCObject* pSender) = win 0x79fd0, mac 0x24480; void deselectAll() = mac 0x1f300, win 0x86af0; void onDeselectAll(cocos2d::CCObject*) = mac 0x19cd0, win 0x86ac0; void disableButton(CreateMenuItem*) = mac 0x1c0f0, win 0x78af0; From 6a3f8e01cedd4ae67af0f1f3a24b6dd35a5c9459 Mon Sep 17 00:00:00 2001 From: ConfiG Date: Sat, 30 Sep 2023 18:13:40 +0300 Subject: [PATCH 82/98] mac CCNode::convertTo*SpaceAR reimpl --- bindings/Cocos2d.bro | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/bindings/Cocos2d.bro b/bindings/Cocos2d.bro index b31a8d3a..9694c00b 100644 --- a/bindings/Cocos2d.bro +++ b/bindings/Cocos2d.bro @@ -638,6 +638,12 @@ class cocos2d::CCNode { virtual auto cleanup() = mac 0x123100, ios 0x15e3a4; auto convertToNodeSpace(cocos2d::CCPoint const&) = mac 0x124750, ios 0x15f55c; auto convertToWorldSpace(cocos2d::CCPoint const&) = mac 0x124790; + cocos2d::CCPoint convertToNodeSpaceAR(cocos2d::CCPoint const& worldPoint) { + return convertToNodeSpace(worldPoint) - getAnchorPointInPoints(); + } + cocos2d::CCPoint convertToWorldSpaceAR(cocos2d::CCPoint const& nodePoint) { + return convertToWorldSpace(nodePoint + getAnchorPointInPoints()); + } static cocos2d::CCNode* create() = mac 0x1230a0; virtual auto draw() = mac 0x123840, ios 0x15e974; auto getActionByTag(int) = mac 0x123ee0; From c768742dd4d68432d4fe27654c9db96210c27a56 Mon Sep 17 00:00:00 2001 From: alk <45172705+altalk23@users.noreply.github.com> Date: Sat, 30 Sep 2023 19:22:51 +0300 Subject: [PATCH 83/98] Add the checkbox to bug report --- .github/ISSUE_TEMPLATE/bug-report.yml | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/.github/ISSUE_TEMPLATE/bug-report.yml b/.github/ISSUE_TEMPLATE/bug-report.yml index 8847d1ff..1c0a4994 100644 --- a/.github/ISSUE_TEMPLATE/bug-report.yml +++ b/.github/ISSUE_TEMPLATE/bug-report.yml @@ -1,7 +1,17 @@ name: Bug Report -description: Report a bug where something is not working as expected in Geode Loader (not specific mods), which does not crash the game. +description: Report a Geode bug (not mods themselves) where something is not working as expected in Geode Loader (not mods created by others), which does not crash the game. labels: [ "unverified", "bug" ] body: + - type: checkboxes + attributes: + label: Geode Issue + description: | + The Geode repository is for issues of *Geode Loader*, not individual mods created by other developers. + When submitting a bug report, please make sure that the bug is *actually* related to ***Geode Loader itself*** and not to a mod or mod combination. + Failing to do this will get your issue *closed without explanation*. + options: + - label: I confirm that this bug is NOT related to a mod but directly to Geode Loader itself. + required: true - type: dropdown id: platform attributes: From 3e7b1d7e19d2c3574bfdb4f8bcc66f0fea758092 Mon Sep 17 00:00:00 2001 From: ConfiG Date: Sun, 1 Oct 2023 12:57:55 +0300 Subject: [PATCH 84/98] Update crash-report.yml --- .github/ISSUE_TEMPLATE/crash-report.yml | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/.github/ISSUE_TEMPLATE/crash-report.yml b/.github/ISSUE_TEMPLATE/crash-report.yml index 9e882af8..636b5b0a 100644 --- a/.github/ISSUE_TEMPLATE/crash-report.yml +++ b/.github/ISSUE_TEMPLATE/crash-report.yml @@ -2,16 +2,17 @@ name: Crash Report description: Report a Geode bug (not mods themselves) that crashes the game or prevents startup caused by Geode Loader (not mods created by others). labels: [ "unverified", "crash" ] body: - - type: checkboxes + - type: input + id: geode-confirmation attributes: label: Geode Issue description: | The Geode repository is for issues of *Geode Loader*, not individual mods created by other developers. - When submitting a crash report, please make sure that the crash is *actually* related to ***Geode Loader itself*** and not to a mod or mod combination. + When submitting a crash report, please make sure that the crash is *actually* related to ***Geode Loader itself*** and not to a mod or mod combination, after you do that type in "confirm" in the input field below. Failing to do this will get your issue *closed without explanation*. - options: - - label: I confirm that this crash is NOT related to a mod but directly to Geode Loader itself. - required: true + placeholder: "Please, read the text above." + validations: + required: true - type: dropdown id: platform attributes: From cca9e95c6e894a51f8e5aa5692c32f620947cd91 Mon Sep 17 00:00:00 2001 From: ConfiG Date: Sun, 1 Oct 2023 12:58:21 +0300 Subject: [PATCH 85/98] Update crash-report.yml --- .github/ISSUE_TEMPLATE/crash-report.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/ISSUE_TEMPLATE/crash-report.yml b/.github/ISSUE_TEMPLATE/crash-report.yml index 636b5b0a..776fbc64 100644 --- a/.github/ISSUE_TEMPLATE/crash-report.yml +++ b/.github/ISSUE_TEMPLATE/crash-report.yml @@ -11,8 +11,8 @@ body: When submitting a crash report, please make sure that the crash is *actually* related to ***Geode Loader itself*** and not to a mod or mod combination, after you do that type in "confirm" in the input field below. Failing to do this will get your issue *closed without explanation*. placeholder: "Please, read the text above." - validations: - required: true + validations: + required: true - type: dropdown id: platform attributes: From 66bdbb288808a3db86d6139609253a100054937b Mon Sep 17 00:00:00 2001 From: ConfiG Date: Sun, 1 Oct 2023 13:00:58 +0300 Subject: [PATCH 86/98] it's below oops --- .github/ISSUE_TEMPLATE/crash-report.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/ISSUE_TEMPLATE/crash-report.yml b/.github/ISSUE_TEMPLATE/crash-report.yml index 776fbc64..fc0a62f3 100644 --- a/.github/ISSUE_TEMPLATE/crash-report.yml +++ b/.github/ISSUE_TEMPLATE/crash-report.yml @@ -10,7 +10,7 @@ body: The Geode repository is for issues of *Geode Loader*, not individual mods created by other developers. When submitting a crash report, please make sure that the crash is *actually* related to ***Geode Loader itself*** and not to a mod or mod combination, after you do that type in "confirm" in the input field below. Failing to do this will get your issue *closed without explanation*. - placeholder: "Please, read the text above." + placeholder: "Please, read the text below." validations: required: true - type: dropdown From fd40288064327796905cc9b3ae32d2288c9a2cdd Mon Sep 17 00:00:00 2001 From: ConfiG Date: Sun, 1 Oct 2023 13:02:02 +0300 Subject: [PATCH 87/98] and this is above --- .github/ISSUE_TEMPLATE/crash-report.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/ISSUE_TEMPLATE/crash-report.yml b/.github/ISSUE_TEMPLATE/crash-report.yml index fc0a62f3..f4c372a4 100644 --- a/.github/ISSUE_TEMPLATE/crash-report.yml +++ b/.github/ISSUE_TEMPLATE/crash-report.yml @@ -8,7 +8,7 @@ body: label: Geode Issue description: | The Geode repository is for issues of *Geode Loader*, not individual mods created by other developers. - When submitting a crash report, please make sure that the crash is *actually* related to ***Geode Loader itself*** and not to a mod or mod combination, after you do that type in "confirm" in the input field below. + When submitting a crash report, please make sure that the crash is *actually* related to ***Geode Loader itself*** and not to a mod or mod combination, after you do that type in "confirm" in the input field above. Failing to do this will get your issue *closed without explanation*. placeholder: "Please, read the text below." validations: From dd066d9b1e1302c808cb67031d28ecf757ca2201 Mon Sep 17 00:00:00 2001 From: mat <26722564+matcool@users.noreply.github.com> Date: Sun, 1 Oct 2023 08:28:10 -0300 Subject: [PATCH 88/98] Update CHANGELOG.md --- CHANGELOG.md | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index ed989299..094bce59 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,13 @@ # Geode Changelog +## v1.3.5 + * Follow redirect in web::utils functions (a942a45) + * Lots of bindings + * Make codegen symbols private visibility (696a2ca) + * Add deadstrip to macos (0d62940) + * Readd the nullptr check in InstallListPopup::createCells (499f256) + * Fix garagelayer ids on not logged in users (dd0179c) + ## v1.3.4 * Implement string setting character filters (cf8fbba) * Update bindings From 4b82a0fb952b45cef40d3e34de10280a163e5a08 Mon Sep 17 00:00:00 2001 From: mat <26722564+matcool@users.noreply.github.com> Date: Sun, 1 Oct 2023 08:28:33 -0300 Subject: [PATCH 89/98] Update VERSION --- VERSION | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/VERSION b/VERSION index 8c9698aa..80e78df6 100644 --- a/VERSION +++ b/VERSION @@ -1 +1 @@ -1.3.4 \ No newline at end of file +1.3.5 From 9c842de37183a9e60cc6622e24745bb5acbec8c6 Mon Sep 17 00:00:00 2001 From: Fire <17692105+FireMario211@users.noreply.github.com> Date: Sun, 1 Oct 2023 20:21:31 +0000 Subject: [PATCH 90/98] Add a lot of mac bindings why werent these added before, only 1 mac missing from DailyLevelPage --- bindings/GeometryDash.bro | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/bindings/GeometryDash.bro b/bindings/GeometryDash.bro index ac814eef..c3d0d9c6 100644 --- a/bindings/GeometryDash.bro +++ b/bindings/GeometryDash.bro @@ -951,15 +951,15 @@ class CreateMenuItem : CCMenuItemSpriteExtra { class CreatorLayer : cocos2d::CCLayer, cocos2d::CCSceneTransitionDelegate, DialogDelegate { void onBack(cocos2d::CCObject*) = win 0x4fae0; void onChallenge(cocos2d::CCObject*) = mac 0x142960, win 0x4f1b0; - void onLeaderboards(cocos2d::CCObject*) = win 0x4ed20; + void onLeaderboards(cocos2d::CCObject*) = mac 0x142920, win 0x4ed20; void onMyLevels(cocos2d::CCObject*) = mac 0x142b70, win 0x4eaa0; void onSavedLevels(cocos2d::CCObject*) = mac 0x142860, win 0x4ebe0; - void onDailyLevel(cocos2d::CCObject*) = win 0x4f170; - void onWeeklyLevel(cocos2d::CCObject*) = win 0x4f190; - void onFeaturedLevels(cocos2d::CCObject*) = win 0x4edf0; - void onFameLevels(cocos2d::CCObject*) = win 0x4ee70; - void onMapPacks(cocos2d::CCObject*) = win 0x4efb0; - void onOnlineLevels(cocos2d::CCObject*) = win 0x4ef60; + void onDailyLevel(cocos2d::CCObject*) = mac 0x142980, win 0x4f170; + void onWeeklyLevel(cocos2d::CCObject*) = mac 0x1429a0, win 0x4f190; + void onFeaturedLevels(cocos2d::CCObject*) = mac 0x142a20, win 0x4edf0; + void onFameLevels(cocos2d::CCObject*) = mac 0x142a80, win 0x4ee70; + void onMapPacks(cocos2d::CCObject*) = mac 0x1429c0, win 0x4efb0; + void onOnlineLevels(cocos2d::CCObject*) = mac 0x142ae0, win 0x4ef60; void onGauntlets(cocos2d::CCObject*) = mac 0x142b20, win 0x4f0a0; void onSecretVault(cocos2d::CCObject*) = win 0x4f1d0; void onTreasureRoom(cocos2d::CCObject*) = win 0x4f540; @@ -1079,7 +1079,7 @@ class CustomizeObjectLayer : FLAlertLayer, TextInputDelegate, HSVWidgetPopupDele } class DailyLevelPage : FLAlertLayer, FLAlertLayerProtocol, GJDailyLevelDelegate, LevelDownloadDelegate { - static DailyLevelPage* create(bool weekly) = win 0x6a860; + static DailyLevelPage* create(bool weekly) = mac 0x108ac0, win 0x6a860; bool init(bool weekly) = mac 0x108C90, win 0x6a900; virtual void updateTimers(float) = mac 0x109780, win 0x6bef0; virtual void show() = mac 0x10a4b0, win 0x3f360; From 7f277a77e1f7b6c9223684cf026de7b14389dc7c Mon Sep 17 00:00:00 2001 From: SMJS <38814077+SMJSGaming@users.noreply.github.com> Date: Sun, 1 Oct 2023 23:59:44 +0200 Subject: [PATCH 91/98] Added a simple text area UI node (#277) --- loader/include/Geode/ui/TextArea.hpp | 60 +++++++ loader/src/ui/nodes/TextArea.cpp | 228 +++++++++++++++++++++++++++ 2 files changed, 288 insertions(+) create mode 100644 loader/include/Geode/ui/TextArea.hpp create mode 100644 loader/src/ui/nodes/TextArea.cpp diff --git a/loader/include/Geode/ui/TextArea.hpp b/loader/include/Geode/ui/TextArea.hpp new file mode 100644 index 00000000..0ac0cf31 --- /dev/null +++ b/loader/include/Geode/ui/TextArea.hpp @@ -0,0 +1,60 @@ +#pragma once + +#include +#include + +namespace geode { + /** + * A class which provides a textarea with proper alignment and some extra features like: + * + * - Max lines + * - Changing all aspects after creation + * - Custom text alignment + * - Automatic line wrapping and cutoff + * - Line padding + * + * Contact me on Discord (\@smjs) if you have any questions, suggestions or bugs. + */ + class GEODE_DLL SimpleTextArea : public cocos2d::CCNode { + cocos2d::CCMenu* m_container; + std::string m_font; + std::string m_text; + std::vector m_lines; + cocos2d::CCTextAlignment m_alignment; + size_t m_maxLines; + float m_scale; + float m_lineHeight; + float m_linePadding; + bool m_artificialWidth; + public: + static SimpleTextArea* create(const std::string& font, const std::string& text, const float scale); + static SimpleTextArea* create(const std::string& font, const std::string& text, const float scale, const float width); + + void setFont(const std::string& font); + std::string getFont(); + void setAlignment(const cocos2d::CCTextAlignment alignment); + cocos2d::CCTextAlignment getAlignment(); + void setText(const std::string& text); + std::string getText(); + void setMaxLines(const size_t maxLines); + size_t getMaxLines(); + void setWidth(const float width); + float getWidth(); + void setScale(const float scale); + float getScale(); + void setLinePadding(const float padding); + float getLinePadding(); + std::vector getLines(); + float getHeight(); + float getLineHeight(); + private: + static SimpleTextArea* create(const std::string& font, const std::string& text, const float scale, const float width, const bool artificialWidth); + + SimpleTextArea(const std::string& font, const std::string& text, const float scale, const float width, const bool artificialWidth); + cocos2d::CCLabelBMFont* createLabel(const std::string& text, const float top); + cocos2d::CCLabelBMFont* moveOverflow(cocos2d::CCLabelBMFont* line, const char c, const float top); + float calculateOffset(cocos2d::CCLabelBMFont* label); + void updateLines(); + void updateContents(); + }; +} \ No newline at end of file diff --git a/loader/src/ui/nodes/TextArea.cpp b/loader/src/ui/nodes/TextArea.cpp new file mode 100644 index 00000000..4af0518b --- /dev/null +++ b/loader/src/ui/nodes/TextArea.cpp @@ -0,0 +1,228 @@ +#include + +using namespace geode::prelude; + +SimpleTextArea* SimpleTextArea::create(const std::string& font, const std::string& text, const float scale = 1) { + return SimpleTextArea::create(font, text, scale, 500, false); +} + +SimpleTextArea* SimpleTextArea::create(const std::string& font, const std::string& text, const float scale, const float width) { + return SimpleTextArea::create(font, text, scale, width, true); +} + +SimpleTextArea* SimpleTextArea::create(const std::string& font, const std::string& text, const float scale, const float width, const bool artificialWidth) { + SimpleTextArea* instance = new SimpleTextArea(font, text, scale, width, artificialWidth); + + if (instance && instance->init()) { + instance->autorelease(); + + return instance; + } else { + CC_SAFE_DELETE(instance); + + return nullptr; + } +} + +SimpleTextArea::SimpleTextArea(const std::string& font, const std::string& text, const float scale, const float width, const bool artificialWidth) { + m_font = font; + m_text = text; + m_maxLines = 0; + m_scale = scale; + m_linePadding = 0; + m_artificialWidth = artificialWidth; + m_container = CCMenu::create(); + + this->setAnchorPoint({ 0.5f, 0.5f }); + m_container->setPosition({ 0, 0 }); + m_container->setAnchorPoint({ 0, 1 }); + m_container->setContentSize({ width, 0 }); + + this->addChild(m_container); + this->updateContents(); +} + +void SimpleTextArea::setFont(const std::string& font) { + m_font = font; + + this->updateContents(); +} + +std::string SimpleTextArea::getFont() { + return m_font; +} + +void SimpleTextArea::setAlignment(const CCTextAlignment alignment) { + m_alignment = alignment; + + this->updateContents(); +} + +CCTextAlignment SimpleTextArea::getAlignment() { + return m_alignment; +} + +void SimpleTextArea::setText(const std::string& text) { + m_text = text; + + this->updateContents(); +} + +std::string SimpleTextArea::getText() { + return m_text; +} + +void SimpleTextArea::setMaxLines(const size_t maxLines) { + m_maxLines = maxLines; + + this->updateContents(); +} + +size_t SimpleTextArea::getMaxLines() { + return m_maxLines; +} + +void SimpleTextArea::setWidth(const float width) { + m_artificialWidth = true; + + this->setContentSize({ width, this->getContentSize().height }); + m_container->setContentSize(this->getContentSize()); +} + +float SimpleTextArea::getWidth() { + return m_container->getContentSize().width; +} + +void SimpleTextArea::setScale(const float scale) { + m_scale = scale; + + this->updateContents(); +} + +float SimpleTextArea::getScale() { + return m_scale; +} + +void SimpleTextArea::setLinePadding(const float padding) { + m_linePadding = padding; + + this->updateContents(); +} + +float SimpleTextArea::getLinePadding() { + return m_linePadding; +} + +std::vector SimpleTextArea::getLines() { + return m_lines; +} + +float SimpleTextArea::getHeight() { + return m_container->getContentSize().height; +} + +float SimpleTextArea::getLineHeight() { + return m_lineHeight; +} + +CCLabelBMFont* SimpleTextArea::createLabel(const std::string& text, const float top) { + CCLabelBMFont* label = CCLabelBMFont::create(text.c_str(), m_font.c_str()); + + label->setScale(m_scale); + label->setAnchorPoint({ 0, 0 }); + label->setPosition({ 0, top }); + + return label; +} + +CCLabelBMFont* SimpleTextArea::moveOverflow(CCLabelBMFont* line, const char c, const float top) { + const std::string text = line->getString(); + const char back = text.back(); + const bool lastIsSpace = back == ' '; + CCLabelBMFont* newLine = this->createLabel(std::string(!lastIsSpace, back).append(std::string(c != ' ', c)), top); + + if (!lastIsSpace) { + if (text[text.size() - 2] == ' ') { + line->setString(text.substr(0, text.size() - 1).c_str()); + } else { + line->setString((text.substr(0, text.size() - 1) + '-').c_str()); + } + } + + m_lines.push_back(newLine); + + return newLine; +} + +float SimpleTextArea::calculateOffset(CCLabelBMFont* label) { + return m_linePadding + label->getContentSize().height * m_scale; +} + +void SimpleTextArea::updateLines() { + float top = 0; + CCLabelBMFont* line = this->createLabel("", top); + m_lines = { line }; + + for (const char c : m_text) { + if (m_maxLines && m_lines.size() > m_maxLines) { + CCLabelBMFont* last = m_lines.at(m_maxLines - 1); + const std::string text = last->getString(); + + m_lines.pop_back(); + last->setString(text.substr(0, text.size() - 3).append("...").c_str()); + + break; + } else if (c == '\n') { + line = this->createLabel("", top -= this->calculateOffset(line)); + + m_lines.push_back(line); + } else if (m_artificialWidth && line->getContentSize().width >= this->getWidth()) { + line = this->moveOverflow(line, c, top -= this->calculateOffset(line)); + } else { + const std::string text = line->getString(); + + line->setString((text + c).c_str()); + } + } +} + +void SimpleTextArea::updateContents() { + this->updateLines(); + const size_t lineCount = m_lines.size(); + const float width = this->getWidth(); + + if (lineCount > 0) { + m_lineHeight = m_lines.back()->getContentSize().height * m_scale; + } else { + m_lineHeight = 0; + } + + float height = m_lineHeight * lineCount + m_linePadding * (lineCount - 1); + + this->setContentSize({ width, height }); + m_container->setContentSize(this->getContentSize()); + m_container->removeAllChildren(); + + height -= m_lineHeight; + + for (CCLabelBMFont* line : m_lines) { + const float y = height + line->getPositionY(); + + switch (m_alignment) { + case kCCTextAlignmentLeft: { + line->setAnchorPoint({ 0, 0 }); + line->setPosition({ 0, y }); + } break; + case kCCTextAlignmentCenter: { + line->setAnchorPoint({ 0.5f, 0 }); + line->setPosition({ width / 2, y }); + } break; + case kCCTextAlignmentRight: { + line->setAnchorPoint({ 1, 0 }); + line->setPosition({ width, y }); + } break; + } + + m_container->addChild(line); + } +} \ No newline at end of file From 16aa697ac75fb574700abf94822e96ba46a2acca Mon Sep 17 00:00:00 2001 From: SMJS <38814077+SMJSGaming@users.noreply.github.com> Date: Mon, 2 Oct 2023 00:11:31 +0200 Subject: [PATCH 92/98] Added a filter to only test offsets on bindings --- .github/workflows/test-offsets.yml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.github/workflows/test-offsets.yml b/.github/workflows/test-offsets.yml index 66cfcf47..dde5de3c 100644 --- a/.github/workflows/test-offsets.yml +++ b/.github/workflows/test-offsets.yml @@ -3,6 +3,8 @@ name: Test Offsets on: workflow_dispatch: push: + paths: + - 'bindings/**' # only when adjusting bindings branches: - '**' # every branch - '!no-build-**' # unless marked as no-build From 44fa9c6f69d5663dc9e9c770dfdb17033f0dd3a6 Mon Sep 17 00:00:00 2001 From: SMJS <38814077+SMJSGaming@users.noreply.github.com> Date: Mon, 2 Oct 2023 00:15:14 +0200 Subject: [PATCH 93/98] Added an additional path to cover in offset tests --- .github/workflows/test-offsets.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/test-offsets.yml b/.github/workflows/test-offsets.yml index dde5de3c..23403f67 100644 --- a/.github/workflows/test-offsets.yml +++ b/.github/workflows/test-offsets.yml @@ -5,6 +5,7 @@ on: push: paths: - 'bindings/**' # only when adjusting bindings + - 'loader/test/members/**' branches: - '**' # every branch - '!no-build-**' # unless marked as no-build From 3b8dbfa4d324e8ebd52f99e58afb876182debe1f Mon Sep 17 00:00:00 2001 From: SMJS <38814077+SMJSGaming@users.noreply.github.com> Date: Tue, 3 Oct 2023 12:07:33 +0200 Subject: [PATCH 94/98] Added 2 additional methods to GameStatsManager One of these (set stat) might be a risk to expose so I'm not 100% sure if you guys want it covered or not --- bindings/GeometryDash.bro | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/bindings/GeometryDash.bro b/bindings/GeometryDash.bro index c3d0d9c6..6c4f3f0e 100644 --- a/bindings/GeometryDash.bro +++ b/bindings/GeometryDash.bro @@ -3564,7 +3564,8 @@ class GameStatsManager : cocos2d::CCNode { int getBaseCurrencyForLevel(GJGameLevel*) = mac 0x43470, win 0xf8530; GJChallengeItem* getChallenge(int id) = mac 0x451f0, win 0xa2fb0; void getSecretCoinKey(char const*) = mac 0x429f0; - int getStat(char const*) = mac 0x3d310, win 0xf3580; + int getStat(char const* type) = mac 0x3d310, win 0xf3580; + void setStat(char const* type, int amount) = win 0xf3690; void hasPendingUserCoin(char const*) = mac 0x42730, win 0xf7c50; void hasSecretCoin(char const*) = mac 0x40730, win 0xf7dc0; void hasUserCoin(char const*) = mac 0x427e0, win 0xf7ae0; @@ -3576,6 +3577,7 @@ class GameStatsManager : cocos2d::CCNode { void storeSecretCoin(char const*) = mac 0x42a10; void storeUserCoin(char const*) = mac 0x42890; bool isItemUnlocked(UnlockType type, int id) = win 0xfbb80; + void checkAchievement(char const* type) = win 0xf37c0 PAD = mac 0x50, win 0x28; cocos2d::CCDictionary* m_dailyChests; From 2d172704efed8fa996f330be0a6d60e664d8da8c Mon Sep 17 00:00:00 2001 From: SMJS <38814077+SMJSGaming@users.noreply.github.com> Date: Tue, 3 Oct 2023 12:29:40 +0200 Subject: [PATCH 95/98] Fixed a typo in my last change to game stats manager (#281) * Added 2 additional methods to GameStatsManager One of these (set stat) might be a risk to expose so I'm not 100% sure if you guys want it covered or not * Fixed a typo in my last change to game stats manager --- bindings/GeometryDash.bro | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/bindings/GeometryDash.bro b/bindings/GeometryDash.bro index 6c4f3f0e..54dc755f 100644 --- a/bindings/GeometryDash.bro +++ b/bindings/GeometryDash.bro @@ -3577,7 +3577,7 @@ class GameStatsManager : cocos2d::CCNode { void storeSecretCoin(char const*) = mac 0x42a10; void storeUserCoin(char const*) = mac 0x42890; bool isItemUnlocked(UnlockType type, int id) = win 0xfbb80; - void checkAchievement(char const* type) = win 0xf37c0 + void checkAchievement(char const* type) = win 0xf37c0; PAD = mac 0x50, win 0x28; cocos2d::CCDictionary* m_dailyChests; From 0e8865546c8ab96cbb182ce13b316df40fbfc72c Mon Sep 17 00:00:00 2001 From: SMJS <38814077+SMJSGaming@users.noreply.github.com> Date: Tue, 3 Oct 2023 22:28:15 +0200 Subject: [PATCH 96/98] Fixed alignment issues caused by unallocated memory and bad anchor points Simply put, alignment had no default assignment, causing undefined behavior, this also revealed some bad anchor points which could be optimized --- loader/src/ui/nodes/TextArea.cpp | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-) diff --git a/loader/src/ui/nodes/TextArea.cpp b/loader/src/ui/nodes/TextArea.cpp index 4af0518b..9dce696f 100644 --- a/loader/src/ui/nodes/TextArea.cpp +++ b/loader/src/ui/nodes/TextArea.cpp @@ -30,6 +30,7 @@ SimpleTextArea::SimpleTextArea(const std::string& font, const std::string& text, m_maxLines = 0; m_scale = scale; m_linePadding = 0; + m_alignment = kCCTextAlignmentLeft; m_artificialWidth = artificialWidth; m_container = CCMenu::create(); @@ -129,7 +130,6 @@ CCLabelBMFont* SimpleTextArea::createLabel(const std::string& text, const float CCLabelBMFont* label = CCLabelBMFont::create(text.c_str(), m_font.c_str()); label->setScale(m_scale); - label->setAnchorPoint({ 0, 0 }); label->setPosition({ 0, top }); return label; @@ -203,26 +203,24 @@ void SimpleTextArea::updateContents() { m_container->setContentSize(this->getContentSize()); m_container->removeAllChildren(); - height -= m_lineHeight; - for (CCLabelBMFont* line : m_lines) { const float y = height + line->getPositionY(); switch (m_alignment) { case kCCTextAlignmentLeft: { - line->setAnchorPoint({ 0, 0 }); + line->setAnchorPoint({ 0, 1 }); line->setPosition({ 0, y }); } break; case kCCTextAlignmentCenter: { - line->setAnchorPoint({ 0.5f, 0 }); + line->setAnchorPoint({ 0.5f, 1 }); line->setPosition({ width / 2, y }); } break; case kCCTextAlignmentRight: { - line->setAnchorPoint({ 1, 0 }); + line->setAnchorPoint({ 1, 1 }); line->setPosition({ width, y }); } break; } m_container->addChild(line); } -} \ No newline at end of file +} From 36c461ace47e2939c1f37709ee4514cb0c08d5ba Mon Sep 17 00:00:00 2001 From: SMJS <38814077+SMJSGaming@users.noreply.github.com> Date: Tue, 3 Oct 2023 22:33:59 +0200 Subject: [PATCH 97/98] Fixed alignment issues caused by unallocated memory and bad anchor points (#282) --- loader/src/ui/nodes/TextArea.cpp | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-) diff --git a/loader/src/ui/nodes/TextArea.cpp b/loader/src/ui/nodes/TextArea.cpp index 4af0518b..9dce696f 100644 --- a/loader/src/ui/nodes/TextArea.cpp +++ b/loader/src/ui/nodes/TextArea.cpp @@ -30,6 +30,7 @@ SimpleTextArea::SimpleTextArea(const std::string& font, const std::string& text, m_maxLines = 0; m_scale = scale; m_linePadding = 0; + m_alignment = kCCTextAlignmentLeft; m_artificialWidth = artificialWidth; m_container = CCMenu::create(); @@ -129,7 +130,6 @@ CCLabelBMFont* SimpleTextArea::createLabel(const std::string& text, const float CCLabelBMFont* label = CCLabelBMFont::create(text.c_str(), m_font.c_str()); label->setScale(m_scale); - label->setAnchorPoint({ 0, 0 }); label->setPosition({ 0, top }); return label; @@ -203,26 +203,24 @@ void SimpleTextArea::updateContents() { m_container->setContentSize(this->getContentSize()); m_container->removeAllChildren(); - height -= m_lineHeight; - for (CCLabelBMFont* line : m_lines) { const float y = height + line->getPositionY(); switch (m_alignment) { case kCCTextAlignmentLeft: { - line->setAnchorPoint({ 0, 0 }); + line->setAnchorPoint({ 0, 1 }); line->setPosition({ 0, y }); } break; case kCCTextAlignmentCenter: { - line->setAnchorPoint({ 0.5f, 0 }); + line->setAnchorPoint({ 0.5f, 1 }); line->setPosition({ width / 2, y }); } break; case kCCTextAlignmentRight: { - line->setAnchorPoint({ 1, 0 }); + line->setAnchorPoint({ 1, 1 }); line->setPosition({ width, y }); } break; } m_container->addChild(line); } -} \ No newline at end of file +} From 42a1a33c532a4c86546ee0b0eb55dcfd3b9f0382 Mon Sep 17 00:00:00 2001 From: SMJSGaming Date: Tue, 10 Oct 2023 19:19:12 +0200 Subject: [PATCH 98/98] Added word wrappers, colors and optimizations to text area --- loader/include/Geode/ui/TextArea.hpp | 33 ++++-- loader/src/ui/nodes/TextArea.cpp | 168 +++++++++++++++++++-------- 2 files changed, 146 insertions(+), 55 deletions(-) diff --git a/loader/include/Geode/ui/TextArea.hpp b/loader/include/Geode/ui/TextArea.hpp index 0ac0cf31..c923d4e4 100644 --- a/loader/include/Geode/ui/TextArea.hpp +++ b/loader/include/Geode/ui/TextArea.hpp @@ -4,36 +4,47 @@ #include namespace geode { + enum WrappingMode { + NO_WRAP, + WORD_WRAP, + CUTOFF_WRAP + }; + /** * A class which provides a textarea with proper alignment and some extra features like: * * - Max lines * - Changing all aspects after creation * - Custom text alignment - * - Automatic line wrapping and cutoff + * - Configurable and automatic word wrapping * - Line padding * * Contact me on Discord (\@smjs) if you have any questions, suggestions or bugs. */ class GEODE_DLL SimpleTextArea : public cocos2d::CCNode { + static SimpleTextArea* create(const std::string& text, const std::string& font = "chatFont.fnt", const float scale = 1); + static SimpleTextArea* create(const std::string& text, const std::string& font, const float scale, const float width); + cocos2d::CCMenu* m_container; std::string m_font; std::string m_text; std::vector m_lines; + cocos2d::ccColor4B m_color; cocos2d::CCTextAlignment m_alignment; + WrappingMode m_wrappingMode; size_t m_maxLines; float m_scale; float m_lineHeight; float m_linePadding; - bool m_artificialWidth; - public: - static SimpleTextArea* create(const std::string& font, const std::string& text, const float scale); - static SimpleTextArea* create(const std::string& font, const std::string& text, const float scale, const float width); void setFont(const std::string& font); std::string getFont(); + void setColor(const cocos2d::ccColor4B& color); + cocos2d::ccColor4B getColor(); void setAlignment(const cocos2d::CCTextAlignment alignment); cocos2d::CCTextAlignment getAlignment(); + void setWrappingMode(const WrappingMode mode); + WrappingMode getWrappingMode(); void setText(const std::string& text); std::string getText(); void setMaxLines(const size_t maxLines); @@ -50,11 +61,17 @@ namespace geode { private: static SimpleTextArea* create(const std::string& font, const std::string& text, const float scale, const float width, const bool artificialWidth); + bool m_shouldUpdate; + bool m_artificialWidth; + SimpleTextArea(const std::string& font, const std::string& text, const float scale, const float width, const bool artificialWidth); cocos2d::CCLabelBMFont* createLabel(const std::string& text, const float top); - cocos2d::CCLabelBMFont* moveOverflow(cocos2d::CCLabelBMFont* line, const char c, const float top); float calculateOffset(cocos2d::CCLabelBMFont* label); - void updateLines(); - void updateContents(); + void charIteration(const std::function& overflowHandling); + void updateLinesNoWrap(); + void updateLinesWordWrap(); + void updateLinesCutoffWrap(); + void updateContainer(); + virtual void draw() override; }; } \ No newline at end of file diff --git a/loader/src/ui/nodes/TextArea.cpp b/loader/src/ui/nodes/TextArea.cpp index 9dce696f..a2b74717 100644 --- a/loader/src/ui/nodes/TextArea.cpp +++ b/loader/src/ui/nodes/TextArea.cpp @@ -2,11 +2,11 @@ using namespace geode::prelude; -SimpleTextArea* SimpleTextArea::create(const std::string& font, const std::string& text, const float scale = 1) { - return SimpleTextArea::create(font, text, scale, 500, false); +SimpleTextArea* SimpleTextArea::create(const std::string& text, const std::string& font, const float scale) { + return SimpleTextArea::create(font, text, scale, CCDirector::sharedDirector()->getWinSize().width / 2, false); } -SimpleTextArea* SimpleTextArea::create(const std::string& font, const std::string& text, const float scale, const float width) { +SimpleTextArea* SimpleTextArea::create(const std::string& text, const std::string& font, const float scale, const float width) { return SimpleTextArea::create(font, text, scale, width, true); } @@ -30,9 +30,12 @@ SimpleTextArea::SimpleTextArea(const std::string& font, const std::string& text, m_maxLines = 0; m_scale = scale; m_linePadding = 0; + m_color = { 0xFF, 0xFF, 0xFF, 0xFF }; m_alignment = kCCTextAlignmentLeft; + m_wrappingMode = WORD_WRAP; m_artificialWidth = artificialWidth; m_container = CCMenu::create(); + m_shouldUpdate = true; this->setAnchorPoint({ 0.5f, 0.5f }); m_container->setPosition({ 0, 0 }); @@ -40,33 +43,47 @@ SimpleTextArea::SimpleTextArea(const std::string& font, const std::string& text, m_container->setContentSize({ width, 0 }); this->addChild(m_container); - this->updateContents(); } void SimpleTextArea::setFont(const std::string& font) { m_font = font; - - this->updateContents(); + m_shouldUpdate = true; } std::string SimpleTextArea::getFont() { return m_font; } +void SimpleTextArea::setColor(const ccColor4B& color) { + m_color = color; + m_shouldUpdate = true; +} + +ccColor4B SimpleTextArea::getColor() { + return m_color; +} + void SimpleTextArea::setAlignment(const CCTextAlignment alignment) { m_alignment = alignment; - - this->updateContents(); + m_shouldUpdate = true; } CCTextAlignment SimpleTextArea::getAlignment() { return m_alignment; } +void SimpleTextArea::setWrappingMode(const WrappingMode mode) { + m_wrappingMode = mode; + m_shouldUpdate = true; +} + +WrappingMode SimpleTextArea::getWrappingMode() { + return m_wrappingMode; +} + void SimpleTextArea::setText(const std::string& text) { m_text = text; - - this->updateContents(); + m_shouldUpdate = true; } std::string SimpleTextArea::getText() { @@ -75,8 +92,7 @@ std::string SimpleTextArea::getText() { void SimpleTextArea::setMaxLines(const size_t maxLines) { m_maxLines = maxLines; - - this->updateContents(); + m_shouldUpdate = true; } size_t SimpleTextArea::getMaxLines() { @@ -85,6 +101,7 @@ size_t SimpleTextArea::getMaxLines() { void SimpleTextArea::setWidth(const float width) { m_artificialWidth = true; + m_shouldUpdate = true; this->setContentSize({ width, this->getContentSize().height }); m_container->setContentSize(this->getContentSize()); @@ -96,8 +113,7 @@ float SimpleTextArea::getWidth() { void SimpleTextArea::setScale(const float scale) { m_scale = scale; - - this->updateContents(); + m_shouldUpdate = true; } float SimpleTextArea::getScale() { @@ -106,8 +122,7 @@ float SimpleTextArea::getScale() { void SimpleTextArea::setLinePadding(const float padding) { m_linePadding = padding; - - this->updateContents(); + m_shouldUpdate = true; } float SimpleTextArea::getLinePadding() { @@ -131,34 +146,17 @@ CCLabelBMFont* SimpleTextArea::createLabel(const std::string& text, const float label->setScale(m_scale); label->setPosition({ 0, top }); + label->setColor({ m_color.r, m_color.g, m_color.b }); + label->setOpacity(m_color.a); return label; } -CCLabelBMFont* SimpleTextArea::moveOverflow(CCLabelBMFont* line, const char c, const float top) { - const std::string text = line->getString(); - const char back = text.back(); - const bool lastIsSpace = back == ' '; - CCLabelBMFont* newLine = this->createLabel(std::string(!lastIsSpace, back).append(std::string(c != ' ', c)), top); - - if (!lastIsSpace) { - if (text[text.size() - 2] == ' ') { - line->setString(text.substr(0, text.size() - 1).c_str()); - } else { - line->setString((text.substr(0, text.size() - 1) + '-').c_str()); - } - } - - m_lines.push_back(newLine); - - return newLine; -} - float SimpleTextArea::calculateOffset(CCLabelBMFont* label) { return m_linePadding + label->getContentSize().height * m_scale; } -void SimpleTextArea::updateLines() { +void SimpleTextArea::charIteration(const std::function& overflowHandling) { float top = 0; CCLabelBMFont* line = this->createLabel("", top); m_lines = { line }; @@ -173,21 +171,87 @@ void SimpleTextArea::updateLines() { break; } else if (c == '\n') { - line = this->createLabel("", top -= this->calculateOffset(line)); - - m_lines.push_back(line); - } else if (m_artificialWidth && line->getContentSize().width >= this->getWidth()) { - line = this->moveOverflow(line, c, top -= this->calculateOffset(line)); + m_lines.push_back(line = this->createLabel("", top -= this->calculateOffset(line))); + } else if (m_artificialWidth && line->getContentSize().width * m_scale >= this->getWidth()) { + m_lines.push_back(line = overflowHandling(line, c, top -= this->calculateOffset(line))); } else { - const std::string text = line->getString(); - - line->setString((text + c).c_str()); + line->setString((std::string(line->getString()) + c).c_str()); } } } -void SimpleTextArea::updateContents() { - this->updateLines(); +void SimpleTextArea::updateLinesNoWrap() { + std::stringstream stream(m_text); + std::string part; + float top = 0; + + while (std::getline(stream, part)) { + if (m_maxLines && m_lines.size() >= m_maxLines) { + CCLabelBMFont* last = m_lines.at(m_maxLines - 1); + const std::string text = last->getString(); + + last->setString(text.substr(0, text.size() - 3).append("...").c_str()); + + break; + } else { + CCLabelBMFont* line = this->createLabel(part, 0); + + top -= this->calculateOffset(line); + + m_lines.push_back(line); + } + } +} + +void SimpleTextArea::updateLinesWordWrap() { + this->charIteration([this](CCLabelBMFont* line, const char c, const float top) { + static std::string delimiters(" `~!@#$%^&*()-_=+[{}];:'\",<.>/?\\|"); + + if (delimiters.find(c) == std::string_view::npos) { + const std::string text = line->getString(); + const size_t position = text.find_last_of(delimiters) + 1; + + line->setString(text.substr(0, position).c_str()); + + return this->createLabel(text.substr(position) + c, top); + } else { + return this->createLabel(std::string(c, c != ' '), top); + } + }); +} + +void SimpleTextArea::updateLinesCutoffWrap() { + this->charIteration([this](CCLabelBMFont* line, const char c, const float top) { + const std::string text = line->getString(); + const char back = text.back(); + const bool lastIsSpace = back == ' '; + CCLabelBMFont* newLine = this->createLabel(std::string(!lastIsSpace, back).append(std::string(c != ' ', c)), top); + + if (!lastIsSpace) { + if (text[text.size() - 2] == ' ') { + line->setString(text.substr(0, text.size() - 1).c_str()); + } else { + line->setString((text.substr(0, text.size() - 1) + '-').c_str()); + } + } + + return newLine; + }); +} + +void SimpleTextArea::updateContainer() { + switch (m_wrappingMode) { + case NO_WRAP: { + this->updateLinesNoWrap(); + } break; + case WORD_WRAP: { + this->updateLinesWordWrap(); + } break; + case CUTOFF_WRAP: { + this->updateLinesCutoffWrap(); + } break; + } + const size_t lineCount = m_lines.size(); const float width = this->getWidth(); @@ -212,7 +276,7 @@ void SimpleTextArea::updateContents() { line->setPosition({ 0, y }); } break; case kCCTextAlignmentCenter: { - line->setAnchorPoint({ 0.5f, 1 }); + line->setAnchorPoint({ 0, 1 }); line->setPosition({ width / 2, y }); } break; case kCCTextAlignmentRight: { @@ -224,3 +288,13 @@ void SimpleTextArea::updateContents() { m_container->addChild(line); } } + +void SimpleTextArea::draw() { + CCNode::draw(); + + if (m_shouldUpdate) { + this->updateContainer(); + + m_shouldUpdate = false; + } +} \ No newline at end of file