some small changes + MASSIVELY reduced fps impact from ESP PT
This commit is contained in:
parent
61189c1bce
commit
f242881735
@ -36,6 +36,7 @@
|
||||
#include <unordered_map>
|
||||
#include <algorithm>
|
||||
#include "aftercheaders.h"
|
||||
#include "profiler.h"
|
||||
#include "offsets.hpp"
|
||||
#include "drawing.h"
|
||||
#include "resource.hpp"
|
||||
|
@ -23,14 +23,14 @@ bool CritKeyDown() {
|
||||
}
|
||||
|
||||
bool AllowAttacking() {
|
||||
if (!(CritKeyDown() || ((GetWeaponMode(LOCAL_E) == weapon_melee) && hacks::shared::misc::crit_melee)) && !hacks::shared::misc::crit_suppress) return true;
|
||||
if (!(CritKeyDown() || ((GetWeaponMode() == weapon_melee) && hacks::shared::misc::crit_melee)) && !hacks::shared::misc::crit_suppress) return true;
|
||||
bool crit = IsAttackACrit(g_pUserCmd);
|
||||
LoadSavedState();
|
||||
if (hacks::shared::misc::crit_suppress && !(CritKeyDown() || ((GetWeaponMode(LOCAL_E) == weapon_melee) && hacks::shared::misc::crit_melee))) {
|
||||
if (hacks::shared::misc::crit_suppress && !(CritKeyDown() || ((GetWeaponMode() == weapon_melee) && hacks::shared::misc::crit_melee))) {
|
||||
if (crit && !IsPlayerCritBoosted(LOCAL_E)) {
|
||||
return false;
|
||||
}
|
||||
} else if ((CritKeyDown() || ((GetWeaponMode(LOCAL_E) == weapon_melee) && hacks::shared::misc::crit_melee)) && RandomCrits() && WeaponCanCrit() && (g_pLocalPlayer->weapon()->m_iClassID != g_pClassID->CTFKnife)) {
|
||||
} else if ((CritKeyDown() || ((GetWeaponMode() == weapon_melee) && hacks::shared::misc::crit_melee)) && RandomCrits() && WeaponCanCrit() && (g_pLocalPlayer->weapon()->m_iClassID != g_pClassID->CTFKnife)) {
|
||||
if (!crit) return false;
|
||||
}
|
||||
return true;
|
||||
@ -127,7 +127,7 @@ bool IsAttackACrit(CUserCmd* cmd) {
|
||||
int b = LOCAL_E->m_IDX;
|
||||
rseed = rseed ^ (b | c);
|
||||
RandomSeed(rseed);
|
||||
if (GetWeaponMode(LOCAL_E) == weapon_melee) {
|
||||
if (GetWeaponMode() == weapon_melee) {
|
||||
*(float*)((uintptr_t)RAW_ENT(LOCAL_W) + 2612u) = 1000.0f;
|
||||
}
|
||||
state.Save(weapon);
|
||||
|
@ -176,7 +176,7 @@ void CreateMove() {
|
||||
if (CE_BAD(ent)) continue;
|
||||
tg = TargetState(ent);
|
||||
if (tg == EAimbotTargetState::GOOD) {
|
||||
if (GetWeaponMode(g_pLocalPlayer->entity) == weaponmode::weapon_melee || (int)priority_mode == 2) {
|
||||
if (GetWeaponMode() == weaponmode::weapon_melee || (int)priority_mode == 2) {
|
||||
scr = 4096.0f - calculated_data_array[i].aim_position.DistTo(g_pLocalPlayer->v_Eye);
|
||||
if (scr > target_highest_score) {
|
||||
target_highest_score = scr;
|
||||
@ -199,11 +199,7 @@ void CreateMove() {
|
||||
}
|
||||
} break;
|
||||
case 3: {
|
||||
if (ent->m_Type == ENTITY_BUILDING) {
|
||||
scr = 450.0f - CE_INT(ent, netvar.iBuildingHealth);
|
||||
} else {
|
||||
scr = 450.0f - CE_INT(ent, netvar.iHealth);
|
||||
}
|
||||
scr = 450.0f - ent->m_iHealth;
|
||||
if (scr > target_highest_score) {
|
||||
target_highest_score = scr;
|
||||
target_highest = ent;
|
||||
@ -331,7 +327,7 @@ EAimbotTargetState TargetState(CachedEntity* entity) {
|
||||
if (ignore_taunting && HasCondition<TFCond_Taunting>(entity)) return EAimbotTargetState::TAUNTING;
|
||||
if (IsPlayerInvulnerable(entity)) return EAimbotTargetState::INVULNERABLE;
|
||||
if (respect_cloak && IsPlayerInvisible(entity)) return EAimbotTargetState::INVISIBLE;
|
||||
mode = GetWeaponMode(LOCAL_E);
|
||||
mode = GetWeaponMode();
|
||||
if (mode == weaponmode::weapon_hitscan || LOCAL_W->m_iClassID == g_pClassID->CTFCompoundBow)
|
||||
if (respect_vaccinator && HasCondition<TFCond_UberBulletResist>(entity)) return EAimbotTargetState::VACCINATED;
|
||||
}
|
||||
@ -489,7 +485,7 @@ bool Aim(CachedEntity* entity) {
|
||||
g_pLocalPlayer->bUseSilentAngles = true;
|
||||
}
|
||||
if (autoshoot) {
|
||||
if (g_pLocalPlayer->clazz == tf_class::tf_sniper) {
|
||||
if (TF && g_pLocalPlayer->clazz == tf_class::tf_sniper) {
|
||||
if (g_pLocalPlayer->weapon()->m_iClassID == g_pClassID->CTFSniperRifle || g_pLocalPlayer->weapon()->m_iClassID == g_pClassID->CTFSniperRifleDecap) {
|
||||
if (zoomed_only && !CanHeadshot()) return true;
|
||||
}
|
||||
@ -511,7 +507,7 @@ bool Aim(CachedEntity* entity) {
|
||||
}
|
||||
|
||||
//Tell reset conds to function
|
||||
if (instant_rezoom_enabled) {
|
||||
if (TF && instant_rezoom_enabled) {
|
||||
if (attack && g_pLocalPlayer->bZoomed && !instant_rezoom_shoot) {
|
||||
instant_rezoom_shoot = true;
|
||||
}
|
||||
@ -571,7 +567,7 @@ bool UpdateAimkey() {
|
||||
|
||||
|
||||
float EffectiveTargetingRange() {
|
||||
if (GetWeaponMode(g_pLocalPlayer->weapon()) == weapon_melee) {
|
||||
if (GetWeaponMode() == weapon_melee) {
|
||||
return 100.0f;
|
||||
}
|
||||
return (float)max_range;
|
||||
@ -605,13 +601,13 @@ EAimbotLocalState ShouldAim() {
|
||||
// Miniguns should shoot and aim continiously. TODO smg
|
||||
if (g_pLocalPlayer->weapon()->m_iClassID != g_pClassID->CTFMinigun) {
|
||||
// Melees are weird, they should aim continiously like miniguns too.
|
||||
if (GetWeaponMode(g_pLocalPlayer->entity) != weaponmode::weapon_melee) {
|
||||
if (GetWeaponMode() != weaponmode::weapon_melee) {
|
||||
// Finally, CanShoot() check.
|
||||
if (!CanShoot()) return EAimbotLocalState::CANT_SHOOT;
|
||||
}
|
||||
}
|
||||
}
|
||||
switch (GetWeaponMode(g_pLocalPlayer->entity)) {
|
||||
switch (GetWeaponMode()) {
|
||||
case weapon_hitscan:
|
||||
case weapon_melee:
|
||||
break;
|
||||
@ -683,7 +679,7 @@ int BestHitbox(CachedEntity* target) {
|
||||
flags = CE_INT(target, netvar.iFlags);
|
||||
ground = (flags & (1 << 0));
|
||||
if (!ground) {
|
||||
if (GetWeaponMode(g_pLocalPlayer->entity) == weaponmode::weapon_projectile) {
|
||||
if (GetWeaponMode() == weaponmode::weapon_projectile) {
|
||||
if (g_pLocalPlayer->weapon()->m_iClassID != g_pClassID->CTFCompoundBow) {
|
||||
preferred = hitbox_t::spine_3;
|
||||
}
|
||||
|
@ -167,7 +167,7 @@ bool ShouldAA(CUserCmd* cmd) {
|
||||
}
|
||||
}
|
||||
if ((cmd->buttons & IN_ATTACK2) && g_pLocalPlayer->weapon()->m_iClassID == g_pClassID->CTFLunchBox) return false;
|
||||
switch (GetWeaponMode(g_pLocalPlayer->entity)) {
|
||||
switch (GetWeaponMode()) {
|
||||
case weapon_projectile:
|
||||
if (g_pLocalPlayer->weapon()->m_iClassID == g_pClassID->CTFCompoundBow) {
|
||||
if (!(cmd->buttons & IN_ATTACK)) {
|
||||
|
@ -280,7 +280,7 @@ void CreateMove() {
|
||||
}
|
||||
}
|
||||
if (!enabled && !force_healing_target) return;
|
||||
if (GetWeaponMode(g_pLocalPlayer->entity) != weapon_medigun) return;
|
||||
if (GetWeaponMode() != weapon_medigun) return;
|
||||
if (force_healing_target) {
|
||||
CachedEntity* target = ENTITY(force_healing_target);
|
||||
if (CE_GOOD(target)) {
|
||||
|
@ -53,6 +53,7 @@ void ResetEntityStrings() {
|
||||
for (auto& i : data) {
|
||||
i.string_count = 0;
|
||||
i.color = 0;
|
||||
i.needs_paint = false;
|
||||
}
|
||||
}
|
||||
|
||||
@ -65,14 +66,18 @@ void AddEntityString(CachedEntity* entity, const std::string& string, int color)
|
||||
entity_data.strings[entity_data.string_count].data = string;
|
||||
entity_data.strings[entity_data.string_count].color = color;
|
||||
entity_data.string_count++;
|
||||
entity_data.needs_paint = true;
|
||||
}
|
||||
|
||||
std::vector<int> entities_need_repaint {};
|
||||
|
||||
void CreateMove() {
|
||||
int limit;
|
||||
static int max_clients = g_IEngine->GetMaxClients();
|
||||
CachedEntity* ent;
|
||||
|
||||
ResetEntityStrings();
|
||||
entities_need_repaint.clear();
|
||||
limit = HIGHEST_ENTITY;
|
||||
if (!buildings && !proj_esp && !item_esp) limit = min(max_clients, HIGHEST_ENTITY);
|
||||
for (int i = 0; i < limit; i++) {
|
||||
@ -84,15 +89,12 @@ void CreateMove() {
|
||||
AddEntityString(ent, format((int)(ENTITY(i)->m_flDistance / 64 * 1.22f), 'm'));
|
||||
}
|
||||
}
|
||||
if (data[ent->m_IDX].needs_paint) entities_need_repaint.push_back(ent->m_IDX);
|
||||
}
|
||||
}
|
||||
|
||||
void Draw() {
|
||||
int limit;
|
||||
static int max_clients = g_IEngine->GetMaxClients();
|
||||
limit = HIGHEST_ENTITY;
|
||||
if (!buildings && !proj_esp && !item_esp) limit = min(max_clients, HIGHEST_ENTITY);
|
||||
for (int i = 0; i < limit; i++) {
|
||||
for (auto& i : entities_need_repaint) {
|
||||
ProcessEntityPT(ENTITY(i));
|
||||
}
|
||||
}
|
||||
@ -109,6 +111,7 @@ static CatVar esp_3d_box_nodraw(CV_SWITCH, "esp_3d_box_nodraw", "0", "Invisible
|
||||
static CatVar esp_3d_box_healthbar(CV_SWITCH, "esp_3d_box_healthbar", "1", "Health bar", "Adds a health bar to the esp");
|
||||
|
||||
void Draw3DBox(CachedEntity* ent, int clr, bool healthbar, int health, int healthmax) {
|
||||
PROF_SECTION(PT_esp_draw3dbox);
|
||||
Vector mins, maxs;
|
||||
Vector points_r[8];
|
||||
Vector points[8];
|
||||
@ -228,6 +231,7 @@ static CatVar box_nodraw(CV_SWITCH, "esp_box_nodraw", "0", "Invisible 2D Box", "
|
||||
static CatVar box_expand(CV_INT, "esp_box_expand", "0", "Expand 2D Box", "Expand 2D box by N units");
|
||||
|
||||
void DrawBox(CachedEntity* ent, int clr, float widthFactor, float addHeight, bool healthbar, int health, int healthmax) {
|
||||
PROF_SECTION(PT_esp_drawbox);
|
||||
Vector min, max, origin, so, omin, omax, smin, smax;
|
||||
float height, width, trf;
|
||||
bool cloak;
|
||||
@ -304,17 +308,19 @@ void DrawBox(CachedEntity* ent, int clr, float widthFactor, float addHeight, boo
|
||||
}
|
||||
|
||||
void ProcessEntity(CachedEntity* ent) {
|
||||
static const model_t* model;
|
||||
static int string_count_backup, level, pclass;
|
||||
static bool shown;
|
||||
static player_info_s info;
|
||||
static powerup_type power;
|
||||
static CachedEntity* weapon;
|
||||
static const char* weapon_name;
|
||||
const model_t* model;
|
||||
int string_count_backup, level, pclass;
|
||||
bool shown;
|
||||
player_info_s info;
|
||||
powerup_type power;
|
||||
CachedEntity* weapon;
|
||||
const char* weapon_name;
|
||||
|
||||
if (!enabled) return;
|
||||
if (CE_BAD(ent)) return;
|
||||
|
||||
ESPData& espdata = data[ent->m_IDX];
|
||||
|
||||
if (entity_info) {
|
||||
AddEntityString(ent, format(RAW_ENT(ent)->GetClientClass()->m_pNetworkName, " [", ent->m_iClassID, "]"));
|
||||
if (entity_id) {
|
||||
@ -418,6 +424,7 @@ void ProcessEntity(CachedEntity* ent) {
|
||||
if (show_health) {
|
||||
AddEntityString(ent, format(ent->m_iHealth, '/', ent->m_iMaxHealth, " HP"), colors::Health(ent->m_iHealth, ent->m_iMaxHealth));
|
||||
}
|
||||
espdata.needs_paint = true;
|
||||
return;
|
||||
} else if (ent->m_Type == ENTITY_PLAYER && ent->m_bAlivePlayer) {
|
||||
if (!(local_esp && g_IInput->CAM_IsThirdPerson()) &&
|
||||
@ -482,6 +489,7 @@ void ProcessEntity(CachedEntity* ent) {
|
||||
if (weapon_name) AddEntityString(ent, std::string(weapon_name));
|
||||
}
|
||||
}
|
||||
espdata.needs_paint = true;
|
||||
}
|
||||
return;
|
||||
}
|
||||
@ -490,19 +498,23 @@ void ProcessEntity(CachedEntity* ent) {
|
||||
static CatVar esp_3d_box(CV_SWITCH, "esp_3d_box", "0", "3D box");
|
||||
static CatVar box_healthbar(CV_SWITCH, "esp_box_healthbar", "1", "Box Healthbar");
|
||||
|
||||
/*
|
||||
* According to profiler, this function is the most time-consuming (and gets called up to 200K times a second)
|
||||
*/
|
||||
|
||||
void ProcessEntityPT(CachedEntity* ent) {
|
||||
static int fg, color;
|
||||
static bool transparent, cloak, origin_is_zero;
|
||||
static Vector screen, origin_screen, draw_point;
|
||||
PROF_SECTION(PT_esp_process_entity);
|
||||
|
||||
int fg, color;
|
||||
bool transparent, cloak, origin_is_zero;
|
||||
Vector screen, origin_screen, draw_point;
|
||||
|
||||
if (!enabled) return;
|
||||
if (CE_BAD(ent)) return;
|
||||
|
||||
|
||||
transparent = false;
|
||||
|
||||
if (!(local_esp && g_IInput->CAM_IsThirdPerson()) &&
|
||||
ent->m_IDX == g_IEngine->GetLocalPlayer()) return;
|
||||
//if (!(local_esp && g_IInput->CAM_IsThirdPerson()) &&
|
||||
// ent->m_IDX == g_IEngine->GetLocalPlayer()) return;
|
||||
|
||||
const ESPData& ent_data = data[ent->m_IDX];
|
||||
fg = ent_data.color;
|
||||
@ -513,15 +525,8 @@ void ProcessEntityPT(CachedEntity* ent) {
|
||||
switch (ent->m_Type) {
|
||||
case ENTITY_PLAYER: {
|
||||
cloak = IsPlayerInvisible(ent);
|
||||
if (legit && ent->m_iTeam != g_pLocalPlayer->team && playerlist::IsDefault(ent)) {
|
||||
if (cloak) return;
|
||||
/*if (ent->m_lLastSeen > v_iLegitSeenTicks->GetInt()) {
|
||||
return;
|
||||
}*/
|
||||
}
|
||||
|
||||
if (!ent->m_bEnemy && !teammates && playerlist::IsDefault(ent)) break;
|
||||
if (!ent->m_bAlivePlayer) break;
|
||||
//if (!ent->m_bEnemy && !teammates && playerlist::IsDefault(ent)) break;
|
||||
//if (!ent->m_bAlivePlayer) break;
|
||||
if (vischeck && !ent->IsVisible()) transparent = true;
|
||||
if (!fg) fg = colors::EntityF(ent);
|
||||
if (transparent) fg = colors::Transparent(fg);
|
||||
@ -533,11 +538,6 @@ void ProcessEntityPT(CachedEntity* ent) {
|
||||
break;
|
||||
}
|
||||
case ENTITY_BUILDING: {
|
||||
if (legit && ent->m_iTeam != g_pLocalPlayer->team) {
|
||||
/*if (ent->m_lLastSeen > v_iLegitSeenTicks->GetInt()) {
|
||||
return;
|
||||
}*/
|
||||
}
|
||||
if (CE_INT(ent, netvar.iTeamNum) == g_pLocalPlayer->team && !teammates) break;
|
||||
if (!transparent && vischeck && !ent->IsVisible()) transparent = true;
|
||||
if (!fg) fg = colors::EntityF(ent);
|
||||
@ -553,6 +553,7 @@ void ProcessEntityPT(CachedEntity* ent) {
|
||||
}
|
||||
|
||||
if (ent_data.string_count) {
|
||||
PROF_SECTION(PT_esp_drawstrings);
|
||||
origin_is_zero = !box_esp || ent_data.esp_origin.IsZero(1.0f);
|
||||
if (vischeck && !ent->IsVisible()) transparent = true;
|
||||
draw_point = origin_is_zero ? screen : ent_data.esp_origin;
|
||||
|
@ -8,7 +8,7 @@
|
||||
#ifndef HESP_H_
|
||||
#define HESP_H_
|
||||
|
||||
#include "IHack.h"
|
||||
#include "../common.h"
|
||||
|
||||
class ConVar;
|
||||
class CachedEntity;
|
||||
@ -67,19 +67,20 @@ public:
|
||||
int string_count { 0 };
|
||||
std::array<ESPString, 16> strings {};
|
||||
Vector esp_origin { 0, 0, 0 };
|
||||
bool needs_paint { false };
|
||||
};
|
||||
|
||||
extern std::array<ESPData, 2048> data;
|
||||
void ResetEntityStrings();
|
||||
void AddEntityString(CachedEntity* entity, const std::string& string, int color = 0x0);
|
||||
void AddEntityString(CachedEntity* entity, const std::string& string, int color = 0x0) _FASTCALL;
|
||||
void SetEntityColor(CachedEntity* entity, int color);
|
||||
|
||||
void CreateMove();
|
||||
void Draw();
|
||||
|
||||
void DrawBox(CachedEntity* ent, int clr, float widthFactor, float addHeight, bool healthbar, int health, int healthmax);
|
||||
void ProcessEntity(CachedEntity* ent);
|
||||
void ProcessEntityPT(CachedEntity* ent);
|
||||
void DrawBox(CachedEntity* ent, int clr, float widthFactor, float addHeight, bool healthbar, int health, int healthmax) _FASTCALL;
|
||||
void ProcessEntity(CachedEntity* ent) _FASTCALL;
|
||||
void ProcessEntityPT(CachedEntity* ent) _FASTCALL;
|
||||
|
||||
}}}
|
||||
|
||||
|
@ -37,7 +37,7 @@ trace_t trace_object;
|
||||
|
||||
void CreateMove() {
|
||||
if (!enabled) return;
|
||||
if (GetWeaponMode(g_pLocalPlayer->entity) != weapon_hitscan) return;
|
||||
if (GetWeaponMode() != weapon_hitscan) return;
|
||||
if (ambassador) {
|
||||
if (IsAmbassador(g_pLocalPlayer->weapon())) {
|
||||
if ((g_GlobalVars->curtime - CE_FLOAT(g_pLocalPlayer->weapon(), netvar.flLastFireTime)) <= 1.0) {
|
||||
|
@ -395,28 +395,6 @@ float DistToSqr(CachedEntity* entity) {
|
||||
return g_pLocalPlayer->v_Origin.DistToSqr(entity->m_vecOrigin);
|
||||
}
|
||||
|
||||
bool IsMeleeWeapon(CachedEntity* ent) {
|
||||
|
||||
if (ent->m_iClassID == g_pClassID->CTFBat ||
|
||||
ent->m_iClassID == g_pClassID->CTFBat_Fish ||
|
||||
ent->m_iClassID == g_pClassID->CTFBat_Giftwrap ||
|
||||
ent->m_iClassID == g_pClassID->CTFBat_Wood ||
|
||||
ent->m_iClassID == g_pClassID->CTFShovel ||
|
||||
ent->m_iClassID == g_pClassID->CTFKatana ||
|
||||
ent->m_iClassID == g_pClassID->CTFFireAxe ||
|
||||
ent->m_iClassID == g_pClassID->CTFBottle ||
|
||||
ent->m_iClassID == g_pClassID->CTFSword ||
|
||||
ent->m_iClassID == g_pClassID->CTFFists ||
|
||||
ent->m_iClassID == g_pClassID->CTFWrench ||
|
||||
ent->m_iClassID == g_pClassID->CTFRobotArm ||
|
||||
ent->m_iClassID == g_pClassID->CTFKnife ||
|
||||
ent->m_iClassID == g_pClassID->CTFBonesaw ||
|
||||
ent->m_iClassID == g_pClassID->CTFClub) {
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
void Patch(void* address, void* patch, size_t length) {
|
||||
void* page = (void*)((uintptr_t)address &~ 0xFFF);
|
||||
mprotect(page, 0xFFF, PROT_WRITE | PROT_EXEC);
|
||||
@ -430,12 +408,12 @@ bool IsProjectileCrit(CachedEntity* ent) {
|
||||
return CE_BYTE(ent, netvar.Rocket_bCritical);
|
||||
}
|
||||
|
||||
weaponmode GetWeaponMode(CachedEntity* player) {
|
||||
weaponmode GetWeaponMode() {
|
||||
int weapon_handle, slot;
|
||||
CachedEntity *weapon;
|
||||
|
||||
if (CE_BAD(player)) return weapon_invalid;
|
||||
weapon_handle = CE_INT(player, netvar.hActiveWeapon);
|
||||
if (CE_BAD(LOCAL_E)) return weapon_invalid;
|
||||
weapon_handle = CE_INT(LOCAL_E, netvar.hActiveWeapon);
|
||||
if (IDX_BAD((weapon_handle & 0xFFF))) {
|
||||
//logging::Info("IDX_BAD: %i", weapon_handle & 0xFFF);
|
||||
return weaponmode::weapon_invalid;
|
||||
|
@ -73,7 +73,7 @@ powerup_type GetPowerupOnPlayer(CachedEntity* player);
|
||||
// It's better if it won't create a new object each time it gets called.
|
||||
// So it returns a success state, and the values are stored in out reference.
|
||||
bool GetHitbox(CachedEntity* entity, int hb, Vector& out);
|
||||
weaponmode GetWeaponMode(CachedEntity* player);
|
||||
weaponmode GetWeaponMode();
|
||||
|
||||
void FixMovement(CUserCmd& cmd, Vector& viewangles);
|
||||
void VectorAngles(Vector &forward, Vector &angles);
|
||||
@ -106,7 +106,6 @@ void AimAtHitbox(CachedEntity* ent, int hitbox, CUserCmd* cmd);
|
||||
|
||||
std::string WordWrap(std::string& in, int max, unsigned long font);
|
||||
|
||||
bool IsMeleeWeapon(CachedEntity* ent);
|
||||
bool IsProjectileCrit(CachedEntity* ent);
|
||||
|
||||
QAngle VectorToQAngle(Vector in);
|
||||
|
@ -135,8 +135,14 @@ bool CreateMove_hook(void* thisptr, float inputSample, CUserCmd* cmd) {
|
||||
SAFE_CALL(entity_cache::Update());
|
||||
}
|
||||
// PROF_END("Entity Cache updating");
|
||||
SAFE_CALL(g_pPlayerResource->Update());
|
||||
SAFE_CALL(g_pLocalPlayer->Update());
|
||||
{
|
||||
PROF_SECTION(CM_PlayerResource);
|
||||
SAFE_CALL(g_pPlayerResource->Update());
|
||||
}
|
||||
{
|
||||
PROF_SECTION(CM_LocalPlayer);
|
||||
SAFE_CALL(g_pLocalPlayer->Update());
|
||||
}
|
||||
g_Settings.bInvalid = false;
|
||||
// Disabled because this causes EXTREME aimbot inaccuracy
|
||||
//if (!cmd->command_number) return ret;
|
||||
@ -196,39 +202,80 @@ bool CreateMove_hook(void* thisptr, float inputSample, CUserCmd* cmd) {
|
||||
ResetCritHack();
|
||||
if (TF2) SAFE_CALL(UpdateHoovyList());
|
||||
g_pLocalPlayer->v_OrigViewangles = cmd->viewangles;
|
||||
// PROF_BEGIN();
|
||||
//RunEnginePrediction(g_pLocalPlayer->entity, cmd);
|
||||
SAFE_CALL(hacks::shared::esp::CreateMove());
|
||||
{
|
||||
PROF_SECTION(CM_esp);
|
||||
SAFE_CALL(hacks::shared::esp::CreateMove());
|
||||
}
|
||||
if (!g_pLocalPlayer->life_state && CE_GOOD(g_pLocalPlayer->weapon())) {
|
||||
if (TF) SAFE_CALL(hacks::tf::uberspam::CreateMove());
|
||||
if (TF2) SAFE_CALL(hacks::tf2::antibackstab::CreateMove());
|
||||
if (TF2) SAFE_CALL(hacks::tf2::noisemaker::CreateMove());
|
||||
SAFE_CALL(hacks::shared::bunnyhop::CreateMove());
|
||||
SAFE_CALL(hacks::shared::aimbot::CreateMove());
|
||||
SAFE_CALL(hacks::shared::antiaim::ProcessUserCmd(cmd));
|
||||
if (TF) SAFE_CALL(hacks::tf::autosticky::CreateMove());
|
||||
if (TF) SAFE_CALL(hacks::tf::autoreflect::CreateMove());
|
||||
SAFE_CALL(hacks::shared::triggerbot::CreateMove());
|
||||
if (TF) SAFE_CALL(hacks::tf::autoheal::CreateMove());
|
||||
if (TF2) SAFE_CALL(hacks::tf2::autobackstab::CreateMove());
|
||||
if (TF) {
|
||||
PROF_SECTION(CM_uberspam);
|
||||
SAFE_CALL(hacks::tf::uberspam::CreateMove());
|
||||
}
|
||||
if (TF2) {
|
||||
PROF_SECTION(CM_antibackstab);
|
||||
SAFE_CALL(hacks::tf2::antibackstab::CreateMove());
|
||||
}
|
||||
if (TF2) {
|
||||
PROF_SECTION(CM_noisemaker);
|
||||
SAFE_CALL(hacks::tf2::noisemaker::CreateMove());
|
||||
}
|
||||
{
|
||||
PROF_SECTION(CM_bunnyhop);
|
||||
SAFE_CALL(hacks::shared::bunnyhop::CreateMove());
|
||||
}
|
||||
{
|
||||
PROF_SECTION(CM_aimbot);
|
||||
SAFE_CALL(hacks::shared::aimbot::CreateMove());
|
||||
}
|
||||
{
|
||||
PROF_SECTION(CM_antiaim);
|
||||
SAFE_CALL(hacks::shared::antiaim::ProcessUserCmd(cmd));
|
||||
}
|
||||
if (TF) {
|
||||
PROF_SECTION(CM_autosticky);
|
||||
SAFE_CALL(hacks::tf::autosticky::CreateMove());
|
||||
}
|
||||
if (TF) {
|
||||
PROF_SECTION(CM_autoreflect);
|
||||
SAFE_CALL(hacks::tf::autoreflect::CreateMove());
|
||||
}
|
||||
{
|
||||
PROF_SECTION(CM_triggerbot);
|
||||
SAFE_CALL(hacks::shared::triggerbot::CreateMove());
|
||||
}
|
||||
if (TF) {
|
||||
PROF_SECTION(CM_autoheal);
|
||||
SAFE_CALL(hacks::tf::autoheal::CreateMove());
|
||||
}
|
||||
if (TF2) {
|
||||
PROF_SECTION(CM_autobackstab);
|
||||
SAFE_CALL(hacks::tf2::autobackstab::CreateMove());
|
||||
}
|
||||
}
|
||||
{
|
||||
PROF_SECTION(CM_misc);
|
||||
SAFE_CALL(hacks::shared::misc::CreateMove());
|
||||
}
|
||||
{
|
||||
PROF_SECTION(CM_spam);
|
||||
SAFE_CALL(hacks::shared::spam::CreateMove());
|
||||
}
|
||||
//SAFE_CALL(CREATE_MOVE(FollowBot));
|
||||
SAFE_CALL(hacks::shared::misc::CreateMove());
|
||||
SAFE_CALL(hacks::shared::spam::CreateMove());
|
||||
// PROF_END("Hacks processing");
|
||||
if (time_replaced) g_GlobalVars->curtime = curtime_old;
|
||||
}
|
||||
/*for (IHack* i_hack : hack::hacks) {
|
||||
if (!i_hack->CreateMove(thisptr, inputSample, cmd)) {
|
||||
ret = false;
|
||||
}
|
||||
}*/
|
||||
if (time_replaced) g_GlobalVars->curtime = curtime_old;
|
||||
g_Settings.bInvalid = false;
|
||||
chat_stack::OnCreateMove();
|
||||
hacks::shared::lagexploit::CreateMove();
|
||||
{
|
||||
PROF_SECTION(CM_chat_stack);
|
||||
chat_stack::OnCreateMove();
|
||||
}
|
||||
{
|
||||
PROF_SECTION(CM_lagexploit);
|
||||
hacks::shared::lagexploit::CreateMove();
|
||||
}
|
||||
|
||||
// TODO Auto Steam Friend
|
||||
|
||||
if (g_GlobalVars->framecount % 1000 == 0) {
|
||||
PROF_SECTION(CM_playerlist);
|
||||
playerlist::DoNotKillMe();
|
||||
#ifdef IPC_ENABLED
|
||||
ipc::UpdatePlayerlist();
|
||||
@ -267,6 +314,7 @@ bool CreateMove_hook(void* thisptr, float inputSample, CUserCmd* cmd) {
|
||||
}
|
||||
#ifdef IPC_ENABLED
|
||||
if (CE_GOOD(g_pLocalPlayer->entity) && !g_pLocalPlayer->life_state) {
|
||||
PROF_SECTION(CM_followbot);
|
||||
SAFE_CALL(hacks::shared::followbot::AfterCreateMove());
|
||||
}
|
||||
#endif
|
||||
|
@ -46,7 +46,6 @@ void PaintTraverse_hook(void* _this, unsigned int vp, bool fr, bool ar) {
|
||||
if (!segvcatch::handler_segv) segvcatch::init_fpe();
|
||||
}
|
||||
#endif
|
||||
SEGV_BEGIN;
|
||||
if (!textures_loaded) {
|
||||
textures_loaded = true;
|
||||
hacks::tf::radar::Init();
|
||||
@ -91,7 +90,8 @@ void PaintTraverse_hook(void* _this, unsigned int vp, bool fr, bool ar) {
|
||||
if (call_default) SAFE_CALL(original(_this, vp, fr, ar));
|
||||
// To avoid threading problems.
|
||||
|
||||
PROF_SECTION(PaintTraverse);
|
||||
PROF_SECTION(PT_total);
|
||||
|
||||
if (vp == panel_top) draw_flag = true;
|
||||
if (!cathook) return;
|
||||
|
||||
@ -130,6 +130,7 @@ void PaintTraverse_hook(void* _this, unsigned int vp, bool fr, bool ar) {
|
||||
draw_flag = false;
|
||||
|
||||
if (!hack::command_stack().empty()) {
|
||||
PROF_SECTION(PT_command_stack);
|
||||
std::lock_guard<std::mutex> guard(hack::command_stack_mutex);
|
||||
while (!hack::command_stack().empty()) {
|
||||
logging::Info("executing %s", hack::command_stack().top().c_str());
|
||||
@ -142,7 +143,10 @@ void PaintTraverse_hook(void* _this, unsigned int vp, bool fr, bool ar) {
|
||||
|
||||
if (clean_screenshots && g_IEngine->IsTakingScreenshot()) return;
|
||||
|
||||
PROF_SECTION(PT_active);
|
||||
|
||||
if (info_text) {
|
||||
PROF_SECTION(PT_info_text);
|
||||
AddSideString("cathook by nullifiedcat", colors::RainbowCurrent());
|
||||
AddSideString(hack::GetVersion(), GUIColor());
|
||||
#if NOGUI != 1
|
||||
@ -167,12 +171,31 @@ void PaintTraverse_hook(void* _this, unsigned int vp, bool fr, bool ar) {
|
||||
}
|
||||
|
||||
if (CE_GOOD(g_pLocalPlayer->entity) && !g_Settings.bInvalid) {
|
||||
if (TF) SAFE_CALL(hacks::tf2::antidisguise::Draw());
|
||||
SAFE_CALL(hacks::shared::misc::Draw());
|
||||
SAFE_CALL(hacks::shared::esp::Draw());
|
||||
if (TF) SAFE_CALL(hacks::tf::spyalert::Draw());
|
||||
if (TF) SAFE_CALL(hacks::tf::radar::Draw());
|
||||
if (TF2) SAFE_CALL(hacks::tf2::skinchanger::PaintTraverse());
|
||||
PROF_SECTION(PT_total_hacks);
|
||||
if (TF) {
|
||||
PROF_SECTION(PT_antidisguise);
|
||||
SAFE_CALL(hacks::tf2::antidisguise::Draw());
|
||||
}
|
||||
{
|
||||
PROF_SECTION(PT_misc);
|
||||
SAFE_CALL(hacks::shared::misc::Draw());
|
||||
}
|
||||
{
|
||||
PROF_SECTION(PT_esp);
|
||||
SAFE_CALL(hacks::shared::esp::Draw());
|
||||
}
|
||||
if (TF) {
|
||||
PROF_SECTION(PT_spyalert);
|
||||
SAFE_CALL(hacks::tf::spyalert::Draw());
|
||||
}
|
||||
if (TF) {
|
||||
PROF_SECTION(PT_radar);
|
||||
SAFE_CALL(hacks::tf::radar::Draw());
|
||||
}
|
||||
if (TF2) {
|
||||
PROF_SECTION(PT_skinchanger);
|
||||
SAFE_CALL(hacks::tf2::skinchanger::PaintTraverse());
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -180,7 +203,10 @@ void PaintTraverse_hook(void* _this, unsigned int vp, bool fr, bool ar) {
|
||||
g_pGUI->Update();
|
||||
#endif
|
||||
|
||||
DrawStrings();
|
||||
{
|
||||
PROF_SECTION(PT_draw_strings);
|
||||
DrawStrings();
|
||||
}
|
||||
SEGV_END;
|
||||
}
|
||||
|
||||
|
@ -39,6 +39,8 @@ void DrawModelExecute_hook(IVModelRender* _this, const DrawModelState_t& state,
|
||||
return;
|
||||
}
|
||||
|
||||
PROF_SECTION(DrawModelExecute);
|
||||
|
||||
if (no_arms || no_hats) {
|
||||
if (info.pModel) {
|
||||
name = g_IModelInfo->GetModelName(info.pModel);
|
||||
@ -202,12 +204,18 @@ void FrameStageNotify_hook(void* _this, int stage) {
|
||||
static IClientEntity *ent;
|
||||
static ConVar* glow_outline_effect = g_ICvar->FindVar("glow_outline_effect_enable");
|
||||
|
||||
PROF_SECTION(FrameStageNotify_TOTAL);
|
||||
|
||||
static const FrameStageNotify_t original = (FrameStageNotify_t)hooks::client.GetMethod(offsets::FrameStageNotify());
|
||||
SEGV_BEGIN;
|
||||
if (!g_IEngine->IsInGame()) g_Settings.bInvalid = true;
|
||||
// TODO hack FSN hook
|
||||
hacks::tf2::skinchanger::FrameStageNotify(stage);
|
||||
{
|
||||
PROF_SECTION(FSN_skinchanger);
|
||||
hacks::tf2::skinchanger::FrameStageNotify(stage);
|
||||
}
|
||||
if (resolver && cathook && !g_Settings.bInvalid && stage == FRAME_NET_UPDATE_POSTDATAUPDATE_START) {
|
||||
PROF_SECTION(FSN_resolver);
|
||||
for (int i = 1; i < 32 && i < HIGHEST_ENTITY; i++) {
|
||||
if (i == g_IEngine->GetLocalPlayer()) continue;
|
||||
ent = g_IEntityList->GetClientEntity(i);
|
||||
@ -233,6 +241,7 @@ void FrameStageNotify_hook(void* _this, int stage) {
|
||||
#endif
|
||||
if (CE_GOOD(LOCAL_E) && no_zoom) RemoveCondition<TFCond_Zoomed>(LOCAL_E);
|
||||
if (glow_outline_effect->GetBool()) {
|
||||
PROF_SECTION(FSN_outline);
|
||||
if (glow_enabled) {
|
||||
for (int i = 0; i < g_GlowObjectManager->m_GlowObjectDefinitions.Size(); i++) {
|
||||
GlowObjectDefinition_t& glowobject = g_GlowObjectManager->m_GlowObjectDefinitions[i];
|
||||
|
@ -33,10 +33,12 @@ void ProfilerSection::OnNodeDeath(ProfilerNode& node) {
|
||||
|
||||
if (std::chrono::duration_cast<std::chrono::seconds>(std::chrono::high_resolution_clock::now() - m_log).count() > 3) {
|
||||
if (do_profiler_logging)
|
||||
logging::Info("[P] stats for '%-32s': MIN{%12llu} MAX{%12llu} AVG{%12llu}", m_name.c_str(),
|
||||
logging::Info("[P],'%-32s',%12llu,%12llu,%12llu,%12llu,%u", m_name.c_str(),
|
||||
std::chrono::duration_cast<std::chrono::nanoseconds>(m_sum).count(),
|
||||
std::chrono::duration_cast<std::chrono::nanoseconds>(m_sum).count() / (m_calls ? m_calls : 1),
|
||||
std::chrono::duration_cast<std::chrono::nanoseconds>(m_min).count(),
|
||||
std::chrono::duration_cast<std::chrono::nanoseconds>(m_max).count(),
|
||||
std::chrono::duration_cast<std::chrono::nanoseconds>(m_sum).count() / (m_calls ? m_calls : 1));
|
||||
m_calls);
|
||||
m_log = std::chrono::high_resolution_clock::now();
|
||||
m_min = std::chrono::nanoseconds::zero();
|
||||
m_max = std::chrono::nanoseconds::zero();
|
||||
|
@ -39,7 +39,7 @@ public:
|
||||
ProfilerSection& m_section;
|
||||
};
|
||||
|
||||
#define ENABLE_PROFILER false
|
||||
#define ENABLE_PROFILER true
|
||||
#if ENABLE_PROFILER
|
||||
#define PROF_SECTION(id) \
|
||||
static ProfilerSection __PROFILER__##id(#id); \
|
||||
|
Reference in New Issue
Block a user