moved hooks
This commit is contained in:
parent
dcacfd9241
commit
357af6b76b
@ -92,7 +92,7 @@
|
||||
</folderInfo>
|
||||
<sourceEntries>
|
||||
<entry excluding="autogen|vtables|segvcatch|gui|copypasted|targeting|ipc|mem|hooks|sdk|src" flags="VALUE_WORKSPACE_PATH|RESOLVED" kind="sourcePath" name=""/>
|
||||
<entry excluding="autogen|vtables|segvcatch|gui|hooks|targeting|ipc|mem" flags="VALUE_WORKSPACE_PATH|RESOLVED" kind="sourcePath" name="src"/>
|
||||
<entry excluding="autogen|vtables|segvcatch|gui|targeting|ipc|mem" flags="VALUE_WORKSPACE_PATH|RESOLVED" kind="sourcePath" name="src"/>
|
||||
<entry flags="VALUE_WORKSPACE_PATH|RESOLVED" kind="sourcePath" name="src/autogen"/>
|
||||
<entry flags="VALUE_WORKSPACE_PATH|RESOLVED" kind="sourcePath" name="src/gui"/>
|
||||
<entry flags="VALUE_WORKSPACE_PATH|RESOLVED" kind="sourcePath" name="src/ipc"/>
|
||||
|
@ -8,7 +8,7 @@ TF2 path detection
|
||||
remove debug logs
|
||||
FIX crash
|
||||
FIX conds
|
||||
|
||||
Player List
|
||||
|
||||
MAX -> MIN priority
|
||||
Crit Hack
|
||||
|
@ -63,9 +63,11 @@
|
||||
|
||||
#define NO_DEVIGNORE true
|
||||
#define DEBUG_SEGV true
|
||||
#define NO_IPC true
|
||||
|
||||
#if DEBUG_SEGV == true
|
||||
|
||||
|
||||
#define SEGV_BEGIN \
|
||||
try {
|
||||
|
||||
|
@ -62,7 +62,6 @@ Elf32_Shdr *getSectionHeader(void *module, const char *sectionName)
|
||||
|
||||
uintptr_t CSignature::dwFindPattern(uintptr_t dwAddress, uintptr_t dwLength, const char* szPattern)
|
||||
{
|
||||
logging::Info("Seaching for pattern from 0x%08x, len 0x%08x", dwAddress, dwLength);
|
||||
const char* pat = szPattern;
|
||||
uintptr_t firstMatch = NULL;
|
||||
for (uintptr_t pCur = dwAddress; pCur < dwLength; pCur++)
|
||||
|
@ -23,7 +23,6 @@ void netvar_tree::init()
|
||||
auto *recv_table = client_class->m_pRecvTable;
|
||||
populate_nodes(recv_table, &class_info->nodes);
|
||||
nodes.emplace(recv_table->GetName(), class_info);
|
||||
//logging::Info("put %s", recv_table->GetName());
|
||||
client_class = client_class->m_pNext;
|
||||
}
|
||||
}
|
||||
|
@ -110,7 +110,7 @@ public:
|
||||
{
|
||||
const auto &node = nodes[name];
|
||||
if (node == 0) {
|
||||
logging::Info("Confused: %s", name);
|
||||
logging::Info("Invalid NetVar node: %s", name);
|
||||
return 0;
|
||||
}
|
||||
return get_offset_recursive(node->nodes, node->offset, args...);
|
||||
|
@ -15,7 +15,6 @@ CatEnum::CatEnum(const char** values, int size, int min) {
|
||||
m_iMin = min;
|
||||
m_iMax = min + size - 1;
|
||||
m_iLength = size;
|
||||
logging::Info("Created enum with size %i", size);
|
||||
}
|
||||
|
||||
const char* CatEnum::Name(int value) {
|
||||
|
@ -25,12 +25,10 @@ void GUI::AddList(GUI_List* list) {
|
||||
}
|
||||
|
||||
void GUI::PushList(const char* id) {
|
||||
logging::Info("Pushing list %s", id);
|
||||
if (m_nStackSize == LISTS_MAX - 1) return;
|
||||
for (int i = 0; i < m_nListCount; i++) {
|
||||
GUI_List* list = m_Lists[i];
|
||||
if (strcmp(list->m_pszListID, id) == 0) {
|
||||
logging::Info("Found!");
|
||||
m_ListStack[m_nStackSize] = list;
|
||||
m_nStackSize++;
|
||||
return;
|
||||
|
@ -50,6 +50,8 @@
|
||||
#include "gui/controls.h"
|
||||
#include "cvwrapper.h"
|
||||
|
||||
#include "hooks/hookedmethods.h"
|
||||
|
||||
#include "sdk.h"
|
||||
#include "vfunc.h"
|
||||
#include "copypasted/CSignature.h"
|
||||
@ -61,345 +63,6 @@
|
||||
* Credits to josh33901 aka F1ssi0N for butifel F1Public and Darkstorm 2015 Linux
|
||||
*/
|
||||
|
||||
typedef void(PaintTraverse_t)(void*, unsigned int, bool, bool);
|
||||
typedef bool(CreateMove_t)(void*, float, CUserCmd*);
|
||||
typedef void(OverrideView_t)(void*, CViewSetup*);
|
||||
typedef void(FrameStageNotify_t)(void*, int);
|
||||
typedef bool(DispatchUserMessage_t)(void*, int, bf_read&);
|
||||
|
||||
Vector last_angles(0.0f, 0.0f, 0.0f);
|
||||
|
||||
void hack::Hk_OverrideView(void* thisptr, CViewSetup* setup) {
|
||||
SEGV_BEGIN;
|
||||
((OverrideView_t*)hooks::hkClientMode->GetMethod(hooks::offOverrideView))(thisptr, setup);
|
||||
if (!g_Settings.bHackEnabled->GetBool()) return;
|
||||
if (g_Settings.flForceFOV && g_Settings.flForceFOV->GetBool()) {
|
||||
setup->fov = g_Settings.flForceFOV->GetFloat();
|
||||
}
|
||||
SEGV_END;
|
||||
}
|
||||
|
||||
void hack::Hk_PaintTraverse(void* p, unsigned int vp, bool fr, bool ar) {
|
||||
if (!segvcatch::handler_fpe || !segvcatch::handler_segv) {
|
||||
segvcatch::init_segv();
|
||||
segvcatch::init_fpe();
|
||||
logging::Info("segvcatch init!");
|
||||
}
|
||||
|
||||
SEGV_BEGIN;
|
||||
SAFE_CALL(((PaintTraverse_t*)hooks::hkPanel->GetMethod(hooks::offPaintTraverse))(p, vp, fr, ar));
|
||||
if (!g_Settings.bHackEnabled->GetBool()) return;
|
||||
// Because of single-multi thread shit I'm gonna put this thing riiiight here.
|
||||
if (g_phFollowBot->v_bEnabled->GetBool()) {
|
||||
ipc_client_seg* seg_g = g_phFollowBot->m_pIPC->GetClientSegment(0);
|
||||
ipc_client_seg* seg_l = g_phFollowBot->m_pIPC->GetClientSegment(g_phFollowBot->m_pIPC->client_id);
|
||||
|
||||
if (seg_g == 0) {
|
||||
logging::Info("!!! seg_g == 0 !!!");
|
||||
}
|
||||
if (seg_l == 0) {
|
||||
logging::Info("!!! seg_l == 0 !!!");
|
||||
}
|
||||
|
||||
if (seg_g && seg_g->command_number > g_phFollowBot->last_command_global) {
|
||||
logging::Info("Executing `%s`", seg_g->command_buffer);
|
||||
if (g_phFollowBot->last_command_global) interfaces::engineClient->ExecuteClientCmd(seg_g->command_buffer);
|
||||
g_phFollowBot->last_command_global = seg_g->command_number;
|
||||
}
|
||||
if (seg_l && seg_l->command_number > g_phFollowBot->last_command_local) {
|
||||
logging::Info("Executing `%s`", seg_l->command_buffer);
|
||||
if (g_phFollowBot->last_command_local) interfaces::engineClient->ExecuteClientCmd(seg_l->command_buffer);
|
||||
g_phFollowBot->last_command_local = seg_l->command_number;
|
||||
}
|
||||
}
|
||||
|
||||
if (g_Settings.bNoVisuals->GetBool()) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (!draw::width || !draw::height) {
|
||||
interfaces::engineClient->GetScreenSize(draw::width, draw::height);
|
||||
}
|
||||
if (!draw::panel_top) {
|
||||
const char* name = interfaces::panel->GetName(vp);
|
||||
if (strlen(name) > 4) {
|
||||
if (name[0] == 'M' && name[3] == 'S') {
|
||||
draw::panel_top = vp;
|
||||
logging::Info("Got top panel: %i", vp);
|
||||
}
|
||||
}
|
||||
}
|
||||
if (!interfaces::engineClient->IsInGame()) {
|
||||
g_Settings.bInvalid = true;
|
||||
}
|
||||
if (g_Settings.bInvalid) {
|
||||
return;
|
||||
}
|
||||
if (CE_BAD(g_pLocalPlayer->entity)) {
|
||||
return;
|
||||
}
|
||||
if (draw::panel_top == vp) {
|
||||
ResetStrings();
|
||||
if (g_Settings.bShowLogo->GetBool()) {
|
||||
AddSideString(colors::green, colors::black, "cathook by d4rkc4t");
|
||||
#if _DEVELOPER
|
||||
AddSideString(colors::red, colors::black, "DEVELOPER BUILD");
|
||||
#else
|
||||
AddSideString(colors::orange, colors::black, "Early Access: " __DRM_NAME);
|
||||
#endif
|
||||
AddSideString(colors::green, colors::black, "version: " CATHOOK_VERSION_MAJOR "." CATHOOK_VERSION_MINOR "." CATHOOK_VERSION_PATCH);
|
||||
}
|
||||
|
||||
//SAFE_CALL(PAINT_TRAVERSE(AutoStrafe));
|
||||
//SAFE_CALL(PAINT_TRAVERSE(AntiAim));
|
||||
SAFE_CALL(PAINT_TRAVERSE(AntiDisguise));
|
||||
//SAFE_CALL(PAINT_TRAVERSE(AutoReflect));
|
||||
//SAFE_CALL(PAINT_TRAVERSE(FollowBot));
|
||||
SAFE_CALL(PAINT_TRAVERSE(Misc));
|
||||
//SAFE_CALL(PAINT_TRAVERSE(Aimbot));
|
||||
//SAFE_CALL(PAINT_TRAVERSE(Bunnyhop));
|
||||
SAFE_CALL(PAINT_TRAVERSE(ESP));
|
||||
//SAFE_CALL(PAINT_TRAVERSE(Triggerbot));
|
||||
//SAFE_CALL(PAINT_TRAVERSE(AutoSticky));
|
||||
//SAFE_CALL(PAINT_TRAVERSE(Airstuck));
|
||||
//SAFE_CALL(PAINT_TRAVERSE(AutoHeal));
|
||||
//SAFE_CALL(PAINT_TRAVERSE(HuntsmanCompensation));
|
||||
SAFE_CALL(PAINT_TRAVERSE(SpyAlert));
|
||||
Vector screen;
|
||||
for (int i = 0; i < HIGHEST_ENTITY; i++) {
|
||||
CachedEntity* ce = gEntityCache.GetEntity(i);
|
||||
if (CE_BAD(ce)) continue;
|
||||
if (ce->m_ESPOrigin.IsZero(1.0f))
|
||||
if (!draw::EntityCenterToScreen(ce, screen)) continue;
|
||||
for (int j = 0; j < ce->m_nESPStrings; j++) {
|
||||
ESPStringCompound str = ce->GetESPString(j);
|
||||
//logging::Info("drawing [idx=%i][ns=%i] %s", i, ce->m_nESPStrings, str.m_String);
|
||||
if (!ce->m_ESPOrigin.IsZero(1.0)) {
|
||||
draw::DrawString(ce->m_ESPOrigin.x, ce->m_ESPOrigin.y, str.m_Color, str.m_Background, false, str.m_String);
|
||||
ce->m_ESPOrigin.y += 11;
|
||||
} else {
|
||||
draw::DrawString(screen.x, screen.y, str.m_Color, str.m_Background, true, str.m_String);
|
||||
screen.y += 11;
|
||||
}
|
||||
}
|
||||
}
|
||||
#if GUI_ENABLED == true
|
||||
g_pGUI->UpdateKeys();
|
||||
g_pGUI->Draw();
|
||||
#endif
|
||||
DrawStrings();
|
||||
}
|
||||
SEGV_END;
|
||||
}
|
||||
|
||||
typedef bool(CanPacket_t)(void* thisptr);
|
||||
bool Hk_CanPacket(void* thisptr) {
|
||||
SEGV_BEGIN;
|
||||
return g_Settings.bSendPackets->GetBool() && ((CanPacket_t*)hooks::hkNetChannel->GetMethod(hooks::offCanPacket))(thisptr);
|
||||
SEGV_END;
|
||||
return false;
|
||||
}
|
||||
|
||||
typedef int(IN_KeyEvent_t)(void* thisptr, int eventcode, ButtonCode_t keynum, const char* pszCurrentBinding);
|
||||
int Hk_IN_KeyEvent(void* thisptr, int eventcode, ButtonCode_t keynum, const char* pszCurrentBinding) {
|
||||
SEGV_BEGIN;
|
||||
if (eventcode == 1) {
|
||||
if (g_pGUI->KeyEvent(keynum)) return 1;
|
||||
}
|
||||
return ((IN_KeyEvent_t*)hooks::hkClient->GetMethod(hooks::offKeyEvent))(thisptr, eventcode, keynum, pszCurrentBinding);
|
||||
SEGV_END;
|
||||
return 0;
|
||||
}
|
||||
|
||||
typedef bool(SendNetMsg_t)(void* thisptr, INetMessage& msg, bool forcereliable, bool voice);
|
||||
bool Hk_SendNetMsg(void* thisptr, INetMessage& msg, bool bForceReliable = false, bool bVoice = false) {
|
||||
SEGV_BEGIN;
|
||||
|
||||
//logging::Info("Sending NetMsg! %i", msg.GetType());
|
||||
if (g_phAirstuck->v_bStuck->GetBool() && g_Settings.bHackEnabled->GetBool()) {
|
||||
switch (msg.GetType()) {
|
||||
case net_NOP:
|
||||
case net_SignonState:
|
||||
case net_StringCmd:
|
||||
break;
|
||||
default:
|
||||
return false;
|
||||
}
|
||||
}
|
||||
return ((SendNetMsg_t*)hooks::hkNetChannel->GetMethod(hooks::offSendNetMsg))(thisptr, msg, bForceReliable, bVoice);
|
||||
SEGV_END;
|
||||
return false;
|
||||
}
|
||||
|
||||
typedef void(Shutdown_t)(void*, const char*);
|
||||
void Hk_Shutdown(void* thisptr, const char* reason) {
|
||||
SEGV_BEGIN;
|
||||
if (g_Settings.bHackEnabled->GetBool()) {
|
||||
const char* new_reason = reason;
|
||||
if (g_Settings.sDisconnectMsg->m_StringLength > 3) {
|
||||
new_reason = g_Settings.sDisconnectMsg->GetString();
|
||||
}
|
||||
((Shutdown_t*)hooks::hkNetChannel->GetMethod(hooks::offShutdown))(thisptr, new_reason);
|
||||
} else {
|
||||
((Shutdown_t*)hooks::hkNetChannel->GetMethod(hooks::offShutdown))(thisptr, reason);
|
||||
}
|
||||
SEGV_END;
|
||||
}
|
||||
|
||||
bool hack::Hk_CreateMove(void* thisptr, float inputSample, CUserCmd* cmd) {
|
||||
SEGV_BEGIN;
|
||||
|
||||
bool ret = ((CreateMove_t*)hooks::hkClientMode->GetMethod(hooks::offCreateMove))(thisptr, inputSample, cmd);
|
||||
|
||||
if (!cmd) {
|
||||
return ret;
|
||||
}
|
||||
|
||||
if (!g_Settings.bHackEnabled->GetBool()) {
|
||||
return ret;
|
||||
}
|
||||
|
||||
if (!interfaces::engineClient->IsInGame()) {
|
||||
g_Settings.bInvalid = true;
|
||||
return true;
|
||||
}
|
||||
|
||||
PROF_BEGIN();
|
||||
|
||||
INetChannel* ch = (INetChannel*)interfaces::engineClient->GetNetChannelInfo();
|
||||
if (ch && !hooks::IsHooked((void*)((uintptr_t)ch))) {
|
||||
logging::Info("Hooking INetChannel!");
|
||||
hooks::hkNetChannel = new hooks::VMTHook();
|
||||
hooks::hkNetChannel->Init(ch, 0);
|
||||
hooks::hkNetChannel->HookMethod((void*)Hk_CanPacket, hooks::offCanPacket);
|
||||
hooks::hkNetChannel->HookMethod((void*)Hk_SendNetMsg, hooks::offSendNetMsg);
|
||||
hooks::hkNetChannel->HookMethod((void*)Hk_Shutdown, hooks::offShutdown);
|
||||
hooks::hkNetChannel->Apply();
|
||||
logging::Info("NetChannel Hooked!");
|
||||
}
|
||||
//logging::Info("canpacket: %i", ch->CanPacket());
|
||||
//if (!cmd) return ret;
|
||||
|
||||
bool time_replaced = false;
|
||||
float curtime_old;
|
||||
if (CE_GOOD(g_pLocalPlayer->entity)) {
|
||||
float servertime = (float)CE_INT(g_pLocalPlayer->entity, netvar.nTickBase) * interfaces::gvars->interval_per_tick;
|
||||
curtime_old = interfaces::gvars->curtime;
|
||||
interfaces::gvars->curtime = servertime;
|
||||
time_replaced = true;
|
||||
}
|
||||
if (g_Settings.bInvalid) {
|
||||
gEntityCache.Invalidate();
|
||||
}
|
||||
PROF_BEGIN();
|
||||
SAFE_CALL(gEntityCache.Update());
|
||||
PROF_END("Entity Cache updating");
|
||||
SAFE_CALL(g_pPlayerResource->Update());
|
||||
SAFE_CALL(g_pLocalPlayer->Update());
|
||||
g_Settings.bInvalid = false;
|
||||
if (CE_GOOD(g_pLocalPlayer->entity)) {
|
||||
g_pLocalPlayer->v_OrigViewangles = cmd->viewangles;
|
||||
PROF_BEGIN();
|
||||
//RunEnginePrediction(g_pLocalPlayer->entity, cmd);
|
||||
SAFE_CALL(CREATE_MOVE(ESP));
|
||||
if (!g_pLocalPlayer->life_state) {
|
||||
SAFE_CALL(CREATE_MOVE(Bunnyhop));
|
||||
SAFE_CALL(CREATE_MOVE(Aimbot));
|
||||
SAFE_CALL(CREATE_MOVE(Airstuck));
|
||||
SAFE_CALL(CREATE_MOVE(AntiAim));
|
||||
SAFE_CALL(CREATE_MOVE(AutoSticky));
|
||||
SAFE_CALL(CREATE_MOVE(AutoReflect));
|
||||
SAFE_CALL(CREATE_MOVE(AutoStrafe));
|
||||
SAFE_CALL(CREATE_MOVE(Triggerbot));
|
||||
SAFE_CALL(CREATE_MOVE(HuntsmanCompensation));
|
||||
}
|
||||
SAFE_CALL(CREATE_MOVE(AntiDisguise));
|
||||
SAFE_CALL(CREATE_MOVE(AutoHeal));
|
||||
SAFE_CALL(CREATE_MOVE(FollowBot));
|
||||
SAFE_CALL(CREATE_MOVE(Misc));
|
||||
PROF_END("Hacks processing");
|
||||
if (time_replaced) interfaces::gvars->curtime = curtime_old;
|
||||
}
|
||||
/*for (IHack* i_hack : hack::hacks) {
|
||||
if (!i_hack->CreateMove(thisptr, inputSample, cmd)) {
|
||||
ret = false;
|
||||
}
|
||||
}*/
|
||||
g_Settings.bInvalid = false;
|
||||
if (CE_GOOD(g_pLocalPlayer->entity)) {
|
||||
if (g_pLocalPlayer->bUseSilentAngles) {
|
||||
Vector vsilent(cmd->forwardmove, cmd->sidemove, cmd->upmove);
|
||||
float speed = sqrt(vsilent.x * vsilent.x + vsilent.y * vsilent.y);
|
||||
Vector ang;
|
||||
VectorAngles(vsilent, ang);
|
||||
float yaw = DEG2RAD(ang.y - g_pLocalPlayer->v_OrigViewangles.y + cmd->viewangles.y);
|
||||
cmd->forwardmove = cos(yaw) * speed;
|
||||
cmd->sidemove = sin(yaw) * speed;
|
||||
ret = false;
|
||||
}
|
||||
}
|
||||
if (cmd)
|
||||
last_angles = cmd->viewangles;
|
||||
|
||||
PROF_END("CreateMove");
|
||||
return ret;
|
||||
|
||||
SEGV_END;
|
||||
return true;
|
||||
}
|
||||
|
||||
void hack::Hk_FrameStageNotify(void* thisptr, int stage) {
|
||||
SEGV_BEGIN;
|
||||
DRM_ENFORCE;
|
||||
//logging::Info("FrameStageNotify %i", stage);
|
||||
// Ambassador to festive ambassador changer. simple.
|
||||
if (!interfaces::engineClient->IsInGame()) g_Settings.bInvalid = true;
|
||||
//logging::Info("fsi begin");// TODO dbg
|
||||
if (g_Settings.bHackEnabled->GetBool() && !g_Settings.bInvalid) {
|
||||
/*if (CE_GOOD(g_pLocalPlayer->entity) && CE_GOOD(g_pLocalPlayer->weapon())) {
|
||||
int defidx = CE_INT(g_pLocalPlayer->weapon(), netvar.iItemDefinitionIndex);
|
||||
if (defidx == 61) {
|
||||
CE_INT(g_pLocalPlayer->weapon(), netvar.iItemDefinitionIndex) = 1006;
|
||||
}
|
||||
}*/
|
||||
if (g_Settings.bThirdperson->GetBool() && !g_pLocalPlayer->life_state && CE_GOOD(g_pLocalPlayer->entity)) {
|
||||
CE_INT(g_pLocalPlayer->entity, netvar.nForceTauntCam) = 1;
|
||||
}
|
||||
if (stage == 5 && g_Settings.bShowAntiAim->GetBool() && interfaces::iinput->CAM_IsThirdPerson()) {
|
||||
if (CE_GOOD(g_pLocalPlayer->entity)) {
|
||||
CE_FLOAT(g_pLocalPlayer->entity, netvar.deadflag + 4) = last_angles.x;
|
||||
CE_FLOAT(g_pLocalPlayer->entity, netvar.deadflag + 8) = last_angles.y;
|
||||
}
|
||||
}
|
||||
}
|
||||
((FrameStageNotify_t*)hooks::hkClient->GetMethod(hooks::offFrameStageNotify))(thisptr, stage);
|
||||
/*if (g_Settings.bHackEnabled->GetBool() && !g_Settings.bInvalid) {
|
||||
if (stage == 5 && g_Settings.bNoFlinch->GetBool()) {
|
||||
static Vector oldPunchAngles = Vector();
|
||||
Vector punchAngles = CE_VECTOR(g_pLocalPlayer->entity, netvar.vecPunchAngle);
|
||||
QAngle viewAngles;
|
||||
interfaces::engineClient->GetViewAngles(viewAngles);
|
||||
viewAngles -= VectorToQAngle(punchAngles - oldPunchAngles);
|
||||
oldPunchAngles = punchAngles;
|
||||
interfaces::engineClient->SetViewAngles(viewAngles);
|
||||
}
|
||||
|
||||
if (g_Settings.bNoZoom->GetBool()) {
|
||||
if (CE_GOOD(g_pLocalPlayer->entity)) {
|
||||
//g_pLocalPlayer->bWasZoomed = NET_INT(g_pLocalPlayer->entity, netvar.iCond) & cond::zoomed;
|
||||
CE_INT(g_pLocalPlayer->entity, netvar.iCond) = CE_INT(g_pLocalPlayer->entity, netvar.iCond) &~ cond::zoomed;
|
||||
}
|
||||
}
|
||||
}*/
|
||||
//logging::Info("fsi end");// TODO dbg
|
||||
SEGV_END;
|
||||
}
|
||||
|
||||
bool hack::Hk_DispatchUserMessage(void* thisptr, int type, bf_read& buf) {
|
||||
//logging::Info("message %i", type);
|
||||
return ((DispatchUserMessage_t*)hooks::hkClient->GetMethod(hooks::offFrameStageNotify + 1))(thisptr, type, buf);
|
||||
}
|
||||
|
||||
bool hack::shutdown = false;
|
||||
|
||||
ICvar* g_pCVar = 0;
|
||||
@ -484,7 +147,8 @@ void hack::Initialize() {
|
||||
logging::Info("Hooking methods...");
|
||||
hooks::hkPanel = new hooks::VMTHook();
|
||||
hooks::hkPanel->Init(interfaces::panel, 0);
|
||||
hooks::hkPanel->HookMethod((void*)&hack::Hk_PaintTraverse, hooks::offPaintTraverse);
|
||||
//hooks::hkPanel->HookMethod((void*)&hack::Hk_PaintTraverse, hooks::offPaintTraverse);
|
||||
hooks::hkPanel->HookMethod((void*)PaintTraverse_hook, hooks::offPaintTraverse);
|
||||
hooks::hkPanel->Apply();
|
||||
hooks::hkClientMode = new hooks::VMTHook();
|
||||
uintptr_t* clientMode = 0;
|
||||
@ -492,14 +156,15 @@ void hack::Initialize() {
|
||||
sleep(1);
|
||||
}
|
||||
hooks::hkClientMode->Init((void*)clientMode, 0);
|
||||
hooks::hkClientMode->HookMethod((void*)&hack::Hk_CreateMove, hooks::offCreateMove);
|
||||
hooks::hkClientMode->HookMethod((void*)&hack::Hk_OverrideView, hooks::offOverrideView);
|
||||
//hooks::hkClientMode->HookMethod((void*)&hack::Hk_CreateMove, hooks::offCreateMove);
|
||||
hooks::hkClientMode->HookMethod((void*)CreateMove_hook, hooks::offCreateMove);
|
||||
hooks::hkClientMode->HookMethod((void*)OverrideView_hook, hooks::offOverrideView);
|
||||
hooks::hkClientMode->Apply();
|
||||
hooks::hkClient = new hooks::VMTHook();
|
||||
hooks::hkClient->Init((void*)interfaces::baseClient, 0);
|
||||
hooks::hkClient->HookMethod((void*)&hack::Hk_FrameStageNotify, hooks::offFrameStageNotify);
|
||||
hooks::hkClient->HookMethod((void*)&hack::Hk_DispatchUserMessage, hooks::offFrameStageNotify + 1);
|
||||
hooks::hkClient->HookMethod((void*)&Hk_IN_KeyEvent, hooks::offKeyEvent);
|
||||
hooks::hkClient->HookMethod((void*)FrameStageNotify_hook, hooks::offFrameStageNotify);
|
||||
hooks::hkClient->HookMethod((void*)DispatchUserMessage_hook, hooks::offFrameStageNotify + 1);
|
||||
hooks::hkClient->HookMethod((void*)IN_KeyEvent_hook, hooks::offKeyEvent);
|
||||
hooks::hkClient->Apply();
|
||||
/*hooks::hkMatSurface = new hooks::VMTHook();
|
||||
hooks::hkMatSurface->Init((void*)interfaces::matsurface, 0);
|
||||
|
@ -31,12 +31,6 @@ namespace hack {
|
||||
|
||||
extern bool shutdown;
|
||||
|
||||
void Hk_OverrideView(void*, CViewSetup*);
|
||||
void Hk_PaintTraverse(void*, unsigned int, bool, bool);
|
||||
bool Hk_CreateMove(void*, float, CUserCmd*);
|
||||
void Hk_FrameStageNotify(void*, int stage);
|
||||
bool Hk_DispatchUserMessage(void*, int, bf_read&);
|
||||
|
||||
void Initialize();
|
||||
void Think();
|
||||
void Shutdown();
|
||||
|
@ -7,11 +7,109 @@
|
||||
|
||||
#include "CreateMove.h"
|
||||
|
||||
#include "hooks.h"
|
||||
#include "../hooks.h"
|
||||
#include "../hack.h"
|
||||
#include "../common.h"
|
||||
#include "hookedmethods.h"
|
||||
|
||||
bool CreateMove_hook(void* thisptr, float inputSample, CUserCmd* cmd) {
|
||||
SEGV_BEGIN;
|
||||
|
||||
bool ret = ((CreateMove_t*)hooks::hkClientMode->GetMethod(hooks::offCreateMove))(thisptr, inputSample, cmd);
|
||||
|
||||
if (!cmd) {
|
||||
return ret;
|
||||
}
|
||||
|
||||
if (!g_Settings.bHackEnabled->GetBool()) {
|
||||
return ret;
|
||||
}
|
||||
|
||||
if (!interfaces::engineClient->IsInGame()) {
|
||||
g_Settings.bInvalid = true;
|
||||
return true;
|
||||
}
|
||||
|
||||
// PROF_BEGIN();
|
||||
|
||||
INetChannel* ch = (INetChannel*)interfaces::engineClient->GetNetChannelInfo();
|
||||
if (ch && !hooks::IsHooked((void*)((uintptr_t)ch))) {
|
||||
logging::Info("Hooking INetChannel!");
|
||||
hooks::hkNetChannel = new hooks::VMTHook();
|
||||
hooks::hkNetChannel->Init(ch, 0);
|
||||
hooks::hkNetChannel->HookMethod((void*)CanPacket_hook, hooks::offCanPacket);
|
||||
hooks::hkNetChannel->HookMethod((void*)SendNetMsg_hook, hooks::offSendNetMsg);
|
||||
hooks::hkNetChannel->HookMethod((void*)Shutdown_hook, hooks::offShutdown);
|
||||
hooks::hkNetChannel->Apply();
|
||||
logging::Info("NetChannel Hooked!");
|
||||
}
|
||||
//logging::Info("canpacket: %i", ch->CanPacket());
|
||||
//if (!cmd) return ret;
|
||||
|
||||
bool time_replaced = false;
|
||||
float curtime_old;
|
||||
if (CE_GOOD(g_pLocalPlayer->entity)) {
|
||||
float servertime = (float)CE_INT(g_pLocalPlayer->entity, netvar.nTickBase) * interfaces::gvars->interval_per_tick;
|
||||
curtime_old = interfaces::gvars->curtime;
|
||||
interfaces::gvars->curtime = servertime;
|
||||
time_replaced = true;
|
||||
}
|
||||
if (g_Settings.bInvalid) {
|
||||
gEntityCache.Invalidate();
|
||||
}
|
||||
// PROF_BEGIN();
|
||||
SAFE_CALL(gEntityCache.Update());
|
||||
// PROF_END("Entity Cache updating");
|
||||
SAFE_CALL(g_pPlayerResource->Update());
|
||||
SAFE_CALL(g_pLocalPlayer->Update());
|
||||
g_Settings.bInvalid = false;
|
||||
if (CE_GOOD(g_pLocalPlayer->entity)) {
|
||||
g_pLocalPlayer->v_OrigViewangles = cmd->viewangles;
|
||||
// PROF_BEGIN();
|
||||
//RunEnginePrediction(g_pLocalPlayer->entity, cmd);
|
||||
SAFE_CALL(CREATE_MOVE(ESP));
|
||||
if (!g_pLocalPlayer->life_state) {
|
||||
SAFE_CALL(CREATE_MOVE(Bunnyhop));
|
||||
SAFE_CALL(CREATE_MOVE(Aimbot));
|
||||
SAFE_CALL(CREATE_MOVE(Airstuck));
|
||||
SAFE_CALL(CREATE_MOVE(AntiAim));
|
||||
SAFE_CALL(CREATE_MOVE(AutoSticky));
|
||||
SAFE_CALL(CREATE_MOVE(AutoReflect));
|
||||
SAFE_CALL(CREATE_MOVE(AutoStrafe));
|
||||
SAFE_CALL(CREATE_MOVE(Triggerbot));
|
||||
SAFE_CALL(CREATE_MOVE(HuntsmanCompensation));
|
||||
}
|
||||
SAFE_CALL(CREATE_MOVE(AntiDisguise));
|
||||
SAFE_CALL(CREATE_MOVE(AutoHeal));
|
||||
SAFE_CALL(CREATE_MOVE(FollowBot));
|
||||
SAFE_CALL(CREATE_MOVE(Misc));
|
||||
// PROF_END("Hacks processing");
|
||||
if (time_replaced) interfaces::gvars->curtime = curtime_old;
|
||||
}
|
||||
/*for (IHack* i_hack : hack::hacks) {
|
||||
if (!i_hack->CreateMove(thisptr, inputSample, cmd)) {
|
||||
ret = false;
|
||||
}
|
||||
}*/
|
||||
g_Settings.bInvalid = false;
|
||||
if (CE_GOOD(g_pLocalPlayer->entity)) {
|
||||
if (g_pLocalPlayer->bUseSilentAngles) {
|
||||
Vector vsilent(cmd->forwardmove, cmd->sidemove, cmd->upmove);
|
||||
float speed = sqrt(vsilent.x * vsilent.x + vsilent.y * vsilent.y);
|
||||
Vector ang;
|
||||
VectorAngles(vsilent, ang);
|
||||
float yaw = DEG2RAD(ang.y - g_pLocalPlayer->v_OrigViewangles.y + cmd->viewangles.y);
|
||||
cmd->forwardmove = cos(yaw) * speed;
|
||||
cmd->sidemove = sin(yaw) * speed;
|
||||
ret = false;
|
||||
}
|
||||
}
|
||||
if (cmd)
|
||||
g_Settings.last_angles = cmd->viewangles;
|
||||
|
||||
// PROF_END("CreateMove");
|
||||
return ret;
|
||||
|
||||
SEGV_END;
|
||||
return true;
|
||||
}
|
||||
|
@ -7,10 +7,123 @@
|
||||
|
||||
#include "PaintTraverse.h"
|
||||
#include "../common.h"
|
||||
#include "../hack.h"
|
||||
#include "hookedmethods.h"
|
||||
#include "../segvcatch/segvcatch.h"
|
||||
|
||||
void PaintTraverse_hook(void* thisptr, unsigned int panel, bool b1, bool b2) {
|
||||
void PaintTraverse_hook(void* p, unsigned int vp, bool fr, bool ar) {
|
||||
#if DEBUG_SEGV == true
|
||||
if (!segvcatch::handler_fpe || !segvcatch::handler_segv) {
|
||||
segvcatch::init_segv();
|
||||
segvcatch::init_fpe();
|
||||
logging::Info("segvcatch init!");
|
||||
}
|
||||
#endif
|
||||
SEGV_BEGIN;
|
||||
SAFE_CALL(((PaintTraverse_t*)hooks::hkPanel->GetMethod(hooks::offPaintTraverse))(p, vp, fr, ar));
|
||||
if (!g_Settings.bHackEnabled->GetBool()) return;
|
||||
// Because of single-multi thread shit I'm gonna put this thing riiiight here.
|
||||
#if NO_IPC != true
|
||||
if (g_phFollowBot->v_bEnabled->GetBool()) {
|
||||
ipc_client_seg* seg_g = g_phFollowBot->m_pIPC->GetClientSegment(0);
|
||||
ipc_client_seg* seg_l = g_phFollowBot->m_pIPC->GetClientSegment(g_phFollowBot->m_pIPC->client_id);
|
||||
|
||||
if (seg_g == 0) {
|
||||
logging::Info("!!! seg_g == 0 !!!");
|
||||
}
|
||||
if (seg_l == 0) {
|
||||
logging::Info("!!! seg_l == 0 !!!");
|
||||
}
|
||||
|
||||
if (seg_g && seg_g->command_number > g_phFollowBot->last_command_global) {
|
||||
logging::Info("Executing `%s`", seg_g->command_buffer);
|
||||
if (g_phFollowBot->last_command_global) interfaces::engineClient->ExecuteClientCmd(seg_g->command_buffer);
|
||||
g_phFollowBot->last_command_global = seg_g->command_number;
|
||||
}
|
||||
if (seg_l && seg_l->command_number > g_phFollowBot->last_command_local) {
|
||||
logging::Info("Executing `%s`", seg_l->command_buffer);
|
||||
if (g_phFollowBot->last_command_local) interfaces::engineClient->ExecuteClientCmd(seg_l->command_buffer);
|
||||
g_phFollowBot->last_command_local = seg_l->command_number;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
if (g_Settings.bNoVisuals->GetBool()) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (!draw::width || !draw::height) {
|
||||
interfaces::engineClient->GetScreenSize(draw::width, draw::height);
|
||||
}
|
||||
if (!draw::panel_top) {
|
||||
const char* name = interfaces::panel->GetName(vp);
|
||||
if (strlen(name) > 4) {
|
||||
if (name[0] == 'M' && name[3] == 'S') {
|
||||
draw::panel_top = vp;
|
||||
logging::Info("Got top panel: %i", vp);
|
||||
}
|
||||
}
|
||||
}
|
||||
if (!interfaces::engineClient->IsInGame()) {
|
||||
g_Settings.bInvalid = true;
|
||||
}
|
||||
if (g_Settings.bInvalid) {
|
||||
return;
|
||||
}
|
||||
if (CE_BAD(g_pLocalPlayer->entity)) {
|
||||
return;
|
||||
}
|
||||
if (draw::panel_top == vp) {
|
||||
ResetStrings();
|
||||
if (g_Settings.bShowLogo->GetBool()) {
|
||||
AddSideString(colors::green, colors::black, "cathook by d4rkc4t");
|
||||
#if _DEVELOPER
|
||||
AddSideString(colors::red, colors::black, "DEVELOPER BUILD");
|
||||
#else
|
||||
AddSideString(colors::orange, colors::black, "Early Access: " __DRM_NAME);
|
||||
#endif
|
||||
AddSideString(colors::green, colors::black, "version: " CATHOOK_VERSION_MAJOR "." CATHOOK_VERSION_MINOR "." CATHOOK_VERSION_PATCH);
|
||||
}
|
||||
|
||||
//SAFE_CALL(PAINT_TRAVERSE(AutoStrafe));
|
||||
//SAFE_CALL(PAINT_TRAVERSE(AntiAim));
|
||||
SAFE_CALL(PAINT_TRAVERSE(AntiDisguise));
|
||||
//SAFE_CALL(PAINT_TRAVERSE(AutoReflect));
|
||||
//SAFE_CALL(PAINT_TRAVERSE(FollowBot));
|
||||
SAFE_CALL(PAINT_TRAVERSE(Misc));
|
||||
//SAFE_CALL(PAINT_TRAVERSE(Aimbot));
|
||||
//SAFE_CALL(PAINT_TRAVERSE(Bunnyhop));
|
||||
SAFE_CALL(PAINT_TRAVERSE(ESP));
|
||||
//SAFE_CALL(PAINT_TRAVERSE(Triggerbot));
|
||||
//SAFE_CALL(PAINT_TRAVERSE(AutoSticky));
|
||||
//SAFE_CALL(PAINT_TRAVERSE(Airstuck));
|
||||
//SAFE_CALL(PAINT_TRAVERSE(AutoHeal));
|
||||
//SAFE_CALL(PAINT_TRAVERSE(HuntsmanCompensation));
|
||||
SAFE_CALL(PAINT_TRAVERSE(SpyAlert));
|
||||
Vector screen;
|
||||
for (int i = 0; i < HIGHEST_ENTITY; i++) {
|
||||
CachedEntity* ce = gEntityCache.GetEntity(i);
|
||||
if (CE_BAD(ce)) continue;
|
||||
if (ce->m_ESPOrigin.IsZero(1.0f))
|
||||
if (!draw::EntityCenterToScreen(ce, screen)) continue;
|
||||
for (int j = 0; j < ce->m_nESPStrings; j++) {
|
||||
ESPStringCompound str = ce->GetESPString(j);
|
||||
//logging::Info("drawing [idx=%i][ns=%i] %s", i, ce->m_nESPStrings, str.m_String);
|
||||
if (!ce->m_ESPOrigin.IsZero(1.0)) {
|
||||
draw::DrawString(ce->m_ESPOrigin.x, ce->m_ESPOrigin.y, str.m_Color, str.m_Background, false, str.m_String);
|
||||
ce->m_ESPOrigin.y += 11;
|
||||
} else {
|
||||
draw::DrawString(screen.x, screen.y, str.m_Color, str.m_Background, true, str.m_String);
|
||||
screen.y += 11;
|
||||
}
|
||||
}
|
||||
}
|
||||
#if GUI_ENABLED == true
|
||||
g_pGUI->UpdateKeys();
|
||||
g_pGUI->Draw();
|
||||
#endif
|
||||
DrawStrings();
|
||||
}
|
||||
SEGV_END;
|
||||
}
|
||||
|
||||
|
@ -5,8 +5,8 @@
|
||||
* Author: nullifiedcat
|
||||
*/
|
||||
|
||||
#ifndef HOOKS_H_
|
||||
#define HOOKS_H_
|
||||
#ifndef HOOKEDMETHODS_H_
|
||||
#define HOOKEDMETHODS_H_
|
||||
|
||||
typedef bool(CreateMove_t)(void*, float, CUserCmd*);
|
||||
typedef void(PaintTraverse_t)(void*, unsigned int, bool, bool);
|
||||
@ -22,4 +22,4 @@ typedef void(FrameStageNotify_t)(void*, int);
|
||||
#include "PaintTraverse.h"
|
||||
#include "others.h"
|
||||
|
||||
#endif /* HOOKS_H_ */
|
||||
#endif /* HOOKEDMETHODS_H_ */
|
@ -5,9 +5,10 @@
|
||||
* Author: nullifiedcat
|
||||
*/
|
||||
|
||||
#include "hooks.h"
|
||||
#include "../common.h"
|
||||
#include "../netmessage.h"
|
||||
#include "../gui/gui.h"
|
||||
#include "hookedmethods.h"
|
||||
|
||||
bool CanPacket_hook(void* thisptr) {
|
||||
SEGV_BEGIN;
|
||||
@ -61,27 +62,30 @@ void Shutdown_hook(void* thisptr, const char* reason) {
|
||||
|
||||
void FrameStageNotify_hook(void* thisptr, int stage) {
|
||||
SEGV_BEGIN;
|
||||
DRM_ENFORCE;
|
||||
//logging::Info("FrameStageNotify %i", stage);
|
||||
// Ambassador to festive ambassador changer. simple.
|
||||
if (g_Settings.bHackEnabled->GetBool()) {
|
||||
if (CE_GOOD(g_pLocalPlayer->entity) && CE_GOOD(g_pLocalPlayer->weapon())) {
|
||||
if (!interfaces::engineClient->IsInGame()) g_Settings.bInvalid = true;
|
||||
//logging::Info("fsi begin");// TODO dbg
|
||||
if (g_Settings.bHackEnabled->GetBool() && !g_Settings.bInvalid) {
|
||||
/*if (CE_GOOD(g_pLocalPlayer->entity) && CE_GOOD(g_pLocalPlayer->weapon())) {
|
||||
int defidx = CE_INT(g_pLocalPlayer->weapon(), netvar.iItemDefinitionIndex);
|
||||
if (defidx == 61) {
|
||||
CE_INT(g_pLocalPlayer->weapon(), netvar.iItemDefinitionIndex) = 1006;
|
||||
}
|
||||
}
|
||||
if (g_Settings.bThirdperson->GetBool() && g_pLocalPlayer->entity) {
|
||||
}*/
|
||||
if (g_Settings.bThirdperson->GetBool() && !g_pLocalPlayer->life_state && CE_GOOD(g_pLocalPlayer->entity)) {
|
||||
CE_INT(g_pLocalPlayer->entity, netvar.nForceTauntCam) = 1;
|
||||
}
|
||||
if (stage == 5 && g_Settings.bShowAntiAim->GetBool() && interfaces::iinput->CAM_IsThirdPerson()) {
|
||||
if (CE_GOOD(g_pLocalPlayer->entity)) {
|
||||
CE_FLOAT(g_pLocalPlayer->entity, netvar.deadflag + 4) = last_angles.x;
|
||||
CE_FLOAT(g_pLocalPlayer->entity, netvar.deadflag + 8) = last_angles.y;
|
||||
CE_FLOAT(g_pLocalPlayer->entity, netvar.deadflag + 4) = g_Settings.last_angles.x;
|
||||
CE_FLOAT(g_pLocalPlayer->entity, netvar.deadflag + 8) = g_Settings.last_angles.y;
|
||||
}
|
||||
}
|
||||
}
|
||||
((FrameStageNotify_t*)hooks::hkClient->GetMethod(hooks::offFrameStageNotify))(thisptr, stage);
|
||||
if (g_Settings.bHackEnabled->GetBool()) {
|
||||
/*if (g_Settings.bHackEnabled->GetBool() && !g_Settings.bInvalid) {
|
||||
if (stage == 5 && g_Settings.bNoFlinch->GetBool()) {
|
||||
static Vector oldPunchAngles = Vector();
|
||||
Vector punchAngles = CE_VECTOR(g_pLocalPlayer->entity, netvar.vecPunchAngle);
|
||||
@ -98,7 +102,8 @@ void FrameStageNotify_hook(void* thisptr, int stage) {
|
||||
CE_INT(g_pLocalPlayer->entity, netvar.iCond) = CE_INT(g_pLocalPlayer->entity, netvar.iCond) &~ cond::zoomed;
|
||||
}
|
||||
}
|
||||
}
|
||||
}*/
|
||||
//logging::Info("fsi end");// TODO dbg
|
||||
SEGV_END;
|
||||
}
|
||||
|
||||
|
@ -40,6 +40,7 @@
|
||||
#include <iserver.h>
|
||||
#include <view_shared.h>
|
||||
#include <VGuiMatSurface/IMatSystemSurface.h>
|
||||
#include <steam/isteamuser.h>
|
||||
|
||||
#include "sdk/in_buttons.h"
|
||||
#include "sdk/iinput.h"
|
||||
|
@ -47,9 +47,7 @@ static int s_nDLLIdentifier = -1; // A unique identifier indicating which DLL th
|
||||
static bool s_bRegistered = false;
|
||||
|
||||
void SetCVarInterface(ICvar* iface) {
|
||||
logging::Info("Setting interface.. current: 0x%08x", g_pCVar);
|
||||
g_pCVar = iface;
|
||||
logging::Info("new: 0x%08x", g_pCVar);
|
||||
}
|
||||
|
||||
class CDefaultAccessor : public IConCommandBaseAccessor
|
||||
|
Reference in New Issue
Block a user