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 Jul 20, 2024
2 parents e572ab0 + 4951b15 commit f158534
Show file tree
Hide file tree
Showing 12 changed files with 334 additions and 6 deletions.
81 changes: 81 additions & 0 deletions src/hacks/Bypass/AllowLowVolume.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,81 @@
#include <modules/gui/gui.hpp>
#include <modules/hack/hack.hpp>
#include <modules/config/config.hpp>

#include <Geode/modify/OptionsLayer.hpp>
#include <Geode/modify/PauseLayer.hpp>

namespace eclipse::hacks::Bypass {

class AllowLowVolume : public hack::Hack {
void init() override {
auto tab = gui::MenuTab::find("Bypass");
tab->addToggle("Allow Low Volume", "bypass.allowlowvolume")
->handleKeybinds()
->setDescription("Allows setting the volume lower than 3%.");
}

[[nodiscard]] const char* getId() const override { return "Allow Low Volume"; }
};

REGISTER_HACK(AllowLowVolume)

#define GET_SLIDER(sender) geode::cast::typeinfo_cast<SliderThumb*>(sender); if (!slider) return

class $modify(OptionsLayer) {
static void onModify(auto& self) {
SAFE_PRIORITY("OptionsLayer::musicSliderChanged");
SAFE_PRIORITY("OptionsLayer::sfxSliderChanged");
}

void musicSliderChanged(cocos2d::CCObject* sender) {
if (!config::get<bool>("bypass.allowlowvolume", false))
return OptionsLayer::musicSliderChanged(sender);

auto slider = GET_SLIDER(sender);
auto value = slider->getValue();
auto* audioEngine = FMODAudioEngine::get();
float originalVolume = audioEngine->getBackgroundMusicVolume();
audioEngine->setBackgroundMusicVolume(value);
if (originalVolume <= 0.f && value > 0.f)
GameManager::get()->playMenuMusic();
}

void sfxSliderChanged(cocos2d::CCObject* sender) {
if (!config::get<bool>("bypass.allowlowvolume", false))
return OptionsLayer::sfxSliderChanged(sender);

auto slider = GET_SLIDER(sender);
auto value = slider->getValue();
FMODAudioEngine::get()->setEffectsVolume(value);
}
};

class $modify(PauseLayer) {
static void onModify(auto& self) {
SAFE_PRIORITY("PauseLayer::musicSliderChanged");
SAFE_PRIORITY("PauseLayer::sfxSliderChanged");
}

void musicSliderChanged(cocos2d::CCObject* sender) {
if (!config::get<bool>("bypass.allowlowvolume", false))
return PauseLayer::musicSliderChanged(sender);

auto slider = GET_SLIDER(sender);
auto value = slider->getValue();
FMODAudioEngine::get()->setBackgroundMusicVolume(value);
}

// Function is merged with the one in OptionsLayer on Windows
#if !(defined(GEODE_IS_WINDOWS) && GEODE_COMP_GD_VERSION == 22060)
void sfxSliderChanged(cocos2d::CCObject* sender) {
if (!config::get<bool>("bypass.allowlowvolume", false))
return PauseLayer::sfxSliderChanged(sender);

auto slider = GET_SLIDER(sender);
auto value = slider->getValue();
FMODAudioEngine::get()->setEffectsVolume(value);
}
#endif
};
}
30 changes: 30 additions & 0 deletions src/hacks/Bypass/CharacterFilter.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
#include <modules/gui/gui.hpp>
#include <modules/hack/hack.hpp>
#include <modules/config/config.hpp>

#include <Geode/modify/CCTextInputNode.hpp>

