Merge pull request #660 from l0fg/l0fg-pr-cleanup

Cleanup: LAG_BOT ifdefs and CMake option
This commit is contained in:
TotallyNotElite 2018-12-13 16:30:47 +01:00 committed by GitHub
commit 625316c88e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
14 changed files with 0 additions and 77 deletions

View File

@ -25,7 +25,6 @@ set_property(CACHE Game PROPERTY STRINGS ${GameValues})
set(EnableProfiler 0 CACHE BOOL "Enable Profiler") set(EnableProfiler 0 CACHE BOOL "Enable Profiler")
set(EnableVisuals 1 CACHE BOOL "Enable Visuals") 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(ExternalDrawing 0 CACHE BOOL "External Visuals")
set(EnableGUI 1 CACHE BOOL "Enable GUI") set(EnableGUI 1 CACHE BOOL "Enable GUI")
set(EnableIPC 1 CACHE BOOL "Enable IPC") set(EnableIPC 1 CACHE BOOL "Enable IPC")

View File

@ -6,7 +6,6 @@
#define GAME_SPECIFIC @GameSpecific@ #define GAME_SPECIFIC @GameSpecific@
#define GAME @Game@ #define GAME @Game@
#define ENABLE_VISUALS @EnableVisuals@ #define ENABLE_VISUALS @EnableVisuals@
#define LAGBOT_MODE @LagbotMode@
#define EXTERNAL_DRAWING @ExternalDrawing@ #define EXTERNAL_DRAWING @ExternalDrawing@
#define ENABLE_GUI @EnableGUI@ #define ENABLE_GUI @EnableGUI@
#define ENABLE_IPC @EnableIPC@ #define ENABLE_IPC @EnableIPC@

View File

@ -18,7 +18,6 @@
#include "SpyAlert.hpp" #include "SpyAlert.hpp"
#endif #endif
#if not LAGBOT_MODE
#include "Aimbot.hpp" #include "Aimbot.hpp"
#include "AntiAim.hpp" #include "AntiAim.hpp"
#include "AntiDisguise.hpp" #include "AntiDisguise.hpp"
@ -30,16 +29,12 @@
#include "AutoDeadringer.hpp" #include "AutoDeadringer.hpp"
#include "Bunnyhop.hpp" #include "Bunnyhop.hpp"
#include "SeedPrediction.hpp" #include "SeedPrediction.hpp"
#endif
#if ENABLE_VISUALS #if ENABLE_VISUALS
#include "Radar.hpp" #include "Radar.hpp"
#endif #endif
#if not LAGBOT_MODE
#include "Walkbot.hpp" #include "Walkbot.hpp"
#include "navparser.hpp" #include "navparser.hpp"
#endif
#include "AutoJoin.hpp" #include "AutoJoin.hpp"
#if not LAGBOT_MODE
#include "AntiBackstab.hpp" #include "AntiBackstab.hpp"
#include "AutoBackstab.hpp" #include "AutoBackstab.hpp"
#include "FollowBot.hpp" #include "FollowBot.hpp"
@ -49,16 +44,11 @@
#include "DominateSay.hpp" #include "DominateSay.hpp"
#include "UberSpam.hpp" #include "UberSpam.hpp"
#include "Achievement.hpp" #include "Achievement.hpp"
#endif
#include "Spam.hpp" #include "Spam.hpp"
#if not LAGBOT_MODE
#include "NavBot.hpp" #include "NavBot.hpp"
#include "Noisemaker.hpp" #include "Noisemaker.hpp"
#include "FollowBot.hpp" #include "FollowBot.hpp"
#include "Announcer.hpp" #include "Announcer.hpp"
#include "Killstreak.hpp" #include "Killstreak.hpp"
#endif
#include "CatBot.hpp" #include "CatBot.hpp"
#if not LAGBOT_MODE
#include "Backtrack.hpp" #include "Backtrack.hpp"
#endif

View File

