Skip to content

Commit

Permalink
lag fix
Browse files Browse the repository at this point in the history
  • Loading branch information
TheSillyDoggo committed Feb 6, 2024
1 parent 19bbaaf commit 554e737
Show file tree
Hide file tree
Showing 8 changed files with 162 additions and 5 deletions.
6 changes: 6 additions & 0 deletions changelog.md
Original file line number Diff line number Diff line change
@@ -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
Expand Down
2 changes: 1 addition & 1 deletion mod.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"geode": "2.0.0",
"version": "v1.1.1",
"version": "v1.1.2",
"gd": {
"win": "2.204",
"android": "*"
Expand Down
7 changes: 5 additions & 2 deletions src/Client/AndroidUI.h
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
#include "ClientSetup.h"
#include <Geode/modify/AchievementNotifier.hpp>
#include <Geode/modify/MenuLayer.hpp>
#include <Geode/modify/AppDelegate.hpp>
#include <Geode/modify/PauseLayer.hpp>
#include <Geode/modify/PlayLayer.hpp>
#include <Geode/modify/MenuLayer.hpp>
Expand Down Expand Up @@ -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);
Expand Down Expand Up @@ -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 :(
Expand Down
2 changes: 2 additions & 0 deletions src/Client/ClientSetup.h
Original file line number Diff line number Diff line change
Expand Up @@ -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. <cr>Doesn't work for scaling in the editor currently</c>"));
#endif
Expand Down
16 changes: 16 additions & 0 deletions src/Hacks/LevelEdit.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
#include <Geode/Geode.hpp>
#include <Geode/modify/PauseLayer.hpp>
#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();
}
};
17 changes: 17 additions & 0 deletions src/Hacks/ShowLayout.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
/*#include <Geode/Geode.hpp>
#include <Geode/modify/PlayLayer.hpp>
#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);
}
};*/
63 changes: 62 additions & 1 deletion src/Hacks/TransitionTimeCustomiser.cpp
Original file line number Diff line number Diff line change
@@ -1,10 +1,71 @@
#include <Geode/Geode.hpp>
#include <Geode/cocos/layers_scenes_transitions_nodes/CCTransition.h>
#include <Geode/modify/CCTransitionFade.hpp>
#include <Geode/modify/CCDirector.hpp>
#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)
Expand All @@ -16,6 +77,6 @@ class $modify (cocos2d::CCTransitionFade)
mod = 0;
}

return CCTransitionFade::create(duration * mod, scene);
return as<CCTransitionFade*>(getSceneForSel(0, duration * mod, scene));// /*base_cast<CCTransitionFade*>(CCTransitionFlipY::create(duration * mod, scene)); */CCTransitionFade::create(duration * mod, scene);
}
};
54 changes: 53 additions & 1 deletion src/Hacks/TransparentBG.cpp
Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@
#include <Geode/Geode.hpp>
#include <Geode/modify/CCSprite.hpp>
#include <Geode/modify/AppDelegate.hpp>
#include "../Client/Client.h"

using namespace geode::prelude;

class $modify (CCSprite)
/*class $modify (CCSprite)
{
bool grad;
Expand All @@ -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<CCLayer*>(scene->getChildren()->objectAtIndex(0)))
{
l->sortAllChildren();

if (auto b = static_cast<CCSprite*>(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});
}
}
}
}
}
}
};

0 comments on commit 554e737

Please sign in to comment.