From 5d5470f9996b5b9b4a1f3b972bf7ec8985485ae6 Mon Sep 17 00:00:00 2001 From: Illia Zhdanov Date: Sat, 16 Aug 2025 17:33:09 +0300 Subject: [PATCH 1/3] added more speedhack keybinds --- comp | 0 libs/imgui/imgui_draw.cpp | 8 +++++--- mod.json | 2 +- src/gui.cpp | 10 +++++++++- src/gui.hpp | 5 ++++- src/hacks.cpp | 32 +++++++++++++++++++++++++++++++- src/utils.cpp | 2 +- src/utils.hpp | 16 +++++++++++++++- 8 files changed, 66 insertions(+), 9 deletions(-) create mode 100644 comp diff --git a/comp b/comp new file mode 100644 index 00000000..e69de29b diff --git a/libs/imgui/imgui_draw.cpp b/libs/imgui/imgui_draw.cpp index 2be82021..f763a2f3 100644 --- a/libs/imgui/imgui_draw.cpp +++ b/libs/imgui/imgui_draw.cpp @@ -386,9 +386,11 @@ void ImDrawListSharedData::SetCircleTessellationMaxError(float max_error) void ImDrawList::_ResetForNewFrame() { // Verify that the ImDrawCmd fields we want to memcmp() are contiguous in memory. - IM_STATIC_ASSERT(offsetof(ImDrawCmd, ClipRect) == 0); - IM_STATIC_ASSERT(offsetof(ImDrawCmd, TextureId) == sizeof(ImVec4)); - IM_STATIC_ASSERT(offsetof(ImDrawCmd, VtxOffset) == sizeof(ImVec4) + sizeof(ImTextureID)); + + // IM_STATIC_ASSERT(offsetof(ImDrawCmd, ClipRect) == 0); + // IM_STATIC_ASSERT(offsetof(ImDrawCmd, TextureId) == sizeof(ImVec4)); + // IM_STATIC_ASSERT(offsetof(ImDrawCmd, VtxOffset) == sizeof(ImVec4) + sizeof(ImTextureID)); + if (_Splitter._Count > 1) _Splitter.Merge(this); diff --git a/mod.json b/mod.json index 2311b15b..2a964dae 100644 --- a/mod.json +++ b/mod.json @@ -1,5 +1,5 @@ { - "geode": "4.6.3", + "geode": "4.7.1", "gd": { "win": "2.2074", "android": "2.2074", diff --git a/src/gui.cpp b/src/gui.cpp index 7bbc63ef..f657fa27 100644 --- a/src/gui.cpp +++ b/src/gui.cpp @@ -298,11 +298,19 @@ void Gui::Render() { renderKeyButton("Menu Key: ", m_toggleKey); - ImGui::Text("Framerate"); + ImGui::Text("Speedhack"); ImGui::Separator(); ImGui::Spacing(); renderKeyButton("Speedhack Key: ", m_speedhackKey); + renderKeyButton("Speedhack Decrease Key: ", m_speedhackDecreaseKey); + renderKeyButton("Speedhack Increase Key: ", m_speedhackIncreaseKey); + ImGui::InputFloat("Speedhack Step Interval: ", &m_speedhackStepInterval, 0.1f, 1.0f, "%.2fx"); + + ImGui::Text("Framerate"); + ImGui::Separator(); + ImGui::Spacing(); + renderKeyButton("TPS Bypass Key: ", m_tpsKey); ImGui::Text("Replay Engine"); diff --git a/src/gui.hpp b/src/gui.hpp index 5658c5b5..beb6698b 100644 --- a/src/gui.hpp +++ b/src/gui.hpp @@ -31,6 +31,9 @@ class Gui { int m_toggleKey = GLFW_KEY_TAB; int m_speedhackKey = 0; + int m_speedhackDecreaseKey = 0; + int m_speedhackIncreaseKey = 0; + float m_speedhackStepInterval = 0.1; int m_tpsKey = 0; int m_playbackKey = 0; @@ -288,4 +291,4 @@ namespace ImGuiH { ImGui::PopStyleColor(); return ret; } -} \ No newline at end of file +} diff --git a/src/hacks.cpp b/src/hacks.cpp index 99f14588..8ff06f8f 100644 --- a/src/hacks.cpp +++ b/src/hacks.cpp @@ -6,6 +6,7 @@ #include "recorder.hpp" #include "replayEngine.hpp" #include +#include #include "popupSystem.hpp" #include "utils.hpp" @@ -866,6 +867,9 @@ void Hacks::saveKeybinds() { keybindJson["gui::toggle"] = gui.m_toggleKey; keybindJson["speedhackKey"] = gui.m_speedhackKey; + keybindJson["speedhackDecreaseKey"] = gui.m_speedhackDecreaseKey; + keybindJson["speedhackIncreaseKey"] = gui.m_speedhackIncreaseKey; + keybindJson["speedhackStepInterval"] = gui.m_speedhackStepInterval; keybindJson["tpsKey"] = gui.m_tpsKey; keybindJson["playbackKey"] = gui.m_playbackKey; @@ -882,7 +886,6 @@ void Hacks::saveKeybinds() { keybindJson["startposSwitcherLeftKey"] = gui.m_startposSwitcherLeftKey; keybindJson["startposSwitcherRightKey"] = gui.m_startposSwitcherRightKey; - keybindJson["autoDeafenKey"] = gui.m_autoDeafenKey; if (!keybindJson.empty()) { @@ -920,6 +923,9 @@ void Hacks::loadKeybinds() { gui.m_toggleKey = keybindJson.value("gui::toggle", GLFW_KEY_TAB); gui.m_speedhackKey = keybindJson.value("speedhackKey", 0); + gui.m_speedhackDecreaseKey = keybindJson.value("speedhackDecreaseKey", 0); + gui.m_speedhackIncreaseKey = keybindJson.value("speedhackIncreaseKey", 0); + gui.m_speedhackStepInterval = keybindJson.value("speedhackStepInterval", 0.1f); gui.m_tpsKey = keybindJson.value("tpsKey", 0); gui.m_playbackKey = keybindJson.value("playbackKey", 0); @@ -1060,6 +1066,30 @@ void Hacks::toggleKeybinds(int key) { if (gui.m_speedhackKey == key) config.set("speedhack_enabled", !config.get("speedhack_enabled", false)); + if (gui.m_speedhackDecreaseKey == key) { + float speedhackValue = config.get("speedhack_value", 1.0f); + float speedhackStepInterval = config.get("speedhack_step_interval", 0.1f); + float newSpeedhackValue = speedhackValue - speedhackStepInterval; + + config.set("speedhack_value", newSpeedhackValue); + + std::string notification_text = std::format("{:.2f}x->{:.2f}x", speedhackValue, newSpeedhackValue); + + toast(notification_text); + } + + if (gui.m_speedhackIncreaseKey == key) { + float speedhackValue = config.get("speedhack_value", 1.0f); + float speedhackStepInterval = config.get("speedhack_step_interval", 0.1f); + float newSpeedhackValue = speedhackValue + speedhackStepInterval; + + config.set("speedhack_value", newSpeedhackValue); + + std::string notification_text = std::format("{:.2f}x->{:.2f}x", speedhackValue, newSpeedhackValue); + + toast(notification_text); + } + if (gui.m_tpsKey == key) config.set("tps_enabled", !config.get("tps_enabled", false)); diff --git a/src/utils.cpp b/src/utils.cpp index e4ca8b3f..1d7e46d8 100644 --- a/src/utils.cpp +++ b/src/utils.cpp @@ -161,4 +161,4 @@ void utilsH::setPitchShifter(float pitch) { pitchShifter->setParameterFloat(FMOD_DSP_PITCHSHIFT_FFTSIZE, 2048); // Average balance of accuracy and delay (1024 by default) pitchShifter->setParameterFloat(FMOD_DSP_PITCHSHIFT_PITCH, pitch); -} \ No newline at end of file +} diff --git a/src/utils.hpp b/src/utils.hpp index eb3ef81e..89a15153 100644 --- a/src/utils.hpp +++ b/src/utils.hpp @@ -3,6 +3,7 @@ #include #include #include "config.hpp" +#include #ifdef GEODE_IS_WINDOWS struct WindowStateBackup { @@ -53,4 +54,17 @@ static void benchmark(const std::string& name, const std::function& func geode::log::debug("[Benchmark] {}: avg = {:.0f} ns | {:.4f} ms ({} runs)\n", name, avg_ns, avg_ms, runs); -} \ No newline at end of file +} + +static void toast(const std::string& text, float delay = 1, float scale = 1, int opacity = 127) { + auto alert = TextAlertPopup::create(text, delay, scale, opacity, "bigFont.fnt"); + auto cs = alert->getChildByType(0)->getScaledContentSize(); + alert->setPosition( + cs.width / 2.f, + cocos2d::CCDirector::get()->getWinSize().height - cs.height / 2.f + ); + + auto scene = cocos2d::CCScene::get(); + + scene->addChild(alert); +} From 5c1f2b6941afe23d705c6c70f185f6e66a144127 Mon Sep 17 00:00:00 2001 From: Illia Zhdanov Date: Sat, 16 Aug 2025 17:35:25 +0300 Subject: [PATCH 2/3] reverted accidental imgui change --- libs/imgui/imgui_draw.cpp | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/libs/imgui/imgui_draw.cpp b/libs/imgui/imgui_draw.cpp index f763a2f3..fe0f99bf 100644 --- a/libs/imgui/imgui_draw.cpp +++ b/libs/imgui/imgui_draw.cpp @@ -386,10 +386,9 @@ void ImDrawListSharedData::SetCircleTessellationMaxError(float max_error) void ImDrawList::_ResetForNewFrame() { // Verify that the ImDrawCmd fields we want to memcmp() are contiguous in memory. - - // IM_STATIC_ASSERT(offsetof(ImDrawCmd, ClipRect) == 0); - // IM_STATIC_ASSERT(offsetof(ImDrawCmd, TextureId) == sizeof(ImVec4)); - // IM_STATIC_ASSERT(offsetof(ImDrawCmd, VtxOffset) == sizeof(ImVec4) + sizeof(ImTextureID)); + IM_STATIC_ASSERT(offsetof(ImDrawCmd, ClipRect) == 0); + IM_STATIC_ASSERT(offsetof(ImDrawCmd, TextureId) == sizeof(ImVec4)); + IM_STATIC_ASSERT(offsetof(ImDrawCmd, VtxOffset) == sizeof(ImVec4) + sizeof(ImTextureID)); if (_Splitter._Count > 1) _Splitter.Merge(this); From 3ffc860d7e11b5c5efc3b082df08788e9a269abe Mon Sep 17 00:00:00 2001 From: Illia Zhdanov Date: Sat, 16 Aug 2025 18:53:17 +0300 Subject: [PATCH 3/3] add toast customization --- src/gui.cpp | 15 +++++++++++---- src/gui.hpp | 4 ++++ src/hacks.cpp | 18 +++++++++++------- 3 files changed, 26 insertions(+), 11 deletions(-) diff --git a/src/gui.cpp b/src/gui.cpp index f657fa27..464aca16 100644 --- a/src/gui.cpp +++ b/src/gui.cpp @@ -302,10 +302,17 @@ void Gui::Render() { ImGui::Separator(); ImGui::Spacing(); - renderKeyButton("Speedhack Key: ", m_speedhackKey); - renderKeyButton("Speedhack Decrease Key: ", m_speedhackDecreaseKey); - renderKeyButton("Speedhack Increase Key: ", m_speedhackIncreaseKey); - ImGui::InputFloat("Speedhack Step Interval: ", &m_speedhackStepInterval, 0.1f, 1.0f, "%.2fx"); + renderKeyButton("Toggle Key", m_speedhackKey); + renderKeyButton("Decrease Key", m_speedhackDecreaseKey); + renderKeyButton("Increase Key", m_speedhackIncreaseKey); + ImGui::InputFloat("Step Interval", &m_speedhackStepInterval, 0.1f, 1.0f, "%.2fx"); + ImGui::InputFloat("Toast Delay", &m_speedhackToastDelay, 0.1f, 1.0f, "%.2fs"); + ImGui::InputFloat("Toast Scale", &m_speedhackToastScale, 0.1f, 2.0f, "%.2f"); + + uint8_t step = 5; + uint8_t stepFast = 10; + ImGui::InputScalar("Toast Opacity", ImGuiDataType_U8, &m_speedhackToastOpacity, &step, &stepFast, "%u"); + ImGui::Text("Framerate"); ImGui::Separator(); diff --git a/src/gui.hpp b/src/gui.hpp index beb6698b..e7c83181 100644 --- a/src/gui.hpp +++ b/src/gui.hpp @@ -34,6 +34,10 @@ class Gui { int m_speedhackDecreaseKey = 0; int m_speedhackIncreaseKey = 0; float m_speedhackStepInterval = 0.1; + float m_speedhackToastDelay = 1.0; + float m_speedhackToastScale = 1.0; + int m_speedhackToastOpacity = 127; + int m_tpsKey = 0; int m_playbackKey = 0; diff --git a/src/hacks.cpp b/src/hacks.cpp index 8ff06f8f..91299a50 100644 --- a/src/hacks.cpp +++ b/src/hacks.cpp @@ -870,6 +870,9 @@ void Hacks::saveKeybinds() { keybindJson["speedhackDecreaseKey"] = gui.m_speedhackDecreaseKey; keybindJson["speedhackIncreaseKey"] = gui.m_speedhackIncreaseKey; keybindJson["speedhackStepInterval"] = gui.m_speedhackStepInterval; + keybindJson["speedhackToastDelay"] = gui.m_speedhackToastDelay; + keybindJson["speedhackToastScale"] = gui.m_speedhackToastScale; + keybindJson["speedhackToastOpacity"] = gui.m_speedhackToastOpacity; keybindJson["tpsKey"] = gui.m_tpsKey; keybindJson["playbackKey"] = gui.m_playbackKey; @@ -926,6 +929,9 @@ void Hacks::loadKeybinds() { gui.m_speedhackDecreaseKey = keybindJson.value("speedhackDecreaseKey", 0); gui.m_speedhackIncreaseKey = keybindJson.value("speedhackIncreaseKey", 0); gui.m_speedhackStepInterval = keybindJson.value("speedhackStepInterval", 0.1f); + gui.m_speedhackToastDelay = keybindJson.value("speedhackToastDelay", 1.f); + gui.m_speedhackToastScale = keybindJson.value("speedhackToastScale", 1.f); + gui.m_speedhackToastOpacity = keybindJson.value("speedhackToastOpacity", 127); gui.m_tpsKey = keybindJson.value("tpsKey", 0); gui.m_playbackKey = keybindJson.value("playbackKey", 0); @@ -1068,26 +1074,24 @@ void Hacks::toggleKeybinds(int key) { if (gui.m_speedhackDecreaseKey == key) { float speedhackValue = config.get("speedhack_value", 1.0f); - float speedhackStepInterval = config.get("speedhack_step_interval", 0.1f); - float newSpeedhackValue = speedhackValue - speedhackStepInterval; - + float newSpeedhackValue = speedhackValue - gui.m_speedhackStepInterval; + config.set("speedhack_value", newSpeedhackValue); std::string notification_text = std::format("{:.2f}x->{:.2f}x", speedhackValue, newSpeedhackValue); - toast(notification_text); + toast(notification_text, gui.m_speedhackToastDelay, gui.m_speedhackToastScale, gui.m_speedhackToastOpacity); } if (gui.m_speedhackIncreaseKey == key) { float speedhackValue = config.get("speedhack_value", 1.0f); - float speedhackStepInterval = config.get("speedhack_step_interval", 0.1f); - float newSpeedhackValue = speedhackValue + speedhackStepInterval; + float newSpeedhackValue = speedhackValue + gui.m_speedhackStepInterval; config.set("speedhack_value", newSpeedhackValue); std::string notification_text = std::format("{:.2f}x->{:.2f}x", speedhackValue, newSpeedhackValue); - toast(notification_text); + toast(notification_text, gui.m_speedhackToastDelay, gui.m_speedhackToastScale, gui.m_speedhackToastOpacity); } if (gui.m_tpsKey == key)