Added LevelInit(), LevelShutdown()

This commit is contained in:
nullifiedcat 2017-01-16 07:36:23 +03:00
parent cf61a132c0
commit 782e32c471
26 changed files with 116 additions and 5 deletions

View File

@ -9,13 +9,13 @@
#include "common.h"
bool BitCheck(condition_data_s data, condition cond) {
if (cond > 32 * 3) {
if (cond >= 32 * 3) {
return data.cond_3 & (1 << (cond % 32));
}
if (cond > 32 * 2) {
if (cond >= 32 * 2) {
return data.cond_2 & (1 << (cond % 32));
}
if (cond > 32 * 1) {
if (cond >= 32 * 1) {
return data.cond_1 & (1 << (cond % 32));
}
return data.cond_0 & (1 << (cond));

View File

@ -167,6 +167,8 @@ void hack::Initialize() {
//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->HookMethod((void*)LevelInit_hook, hooks::offLevelInit);
hooks::hkClientMode->HookMethod((void*)LevelShutdown_hook, hooks::offLevelShutdown);
hooks::hkClientMode->Apply();
hooks::hkClient = new hooks::VMTHook();
hooks::hkClient->Init((void*)interfaces::baseClient, 0);

View File

@ -17,6 +17,12 @@
#define PAINT_TRAVERSE(x) \
g_ph##x->PaintTraverse(p, vp, fr, ar)
#define LEVEL_INIT(x, a) \
g_ph##x->LevelInit(a)
#define LEVEL_INIT(x) \
g_ph##x->LevelShutdown()
#define DELETE_HACK(x) \
delete g_ph##x

View File

@ -455,3 +455,6 @@ bool Aimbot::Aim(CachedEntity* entity, CUserCmd* cmd) {
}
return true;
}
void Aimbot::LevelInit(const char*) {}
void Aimbot::LevelShutdown() {}

View File

@ -39,3 +39,6 @@ bool Airstuck::CreateMove(void*, float, CUserCmd* cmd) {
}
void Airstuck::PaintTraverse(void*, unsigned int, bool, bool) {};
void Airstuck::LevelInit(const char*) {}
void Airstuck::LevelShutdown() {}

View File

@ -77,3 +77,6 @@ bool AntiAim::CreateMove(void*, float, CUserCmd* cmd) {
}
void AntiAim::PaintTraverse(void*, unsigned int, bool, bool) {}
void AntiAim::LevelInit(const char*) {}
void AntiAim::LevelShutdown() {}

View File

@ -34,3 +34,6 @@ void AntiDisguise::PaintTraverse(void*, unsigned int, bool, bool) {
}
bool AntiDisguise::CreateMove(void*, float, CUserCmd*) {return true;}
void AntiDisguise::LevelInit(const char*) {}
void AntiDisguise::LevelShutdown() {}

View File

@ -97,3 +97,6 @@ void AutoHeal::PaintTraverse(void*, unsigned int, bool, bool) {
//if (m_iCurrentHealingTarget >= 0)
//gEntityCache.GetEntity(m_iCurrentHealingTarget)->AddESPString(colors::white, colors::black, "Healing priority: %i", GetHealingPriority(m_iCurrentHealingTarget));
}
void AutoHeal::LevelInit(const char*) {}
void AutoHeal::LevelShutdown() {}

View File

@ -77,3 +77,5 @@ bool AutoReflect::CreateMove(void*, float, CUserCmd* cmd) {
void AutoReflect::PaintTraverse(void*, unsigned int, bool, bool) {}
void AutoReflect::LevelInit(const char*) {}
void AutoReflect::LevelShutdown() {}

View File

@ -58,3 +58,6 @@ bool AutoSticky::CreateMove(void*, float, CUserCmd* cmd) {
void AutoSticky::PaintTraverse(void*, unsigned int, bool, bool) {
}
void AutoSticky::LevelInit(const char*) {}
void AutoSticky::LevelShutdown() {}

View File

@ -33,3 +33,6 @@ bool AutoStrafe::CreateMove(void*, float, CUserCmd* cmd) {
}
void AutoStrafe::PaintTraverse(void*, unsigned int, bool, bool) {}
void AutoStrafe::LevelInit(const char*) {}
void AutoStrafe::LevelShutdown() {}

View File

@ -55,3 +55,6 @@ bool Bunnyhop::CreateMove(void* thisptr, float sampling, CUserCmd* cmd) {
}
void Bunnyhop::PaintTraverse(void*, unsigned int, bool, bool) {}
void Bunnyhop::LevelInit(const char*) {}
void Bunnyhop::LevelShutdown() {}

View File

@ -351,3 +351,6 @@ bool ESP::CreateMove(void*, float, CUserCmd*) {
}
return true;
};
void ESP::LevelInit(const char*) {}
void ESP::LevelShutdown() {}

View File

@ -398,3 +398,6 @@ FollowBot::~FollowBot() {
}
void FollowBot::PaintTraverse(void*, unsigned int, bool, bool) {}
void FollowBot::LevelInit(const char*) {}
void FollowBot::LevelShutdown() {}

View File

@ -53,3 +53,6 @@ bool HuntsmanCompensation::CreateMove(void*, float, CUserCmd* cmd) {
}
void HuntsmanCompensation::PaintTraverse(void*, unsigned int, bool, bool) {}
void HuntsmanCompensation::LevelInit(const char*) {}
void HuntsmanCompensation::LevelShutdown() {}

View File

@ -20,7 +20,9 @@ typedef unsigned int uint32;
#define DECLARE_HACK_METHODS() \
const char* GetName(); \
bool CreateMove(void*, float, CUserCmd*); \
void PaintTraverse(void*, unsigned int, bool, bool);
void PaintTraverse(void*, unsigned int, bool, bool); \
void LevelInit(const char*); \
void LevelShutdown();
#define DECLARE_HACK_SINGLETON(x) \
extern x* g_ph##x;
@ -34,6 +36,8 @@ public:
virtual const char* GetName() = 0;
inline virtual void PaintTraverse(void*, unsigned int, bool, bool) {};
inline virtual bool CreateMove(void*, float, CUserCmd*) { return true; };
inline virtual void LevelInit(const char*) {};
inline virtual void LevelShutdown() {};
// Create() and Destroy() are deprecated: use ctors and destructors instead.
//inline virtual void Create() {};
//inline virtual void Destroy() {};

View File

@ -349,3 +349,6 @@ void Misc::PaintTraverse(void*, unsigned int, bool, bool) {
//AddCenterString(draw::font_handle, interfaces::input->GetAnalogValue(AnalogCode_t::MOUSE_X), interfaces::input->GetAnalogValue(AnalogCode_t::MOUSE_Y), draw::white, L"S\u0FD5");
}
}
void Misc::LevelInit(const char*) {}
void Misc::LevelShutdown() {}

View File

@ -42,3 +42,6 @@ void SpyAlert::PaintTraverse(void*, unsigned int, bool, bool) {
}
}
}
void SpyAlert::LevelInit(const char*) {}
void SpyAlert::LevelShutdown() {}

View File

@ -142,3 +142,6 @@ Triggerbot::~Triggerbot() {
}
void Triggerbot::PaintTraverse(void*, unsigned int, bool, bool) {};
void Triggerbot::LevelInit(const char*) {}
void Triggerbot::LevelShutdown() {}

View File

@ -28,7 +28,6 @@ void BeginConVars() {
void EndConVars() {
if (hConVarsFile) fclose(hConVarsFile);
ConVar_Register();
interfaces::engineClient->ExecuteClientCmd("exec cat_autoexec");
}

View File

@ -20,6 +20,8 @@ unsigned int hooks::offSendNetMsg = 41;
unsigned int hooks::offShutdown = 37;
unsigned int hooks::offKeyEvent = 20;
unsigned int hooks::offHandleInputEvent = 78;
unsigned int hooks::offLevelInit = 23;
unsigned int hooks::offLevelShutdown = 24;
// This thing had been copypasted from somewhere, maybe from F1Public.

View File

@ -47,6 +47,8 @@ extern unsigned int offCanPacket;
extern unsigned int offSendNetMsg;
extern unsigned int offShutdown;
extern unsigned int offKeyEvent;
extern unsigned int offLevelInit;
extern unsigned int offLevelShutdown;
}

View File

@ -24,6 +24,11 @@ void PaintTraverse_hook(void* p, unsigned int vp, bool fr, bool ar) {
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.
static bool autoexec_done = false;
if (!autoexec_done) {
interfaces::engineClient->ExecuteClientCmd("exec cat_autoexec");
}
autoexec_done = true;
#if NO_IPC != true
if (g_phFollowBot->v_bEnabled->GetBool()) {
ipc_client_seg* seg_g = g_phFollowBot->m_pIPC->GetClientSegment(0);

View File

@ -17,6 +17,8 @@ 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);
typedef void(LevelInit_t)(void*, const char*);
typedef void(LevelShutdown_t)(void*);
#include "CreateMove.h"
#include "PaintTraverse.h"

View File

@ -8,6 +8,7 @@
#include "../common.h"
#include "../netmessage.h"
#include "../gui/gui.h"
#include "../hack.h"
#include "hookedmethods.h"
bool CanPacket_hook(void* thisptr) {
@ -128,3 +129,45 @@ void OverrideView_hook(void* thisptr, CViewSetup* setup) {
bool DispatchUserMessage_hook(void* thisptr, int type, bf_read& buf) {
return ((DispatchUserMessage_t*)hooks::hkClient->GetMethod(hooks::offFrameStageNotify + 1))(thisptr, type, buf);
}
void LevelInit_hook(void* thisptr, const char* newmap) {
((LevelInit_t*) hooks::hkClientMode->GetMethod(hooks::offLevelInit))(thisptr, newmap);
logging::Info("LevelInit %s", newmap);
LEVEL_INIT(Aimbot, newmap);
LEVEL_INIT(Airstuck, newmap);
LEVEL_INIT(AntiAim, newmap);
LEVEL_INIT(AntiDisguise, newmap);
LEVEL_INIT(AutoHeal, newmap);
LEVEL_INIT(AutoReflect, newmap);
LEVEL_INIT(AutoSticky, newmap);
LEVEL_INIT(AutoStrafe, newmap);
LEVEL_INIT(Bunnyhop, newmap);
LEVEL_INIT(ESP, newmap);
// LEVEL_SHUTDOWN(FollowBot);
LEVEL_INIT(Misc, newmap);
LEVEL_INIT(SpyAlert, newmap);
LEVEL_INIT(Triggerbot, newmap);
}
void LevelShutdown_hook(void* thisptr) {
((LevelShutdown_t*) hooks::hkClientMode->GetMethod(hooks::offLevelShutdown))(thisptr);
g_Settings.bInvalid = true;
logging::Info("LevelShutdown");
LEVEL_SHUTDOWN(Aimbot);
LEVEL_SHUTDOWN(Airstuck);
LEVEL_SHUTDOWN(AntiAim);
LEVEL_SHUTDOWN(AntiDisguise);
LEVEL_SHUTDOWN(AutoHeal);
LEVEL_SHUTDOWN(AutoReflect);
LEVEL_SHUTDOWN(AutoSticky);
LEVEL_SHUTDOWN(AutoStrafe);
LEVEL_SHUTDOWN(Bunnyhop);
LEVEL_SHUTDOWN(ESP);
// LEVEL_SHUTDOWN(FollowBot);
LEVEL_SHUTDOWN(Misc);
LEVEL_SHUTDOWN(SpyAlert);
LEVEL_SHUTDOWN(Triggerbot);
}

View File

@ -19,5 +19,7 @@ void Shutdown_hook(void*, const char*);
void OverrideView_hook(void*, CViewSetup*);
bool DispatchUserMessage_hook(void*, int, bf_read&);
void FrameStageNotify_hook(void*, int);
void LevelInit_hook(void*, const char*);
void LevelShutdown_hook(void*);
#endif /* OTHERS_H_ */