From 0db530ca816e773efd448c6d922638a4a23ecf84 Mon Sep 17 00:00:00 2001 From: Unnamed Date: Thu, 13 Dec 2018 14:59:55 +0000 Subject: [PATCH] Cleanup: LAG_BOT ifdefs and CMake option --- CMakeLists.txt | 1 - include/config.h.in | 1 - include/hacks/hacklist.hpp | 10 --------- src/hack.cpp | 8 ------- src/hacks/AutoJoin.cpp | 2 -- src/hacks/CMakeLists.txt | 2 -- src/hacks/Misc.cpp | 2 -- src/hooks/CreateMove.cpp | 30 --------------------------- src/hooks/DispatchUserMessage.cpp | 2 -- src/hooks/LevelInit.cpp | 6 ------ src/hooks/LevelShutdown.cpp | 4 ---- src/hooks/Paint.cpp | 2 -- src/hooks/SendDatagram.cpp | 5 ----- src/hooks/visual/FrameStageNotify.cpp | 2 -- 14 files changed, 77 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 6569c462..520c9b88 100755 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -25,7 +25,6 @@ set_property(CACHE Game PROPERTY STRINGS ${GameValues}) set(EnableProfiler 0 CACHE BOOL "Enable Profiler") set(EnableVisuals 1 CACHE BOOL "Enable Visuals") -set(LagbotMode 0 CACHE BOOL "Build light cathook made for lagbots") set(ExternalDrawing 0 CACHE BOOL "External Visuals") set(EnableGUI 1 CACHE BOOL "Enable GUI") set(EnableIPC 1 CACHE BOOL "Enable IPC") diff --git a/include/config.h.in b/include/config.h.in index 6d4e82fd..b2cfc2de 100755 --- a/include/config.h.in +++ b/include/config.h.in @@ -6,7 +6,6 @@ #define GAME_SPECIFIC @GameSpecific@ #define GAME @Game@ #define ENABLE_VISUALS @EnableVisuals@ -#define LAGBOT_MODE @LagbotMode@ #define EXTERNAL_DRAWING @ExternalDrawing@ #define ENABLE_GUI @EnableGUI@ #define ENABLE_IPC @EnableIPC@ diff --git a/include/hacks/hacklist.hpp b/include/hacks/hacklist.hpp index 9a3031d8..20818500 100755 --- a/include/hacks/hacklist.hpp +++ b/include/hacks/hacklist.hpp @@ -18,7 +18,6 @@ #include "SpyAlert.hpp" #endif -#if not LAGBOT_MODE #include "Aimbot.hpp" #include "AntiAim.hpp" #include "AntiDisguise.hpp" @@ -30,16 +29,12 @@ #include "AutoDeadringer.hpp" #include "Bunnyhop.hpp" #include "SeedPrediction.hpp" -#endif #if ENABLE_VISUALS #include "Radar.hpp" #endif -#if not LAGBOT_MODE #include "Walkbot.hpp" #include "navparser.hpp" -#endif #include "AutoJoin.hpp" -#if not LAGBOT_MODE #include "AntiBackstab.hpp" #include "AutoBackstab.hpp" #include "FollowBot.hpp" @@ -49,16 +44,11 @@ #include "DominateSay.hpp" #include "UberSpam.hpp" #include "Achievement.hpp" -#endif #include "Spam.hpp" -#if not LAGBOT_MODE #include "NavBot.hpp" #include "Noisemaker.hpp" #include "FollowBot.hpp" #include "Announcer.hpp" #include "Killstreak.hpp" -#endif #include "CatBot.hpp" -#if not LAGBOT_MODE #include "Backtrack.hpp" -#endif diff --git a/src/hack.cpp b/src/hack.cpp index 6c9f007c..0ba63016 100644 --- a/src/hack.cpp +++ b/src/hack.cpp @@ -289,13 +289,11 @@ free(logname);*/ // hooks::materialsystem.HookMethod(); } #endif -#if not LAGBOT_MODE // FIXME [MP] hacks::shared::killsay::init(); hacks::shared::dominatesay::init(); hacks::shared::announcer::init(); hacks::tf2::killstreak::init(); -#endif hacks::shared::catbot::init(); logging::Info("Hooked!"); velocity::Init(); @@ -319,9 +317,7 @@ free(logname);*/ logging::Info("SDL hooking done"); #endif /* TEXTMODE */ -#if not LAGBOT_MODE hacks::shared::anticheat::Init(); -#endif #if ENABLE_VISUALS #ifndef FEATURE_FIDGET_SPINNER_ENABLED InitSpinner(); @@ -329,9 +325,7 @@ free(logname);*/ #endif hacks::shared::spam::init(); #endif -#if not LAGBOT_MODE hacks::shared::walkbot::Initialize(); -#endif #if ENABLE_VISUALS hacks::shared::esp::Init(); #endif @@ -380,11 +374,9 @@ void hack::Shutdown() #endif logging::Info("Unregistering convars.."); ConVar_Unregister(); -#if not LAGBOT_MODE logging::Info("Shutting down killsay..."); hacks::shared::killsay::shutdown(); hacks::shared::dominatesay::shutdown(); hacks::shared::announcer::shutdown(); -#endif logging::Info("Success.."); } diff --git a/src/hacks/AutoJoin.cpp b/src/hacks/AutoJoin.cpp index 1f2f913e..451b2b50 100644 --- a/src/hacks/AutoJoin.cpp +++ b/src/hacks/AutoJoin.cpp @@ -149,7 +149,6 @@ void updateSearch() #endif } static HookedFunction update(HookedFunctions_types::HF_CreateMove, "Autojoin", 1, []() { -#if !LAGBOT_MODE if (autoteam_timer.test_and_set(500)) { if (autojoin_team and UnassignedTeam()) @@ -162,7 +161,6 @@ static HookedFunction update(HookedFunctions_types::HF_CreateMove, "Autojoin", 1 g_IEngine->ExecuteClientCmd(format("join_class ", classnames[int(autojoin_class) - 1]).c_str()); } } -#endif }); void onShutdown() diff --git a/src/hacks/CMakeLists.txt b/src/hacks/CMakeLists.txt index ec152c61..3dc0b79e 100755 --- a/src/hacks/CMakeLists.txt +++ b/src/hacks/CMakeLists.txt @@ -3,7 +3,6 @@ target_sources(cathook PRIVATE "${CMAKE_CURRENT_LIST_DIR}/CatBot.cpp" "${CMAKE_CURRENT_LIST_DIR}/SeedPrediction.cpp" "${CMAKE_CURRENT_LIST_DIR}/Spam.cpp") -if(NOT LagbotMode) target_sources(cathook PRIVATE "${CMAKE_CURRENT_LIST_DIR}/Achievement.cpp" "${CMAKE_CURRENT_LIST_DIR}/Aimbot.cpp" @@ -37,7 +36,6 @@ if(NOT LagbotMode) "${CMAKE_CURRENT_LIST_DIR}/Walkbot.cpp" "${CMAKE_CURRENT_LIST_DIR}/Radar.cpp") add_subdirectory(ac) -endif() if(EnableVisuals) target_sources(cathook PRIVATE "${CMAKE_CURRENT_LIST_DIR}/ESP.cpp" diff --git a/src/hacks/Misc.cpp b/src/hacks/Misc.cpp index 29fa9922..4496fdec 100644 --- a/src/hacks/Misc.cpp +++ b/src/hacks/Misc.cpp @@ -131,7 +131,6 @@ InitRoutine init([]() { teammatesPushaway = g_ICvar->FindVar("tf_avoidteammates_ void CreateMove() { -#if !LAGBOT_MODE if (current_user_cmd->command_number) last_number = current_user_cmd->command_number; @@ -225,7 +224,6 @@ void CreateMove() if (*nopush_enabled == teammatesPushaway->GetBool()) teammatesPushaway->SetValue(!nopush_enabled); } -#endif } #if ENABLE_VISUALS diff --git a/src/hooks/CreateMove.cpp b/src/hooks/CreateMove.cpp index 1966c6d8..e7c51c57 100644 --- a/src/hooks/CreateMove.cpp +++ b/src/hooks/CreateMove.cpp @@ -33,19 +33,6 @@ static settings::Bool no_shake{ "visual.no-shake", "true" }; #endif class CMoveData; -#if LAGBOT_MODE -CatCommand set_value("set", "Set value", [](const CCommand &args) { - if (args.ArgC() < 2) - return; - ConVar *var = g_ICvar->FindVar(args.Arg(1)); - if (!var) - return; - std::string value(args.Arg(2)); - ReplaceString(value, "\\n", "\n"); - var->SetValue(value.c_str()); - logging::Info("Set '%s' to '%s'", args.Arg(1), value.c_str()); -}); -#endif namespace engine_prediction { @@ -101,11 +88,6 @@ void RunEnginePrediction(IClientEntity *ent, CUserCmd *ucmd) return; } } // namespace engine_prediction -#if not LAGBOT_MODE -#define antikick_time 35 -#else -#define antikick_time 90 -#endif static int attackticks = 0; @@ -133,13 +115,11 @@ DEFINE_HOOKED_METHOD(CreateMove, bool, void *this_, float input_sample_time, CUs tickcount++; current_user_cmd = cmd; -#if !LAGBOT_MODE IF_GAME(IsTF2C()) { if (CE_GOOD(LOCAL_W) && minigun_jump && LOCAL_W->m_iClassID() == CL_CLASS(CTFMinigun)) CE_INT(LOCAL_W, netvar.iWeaponState) = 0; } -#endif ret = original::CreateMove(this_, input_sample_time, cmd); PROF_SECTION(CreateMove); @@ -307,7 +287,6 @@ DEFINE_HOOKED_METHOD(CreateMove, bool, void *this_, float input_sample_time, CUs { if (!g_pLocalPlayer->life_state && CE_GOOD(g_pLocalPlayer->weapon())) { -#if !LAGBOT_MODE // Walkbot can leave game. if (!g_IEngine->IsInGame()) { @@ -405,9 +384,7 @@ DEFINE_HOOKED_METHOD(CreateMove, bool, void *this_, float input_sample_time, CUs if (debug_projectiles) projectile_logging::Update(); Prediction_CreateMove(); -#endif } -#if !LAGBOT_MODE { PROF_SECTION(CM_misc); hacks::shared::misc::CreateMove(); @@ -416,27 +393,22 @@ DEFINE_HOOKED_METHOD(CreateMove, bool, void *this_, float input_sample_time, CUs PROF_SECTION(CM_crits); criticals::create_move(); } -#endif { PROF_SECTION(CM_spam); hacks::shared::spam::createMove(); } -#if !LAGBOT_MODE { PROF_SECTION(CM_AC); hacks::shared::anticheat::CreateMove(); } -#endif } if (time_replaced) g_GlobalVars->curtime = curtime_old; g_Settings.bInvalid = false; -#if !LAGBOT_MODE { PROF_SECTION(CM_chat_stack); chat_stack::OnCreateMove(); } -#endif // TODO Auto Steam Friend @@ -451,7 +423,6 @@ DEFINE_HOOKED_METHOD(CreateMove, bool, void *this_, float input_sample_time, CUs } } #endif -#if !LAGBOT_MODE hacks::shared::backtrack::UpdateIncomingSequences(); if (CE_GOOD(g_pLocalPlayer->entity)) { @@ -523,7 +494,6 @@ DEFINE_HOOKED_METHOD(CreateMove, bool, void *this_, float input_sample_time, CUs g_Settings.brute.choke[i].pop_front(); } } -#endif // PROF_END("CreateMove"); if (!(cmd->buttons & IN_ATTACK)) diff --git a/src/hooks/DispatchUserMessage.cpp b/src/hooks/DispatchUserMessage.cpp index 76ecdd82..bcffa095 100644 --- a/src/hooks/DispatchUserMessage.cpp +++ b/src/hooks/DispatchUserMessage.cpp @@ -187,7 +187,6 @@ DEFINE_HOOKED_METHOD(DispatchUserMessage, bool, void *this_, int type, bf_read & if (crypt_chat && message.find("!!B") == 0 && ucccccp::validate(message)) { std::string msg = ucccccp::decrypt(message); -#if !LAGBOT_MODE CachedEntity *ent = ENTITY(data[0]); if (msg != "Attempt at ucccccping and failing" && msg != "Unsupported version" && ent != LOCAL_E) { @@ -197,7 +196,6 @@ DEFINE_HOOKED_METHOD(DispatchUserMessage, bool, void *this_, int type, bf_read & state = playerlist::k_EState::CAT; } } -#endif PrintChat("\x07%06X%s\x01: %s", 0xe05938, name.c_str(), msg.c_str()); } chatlog::LogMessage(data[0], message); diff --git a/src/hooks/LevelInit.cpp b/src/hooks/LevelInit.cpp index 5164ec70..d6a60eed 100644 --- a/src/hooks/LevelInit.cpp +++ b/src/hooks/LevelInit.cpp @@ -22,15 +22,11 @@ namespace hooked_methods DEFINE_HOOKED_METHOD(LevelInit, void, void *this_, const char *name) { -#if !LAGBOT_MODE hacks::shared::backtrack::lastincomingsequencenumber = 0; hacks::shared::backtrack::sequences.clear(); -#endif firstcm = true; // nav::init = false; -#if !LAGBOT_MODE playerlist::Save(); -#endif #if ENABLE_VISUALS #if ENABLE_GUI gui::onLevelLoad(); @@ -55,14 +51,12 @@ DEFINE_HOOKED_METHOD(LevelInit, void, void *this_, const char *name) for (int i = 0; i < 32; i++) g_Settings.brute.brutenum[i] = 0; g_IEngine->ClientCmd_Unrestricted("exec cat_matchexec"); -#if !LAGBOT_MODE hacks::shared::aimbot::Reset(); hacks::shared::backtrack::Init(); chat_stack::Reset(); hacks::shared::anticheat::ResetEverything(); original::LevelInit(this_, name); hacks::shared::walkbot::OnLevelInit(); -#endif #if ENABLE_IPC if (ipc::peer) { diff --git a/src/hooks/LevelShutdown.cpp b/src/hooks/LevelShutdown.cpp index 9759e204..55aa7a96 100644 --- a/src/hooks/LevelShutdown.cpp +++ b/src/hooks/LevelShutdown.cpp @@ -13,15 +13,11 @@ namespace hooked_methods DEFINE_HOOKED_METHOD(LevelShutdown, void, void *this_) { need_name_change = true; -#if !LAGBOT_MODE playerlist::Save(); -#endif g_Settings.bInvalid = true; -#if !LAGBOT_MODE hacks::shared::aimbot::Reset(); chat_stack::Reset(); hacks::shared::anticheat::ResetEverything(); -#endif #if ENABLE_IPC if (ipc::peer) { diff --git a/src/hooks/Paint.cpp b/src/hooks/Paint.cpp index 175190de..ad3014b6 100644 --- a/src/hooks/Paint.cpp +++ b/src/hooks/Paint.cpp @@ -24,9 +24,7 @@ DEFINE_HOOKED_METHOD(Paint, void, IEngineVGui *this_, PaintMode_t mode) if (mode & PaintMode_t::PAINT_UIPANELS) { -#if not LAGBOT_MODE hacks::tf2::killstreak::apply_killstreaks(); -#endif hacks::shared::catbot::update(); hitrate::Update(); #if ENABLE_ONLINE diff --git a/src/hooks/SendDatagram.cpp b/src/hooks/SendDatagram.cpp index dfc0c616..0c821475 100644 --- a/src/hooks/SendDatagram.cpp +++ b/src/hooks/SendDatagram.cpp @@ -12,7 +12,6 @@ DEFINE_HOOKED_METHOD(SendDatagram, int, INetChannel *ch, bf_write *buf) { if (!round(hacks::shared::backtrack::getLatency())) return original::SendDatagram(ch, buf); -#if !LAGBOT_MODE int in = 0; int state = 0; if (CE_GOOD(LOCAL_E) && ch) @@ -23,17 +22,13 @@ DEFINE_HOOKED_METHOD(SendDatagram, int, INetChannel *ch, bf_write *buf) float latencysend = round((round((hacks::shared::backtrack::getLatency() - 0.5f) / 15.1515151515f) - 0.5f) * 15.1515151515f); hacks::shared::backtrack::AddLatencyToNetchan(ch, latencysend); } -#endif int ret = original::SendDatagram(ch, buf); -#if !LAGBOT_MODE if (CE_GOOD(LOCAL_E) && ch) { ch->m_nInSequenceNr = in; ch->m_nInReliableState = state; } - -#endif return ret; } } // namespace hooked_methods diff --git a/src/hooks/visual/FrameStageNotify.cpp b/src/hooks/visual/FrameStageNotify.cpp index 9ccff69b..3048a207 100644 --- a/src/hooks/visual/FrameStageNotify.cpp +++ b/src/hooks/visual/FrameStageNotify.cpp @@ -8,9 +8,7 @@ #include #include #include "HookedMethods.hpp" -#if not LAGBOT_MODE #include "hacks/Backtrack.hpp" -#endif static settings::Float nightmode{ "visual.night-mode", "0" }; static settings::Bool no_shake{ "visual.no-shake", "true" };