Skip to content

Commit

Permalink
i'm too retarded
Browse files Browse the repository at this point in the history
  • Loading branch information
nullifiedcat committed Feb 11, 2017
1 parent c118af6 commit 36f8f27
Show file tree
Hide file tree
Showing 10 changed files with 437 additions and 21 deletions.
1 change: 1 addition & 0 deletions cathook/src/globals.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@ void GlobalSettings::Init() {
this->bDebugLog = new CatVar(CV_SWITCH, "log", "1", "Debug Log", NULL, "Disable this if you don't need cathook messages in your console");
this->bThirdperson->m_pConVar->InstallChangeCallback(ThirdpersonCallback);
this->bFastOutline = new CatVar(CV_SWITCH, "fastoutline", "0", "Low quality outline", NULL, "Might increase performance when there is a lot of ESP text to draw");
//this->bRollSpeedhack = new CatVar(CV_SWITCH, "rollspeedhack", "0", "Roll Speedhack", NULL, "Roll speedhack - works in TF2C!!");
bInvalid = true;
}

Expand Down
1 change: 1 addition & 0 deletions cathook/src/globals.h
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@ class GlobalSettings {
CatVar* bDebugLog;
Vector last_angles;
CatVar* bFastOutline;
CatVar* bRollSpeedhack;
bool bInvalid;
};

Expand Down
4 changes: 4 additions & 0 deletions cathook/src/gui/CMenuWindow.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -127,6 +127,10 @@ void CMenuWindow::AddElements() {
}));*/
if (TF) ADDCVAR(g_phAutoHeal->v_bEnabled);
if (TF) ADDCVAR(g_phAntiDisguise->v_bEnabled);
if (TF2C) {
ADDCVAR(g_phMisc->v_bTauntSlide);
ADDCVAR(g_phMisc->v_bCritHack);
}
ADDCVAR(g_phMisc->v_bAntiAFK);
ADDCVAR(g_Settings.bCleanScreenshots);
ADDCVAR(g_Settings.bHackEnabled);
Expand Down
22 changes: 21 additions & 1 deletion cathook/src/hacks/Bunnyhop.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -14,13 +14,16 @@ DEFINE_HACK_SINGLETON(Bunnyhop);

Bunnyhop::Bunnyhop() {
this->v_bEnabled = new CatVar(CV_SWITCH, "bhop_enabled", "0", "Enable", NULL, "Enable Bunnyhop");
this->v_iPerfectJumpLimit = new CatVar(CV_SWITCH, "bhop_pjumps", "0", "Perfect Jump Limit", NULL, "Bunny Hop perfect jump limit. 0 = Disabled");
this->v_bAutoJump = new CatVar(CV_SWITCH, "bhop_autojump", "0", "AutoJump", NULL, "Autojump if you reach certain speed");
this->v_iAutoJumpSpeed = new CatVar(CV_INT, "bhop_autojump_speed", "300", "AutoJump speed", NULL, "Minimum autojump speed");
this->v_bImperfect = new CatVar(CV_INT, "bhop_imperfect", "0", "Miss bhop jumps randomly", NULL, "To avoid auto bans");
}

bool bDoubleJumpFix = false;
int iTicksFlying = 0;
int iTicksLastJump = 0;
int iPerfectJumps = 0;