namespace eclipse::hacks::Bypass {

class CharFilter : public hack::Hack {
void init() override {
auto tab = gui::MenuTab::find("Bypass");
tab->addToggle("Character Filter Bypass", "bypass.charfilter")
->handleKeybinds()
->setDescription("Allows you to bypass the character filter on any text field");
}

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

REGISTER_HACK(CharFilter)

class $modify(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,.+_|{}:?/!@#$%^&*()");
CCTextInputNode::updateLabel(str);
}
};

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

#include <Geode/modify/CCTextInputNode.hpp>

namespace eclipse::hacks::Bypass {

class CharLimit : public hack::Hack {
void init() override {
auto tab = gui::MenuTab::find("Bypass");
tab->addToggle("Character Limit Bypass", "bypass.charlimit")
->handleKeybinds()
->setDescription("Allows you to bypass the character limit of any text field");
}

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

REGISTER_HACK(CharLimit)

class $modify(CCTextInputNode) {
void updateLabel(gd::string str) {
if (config::get<bool>("bypass.charlimit", false)) setMaxLabelLength(99999);
CCTextInputNode::updateLabel(str);
}
};

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

#include <Geode/modify/PlayLayer.hpp>

namespace eclipse::hacks::Bypass {

class CheckpointLimit : public hack::Hack {
void init() override {
auto tab = gui::MenuTab::find("Bypass");
tab->addToggle("Checkpoint Limit", "bypass.checkpointlimit")
->handleKeybinds()
->setDescription("Allows you to place more than 50 checkpoints in practice mode.");
}

[[nodiscard]] const char* getId() const override { return "Checkpoint Limit"; }
};

REGISTER_HACK(CheckpointLimit)

class $modify(PlayLayer) {
static void onModify(auto& self) {
SAFE_PRIORITY("PlayLayer::storeCheckpoint");
}

void storeCheckpoint(CheckpointObject* checkpointObject) {
if (!config::get<bool>("bypass.checkpointlimit", false))
return PlayLayer::storeCheckpoint(checkpointObject);

// Reimplemented without the checkpoint limit
m_checkpointArray->addObject(checkpointObject);
PlayLayer::addToSection(checkpointObject->m_physicalCheckpointObject);
}
};

}
43 changes: 43 additions & 0 deletions src/hacks/Global/LockCursor.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>

#ifdef __APPLE__

// silly goofy fix because it errors if it comes after geode includes
#define CommentType CommentTypeDummy
#include <CoreGraphics/CoreGraphics.h>
#include <CoreServices/CoreServices.h>
#undef CommentType

#endif

namespace eclipse::hacks::Global {

class LockCursor : public hack::Hack {
void init() override {
auto tab = gui::MenuTab::find("Global");
tab->addToggle("Lock Cursor", "global.lockcursor")->handleKeybinds();
}

void update() override {
if (!PlayLayer::get()) return;

#ifdef __APPLE__

if (!gui::Engine::get()->isToggled() && config::get<bool>("global.lockcursor") && !PlayLayer::get()->m_hasCompletedLevel && !PlayLayer::get()->m_isPaused) {
CGEventRef ourEvent = CGEventCreate(NULL);
auto point = CGEventGetLocation(ourEvent);
CFRelease(ourEvent);

CGWarpMouseCursorPosition(point);
}

#endif
}

[[nodiscard]] const char* getId() const override { return "Lock Cursor"; }
};

REGISTER_HACK(LockCursor)
}
31 changes: 31 additions & 0 deletions src/hacks/Level/ForcePlatformer.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
#include <modules/gui/gui.hpp>
#include <modules/hack/hack.hpp>
#include <modules/config/config.hpp>

#include <Geode/modify/PlayLayer.hpp>

namespace eclipse::hacks::Level {

class ForcePlatformer : public hack::Hack {
void init() override {
auto tab = gui::MenuTab::find("Level");
tab->addToggle("Force Platformer", "level.forceplatformer")->handleKeybinds();
}

[[nodiscard]] const char* getId() const override { return "Force Platformer"; }
};

REGISTER_HACK(ForcePlatformer)

class $modify(PlayLayer) {
bool init(GJGameLevel* gj, bool p1, bool p2) {
if (!PlayLayer::init(gj, p1, p2)) return false;
if (!config::get<bool>("level.forceplatformer", false)) return true;

if (m_player1) m_player1->togglePlatformerMode(true);
if (m_player2) m_player2->togglePlatformerMode(true);

return true;
}
};
}
31 changes: 31 additions & 0 deletions src/hacks/Level/PlatGamemodes.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
#include <modules/gui/gui.hpp>
#include <modules/hack/hack.hpp>
#include <modules/config/config.hpp>

#include <Geode/modify/GJBaseGameLayer.hpp>

namespace eclipse::hacks::Level {

class PlatGamemodes : public hack::Hack {
void init() override {
auto tab = gui::MenuTab::find("Level");
tab->addToggle("All Modes in Platformer", "level.platgamemodes")->handleKeybinds();
}

[[nodiscard]] const char* getId() const override { return "All Modes in Platformer"; }
};

REGISTER_HACK(PlatGamemodes)

class $modify(GJBaseGameLayer) {
void collisionCheckObjects(PlayerObject* player, gd::vector<GameObject*>* gameObjects, int p2, float p3) {
if (!config::get<bool>("level.platgamemodes", false))
return GJBaseGameLayer::collisionCheckObjects(player, gameObjects, p2, p3);

bool isPlatformer = m_isPlatformer;
m_isPlatformer = false;
GJBaseGameLayer::collisionCheckObjects(player, gameObjects, p2, p3);
m_isPlatformer = isPlatformer;
}
};
}
47 changes: 47 additions & 0 deletions src/hacks/Player/JumpHack.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
#include <modules/gui/gui.hpp>
#include <modules/hack/hack.hpp>
#include <modules/config/config.hpp>

#include <Geode/modify/PlayerObject.hpp>
#include <Geode/modify/GJBaseGameLayer.hpp>

namespace eclipse::hacks::Player {

class JumpHack : public hack::Hack {
void init() override {
auto tab = gui::MenuTab::find("Player");
tab->addToggle("Jump Hack", "player.jumphack")
->setDescription("Allows the player to infinitely jump in the air")
->handleKeybinds();
}

[[nodiscard]] bool isCheating() override { return config::get<bool>("player.jumphack", false); }
[[nodiscard]] const char* getId() const override { return "Jump Hack"; }
};

REGISTER_HACK(JumpHack)

bool jump = false;

class $modify(GJBaseGameLayer) {
void update(float dt) {
if (config::get<bool>("player.jumphack", false) && jump) {
if (m_player1) m_player1->m_isOnGround = true;
if (m_player2) m_player2->m_isOnGround = true;
}
GJBaseGameLayer::update(dt);
if (config::get<bool>("player.jumphack", false) && jump) {
if (m_player1) m_player1->m_isOnGround = true;
if (m_player2) m_player2->m_isOnGround = true;
jump = false;
}
}
};

class $modify(PlayerObject) {
void pushButton(PlayerButton idk) {
jump = true;
PlayerObject::pushButton(idk);
}
};
}
2 changes: 1 addition & 1 deletion src/hacks/Recorder/Recorder.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ namespace eclipse::hacks::Recorder {

recorder::RenderSettings settings;

settings.m_birtate = config::get<float>("recorder.bitrate", 30.f);
settings.m_bitrate = config::get<float>("recorder.bitrate", 30.f);
settings.m_fps = config::get<float>("recorder.fps", 60.f);
settings.m_width = config::get<int>("recorder.resolution.x", 1920);
settings.m_height = config::get<int>("recorder.resolution.y", 1080);
Expand Down
1 change: 0 additions & 1 deletion src/modules/gui/imgui.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,6 @@ namespace eclipse::gui::imgui {
}

MenuTab* ImGuiEngine::findTab(const std::string& name) {
// TODO: do the layout thing with this too
return dynamic_cast<WindowLayout*>(getTheme()->getLayout())->findTab(name);
}

Expand Down
2 changes: 1 addition & 1 deletion src/modules/recorder/recorder.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ namespace eclipse::recorder {
break;
}

command << "-b:v " << m_renderSettings.m_birtate << "M ";
command << "-b:v " << m_renderSettings.m_bitrate << "M ";

if (!m_renderSettings.m_extraArgs.empty())
command << m_renderSettings.m_extraArgs << " ";
Expand Down
6 changes: 3 additions & 3 deletions src/modules/recorder/recorder.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -19,13 +19,13 @@ namespace eclipse::recorder {
uint32_t m_height = 1080;
uint32_t m_fps = 60;
Codec m_codec = None;
float m_birtate = 30;
float m_bitrate = 30;
std::string m_args;
std::string m_extraArgs;
std::string m_videoArgs;

RenderSettings() : m_width(1920), m_height(1080), m_fps(60), m_birtate(30) {}
RenderSettings(uint32_t width, uint32_t height, uint32_t fps, float bitrate, Codec codec) : m_width(width), m_height(height), m_fps(fps), m_birtate(bitrate), m_codec(codec) {}
RenderSettings() : m_width(1920), m_height(1080), m_fps(60), m_bitrate(30) {}
RenderSettings(uint32_t width, uint32_t height, uint32_t fps, float bitrate, Codec codec) : m_width(width), m_height(height), m_fps(fps), m_bitrate(bitrate), m_codec(codec) {}
};

class Recorder {
Expand Down

0 comments on commit f158534

Please sign in to comment.