From 4ff18a0d5d4c2b794a818fdfa1fe972e9a88bdc8 Mon Sep 17 00:00:00 2001 From: TotallyNotElite <1yourexperiment@protonmail.com> Date: Sat, 8 Sep 2018 20:14:49 +0200 Subject: [PATCH] Lightesp converted (test) --- include/common.hpp | 2 +- include/hacks/LightESP.hpp | 1 - include/hooks/HookTools.hpp | 7 ++++--- src/hacks/LightESP.cpp | 7 ++++--- src/hooks/CreateMove.cpp | 4 ---- src/hooks/HookTools.cpp | 16 +++++++--------- 6 files changed, 16 insertions(+), 21 deletions(-) diff --git a/include/common.hpp b/include/common.hpp index f6514b37..95819b26 100755 --- a/include/common.hpp +++ b/include/common.hpp @@ -97,7 +97,7 @@ #include "init.hpp" #include "reclasses/reclasses.hpp" #include -#include +#include "HookTools.hpp" #include "copypasted/Netvar.h" #include "copypasted/CSignature.h" diff --git a/include/hacks/LightESP.hpp b/include/hacks/LightESP.hpp index 80f54b32..d835dd83 100644 --- a/include/hacks/LightESP.hpp +++ b/include/hacks/LightESP.hpp @@ -3,7 +3,6 @@ namespace hacks::shared::lightesp { #if ENABLE_VISUALS -void run(); void draw(); rgba_t LightESPColor(CachedEntity *ent); #endif diff --git a/include/hooks/HookTools.hpp b/include/hooks/HookTools.hpp index c7084e15..80acf5d9 100644 --- a/include/hooks/HookTools.hpp +++ b/include/hooks/HookTools.hpp @@ -4,11 +4,12 @@ #include #include "core/logging.hpp" -namespace HookTools { - void CreateMove(); +namespace HookTools +{ +void CreateMove(); } struct CreateMove { - CreateMove(int priority = 5, std::function func = [](){}); + CreateMove(int priority = 5, std::function func = []() {}); }; diff --git a/src/hacks/LightESP.cpp b/src/hacks/LightESP.cpp index 51678356..7e2f16cc 100644 --- a/src/hacks/LightESP.cpp +++ b/src/hacks/LightESP.cpp @@ -14,9 +14,9 @@ Vector minp[32]; Vector maxp[32]; bool drawEsp[32]; -void run() -{ #if ENABLE_VISUALS +static CreateMove run(5, []() { + PROF_SECTION(CM_lightesp); if (!enable) return; for (int i = 1; i < g_IEngine->GetMaxClients(); i++) @@ -42,8 +42,9 @@ void run() maxp[i] = pEntity->hitboxes.GetHitbox(0)->max; drawEsp[i] = true; } +}); #endif -} + void draw() { #if ENABLE_VISUALS diff --git a/src/hooks/CreateMove.cpp b/src/hooks/CreateMove.cpp index f2024bd6..fe099b0e 100644 --- a/src/hooks/CreateMove.cpp +++ b/src/hooks/CreateMove.cpp @@ -286,10 +286,6 @@ DEFINE_HOOKED_METHOD(CreateMove, bool, void *this_, float input_sample_time, PROF_SECTION(CM_esp); hacks::shared::esp::CreateMove(); } - { - PROF_SECTION(CM_lightesp); - hacks::shared::lightesp::run(); - } #endif #endif if (!g_pLocalPlayer->life_state && CE_GOOD(g_pLocalPlayer->weapon())) diff --git a/src/hooks/HookTools.cpp b/src/hooks/HookTools.cpp index 8d3bc9c4..2608a0d6 100644 --- a/src/hooks/HookTools.cpp +++ b/src/hooks/HookTools.cpp @@ -23,13 +23,11 @@ void HookTools::CreateMove() } static InitRoutine init([]() { - auto &CreateMoves = GetCreateMoves(); - std::sort(CreateMoves.begin(), - CreateMoves.end(), - [](std::pair> a, - std::pair> b) { - return a.first > b.first; - }); - logging::Info("Sorted CreateMove functions: %i", - CreateMoves.size()); + auto &CreateMoves = GetCreateMoves(); + std::sort(CreateMoves.begin(), CreateMoves.end(), + [](std::pair> a, + std::pair> b) { + return a.first > b.first; + }); + logging::Info("Sorted CreateMove functions: %i", CreateMoves.size()); });