void Bunnyhop::ProcessUserCmd(CUserCmd* cmd) {
m_bFakeLagFix = false;
Expand All @@ -36,6 +39,16 @@ void Bunnyhop::ProcessUserCmd(CUserCmd* cmd) {
}

bool ground = (flags & (1 << 0));

if (!ground) {
if (v_bImperfect->GetBool()) {
if (g_pLocalPlayer->clazz != tf_scout) {
if (rand() % 3) cmd->buttons &= ~IN_JUMP;
else cmd->buttons |= IN_JUMP;
}
}
}

bool jump = (cmd->buttons & IN_JUMP);

if (ground) {
Expand All @@ -44,7 +57,14 @@ void Bunnyhop::ProcessUserCmd(CUserCmd* cmd) {
iTicksFlying++;
}

if (ground && jump) m_bFakeLagFix = true;
if (ground && jump) {
if (v_iPerfectJumpLimit->GetBool() && iPerfectJumps > v_iPerfectJumpLimit->GetInt()) {
iPerfectJumps = 0;
cmd->buttons &= ~IN_JUMP;
}
m_bFakeLagFix = true;
if (v_iPerfectJumpLimit->GetBool()) iPerfectJumps++;
}

if (!ground && jump) {
if (iTicksLastJump++ >= 20) cmd->buttons = cmd->buttons &~ IN_JUMP;
Expand Down
2 changes: 2 additions & 0 deletions cathook/src/hacks/Bunnyhop.h
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,8 @@ class Bunnyhop : public IHack {
virtual void ProcessUserCmd(CUserCmd*) override;

CatVar* v_bEnabled;
CatVar* v_iPerfectJumpLimit;
CatVar* v_bImperfect;
CatVar* v_bAutoJump;
CatVar* v_iAutoJumpSpeed;
bool m_bFakeLagFix;
Expand Down
66 changes: 51 additions & 15 deletions cathook/src/hacks/Misc.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -301,10 +301,14 @@ Misc::Misc() {
v_iFakeLag = new CatVar(CV_INT, "fakelag", "0", "Fakelag", NULL, "# of packets jammed", true, 25.0f);
//v_bDumpEventInfo = CreateConVar(CON_PREFIX "debug_event_info", "0", "Show event info");
CreateConCommand(CON_PREFIX "set", CC_SetValue, "Set ConVar value (if third argument is 1 the ^'s will be converted into newlines)");
if (TF2C) {
v_bTauntSlide = new CatVar(CV_SWITCH, "tauntslide", "0", "Taunt Slide", NULL, "Works only in TF2 Classic!");
v_bCritHack = new CatVar(CV_SWITCH, "crits", "0", "Crit Hack", NULL, "Works only in TF2 Classic!");
}
//v_bDebugCrits = new CatVar(CV_SWITCH, "debug_crits", "0", "Debug Crits", NULL, "???");
v_bCleanChat = new CatVar(CV_SWITCH, "clean_chat", "1", "Remove newlines from messages", NULL, "Removes newlines from messages, at least it should do that. Might be broken.");
if (TF2) c_Schema = CreateConCommand(CON_PREFIX "schema", CC_Misc_Schema, "Load item schema");
if (TF2) v_bDebugCrits = new CatVar(CV_SWITCH, "debug_crits", "0", "???", NULL, "???");
if (TF) v_bDebugCrits = new CatVar(CV_SWITCH, "debug_crits", "0", "???", NULL, "???");
//if (TF2) v_bHookInspect = new CatVar(CV_SWITCH, "hook_inspect", "0", "Hook CanInspect", NULL, "Once enabled, can't be turned off. cathook can't be unloaded after enabling it");
//interfaces::eventManager->AddListener(&listener, "player_death", false);
}
Expand Down Expand Up @@ -358,23 +362,43 @@ void Misc::ProcessUserCmd(CUserCmd* cmd) {
}
}
*/
if (TF2 && v_bDebugCrits->GetBool() && CE_GOOD(LOCAL_W)) {
if (v_bTauntSlide->GetBool())
RemoveCondition(LOCAL_E, TFCond_Taunting);
if (TF2C && v_bCritHack->GetBool() && CE_GOOD(LOCAL_W)) {
static uintptr_t CalcIsAttackCritical_s = gSignatures.GetClientSignature("55 89 E5 56 53 83 EC 10 8B 5D 08 89 1C 24 E8 ? ? ? ? 85 C0 89 C6 74 59 8B 00 89 34 24 FF 90 E0 02 00 00 84 C0 74 4A A1 ? ? ? ? 8B 40 04 3B 83 A8 09 00 00 74 3A");
typedef void(*CalcIsAttackCritical_t)(IClientEntity*);
CalcIsAttackCritical_t CIACFn = (CalcIsAttackCritical_t)(CalcIsAttackCritical_s);
if (cmd->buttons & IN_ATTACK) {
int tries = 0;
RandomSeed(MD5_PseudoRandom(cmd->command_number) & 0x7fffffff);
CIACFn(RAW_ENT(LOCAL_W));
bool crit = *(bool*)((uintptr_t)RAW_ENT(LOCAL_W) + 2454ul);
if (!crit) cmd->buttons &= ~IN_ATTACK;
/*while (!crit && tries < 50) {
tries++;
//crit = (vfunc<bool(*)(IClientEntity*)>(RAW_ENT(LOCAL_W), 1764 / 4, 0))(RAW_ENT(LOCAL_W));
}*/
}
}

if (TF && v_bDebugCrits->GetBool() && CE_GOOD(LOCAL_W)) {
//static uintptr_t helper = gSignatures.GetClientSignature("55 89 E5 81 EC 88 00 00 00 89 5D F4 8B 5D 08 89 75 F8 89 7D FC 31 FF 89 1C 24 E8 ? ? ? ? 85 C0 89 C6 74 0F 8B 00 89 34 24 FF 90 E0 02 00 00 84 C0 75 14 89 F8 8B 5D F4 8B 75 F8 8B 7D FC 89 EC 5D C3");
/*if (interfaces::gvars->curtime - lastcheck >= 1.0f) {
RandomSeed(cmd->random_seed);
ciac_s = vfunc<int(*)(IClientEntity*)>(RAW_ENT(LOCAL_W), 458, 0)(RAW_ENT(LOCAL_W));
if (ciac_s) cmd->buttons |= IN_ATTACK;
lastcheck = interfaces::gvars->curtime;
}*/
static uintptr_t critsig = gSignatures.GetClientSignature("55 89 E5 83 EC 28 89 5D F4 8B 5D 08 89 75 F8 89 7D FC 89 1C 24 E8 ? ? ? ? 85 C0 89 C6 74 60 8B 00 89 34 24 FF 90 E0 02 00 00 84 C0 74 51 A1 14 C8 F6 01 8B 40 04 3B 83 30 0B 00 00 74 41 89 83 30 0B 00 00 A1 ? ? ? ? C6 83 0F 0B 00 00 00 83 78 30 05 74 59");
typedef void(*C_TFWeaponBase__CalcIsAttackCritical_t)(IClientEntity*);
static C_TFWeaponBase__CalcIsAttackCritical_t ciac = (C_TFWeaponBase__CalcIsAttackCritical_t)critsig;
if (TF2) {
static uintptr_t critsig = gSignatures.GetClientSignature("55 89 E5 83 EC 28 89 5D F4 8B 5D 08 89 75 F8 89 7D FC 89 1C 24 E8 ? ? ? ? 85 C0 89 C6 74 60 8B 00 89 34 24 FF 90 E0 02 00 00 84 C0 74 51 A1 14 C8 F6 01 8B 40 04 3B 83 30 0B 00 00 74 41 89 83 30 0B 00 00 A1 ? ? ? ? C6 83 0F 0B 00 00 00 83 78 30 05 74 59");
typedef void(*C_TFWeaponBase__CalcIsAttackCritical_t)(IClientEntity*);
static C_TFWeaponBase__CalcIsAttackCritical_t ciac = (C_TFWeaponBase__CalcIsAttackCritical_t)critsig;
if (interfaces::gvars->curtime - lastcheck >= 1.0f) {
//RandomSeed(cmd->random_seed);
ciac(RAW_ENT(LOCAL_W));
//logging::Info("0x%08x", *(unsigned char*)(RAW_ENT(LOCAL_W) + 0x0B0E));
//ciac_s = *(int*)((uintptr_t)RAW_ENT(LOCAL_W) + 0x0B0Eu) - 256;
RandomSeed(cmd->random_seed);
//RandomSeed(cmd->random_seed);
ciac_s = vfunc<bool(*)(IClientEntity*)>(RAW_ENT(LOCAL_W), 1836 / 4, 0)(RAW_ENT(LOCAL_W));
lastcheck = interfaces::gvars->curtime;
if (ciac_s != 0) {
Expand All @@ -383,6 +407,10 @@ void Misc::ProcessUserCmd(CUserCmd* cmd) {
AddCenterString(colors::red, "Crit!");
}
}
} else if (TF2C) {


}
}
g_Settings.bSendPackets->SetValue(true);
if (v_iFakeLag->GetInt()) {
Expand Down Expand Up @@ -468,15 +496,18 @@ void Misc::Draw() {

if (CE_GOOD(g_pLocalPlayer->weapon())) {
if (v_bDebugCrits->GetBool()) {
if (!vfunc<bool(*)(IClientEntity*)>(RAW_ENT(LOCAL_W), 465, 0)(RAW_ENT(LOCAL_W)))
AddCenterString(colors::white, "Random crits are disabled");
else {
if (!vfunc<bool(*)(IClientEntity*)>(RAW_ENT(LOCAL_W), 465 + 21, 0)(RAW_ENT(LOCAL_W)))
AddCenterString(colors::white, "Weapon can't randomly crit");
else
AddCenterString(colors::white, "Weapon can randomly crit");
if (TF2) {
if (!vfunc<bool(*)(IClientEntity*)>(RAW_ENT(LOCAL_W), 465, 0)(RAW_ENT(LOCAL_W)))
AddCenterString(colors::white, "Random crits are disabled");
else {
if (!vfunc<bool(*)(IClientEntity*)>(RAW_ENT(LOCAL_W), 465 + 21, 0)(RAW_ENT(LOCAL_W)))
AddCenterString(colors::white, "Weapon can't randomly crit");
else
AddCenterString(colors::white, "Weapon can randomly crit");
}
}


}
AddSideString(colors::white, "Weapon: %s [%i]", RAW_ENT(g_pLocalPlayer->weapon())->GetClientClass()->GetName(), g_pLocalPlayer->weapon()->m_iClassID);
//AddSideString(colors::white, "flNextPrimaryAttack: %f", CE_FLOAT(g_pLocalPlayer->weapon(), netvar.flNextPrimaryAttack));
Expand All @@ -498,8 +529,13 @@ void Misc::Draw() {
AddSideString(colors::white, "Speed: %f", speed);
AddSideString(colors::white, "Gravity: %f", gravity);
AddSideString(colors::white, "CIAC: %i", ciac_s);
AddSideString(colors::white, "Last CIAC: %.2f", lastcheck);
AddSideString(colors::white, "Bucket: %.2f", *(float*)((uintptr_t)RAW_ENT(LOCAL_W) + 2612u));
if (TF2) AddSideString(colors::white, "Last CIAC: %.2f", lastcheck);
if (TF2) AddSideString(colors::white, "Bucket: %.2f", *(float*)((uintptr_t)RAW_ENT(LOCAL_W) + 2612u));
bool ciac = *(bool*)((uintptr_t)RAW_ENT(LOCAL_W) + 2454ul);
static bool ciacl = false;
if (ciac != ciacl && ciac) logging::Info("!!!");
ciacl = ciac;
if (TF2C) AddSideString(colors::white, "CAAC: %i", ciac);
//AddSideString(colors::white, "IsZoomed: %i", g_pLocalPlayer->bZoomed);
//AddSideString(colors::white, "CanHeadshot: %i", CanHeadshot());
//AddSideString(colors::white, "IsThirdPerson: %i", interfaces::iinput->CAM_IsThirdPerson());
Expand Down
2 changes: 2 additions & 0 deletions cathook/src/hacks/Misc.h
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,8 @@ class Misc : public IHack {
CatVar* v_bAntiAFK;
CatVar* v_bHookInspect;
CatVar* v_iFakeLag;
CatVar* v_bCritHack;
CatVar* v_bTauntSlide;
//ConVar* v_bDumpEventInfo;
ConCommand* c_DumpItemAttributes;
ConCommand* c_SayLine;
Expand Down
11 changes: 8 additions & 3 deletions cathook/src/helpers.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -487,9 +487,14 @@ bool GetProjectileData(CachedEntity* weapon, float& speed, float& gravity) {
} else if (weapon->m_iClassID == g_pClassID->CTFRocketLauncher) {
rspeed = 1100.0f;
} else if (weapon->m_iClassID == g_pClassID->CTFGrenadeLauncher) {
rspeed = vfunc<GetProjectileData*>(RAW_ENT(weapon), 527)(RAW_ENT(weapon));
// TODO Wrong grenade launcher gravity
rgrav = 0.5f;
if (TF2) {
rspeed = vfunc<GetProjectileData*>(RAW_ENT(weapon), 527)(RAW_ENT(weapon));
// TODO Wrong grenade launcher gravity
rgrav = 0.5f;
} else if (TF2C) {
rspeed = 1100.0f;
rgrav = 0.5f;
}
} else if (weapon->m_iClassID == g_pClassID->CTFCompoundBow) {
rspeed = vfunc<GetProjectileData*>(RAW_ENT(weapon), 527)(RAW_ENT(weapon));
rgrav = vfunc<GetProjectileData*>(RAW_ENT(weapon), 528)(RAW_ENT(weapon));
Expand Down
44 changes: 42 additions & 2 deletions cathook/src/hooks/CreateMove.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,24 @@
#include "../common.h"
#include "hookedmethods.h"

float AngleDiff( float destAngle, float srcAngle )
{
float delta;

delta = fmodf(destAngle - srcAngle, 360.0f);
if ( destAngle > srcAngle )
{
if ( delta >= 180 )
delta -= 360;
}
else
{
if ( delta <= -180 )
delta += 360;
}
return delta;
}//TODO temporary

bool CreateMove_hook(void* thisptr, float inputSample, CUserCmd* cmd) {
SEGV_BEGIN;

Expand Down Expand Up @@ -100,6 +118,27 @@ bool CreateMove_hook(void* thisptr, float inputSample, CUserCmd* cmd) {
if (g_pChatStack)
g_pChatStack->OnCreateMove();
if (CE_GOOD(g_pLocalPlayer->entity)) {
/*if (g_Settings.bRollSpeedhack->GetBool()) {
Vector vecMove( cmd->forwardmove, 0.0f, 0.0f );
float flLength = vecMove.Length();
if( flLength > 0.0f && !(cmd->buttons & IN_ATTACK) )
{
//Vector nvm = -vecMove;
Vector angMoveReverse;
VectorAngles( vecMove, angMoveReverse );
cmd->forwardmove = -flLength;
cmd->sidemove = 0.0f; // Move only backwards, no sidemove
cmd->viewangles.y = AngleDiff( cmd->viewangles.y , angMoveReverse.y ) ;
logging::Info("yaw %.2f", cmd->viewangles.y);
cmd->viewangles.y += 180.0f;
if (cmd->viewangles.y > 180.0f) cmd->viewangles.y -= 360.0f;
cmd->viewangles.z = 89.0f; // OMFG SUPER 1337 SPEEDHAQ METHODS 8)
g_pLocalPlayer->bUseSilentAngles = true;
}
}*/

if (g_pLocalPlayer->bUseSilentAngles) {
Vector vsilent(cmd->forwardmove, cmd->sidemove, cmd->upmove);
float speed = sqrt(vsilent.x * vsilent.x + vsilent.y * vsilent.y);
Expand All @@ -110,9 +149,10 @@ bool CreateMove_hook(void* thisptr, float inputSample, CUserCmd* cmd) {
cmd->sidemove = sin(yaw) * speed;
ret = false;
}
if (cmd)
g_Settings.last_angles = cmd->viewangles;
}
if (cmd)
g_Settings.last_angles = cmd->viewangles;


// PROF_END("CreateMove");
return ret;
Expand Down
Loading

0 comments on commit 36f8f27

Please sign in to comment.