This commit is contained in:
Oscar
2025-07-17 13:52:06 +03:00
commit 2f50c8a911
206 changed files with 246874 additions and 0 deletions

View File

@@ -0,0 +1,56 @@
#include "hooks.h"
#include <iostream>
#include "../../../external/kiero/minhook/include/MinHook.h"
#include "../../templeware/utils/memory/Interface/Interface.h"
#include "../utils/memory/patternscan/patternscan.h"
#include "../utils/memory/gaa/gaa.h"
#include "../players/hook/playerHook.h"
#include "../features/visuals/visuals.h"
#include "../features/chams/chams.h"
#include "../../cs2/datatypes/cutlbuffer/cutlbuffer.h"
#include "../../cs2/datatypes/keyvalues/keyvalues.h"
#include "../../cs2/entity/C_Material/C_Material.h"
#include "../config/config.h"
#include "../interfaces/interfaces.h"
#include "../features/aim/aim.h"
void __fastcall H::hkFrameStageNotify(void* a1, int stage)
{
FrameStageNotify.GetOriginal()(a1, stage);
// frame_render_stage | 9
if (stage == 9 && oGetLocalPlayer(0)) {
Esp::cache();
Aimbot();
}
}
void* __fastcall H::hkLevelInit(void* pClientModeShared, const char* szNewMap) {
static void* g_pPVS = (void*)M::getAbsoluteAddress(M::patternScan("engine2", "48 8D 0D ? ? ? ? 33 D2 FF 50"), 0x3);
M::vfunc<void*, 6U, void>(g_pPVS, false);
return LevelInit.GetOriginal()(pClientModeShared, szNewMap);
}
void H::Hooks::init() {
oGetWeaponData = *reinterpret_cast<int*>(M::patternScan("client", ("48 8B 81 ? ? ? ? 85 D2 78 ? 48 83 FA ? 73 ? F3 0F 10 84 90 ? ? ? ? C3 F3 0F 10 80 ? ? ? ? C3 CC CC CC CC")) + 0x3);
ogGetBaseEntity = reinterpret_cast<decltype(ogGetBaseEntity)>(M::patternScan("client", ("81 FA ? ? ? ? 77 ? 8B C2 C1 F8 ? 83 F8 ? 77 ? 48 98 48 8B 4C C1 ? 48 85 C9 74 ? 8B C2 25 ? ? ? ? 48 6B C0 ? 48 03 C8 74 ? 8B 41 ? 25 ? ? ? ? 3B C2 75 ? 48 8B 01")));
oGetLocalPlayer = reinterpret_cast<decltype(oGetLocalPlayer)>(M::patternScan("client", ("48 83 EC 28 83 F9 FF 75 17 48 8B 0D ?? ?? ?? ?? 48 8D 54 24 30 48 8B 01 FF 90 ?? ?? ?? ?? 8B 08 48 63 C1 48 8D 0D ?? ?? ?? ?? 48 8B 0C")));
UpdateWallsObject.Add((void*)M::patternScan("scenesystem", ("48 89 5C 24 10 48 89 6C 24 18 56 57 41 54 41 56 41 57 48 83 EC 40")), &hkUpdateSceneObject);
FrameStageNotify.Add((void*)M::patternScan("client", ("48 89 5C 24 ? 56 48 83 EC 30 8B 05 ? ? ? ?")), &hkFrameStageNotify);
DrawArray.Add((void*)M::patternScan("scenesystem", ("48 8B C4 48 89 50 10 53 41 55 41 56 48 81 EC ? ? ? ? 4D 63 F1")), &chams::hook);
GetRenderFov.Add((void*)M::getAbsoluteAddress(M::patternScan("client", "E8 ? ? ? ? F3 0F 11 45 00 48 8B 5C 24 40"), 1), &hkGetRenderFov);
LevelInit.Add((void*)M::getAbsoluteAddress(M::patternScan("client", "E8 ? ? ? ? C6 83 ? ? ? ? ? C6 83"), 1), &hkLevelInit);
RenderFlashBangOverlay.Add((void*)M::patternScan("client", ("85 D2 0F 88 ? ? ? ? 55 56 41 55")), &hkRenderFlashbangOverlay);
MH_EnableHook(MH_ALL_HOOKS);
}

View File

