diff --git a/include/MiscTemporary.hpp b/include/MiscTemporary.hpp index a404aae4..fecf785e 100644 --- a/include/MiscTemporary.hpp +++ b/include/MiscTemporary.hpp @@ -5,6 +5,7 @@ #pragma once +#include #include "common.hpp" // This is a temporary file to put code that needs moving/refactoring in. @@ -21,3 +22,9 @@ extern int prevflowticks; extern int spectator_target; extern CLC_VoiceData *voicecrash; #endif + +extern settings::Bool clean_screenshots; +extern settings::Bool crypt_chat; +extern settings::Bool nolerp; +extern settings::Bool no_zoom; +extern settings::Bool disable_visuals; \ No newline at end of file diff --git a/src/MiscTemporary.cpp b/src/MiscTemporary.cpp index 72296a06..03062a6a 100644 --- a/src/MiscTemporary.cpp +++ b/src/MiscTemporary.cpp @@ -13,3 +13,9 @@ bool firstcm = false; Timer DelayTimer{}; float prevflow = 0.0f; int prevflowticks = 0; + +settings::Bool crypt_chat{ "chat.crypto", "false" }; +settings::Bool clean_screenshots{ "visual.clean-screenshots", "false" }; +settings::Bool nolerp{ "misc.no-lerp", "false" }; +settings::Bool no_zoom{ "remove.scope", "false" }; +settings::Bool disable_visuals{ "visual.disable", "false" }; \ No newline at end of file diff --git a/src/hooks/CreateMove.cpp b/src/hooks/CreateMove.cpp index aa2a18fc..696b69c4 100644 --- a/src/hooks/CreateMove.cpp +++ b/src/hooks/CreateMove.cpp @@ -16,7 +16,6 @@ #include "HookedMethods.hpp" static settings::Bool minigun_jump{ "misc.minigun-jump-tf2c", "false" }; -static settings::Bool nolerp{ "misc.no-lerp", "false" }; static settings::Button roll_speedhack{ "misc.roll-speedhack", "false" }; static settings::Bool engine_pred{ "misc.engine-prediction", "false" }; static settings::Bool debug_projectiles{ "debug.projectiles", "false" }; diff --git a/src/hooks/DispatchUserMessage.cpp b/src/hooks/DispatchUserMessage.cpp index ff64cbeb..ef2b0a8f 100644 --- a/src/hooks/DispatchUserMessage.cpp +++ b/src/hooks/DispatchUserMessage.cpp @@ -11,10 +11,10 @@ #include #include "HookedMethods.hpp" -static settings::Bool clean_chat{ "misc.clean-chat", "false" }; +static settings::Bool clean_chat{ "chat.clean", "false" }; static settings::Bool dispatch_log{ "debug.log-dispatch-user-msg", "false" }; -static settings::String chat_filter{ "misc.chat-censor.filter", "" }; -static settings::Bool chat_filter_enable{ "misc.chat-censor.enable", "false" }; +static settings::String chat_filter{ "chat.censor.filter", "" }; +static settings::Bool chat_filter_enable{ "chat.censor.enable", "false" }; static bool retrun = false; static Timer sendmsg{}; @@ -69,9 +69,9 @@ DEFINE_HOOKED_METHOD(DispatchUserMessage, bool, void *this_, int type, message.push_back(c); } } - if (chat_filter_enabled && data[0] != LOCAL_E->m_IDX) + if (chat_filter_enable && data[0] != LOCAL_E->m_IDX) { - if (!strcmp(chat_filter.GetString(), "")) + if (chat_filter) { std::string tmp = {}; std::string tmp2 = {}; @@ -189,7 +189,7 @@ DEFINE_HOOKED_METHOD(DispatchUserMessage, bool, void *this_, int type, } else if (data[0] != LOCAL_E->m_IDX) { - std::string input = chat_filter.GetString(); + std::string input = *chat_filter; boost::to_lower(input); std::string message2 = message; std::vector result{}; @@ -215,10 +215,10 @@ DEFINE_HOOKED_METHOD(DispatchUserMessage, bool, void *this_, int type, } } } -#if not LAGBOT_MODE - if (sendmsg.test_and_set(300000) && +#if !LAGBOT_MODE + /*if (sendmsg.test_and_set(300000) && hacks::shared::antiaim::communicate) - chat_stack::Say("!!meow"); + chat_stack::Say("!!meow");*/ #endif if (crypt_chat) { @@ -226,8 +226,8 @@ DEFINE_HOOKED_METHOD(DispatchUserMessage, bool, void *this_, int type, { if (ucccccp::validate(message)) { -#if not LAGBOT_MODE - if (ucccccp::decrypt(message) == "meow" && +#if !LAGBOT_MODE +/* if (ucccccp::decrypt(message) == "meow" && hacks::shared::antiaim::communicate && data[0] != LOCAL_E->m_IDX && playerlist::AccessData(ENTITY(data[0])).state != @@ -236,7 +236,7 @@ DEFINE_HOOKED_METHOD(DispatchUserMessage, bool, void *this_, int type, playerlist::AccessData(ENTITY(data[0])).state = playerlist::k_EState::CAT; chat_stack::Say("!!meow"); - } + }*/ #endif PrintChat("\x07%06X%s\x01: %s", 0xe05938, name.c_str(), ucccccp::decrypt(message).c_str()); @@ -261,7 +261,7 @@ DEFINE_HOOKED_METHOD(DispatchUserMessage, bool, void *this_, int type, logging::Info("MESSAGE %d, DATA = [ %s ]", type, str.str().c_str()); buf.Seek(0); } - votelogger::user_message(buf, type); + votelogger::dispatchUserMessage(buf, type); return original::DispatchUserMessage(this_, type, buf); } } diff --git a/src/hooks/SendDatagram.cpp b/src/hooks/SendDatagram.cpp index f5da49c7..2f7263a4 100644 --- a/src/hooks/SendDatagram.cpp +++ b/src/hooks/SendDatagram.cpp @@ -10,12 +10,12 @@ namespace hooked_methods { DEFINE_HOOKED_METHOD(SendDatagram, int, INetChannel *ch, bf_write *buf) { -#if not LAGBOT_MODE +#if !LAGBOT_MODE int in = ch->m_nInSequenceNr; auto state = ch->m_nInReliableState; float latencysend = - round((round(((float) hacks::shared::backtrack::latency - 0.5f) / + round((round((hacks::shared::backtrack::getLatency() - 0.5f) / 15.1515151515f) - 0.5f) * 15.1515151515f); @@ -23,7 +23,7 @@ DEFINE_HOOKED_METHOD(SendDatagram, int, INetChannel *ch, bf_write *buf) #endif int ret = original::SendDatagram(ch, buf); -#if not LAGBOT_MODE +#if !LAGBOT_MODE ch->m_nInSequenceNr = in; ch->m_nInReliableState = state; diff --git a/src/hooks/SendNetMsg.cpp b/src/hooks/SendNetMsg.cpp index 663330a6..7ecf338f 100644 --- a/src/hooks/SendNetMsg.cpp +++ b/src/hooks/SendNetMsg.cpp @@ -7,6 +7,7 @@ #include #include #include "HookedMethods.hpp" +#include static settings::Int newlines_msg{ "chat.prefix-newlines", "0" }; static settings::Bool log_sent{ "debug.log-sent-chat", "false" }; diff --git a/src/hooks/visual/DrawModelExecute.cpp b/src/hooks/visual/DrawModelExecute.cpp index b4735da1..e4964873 100644 --- a/src/hooks/visual/DrawModelExecute.cpp +++ b/src/hooks/visual/DrawModelExecute.cpp @@ -17,13 +17,10 @@ DEFINE_HOOKED_METHOD(DrawModelExecute, void, IVModelRender *this_, const DrawModelState_t &state, const ModelRenderInfo_t &info, matrix3x4_t *bone) { - static const char *name; - static std::string sname; - static IClientUnknown *unk; - static IClientEntity *ent; + if (!isHackActive()) + return; - if (!cathook || - !(spectator_target || no_arms || no_hats || + if (!(spectator_target || no_arms || no_hats || (clean_screenshots && g_IEngine->IsTakingScreenshot()) || CE_BAD(LOCAL_E) || !LOCAL_E->m_bAlivePlayer())) { @@ -36,10 +33,10 @@ DEFINE_HOOKED_METHOD(DrawModelExecute, void, IVModelRender *this_, { if (info.pModel) { - name = g_IModelInfo->GetModelName(info.pModel); + const char *name = g_IModelInfo->GetModelName(info.pModel); if (name) { - sname = name; + std::string sname = name; if (no_arms && sname.find("arms") != std::string::npos) { return; @@ -53,10 +50,10 @@ DEFINE_HOOKED_METHOD(DrawModelExecute, void, IVModelRender *this_, } } - unk = info.pRenderable->GetIClientUnknown(); + IClientUnknown *unk = info.pRenderable->GetIClientUnknown(); if (unk) { - ent = unk->GetIClientEntity(); + IClientEntity *ent = unk->GetIClientEntity(); if (ent) { if (ent->entindex() == spectator_target) diff --git a/src/hooks/visual/FrameStageNotify.cpp b/src/hooks/visual/FrameStageNotify.cpp index f93b3616..517aee3a 100644 --- a/src/hooks/visual/FrameStageNotify.cpp +++ b/src/hooks/visual/FrameStageNotify.cpp @@ -6,6 +6,7 @@ #include #include #include +#include #include "HookedMethods.hpp" #if not LAGBOT_MODE #include "hacks/Backtrack.hpp" @@ -13,6 +14,8 @@ static settings::Float nightmode{ "visual.night-mode", "0" }; +static float old_nightmode{ 0.0f }; + namespace hooked_methods { #include "reclasses.hpp" @@ -20,10 +23,13 @@ namespace hooked_methods DEFINE_HOOKED_METHOD(FrameStageNotify, void, void *this_, ClientFrameStage_t stage) { - static float OldNightmode = 0.0f; - if (OldNightmode != (float) nightmode) - { + if (!isHackActive()) + return original::FrameStageNotify(this_, stage); + PROF_SECTION(FrameStageNotify_TOTAL); + + if (old_nightmode != *nightmode) + { static ConVar *r_DrawSpecificStaticProp = g_ICvar->FindVar("r_DrawSpecificStaticProp"); if (!r_DrawSpecificStaticProp) @@ -62,18 +68,16 @@ DEFINE_HOOKED_METHOD(FrameStageNotify, void, void *this_, pMaterial->ColorModulate(1.0f, 1.0f, 1.0f); } } - OldNightmode = nightmode; + old_nightmode = *nightmode; } - PROF_SECTION(FrameStageNotify_TOTAL); - if (!g_IEngine->IsInGame()) g_Settings.bInvalid = true; { PROF_SECTION(FSN_skinchanger); hacks::tf2::skinchanger::FrameStageNotify(stage); } - if (cathook && stage == FRAME_RENDER_START) + if (isHackActive() && stage == FRAME_RENDER_START) { INetChannel *ch; ch = (INetChannel *) g_IEngine->GetNetChannelInfo(); @@ -97,11 +101,11 @@ DEFINE_HOOKED_METHOD(FrameStageNotify, void, void *this_, hooks::firebullets.Apply(); } } - if (cathook && !g_Settings.bInvalid && stage == FRAME_RENDER_START) + if (isHackActive() && !g_Settings.bInvalid && stage == FRAME_RENDER_START) { IF_GAME(IsTF()) { - if (CE_GOOD(LOCAL_E) && no_zoom) + if (no_zoom && CE_GOOD(LOCAL_E)) RemoveCondition(LOCAL_E); } hacks::tf::thirdperson::frameStageNotify(); diff --git a/src/hooks/visual/OverrideView.cpp b/src/hooks/visual/OverrideView.cpp index a498b414..3d13181e 100644 --- a/src/hooks/visual/OverrideView.cpp +++ b/src/hooks/visual/OverrideView.cpp @@ -16,20 +16,18 @@ namespace hooked_methods DEFINE_HOOKED_METHOD(OverrideView, void, void *this_, CViewSetup *setup) { - static bool zoomed; original::OverrideView(this_, setup); - if (!cathook) + + if (!isHackActive()) return; + if (g_pLocalPlayer->bZoomed && override_fov_zoomed) { - setup->fov = override_fov_zoomed; + setup->fov = *override_fov_zoomed; } - else + else if (override_fov) { - if (override_fov) - { - setup->fov = override_fov; - } + setup->fov = *override_fov; } if (spectator_target) @@ -81,7 +79,7 @@ DEFINE_HOOKED_METHOD(OverrideView, void, void *this_, CViewSetup *setup) freecam_origin += forward; setup->origin = freecam_origin; } - freecam_last = freecam.KeyDown(); + freecam_last = freecam.isKeyDown(); } draw::fov = setup->fov; diff --git a/src/hooks/visual/PaintTraverse.cpp b/src/hooks/visual/PaintTraverse.cpp index 64a2ba47..b649e598 100644 --- a/src/hooks/visual/PaintTraverse.cpp +++ b/src/hooks/visual/PaintTraverse.cpp @@ -4,13 +4,12 @@ */ #include +#include #include "HookedMethods.hpp" #include "hacks/Radar.hpp" -static settings::Bool disable_visuals{ "visual.disable", "false" }; -static settings::Bool no_zoom{ "remove.scope", "false" }; static settings::Bool pure_bypass{ "visual.sv-pure-bypass", "false" }; -static settings::Int software_cursor_move{ "visual.software-cursor-mode", "0" }; +static settings::Int software_cursor_mode{ "visual.software-cursor-mode", "0" }; static settings::Int waittime{ "debug.join-wait-time", "2500" }; static settings::Bool no_reportlimit{ "misc.no-report-limit", "false" }; @@ -230,13 +229,13 @@ label1: pure_orig = (void *) 0; } call_default = true; - if (cathook && panel_scope && no_zoom && panel == panel_scope) + if (isHackActive() && panel_scope && no_zoom && panel == panel_scope) call_default = false; if (software_cursor_mode) { cur = software_cursor->GetBool(); - switch ((int) software_cursor_mode) + switch (*software_cursor_mode) { case 1: if (!software_cursor->GetBool()) @@ -268,7 +267,7 @@ label1: if (panel == panel_top) draw_flag = true; - if (!cathook) + if (!isHackActive()) return; if (!panel_top) @@ -319,7 +318,7 @@ label1: if (clean_screenshots && g_IEngine->IsTakingScreenshot()) return; #if ENABLE_GUI - g_pGUI->Update(); + // FIXME #endif draw::UpdateWTS(); } diff --git a/src/hooks/visual/SDL_GL_SwapWindow.cpp b/src/hooks/visual/SDL_GL_SwapWindow.cpp index 6ec972ae..6c20ad2f 100644 --- a/src/hooks/visual/SDL_GL_SwapWindow.cpp +++ b/src/hooks/visual/SDL_GL_SwapWindow.cpp @@ -3,11 +3,11 @@ Copyright (c) 2018 nullworks. All rights reserved. */ -#include #include #include #include #include "HookedMethods.hpp" +#include static bool init{ false }; static bool init_wminfo{ false }; @@ -39,7 +39,7 @@ DEFINE_HOOKED_METHOD(SDL_GL_SwapWindow, void, SDL_Window *window) if (!tf2_sdl) tf2_sdl = SDL_GL_GetCurrentContext(); - if (cathook && !disable_visuals) + if (isHackActive() && !disable_visuals) { PROF_SECTION(SWAPWINDOW_cathook); if (not init) diff --git a/src/textmode.cpp b/src/textmode.cpp index ee181cc2..925fe849 100644 --- a/src/textmode.cpp +++ b/src/textmode.cpp @@ -39,7 +39,7 @@ CatCommand fixvac("fixvac", "Lemme in to secure servers", []() { EXPOSED_Epic_VACBypass_1337_DoNotSteal_xXx_$1_xXx_MLG(); }); -InitRoutine init([]() { +static InitRoutine init([]() { #if ENABLE_TEXTMODE_STDIN logging::Info("[TEXTMODE] Setting up input handling"); int flags = fcntl(0, F_GETFL, 0); diff --git a/src/visual/EffectChams.cpp b/src/visual/EffectChams.cpp index 9329a846..3ed7aa15 100644 --- a/src/visual/EffectChams.cpp +++ b/src/visual/EffectChams.cpp @@ -163,8 +163,7 @@ rgba_t EffectChams::ChamsColor(IClientEntity *entity) switch (ent->m_Type()) { case ENTITY_BUILDING: - if (!ent->m_bEnemy() && !(teammates || teammate_buildings) && - (!(chamsR || chamsB || chamsG) && ent != LOCAL_E)) + if (!ent->m_bEnemy() && !(teammates || teammate_buildings) && ent != LOCAL_E) { return colors::empty; } @@ -176,13 +175,6 @@ rgba_t EffectChams::ChamsColor(IClientEntity *entity) case ENTITY_PLAYER: if (!players) return colors::empty; - if (ent->m_IDX == LOCAL_E->m_IDX && chamsteam) - if (LOCAL_E->m_iTeam() == TEAM_BLU) - return colors::blu; - else - return colors::red; - if (ent->m_IDX == LOCAL_E->m_IDX && !rainbow) - return colors::FromRGBA8(chamsR, chamsG, chamsB, 255); if (health) { return colors::Health(ent->m_iHealth(), ent->m_iMaxHealth()); @@ -238,11 +230,11 @@ bool EffectChams::ShouldRenderChams(IClientEntity *entity) case ITEM_HEALTH_LARGE: case ITEM_HEALTH_MEDIUM: case ITEM_HEALTH_SMALL: - return medkits; + return *medkits; case ITEM_AMMO_LARGE: case ITEM_AMMO_MEDIUM: case ITEM_AMMO_SMALL: - return ammobox; + return *ammobox; } break; } @@ -325,7 +317,7 @@ void EffectChams::Render(int x, int y, int w, int h) return; if (!init) Init(); - if (!cathook || (g_IEngine->IsTakingScreenshot() && clean_screenshots)) + if (!isHackActive() || (g_IEngine->IsTakingScreenshot() && clean_screenshots)) return; CMatRenderContextPtr ptr(GET_RENDER_CONTEXT); BeginRenderChams(); diff --git a/src/visual/EffectGlow.cpp b/src/visual/EffectGlow.cpp index e7c3d972..33594e55 100644 --- a/src/visual/EffectGlow.cpp +++ b/src/visual/EffectGlow.cpp @@ -239,13 +239,11 @@ rgba_t EffectGlow::GlowColor(IClientEntity *entity) } break; case ENTITY_PLAYER: - if (ent->m_IDX == LOCAL_E->m_IDX && glowteam) + if (ent->m_IDX == LOCAL_E->m_IDX) if (LOCAL_E->m_iTeam() == TEAM_BLU) return colors::blu; else return colors::red; - if (ent->m_IDX == LOCAL_E->m_IDX && glowself && !rainbow) - return colors::FromRGBA8(glowR, glowG, glowB, 255); if (health && playerlist::IsDefault(ent)) { return colors::Health(ent->m_iHealth(), ent->m_iMaxHealth()); @@ -296,11 +294,11 @@ bool EffectGlow::ShouldRenderGlow(IClientEntity *entity) const auto &type = ent->m_ItemType(); if (type >= ITEM_HEALTH_SMALL && type <= ITEM_HEALTH_LARGE) { - return medkits; + return *medkits; } else if (type >= ITEM_AMMO_SMALL && type <= ITEM_AMMO_SMALL) { - return ammobox; + return *ammobox; } else if (type >= ITEM_POWERUP_FIRST && type <= ITEM_POWERUP_LAST) { @@ -433,7 +431,7 @@ void EffectGlow::Render(int x, int y, int w, int h) static IMaterialVar *blury_bloomamount; if (!init) Init(); - if (!cathook || (g_IEngine->IsTakingScreenshot() && clean_screenshots) || + if (!isHackActive() || (g_IEngine->IsTakingScreenshot() && clean_screenshots) || g_Settings.bInvalid) return; CMatRenderContextPtr ptr(GET_RENDER_CONTEXT); diff --git a/src/visual/EventLogging.cpp b/src/visual/EventLogging.cpp index 4ad31b6f..025b4353 100644 --- a/src/visual/EventLogging.cpp +++ b/src/visual/EventLogging.cpp @@ -168,7 +168,7 @@ public: } }; -LoggingEventListener listener{}; +static LoggingEventListener listener{}; InitRoutine init([]() { g_IGameEventManager->AddListener(&listener, false); diff --git a/src/visual/drawmgr.cpp b/src/visual/drawmgr.cpp index 90978ee9..36fe0248 100644 --- a/src/visual/drawmgr.cpp +++ b/src/visual/drawmgr.cpp @@ -84,7 +84,8 @@ void DrawCheatVisuals() #endif ) { - name_s = force_name.GetString(); + // FIXME + /*name_s = *force_name; if (name_s.length() < 3) name_s = "*Not Set*"; reason_s = disconnect_reason.GetString(); @@ -94,12 +95,11 @@ void DrawCheatVisuals() AddSideString(format("Custom Name: ", name_s), GUIColor()); AddSideString( format("Custom Disconnect Reason: ", reason_s), - GUIColor()); + GUIColor());*/ } } } } - hacks::tf2::global::runcfg(); if (spectator_target) { AddCenterString("Press SPACE to stop spectating"); @@ -111,10 +111,6 @@ void DrawCheatVisuals() PROF_SECTION(DRAW_aimbot); hacks::shared::aimbot::DrawText(); } - { - PROF_SECTION(DRAW_lagexploit) - hacks::shared::lagexploit::Draw(); - } IF_GAME(IsTF2()) { PROF_SECTION(DRAW_skinchanger); @@ -142,11 +138,6 @@ void DrawCheatVisuals() PROF_SECTION(DRAW_lightesp); hacks::shared::lightesp::draw(); } - IF_GAME(IsTF2()) - { - PROF_SECTION(DRAW_healarrows); - hacks::tf2::healarrow::Draw(); - } { PROF_SECTION(DRAW_walkbot); hacks::shared::walkbot::Draw(); diff --git a/src/visual/fidgetspinner.cpp b/src/visual/fidgetspinner.cpp index 45d46c40..02418ba1 100644 --- a/src/visual/fidgetspinner.cpp +++ b/src/visual/fidgetspinner.cpp @@ -50,7 +50,7 @@ public: } }; -SpinnerListener listener; +static SpinnerListener listener; void InitSpinner() {