From aea0b298514a1c9970f239eb426c7f7d55e735ec Mon Sep 17 00:00:00 2001 From: FireMario211 <17692105+FireMario211@users.noreply.github.com> Date: Thu, 1 Feb 2024 18:14:43 -0500 Subject: [PATCH] bug fix updates --- changelog.md | 5 +++++ mod.json | 2 +- resources/hacks/settings.json | 8 ------- src/PrismUI.cpp | 42 +++++++++++++++++++++-------------- src/PrismUI.hpp | 6 +++-- src/main.cpp | 3 --- 6 files changed, 35 insertions(+), 31 deletions(-) diff --git a/changelog.md b/changelog.md index b1fba92..008eff7 100644 --- a/changelog.md +++ b/changelog.md @@ -1,3 +1,8 @@ +# v1.3.2 + - Removed Dear ImGui :( + - Removed Menu Style. + - Fixed performance issues. + - Fixed text centering issues with info popup. # v1.3.1 - Prevented users from being softlocked via speedhack. - Fixed text scaling issue with other languages. diff --git a/mod.json b/mod.json index 501ea17..c9cb1c0 100644 --- a/mod.json +++ b/mod.json @@ -1,6 +1,6 @@ { "geode": "2.0.0", - "version": "v1.3.1", + "version": "v1.3.2", "gd": { "win": "2.204", "mac": "2.200", diff --git a/resources/hacks/settings.json b/resources/hacks/settings.json index f5bd600..6d978d9 100644 --- a/resources/hacks/settings.json +++ b/resources/hacks/settings.json @@ -101,13 +101,5 @@ "opcodes": [], "type": "button", "default": "button" - }, - { - "name": "Menu Style", - "desc": "", - "opcodes": [], - "type": "dropdown", - "default": 1, - "values": ["ImGui", "Geometry Dash"] } ] diff --git a/src/PrismUI.cpp b/src/PrismUI.cpp index c79ffe0..abaeec3 100644 --- a/src/PrismUI.cpp +++ b/src/PrismUI.cpp @@ -9,6 +9,8 @@ int currentMenuIndexGD = 0; +matjson::Array currentThemeApplied; + int calcLimit(int n) { return static_cast(std::floor(std::log10(n)) + 1); } @@ -107,7 +109,6 @@ float calculateScale(const std::string& input, int charsBeforeShrink, float minS } bool PrismUIButton::init(HackItem* hack) { - auto currentLanguage = Lang::getLanguage(); menu = CCMenu::create(); const auto& obj = hack->data; std::string name = hack->name; @@ -386,17 +387,19 @@ void PrismUIButton::onDropdownBtn(CCObject* sender) { if (hack->name == "Menu Style") { auto obj = static_cast(CCScene::get()->getChildByID("prism-menu")); obj->onClose(sender); + } else if (hack->name == "Theme") { + currentThemeApplied = matjson::Array {}; } } -void PrismUI::CreateHackItem(HackItem* hack, bool isSettings) { +void PrismUI::CreateHackItem(HackItem* hack) { const auto& obj = hack->data; std::string name = hack->name; std::string desc = hack->desc; auto opcodes = obj.get("opcodes"); if (!((Hacks::isHackEnabled("Enable Patching") && obj.contains("winOnly")) || !obj.contains("winOnly") || name == "Enable Patching")) return; - auto btn = PrismUIButton::create(hack); - float indexY = (isSettings) ? ((currentI - 1)* 28) + 100 : (currentI * 28) + 100; + auto btn = PrismUIButton::create(hack, m_currentLang.get()); + float indexY = (currentI * 28) + 100; // TODO: create custom sprite so people dont complain auto infoSpr = CCSprite::createWithSpriteFrameName("GJ_infoIcon_001.png"); //infoSpr->setScale(.5F); @@ -562,8 +565,7 @@ void PrismUI::RegenCategory() { break; case 5: { // Settings jsonArray = matjson::parse(Hacks::getSettings()).as_array(); - auto currentLanguage = Lang::getLanguage(); - auto createdByLabel = CCLabelBMFont::create(currentLanguage->name("Prism Menu by Firee").c_str(), "PrismMenu.fnt"_spr); + auto createdByLabel = CCLabelBMFont::create(m_currentLang->name("Prism Menu by Firee").c_str(), "PrismMenu.fnt"_spr); auto versionLabel = CCLabelBMFont::create("Unknown.", "PrismMenu.fnt"_spr); createdByLabel->limitLabelWidth(150, 1.0F, .2F); createdByLabel->setPosition({63, 470}); @@ -602,7 +604,7 @@ void PrismUI::RegenCategory() { std::string name = obj.get("name"); HackItem* hack = Hacks::getHack(name); if (hack != nullptr) { - CreateHackItem(hack, currentMenuIndexGD == 5); + CreateHackItem(hack); } } } @@ -701,7 +703,8 @@ void PrismUIButton::onInfoBtn(CCObject* ret) { ->setAxisAlignment(AxisAlignment::Center) ->setAxisReverse(true) ); - newLines->setPosition({282, (cocos2d::CCDirector::sharedDirector()->getWinSize().height / 2) + 10}); // 160 - 220 + auto winSize = cocos2d::CCDirector::sharedDirector()->getWinSize(); + newLines->setPosition({(winSize.width / 2), (winSize.height / 2) + 10}); // 160 - 220 newLines->setZOrder(lines->getZOrder()); lines->removeFromParentAndCleanup(true); flAlert->m_mainLayer->addChild(newLines); @@ -712,12 +715,16 @@ void PrismUIButton::onInfoBtn(CCObject* ret) { } matjson::Object PrismUI::GetTheme() { - return Themes::getCurrentTheme(); + if (currentThemeApplied.empty()) { + log::debug("Getting current theme..."); + currentThemeApplied.push_back(Themes::getCurrentTheme()); + } + return currentThemeApplied[0].as_object(); } bool PrismUI::init(float _w, float _h) { auto winSize = cocos2d::CCDirector::sharedDirector()->getWinSize(); - auto currentLanguage = Lang::getLanguage(); + m_currentLang = Lang::getLanguage(); float menuScale = Hacks::getHack("Menu Scale")->value.floatValue; this->m_pLrSize = cocos2d::CCSize { _w, _h }; @@ -774,12 +781,12 @@ bool PrismUI::init(float _w, float _h) { bg->addChild(sideBar); bg->addChild(buttonBG); - CreateButton(currentLanguage->name("§ Global").c_str(), 0); - CreateButton(currentLanguage->name("¬ Player").c_str(), 1); - CreateButton(currentLanguage->name("ª Bypass").c_str(), 2); - CreateButton(currentLanguage->name("« Creator").c_str(), 3); - CreateButton(currentLanguage->name("··· Misc").c_str(), 4); - CreateButton(currentLanguage->name("¶ Settings").c_str(), 5); + CreateButton(m_currentLang->name("§ Global").c_str(), 0); + CreateButton(m_currentLang->name("¬ Player").c_str(), 1); + CreateButton(m_currentLang->name("ª Bypass").c_str(), 2); + CreateButton(m_currentLang->name("« Creator").c_str(), 3); + CreateButton(m_currentLang->name("··· Misc").c_str(), 4); + CreateButton(m_currentLang->name("¶ Settings").c_str(), 5); Themes::RGBAToCC(GetTheme()["BG"], bg); Themes::RGBAToCC(GetTheme()["BG"], bgBehind); bgBehind->setColor({255, 255, 255}); @@ -838,9 +845,10 @@ PrismUI* PrismUI::create() { return nullptr; }; -PrismUIButton* PrismUIButton::create(HackItem* hack) { +PrismUIButton* PrismUIButton::create(HackItem* hack, Lang* lang) { auto pRet = new PrismUIButton(); if (pRet) { + pRet->currentLanguage = lang; if (pRet->init(hack)) { pRet->autorelease(); return pRet; diff --git a/src/PrismUI.hpp b/src/PrismUI.hpp index 6e80132..875587e 100644 --- a/src/PrismUI.hpp +++ b/src/PrismUI.hpp @@ -12,6 +12,7 @@ class PrismUIButton : public CCNode, public TextInputDelegate { HackItem* m_hack; Slider* m_slider; InputNode* m_input; + Lang* currentLanguage; bool editedInputNode = false; virtual bool init(HackItem* hack); void onBoolBtn(CCObject*); @@ -32,7 +33,7 @@ class PrismUIButton : public CCNode, public TextInputDelegate { HackItem* getHack() { return m_hack; } void onInfoBtn(CCObject*); - static PrismUIButton* create(HackItem* hack); + static PrismUIButton* create(HackItem* hack, Lang* lang); }; class PrismUI : public FLAlertLayer { @@ -45,6 +46,7 @@ class PrismUI : public FLAlertLayer { std::vector m_pNavButtons; CCScrollLayerExt* m_scrollLayer; CCMenu* m_content; + std::unique_ptr m_currentLang; float m_fWidth; float m_fHeight; @@ -53,7 +55,7 @@ class PrismUI : public FLAlertLayer { float height ); virtual void keyDown(cocos2d::enumKeyCodes) override; - void CreateHackItem(HackItem* item, bool); + void CreateHackItem(HackItem*); void RegenCategory(); void CreateButton(const char* name, int menuIndex); void ButtonState(int id, bool activated); diff --git a/src/main.cpp b/src/main.cpp index 4116469..fb6df24 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -74,9 +74,6 @@ class PrismButton : public CCMenu { //this->scheduleUpdate(); return true; } - void registerWithTouchDispatcher() override { // is this even needed anymore - CCDirector::sharedDirector()->getTouchDispatcher()->addTargetedDelegate(this, -500, true); - } public: // chat jippity #if 0 // fixing later, because chatgpt is givin gme bad results