before splitting hooks

This commit is contained in:
nullifiedcat 2017-01-14 11:55:35 +03:00
parent acce532ecb
commit dcacfd9241
14 changed files with 67 additions and 42 deletions

View File

@ -59,7 +59,7 @@
<option id="gnu.c.compiler.option.dialect.std.1436721060" name="Language standard" superClass="gnu.c.compiler.option.dialect.std" useByScannerDiscovery="true" value="gnu.c.compiler.dialect.default" valueType="enumerated"/> <option id="gnu.c.compiler.option.dialect.std.1436721060" name="Language standard" superClass="gnu.c.compiler.option.dialect.std" useByScannerDiscovery="true" value="gnu.c.compiler.dialect.default" valueType="enumerated"/>
<option id="gnu.c.compiler.option.misc.other.743672320" name="Other flags" superClass="gnu.c.compiler.option.misc.other" useByScannerDiscovery="false" value="-c -fmessage-length=0 -shared -m32" valueType="string"/> <option id="gnu.c.compiler.option.misc.other.743672320" name="Other flags" superClass="gnu.c.compiler.option.misc.other" useByScannerDiscovery="false" value="-c -fmessage-length=0 -shared -m32" valueType="string"/>
<option id="gnu.c.compiler.option.misc.pic.1956969567" name="Position Independent Code (-fPIC)" superClass="gnu.c.compiler.option.misc.pic" useByScannerDiscovery="false" value="true" valueType="boolean"/> <option id="gnu.c.compiler.option.misc.pic.1956969567" name="Position Independent Code (-fPIC)" superClass="gnu.c.compiler.option.misc.pic" useByScannerDiscovery="false" value="true" valueType="boolean"/>
<option id="gnu.c.compiler.option.include.paths.634898295" name="Include paths (-I)" superClass="gnu.c.compiler.option.include.paths" useByScannerDiscovery="false" valueType="includePath"/> <option id="gnu.c.compiler.option.include.paths.634898295" name="Include paths (-I)" superClass="gnu.c.compiler.option.include.paths" useByScannerDiscovery="false"/>
<inputType id="cdt.managedbuild.tool.gnu.c.compiler.input.720576197" superClass="cdt.managedbuild.tool.gnu.c.compiler.input"/> <inputType id="cdt.managedbuild.tool.gnu.c.compiler.input.720576197" superClass="cdt.managedbuild.tool.gnu.c.compiler.input"/>
</tool> </tool>
<tool id="cdt.managedbuild.tool.gnu.c.linker.exe.debug.622955675" name="GCC C Linker" superClass="cdt.managedbuild.tool.gnu.c.linker.exe.debug"> <tool id="cdt.managedbuild.tool.gnu.c.linker.exe.debug.622955675" name="GCC C Linker" superClass="cdt.managedbuild.tool.gnu.c.linker.exe.debug">

View File