@ -289,13 +289,11 @@ free(logname);*/
// hooks::materialsystem.HookMethod(); // hooks::materialsystem.HookMethod();
} }
#endif #endif
#if not LAGBOT_MODE
// FIXME [MP] // FIXME [MP]
hacks::shared::killsay::init(); hacks::shared::killsay::init();
hacks::shared::dominatesay::init(); hacks::shared::dominatesay::init();
hacks::shared::announcer::init(); hacks::shared::announcer::init();
hacks::tf2::killstreak::init(); hacks::tf2::killstreak::init();
#endif
hacks::shared::catbot::init(); hacks::shared::catbot::init();
logging::Info("Hooked!"); logging::Info("Hooked!");
velocity::Init(); velocity::Init();
@ -319,9 +317,7 @@ free(logname);*/
logging::Info("SDL hooking done"); logging::Info("SDL hooking done");
#endif /* TEXTMODE */ #endif /* TEXTMODE */
#if not LAGBOT_MODE
hacks::shared::anticheat::Init(); hacks::shared::anticheat::Init();
#endif
#if ENABLE_VISUALS #if ENABLE_VISUALS
#ifndef FEATURE_FIDGET_SPINNER_ENABLED #ifndef FEATURE_FIDGET_SPINNER_ENABLED
InitSpinner(); InitSpinner();
@ -329,9 +325,7 @@ free(logname);*/
#endif #endif
hacks::shared::spam::init(); hacks::shared::spam::init();
#endif #endif
#if not LAGBOT_MODE
hacks::shared::walkbot::Initialize(); hacks::shared::walkbot::Initialize();
#endif
#if ENABLE_VISUALS #if ENABLE_VISUALS
hacks::shared::esp::Init(); hacks::shared::esp::Init();
#endif #endif
@ -380,11 +374,9 @@ void hack::Shutdown()
#endif #endif
logging::Info("Unregistering convars.."); logging::Info("Unregistering convars..");
ConVar_Unregister(); ConVar_Unregister();
#if not LAGBOT_MODE
logging::Info("Shutting down killsay..."); logging::Info("Shutting down killsay...");
hacks::shared::killsay::shutdown(); hacks::shared::killsay::shutdown();
hacks::shared::dominatesay::shutdown(); hacks::shared::dominatesay::shutdown();
hacks::shared::announcer::shutdown(); hacks::shared::announcer::shutdown();
#endif
logging::Info("Success.."); logging::Info("Success..");
} }

View File

@ -149,7 +149,6 @@ void updateSearch()
#endif #endif
} }
static HookedFunction update(HookedFunctions_types::HF_CreateMove, "Autojoin", 1, []() { static HookedFunction update(HookedFunctions_types::HF_CreateMove, "Autojoin", 1, []() {
#if !LAGBOT_MODE
if (autoteam_timer.test_and_set(500)) if (autoteam_timer.test_and_set(500))
{ {
if (autojoin_team and UnassignedTeam()) 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()); g_IEngine->ExecuteClientCmd(format("join_class ", classnames[int(autojoin_class) - 1]).c_str());
} }
} }
#endif
}); });
void onShutdown() void onShutdown()

View File

