Skip to content

Commit

Permalink
Fix: wrong offsets
Browse files Browse the repository at this point in the history
  • Loading branch information
chadlrnsn committed Jul 5, 2024
1 parent af7c3c7 commit 715b982
Show file tree
Hide file tree
Showing 9 changed files with 34 additions and 85 deletions.
14 changes: 7 additions & 7 deletions cheat-library/src/Features/GodMode.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
46 changes: 9 additions & 37 deletions cheat-library/src/Features/MultiHit.cpp
Original file line number Diff line number Diff line change
@@ -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<CVMTHook> g_processEventHook;

void HitMultiplier::Run(void** args, size_t numArgs) {
if (!Initalized || numArgs != 1) {
Expand All @@ -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<CVMTHook>(VTableClass);
ProcessEventOriginal = reinterpret_cast<ProcessEvent>(
g_processEventHook->HookMethod(reinterpret_cast<void*>(&ProcessEventHooked), HOOK_INDEX)
);


printf("Hook created successfully. o: [0x%p]\n", ProcessEventOriginal);
}
}
else
{
if (g_processEventHook) {
g_processEventHook->RestoreTable();
g_processEventHook.reset();
}
}
}
2 changes: 1 addition & 1 deletion cheat-library/src/Features/MultiHit.h
Original file line number Diff line number Diff line change
Expand Up @@ -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() {};
Expand Down
4 changes: 2 additions & 2 deletions cheat-library/src/Menu/Menu.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand Down
2 changes: 1 addition & 1 deletion cheat-library/src/dllmain.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
6 changes: 5 additions & 1 deletion cheat-library/vendor/PE_Hook/PE_Hook.cpp
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
#include "PE_Hook.hpp"
#include "SDK/Basic.hpp"

using namespace Hook;

Expand Down Expand Up @@ -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;
}
Expand Down Expand Up @@ -106,3 +107,6 @@ void ProcessEventHook::ApplyHook(std::uintptr_t pClass, std::uintptr_t pOrgFunc,
}
}

bool ProcessEventHook::IsHooked() const {
return m_class != 0;
}
5 changes: 3 additions & 2 deletions cheat-library/vendor/PE_Hook/PE_Hook.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,6 @@

namespace Hook
{
#define ProcessEventOffset 0x274FB70

template <typename T = void*>
inline auto ValidPtr(T ptr) -> bool {
return (ptr && ptr > (T)0xFFFFFF && ptr < (T)0x7FFFFFFFFFFF);
Expand Down Expand Up @@ -58,6 +56,9 @@ namespace Hook

~ProcessEventHook() { this->FreeVTableCache(); }

bool IsHooked() const;
int GetEventIndex() const { return m_eventindex; }

private:
int m_eventindex;
};
Expand Down
28 changes: 0 additions & 28 deletions cheat-library/vendor/PE_Hook/vmthook.h
Original file line number Diff line number Diff line change
@@ -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 <cstdint>
#include <memory>
Expand Down
12 changes: 6 additions & 6 deletions cheat-library/vendor/UnrealEngine/SDK/Basic.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 715b982

Please sign in to comment.