@@ -0,0 +1,38 @@
#pragma once
#include "includeHooks.h"
#include "../../cs2/entity/C_AggregateSceneObject/C_AggregateSceneObject.h"
#include "../../cs2/entity/C_CSPlayerPawn/C_CSPlayerPawn.h"
#include "../../cs2/datatypes/cutlbuffer/cutlbuffer.h"
#include "../../cs2/datatypes/keyvalues/keyvalues.h"
#include "../../cs2/entity/C_Material/C_Material.h"
// Forward declaration
class CMeshData;
class CEntityIdentity;
namespace H {
void* __fastcall hkUpdateSceneObject(C_AggregateSceneObject* object, void* unk);
void __fastcall hkFrameStageNotify(void* a1, int stage);
void* __fastcall hkLevelInit(void* pClientModeShared, const char* szNewMap);
void __fastcall hkChamsObject(void* pAnimatableSceneObjectDesc, void* pDx11, CMeshData* arrMeshDraw, int nDataCount, void* pSceneView, void* pSceneLayer, void* pUnk, void* pUnk2);
void __fastcall hkRenderFlashbangOverlay(void* a1, void* a2, void* a3, void* a4, void* a5);
inline float g_flActiveFov;
float hkGetRenderFov(void* rcx);
inline CInlineHookObj<decltype(&hkChamsObject)> DrawArray = { };
inline CInlineHookObj<decltype(&hkFrameStageNotify)> FrameStageNotify = { };
inline CInlineHookObj<decltype(&hkUpdateSceneObject)> UpdateWallsObject = { };
inline CInlineHookObj<decltype(&hkGetRenderFov)> GetRenderFov = { };
inline CInlineHookObj<decltype(&hkLevelInit)> LevelInit = { };
inline CInlineHookObj<decltype(&hkRenderFlashbangOverlay)> RenderFlashBangOverlay = { };
// inline hooks
inline int oGetWeaponData;
inline void* (__fastcall* ogGetBaseEntity)(void*, int);
inline C_CSPlayerPawn* (__fastcall* oGetLocalPlayer)(int);
class Hooks {
public:
void init();
};
}

View File

@@ -0,0 +1,108 @@
#pragma once
#include "../../../external/kiero/minhook/include/MinHook.h"
#include <cstdint>
// @source: popular github minhook instance
template <typename T>
class CInlineHookObj
{
public:
/// setup hook and replace function
/// @returns: true if hook has been successfully created, false otherwise
bool Add(void* pFunction, void* pDetour)
{
if (pFunction == nullptr || pDetour == nullptr)
return false;
pBaseFn = pFunction;
pReplaceFn = pDetour;
if (const MH_STATUS status = MH_CreateHook(pBaseFn, pReplaceFn, &pOriginalFn); status != MH_OK)
{
return false;
}
if (!Replace())
return false;
return true;
}
/// patch memory to jump to our function instead of original
/// @returns: true if hook has been successfully applied, false otherwise
bool Replace()
{
// check is hook has been created
if (pBaseFn == nullptr)
return false;
// check that function isn't already hooked
if (bIsHooked)
return false;
if (const MH_STATUS status = MH_EnableHook(pBaseFn); status != MH_OK)
{
return false;
}
// switch hook state
bIsHooked = true;
return true;
}
/// restore original function call and cleanup hook data
/// @returns: true if hook has been successfully removed, false otherwise
bool Remove()
{
// restore it at first
if (!Restore())
return false;
if (const MH_STATUS status = MH_RemoveHook(pBaseFn); status != MH_OK)
{
return false;
}
return true;
}
/// restore patched memory to original function call
/// @returns: true if hook has been successfully restored, false otherwise
bool Restore()
{
// check that function is hooked
if (!bIsHooked)
return false;
if (const MH_STATUS status = MH_DisableHook(pBaseFn); status != MH_OK)
{
return false;
}
// switch hook state
bIsHooked = false;
return true;
}
/// @returns: original, unwrapped function that would be called without the hook
inline T GetOriginal()
{
return reinterpret_cast<T>(pOriginalFn);
}
/// @returns: true if hook is applied at the time, false otherwise
inline bool IsHooked() const
{
return bIsHooked;
}
private:
// current hook state
bool bIsHooked = false;
// function base handle
void* pBaseFn = nullptr;
// function that being replace the original call
void* pReplaceFn = nullptr;
// original function
void* pOriginalFn = nullptr;
};