fix Pure Bypass, Fix DME Chams and misc stuff

This commit is contained in:
LightCat 2019-04-26 19:36:14 +02:00
parent 00a67372fe
commit 098a506400
22 changed files with 51 additions and 63 deletions

View File

@ -180,4 +180,8 @@ struct offsets
{ {
return PlatformOffset(77, undefined, 77); return PlatformOffset(77, undefined, 77);
} }
static constexpr uint32_t RegisterFileWhitelist()
{
return PlatformOffset(94, undefined, undefined);
}
}; };

View File

@ -15,7 +15,7 @@ void hacks::shared::anti_anti_aim::createMove()
return; return;
IClientEntity *entity{ nullptr }; IClientEntity *entity{ nullptr };
for (int i = 0; i < g_IEngine->GetMaxClients(); i++) for (int i = 0; i <= g_IEngine->GetMaxClients(); i++)
{ {
resolveEnt(i, entity); resolveEnt(i, entity);
} }

View File

@ -52,7 +52,7 @@ void CreateMove()
return; return;
angles::Update(); angles::Update();
ac::aimbot::player_orgs().clear(); ac::aimbot::player_orgs().clear();
for (int i = 1; i < g_IEngine->GetMaxClients(); i++) for (int i = 1; i <= g_IEngine->GetMaxClients(); i++)
{ {
if (skip_local && (i == g_IEngine->GetLocalPlayer())) if (skip_local && (i == g_IEngine->GetLocalPlayer()))
continue; continue;

View File

@ -20,7 +20,7 @@ void Draw()
if (!*enable && !*no_invisibility) if (!*enable && !*no_invisibility)
return; return;
for (int i = 0; i < g_IEngine->GetMaxClients(); i++) for (int i = 0; i <= g_IEngine->GetMaxClients(); i++)
{ {
ent = ENTITY(i); ent = ENTITY(i);
if (CE_BAD(ent) || ent == LOCAL_E || ent->m_Type() != ENTITY_PLAYER || CE_INT(ent, netvar.iClass) != tf_class::tf_spy) if (CE_BAD(ent) || ent == LOCAL_E || ent->m_Type() != ENTITY_PLAYER || CE_INT(ent, netvar.iClass) != tf_class::tf_spy)

View File

@ -126,6 +126,11 @@ static void doBacktrackStab()
continue; continue;
Vector &min = btp.collidable.min; Vector &min = btp.collidable.min;
Vector &max = btp.collidable.max; Vector &max = btp.collidable.max;
// Shrink by 5%
min.x += (max.x - min.x) / 100.0f * 5.0f;
max.x -= (max.x - min.x) / 100.0f * 5.0f;
min.y += (max.y - min.y) / 100.0f * 5.0f;
max.y -= (max.y - min.y) / 100.0f * 5.0f;
Vector hit; Vector hit;
if (hacks::shared::triggerbot::CheckLineBox(min, max, g_pLocalPlayer->v_Eye, GetForwardVector(g_pLocalPlayer->v_Eye, newangle, swingrange), hit)) if (hacks::shared::triggerbot::CheckLineBox(min, max, g_pLocalPlayer->v_Eye, GetForwardVector(g_pLocalPlayer->v_Eye, newangle, swingrange), hit))
{ {

View File

@ -81,7 +81,7 @@ int BulletDangerValue(CachedEntity *patient)
return 0; return 0;
bool any_zoomed_snipers = false; bool any_zoomed_snipers = false;
// Find dangerous snipers in other team // Find dangerous snipers in other team
for (int i = 1; i < g_IEngine->GetMaxClients(); i++) for (int i = 1; i <= g_IEngine->GetMaxClients(); i++)
{ {
CachedEntity *ent = ENTITY(i); CachedEntity *ent = ENTITY(i);
if (CE_BAD(ent)) if (CE_BAD(ent))
@ -126,7 +126,7 @@ int FireDangerValue(CachedEntity *patient)
uint8_t should_switch = 0; uint8_t should_switch = 0;
if (auto_vacc_pop_if_pyro) if (auto_vacc_pop_if_pyro)
{ {
for (int i = 1; i < g_IEngine->GetMaxClients(); i++) for (int i = 1; i <= g_IEngine->GetMaxClients(); i++)
{ {
CachedEntity *ent = ENTITY(i); CachedEntity *ent = ENTITY(i);
if (CE_BAD(ent)) if (CE_BAD(ent))
@ -525,7 +525,7 @@ int BestTarget()
int best_score = INT_MIN; int best_score = INT_MIN;
if (steamid_only) if (steamid_only)
return best; return best;
for (int i = 0; i < g_IEngine->GetMaxClients(); i++) for (int i = 0; i <= g_IEngine->GetMaxClients(); i++)
{ {
int score = HealingPriority(i); int score = HealingPriority(i);
if (score > best_score && score != -1) if (score > best_score && score != -1)
@ -577,7 +577,7 @@ void CreateMove()
} }
else if (steamid) else if (steamid)
{ {
for (int i = 1; i < g_IEngine->GetMaxClients(); i++) for (int i = 1; i <= g_IEngine->GetMaxClients(); i++)
{ {
CachedEntity *ent = ENTITY(i); CachedEntity *ent = ENTITY(i);
if (CE_BAD(ent) || !ent->player_info.friendsID) if (CE_BAD(ent) || !ent->player_info.friendsID)
@ -601,7 +601,7 @@ void CreateMove()
} }
if (current_id != steamid) if (current_id != steamid)
{ {
for (int i = 1; i < g_IEngine->GetMaxClients(); i++) for (int i = 1; i <= g_IEngine->GetMaxClients(); i++)
{ {
CachedEntity *ent = ENTITY(i); CachedEntity *ent = ENTITY(i);
if (CE_BAD(ent) || !ent->player_info.friendsID) if (CE_BAD(ent) || !ent->player_info.friendsID)

View File

@ -116,7 +116,7 @@ static void Run()
// Fill backtrack data (stored in headPositions) // Fill backtrack data (stored in headPositions)
{ {
PROF_SECTION(cm_bt_ent_loop) PROF_SECTION(cm_bt_ent_loop)
for (int i = 1; i < g_IEngine->GetMaxClients(); i++) for (int i = 1; i <= g_IEngine->GetMaxClients(); i++)
{ {
CachedEntity *pEntity = ENTITY(i); CachedEntity *pEntity = ENTITY(i);
if (CE_BAD(pEntity) || !pEntity->m_bAlivePlayer()) if (CE_BAD(pEntity) || !pEntity->m_bAlivePlayer())
@ -222,7 +222,7 @@ static void Draw()
return; return;
// :b:ones for non drawable ents // :b:ones for non drawable ents
if (draw_skeleton) if (draw_skeleton)
for (int i = 0; i < g_IEngine->GetMaxClients(); i++) for (int i = 0; i <= g_IEngine->GetMaxClients(); i++)
{ {
CachedEntity *ent = ENTITY(i); CachedEntity *ent = ENTITY(i);
if (CE_BAD(ent) || !ent->m_bAlivePlayer() || i == g_IEngine->GetLocalPlayer()) if (CE_BAD(ent) || !ent->m_bAlivePlayer() || i == g_IEngine->GetLocalPlayer())
@ -249,7 +249,7 @@ static void Draw()
} }
if (!draw_bt) if (!draw_bt)
return; return;
for (int i = 0; i < g_IEngine->GetMaxClients(); i++) for (int i = 0; i <= g_IEngine->GetMaxClients(); i++)
{ {
CachedEntity *ent = ENTITY(i); CachedEntity *ent = ENTITY(i);
if (CE_BAD(ent)) if (CE_BAD(ent))
@ -376,7 +376,7 @@ std::pair<int, int> getBestEntBestTick()
if (GetWeaponMode() == weapon_melee) if (GetWeaponMode() == weapon_melee)
{ {
float bestDist = 9999.0f; float bestDist = 9999.0f;
for (int i = 0; i < g_IEngine->GetMaxClients(); i++) for (int i = 0; i <= g_IEngine->GetMaxClients(); i++)
{ {
CachedEntity *tar = ENTITY(i); CachedEntity *tar = ENTITY(i);
if (CE_GOOD(tar)) if (CE_GOOD(tar))
@ -406,7 +406,7 @@ std::pair<int, int> getBestEntBestTick()
else else
{ {
float bestFov = 180.0f; float bestFov = 180.0f;
for (int i = 0; i < g_IEngine->GetMaxClients(); i++) for (int i = 0; i <= g_IEngine->GetMaxClients(); i++)
{ {
CachedEntity *tar = ENTITY(i); CachedEntity *tar = ENTITY(i);
if (CE_GOOD(tar)) if (CE_GOOD(tar))

View File

@ -194,7 +194,7 @@ void reportall()
patch.Patch(); patch.Patch();
patched_report = true; patched_report = true;
} }
for (int i = 1; i < g_IEngine->GetMaxClients(); i++) for (int i = 1; i <= g_IEngine->GetMaxClients(); i++)
{ {
CachedEntity *ent = ENTITY(i); CachedEntity *ent = ENTITY(i);
// We only want a nullptr check since dormant entities are still on the // We only want a nullptr check since dormant entities are still on the
@ -262,7 +262,7 @@ void smart_crouch()
static bool crouch = false; static bool crouch = false;
if (crouchcdr.test_and_set(2000)) if (crouchcdr.test_and_set(2000))
{ {
for (int i = 0; i < g_IEngine->GetMaxClients(); i++) for (int i = 0; i <= g_IEngine->GetMaxClients(); i++)
{ {
auto ent = ENTITY(i); auto ent = ENTITY(i);
if (CE_BAD(ent) || ent->m_Type() != ENTITY_PLAYER || ent->m_iTeam() == LOCAL_E->m_iTeam() || !(ent->hitboxes.GetHitbox(0)) || !(ent->m_bAlivePlayer()) || !player_tools::shouldTarget(ent) || should_ignore_player(ent)) if (CE_BAD(ent) || ent->m_Type() != ENTITY_PLAYER || ent->m_iTeam() == LOCAL_E->m_iTeam() || !(ent->hitboxes.GetHitbox(0)) || !(ent->m_bAlivePlayer()) || !player_tools::shouldTarget(ent) || should_ignore_player(ent))

View File

@ -17,7 +17,7 @@ static InitRoutine init([]() {
if (CE_BAD(LOCAL_E)) if (CE_BAD(LOCAL_E))
return; return;
re::CTFPlayerShared *shared_player = &re::C_BasePlayer::shared_(RAW_ENT(LOCAL_E)); re::CTFPlayerShared *shared_player = &re::C_BasePlayer::shared_(RAW_ENT(LOCAL_E));
for (int i = 0; i < g_IEngine->GetMaxClients(); i++) for (int i = 0; i <= g_IEngine->GetMaxClients(); i++)
{ {
CachedEntity *ent = ENTITY(i); CachedEntity *ent = ENTITY(i);
if (CE_GOOD(ent) && ent->m_bAlivePlayer() && re::CTFPlayerShared::IsDominatingPlayer(shared_player, i)) if (CE_GOOD(ent) && ent->m_bAlivePlayer() && re::CTFPlayerShared::IsDominatingPlayer(shared_player, i))

View File

@ -53,7 +53,7 @@ static CatCommand follow_steam("fb_steam", "Follow Steam Id", [](const CCommand
}); });
static CatCommand steam_debug("debug_steamid", "Print steamids", []() { static CatCommand steam_debug("debug_steamid", "Print steamids", []() {
for (int i = 0; i < g_IEngine->GetMaxClients(); i++) for (int i = 0; i <= g_IEngine->GetMaxClients(); i++)
{ {
auto ent = ENTITY(i); auto ent = ENTITY(i);
logging::Info("%u", ent->player_info.friendsID); logging::Info("%u", ent->player_info.friendsID);

View File

@ -25,7 +25,7 @@ static void cm()
{ {
if (!*enable) if (!*enable)
return; return;
for (int i = 1; i < g_IEngine->GetMaxClients(); i++) for (int i = 1; i <= g_IEngine->GetMaxClients(); i++)
{ {
if (g_pLocalPlayer->entity_idx == i) if (g_pLocalPlayer->entity_idx == i)
continue; continue;
@ -53,7 +53,7 @@ void draw()
{ {
if (!enable) if (!enable)
return; return;
for (int i = 1; i < g_IEngine->GetMaxClients(); i++) for (int i = 1; i <= g_IEngine->GetMaxClients(); i++)
{ {
if (!drawEsp[i]) if (!drawEsp[i])
continue; continue;

View File

@ -60,7 +60,7 @@ std::pair<CachedEntity *, Vector> FindBestEnt(bool teammate, bool Predict, bool
return { bestent, predicted }; return { bestent, predicted };
} }
prevent = -1; prevent = -1;
for (int i = 0; i < g_IEngine->GetMaxClients(); i++) for (int i = 0; i <= g_IEngine->GetMaxClients(); i++)
{ {
CachedEntity *ent = ENTITY(i); CachedEntity *ent = ENTITY(i);
if (CE_BAD(ent) || !(ent->m_bAlivePlayer()) || (teammate && ent->m_iTeam() != LOCAL_E->m_iTeam()) || ent == LOCAL_E) if (CE_BAD(ent) || !(ent->m_bAlivePlayer()) || (teammate && ent->m_iTeam() != LOCAL_E->m_iTeam()) || ent == LOCAL_E)

View File

@ -51,7 +51,7 @@ void Paint()
{ {
if (!*draw_kda && !*mafia_city) if (!*draw_kda && !*mafia_city)
return; return;
for (int i = 0; i < g_IEngine->GetMaxClients(); i++) for (int i = 0; i <= g_IEngine->GetMaxClients(); i++)
{ {
CachedEntity *ent = ENTITY(i); CachedEntity *ent = ENTITY(i);
if (CE_BAD(ent)) if (CE_BAD(ent))

View File

@ -131,7 +131,7 @@ static std::pair<CachedEntity *, float> getNearestPlayerDistance()
{ {
float distance = FLT_MAX; float distance = FLT_MAX;
CachedEntity *best_ent = nullptr; CachedEntity *best_ent = nullptr;
for (int i = 1; i < g_IEngine->GetMaxClients(); i++) for (int i = 1; i <= g_IEngine->GetMaxClients(); i++)
{ {
CachedEntity *ent = ENTITY(i); CachedEntity *ent = ENTITY(i);
if (CE_GOOD(ent) && ent->m_bAlivePlayer() && ent->m_bEnemy() && g_pLocalPlayer->v_Origin.DistTo(ent->m_vecOrigin()) < distance && player_tools::shouldTarget(ent) && VisCheckEntFromEnt(LOCAL_E, ent)) if (CE_GOOD(ent) && ent->m_bAlivePlayer() && ent->m_bEnemy() && g_pLocalPlayer->v_Origin.DistTo(ent->m_vecOrigin()) < distance && player_tools::shouldTarget(ent) && VisCheckEntFromEnt(LOCAL_E, ent))
@ -224,7 +224,7 @@ static bool stayNearPlayer(CachedEntity *&ent, const bot_class_config &config, C
static bool stayNearPlayers(const bot_class_config &config, CachedEntity *&result_ent, CNavArea *&result_area) static bool stayNearPlayers(const bot_class_config &config, CachedEntity *&result_ent, CNavArea *&result_area)
{ {
std::vector<CachedEntity *> players; std::vector<CachedEntity *> players;
for (int i = 1; i < g_IEngine->GetMaxClients(); i++) for (int i = 1; i <= g_IEngine->GetMaxClients(); i++)
{ {
CachedEntity *ent = ENTITY(i); CachedEntity *ent = ENTITY(i);
if (CE_BAD(ent) || !ent->m_bAlivePlayer() || !ent->m_bEnemy() || !player_tools::shouldTarget(ent)) if (CE_BAD(ent) || !ent->m_bAlivePlayer() || !ent->m_bEnemy() || !player_tools::shouldTarget(ent))

View File

@ -1,35 +1,15 @@
#include <settings/Bool.hpp> #include <settings/Bool.hpp>
#include "common.hpp" #include "common.hpp"
static settings::Bool enabled{ "pure-bypass.enable", "false" }; hooks::VMTHook svpurehook{};
static void *pure_orig, **pure_addr; static void (*orig_RegisterFileWhilelist)(void *, void *, void *);
static void RegisterFileWhitelist(void *_this, void *a, void *b)
static void toggle(bool on)
{ {
if (on) logging::Info("git gud sv_pure !");
{
if (!pure_addr)
{
pure_addr = *reinterpret_cast<void ***>(gSignatures.GetEngineSignature("A1 ? ? ? ? 85 C0 74 ? C7 44 24 ? ? ? ? ? 89 04 24") + 1);
if (!pure_addr)
{
logging::Info("Pure bypass broken, failed to find signature");
return;
}
}
if (*pure_addr)
pure_orig = *pure_addr;
*pure_addr = nullptr;
}
else if (pure_orig)
{
*pure_addr = pure_orig;
pure_orig = nullptr;
}
} }
static InitRoutine init([] { static InitRoutine init([] {
toggle(*enabled); svpurehook.Set(g_IFileSystem);
enabled.installChangeCallback([](settings::VariableBase<bool> &, bool on) { toggle(on); }); svpurehook.HookMethod(RegisterFileWhitelist, offsets::RegisterFileWhitelist(), &orig_RegisterFileWhilelist);
svpurehook.Apply();
}); });

View File

@ -181,7 +181,7 @@ int QueryPlayer(Query query)
} }
std::vector<int> candidates{}; std::vector<int> candidates{};
int index_result = 0; int index_result = 0;
for (int i = 1; i < g_IEngine->GetMaxClients(); i++) for (int i = 1; i <= g_IEngine->GetMaxClients(); i++)
{ {
if (PlayerPassesQuery(query, i)) if (PlayerPassesQuery(query, i))
{ {

View File

@ -424,7 +424,7 @@ DEFINE_HOOKED_METHOD(CreateMove, bool, void *this_, float input_sample_time, CUs
} }
if (cmd && (cmd->buttons & IN_ATTACK || !(hacks::shared::antiaim::isEnabled() && *fakelag_amount && *bSendPackets))) if (cmd && (cmd->buttons & IN_ATTACK || !(hacks::shared::antiaim::isEnabled() && *fakelag_amount && *bSendPackets)))
g_Settings.brute.last_angles[LOCAL_E->m_IDX] = cmd->viewangles; g_Settings.brute.last_angles[LOCAL_E->m_IDX] = cmd->viewangles;
for (int i = 0; i < g_IEngine->GetMaxClients(); i++) for (int i = 0; i <= g_IEngine->GetMaxClients(); i++)
{ {
CachedEntity *ent = ENTITY(i); CachedEntity *ent = ENTITY(i);

View File

@ -35,7 +35,7 @@ bool StolenName()
int potential_targets_length = 0; int potential_targets_length = 0;
// Go through entities looking for potential targets // Go through entities looking for potential targets
for (int i = 1; i < g_IEngine->GetMaxClients(); i++) for (int i = 1; i <= g_IEngine->GetMaxClients(); i++)
{ {
CachedEntity *ent = ENTITY(i); CachedEntity *ent = ENTITY(i);

View File

@ -71,7 +71,7 @@ DEFINE_HOOKED_METHOD(DrawModelExecute, void, IVModelRender *this_, const DrawMod
if (sname.find("models/player") || sname.find("models/weapons") || sname.find("models/workshop/player") || sname.find("models/workshop/weapons")) if (sname.find("models/player") || sname.find("models/weapons") || sname.find("models/workshop/player") || sname.find("models/workshop/weapons"))
{ {
if (IDX_GOOD(info.entity_index) && info.entity_index < g_IEngine->GetMaxClients() && info.entity_index != g_IEngine->GetLocalPlayer()) if (IDX_GOOD(info.entity_index) && info.entity_index <= g_IEngine->GetMaxClients() && info.entity_index != g_IEngine->GetLocalPlayer())
{ {
CachedEntity *ent = ENTITY(info.entity_index); CachedEntity *ent = ENTITY(info.entity_index);
if (CE_GOOD(ent) && ent->m_bAlivePlayer()) if (CE_GOOD(ent) && ent->m_bAlivePlayer())
@ -96,15 +96,14 @@ DEFINE_HOOKED_METHOD(DrawModelExecute, void, IVModelRender *this_, const DrawMod
// Sort // Sort
std::sort(usable.begin(), usable.end(), [](hacks::shared::backtrack::BacktrackData &a, hacks::shared::backtrack::BacktrackData &b) { return a.tickcount < b.tickcount; }); std::sort(usable.begin(), usable.end(), [](hacks::shared::backtrack::BacktrackData &a, hacks::shared::backtrack::BacktrackData &b) { return a.tickcount < b.tickcount; });
// Make our own Chamsish Material // Make our own Chamsish Material
static CMaterialReference mat_lit; static CMaterialReference mat_unlit;
static bool init = false; static bool init = false;
if (!init) if (!init)
{ {
KeyValues *kv = new KeyValues("VertexLitGeneric"); KeyValues *kv = new KeyValues("UnlitGeneric");
kv->SetString("$basetexture", "vgui/white_additive"); kv->SetString("$basetexture", "vgui/white_additive");
kv->SetInt("$ignorez", 0); kv->SetInt("$ignorez", 0);
kv->SetInt("$halflambert", 1); mat_unlit.Init("__cathook_glow_unlit", kv);
mat_lit.Init("__cathook_echams_lit", kv);
init = true; init = true;
} }
// Render Chams/Glow stuff // Render Chams/Glow stuff
@ -116,7 +115,7 @@ DEFINE_HOOKED_METHOD(DrawModelExecute, void, IVModelRender *this_, const DrawMod
// Important for Depth // Important for Depth
ptr->DepthRange(0.0f, 1.0f); ptr->DepthRange(0.0f, 1.0f);
// Apply our material // Apply our material
g_IVModelRender->ForcedMaterialOverride(mat_lit); g_IVModelRender->ForcedMaterialOverride(mat_unlit);
// Run Original // Run Original
original::DrawModelExecute(this_, state, info, usable[0].bones); original::DrawModelExecute(this_, state, info, usable[0].bones);
// Revert // Revert

View File

@ -74,7 +74,7 @@ void authreq(std::string &msg)
else else
steamidhash = msg.substr(4); steamidhash = msg.substr(4);
for (int i = 0; i < g_IEngine->GetMaxClients(); i++) for (int i = 0; i <= g_IEngine->GetMaxClients(); i++)
{ {
if (i == g_pLocalPlayer->entity_idx) if (i == g_pLocalPlayer->entity_idx)
continue; continue;

View File

@ -235,7 +235,7 @@ CatCommand pl_set_state("pl_set_state", "cat_pl_set_state [playername] [state] (
} }
auto name = args.Arg(1); auto name = args.Arg(1);
int id = -1; int id = -1;
for (int i = 0; i < g_IEngine->GetMaxClients(); i++) for (int i = 0; i <= g_IEngine->GetMaxClients(); i++)
{ {
player_info_s info; player_info_s info;
if (!g_IEngine->GetPlayerInfo(i, &info)) if (!g_IEngine->GetPlayerInfo(i, &info))
@ -301,7 +301,7 @@ static int cat_pl_set_state_completionCallback(const char *c_partial, char comma
std::vector<std::string> names; std::vector<std::string> names;
for (int i = 0; i < g_IEngine->GetMaxClients(); i++) for (int i = 0; i <= g_IEngine->GetMaxClients(); i++)
{ {
player_info_s info; player_info_s info;
if (!g_IEngine->GetPlayerInfo(i, &info)) if (!g_IEngine->GetPlayerInfo(i, &info))

View File

@ -29,7 +29,7 @@ static void vote_rage_back()
if (!g_IEngine->IsInGame() || !attempt_vote_time.test_and_set(1000)) if (!g_IEngine->IsInGame() || !attempt_vote_time.test_and_set(1000))
return; return;
for (int i = 1; i < g_IEngine->GetMaxClients(); i++) for (int i = 1; i <= g_IEngine->GetMaxClients(); i++)
{ {
auto ent = ENTITY(i); auto ent = ENTITY(i);
// TO DO: m_bEnemy check only when you can't vote off players from the opposite team // TO DO: m_bEnemy check only when you can't vote off players from the opposite team