@ -50,13 +50,19 @@
#define SQR(x) x * x #define SQR(x) x * x
#define CATHOOK_VERSION_MAJOR "0"
#define CATHOOK_VERSION_MINOR "1"
#define CATHOOK_VERSION_PATCH "0"
#define CON_NAME "cat" #define CON_NAME "cat"
#define CON_PREFIX CON_NAME "_" #define CON_PREFIX CON_NAME "_"
#ifndef DEG2RAD
#define DEG2RAD(x) (float)(x) * (PI / 180.0f) #define DEG2RAD(x) (float)(x) * (PI / 180.0f)
#endif
#define NO_DEVIGNORE true #define NO_DEVIGNORE true
#define DEBUG_SEGV false #define DEBUG_SEGV true
#if DEBUG_SEGV == true #if DEBUG_SEGV == true
@ -87,10 +93,10 @@
#endif #endif
#define ADD_HACK(x) \ /*#define ADD_HACK(x) \
hack::AddHack(g_ph##x = new x()); hack::AddHack(g_ph##x = new x());
#define CREATE_MOVE(x) \ #define CREATE_MOVE(x) \
g_ph##x->CreateMove(thisptr, inputSample, cmd) g_ph##x->CreateMove(thisptr, inputSample, cmd)*/
#endif /* COMMON_H_ */ #endif /* COMMON_H_ */

View File

@ -147,14 +147,24 @@ void hack::Hk_PaintTraverse(void* p, unsigned int vp, bool fr, bool ar) {
#else #else
AddSideString(colors::orange, colors::black, "Early Access: " __DRM_NAME); AddSideString(colors::orange, colors::black, "Early Access: " __DRM_NAME);
#endif #endif
AddSideString(colors::green, colors::black, "version: " CATHOOK_VERSION_MAJOR "." CATHOOK_VERSION_MINOR "." CATHOOK_VERSION_PATCH);
} }
for (IHack* i_hack : hack::hacks) {
//PROF_BEGIN(); //SAFE_CALL(PAINT_TRAVERSE(AutoStrafe));
SEGV_BEGIN //SAFE_CALL(PAINT_TRAVERSE(AntiAim));
i_hack->PaintTraverse(p, vp, fr, ar); SAFE_CALL(PAINT_TRAVERSE(AntiDisguise));
SEGV_END_INFO("Hack PaintTraverse") //SAFE_CALL(PAINT_TRAVERSE(AutoReflect));
//PROF_END(strfmt("%s PaintTraverse", i_hack->GetName())); //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; Vector screen;
for (int i = 0; i < HIGHEST_ENTITY; i++) { for (int i = 0; i < HIGHEST_ENTITY; i++) {
CachedEntity* ce = gEntityCache.GetEntity(i); CachedEntity* ce = gEntityCache.GetEntity(i);
@ -390,13 +400,8 @@ bool hack::Hk_DispatchUserMessage(void* thisptr, int type, bf_read& buf) {
return ((DispatchUserMessage_t*)hooks::hkClient->GetMethod(hooks::offFrameStageNotify + 1))(thisptr, type, buf); return ((DispatchUserMessage_t*)hooks::hkClient->GetMethod(hooks::offFrameStageNotify + 1))(thisptr, type, buf);
} }
std::vector<IHack*> hack::hacks;
bool hack::shutdown = false; bool hack::shutdown = false;
void hack::AddHack(IHack* hack) {
hack::hacks.push_back(hack);
}
ICvar* g_pCVar = 0; ICvar* g_pCVar = 0;
void hack::InitHacks() { void hack::InitHacks() {
@ -521,7 +526,19 @@ void hack::Shutdown() {
if (hooks::hkClient) hooks::hkClient->Kill(); if (hooks::hkClient) hooks::hkClient->Kill();
if (hooks::hkMatSurface) hooks::hkMatSurface->Kill(); if (hooks::hkMatSurface) hooks::hkMatSurface->Kill();
if (hooks::hkNetChannel) hooks::hkNetChannel->Kill(); if (hooks::hkNetChannel) hooks::hkNetChannel->Kill();
for (IHack* i_hack : hack::hacks) { DELETE_HACK(AutoStrafe);
delete i_hack; DELETE_HACK(AntiAim);
} DELETE_HACK(AntiDisguise);
DELETE_HACK(AutoReflect);
DELETE_HACK(FollowBot);
DELETE_HACK(Misc);
DELETE_HACK(Aimbot);
DELETE_HACK(Bunnyhop);
DELETE_HACK(ESP);
DELETE_HACK(Triggerbot);
DELETE_HACK(AutoSticky);
DELETE_HACK(Airstuck);
DELETE_HACK(AutoHeal);
DELETE_HACK(HuntsmanCompensation);
DELETE_HACK(SpyAlert);
} }

View File

@ -8,14 +8,18 @@
#ifndef HACK_H_ #ifndef HACK_H_
#define HACK_H_ #define HACK_H_
#include <vector>
#define ADD_HACK(x) \ #define ADD_HACK(x) \
hack::AddHack(g_ph##x = new x()); g_ph##x = new x()
#define CREATE_MOVE(x) \ #define CREATE_MOVE(x) \
g_ph##x->CreateMove(thisptr, inputSample, cmd) g_ph##x->CreateMove(thisptr, inputSample, cmd)
#define PAINT_TRAVERSE(x) \
g_ph##x->PaintTraverse(p, vp, fr, ar)
#define DELETE_HACK(x) \
delete g_ph##x
class IHack; class IHack;
class CUserCmd; class CUserCmd;
class CViewSetup; class CViewSetup;
@ -25,7 +29,6 @@ class CCommand;
namespace hack { namespace hack {
extern std::vector<IHack*> hacks;
extern bool shutdown; extern bool shutdown;
void Hk_OverrideView(void*, CViewSetup*); void Hk_OverrideView(void*, CViewSetup*);
@ -34,8 +37,6 @@ bool Hk_CreateMove(void*, float, CUserCmd*);
void Hk_FrameStageNotify(void*, int stage); void Hk_FrameStageNotify(void*, int stage);
bool Hk_DispatchUserMessage(void*, int, bf_read&); bool Hk_DispatchUserMessage(void*, int, bf_read&);
void AddHack(IHack* hack);
void Initialize(); void Initialize();
void Think(); void Think();
void Shutdown(); void Shutdown();

View File

@ -180,6 +180,9 @@ bool Aimbot::CreateMove(void*, float, CUserCmd* cmd) {
case ClassID::CTFRocketLauncher_Mortar: case ClassID::CTFRocketLauncher_Mortar:
m_iPreferredHitbox = hitbox_t::foot_L; m_iPreferredHitbox = hitbox_t::foot_L;
break; break;
case ClassID::CTFFlareGun:
m_iPreferredHitbox = hitbox_t::spine_3;
break;
default: default:
m_iPreferredHitbox = hitbox_t::pelvis; m_iPreferredHitbox = hitbox_t::pelvis;
} }

View File

@ -17,6 +17,7 @@ const char* AutoReflect::GetName() {
} }
bool AutoReflect::ShouldReflect(CachedEntity* ent) { bool AutoReflect::ShouldReflect(CachedEntity* ent) {
if (CE_BAD(ent)) return false;
if (ent->m_Type != ENTITY_PROJECTILE) return false; if (ent->m_Type != ENTITY_PROJECTILE) return false;
if (CE_INT(ent, netvar.iTeamNum) == g_pLocalPlayer->team) return false; if (CE_INT(ent, netvar.iTeamNum) == g_pLocalPlayer->team) return false;
// If projectile is already deflected, don't deflect it again. // If projectile is already deflected, don't deflect it again.

View File

@ -76,7 +76,7 @@ void ESP::DrawBox(CachedEntity* ent, Color clr, float widthFactor, float addHeig
bool cloak = ent->m_iClassID == ClassID::CTFPlayer && IsPlayerInvisible(ent);//(CE_INT(ent, netvar.iCond) & cond::cloaked); bool cloak = ent->m_iClassID == ClassID::CTFPlayer && IsPlayerInvisible(ent);//(CE_INT(ent, netvar.iCond) & cond::cloaked);
Vector min, max; Vector min, max;
RAW_ENT(ent)->GetRenderBounds(min, max); RAW_ENT(ent)->GetRenderBounds(min, max);
Vector origin = ent->m_vecOrigin; Vector origin = RAW_ENT(ent)->GetAbsOrigin();
Vector so; Vector so;
draw::WorldToScreen(origin, so); draw::WorldToScreen(origin, so);
//if (!a) return; //if (!a) return;

View File

@ -431,7 +431,7 @@ bool GetProjectileData(CachedEntity* weapon, float& speed, float& gravity) {
break; break;
case ClassID::CTFGrenadeLauncher: case ClassID::CTFGrenadeLauncher:
// TODO offset (GetProjectileSpeed) // TODO offset (GetProjectileSpeed)
rspeed = ((GetProjectileData*) *(*(const void ***) weapon + 527))(RAW_ENT(weapon)); rspeed = vfunc<GetProjectileData*>(RAW_ENT(weapon), 527)(RAW_ENT(weapon));
// TODO Wrong grenade launcher gravity // TODO Wrong grenade launcher gravity
rgrav = 0.5f; rgrav = 0.5f;
break; break;

View File

@ -7,11 +7,8 @@
#include "CreateMove.h" #include "CreateMove.h"
#include "../fixsdk.h"
#include "../common.h"
#include "./others.h"
#include "hooks.h" #include "hooks.h"
#include "../profiler.h" #include "../common.h"
bool CreateMove_hook(void* thisptr, float inputSample, CUserCmd* cmd) { bool CreateMove_hook(void* thisptr, float inputSample, CUserCmd* cmd) {
SEGV_BEGIN; SEGV_BEGIN;

View File

@ -10,7 +10,6 @@
class CUserCmd; class CUserCmd;
typedef bool(CreateMove_t)(void*, float, CUserCmd*);
bool CreateMove_hook(void*, float, CUserCmd*); bool CreateMove_hook(void*, float, CUserCmd*);
#endif /* CREATEMOVE_H_ */ #endif /* CREATEMOVE_H_ */

View File

@ -8,7 +8,6 @@
#ifndef PAINTTRAVERSE_H_ #ifndef PAINTTRAVERSE_H_
#define PAINTTRAVERSE_H_ #define PAINTTRAVERSE_H_
typedef void(PaintTraverse_t)(void*, unsigned int, bool, bool);
void PaintTraverse_hook(void*, unsigned int, bool, bool); void PaintTraverse_hook(void*, unsigned int, bool, bool);
#endif /* PAINTTRAVERSE_H_ */ #endif /* PAINTTRAVERSE_H_ */

View File

@ -8,6 +8,16 @@
#ifndef HOOKS_H_ #ifndef HOOKS_H_
#define HOOKS_H_ #define HOOKS_H_
typedef bool(CreateMove_t)(void*, float, CUserCmd*);
typedef void(PaintTraverse_t)(void*, unsigned int, bool, bool);
typedef bool(CanPacket_t)(void*);
typedef int(IN_KeyEvent_t)(void*, int, int, const char*);
typedef bool(SendNetMsg_t)(void*, INetMessage&, bool, bool);
typedef void(Shutdown_t)(void*, const char*);
typedef void(OverrideView_t)(void*, CViewSetup*);
typedef bool(DispatchUserMessage_t)(void*, int, bf_read&);
typedef void(FrameStageNotify_t)(void*, int);
#include "CreateMove.h" #include "CreateMove.h"
#include "PaintTraverse.h" #include "PaintTraverse.h"
#include "others.h" #include "others.h"

View File

@ -5,7 +5,7 @@
* Author: nullifiedcat * Author: nullifiedcat
*/ */
#include "others.h" #include "hooks.h"
#include "../common.h" #include "../common.h"
#include "../netmessage.h" #include "../netmessage.h"

View File

@ -12,14 +12,6 @@ class INetMessage;
class CViewSetup; class CViewSetup;
class bf_read; class bf_read;
typedef bool(CanPacket_t)(void*);
typedef int(IN_KeyEvent_t)(void*, int, int, const char*);
typedef bool(SendNetMsg_t)(void*, INetMessage&, bool, bool);
typedef void(Shutdown_t)(void*, const char*);
typedef void(OverrideView_t)(void*, CViewSetup*);
typedef bool(DispatchUserMessage_t)(void*, int, bf_read&);
typedef void(FrameStageNotify_t)(void*, int);
bool CanPacket_hook(void*); bool CanPacket_hook(void*);
int IN_KeyEvent_hook(void*, int, int, const char*); int IN_KeyEvent_hook(void*, int, int, const char*);
bool SendNetMsg_hook(void*, INetMessage&, bool, bool); bool SendNetMsg_hook(void*, INetMessage&, bool, bool);