Skip to content

Commit

Permalink
Merge branch 'EclipseMenu:main' into main
Browse files Browse the repository at this point in the history
  • Loading branch information
Rustring authored Sep 1, 2024
2 parents ab1b945 + a043576 commit baddfb9
Show file tree
Hide file tree
Showing 11 changed files with 513 additions and 14 deletions.
12 changes: 9 additions & 3 deletions src/hacks/Bypass/CharacterFilter.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
#include <modules/config/config.hpp>

#include <Geode/modify/CCTextInputNode.hpp>
#include <utility>

namespace eclipse::hacks::Bypass {

Expand All @@ -22,11 +23,16 @@ namespace eclipse::hacks::Bypass {

class $modify(CharacterFilterCCTINHook, CCTextInputNode) {
void updateLabel(gd::string str) {
// im just gonna hope this is all of it
if (config::get<bool>("bypass.charfilter", false))
setAllowedChars("`1234567890-=qwertyuiop[]\\asdfghjkl;'zxcvbnm,.+_|{}:?/!@#$%^&*()");
setAllowedChars(
"abcdefghijklmnopqrstuvwxyz"
"ABCDEFGHIJKLMNOPQRSTUVWXYZ"
"0123456789!@#$%^&*()-=_+"
"`~[]{}/?.>,<\\|;:'\""
" "
);

CCTextInputNode::updateLabel(str);
CCTextInputNode::updateLabel(std::move(str));
}
};

Expand Down
80 changes: 80 additions & 0 deletions src/hacks/Creator/DefaultSongBypass.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,80 @@
#include <modules/gui/gui.hpp>
#include <modules/hack/hack.hpp>
#include <modules/config/config.hpp>

#include <Geode/modify/SongSelectNode.hpp>
#include <Geode/modify/MoreSearchLayer.hpp>

namespace eclipse::hacks::Creator {

class DefaultSongBypass : public hack::Hack {
void init() override {
auto tab = gui::MenuTab::find("Creator");

tab->addToggle("Default Song Bypass", "creator.defaultsongbypass")
->handleKeybinds()
->setDescription("Unlocks hidden songs in the level editor");
}

[[nodiscard]] const char* getId() const override { return "Default Song Bypass"; }
};

REGISTER_HACK(DefaultSongBypass)

class $modify(DefaultSongBypassSSNHook, SongSelectNode) {
static void onModify(auto& self) {
SAFE_PRIORITY("SongSelectNode::audioPrevious");
SAFE_PRIORITY("SongSelectNode::audioNext");
}

void audioPrevious(cocos2d::CCObject* sender) {
if (!config::get<bool>("creator.defaultsongbypass", false))
return SongSelectNode::audioPrevious(sender);

this->m_selectedSongID = std::max(0, this->m_selectedSongID - 1);
SongSelectNode::updateAudioLabel();
}

void audioNext(cocos2d::CCObject* sender) {
if (!config::get<bool>("creator.defaultsongbypass", false))
return SongSelectNode::audioNext(sender);

this->m_selectedSongID = std::max(0, this->m_selectedSongID + 1);
SongSelectNode::updateAudioLabel();
}
};

class $modify(DefaultSongBypassMSLHook, MoreSearchLayer) {
static void onModify(auto& self) {
SAFE_PRIORITY("MoreSearchLayer::audioPrevious");
SAFE_PRIORITY("MoreSearchLayer::audioNext");
SAFE_PRIORITY("MoreSearchLayer::selectSong");
}

void audioPrevious(cocos2d::CCObject* sender) {
if (!config::get<bool>("creator.defaultsongbypass", false))
return MoreSearchLayer::audioPrevious(sender);

auto song = GameLevelManager::get()->getIntForKey("song_filter");
MoreSearchLayer::selectSong(std::max(1, song - 1));
}

void audioNext(cocos2d::CCObject* sender) {
if (!config::get<bool>("creator.defaultsongbypass", false))
return MoreSearchLayer::audioNext(sender);

auto song = GameLevelManager::get()->getIntForKey("song_filter");
MoreSearchLayer::selectSong(std::max(1, song + 1));
}

void selectSong(int songID) {
if (!config::get<bool>("creator.defaultsongbypass", false))
return MoreSearchLayer::selectSong(songID);

songID = std::max(1, songID);
GameLevelManager::get()->setIntForKey(songID, "song_filter");
MoreSearchLayer::updateAudioLabel();
}
};

}
57 changes: 57 additions & 0 deletions src/hacks/Creator/FreeScroll.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
#include <modules/gui/gui.hpp>
#include <modules/hack/hack.hpp>
#include <modules/config/config.hpp>

#include <Geode/modify/EditorUI.hpp>

namespace eclipse::hacks::Creator {

class FreeScroll : public hack::Hack {
void init() override {
auto tab = gui::MenuTab::find("Creator");

tab->addToggle("Free Scroll", "creator.freescroll")
->handleKeybinds()
->setDescription("Removes camera constraints in the level editor");
}

[[nodiscard]] const char* getId() const override { return "Free Scroll"; }
};

REGISTER_HACK(FreeScroll)

class $modify(FreeScrollEUIHook, EditorUI) {
static void onModify(auto& self) {
SAFE_PRIORITY("EditorUI::constrainGameLayerPosition");
}

void constrainGameLayerPosition(float width, float height) {
if (!config::get<bool>("creator.freescroll", false))
return EditorUI::constrainGameLayerPosition(width, height);

// decompiled function:
// void EditorUI::constrainGameLayerPosition(float width, float height) {
// auto* objLayer = m_editorLayer->m_objectLayer;
// auto pos = objLayer->getPosition();
// objLayer->setPosition({0, 0});
// auto* director = cocos2d::CCDirector::sharedDirector();
// auto screenLeft = director->getScreenLeft();
// auto screenTop = director->getScreenTop();
// auto screenRight = director->getScreenRight();
//
// cocos2d::CCPoint topRight = { screenRight, screenTop };
// cocos2d::CCPoint bottomLeft = { screenLeft, m_unk23c };
//
// auto maxBlocksHeight = m_editorLayer->m_levelSettings->m_dynamicLevelHeight ? 1000 : 80;
// cocos2d::CCPoint worldBottomLeft = objLayer->convertToWorldSpace({ width * 30.0 - 30.0, height * 30.0 + 90.0 });
// cocos2d::CCPoint worldTopRight = objLayer->convertToWorldSpace({ 240030.0, (maxBlocksHeight * 30.0) + 90.0 + 30.0 });
//
// auto x = std::clamp(pos.x, bottomLeft.x - worldBottomLeft.x, topRight.x - worldTopRight.x);
// auto y = std::clamp(pos.y, bottomLeft.y - worldBottomLeft.y, topRight.y - worldTopRight.y);
//
// objLayer->setPosition({x, y});
// }
}
};

}
43 changes: 43 additions & 0 deletions src/hacks/Creator/HideUI.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
#include <modules/gui/gui.hpp>
#include <modules/hack/hack.hpp>
#include <modules/config/config.hpp>

#include <Geode/modify/EditorUI.hpp>

namespace eclipse::hacks::Creator {

class HideUI : public hack::Hack {
void init() override {
auto tab = gui::MenuTab::find("Creator");

tab->addToggle("Hide UI", "creator.hideui")
->handleKeybinds()
->setDescription("Hides the UI in the editor.");
}

[[nodiscard]] const char* getId() const override { return "Hide UI"; }
};

REGISTER_HACK(HideUI)

static bool s_lastState = false;

class $modify(HideUIEUIHook, EditorUI) {
void onUpdate(float) {
const bool isHidden = config::get<bool>("creator.hideui", false);
if (s_lastState == isHidden)
return;

s_lastState = isHidden;
this->setVisible(!isHidden);
}

bool init(LevelEditorLayer* editorLayer) {
if (!EditorUI::init(editorLayer)) return false;

this->schedule(schedule_selector(HideUIEUIHook::onUpdate), 0.f);
return true;
}
};

}
49 changes: 49 additions & 0 deletions src/hacks/Global/TPSBypass.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
#include <modules/gui/gui.hpp>
#include <modules/hack/hack.hpp>
#include <modules/config/config.hpp>

#include <Geode/modify/GJBaseGameLayer.hpp>

constexpr float MIN_TPS = 0.f;
constexpr float MAX_TPS = 100000.f;

namespace eclipse::hacks::Global {
class TPSBypass : public hack::Hack {
public:
void init() override {
config::setIfEmpty("global.tpsbypass", 240.f);

auto tab = gui::MenuTab::find("Global");
tab->addFloatToggle("TPS Bypass", "global.tpsbypass", MIN_TPS, MAX_TPS, "%.0f TPS")
->handleKeybinds();
}

[[nodiscard]] const char* getId() const override { return "TPSBypass"; }
[[nodiscard]] int32_t getPriority() const override { return -14; }
};

REGISTER_HACK(TPSBypass)

class $modify(TPSBypassGJBGLHook, GJBaseGameLayer) {
float getModifiedDelta(float dt) {
if (!config::get<bool>("global.tpsbypass.toggle", false))
return GJBaseGameLayer::getModifiedDelta(dt);

auto tps = config::get<float>("global.tpsbypass", 240.f);
auto spt = 1.f / tps;

if (m_resumeTimer > 0) {
--m_resumeTimer;
dt = 0.f;
}

auto totalDelta = dt + m_unk3248;
auto timestep = std::min(m_gameState.m_timeWarp, 1.f) * spt;
auto steps = std::round(totalDelta / timestep);
auto newDelta = steps * timestep;
m_unk3248 = totalDelta - newDelta;
return static_cast<float>(newDelta);
}
};

}
Loading

0 comments on commit baddfb9

Please sign in to comment.