forked from EclipseMenu/EclipseMenu
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'EclipseMenu:main' into main
- Loading branch information
Showing
11 changed files
with
513 additions
and
14 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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(); | ||
} | ||
}; | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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}); | ||
// } | ||
} | ||
}; | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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; | ||
} | ||
}; | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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); | ||
} | ||
}; | ||
|
||
} |
Oops, something went wrong.