From 715b98257e672f7397676a75ef1f3bcf3d2e920b Mon Sep 17 00:00:00 2001 From: chad Date: Fri, 5 Jul 2024 20:59:25 +0500 Subject: [PATCH] Fix: wrong offsets --- cheat-library/src/Features/GodMode.cpp | 14 +++--- cheat-library/src/Features/MultiHit.cpp | 46 ++++--------------- cheat-library/src/Features/MultiHit.h | 2 +- cheat-library/src/Menu/Menu.cpp | 4 +- cheat-library/src/dllmain.cpp | 2 +- cheat-library/vendor/PE_Hook/PE_Hook.cpp | 6 ++- cheat-library/vendor/PE_Hook/PE_Hook.hpp | 5 +- cheat-library/vendor/PE_Hook/vmthook.h | 28 ----------- .../vendor/UnrealEngine/SDK/Basic.hpp | 12 ++--- 9 files changed, 34 insertions(+), 85 deletions(-) diff --git a/cheat-library/src/Features/GodMode.cpp b/cheat-library/src/Features/GodMode.cpp index c58729c..df66ec4 100644 --- a/cheat-library/src/Features/GodMode.cpp +++ b/cheat-library/src/Features/GodMode.cpp @@ -2,13 +2,13 @@ void GodMode::DrawMenuItems() { - ImGui::Checkbox("God Mode", &bGodMode); - - if (bGodMode) { - ImGui::BeginChild(1, ImVec2(0, 100), true); - ImGui::SliderInt("## DMG", &iDmgTest, -10000, 10000); - ImGui::EndChild(); - } + //ImGui::Checkbox("God Mode", &bGodMode); + // + //if (bGodMode) { + // ImGui::BeginChild(1, ImVec2(0, 100), true); + // ImGui::SliderInt("## DMG", &iDmgTest, -10000, 10000); + // ImGui::EndChild(); + //} } void GodMode::Run(void** args, size_t numArgs) diff --git a/cheat-library/src/Features/MultiHit.cpp b/cheat-library/src/Features/MultiHit.cpp index 628e1d0..ccc4de0 100644 --- a/cheat-library/src/Features/MultiHit.cpp +++ b/cheat-library/src/Features/MultiHit.cpp @@ -1,37 +1,29 @@ #include "MultiHit.h" #include "PE_Hook/vmthook.h" -#define HOOK_INDEX 0x49 using ProcessEvent = void(__thiscall*)(UObject*, UFunction*, void*); static ProcessEvent ProcessEventOriginal = nullptr; void __stdcall ProcessEventHooked(UObject* object, UFunction* function, void* parms) { - printf("ProcessEvent Function Called\n"); + printf("ProcessEvent Function Called: %s\n", function->GetName()); ProcessEventOriginal(object, function, parms); - - return ProcessEventOriginal(object, function, parms); } -UGameViewportClient* getViewport(UWorld* world) noexcept { - return world->OwningGameInstance->LocalPlayers[0]->ViewportClient; -} -void HitMultiplier::DrawMenuItems() -{ - ImGui::Checkbox("Multi Hit", &bEnable); - if (bEnable) { - ImGui::BeginChild(2, ImVec2(0,100), 1); - ImGui::Text("Hit multiplier"); - ImGui::SliderInt("##Hit multiplier", &iCurrent, iMin, iMax); - ImGui::EndChild(); - } +void HitMultiplier::DrawMenuItems() { + ImGui::Checkbox("Multi Hit", &bEnable); + if (bEnable) { + ImGui::BeginChild(2, ImVec2(0, 100), 1); + ImGui::Text("Hit multiplier"); + ImGui::SliderInt("##Hit multiplier", &iCurrent, iMin, iMax); + ImGui::EndChild(); + } } -std::unique_ptr g_processEventHook; void HitMultiplier::Run(void** args, size_t numArgs) { if (!Initalized || numArgs != 1) { @@ -42,25 +34,5 @@ void HitMultiplier::Run(void** args, size_t numArgs) { APawn* Pawn = (APawn*)args[0]; UWorld* World = (UWorld*)args[1]; - if (bEnable) { - UGameViewportClient* viewport = getViewport(World); - UObject* VTableClass = viewport->FindObject("Function TsAnimNotifyReSkillEvent.TsAnimNotifyReSkillEvent_C.K2_Notify"); - - if (!g_processEventHook) { - g_processEventHook = std::make_unique(VTableClass); - ProcessEventOriginal = reinterpret_cast( - g_processEventHook->HookMethod(reinterpret_cast(&ProcessEventHooked), HOOK_INDEX) - ); - - printf("Hook created successfully. o: [0x%p]\n", ProcessEventOriginal); - } - } - else - { - if (g_processEventHook) { - g_processEventHook->RestoreTable(); - g_processEventHook.reset(); - } - } } diff --git a/cheat-library/src/Features/MultiHit.h b/cheat-library/src/Features/MultiHit.h index 564eaf8..11ab478 100644 --- a/cheat-library/src/Features/MultiHit.h +++ b/cheat-library/src/Features/MultiHit.h @@ -10,9 +10,9 @@ class HitMultiplier : Feature int iMax = 100; int iMin = 1; int iCurrent = 10; - bool bHooked = false; private: + bool bHooked = false; public: HitMultiplier() {}; diff --git a/cheat-library/src/Menu/Menu.cpp b/cheat-library/src/Menu/Menu.cpp index 01a8ca8..ca12687 100644 --- a/cheat-library/src/Menu/Menu.cpp +++ b/cheat-library/src/Menu/Menu.cpp @@ -218,13 +218,13 @@ void Menu::RenderMenu() switch (tab) { case PLAYER: - god.DrawMenuItems(); + //god.DrawMenuItems(); speedhack.DrawMenuItems(); fly.DrawMenuItems(); gravityScale.DrawMenuItems(); walkFloorZ.DrawMenuItems(); walkFloorAngle.DrawMenuItems(); - hitMultiplier.DrawMenuItems(); + //hitMultiplier.DrawMenuItems(); break; diff --git a/cheat-library/src/dllmain.cpp b/cheat-library/src/dllmain.cpp index 55bc804..3a21017 100644 --- a/cheat-library/src/dllmain.cpp +++ b/cheat-library/src/dllmain.cpp @@ -217,7 +217,7 @@ DWORD WINAPI FeaturesThread(LPVOID lpReserved) void* flyArgs[2] = { AcknowledgedPawn, MoveComponent }; fly.Run(flyArgs, 1);; - std::this_thread::sleep_for(std::chrono::milliseconds(100)); + std::this_thread::sleep_for(std::chrono::milliseconds(10)); } return TRUE; diff --git a/cheat-library/vendor/PE_Hook/PE_Hook.cpp b/cheat-library/vendor/PE_Hook/PE_Hook.cpp index 86a5799..1d01219 100644 --- a/cheat-library/vendor/PE_Hook/PE_Hook.cpp +++ b/cheat-library/vendor/PE_Hook/PE_Hook.cpp @@ -1,4 +1,5 @@ #include "PE_Hook.hpp" +#include "SDK/Basic.hpp" using namespace Hook; @@ -52,7 +53,7 @@ int ProcessEventHook::FindProcessEventIndex() if (!ValidPtr((void*)function)) continue; - if (function == (module_base + ProcessEventOffset)) + if (function == (module_base + SDK::Offsets::ProcessEvent)) { return index; } @@ -106,3 +107,6 @@ void ProcessEventHook::ApplyHook(std::uintptr_t pClass, std::uintptr_t pOrgFunc, } } +bool ProcessEventHook::IsHooked() const { + return m_class != 0; +} \ No newline at end of file diff --git a/cheat-library/vendor/PE_Hook/PE_Hook.hpp b/cheat-library/vendor/PE_Hook/PE_Hook.hpp index 8d3e24c..8acb89d 100644 --- a/cheat-library/vendor/PE_Hook/PE_Hook.hpp +++ b/cheat-library/vendor/PE_Hook/PE_Hook.hpp @@ -6,8 +6,6 @@ namespace Hook { -#define ProcessEventOffset 0x274FB70 - template inline auto ValidPtr(T ptr) -> bool { return (ptr && ptr > (T)0xFFFFFF && ptr < (T)0x7FFFFFFFFFFF); @@ -58,6 +56,9 @@ namespace Hook ~ProcessEventHook() { this->FreeVTableCache(); } + bool IsHooked() const; + int GetEventIndex() const { return m_eventindex; } + private: int m_eventindex; }; diff --git a/cheat-library/vendor/PE_Hook/vmthook.h b/cheat-library/vendor/PE_Hook/vmthook.h index eb7b471..35865d5 100644 --- a/cheat-library/vendor/PE_Hook/vmthook.h +++ b/cheat-library/vendor/PE_Hook/vmthook.h @@ -1,33 +1,5 @@ #pragma once // Source - https://github.com/tanduRE/VMTHook/blob/master/vmthook.h -/* - * - * - MIT License - - Copyright (c) 2018 tanduRE - - Permission is hereby granted, free of charge, to any person obtaining a copy - of this software and associated documentation files (the "Software"), to deal - in the Software without restriction, including without limitation the rights - to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - copies of the Software, and to permit persons to whom the Software is - furnished to do so, subject to the following conditions: - - The above copyright notice and this permission notice shall be included in all - copies or substantial portions of the Software. - - THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - SOFTWARE. - * - * - */ - #include #include diff --git a/cheat-library/vendor/UnrealEngine/SDK/Basic.hpp b/cheat-library/vendor/UnrealEngine/SDK/Basic.hpp index d6d40da..d8dd6ff 100644 --- a/cheat-library/vendor/UnrealEngine/SDK/Basic.hpp +++ b/cheat-library/vendor/UnrealEngine/SDK/Basic.hpp @@ -31,12 +31,12 @@ using namespace UC; */ namespace Offsets { - constexpr int32 GObjects = 0x07CFE4E8; - constexpr int32 AppendString = 0x02348990; - constexpr int32 GNames = 0x07CC5A00; - constexpr int32 GWorld = 0x07BDCD50; - constexpr int32 ProcessEvent = 0x0254B460; - constexpr int32 ProcessEventIdx = 0x00000049; + constexpr int32 GObjects = 0x07E8C2A8; + constexpr int32 AppendString = 0x02421AF0; + constexpr int32 GNames = 0x07E537C0; + constexpr int32 GWorld = 0x080C0610; + constexpr int32 ProcessEvent = 0x02625440; + constexpr int32 ProcessEventIdx = 0x00000049; } namespace InSDKUtils