From 5fa99407920e9772bcbd1e4540c624538757ffd5 Mon Sep 17 00:00:00 2001 From: TobyAdd <66429886+TobyAdd@users.noreply.github.com> Date: Wed, 13 Nov 2024 20:03:16 +0200 Subject: [PATCH] update 2.2074 --- .github/workflows/multi-platform.yml | 10 +- CMakeLists.txt | 2 +- mod.json | 6 +- src/gui.cpp | 16 +++- src/hacks.cpp | 53 +++++------ src/hacks.hpp | 7 ++ src/hooks.cpp | 133 +++++++++++++++++++++++++-- 7 files changed, 179 insertions(+), 48 deletions(-) diff --git a/.github/workflows/multi-platform.yml b/.github/workflows/multi-platform.yml index 2d547b5..1eacb4f 100644 --- a/.github/workflows/multi-platform.yml +++ b/.github/workflows/multi-platform.yml @@ -24,6 +24,10 @@ jobs: - name: Build the mod uses: geode-sdk/build-geode-mod@main with: + bindings: geode-sdk/bindings + bindings-ref: main + combine: true + sdk: nightly target: ${{ matrix.config.target }} package: @@ -37,7 +41,5 @@ jobs: - uses: actions/upload-artifact@v4 with: - name: Geode Build - path: ${{ steps.build.outputs.build-output }} - - + name: Build Output + path: ${{ steps.build.outputs.build-output }} \ No newline at end of file diff --git a/CMakeLists.txt b/CMakeLists.txt index eca7744..f9bd0c5 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -23,7 +23,7 @@ target_include_directories(${PROJECT_NAME} PRIVATE libs) set(HAS_IMGUI ON) add_subdirectory(libs/imgui) -CPMAddPackage("gh:matcool/gd-imgui-cocos#324dc5d") +CPMAddPackage("gh:matcool/gd-imgui-cocos#fbd4103") target_link_libraries(${PROJECT_NAME} imgui-cocos imgui) setup_geode_mod(${PROJECT_NAME}) diff --git a/mod.json b/mod.json index eb2c4fa..dc56f79 100644 --- a/mod.json +++ b/mod.json @@ -1,11 +1,11 @@ { - "geode": "3.8.1", + "geode": "4.0.0-alpha.1", "gd": { - "win": "2.206" + "win": "2.2074" }, "id": "tobyadd.gdh", "name": "GDH", - "version": "v4.8.0", + "version": "v4.9.0-alpha.1", "developer": "TobyAdd", "description": "GDH is an open-source Geometry Dash mod menu that aims to improve the game's performance and add new features", "early-load": true, diff --git a/src/gui.cpp b/src/gui.cpp index d0f5f04..bf7f750 100644 --- a/src/gui.cpp +++ b/src/gui.cpp @@ -373,7 +373,12 @@ void gui::RenderMain() { else if (hck.name == "RGB Icons") { hacks::rgb_icons = hck.enabled; } else if (hck.name == "Wave Trail Size") { hacks::wave_trail = hck.enabled; } else if (hck.name == "Random Seed") { hacks::random_seed_enabled = hck.enabled; } + else if (hck.name == "Level Edit") { hacks::level_edit = hck.enabled; } else if (hck.name == "No Death Effect") { hacks::no_death_effect = hck.enabled; } + else if (hck.name == "Copy Hack") { hacks::copy_hack = hck.enabled; } + else if (hck.name == "Main Levels") { hacks::main_levels = hck.enabled; } + else if (hck.name == "No Shaders") { hacks::no_shaders = hck.enabled; } + else if (hck.name == "Safe Mode") { hacks::safe_mode = hck.enabled; } else if (hck.name == "Show Hitboxes") { hacks::show_hitboxes = hck.enabled; auto pl = PlayLayer::get(); @@ -432,8 +437,10 @@ void gui::RenderMain() { ImGui::PopStyleColor(); - if (ImGui::IsItemHovered() && !hck.desc.empty()) + if (ImGui::IsItemHovered() && !hck.desc.empty()) { ImGui::SetTooltip("%s", hck.desc.c_str()); + } + if (hck.name == "RGB Icons") { ImGui::SameLine(); @@ -478,7 +485,7 @@ void gui::RenderMain() { } if (ImGui::BeginPopupModal("Hitboxes Settings", NULL, ImGuiWindowFlags_AlwaysAutoResize)) { - ImGui::Checkbox("Draw Trail", &hacks::draw_trail, gui::scale); + // ImGui::Checkbox("Draw Trail", &hacks::draw_trail, gui::scale); ImGui::DragInt("##trail_length", &hacks::trail_length, 1, 0, INT_MAX, "Trail Length: %i"); ImGui::Checkbox("Show Hitboxes on Death", &hacks::show_hitboxes_on_death); if (ImGui::Button("Close", {ImGui::GetContentRegionAvail().x, NULL})) { @@ -586,6 +593,11 @@ void gui::toggleKeybinds(int key) { else if (hck.name == "Wave Trail Size") { hacks::wave_trail = hck.enabled; } else if (hck.name == "Random Seed") { hacks::random_seed_enabled = hck.enabled; } else if (hck.name == "No Death Effect") { hacks::no_death_effect = hck.enabled; } + else if (hck.name == "Level Edit") { hacks::level_edit = hck.enabled; } + else if (hck.name == "Copy Hack") { hacks::copy_hack = hck.enabled; } + else if (hck.name == "No Shaders") { hacks::no_shaders = hck.enabled; } + else if (hck.name == "Main Levels") { hacks::main_levels = hck.enabled; } + else if (hck.name == "Safe Mode") { hacks::safe_mode = hck.enabled; } else if (hck.name == "Show Hitboxes") { hacks::show_hitboxes = hck.enabled; auto pl = PlayLayer::get(); diff --git a/src/hacks.cpp b/src/hacks.cpp index 9465ac1..18d8811 100644 --- a/src/hacks.cpp +++ b/src/hacks.cpp @@ -66,6 +66,13 @@ bool hacks::disable_render = false; bool hacks::no_death_effect = false; +bool hacks::level_edit = false; +bool hacks::copy_hack = false; + +bool hacks::no_shaders = false; +bool hacks::safe_mode = false; +bool hacks::main_levels = false; + std::vector hacks::windows = { {"Core", 10, 10, 200, 200, { @@ -84,12 +91,7 @@ std::vector hacks::windows = { } }, {"No Death Effect", "Upon death, the cube will not emit an exploding effect"}, - {"Safe Mode", "Disables progress on levels", - { - {"0f 85 ? ? ? ? 40 38 b7 ? ? ? ? 0f 85 ? ? ? ? 0f b6 97", "E9 B4 01 00 00 90"}, - {"0f 85 ? ? ? ? 80 bf ? ? ? ? ? 0f 85 ? ? ? ? e8", "E9 78 03 00 00 90"} - } - } + {"Safe Mode", "Disables progress on levels"} } }, {"Bypass", 10, 220, 200, 250, @@ -138,8 +140,8 @@ std::vector hacks::windows = { {"7c ? e8 ? ? ? ? 48 8b d0", "90 90"}, {"0f 84 ? ? ? ? ff 15 ? ? ? ? 48 8b f8 ff 15 ? ? ? ? 48 89 b8", "90 90 90 90 90 90"}, {"0f 85 ? ? ? ? 48 8d 45 ? 48 89 45 ? 0f b7 05 ? ? ? ? 66 89 45 ? 0f b6 05 ? ? ? ? 88 45 ? 0f 57 c0 0f 11 45 ? 45 33 f6 4c 89 75 ? 48 c7 45 ? ? ? ? ? 41 8d 4e ? e8 ? ? ? ? 48 8b c8 48 89 45 ? 48 c7 45 ? ? ? ? ? 48 c7 45 ? ? ? ? ? 0f 28 05 ? ? ? ? 0f 11 00 0f 28 0d ? ? ? ? 0f 11 48 ? 0f 28 05 ? ? ? ? 0f 11 40 ? f2 0f 10 05", "E9 FE 02 00 00 90"}, - {"0f 85 ? ? ? ? 48 8d 45 ? 48 89 45 ? 0f b7 05 ? ? ? ? 66 89 45 ? 0f b6 05 ? ? ? ? 88 45 ? 0f 57 c0 0f 11 45 ? 45 33 f6 4c 89 75 ? 48 c7 45 ? ? ? ? ? 41 8d 4e ? e8 ? ? ? ? 48 8b c8 48 89 45 ? 48 c7 45 ? ? ? ? ? 48 c7 45 ? ? ? ? ? 0f 28 05 ? ? ? ? 0f 11 00 0f 28 0d ? ? ? ? 0f 11 48 ? 0f 28 05 ? ? ? ? 0f 11 40 ? 0f 28 0d ? ? ? ? 0f 11 48 ? 0f b7 05", "E9 C6 02 00 00 90"}, - {"0f 85 ? ? ? ? 48 8d 45 ? 48 89 45 ? 0f b7 05 ? ? ? ? 66 89 45 ? 0f b6 05 ? ? ? ? 88 45 ? 0f 57 c0 0f 11 45 ? 45 33 f6 4c 89 75 ? 48 c7 45 ? ? ? ? ? 41 8d 4e ? e8 ? ? ? ? 48 8b c8 48 89 45 ? 48 c7 45 ? ? ? ? ? 48 c7 45 ? ? ? ? ? 0f 28 05 ? ? ? ? 0f 11 00 0f 28 0d ? ? ? ? 0f 11 48 ? 0f 28 05 ? ? ? ? 0f 11 40 ? 0f 28 0d ? ? ? ? 0f 11 48 ? 0f 28 05", "E9 2E 05 00 00 90"}, + {"0f 85 ? ? ? ? 48 8d 45 ? 48 89 45 ? 0f b7 05 ? ? ? ? 66 89 45 ? 0f b6 05 ? ? ? ? 88 45 ? 0f 57 c0 0f 11 45 ? 45 33 f6 4c 89 75 ? 48 c7 45 ? ? ? ? ? 41 8d 4e ? e8 ? ? ? ? 48 8b c8 48 89 45 ? 48 c7 45 ? ? ? ? ? 48 c7 45 ? ? ? ? ? 0f 28 05 ? ? ? ? 0f 11 00 0f 28 0d ? ? ? ? 0f 11 48 ? 0f 28 05 ? ? ? ? 0f 11 40 ? 0f 28 0d ? ? ? ? 0f 11 48 ? 0f b7 05", "E9 C7 02 00 00 90"}, + {"0f 85 ? ? ? ? 48 8d 45 ? 48 89 45 ? 0f b7 05 ? ? ? ? 66 89 45 ? 0f b6 05 ? ? ? ? 88 45 ? 0f 57 c0 0f 11 45 ? 45 33 f6 4c 89 75 ? 48 c7 45 ? ? ? ? ? 41 8d 4e ? e8 ? ? ? ? 48 8b c8 48 89 45 ? 48 c7 45 ? ? ? ? ? 48 c7 45 ? ? ? ? ? 0f 28 05 ? ? ? ? 0f 11 00 0f 28 0d ? ? ? ? 0f 11 48 ? 0f 28 05 ? ? ? ? 0f 11 40 ? 0f 28 0d ? ? ? ? 0f 11 48 ? 0f 28 05", "E9 2F 05 00 00 90"}, {"0f 8c ? ? ? ? ff 15 ? ? ? ? 48 8b f8 ff 15", "90 90 90 90 90 90"}, {"0f 84 ? ? ? ? c6 05", "90 90 90 90 90 90"}, {"0f 8c ? ? ? ? 48 8b 0d ? ? ? ? 48 85 c9 75 ? b9 ? ? ? ? e8 ? ? ? ? 48 89 45 ? 48 8b c8 e8 ? ? ? ? 90 48 89 05 ? ? ? ? 48 8b 10 48 8b c8 ff 52 ? 48 8b 0d ? ? ? ? 45 33 c0", "90 90 90 90 90 90"}, @@ -181,14 +183,14 @@ std::vector hacks::windows = { {"f3 0f 10 05 ? ? ? ? ff 15 ? ? ? ? 48 89 44 24", "0F 57 C0 90 90 90 90 90"} } }, - {"Random Seed", "Changes the seed game so that the random trigger is not triggered randomly"}, + // {"Random Seed", "Changes the seed game so that the random trigger is not triggered randomly"}, {"Respawn Time", "Changes respawn time on death"}, {"Restart Level", "Reload the level"}, {"Practice Mode", "Enter practice mode"}, {"Ignore ESC", "Prevents exiting the level"}, {"Instant Complete", "Instant level completion"}, {"Jump Hack", "Đšemoves the barrier to jump gravity"}, - {"Smart Startpos", "Restores correct gameplay without startpos settings"}, + // {"Smart Startpos", "Restores correct gameplay without startpos settings"}, {"Startpos Switcher", "The ability to switch between starting positions using the keys that you setted in keybinds"}, {"Reset Camera", "When switching between starting positions, the camera may move, so this feature fixes that unpleasant switch"}, {"RGB Icons", "LGBT icons, yes :3"}, @@ -244,12 +246,7 @@ std::vector hacks::windows = { {"74 ? 48 8b 8e ? ? ? ? 48 8b 01 f3 0f 10 0d ? ? ? ? ff 90 ? ? ? ? 48 8d 15", "EB"} } }, - {"No Shaders", "Disabling shaders in levels", - { - {"ff 15 ? ? ? ? 48 8b 8b ? ? ? ? 48 8b 01 ff 90 ? ? ? ? 48 8b c8 ff 15 ? ? ? ? 48 8d 94 24", "90 90 90 90 90 90"}, - {"7a ? 0f 84 ? ? ? ? 48 89 9c 24", "E9 14 09 00 00 90 90 90"} - } - }, + {"No Shaders", "Disabling shaders in levels"}, {"No Particles", "Disables resuming the particle system", { {"40 53 48 83 ec ? 48 83 b9 ? ? ? ? ? 48 8b d9 0f 84 ? ? ? ? 83 b9", "C3", "libcocos2d.dll"}, @@ -317,11 +314,7 @@ std::vector hacks::windows = { }, {"Creator", 440, 10, 210, 250, { - {"Copy Hack", "Copy any online level without a password", - { - {"0f 8f ? ? ? ? 41 8b 85", "E9 F6 00 00 00 90"} - } - }, + {"Copy Hack", "Copy any online level without a password"}, {"Custom Object Bypass", "Removes the limit restricted to 1000 objects", { {"0f 84 ? ? ? ? ff 15 ? ? ? ? 3d", "E9 51 01 00 00 90"}, @@ -351,14 +344,7 @@ std::vector hacks::windows = { {"0f 82 ? ? ? ? 48 8b 8f ? ? ? ? 4c 89 74 24", "90 90 90 90 90 90"} } }, - {"Level Edit", "Edit any online level", - { - {"0f 85 ? ? ? ? 48 8d 0d ? ? ? ? ff 15 ? ? ? ? 4c 8b f8 48 8b 38", "90 90 90 90 90 90"}, - {"4c 0f 44 c8", "49 89 C1 90"}, - {"0f 85 ? ? ? ? ff 15 ? ? ? ? 48 8b 10 48 8b c8 ff 52", "90 90 90 90 90 90"}, - {"0f 87 ? ? ? ? 48 63 c2 4c 8d 05 ? ? ? ? 41 8b 94 80 ? ? ? ? 49 03 d0 ff e2 e8", "E9 A8 01 00 00 90"} - } - }, + {"Level Edit", "Edit any online level"}, {"No (C) Mark", "Removes copyright on copied levels", { {"41 8b bd", "31 FF EB 0A"} @@ -420,6 +406,11 @@ void hacks::init() { else if (hck.name == "Show Hitboxes") { hacks::show_hitboxes = hck.enabled; } else if (hck.name == "Random Seed") { hacks::random_seed_enabled = hck.enabled; } else if (hck.name == "No Death Effect") { hacks::no_death_effect = hck.enabled; } + else if (hck.name == "Copy Hack") { hacks::copy_hack = hck.enabled; } + else if (hck.name == "Level Edit") { hacks::level_edit = hck.enabled; } + else if (hck.name == "Main Levels") { hacks::main_levels = hck.enabled; } + else if (hck.name == "No Shaders") { hacks::no_shaders = hck.enabled; } + else if (hck.name == "Safe Mode") { hacks::safe_mode = hck.enabled; } else { for (auto& opc : hck.opcodes) { std::string bytesStr = hck.enabled ? opc.on : opc.off; @@ -525,7 +516,7 @@ void hacks::save(const std::vector& windows, const std::filesystem::path j["label_opacity"] = labels::label_opacity; j["label_padding"] = labels::label_padding; - j["draw_trail"] = hacks::draw_trail; + // j["draw_trail"] = hacks::draw_trail; j["trail_length"] = hacks::trail_length; j["show_hitboxes_on_death"] = hacks::show_hitboxes_on_death; @@ -687,7 +678,7 @@ void hacks::load(const std::filesystem::path &filename, std::vector& win labels::label_opacity = j.value("label_opacity", 0.5f); labels::label_padding = j.value("label_padding", 5.0f); - hacks::draw_trail = j.value("draw_trail", false); + // hacks::draw_trail = j.value("draw_trail", false); hacks::trail_length = j.value("trail_length", 240); hacks::show_hitboxes_on_death = j.value("show_hitboxes_on_death", false); diff --git a/src/hacks.hpp b/src/hacks.hpp index 5c3cd30..4f2fad6 100644 --- a/src/hacks.hpp +++ b/src/hacks.hpp @@ -100,6 +100,13 @@ namespace hacks { extern bool disable_render; extern bool no_death_effect; + + extern bool copy_hack; + extern bool level_edit; + + extern bool no_shaders; + extern bool main_levels; + extern bool safe_mode; void update_framerate(float value); diff --git a/src/hooks.cpp b/src/hooks.cpp index 71a865c..47f02c3 100644 --- a/src/hooks.cpp +++ b/src/hooks.cpp @@ -16,6 +16,12 @@ #include #include #include +#include +#include +#include +#include +#include +#include #include "speedhackAudio.hpp" #include "labels.hpp" #include "replayEngine.hpp" @@ -349,6 +355,17 @@ class $modify(PlayLayer) { return true; } + void levelComplete() { + bool testmode = this->m_isTestMode; + + if (hacks::safe_mode) + m_isTestMode = true; + + PlayLayer::levelComplete(); + + m_isTestMode = testmode; + } + void addObject(GameObject* obj) { PlayLayer::addObject(obj); switch (obj->m_objectID) @@ -512,6 +529,9 @@ class $modify(PlayLayer) { PlayLayer::resetLevel(); + if (hacks::safe_mode) + m_level->m_attempts = m_level->m_attempts - 1; + labels::progress = 0; // geode::log::debug("[restart level] - curr {}; custom_curr {}", static_cast(m_gameState.m_currentProgress), static_cast(m_gameState.m_levelTime * 240)); @@ -583,6 +603,11 @@ class $modify(PlayLayer) { engine.mode = state::disable; } + void showNewBest(bool p0, int p1, int p2, bool p3, bool p4, bool p5) { + if (hacks::safe_mode) return; + PlayLayer::showNewBest(p0, p1, p2, p3, p4, p5); + } + void destroyPlayer(PlayerObject* player, GameObject* obj) { if (!m_fields->anticheat_obj) m_fields->anticheat_obj = obj; @@ -655,6 +680,13 @@ class $modify(PlayLayer) { } }; +class $modify(GJGameLevel) { + void savePercentage(int percent, bool isPracticeMode, int clicks, int attempts, bool isChkValid) { + if (hacks::safe_mode) return; + GJGameLevel::savePercentage(percent, isPracticeMode, clicks, attempts, isChkValid); + } +}; + class $modify(PlayerObject) { void flipGravity(bool p1, bool p2) { PlayerObject::flipGravity(p1, p2); @@ -662,6 +694,17 @@ class $modify(PlayerObject) { labels::gravity_p2_flipped = p2; // geode::log::debug("[gravity flip] p1: {} p2: {}", p1, p2); } + + void playDeathEffect() { + if (hacks::no_death_effect) return; + PlayerObject::playDeathEffect(); + } + + void incrementJumps() { + if (hacks::safe_mode) return; + + PlayerObject::incrementJumps(); + } }; class $modify(MyEndLevelLayer, EndLevelLayer) { @@ -801,13 +844,6 @@ class $modify(GameManager) { } }; -class $modify(PlayerObject) { - void playDeathEffect() { - if (hacks::no_death_effect) return; - PlayerObject::playDeathEffect(); - } -}; - class $modify(GameStatsManager) { bool isItemUnlocked(UnlockType p0, int p1) { if (GameStatsManager::isItemUnlocked(p0, p1)) @@ -825,6 +861,62 @@ class $modify(GameStatsManager) { return false; } }; +//EditorUI +class $modify(EditorUI) { + void onSettings(cocos2d::CCObject* sender) { + auto levelType = LevelEditorLayer::get()->m_level->m_levelType; + + if (hacks::level_edit) + LevelEditorLayer::get()->m_level->m_levelType = GJLevelType::Editor; + EditorUI::onSettings(sender); + LevelEditorLayer::get()->m_level->m_levelType = levelType; + } +}; + +class $modify(ShaderLayer) { + void performCalculations() { + if (hacks::no_shaders) { + m_state.m_usesShaders = false; + return; + } + + ShaderLayer::performCalculations(); + } +}; + +class $modify(LevelPage) { + void onPlay(cocos2d::CCObject* sender) { + auto coins = m_level->m_requiredCoins; + + if (hacks::main_levels) m_level->m_requiredCoins = 0; + + LevelPage::onPlay(sender); + + m_level->m_requiredCoins = coins; + } +}; + +class $modify(EditorPauseLayer) { + bool init(LevelEditorLayer* p0) { + auto levelType = LevelEditorLayer::get()->m_level->m_levelType; + + if (hacks::level_edit) + LevelEditorLayer::get()->m_level->m_levelType = GJLevelType::Editor; + auto ret = EditorPauseLayer::init(p0); + LevelEditorLayer::get()->m_level->m_levelType = levelType; + + return ret; + } +}; + +class $modify(LevelTools) { + static bool verifyLevelIntegrity(gd::string p0, int p1) { + if (LevelTools::verifyLevelIntegrity(p0, p1)) + return true; + + return hacks::level_edit; + } +}; class $modify(PauseLayer) { static void onModify(auto& self) { @@ -837,7 +929,15 @@ class $modify(PauseLayer) { } void customSetup() { + auto levelType = PlayLayer::get()->m_level->m_levelType; + + if (hacks::level_edit) + PlayLayer::get()->m_level->m_levelType = GJLevelType::Editor; + PauseLayer::customSetup(); + + PlayLayer::get()->m_level->m_levelType = levelType; + hooks::pauseLayer = this; if (hacks::hide_menu) { this->setVisible(false); @@ -848,6 +948,17 @@ class $modify(PauseLayer) { PauseLayer::onResume(sender); hooks::pauseLayer = nullptr; } + + void onEdit(cocos2d::CCObject* sender) { + auto a = PlayLayer::get()->m_level->m_levelType; + + if (hacks::level_edit) + PlayLayer::get()->m_level->m_levelType = GJLevelType::Editor; + + PauseLayer::onEdit(sender); + + PlayLayer::get()->m_level->m_levelType = a; + } }; class $modify(AchievementNotifier) { @@ -940,4 +1051,12 @@ class $modify(LevelInfoLayer) { return true; } + + static LevelInfoLayer* create(GJGameLevel* level, bool challenge) { + if (hacks::copy_hack) { + level->m_password = 1; + } + + return LevelInfoLayer::create(level, challenge); + } };