Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Empty file added comp
Empty file.
3 changes: 2 additions & 1 deletion libs/imgui/imgui_draw.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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);

Expand Down
2 changes: 1 addition & 1 deletion mod.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"geode": "4.6.3",
"geode": "4.7.1",
"gd": {
"win": "2.2074",
"android": "2.2074",
Expand Down
19 changes: 17 additions & 2 deletions src/gui.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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");
Expand Down
9 changes: 8 additions & 1 deletion src/gui.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -288,4 +295,4 @@ namespace ImGuiH {
ImGui::PopStyleColor();
return ret;
}
}
}
36 changes: 35 additions & 1 deletion src/hacks.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
#include "recorder.hpp"
#include "replayEngine.hpp"
#include <imgui-cocos.hpp>
#include <Geode/binding/TextAlertPopup.hpp>
#include "popupSystem.hpp"
#include "utils.hpp"

Expand Down Expand Up @@ -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;
Expand All @@ -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()) {
Expand Down Expand Up @@ -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);
Expand Down Expand Up @@ -1060,6 +1072,28 @@ void Hacks::toggleKeybinds(int key) {
if (gui.m_speedhackKey == key)
config.set<bool>("speedhack_enabled", !config.get<bool>("speedhack_enabled", false));

if (gui.m_speedhackDecreaseKey == key) {
float speedhackValue = config.get<float>("speedhack_value", 1.0f);
float newSpeedhackValue = speedhackValue - gui.m_speedhackStepInterval;

config.set<float>("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<float>("speedhack_value", 1.0f);
float newSpeedhackValue = speedhackValue + gui.m_speedhackStepInterval;

config.set<float>("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<bool>("tps_enabled", !config.get<bool>("tps_enabled", false));

Expand Down
2 changes: 1 addition & 1 deletion src/utils.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}
}
16 changes: 15 additions & 1 deletion src/utils.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
#include <cctype>
#include <fstream>
#include "config.hpp"
#include <Geode/binding/TextAlertPopup.hpp>

#ifdef GEODE_IS_WINDOWS
struct WindowStateBackup {
Expand Down Expand Up @@ -53,4 +54,17 @@ static void benchmark(const std::string& name, const std::function<void()>& func

geode::log::debug("[Benchmark] {}: avg = {:.0f} ns | {:.4f} ms ({} runs)\n",
name, avg_ns, avg_ms, runs);
}
}

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<cocos2d::extension::CCScale9Sprite>(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);
}