@ -3,7 +3,6 @@ target_sources(cathook PRIVATE
"${CMAKE_CURRENT_LIST_DIR}/CatBot.cpp" "${CMAKE_CURRENT_LIST_DIR}/CatBot.cpp"
"${CMAKE_CURRENT_LIST_DIR}/SeedPrediction.cpp" "${CMAKE_CURRENT_LIST_DIR}/SeedPrediction.cpp"
"${CMAKE_CURRENT_LIST_DIR}/Spam.cpp") "${CMAKE_CURRENT_LIST_DIR}/Spam.cpp")
if(NOT LagbotMode)
target_sources(cathook PRIVATE target_sources(cathook PRIVATE
"${CMAKE_CURRENT_LIST_DIR}/Achievement.cpp" "${CMAKE_CURRENT_LIST_DIR}/Achievement.cpp"
"${CMAKE_CURRENT_LIST_DIR}/Aimbot.cpp" "${CMAKE_CURRENT_LIST_DIR}/Aimbot.cpp"
@ -37,7 +36,6 @@ if(NOT LagbotMode)
"${CMAKE_CURRENT_LIST_DIR}/Walkbot.cpp" "${CMAKE_CURRENT_LIST_DIR}/Walkbot.cpp"
"${CMAKE_CURRENT_LIST_DIR}/Radar.cpp") "${CMAKE_CURRENT_LIST_DIR}/Radar.cpp")
add_subdirectory(ac) add_subdirectory(ac)
endif()
if(EnableVisuals) if(EnableVisuals)
target_sources(cathook PRIVATE target_sources(cathook PRIVATE
"${CMAKE_CURRENT_LIST_DIR}/ESP.cpp" "${CMAKE_CURRENT_LIST_DIR}/ESP.cpp"

View File

@ -131,7 +131,6 @@ InitRoutine init([]() { teammatesPushaway = g_ICvar->FindVar("tf_avoidteammates_
void CreateMove() void CreateMove()
{ {
#if !LAGBOT_MODE
if (current_user_cmd->command_number) if (current_user_cmd->command_number)
last_number = current_user_cmd->command_number; last_number = current_user_cmd->command_number;
@ -225,7 +224,6 @@ void CreateMove()
if (*nopush_enabled == teammatesPushaway->GetBool()) if (*nopush_enabled == teammatesPushaway->GetBool())
teammatesPushaway->SetValue(!nopush_enabled); teammatesPushaway->SetValue(!nopush_enabled);
} }
#endif
} }
#if ENABLE_VISUALS #if ENABLE_VISUALS

View File

@ -33,19 +33,6 @@ static settings::Bool no_shake{ "visual.no-shake", "true" };
#endif #endif
class CMoveData; 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 namespace engine_prediction
{ {
@ -101,11 +88,6 @@ void RunEnginePrediction(IClientEntity *ent, CUserCmd *ucmd)
return; return;
} }
} // namespace engine_prediction } // namespace engine_prediction
#if not LAGBOT_MODE
#define antikick_time 35
#else
#define antikick_time 90
#endif
static int attackticks = 0; static int attackticks = 0;
@ -133,13 +115,11 @@ DEFINE_HOOKED_METHOD(CreateMove, bool, void *this_, float input_sample_time, CUs
tickcount++; tickcount++;
current_user_cmd = cmd; current_user_cmd = cmd;
#if !LAGBOT_MODE
IF_GAME(IsTF2C()) IF_GAME(IsTF2C())
{ {
if (CE_GOOD(LOCAL_W) && minigun_jump && LOCAL_W->m_iClassID() == CL_CLASS(CTFMinigun)) if (CE_GOOD(LOCAL_W) && minigun_jump && LOCAL_W->m_iClassID() == CL_CLASS(CTFMinigun))
CE_INT(LOCAL_W, netvar.iWeaponState) = 0; CE_INT(LOCAL_W, netvar.iWeaponState) = 0;
} }
#endif
ret = original::CreateMove(this_, input_sample_time, cmd); ret = original::CreateMove(this_, input_sample_time, cmd);
PROF_SECTION(CreateMove); 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 (!g_pLocalPlayer->life_state && CE_GOOD(g_pLocalPlayer->weapon()))
{ {
#if !LAGBOT_MODE
// Walkbot can leave game. // Walkbot can leave game.
if (!g_IEngine->IsInGame()) if (!g_IEngine->IsInGame())
{ {
@ -405,9 +384,7 @@ DEFINE_HOOKED_METHOD(CreateMove, bool, void *this_, float input_sample_time, CUs
if (debug_projectiles) if (debug_projectiles)
projectile_logging::Update(); projectile_logging::Update();
Prediction_CreateMove(); Prediction_CreateMove();
#endif
} }
#if !LAGBOT_MODE
{ {
PROF_SECTION(CM_misc); PROF_SECTION(CM_misc);
hacks::shared::misc::CreateMove(); hacks::shared::misc::CreateMove();
@ -416,27 +393,22 @@ DEFINE_HOOKED_METHOD(CreateMove, bool, void *this_, float input_sample_time, CUs
PROF_SECTION(CM_crits); PROF_SECTION(CM_crits);
criticals::create_move(); criticals::create_move();
} }
#endif
{ {
PROF_SECTION(CM_spam); PROF_SECTION(CM_spam);
hacks::shared::spam::createMove(); hacks::shared::spam::createMove();
} }
#if !LAGBOT_MODE
{ {
PROF_SECTION(CM_AC); PROF_SECTION(CM_AC);
hacks::shared::anticheat::CreateMove(); hacks::shared::anticheat::CreateMove();
} }
#endif
} }
if (time_replaced) if (time_replaced)
g_GlobalVars->curtime = curtime_old; g_GlobalVars->curtime = curtime_old;
g_Settings.bInvalid = false; g_Settings.bInvalid = false;
#if !LAGBOT_MODE
{ {
PROF_SECTION(CM_chat_stack); PROF_SECTION(CM_chat_stack);
chat_stack::OnCreateMove(); chat_stack::OnCreateMove();
} }
#endif
// TODO Auto Steam Friend // TODO Auto Steam Friend
@ -451,7 +423,6 @@ DEFINE_HOOKED_METHOD(CreateMove, bool, void *this_, float input_sample_time, CUs
} }
} }
#endif #endif
#if !LAGBOT_MODE
hacks::shared::backtrack::UpdateIncomingSequences(); hacks::shared::backtrack::UpdateIncomingSequences();
if (CE_GOOD(g_pLocalPlayer->entity)) 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(); g_Settings.brute.choke[i].pop_front();
} }
} }
#endif
// PROF_END("CreateMove"); // PROF_END("CreateMove");
if (!(cmd->buttons & IN_ATTACK)) if (!(cmd->buttons & IN_ATTACK))

