diff --git a/include/hacks/Aimbot.hpp b/include/hacks/Aimbot.hpp index 5e296730..943856ce 100644 --- a/include/hacks/Aimbot.hpp +++ b/include/hacks/Aimbot.hpp @@ -40,10 +40,6 @@ extern bool foundTarget; extern int target_eid; // Functions called by other functions for when certian game calls are run -void CreateMove(); -#if ENABLE_VISUALS -void DrawText(); -#endif void Reset(); // Stuff to make storing functions easy diff --git a/include/hacks/AutoDeadringer.hpp b/include/hacks/AutoDeadringer.hpp deleted file mode 100755 index 317d11a2..00000000 --- a/include/hacks/AutoDeadringer.hpp +++ /dev/null @@ -1,13 +0,0 @@ -/* - * AutoDeadringer.hpp - * - * Created on: Apr 12, 2018 - * Author: bencat07 - */ - -#pragma once -namespace hacks::shared::deadringer -{ - -void CreateMove(); -} diff --git a/include/hacks/Backtrack.hpp b/include/hacks/Backtrack.hpp index c34bb116..b60f85d3 100644 --- a/include/hacks/Backtrack.hpp +++ b/include/hacks/Backtrack.hpp @@ -38,8 +38,6 @@ struct BestTickData } }; void Init(); -void Run(); -void Draw(); void AddLatencyToNetchan(INetChannel *, float); void UpdateIncomingSequences(); extern int lastincomingsequencenumber; diff --git a/include/hacks/Bunnyhop.hpp b/include/hacks/Bunnyhop.hpp deleted file mode 100755 index e05eeb49..00000000 --- a/include/hacks/Bunnyhop.hpp +++ /dev/null @@ -1,15 +0,0 @@ -/* - * HBunnyhop.h - * - * Created on: Oct 6, 2016 - * Author: nullifiedcat - */ - -#pragma once - -#include "common.hpp" - -namespace hacks::shared::bunnyhop -{ -void CreateMove(); -} diff --git a/include/hacks/Noisemaker.hpp b/include/hacks/Noisemaker.hpp deleted file mode 100755 index dde8d269..00000000 --- a/include/hacks/Noisemaker.hpp +++ /dev/null @@ -1,15 +0,0 @@ -/* - * Noisemaker.h - * - * Created on: Feb 2, 2017 - * Author: nullifiedcat - */ - -#pragma once - -#include "common.hpp" - -namespace hacks::tf2::noisemaker -{ -void CreateMove(); -} diff --git a/include/hacks/UberSpam.hpp b/include/hacks/UberSpam.hpp index 55548262..cbf4e496 100644 --- a/include/hacks/UberSpam.hpp +++ b/include/hacks/UberSpam.hpp @@ -12,8 +12,6 @@ namespace hacks::tf::uberspam { -void CreateMove(); - // Ready, Used, Ended, %... extern const std::vector builtin_cathook; diff --git a/include/hacks/hacklist.hpp b/include/hacks/hacklist.hpp index 8135de9c..ac3a6d2e 100755 --- a/include/hacks/hacklist.hpp +++ b/include/hacks/hacklist.hpp @@ -25,8 +25,6 @@ #include "AutoSticky.hpp" #include "AutoDetonator.hpp" #include "AntiCheat.hpp" -#include "AutoDeadringer.hpp" -#include "Bunnyhop.hpp" #include "SeedPrediction.hpp" #if ENABLE_VISUALS #include "Radar.hpp" @@ -45,7 +43,6 @@ #include "Achievement.hpp" #include "Spam.hpp" #include "NavBot.hpp" -#include "Noisemaker.hpp" #include "FollowBot.hpp" #include "Announcer.hpp" #include "Killstreak.hpp" diff --git a/src/hacks/Aimbot.cpp b/src/hacks/Aimbot.cpp index 1ffdbbc6..2c9ac45d 100644 --- a/src/hacks/Aimbot.cpp +++ b/src/hacks/Aimbot.cpp @@ -100,12 +100,13 @@ Timer zoomTime{}; // for current frame, to avoid performing them again AimbotCalculatedData_s calculated_data_array[2048]{}; // The main "loop" of the aimbot. -void CreateMove() +static void CreateMove() { PROF_SECTION(PT_aimbot_cm); if (!enable) return; - + if (CE_BAD(LOCAL_E) || !LOCAL_E->m_bAlivePlayer() || CE_BAD(LOCAL_W)) + return; // Auto-Unzoom if (auto_unzoom) if (g_pLocalPlayer->holding_sniper_rifle && g_pLocalPlayer->bZoomed && zoomTime.test_and_set(3000)) @@ -1227,7 +1228,7 @@ void Reset() } #if ENABLE_VISUALS -void DrawText() +static void DrawText() { // Dont draw to screen when aimbot is disabled if (!enable) @@ -1276,4 +1277,10 @@ void DrawText() } } #endif +static InitRoutine EC([](){ + EC::Register(CreateMove, "CM_Aimbot", EC::average); +#if ENABLE_VISUALS + EC::Register(DrawText, "DRAW_Aimbot", EC::average); +#endif +}); } // namespace hacks::shared::aimbot diff --git a/src/hacks/AutoDeadringer.cpp b/src/hacks/AutoDeadringer.cpp index 9dd854cb..27811d9e 100644 --- a/src/hacks/AutoDeadringer.cpp +++ b/src/hacks/AutoDeadringer.cpp @@ -36,11 +36,11 @@ int NearbyEntities() } return ret; } -void CreateMove() +static void CreateMove() { if (!enable) return; - if (CE_BAD(LOCAL_E) || CE_BAD(LOCAL_W)) + if (CE_BAD(LOCAL_E) || !LOCAL_E->m_bAlivePlayer() || CE_BAD(LOCAL_W)) return; if (g_pLocalPlayer->clazz != tf_spy) return; @@ -67,4 +67,7 @@ void CreateMove() current_user_cmd->buttons |= IN_ATTACK2; } } +static InitRoutine EC([](){ + EC::Register(CreateMove, "AutoDeadringer", EC::average); +}); } // namespace hacks::shared::deadringer diff --git a/src/hacks/Backtrack.cpp b/src/hacks/Backtrack.cpp index 8ff08521..7d43dccd 100644 --- a/src/hacks/Backtrack.cpp +++ b/src/hacks/Backtrack.cpp @@ -79,7 +79,7 @@ int BestTick = 0; int iBestTarget = -1; bool istickvalid[32][66]{}; bool istickinvalid[32][66]{}; -void Run() +static void Run() { if (!shouldBacktrack()) { @@ -88,7 +88,7 @@ void Run() } isBacktrackEnabled = true; - if (CE_BAD(LOCAL_E) || CE_BAD(LOCAL_W)) + if (CE_BAD(LOCAL_E) || !LOCAL_E->m_bAlivePlayer() || CE_BAD(LOCAL_W)) return; if (g_Settings.bInvalid) return; @@ -167,7 +167,7 @@ void Run() } } } -void Draw() +static void Draw() { #if ENABLE_VISUALS if (!isBacktrackEnabled) @@ -363,5 +363,10 @@ std::pair getBestEntBestTick() } return std::make_pair(bestEnt, bestTick); } - +static InitRoutine EC([](){ + EC::Register(Run, "CM_Backtrack", EC::early); +#if ENABLE_VISUALS + EC::Register(Draw, "DRAW_Backtrack", EC::average); +#endif +}); } // namespace hacks::shared::backtrack diff --git a/src/hacks/Bunnyhop.cpp b/src/hacks/Bunnyhop.cpp index fe2c0af7..0d1dd86e 100644 --- a/src/hacks/Bunnyhop.cpp +++ b/src/hacks/Bunnyhop.cpp @@ -19,8 +19,10 @@ static int ticks_last_jump = 0; // static int perfect_jumps = 0; // Function called by game for movement -void CreateMove() +static void CreateMove() { + if (!CE_GOOD(LOCAL_E) || !LOCAL_E->m_bAlivePlayer() || CE_BAD(LOCAL_W)) + return; // Check user settings if bhop is enabled if (!enable) return; @@ -50,4 +52,7 @@ void CreateMove() if (!jump) ticks_last_jump = 0; } +static InitRoutine EC([](){ + EC::Register(CreateMove, "Bunnyhop", -4); +}); } // namespace hacks::shared::bunnyhop diff --git a/src/hacks/CatBot.cpp b/src/hacks/CatBot.cpp index 9163f7b2..50a75ebf 100644 --- a/src/hacks/CatBot.cpp +++ b/src/hacks/CatBot.cpp @@ -442,7 +442,7 @@ static void draw() static InitRoutine runinit([]() { EC::Register(cm, "cm_catbot", EC::average); #if ENABLE_VISUALS - EC::Register(cm, "draw_catbot", EC::average); + EC::Register(draw, "draw_catbot", EC::average); #endif }); } // namespace hacks::shared::catbot diff --git a/src/hacks/ESP.cpp b/src/hacks/ESP.cpp index 5185d303..10afa713 100644 --- a/src/hacks/ESP.cpp +++ b/src/hacks/ESP.cpp @@ -1446,7 +1446,9 @@ void SetEntityColor(CachedEntity *entity, const rgba_t &color) static InitRoutine init([](){ EC::Register(cm, "cm_esp", EC::average); +#if ENABLE_VISUALS EC::Register(Draw, "draw_esp", EC::average); +#endif }); diff --git a/src/hacks/LightESP.cpp b/src/hacks/LightESP.cpp index 223bdfa4..f8079f57 100644 --- a/src/hacks/LightESP.cpp +++ b/src/hacks/LightESP.cpp @@ -81,7 +81,9 @@ void draw() static InitRoutine init([](){ EC::Register(cm, "cm_lightesp", EC::average); +#if ENABLE_VISUALS EC::Register(draw, "draw_lightesp", EC::average); +#endif }); } // namespace hacks::shared::lightesp diff --git a/src/hacks/Noisemaker.cpp b/src/hacks/Noisemaker.cpp index 38c06229..d540bf5c 100644 --- a/src/hacks/Noisemaker.cpp +++ b/src/hacks/Noisemaker.cpp @@ -13,9 +13,9 @@ static settings::Bool enable{ "noisemaker-spam.enable", "false" }; namespace hacks::tf2::noisemaker { -void CreateMove() +static void CreateMove() { - if (enable) + if (enable && CE_GOOD(LOCAL_E) && LOCAL_E->m_bAlivePlayer()) { if (g_GlobalVars->framecount % 100 == 0) { @@ -26,4 +26,8 @@ void CreateMove() } } } +static InitRoutine EC([]() +{ + EC::Register(CreateMove, "Noisemaker", EC::average); +}); } // namespace hacks::tf2::noisemaker diff --git a/src/hacks/UberSpam.cpp b/src/hacks/UberSpam.cpp index cd5ff28a..289dda1a 100644 --- a/src/hacks/UberSpam.cpp +++ b/src/hacks/UberSpam.cpp @@ -56,8 +56,10 @@ int ChargePercentLineIndex(float chargef) return 3 + (charge / cpl); } -void CreateMove() +static void CreateMove() { + if (CE_BAD(LOCAL_E) || !LOCAL_E->m_bAlivePlayer() || CE_BAD(LOCAL_W)) + return; if (!GetSource()) return; if (LOCAL_W->m_iClassID() != CL_CLASS(CWeaponMedigun)) @@ -108,6 +110,9 @@ void CreateMove() last_charge = (int) (100.0f * charge); } +static InitRoutine register_EC([](){ + EC::Register(CreateMove, "Uberspam", EC::priority::average); +}); // Ready, Used, Ended, %... const std::vector builtin_cathook = { "-> I am charged!", "-> Not a step back! UBERCHARGE USED!", "-> My Ubercharge comes to an end!", "-> I have %i%% of ubercharge!", "-> I have half of the ubercharge!", "-> Ubercharge almost ready! (%i%%)" }; diff --git a/src/hooks/CreateMove.cpp b/src/hooks/CreateMove.cpp index d5175e20..a60a38ee 100644 --- a/src/hooks/CreateMove.cpp +++ b/src/hooks/CreateMove.cpp @@ -288,34 +288,6 @@ DEFINE_HOOKED_METHOD(CreateMove, bool, void *this_, float input_sample_time, CUs g_Settings.is_create_move = false; return ret; } - IF_GAME(IsTF()) - { - PROF_SECTION(CM_uberspam); - hacks::tf::uberspam::CreateMove(); - } - IF_GAME(IsTF2()) - { - PROF_SECTION(CM_noisemaker); - hacks::tf2::noisemaker::CreateMove(); - } - { - PROF_SECTION(CM_deadringer); - hacks::shared::deadringer::CreateMove(); - } - { - PROF_SECTION(CM_bunnyhop); - hacks::shared::bunnyhop::CreateMove(); - } - if (engine_pred) - engine_prediction::RunEnginePrediction(RAW_ENT(LOCAL_E), current_user_cmd); - { - PROF_SECTION(CM_backtracc); - hacks::shared::backtrack::Run(); - } - { - PROF_SECTION(CM_aimbot); - hacks::shared::aimbot::CreateMove(); - } if (current_user_cmd->buttons & IN_ATTACK) ++attackticks; else @@ -371,11 +343,6 @@ DEFINE_HOOKED_METHOD(CreateMove, bool, void *this_, float input_sample_time, CUs PROF_SECTION(CM_autobackstab); hacks::tf2::autobackstab::CreateMove(); } - IF_GAME(IsTF2()) - { - PROF_SECTION(CM_autodeadringer); - hacks::shared::deadringer::CreateMove(); - } if (debug_projectiles) projectile_logging::Update(); Prediction_CreateMove(); @@ -499,6 +466,13 @@ DEFINE_HOOKED_METHOD(CreateMove, bool, void *this_, float input_sample_time, CUs g_Settings.is_create_move = false; return ret; } +static InitRoutine EngPred([](){ + EC::Register([](){ + if (engine_pred) + engine_prediction::RunEnginePrediction(RAW_ENT(LOCAL_E), current_user_cmd); + }, "engine_prediction", -3); + +}); } // namespace hooked_methods /*float o_curtime; diff --git a/src/visual/drawmgr.cpp b/src/visual/drawmgr.cpp index ae725dc0..c92fcc2a 100644 --- a/src/visual/drawmgr.cpp +++ b/src/visual/drawmgr.cpp @@ -187,11 +187,6 @@ void DrawCheatVisuals() } if (CE_GOOD(g_pLocalPlayer->entity) && !g_Settings.bInvalid) { - PROF_SECTION(PT_total_hacks); - { - PROF_SECTION(DRAW_aimbot); - hacks::shared::aimbot::DrawText(); - } IF_GAME(IsTF2()) { PROF_SECTION(DRAW_skinchanger); @@ -209,11 +204,6 @@ void DrawCheatVisuals() PROF_SECTION(DRAW_autoreflect); hacks::tf::autoreflect::Draw(); } - IF_GAME(IsTF2()) - { - PROF_SECTION(DRAW_backtracc); - hacks::shared::backtrack::Draw(); - } { PROF_SECTION(DRAW_walkbot); hacks::shared::walkbot::Draw();