Skip to content
This repository has been archived by the owner on Aug 6, 2024. It is now read-only.

Commit

Permalink
Beta 3!
Browse files Browse the repository at this point in the history
  • Loading branch information
TobyAdd committed Jul 22, 2023
1 parent ac75730 commit 75ceba7
Show file tree
Hide file tree
Showing 16 changed files with 1,197 additions and 281 deletions.
2 changes: 0 additions & 2 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,6 @@ project(${PROJECT})
file(GLOB_RECURSE SOURCE_FILES src/*.cpp)
add_library(${PROJECT} SHARED ${SOURCE_FILES})

add_compile_definitions(UNICODE _UNICODE)

target_include_directories(${PROJECT} PRIVATE
libs/minhook/include
libs/gd.h/include
Expand Down
13 changes: 4 additions & 9 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,21 +5,16 @@ ReplayEngine is a redesigned and improved project that offers more accurate macr
# Download
https://github.com/TobyAdd/ReplayEngine/releases
# How to install
You need to inject a DLL into Geometry Dash. You can use [Cheat Engine](https://www.cheatengine.org/index.php) or [another injector](https://www.google.com/search?q=dll+injector). Do not inject it with Mega Hack as it may not work properly. You can use [GDDLLLoader](https://github.com/adafcaefc/GDDllLoader) to inject it
Press K to open UI
# Screenshot
![image](https://github.com/TobyAdd/ReplayEngine/assets/66429886/f31b093e-eb6d-4718-918b-0d7cdca19c29)
You need to inject a DLL into Geometry Dash. You can use [Cheat Engine](https://www.cheatengine.org/index.php) or [another injector](https://www.google.com/search?q=dll+injector). Do not inject it with Mega Hack as it may not work properly. You can use [GDDLLLoader](https://github.com/adafcaefc/GDDllLoader) to inject it
# Screenshot (design is not finished yet)
![sc](https://user-images.githubusercontent.com/66429886/233846048-7295ea54-f768-48b5-879a-51904c066a1a.png)
# Features
- Accurate replay recording
- Intergrated FPS Bypass and Speedhack
- Frame Advance
- Spam Bot
- Straight Fly Bot
- Dual Clicks
- Internal Recorder
- Hacks
# Special Thanks
[@FireMario211](https://github.com/FireMario211) - For the development of the GD Mod example.
[@HJfod](https://github.com/HJfod) - Help with some coding stuff.
[@matcool](https://github.com/matcool) - Internal Recorder
[@absoIute](https://github.com/absoIute) - Hacks
[@HJfod](https://github.com/HJfod) - Help with some coding stuff.
2 changes: 1 addition & 1 deletion libs/imgui-hook/imgui-hook.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -55,8 +55,8 @@ void __fastcall CCEGLView_swapBuffers_H(CCEGLView* self)
ImGuiIO& io = ImGui::GetIO();
io.Fonts->AddFontFromMemoryTTF(fontData, sizeof(fontData), 14.f);
io.IniFilename = nullptr;
ApplyColor();
ApplyStyle();
ApplyColor();
hWnd = WindowFromDC(*reinterpret_cast<HDC*>(reinterpret_cast<uintptr_t>(self->getWindow()) + 0x244));
originalWndProc = (WNDPROC)GetWindowLongPtr(hWnd, GWLP_WNDPROC);
SetWindowLongPtr(hWnd, GWLP_WNDPROC, (LONG_PTR)HookedWndProc);
Expand Down
137 changes: 82 additions & 55 deletions libs/imgui-hook/imgui_theme.hpp
Original file line number Diff line number Diff line change
@@ -1,63 +1,90 @@
#include "imgui/imgui.h"

void ApplyColor() {
ImVec4 *colors = ImGui::GetStyle().Colors;
colors[ImGuiCol_Text] = ImVec4(1.00f, 1.00f, 1.00f, 1.00f);
colors[ImGuiCol_TextDisabled] = ImVec4(0.50f, 0.50f, 0.50f, 1.00f);
colors[ImGuiCol_WindowBg] = ImVec4(0.14f, 0.16f, 0.18f, 1.00f);
colors[ImGuiCol_ChildBg] = ImVec4(0.14f, 0.16f, 0.18f, 0.00f);
colors[ImGuiCol_PopupBg] = ImVec4(0.15f, 0.17f, 0.18f, 1.00f);
colors[ImGuiCol_Border] = ImVec4(0.83f, 0.83f, 0.84f, 0.47f);
colors[ImGuiCol_BorderShadow] = ImVec4(0.83f, 0.83f, 0.84f, 0.00f);
colors[ImGuiCol_FrameBg] = ImVec4(0.22f, 0.24f, 0.26f, 1.00f);
colors[ImGuiCol_FrameBgHovered] = ImVec4(0.31f, 0.33f, 0.34f, 1.00f);
colors[ImGuiCol_FrameBgActive] = ImVec4(0.40f, 0.41f, 0.42f, 1.00f);
colors[ImGuiCol_TitleBg] = ImVec4(0.22f, 0.24f, 0.26f, 1.00f);
colors[ImGuiCol_TitleBgActive] = ImVec4(0.22f, 0.24f, 0.26f, 1.00f);
colors[ImGuiCol_TitleBgCollapsed] = ImVec4(0.22f, 0.24f, 0.26f, 1.00f);
colors[ImGuiCol_MenuBarBg] = ImVec4(0.20f, 0.22f, 0.23f, 1.00f);
colors[ImGuiCol_ScrollbarBg] = ImVec4(0.14f, 0.16f, 0.18f, 1.00f);
colors[ImGuiCol_ScrollbarGrab] = ImVec4(0.31f, 0.31f, 0.31f, 1.00f);
colors[ImGuiCol_ScrollbarGrabHovered] = ImVec4(0.41f, 0.41f, 0.41f, 1.00f);
colors[ImGuiCol_ScrollbarGrabActive] = ImVec4(0.51f, 0.51f, 0.51f, 1.00f);
colors[ImGuiCol_CheckMark] = ImVec4(1.00f, 1.00f, 1.00f, 1.00f);
colors[ImGuiCol_SliderGrab] = ImVec4(1.00f, 1.00f, 1.00f, 0.59f);
colors[ImGuiCol_SliderGrabActive] = ImVec4(1.00f, 1.00f, 1.00f, 0.59f);
colors[ImGuiCol_Button] = ImVec4(0.22f, 0.24f, 0.26f, 0.90f);
colors[ImGuiCol_ButtonHovered] = ImVec4(0.31f, 0.33f, 0.34f, 0.90f);
colors[ImGuiCol_ButtonActive] = ImVec4(0.40f, 0.41f, 0.42f, 0.90f);
colors[ImGuiCol_Header] = ImVec4(0.22f, 0.24f, 0.26f, 1.00f);
colors[ImGuiCol_HeaderHovered] = ImVec4(0.31f, 0.33f, 0.34f, 1.00f);
colors[ImGuiCol_HeaderActive] = ImVec4(0.40f, 0.41f, 0.42f, 1.00f);
colors[ImGuiCol_Separator] = ImVec4(0.43f, 0.43f, 0.50f, 0.50f);
colors[ImGuiCol_SeparatorHovered] = ImVec4(0.31f, 0.33f, 0.34f, 1.00f);
colors[ImGuiCol_SeparatorActive] = ImVec4(0.40f, 0.41f, 0.42f, 1.00f);
colors[ImGuiCol_ResizeGrip] = ImVec4(0.22f, 0.24f, 0.26f, 1.00f);
colors[ImGuiCol_ResizeGripHovered] = ImVec4(0.31f, 0.33f, 0.34f, 1.00f);
colors[ImGuiCol_ResizeGripActive] = ImVec4(0.40f, 0.41f, 0.42f, 1.00f);
colors[ImGuiCol_Tab] = ImVec4(0.22f, 0.24f, 0.26f, 1.00f);
colors[ImGuiCol_TabHovered] = ImVec4(0.31f, 0.33f, 0.34f, 1.00f);
colors[ImGuiCol_TabActive] = ImVec4(0.31f, 0.33f, 0.34f, 1.00f);
colors[ImGuiCol_TabUnfocused] = ImVec4(0.22f, 0.24f, 0.26f, 1.00f);
colors[ImGuiCol_TabUnfocusedActive] = ImVec4(0.22f, 0.24f, 0.26f, 1.00f);
colors[ImGuiCol_PlotLines] = ImVec4(0.61f, 0.61f, 0.61f, 1.00f);
colors[ImGuiCol_PlotLinesHovered] = ImVec4(1.00f, 0.43f, 0.35f, 1.00f);
colors[ImGuiCol_PlotHistogram] = ImVec4(0.90f, 0.70f, 0.00f, 1.00f);
colors[ImGuiCol_PlotHistogramHovered] = ImVec4(1.00f, 0.60f, 0.00f, 1.00f);
colors[ImGuiCol_TableHeaderBg] = ImVec4(0.22f, 0.24f, 0.26f, 1.00f);
colors[ImGuiCol_TableBorderStrong] = ImVec4(1.00f, 1.00f, 1.00f, 0.47f);
colors[ImGuiCol_TableBorderLight] = ImVec4(0.23f, 0.23f, 0.25f, 1.00f);
colors[ImGuiCol_TableRowBg] = ImVec4(0.22f, 0.24f, 0.26f, 1.00f);
colors[ImGuiCol_TableRowBgAlt] = ImVec4(0.22f, 0.24f, 0.26f, 1.00f);
colors[ImGuiCol_TextSelectedBg] = ImVec4(0.40f, 0.41f, 0.42f, 1.00f);
colors[ImGuiCol_DragDropTarget] = ImVec4(1.00f, 1.00f, 0.00f, 0.90f);
colors[ImGuiCol_NavHighlight] = ImVec4(0.26f, 0.59f, 0.98f, 1.00f);
colors[ImGuiCol_NavWindowingHighlight] = ImVec4(1.00f, 1.00f, 1.00f, 0.70f);
colors[ImGuiCol_NavWindowingDimBg] = ImVec4(0.80f, 0.80f, 0.80f, 0.20f);
colors[ImGuiCol_ModalWindowDimBg] = ImVec4(0.80f, 0.80f, 0.80f, 0.35f);
auto* colors = ImGui::GetStyle().Colors;
colors[ImGuiCol_Text] = ImVec4(1.00f, 1.00f, 1.00f, 1.00f);
colors[ImGuiCol_TextDisabled] = ImVec4(0.50f, 0.50f, 0.50f, 1.00f);
colors[ImGuiCol_WindowBg] = ImVec4(0.04f, 0.15f, 0.28f, 1.00f);
colors[ImGuiCol_ChildBg] = ImVec4(0.04f, 0.15f, 0.28f, 0.00f);
colors[ImGuiCol_PopupBg] = ImVec4(0.04f, 0.15f, 0.28f, 1.00f);
colors[ImGuiCol_Border] = ImVec4(0.17f, 0.45f, 0.70f, 0.50f);
colors[ImGuiCol_BorderShadow] = ImVec4(0.17f, 0.45f, 0.70f, 0.50f);
colors[ImGuiCol_FrameBg] = ImVec4(0.13f, 0.26f, 0.45f, 0.54f);
colors[ImGuiCol_FrameBgHovered] = ImVec4(0.20f, 0.39f, 0.70f, 0.54f);
colors[ImGuiCol_FrameBgActive] = ImVec4(0.17f, 0.45f, 0.70f, 0.54f);
colors[ImGuiCol_TitleBg] = ImVec4(0.13f, 0.26f, 0.45f, 1.00f);
colors[ImGuiCol_TitleBgActive] = ImVec4(0.13f, 0.26f, 0.45f, 1.00f);
colors[ImGuiCol_TitleBgCollapsed] = ImVec4(0.13f, 0.26f, 0.45f, 1.00f);
colors[ImGuiCol_MenuBarBg] = ImVec4(0.13f, 0.26f, 0.45f, 1.00f);
colors[ImGuiCol_ScrollbarBg] = ImVec4(0.04f, 0.15f, 0.28f, 1.00f);
colors[ImGuiCol_ScrollbarGrab] = ImVec4(0.17f, 0.45f, 0.70f, 0.54f);
colors[ImGuiCol_ScrollbarGrabHovered] = ImVec4(0.24f, 0.56f, 0.70f, 0.54f);
colors[ImGuiCol_ScrollbarGrabActive] = ImVec4(0.17f, 0.45f, 0.70f, 0.54f);
colors[ImGuiCol_CheckMark] = ImVec4(1.00f, 1.00f, 1.00f, 1.00f);
colors[ImGuiCol_SliderGrab] = ImVec4(1.00f, 1.00f, 1.00f, 0.50f);
colors[ImGuiCol_SliderGrabActive] = ImVec4(1.00f, 1.00f, 1.00f, 0.50f);
colors[ImGuiCol_Button] = ImVec4(0.13f, 0.26f, 0.45f, 0.54f);
colors[ImGuiCol_ButtonHovered] = ImVec4(0.20f, 0.39f, 0.70f, 0.54f);
colors[ImGuiCol_ButtonActive] = ImVec4(0.17f, 0.45f, 0.70f, 0.54f);
colors[ImGuiCol_Header] = ImVec4(0.13f, 0.26f, 0.45f, 0.54f);
colors[ImGuiCol_HeaderHovered] = ImVec4(0.20f, 0.39f, 0.70f, 0.54f);
colors[ImGuiCol_HeaderActive] = ImVec4(0.17f, 0.45f, 0.70f, 0.54f);
colors[ImGuiCol_Separator] = ImVec4(0.17f, 0.45f, 0.70f, 0.50f);
colors[ImGuiCol_SeparatorHovered] = ImVec4(0.17f, 0.45f, 0.70f, 0.50f);
colors[ImGuiCol_SeparatorActive] = ImVec4(0.17f, 0.45f, 0.70f, 0.50f);
colors[ImGuiCol_ResizeGrip] = ImVec4(0.13f, 0.26f, 0.45f, 0.54f);
colors[ImGuiCol_ResizeGripHovered] = ImVec4(0.20f, 0.39f, 0.70f, 0.54f);
colors[ImGuiCol_ResizeGripActive] = ImVec4(0.17f, 0.45f, 0.70f, 0.50f);
colors[ImGuiCol_Tab] = ImVec4(0.13f, 0.26f, 0.45f, 0.54f);
colors[ImGuiCol_TabHovered] = ImVec4(0.20f, 0.39f, 0.70f, 0.54f);
colors[ImGuiCol_TabActive] = ImVec4(0.08f, 0.33f, 0.58f, 1.00f);
colors[ImGuiCol_TabUnfocused] = ImVec4(0.10f, 0.09f, 0.14f, 1.00f);
colors[ImGuiCol_TabUnfocusedActive] = ImVec4(0.13f, 0.26f, 0.45f, 1.00f);
colors[ImGuiCol_PlotLines] = ImVec4(0.38f, 0.38f, 0.38f, 1.00f);
colors[ImGuiCol_PlotLinesHovered] = ImVec4(1.00f, 0.26f, 0.21f, 1.00f);
colors[ImGuiCol_PlotHistogram] = ImVec4(0.56f, 0.32f, 0.00f, 1.00f);
colors[ImGuiCol_PlotHistogramHovered] = ImVec4(1.00f, 0.38f, 0.00f, 1.00f);
colors[ImGuiCol_TableHeaderBg] = ImVec4(0.08f, 0.26f, 0.45f, 1.00f);
colors[ImGuiCol_TableBorderStrong] = ImVec4(0.08f, 0.26f, 0.45f, 1.00f);
colors[ImGuiCol_TableBorderLight] = ImVec4(0.08f, 0.26f, 0.45f, 1.00f);
colors[ImGuiCol_TableRowBg] = ImVec4(0.00f, 0.00f, 0.00f, 0.00f);
colors[ImGuiCol_TableRowBgAlt] = ImVec4(1.00f, 1.00f, 1.00f, 0.06f);
colors[ImGuiCol_TextSelectedBg] = ImVec4(0.15f, 0.35f, 0.60f, 0.35f);
colors[ImGuiCol_DragDropTarget] = ImVec4(1.00f, 1.00f, 0.00f, 0.90f);
colors[ImGuiCol_NavHighlight] = ImVec4(0.15f, 0.35f, 0.60f, 1.00f);
colors[ImGuiCol_NavWindowingHighlight] = ImVec4(1.00f, 1.00f, 1.00f, 0.70f);
colors[ImGuiCol_NavWindowingDimBg] = ImVec4(0.80f, 0.80f, 0.80f, 0.20f);
colors[ImGuiCol_ModalWindowDimBg] = ImVec4(0.80f, 0.80f, 0.80f, 0.35f);
}

void ApplyStyle() {
ImGuiStyle& style = ImGui::GetStyle();
style.WindowBorderSize = 0;
style.WindowPadding = ImVec2(8.00f, 8.00f);
style.FramePadding = ImVec2(4.00f, 4.00f);
style.CellPadding = ImVec2(4.00f, 2.00f);
style.ItemSpacing = ImVec2(4.00f, 4.00f);
style.ItemInnerSpacing = ImVec2(4.00f, 4.00f);
style.TouchExtraPadding = ImVec2(0.00f, 0.00f);
style.IndentSpacing = 21.00f;
style.ScrollbarSize = 16.00f;
style.GrabMinSize = 12.00f;
style.WindowBorderSize = 1.00f;
style.ChildBorderSize = 1.00f;
style.PopupBorderSize = 1.00f;
style.FrameBorderSize = 0.00f;
style.TabBorderSize = 0.00f;
style.WindowRounding = 6.00f;
style.ChildRounding = 6.00f;
style.FrameRounding = 6.00f;
style.PopupRounding = 6.00f;
style.ScrollbarRounding = 6.00f;
style.GrabRounding = 6.00f;
style.LogSliderDeadzone = 6.00f;
style.TabRounding = 6.00f;
style.WindowTitleAlign = ImVec2(0.50f, 0.50f);
style.WindowMenuButtonPosition = 0;
style.ColorButtonPosition = 1;
style.ButtonTextAlign = ImVec2(0.50f, 0.50f);
style.SelectableTextAlign = ImVec2(0.00f, 0.00f);
style.DisplaySafeAreaPadding = ImVec2(3.00f, 3.00f);
}
14 changes: 13 additions & 1 deletion src/console.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@

namespace Console
{
bool console_inited = false;

void Console::Write(string text)
{
freopen("CONOUT$", "w", stdout);
Expand Down Expand Up @@ -42,6 +44,16 @@ namespace Console

void Console::Init()
{
AllocConsole();
if (!console_inited) {
console_inited = true;
AllocConsole();
HWND hwndConsole = GetConsoleWindow();
if (hwndConsole != NULL)
{
EnableMenuItem(GetSystemMenu(hwndConsole, FALSE), SC_CLOSE, MF_BYCOMMAND | MF_DISABLED | MF_GRAYED);
}

}

}
}
1 change: 1 addition & 0 deletions src/console.h
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ using namespace std;

namespace Console
{
extern bool console_inited;
void Write(string text);
void WriteLine(string text);
string Input();
Expand Down
85 changes: 41 additions & 44 deletions src/framerate.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3,67 +3,64 @@
#include "replayEngine.h"
#include "recorder.hpp"


bool keyPressed = false;
bool isFirstPress = true;
std::chrono::steady_clock::time_point lastKeyPressTime;

namespace framerate
{
bool g_disable_render = false;
float g_left_over = 0.f;
bool enabled = true;
bool enabled_fps = true;

void(__thiscall *CCScheduler_update)(CCScheduler *, float);
void __fastcall CCScheduler_update_H(CCScheduler *self, int, float dt)
{
auto pl = gd::GameManager::sharedState()->getPlayLayer();
auto el = gd::GameManager::sharedState()->getEditorLayer();
if (pl || el || recorder.m_recording)
{
if (pl && frameAdvance.enabled && frameAdvance.triggered)
{
float newdt = 1.f / replay.fps_value / 1.f;
CCScheduler_update(self, newdt);
frameAdvance.triggered = false;
return;
}
void __fastcall CCScheduler_update_H(CCScheduler* self, int, float dt) {
const auto play_layer = gd::GameManager::sharedState()->getPlayLayer();
if (enabled && play_layer && (replay.mode == record || replay.mode == play || !play_layer->m_isPaused || recorder.m_recording)) {
dt *= replay.speed_value;

const float target_dt = 1.f / replay.fps_value;

if (enabled_fps)
CCDirector::sharedDirector()->setAnimationInterval(target_dt);

if (!replay.real_time)
return CCScheduler_update(self, target_dt);

if (!frameAdvance.enabled)
{
dt *= replay.speed_value;
const float newdt = 1.f / replay.fps_value / 1.f;
if (!replay.real_time)
return CCScheduler_update(self, newdt);

g_disable_render = false;
if (frameAdvance.enabled) {
if (frameAdvance.triggered) {
frameAdvance.triggered = false;
return CCScheduler_update(self, target_dt);
}
else {
return;
}
}

unsigned times = static_cast<int>((dt + g_left_over) / newdt);
if (dt == 0.f)
return CCScheduler_update(self, newdt);
auto start = std::chrono::high_resolution_clock::now();
for (unsigned i = 0; i < times; ++i) {
CCScheduler_update(self, newdt);
using namespace std::literals;
if (std::chrono::high_resolution_clock::now() - start > 33.333ms) {
times = i + 1;
break;
}
unsigned times = static_cast<int>((dt + g_left_over) / target_dt);
if (dt == 0.f)
return CCScheduler_update(self, target_dt);
auto start = std::chrono::high_resolution_clock::now();
for (unsigned i = 0; i < times; ++i) {
CCScheduler_update(self, target_dt);
using namespace std::literals;
if (std::chrono::high_resolution_clock::now() - start > 33.333ms) {
times = i + 1;
break;
}
g_left_over += dt - newdt * times;
}
g_left_over += dt - target_dt * times;
} else {
CCScheduler_update(self, dt);
}
else
{
return CCScheduler_update(self, dt);
}
}

void(__thiscall *PlayLayer_updateVisibility)(void *);
void __fastcall PlayLayer_updateVisibility_H(void *self)
{
if (!g_disable_render)
PlayLayer_updateVisibility(self);
}

void initHooks()
{
auto cocos = GetModuleHandleA("libcocos2d.dll");
MH_CreateHook((void *)(gd::base + 0x205460), PlayLayer_updateVisibility_H, (void **)&PlayLayer_updateVisibility);
MH_CreateHook(GetProcAddress(cocos, "?update@CCScheduler@cocos2d@@UAEXM@Z"), CCScheduler_update_H, (void **)&CCScheduler_update);
}
}
2 changes: 2 additions & 0 deletions src/framerate.h
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,6 @@
namespace framerate
{
void initHooks();
extern bool enabled;
extern bool enabled_fps;
}
Loading

0 comments on commit 75ceba7

Please sign in to comment.