View File

@ -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)) if (crypt_chat && message.find("!!B") == 0 && ucccccp::validate(message))
{ {
std::string msg = ucccccp::decrypt(message); std::string msg = ucccccp::decrypt(message);
#if !LAGBOT_MODE
CachedEntity *ent = ENTITY(data[0]); CachedEntity *ent = ENTITY(data[0]);
if (msg != "Attempt at ucccccping and failing" && msg != "Unsupported version" && ent != LOCAL_E) 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; state = playerlist::k_EState::CAT;
} }
} }
#endif
PrintChat("\x07%06X%s\x01: %s", 0xe05938, name.c_str(), msg.c_str()); PrintChat("\x07%06X%s\x01: %s", 0xe05938, name.c_str(), msg.c_str());
} }
chatlog::LogMessage(data[0], message); chatlog::LogMessage(data[0], message);

View File

@ -22,15 +22,11 @@ namespace hooked_methods
DEFINE_HOOKED_METHOD(LevelInit, void, void *this_, const char *name) DEFINE_HOOKED_METHOD(LevelInit, void, void *this_, const char *name)
{ {
#if !LAGBOT_MODE
hacks::shared::backtrack::lastincomingsequencenumber = 0; hacks::shared::backtrack::lastincomingsequencenumber = 0;
hacks::shared::backtrack::sequences.clear(); hacks::shared::backtrack::sequences.clear();
#endif
firstcm = true; firstcm = true;
// nav::init = false; // nav::init = false;
#if !LAGBOT_MODE
playerlist::Save(); playerlist::Save();
#endif
#if ENABLE_VISUALS #if ENABLE_VISUALS
#if ENABLE_GUI #if ENABLE_GUI
gui::onLevelLoad(); gui::onLevelLoad();
@ -55,14 +51,12 @@ DEFINE_HOOKED_METHOD(LevelInit, void, void *this_, const char *name)
for (int i = 0; i < 32; i++) for (int i = 0; i < 32; i++)
g_Settings.brute.brutenum[i] = 0; g_Settings.brute.brutenum[i] = 0;
g_IEngine->ClientCmd_Unrestricted("exec cat_matchexec"); g_IEngine->ClientCmd_Unrestricted("exec cat_matchexec");
#if !LAGBOT_MODE
hacks::shared::aimbot::Reset(); hacks::shared::aimbot::Reset();
hacks::shared::backtrack::Init(); hacks::shared::backtrack::Init();
chat_stack::Reset(); chat_stack::Reset();
hacks::shared::anticheat::ResetEverything(); hacks::shared::anticheat::ResetEverything();
original::LevelInit(this_, name); original::LevelInit(this_, name);
hacks::shared::walkbot::OnLevelInit(); hacks::shared::walkbot::OnLevelInit();
#endif
#if ENABLE_IPC #if ENABLE_IPC
if (ipc::peer) if (ipc::peer)
{ {

View File

@ -13,15 +13,11 @@ namespace hooked_methods
DEFINE_HOOKED_METHOD(LevelShutdown, void, void *this_) DEFINE_HOOKED_METHOD(LevelShutdown, void, void *this_)
{ {
need_name_change = true; need_name_change = true;
#if !LAGBOT_MODE
playerlist::Save(); playerlist::Save();
#endif
g_Settings.bInvalid = true; g_Settings.bInvalid = true;
#if !LAGBOT_MODE
hacks::shared::aimbot::Reset(); hacks::shared::aimbot::Reset();
chat_stack::Reset(); chat_stack::Reset();
hacks::shared::anticheat::ResetEverything(); hacks::shared::anticheat::ResetEverything();
#endif
#if ENABLE_IPC #if ENABLE_IPC
if (ipc::peer) if (ipc::peer)
{ {

View File

@ -24,9 +24,7 @@ DEFINE_HOOKED_METHOD(Paint, void, IEngineVGui *this_, PaintMode_t mode)
if (mode & PaintMode_t::PAINT_UIPANELS) if (mode & PaintMode_t::PAINT_UIPANELS)
{ {
#if not LAGBOT_MODE
hacks::tf2::killstreak::apply_killstreaks(); hacks::tf2::killstreak::apply_killstreaks();
#endif
hacks::shared::catbot::update(); hacks::shared::catbot::update();
hitrate::Update(); hitrate::Update();
#if ENABLE_ONLINE #if ENABLE_ONLINE

View File

@ -12,7 +12,6 @@ DEFINE_HOOKED_METHOD(SendDatagram, int, INetChannel *ch, bf_write *buf)
{ {
if (!round(hacks::shared::backtrack::getLatency())) if (!round(hacks::shared::backtrack::getLatency()))
return original::SendDatagram(ch, buf); return original::SendDatagram(ch, buf);
#if !LAGBOT_MODE
int in = 0; int in = 0;
int state = 0; int state = 0;
if (CE_GOOD(LOCAL_E) && ch) 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); float latencysend = round((round((hacks::shared::backtrack::getLatency() - 0.5f) / 15.1515151515f) - 0.5f) * 15.1515151515f);
hacks::shared::backtrack::AddLatencyToNetchan(ch, latencysend); hacks::shared::backtrack::AddLatencyToNetchan(ch, latencysend);
} }
#endif
int ret = original::SendDatagram(ch, buf); int ret = original::SendDatagram(ch, buf);
#if !LAGBOT_MODE
if (CE_GOOD(LOCAL_E) && ch) if (CE_GOOD(LOCAL_E) && ch)
{ {
ch->m_nInSequenceNr = in; ch->m_nInSequenceNr = in;
ch->m_nInReliableState = state; ch->m_nInReliableState = state;
} }
#endif
return ret; return ret;
} }
} // namespace hooked_methods } // namespace hooked_methods

View File

@ -8,9 +8,7 @@
#include <settings/Bool.hpp> #include <settings/Bool.hpp>
#include <hacks/Thirdperson.hpp> #include <hacks/Thirdperson.hpp>
#include "HookedMethods.hpp" #include "HookedMethods.hpp"
#if not LAGBOT_MODE
#include "hacks/Backtrack.hpp" #include "hacks/Backtrack.hpp"
#endif
static settings::Float nightmode{ "visual.night-mode", "0" }; static settings::Float nightmode{ "visual.night-mode", "0" };
static settings::Bool no_shake{ "visual.no-shake", "true" }; static settings::Bool no_shake{ "visual.no-shake", "true" };