From 554e737ed775fbef55a68595b2884531a274e805 Mon Sep 17 00:00:00 2001 From: Explodingbill Date: Tue, 6 Feb 2024 15:26:26 +1100 Subject: [PATCH] lag fix --- changelog.md | 6 +++ mod.json | 2 +- src/Client/AndroidUI.h | 7 ++- src/Client/ClientSetup.h | 2 + src/Hacks/LevelEdit.cpp | 16 +++++++ src/Hacks/ShowLayout.cpp | 17 +++++++ src/Hacks/TransitionTimeCustomiser.cpp | 63 +++++++++++++++++++++++++- src/Hacks/TransparentBG.cpp | 54 +++++++++++++++++++++- 8 files changed, 162 insertions(+), 5 deletions(-) create mode 100644 src/Hacks/LevelEdit.cpp create mode 100644 src/Hacks/ShowLayout.cpp diff --git a/changelog.md b/changelog.md index 4725e2f..afe31ef 100644 --- a/changelog.md +++ b/changelog.md @@ -1,3 +1,9 @@ +# 1.1.2 + +- Added Level Edit +- Removed boob dropdown (sad day) +- Fixed lag with Transparent BG + # 1.1.1 - Added hide endscreen diff --git a/mod.json b/mod.json index 447a94d..c7d3ec0 100644 --- a/mod.json +++ b/mod.json @@ -1,6 +1,6 @@ { "geode": "2.0.0", - "version": "v1.1.1", + "version": "v1.1.2", "gd": { "win": "2.204", "android": "*" diff --git a/src/Client/AndroidUI.h b/src/Client/AndroidUI.h index 86b6e21..2016737 100644 --- a/src/Client/AndroidUI.h +++ b/src/Client/AndroidUI.h @@ -2,6 +2,7 @@ #include "ClientSetup.h" #include #include +#include #include #include #include @@ -355,6 +356,8 @@ class AndroidBall : public CCLayer this->setID("android-ball"); + //this->retain(); // idk what this does but it fixes transition customizer + highest++; this->setTag(highest); @@ -595,13 +598,13 @@ class $modify (CCScene) } }; -class $modify (AchievementNotifier) +class $modify (AppDelegate) { void willSwitchToScene(CCScene* p0) { log::info("will switch to scene"); - AchievementNotifier::willSwitchToScene(p0); + AppDelegate::willSwitchToScene(p0); if (p0 == nullptr) return; // something real bad happened, gd will probably shit itself :( diff --git a/src/Client/ClientSetup.h b/src/Client/ClientSetup.h index 79e63fb..82d7bd5 100644 --- a/src/Client/ClientSetup.h +++ b/src/Client/ClientSetup.h @@ -87,6 +87,8 @@ class ClientUtils bypass->modules.push_back(new Module("Confirm Practice", "conf-prac", "confirm practice mode help")); bypass->modules.push_back(new Module("Confirm Restart", "conf-res", "confirm restart help")); + bypass->modules.push_back(new Module("Level Edit", "level-edit", "Allows you to edit any level")); + #ifdef GEODE_IS_ANDROID //bypass->modules.push_back(new Module("Slider Limit Bypass", "slider-limit", "Allows sliders to go beyond the limit of the slider. Doesn't work for scaling in the editor currently")); #endif diff --git a/src/Hacks/LevelEdit.cpp b/src/Hacks/LevelEdit.cpp new file mode 100644 index 0000000..902beb1 --- /dev/null +++ b/src/Hacks/LevelEdit.cpp @@ -0,0 +1,16 @@ +#include +#include +#include "../Client/Client.h" + +using namespace geode::prelude; + +class $modify (PauseLayer) +{ + virtual TodoReturn customSetup() + { + if (Client::GetModuleEnabled("level-edit")) + PlayLayer::get()->m_level->m_levelType = GJLevelType::Editor; + + PauseLayer::customSetup(); + } +}; \ No newline at end of file diff --git a/src/Hacks/ShowLayout.cpp b/src/Hacks/ShowLayout.cpp new file mode 100644 index 0000000..b3e1cb0 --- /dev/null +++ b/src/Hacks/ShowLayout.cpp @@ -0,0 +1,17 @@ +/*#include +#include +#include "../Client/Client.h" + +using namespace geode::prelude; + +class $modify (PlayLayer) +{ + TodoReturn addObject(GameObject* p0) + { + //log::info("type: {}", p0->m_objectType == GameObjectType::Decoration); + + //if (p0->m_objectType != GameObjectType::Decoration) + //if (false) + //PlayLayer::addObject(p0); + } +};*/ \ No newline at end of file diff --git a/src/Hacks/TransitionTimeCustomiser.cpp b/src/Hacks/TransitionTimeCustomiser.cpp index 405dc6d..e673368 100644 --- a/src/Hacks/TransitionTimeCustomiser.cpp +++ b/src/Hacks/TransitionTimeCustomiser.cpp @@ -1,10 +1,71 @@ #include #include #include +#include #include "../Client/Client.h" using namespace geode::prelude; +CCScene* getSceneForSel(int i, float f, CCScene* s) +{ + AppDelegate::get()->willSwitchToScene(s); + + if (i == 0) + return CCTransitionFade::create(f, s); + else if (i == 1) + return CCTransitionCrossFade::create(f, s); + else if (i == 2) + return CCTransitionFadeBL::create(f, s); + else if (i == 3) + return CCTransitionFadeTR::create(f, s); + else if (i == 4) + return CCTransitionFadeUp::create(f, s); + else if (i == 5) + return CCTransitionFadeDown::create(f, s); + else if (i == 6) + return CCTransitionFlipAngular::create(f, s); + else if (i == 7) + return CCTransitionFlipX::create(f, s); + else if (i == 8) + return CCTransitionFlipY::create(f, s); + else if (i == 9) + return CCTransitionZoomFlipAngular::create(f, s); + else if (i == 10) + return CCTransitionZoomFlipX::create(f, s); + else if (i == 11) + return CCTransitionZoomFlipY::create(f, s); + else if (i == 12) + return CCTransitionJumpZoom::create(f, s); + else if (i == 13) + return CCTransitionMoveInT::create(f, s); + else if (i == 14) + return CCTransitionMoveInB::create(f, s); + else if (i == 15) + return CCTransitionMoveInL::create(f, s); + else if (i == 16) + return CCTransitionMoveInR::create(f, s); + else if (i == 17) + return CCTransitionRotoZoom::create(f, s); + else if (i == 18) + return CCTransitionShrinkGrow::create(f, s); + else if (i == 19) + return CCTransitionSlideInT::create(f, s); + else if (i == 20) + return CCTransitionSlideInB::create(f, s); + else if (i == 21) + return CCTransitionSlideInL::create(f, s); + else if (i == 22) + return CCTransitionSlideInR::create(f, s); + else if (i == 23) + return CCTransitionSplitRows::create(f, s); + else if (i == 24) + return CCTransitionSplitCols::create(f, s); + else if (i == 25) + return CCTransitionTurnOffTiles::create(f, s); + + return nullptr; +} + class $modify (cocos2d::CCTransitionFade) { static CCTransitionFade* create(float duration,CCScene* scene) @@ -16,6 +77,6 @@ class $modify (cocos2d::CCTransitionFade) mod = 0; } - return CCTransitionFade::create(duration * mod, scene); + return as(getSceneForSel(0, duration * mod, scene));// /*base_cast(CCTransitionFlipY::create(duration * mod, scene)); */CCTransitionFade::create(duration * mod, scene); } }; \ No newline at end of file diff --git a/src/Hacks/TransparentBG.cpp b/src/Hacks/TransparentBG.cpp index 899bda8..817faa2 100644 --- a/src/Hacks/TransparentBG.cpp +++ b/src/Hacks/TransparentBG.cpp @@ -1,10 +1,11 @@ #include #include +#include #include "../Client/Client.h" using namespace geode::prelude; -class $modify (CCSprite) +/*class $modify (CCSprite) { bool grad; @@ -28,4 +29,55 @@ class $modify (CCSprite) else CCSprite::setColor(color3); } +};*/ + +std::string getNodeName(CCObject* node) { +#ifdef GEODE_IS_WINDOWS + return typeid(*node).name() + 6; +#else + { + std::string ret; + + int status = 0; + auto demangle = abi::__cxa_demangle(typeid(*node).name(), 0, 0, &status); + if (status == 0) { + ret = demangle; + } + free(demangle); + + return ret; + } +#endif +} + +class $modify (AppDelegate) +{ + virtual void willSwitchToScene(CCScene* scene) + { + AppDelegate::willSwitchToScene(scene); + + if (!Client::GetModuleEnabled("trans-bg")) + return; + + if (scene->getChildrenCount() > 0) + { + if (auto l = as(scene->getChildren()->objectAtIndex(0))) + { + l->sortAllChildren(); + + if (auto b = static_cast(l->getChildren()->objectAtIndex(0))) + { + log::info("bg: {}", b); + + if (getNodeName(b).starts_with("cocos2d::CCSprite")) + { + if (b->getColor().r == 0 && b->getColor().g == 102 && b->getColor().b == 255) + { + b->setColor({255, 255, 255}); + } + } + } + } + } + } }; \ No newline at end of file