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..fe0f99bf 100644 --- a/libs/imgui/imgui_draw.cpp +++ b/libs/imgui/imgui_draw.cpp @@ -386,9 +386,10 @@ 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, 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..464aca16 100644 --- a/src/gui.cpp +++ b/src/gui.cpp @@ -298,11 +298,26 @@ void Gui::Render() { renderKeyButton("Menu Key: ", m_toggleKey); - ImGui::Text("Framerate"); + ImGui::Text("Speedhack"); ImGui::Separator(); ImGui::Spacing(); - renderKeyButton("Speedhack Key: ", m_speedhackKey); + 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(); + ImGui::Spacing(); + renderKeyButton("TPS Bypass Key: ", m_tpsKey); ImGui::Text("Replay Engine"); diff --git a/src/gui.hpp b/src/gui.hpp index 5658c5b5..e7c83181 100644 --- a/src/gui.hpp +++ b/src/gui.hpp @@ -31,6 +31,13 @@ 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; + float m_speedhackToastDelay = 1.0; + float m_speedhackToastScale = 1.0; + int m_speedhackToastOpacity = 127; + int m_tpsKey = 0; int m_playbackKey = 0; @@ -288,4 +295,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..91299a50 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,12 @@ 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["speedhackToastDelay"] = gui.m_speedhackToastDelay; + keybindJson["speedhackToastScale"] = gui.m_speedhackToastScale; + keybindJson["speedhackToastOpacity"] = gui.m_speedhackToastOpacity; keybindJson["tpsKey"] = gui.m_tpsKey; keybindJson["playbackKey"] = gui.m_playbackKey; @@ -882,7 +889,6 @@ void Hacks::saveKeybinds() { keybindJson["startposSwitcherLeftKey"] = gui.m_startposSwitcherLeftKey; keybindJson["startposSwitcherRightKey"] = gui.m_startposSwitcherRightKey; - keybindJson["autoDeafenKey"] = gui.m_autoDeafenKey; if (!keybindJson.empty()) { @@ -920,6 +926,12 @@ 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_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); @@ -1060,6 +1072,28 @@ 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 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, gui.m_speedhackToastDelay, gui.m_speedhackToastScale, gui.m_speedhackToastOpacity); + } + + if (gui.m_speedhackIncreaseKey == key) { + float speedhackValue = config.get("speedhack_value", 1.0f); + 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, gui.m_speedhackToastDelay, gui.m_speedhackToastScale, gui.m_speedhackToastOpacity); + } + 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); +}