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.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.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"/>
</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">

View File

@ -50,13 +50,19 @@
#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_PREFIX CON_NAME "_"
#ifndef DEG2RAD
#define DEG2RAD(x) (float)(x) * (PI / 180.0f)
#endif
#define NO_DEVIGNORE true
#define DEBUG_SEGV false
#define DEBUG_SEGV true
#if DEBUG_SEGV == true
@ -87,10 +93,10 @@
#endif
#define ADD_HACK(x) \
/*#define ADD_HACK(x) \
hack::AddHack(g_ph##x = new x());
#define CREATE_MOVE(x) \
g_ph##x->CreateMove(thisptr, inputSample, cmd)
g_ph##x->CreateMove(thisptr, inputSample, cmd)*/
#endif /* COMMON_H_ */

View File

@ -147,14 +147,24 @@ void hack::Hk_PaintTraverse(void* p, unsigned int vp, bool fr, bool ar) {
#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);
}
for (IHack* i_hack : hack::hacks) {
//PROF_BEGIN();
SEGV_BEGIN
i_hack->PaintTraverse(p, vp, fr, ar);
SEGV_END_INFO("Hack PaintTraverse")
//PROF_END(strfmt("%s PaintTraverse", i_hack->GetName()));
}
//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);
@ -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);
}
std::vector<IHack*> hack::hacks;
bool hack::shutdown = false;
void hack::AddHack(IHack* hack) {
hack::hacks.push_back(hack);
}
ICvar* g_pCVar = 0;
void hack::InitHacks() {
@ -521,7 +526,19 @@ void hack::Shutdown() {
if (hooks::hkClient) hooks::hkClient->Kill();
if (hooks::hkMatSurface) hooks::hkMatSurface->Kill();
if (hooks::hkNetChannel) hooks::hkNetChannel->Kill();
for (IHack* i_hack : hack::hacks) {
delete i_hack;
}
DELETE_HACK(AutoStrafe);
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_
#define HACK_H_
#include <vector>
#define ADD_HACK(x) \
hack::AddHack(g_ph##x = new x());
g_ph##x = new x()
#define CREATE_MOVE(x) \
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 CUserCmd;
class CViewSetup;
@ -25,7 +29,6 @@ class CCommand;
namespace hack {
extern std::vector<IHack*> hacks;
extern bool shutdown;
void Hk_OverrideView(void*, CViewSetup*);
@ -34,8 +37,6 @@ bool Hk_CreateMove(void*, float, CUserCmd*);
void Hk_FrameStageNotify(void*, int stage);
bool Hk_DispatchUserMessage(void*, int, bf_read&);
void AddHack(IHack* hack);
void Initialize();
void Think();
void Shutdown();

View File

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

View File

@ -17,6 +17,7 @@ const char* AutoReflect::GetName() {
}
bool AutoReflect::ShouldReflect(CachedEntity* ent) {
if (CE_BAD(ent)) return false;
if (ent->m_Type != ENTITY_PROJECTILE) return false;
if (CE_INT(ent, netvar.iTeamNum) == g_pLocalPlayer->team) return false;
// 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);
Vector min, max;
RAW_ENT(ent)->GetRenderBounds(min, max);
Vector origin = ent->m_vecOrigin;
Vector origin = RAW_ENT(ent)->GetAbsOrigin();
Vector so;
draw::WorldToScreen(origin, so);
//if (!a) return;

View File

@ -431,7 +431,7 @@ bool GetProjectileData(CachedEntity* weapon, float& speed, float& gravity) {
break;
case ClassID::CTFGrenadeLauncher:
// 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
rgrav = 0.5f;
break;

View File

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

View File

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

View File

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

View File

@ -8,6 +8,16 @@
#ifndef 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 "PaintTraverse.h"
#include "others.h"

View File

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

View File

@ -12,14 +12,6 @@ class INetMessage;
class CViewSetup;
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*);
int IN_KeyEvent_hook(void*, int, int, const char*);
bool SendNetMsg_hook(void*, INetMessage&, bool, bool);