diff --git a/makefile b/makefile index f4c218a0..03ef5e52 100644 --- a/makefile +++ b/makefile @@ -53,9 +53,21 @@ LDFLAGS+=-flto endif endif LDLIBS=-lssl -l:libSDL2-2.0.so.0 -static -l:libc.so.6 -static -l:libstdc++.so.6 -l:libtier0.so -l:libvstdlib.so -static -l:libGLEW.so -l:libfreetype.so + +OUT_NAME = libcathook.so + +ifdef TEXTMODE +$(info Compiling for text mode only!) +N_LDLIBS = -lssl -l:libSDL2-2.0.so.0 -l:libGLEW.so -l:libfreetype.so +LDLIBS := $(filter-out $(N_LDLIBS),$(LDLIBS)) +N_INCLUDES = -isystemsrc/freetype-gl -isystemsrc/imgui -isystem/usr/local/include/freetype2 -isystem/usr/include/freetype2 +INCLUDES := $(filter-out $(N_INCLUDES),$(INCLUDES)) +DEFINES += TEXTMODE=1 +#OUT_NAME := libcathook-textmode.so +endif + SRC_DIR = src RES_DIR = res -OUT_NAME = libcathook.so TARGET_DIR = bin TARGET = $(TARGET_DIR)/$(OUT_NAME) SOURCES = $(shell find $(SRC_DIR) -name "*.c*" -print) @@ -96,10 +108,26 @@ CXXFLAGS+=$(addprefix -D,$(DEFINES)) CFLAGS+=$(addprefix -D,$(DEFINES)) CXXFLAGS+=$(INCLUDES) -CXXFLAGS+=$(shell sdl2-config --cflags) CFLAGS+=$(INCLUDES) + +ifdef TEXTMODE + +N_SOURCES := hacks/ESP.cpp hacks/SkinChanger.cpp hacks/SpyAlert.cpp hacks/Radar.cpp fidgetspinner.cpp ftrender.cpp hooks/sdl.cpp drawmgr.cpp drawgl.cpp +N_SOURCES := $(addprefix $(SRC_DIR)/,$(N_SOURCES)) + +SOURCES := $(filter-out $(shell find $(SRC_DIR)/gui -name "*.cpp" -print),$(SOURCES)) +SOURCES := $(filter-out $(shell find $(SRC_DIR)/freetype-gl -name "*.c*" -print),$(SOURCES)) +SOURCES := $(filter-out $(shell find $(SRC_DIR)/imgui -name "*.c*" -print),$(SOURCES)) +SOURCES := $(filter-out $(N_SOURCES),$(SOURCES)) + + +else + +CXXFLAGS+=$(shell sdl2-config --cflags) CFLAGS+=$(shell sdl2-config --cflags) +endif + .PHONY: clean directories echo all: @@ -136,7 +164,7 @@ src/sdk/utlbuffer.o : CFLAGS+=-w .cpp.o: @echo Compiling $< - @$(CXX) $(CXXFLAGS) -c $< -o $@ + $(CXX) $(CXXFLAGS) -c $< -o $@ .c.o: @echo Compiling $< diff --git a/src/atlas.cpp b/src/atlas.cpp index 121284c9..f1230bcc 100644 --- a/src/atlas.cpp +++ b/src/atlas.cpp @@ -5,6 +5,8 @@ * Author: nullifiedcat */ +#ifndef TEXTMODE + #include "atlas.hpp" #include "drawing.h" @@ -36,3 +38,5 @@ void Init() { } } + +#endif diff --git a/src/common.h b/src/common.h index 1c3362da..57ddff38 100644 --- a/src/common.h +++ b/src/common.h @@ -37,17 +37,29 @@ #include "averager.hpp" #include "aftercheaders.h" + +#ifndef TEXTMODE + extern "C" { #include } + +#include "ftrender.hpp" +#include "drawing.h" +#include "fidgetspinner.hpp" +#include "drawgl.hpp" +#include "EffectGlow.hpp" +#include "atlas.hpp" +#include "EffectChams.hpp" +#include "drawmgr.hpp" + +#endif + #include "macros.hpp" #include "colors.hpp" #include "profiler.h" -#include "ftrender.hpp" #include "offsets.hpp" -#include "drawing.h" #include "entitycache.h" -#include "fidgetspinner.hpp" #include "hoovy.hpp" #include "enums.h" #include "projlogging.hpp" @@ -57,14 +69,12 @@ extern "C" { #include "entityhitboxcache.hpp" #include "globals.h" #include "helpers.h" -#include "drawgl.hpp" #include "playerlist.hpp" #include "interfaces.h" -#include "EffectGlow.hpp" -#include "drawmgr.hpp" #include "localplayer.h" #include "conditions.h" #include "logging.h" +#include "targethelper.h" #include "playerresource.h" #include "usercmd.h" #include "trace.h" @@ -72,13 +82,11 @@ extern "C" { #include "netvars.h" #include "vfunc.h" #include "hooks.h" -#include "atlas.hpp" #include "prediction.h" #include "conditions.h" #include "itemtypes.h" #include "chatstack.h" #include "textfile.h" -#include "EffectChams.hpp" #include "ipc.h" #include "hooks/hookedmethods.h" #include "classinfo/classinfo.hpp" diff --git a/src/drawing.cpp b/src/drawing.cpp index 7a79be27..169a7466 100644 --- a/src/drawing.cpp +++ b/src/drawing.cpp @@ -5,6 +5,8 @@ * Author: nullifiedcat */ +#ifndef TEXTMODE + #include "common.h" #include "sdk.h" #include "ftrender.hpp" @@ -112,3 +114,4 @@ bool draw::WorldToScreen(const Vector& origin, Vector& screen) { return false; } +#endif diff --git a/src/hack.cpp b/src/hack.cpp index 56551bdc..a865f5ba 100644 --- a/src/hack.cpp +++ b/src/hack.cpp @@ -40,7 +40,10 @@ #define STRINGIFY(x) #x #define TO_STRING(x) STRINGIFY(x) +#ifndef TEXTMODE #include "ftrender.hpp" +#endif + #include "hooks/hookedmethods.h" #include "init.hpp" @@ -94,6 +97,10 @@ const std::string& hack::GetType() { version += " DYNAMIC"; #endif +#ifdef TEXTMODE + version += " TEXTMODE"; +#endif + version = version.substr(1); version_set = true; return version; @@ -105,6 +112,8 @@ std::stack& hack::command_stack() { return stack; } +#ifndef TEXTMODE /* Why would we need colored chat stuff in textmode? */ + class AdvancedEventListener : public IGameEventListener { public: virtual void FireGameEvent( KeyValues * event) { @@ -136,6 +145,8 @@ public: AdvancedEventListener adv_event_listener {}; +#endif /* TEXTMODE */ + void hack::ExecuteCommand(const std::string command) { std::lock_guard guard(hack::command_stack_mutex); hack::command_stack().push(command); @@ -151,7 +162,9 @@ void hack::CC_Cat(const CCommand& args) { } void hack::Initialize() { - // Essential files must always exist + // Essential files must always exist, except when the game is running in text mode. +#ifndef TEXTMODE + { std::vector essential = { "shaders/v2f-c4f.frag", "shaders/v2f-c4f.vert", @@ -167,6 +180,8 @@ void hack::Initialize() { } } +#endif /* TEXTMODE */ + logging::Info("Initializing..."); srand(time(0)); prctl(PR_SET_DUMPABLE,0,42,42,42); @@ -180,6 +195,9 @@ void hack::Initialize() { logging::Info("Is CSS? %d", IsCSS()); logging::Info("Is TF? %d", IsTF()); InitClassTable(); + +#ifndef TEXTMODE /* We don't need medal to flip 100% when running textmode */ + IF_GAME (IsTF2()) { uintptr_t mmmf = (gSignatures.GetClientSignature("C7 44 24 04 09 00 00 00 BB ? ? ? ? C7 04 24 00 00 00 00 E8 ? ? ? ? BA ? ? ? ? 85 C0 B8 ? ? ? ? 0F 44 DA") + 37); if (mmmf) { @@ -194,23 +212,29 @@ void hack::Initialize() { Patch((void*)canInspectSig, (void*)patch, 3); }*/ } + +#endif /* TEXTMODE */ + BeginConVars(); hack::c_Cat = CreateConCommand(CON_NAME, &hack::CC_Cat, "Info"); g_Settings.Init(); EndConVars(); + +#ifndef TEXTMODE + draw::Initialize(); #if ENABLE_GUI g_pGUI = new CatGUI(); g_pGUI->Setup(); #endif + +#endif /* TEXTMODE */ + gNetvars.init(); InitNetVars(); g_pLocalPlayer = new LocalPlayer(); g_pPlayerResource = new TFPlayerResource(); - /* - * TIME FOR HOOKING! wow - */ hooks::panel.Set(g_IPanel); hooks::panel.HookMethod((void*)PaintTraverse_hook, offsets::PaintTraverse()); hooks::panel.Apply(); @@ -222,7 +246,9 @@ void hack::Initialize() { } hooks::clientmode.Set((void*)clientMode); hooks::clientmode.HookMethod((void*)CreateMove_hook, offsets::CreateMove()); +#ifndef TEXTMODE hooks::clientmode.HookMethod((void*)OverrideView_hook, offsets::OverrideView()); +#endif /* TEXTMODE */ hooks::clientmode.HookMethod((void*)LevelInit_hook, offsets::LevelInit()); hooks::clientmode.HookMethod((void*)LevelShutdown_hook, offsets::LevelShutdown()); hooks::clientmode.Apply(); @@ -232,14 +258,18 @@ void hack::Initialize() { hooks::client.Set(g_IBaseClient); hooks::client.HookMethod((void*)FrameStageNotify_hook, offsets::FrameStageNotify()); hooks::client.HookMethod((void*)DispatchUserMessage_hook, offsets::DispatchUserMessage()); +#ifndef TEXTMODE hooks::client.HookMethod((void*)IN_KeyEvent_hook, offsets::IN_KeyEvent()); +#endif /* TEXTMODE */ hooks::client.Apply(); hooks::input.Set(g_IInput); hooks::input.HookMethod((void*)GetUserCmd_hook, offsets::GetUserCmd()); hooks::input.Apply(); +#ifndef TEXTMODE hooks::modelrender.Set(g_IVModelRender); hooks::modelrender.HookMethod((void*)DrawModelExecute_hook, offsets::DrawModelExecute()); hooks::modelrender.Apply(); +#endif /* TEXTMODE */ hooks::steamfriends.Set(g_ISteamFriends); hooks::steamfriends.HookMethod((void*)GetFriendPersonaName_hook, offsets::GetFriendPersonaName()); hooks::steamfriends.Apply(); @@ -256,18 +286,21 @@ void hack::Initialize() { //hooks::hkBaseClientState8->Apply(); // FIXME [MP] - InitStrings(); hacks::shared::killsay::Init(); -#if ENABLE_GUI - // cat_reloadscheme to load imgui - hack::command_stack().push("cat_reloadscheme"); -#endif hack::command_stack().push("exec cat_autoexec"); hack::command_stack().push("cat_killsay_reload"); hack::command_stack().push("cat_spam_reload"); logging::Info("Hooked!"); velocity::Init(); playerlist::Load(); + +#ifndef TEXTMODE + + InitStrings(); +#if ENABLE_GUI + // cat_reloadscheme to load imgui + hack::command_stack().push("cat_reloadscheme"); +#endif if (g_ppScreenSpaceRegistrationHead && g_pScreenSpaceEffects) { effect_chams::g_pEffectChams = new CScreenSpaceEffectRegistration("_cathook_chams", &effect_chams::g_EffectChams); g_pScreenSpaceEffects->EnableScreenSpaceEffect("_cathook_chams"); @@ -275,20 +308,24 @@ void hack::Initialize() { effect_glow::g_pEffectGlow = new CScreenSpaceEffectRegistration("_cathook_glow", &effect_glow::g_EffectGlow); g_pScreenSpaceEffects->EnableScreenSpaceEffect("_cathook_glow"); } - //for (CScreenSpaceEffectRegistration* reg = *g_ppScreenSpaceRegistrationHead; reg; reg = reg->m_pNext) { - // logging::Info("%s", reg->m_pEffectName); - //} logging::Info("SSE enabled.."); DoSDLHooking(); logging::Info("SDL hooking done"); g_IGameEventManager->AddListener(&adv_event_listener, false); + +#endif /* TEXTMODE */ + hacks::shared::anticheat::Init(); hacks::tf2::healarrow::Init(); + +#ifndef TEXTMODE InitSpinner(); logging::Info("Initialized Fidget Spinner"); hacks::shared::spam::Init(); backpacktf::init(); logging::Info("Initialized Backpack.TF integration"); +#endif + hacks::shared::walkbot::Initialize(); logging::Info("Clearing initializer stack"); diff --git a/src/hacks/Aimbot.cpp b/src/hacks/Aimbot.cpp index 94e6e980..3b661e68 100644 --- a/src/hacks/Aimbot.cpp +++ b/src/hacks/Aimbot.cpp @@ -5,36 +5,7 @@ * Author: nullifiedcat */ -#include "Aimbot.h" - -#include -#include -#include -#include -#include -#include - -#include "../aftercheaders.h" #include "../common.h" -#include "../conditions.h" -#include "../crits.h" -#include "../cvwrapper.h" -#include "../drawing.h" -#include "../entitycache.h" -#include "../globals.h" -#include "../helpers.h" -#include "../hoovy.hpp" -#include "../interfaces.h" -#include "../localplayer.h" -#include "../netvars.h" -#include "../playerlist.hpp" -#include "../prediction.h" -#include "../sdk/in_buttons.h" -#include "../targethelper.h" -#include "../usercmd.h" -#include "AntiAim.h" -#include "ESP.h" -#include "FollowBot.h" namespace hacks { namespace shared { namespace aimbot { @@ -172,8 +143,10 @@ void CreateMove() { } } +#ifndef TEXTMODE // Set target esp color to pink hacks::shared::esp::SetEntityColor(target, colors::pink); +#endif // Check if player can aim and if aimkey allows aiming // We also preform a CanShoot check here per the old canshoot method @@ -992,6 +965,8 @@ void Reset() { projectile_mode = false; } +#ifndef TEXTMODE + // Function called when we need to draw to screen static CatVar fov_draw(CV_SWITCH, "aimbot_fov_draw", "0", "Draw Fov Ring", "Draws a ring to represent your current aimbot fov"); void DrawText() { @@ -1054,5 +1029,6 @@ void DrawText() { } } +#endif }}} diff --git a/src/hacks/Aimbot.h b/src/hacks/Aimbot.h index 3931a554..84c8824e 100644 --- a/src/hacks/Aimbot.h +++ b/src/hacks/Aimbot.h @@ -39,7 +39,9 @@ extern int target_eid; // Functions called by other functions for when certian game calls are run void CreateMove(); +#ifndef TEXTMODE void DrawText(); +#endif void Reset(); // Stuff to make storing functions easy diff --git a/src/hacks/HealArrows.cpp b/src/hacks/HealArrows.cpp index a05723a2..94ee9b52 100644 --- a/src/hacks/HealArrows.cpp +++ b/src/hacks/HealArrows.cpp @@ -77,6 +77,7 @@ void CreateMove() { } void Draw() { +#ifndef TEXTMODE if (healarrow) { if ((g_GlobalVars->curtime - healarrow_time) < float(healarrow_timeout)) { AddCenterString(format("Heal arrow charge: ", int(min(100.0f, (g_GlobalVars->curtime - healarrow_time) / float(healarrow_timeout)) * 100.0f), '%'), colors::yellow); @@ -85,6 +86,9 @@ void Draw() { AddCenterString("Heal arrow ready", colors::green); } } +#else + logging::Info("[WTF] THIS SHOULD NEVER BE CALLED!!! CALL THE POLICE!!!"); +#endif } }}} diff --git a/src/hacks/Misc.cpp b/src/hacks/Misc.cpp index 187c0c80..83c48d73 100644 --- a/src/hacks/Misc.cpp +++ b/src/hacks/Misc.cpp @@ -349,6 +349,8 @@ void CreateMove() { } } +#ifndef TEXTMODE + void DrawText() { if (crit_info && CE_GOOD(LOCAL_W)) { if (CritKeyDown() || experimental_crit_hack.KeyDown()) { @@ -433,6 +435,8 @@ void DrawText() { } } +#endif + void Schema_Reload() { logging::Info("Custom schema loading is not supported right now."); /* diff --git a/src/hacks/Misc.h b/src/hacks/Misc.h index e9a0a3ff..276e8b0f 100644 --- a/src/hacks/Misc.h +++ b/src/hacks/Misc.h @@ -13,7 +13,9 @@ namespace hacks { namespace shared { namespace misc { void CreateMove(); +#ifndef TEXTMODE void DrawText(); +#endif extern IClientEntity* found_crit_weapon; extern int found_crit_number; diff --git a/src/hacks/Walkbot.cpp b/src/hacks/Walkbot.cpp index a63c803d..c3c80b3a 100644 --- a/src/hacks/Walkbot.cpp +++ b/src/hacks/Walkbot.cpp @@ -757,6 +757,47 @@ void UpdateWalker() { } } +bool ShouldSpawnNode() { + if (not state::node_good(state::active_node)) + return true; + + bool was_jumping = state::last_node_buttons & IN_JUMP; + bool is_jumping = g_pUserCmd->buttons & IN_JUMP; + + if (was_jumping != is_jumping and is_jumping) + return true; + + if ((state::last_node_buttons & IN_DUCK) != (g_pUserCmd->buttons & IN_DUCK)) + return true; + + auto& node = state::nodes[state::active_node]; + + if (distance_2d(node.xyz()) > float(spawn_distance)) { + return true; + } + + return false; +} + +void RecordNode() { + index_t node = CreateNode(g_pLocalPlayer->v_Origin); + auto& n = state::nodes[node]; + if (g_pUserCmd->buttons & IN_DUCK) + n.flags |= NF_DUCK; + if (g_pUserCmd->buttons & IN_JUMP) + n.flags |= NF_JUMP; + if (state::node_good(state::active_node)) { + auto& c = state::nodes[state::active_node]; + n.link(state::active_node); + c.link(node); + logging::Info("[wb] Node %u auto-linked to node %u at (%.2f %.2f %.2f)", node, state::active_node, c.x, c.y, c.z); + } + state::last_node_buttons = g_pUserCmd->buttons; + state::active_node = node; +} + +#ifndef TEXTMODE + // Draws a single colored connection between 2 nodes void DrawConnection(index_t a, connection_s& b) { if (b.free()) @@ -834,45 +875,6 @@ void DrawNode(index_t node, bool draw_back) { } } -bool ShouldSpawnNode() { - if (not state::node_good(state::active_node)) - return true; - - bool was_jumping = state::last_node_buttons & IN_JUMP; - bool is_jumping = g_pUserCmd->buttons & IN_JUMP; - - if (was_jumping != is_jumping and is_jumping) - return true; - - if ((state::last_node_buttons & IN_DUCK) != (g_pUserCmd->buttons & IN_DUCK)) - return true; - - auto& node = state::nodes[state::active_node]; - - if (distance_2d(node.xyz()) > float(spawn_distance)) { - return true; - } - - return false; -} - -void RecordNode() { - index_t node = CreateNode(g_pLocalPlayer->v_Origin); - auto& n = state::nodes[node]; - if (g_pUserCmd->buttons & IN_DUCK) - n.flags |= NF_DUCK; - if (g_pUserCmd->buttons & IN_JUMP) - n.flags |= NF_JUMP; - if (state::node_good(state::active_node)) { - auto& c = state::nodes[state::active_node]; - n.link(state::active_node); - c.link(node); - logging::Info("[wb] Node %u auto-linked to node %u at (%.2f %.2f %.2f)", node, state::active_node, c.x, c.y, c.z); - } - state::last_node_buttons = g_pUserCmd->buttons; - state::active_node = node; -} - void DrawPath() { for (index_t i = 0; i < state::nodes.size(); i++) { DrawNode(i, true); @@ -914,6 +916,8 @@ void Draw() { DrawPath(); } +#endif + void OnLevelInit() { if (leave_if_empty && state::state == WB_REPLAYING) { nodes.clear(); diff --git a/src/hacks/Walkbot.hpp b/src/hacks/Walkbot.hpp index 9494b69f..ce20930e 100644 --- a/src/hacks/Walkbot.hpp +++ b/src/hacks/Walkbot.hpp @@ -10,7 +10,9 @@ namespace hacks { namespace shared { namespace walkbot { void Initialize(); +#ifndef TEXTMODE void Draw(); +#endif void Move(); void OnLevelInit(); diff --git a/src/hacks/hacklist.h b/src/hacks/hacklist.h index adf99b14..fe4cd48a 100644 --- a/src/hacks/hacklist.h +++ b/src/hacks/hacklist.h @@ -8,6 +8,15 @@ #ifndef HACKS_HACKLIST_H_ #define HACKS_HACKLIST_H_ +#ifndef TEXTMODE + +#include "ESP.h" +#include "SkinChanger.hpp" +#include "Radar.hpp" +#include "SpyAlert.h" + +#endif + #include "Aimbot.h" #include "AntiAim.h" #include "AntiDisguise.h" @@ -16,7 +25,6 @@ #include "AutoSticky.h" #include "AntiCheat.hpp" #include "Bunnyhop.h" -#include "ESP.h" #include "LagExploit.hpp" #include "Walkbot.hpp" #include "AutoJoin.hpp" @@ -25,15 +33,12 @@ #include "FollowBot.h" #include "HealArrows.hpp" #include "Misc.h" -#include "SpyAlert.h" #include "Trigger.h" #include "KillSay.h" #include "UberSpam.hpp" -#include "SkinChanger.hpp" #include "Achievement.h" #include "Spam.h" #include "Noisemaker.h" #include "FollowBot.h" -#include "Radar.hpp" #endif /* HACKS_HACKLIST_H_ */ diff --git a/src/hooks/CreateMove.cpp b/src/hooks/CreateMove.cpp index 2bc9f64e..ee6885b1 100644 --- a/src/hooks/CreateMove.cpp +++ b/src/hooks/CreateMove.cpp @@ -264,11 +264,13 @@ bool CreateMove_hook(void* thisptr, float inputSample, CUserCmd* cmd) { IF_GAME (IsTF2()) { SAFE_CALL(UpdateHoovyList()); } - g_pLocalPlayer->v_OrigViewangles = cmd->viewangles; + g_pLocalPlayer->v_OrigViewangles = cmd->viewangles; +#ifndef TEXTMODE { PROF_SECTION(CM_esp); SAFE_CALL(hacks::shared::esp::CreateMove()); } +#endif if (!g_pLocalPlayer->life_state && CE_GOOD(g_pLocalPlayer->weapon())) { { PROF_SECTION(CM_walkbot); diff --git a/src/hooks/PaintTraverse.cpp b/src/hooks/PaintTraverse.cpp index 1978ec0d..49c87641 100644 --- a/src/hooks/PaintTraverse.cpp +++ b/src/hooks/PaintTraverse.cpp @@ -41,10 +41,12 @@ void PaintTraverse_hook(void* _this, unsigned int vp, bool fr, bool ar) { if (!segvcatch::handler_segv) segvcatch::init_fpe(); } #endif +#ifndef TEXTMODE if (!textures_loaded) { textures_loaded = true; hacks::tf::radar::Init(); } +#endif if (pure_bypass) { if (!pure_addr) { pure_addr = *reinterpret_cast(gSignatures.GetEngineSignature("55 89 E5 83 EC 18 A1 ? ? ? ? 89 04 24 E8 0D FF FF FF A1 ? ? ? ? 85 C0 74 08 89 04 24 E8 ? ? ? ? C9 C3") + 7); @@ -139,7 +141,7 @@ void PaintTraverse_hook(void* _this, unsigned int vp, bool fr, bool ar) { if (clean_screenshots && g_IEngine->IsTakingScreenshot()) return; PROF_SECTION(PT_active); - +#ifndef TEXTMODE draw::UpdateWTS(); BeginCheatVisuals(); DrawCheatVisuals(); @@ -151,6 +153,7 @@ void PaintTraverse_hook(void* _this, unsigned int vp, bool fr, bool ar) { EndCheatVisuals(); +#endif SEGV_END; } diff --git a/src/hooks/others.cpp b/src/hooks/others.cpp index eac55913..273df6b8 100644 --- a/src/hooks/others.cpp +++ b/src/hooks/others.cpp @@ -12,6 +12,8 @@ #include "ucccccp.hpp" #include "hookedmethods.h" +#ifndef TEXTMODE + static CatVar no_invisibility(CV_SWITCH, "no_invis", "0", "Remove Invisibility", "Useful with chams!"); // This hook isn't used yet! @@ -68,6 +70,41 @@ void DrawModelExecute_hook(IVModelRender* _this, const DrawModelState_t& state, original(_this, state, info, matrix); } + +int IN_KeyEvent_hook(void* _this, int eventcode, int keynum, const char* pszCurrentBinding) { + static const IN_KeyEvent_t original = (IN_KeyEvent_t)hooks::client.GetMethod(offsets::IN_KeyEvent()); +#if ENABLE_GUI + SEGV_BEGIN; + if (g_pGUI->ConsumesKey((ButtonCode_t)keynum) && g_pGUI->Visible()) { + return 0; + } + SEGV_END; +#endif + return original(_this, eventcode, keynum, pszCurrentBinding); +} + +CatVar override_fov_zoomed(CV_FLOAT, "fov_zoomed", "0", "FOV override (zoomed)", "Overrides FOV with this value when zoomed in (default FOV when zoomed is 20)"); +CatVar override_fov(CV_FLOAT, "fov", "0", "FOV override", "Overrides FOV with this value"); + +void OverrideView_hook(void* _this, CViewSetup* setup) { + static const OverrideView_t original = (OverrideView_t)hooks::clientmode.GetMethod(offsets::OverrideView()); + static bool zoomed; + SEGV_BEGIN; + original(_this, setup); + if (!cathook) return; + if (g_pLocalPlayer->bZoomed && override_fov_zoomed) { + setup->fov = override_fov_zoomed; + } else { + if (override_fov) { + setup->fov = override_fov; + } + } + draw::fov = setup->fov; + SEGV_END; +} + +#endif + bool CanPacket_hook(void* _this) { const CanPacket_t original = (CanPacket_t)hooks::netchannel.GetMethod(offsets::CanPacket()); SEGV_BEGIN; @@ -96,18 +133,6 @@ CUserCmd* GetUserCmd_hook(IInput* _this, int sequence_number) { return def; } -int IN_KeyEvent_hook(void* _this, int eventcode, int keynum, const char* pszCurrentBinding) { - static const IN_KeyEvent_t original = (IN_KeyEvent_t)hooks::client.GetMethod(offsets::IN_KeyEvent()); -#if ENABLE_GUI - SEGV_BEGIN; - if (g_pGUI->ConsumesKey((ButtonCode_t)keynum) && g_pGUI->Visible()) { - return 0; - } - SEGV_END; -#endif - return original(_this, eventcode, keynum, pszCurrentBinding); -} - static CatVar log_sent(CV_SWITCH, "debug_log_sent_messages", "0", "Log sent messages"); static CatCommand plus_use_action_slot_item_server("+cat_use_action_slot_item_server", "use_action_slot_item_server", []() { @@ -332,11 +357,12 @@ void FrameStageNotify_hook(void* _this, int stage) { static const FrameStageNotify_t original = (FrameStageNotify_t)hooks::client.GetMethod(offsets::FrameStageNotify()); SEGV_BEGIN; if (!g_IEngine->IsInGame()) g_Settings.bInvalid = true; - // TODO hack FSN hook +#ifndef TEXTMODE { PROF_SECTION(FSN_skinchanger); hacks::tf2::skinchanger::FrameStageNotify(stage); } +#endif if (stage == FRAME_NET_UPDATE_POSTDATAUPDATE_START) { angles::Update(); hacks::shared::anticheat::CreateMove(); @@ -356,6 +382,7 @@ void FrameStageNotify_hook(void* _this, int stage) { } } } +#ifndef TEXTMODE if (cathook && !g_Settings.bInvalid && stage == FRAME_RENDER_START) { #if ENABLE_GUI if (cursor_fix_experimental) { @@ -379,30 +406,11 @@ void FrameStageNotify_hook(void* _this, int stage) { } } } +#endif /* TEXTMODE */ SAFE_CALL(original(_this, stage)); SEGV_END; } -CatVar override_fov_zoomed(CV_FLOAT, "fov_zoomed", "0", "FOV override (zoomed)", "Overrides FOV with this value when zoomed in (default FOV when zoomed is 20)"); -CatVar override_fov(CV_FLOAT, "fov", "0", "FOV override", "Overrides FOV with this value"); - -void OverrideView_hook(void* _this, CViewSetup* setup) { - static const OverrideView_t original = (OverrideView_t)hooks::clientmode.GetMethod(offsets::OverrideView()); - static bool zoomed; - SEGV_BEGIN; - original(_this, setup); - if (!cathook) return; - if (g_pLocalPlayer->bZoomed && override_fov_zoomed) { - setup->fov = override_fov_zoomed; - } else { - if (override_fov) { - setup->fov = override_fov; - } - } - draw::fov = setup->fov; - SEGV_END; -} - static CatVar clean_chat(CV_SWITCH, "clean_chat", "0", "Clean chat", "Removes newlines from chat"); static CatVar dispatch_log(CV_SWITCH, "debug_log_usermessages", "0", "Log dispatched user messages"); diff --git a/src/prediction.cpp b/src/prediction.cpp index 00f23597..e1409e3e 100644 --- a/src/prediction.cpp +++ b/src/prediction.cpp @@ -81,7 +81,7 @@ void Prediction_CreateMove() { } } } - +#ifndef TEXTMODE void Prediction_PaintTraverse() { if (!debug_enginepred) return; for (int i = 1; i < predicted_player_count; i++) { @@ -104,7 +104,7 @@ void Prediction_PaintTraverse() { } } } - +#endif Vector EnginePrediction(CachedEntity* entity, float time) { Vector result = entity->m_vecOrigin; IClientEntity* ent = RAW_ENT(entity); diff --git a/src/prediction.h b/src/prediction.h index 8d60c00f..bd4bab32 100644 --- a/src/prediction.h +++ b/src/prediction.h @@ -24,7 +24,9 @@ float PlayerGravityMod(CachedEntity* player); Vector EnginePrediction(CachedEntity* player, float time); void Prediction_CreateMove(); +#ifndef TEXTMODE void Prediction_PaintTraverse(); +#endif float DistanceToGround(CachedEntity* ent); float DistanceToGround(Vector origin); diff --git a/src/textmode.cpp b/src/textmode.cpp new file mode 100644 index 00000000..909c00cd --- /dev/null +++ b/src/textmode.cpp @@ -0,0 +1,16 @@ +/* + * textmode.cpp + * + * Created on: Jul 28, 2017 + * Author: nullifiedcat + */ + +#include "textmode.hpp" + +bool IsTextMode() { + return false; +} + +void PatchVAC() { + ; +} diff --git a/src/textmode.hpp b/src/textmode.hpp new file mode 100644 index 00000000..65354327 --- /dev/null +++ b/src/textmode.hpp @@ -0,0 +1,11 @@ +/* + * textmode.hpp + * + * Created on: Jul 28, 2017 + * Author: nullifiedcat + */ + +#pragma once + +bool IsTextMode(); +void PatchVAC();