diff --git a/makefile b/makefile index cef0af5a..36991869 100644 --- a/makefile +++ b/makefile @@ -1,19 +1,79 @@ +# +# MAKEFILE OPTIONS (make OPTION=1 ...args) +# +# GAME - compile for specific game (tf2, hl2dm, dab, tf2c, css, dynamic), tf2 by default, other ones probably won't compile/crash on inject +# CLANG - compile with clang instead of g++ +# BUILD_DEBUG - include debug info in the build +# NO_VISUALS - disable all visuals completely +# NO_IPC - disable IPC module completely (also disables followbot lol) +# NO_GUI - disable GUI +# NO_LTO - disable Link-Time Optimization +# NO_WARNINGS - disable warnings during compilation +# NO_TF2_RENDERING - disable in-game rendering (does not work yet) +# TEXTMODE_STDIN - allows using console with textmode tf2 +# TEXTMODE_VAC - allows joining VAC-secured servers in textmode +# + +GAME=tf2 + +ENABLE_VISUALS=1 +ENABLE_GUI=1 +ENABLE_IPC=1 +ENABLE_NULL_GRAPHICS=0 +TEXTMODE_STDIN=0 +TEXTMODE_VAC=0 +DATA_PATH="/opt/cathook-data" +NO_LTO=0 +ifdef CLANG +override NO_LTO=1 +endif + +ifdef NO_VISUALS +ENABLE_VISUALS:=0 +ENABLE_GUI:=0 +endif +ifdef NO_IPC +ENABLE_IPC:=0 +endif +ifdef NO_GUI +ENABLE_GUI:=0 +endif +ifdef NO_TF2_RENDERING +ENABLE_NULL_GRAPHICS:=1 +endif + +OUT_NAME = libcathook.so +SSDK_DIR=$(realpath source-sdk-2013/mp/src) +SIPC_DIR=$(realpath simple-ipc/src/include) +LIB_DIR=lib +SRC_DIR=src +RES_DIR=res +OUT_DIR=bin +TARGET = $(OUT_DIR)/$(OUT_NAME) + +INCLUDES=-Iucccccp -isystem$(SSDK_DIR)/public -isystem$(SSDK_DIR)/mathlib -isystem$(SSDK_DIR)/common -isystem$(SSDK_DIR)/public/tier1 -isystem$(SSDK_DIR)/public/tier0 -isystem$(SSDK_DIR) +LDLIBS=-static -l:libc.so.6 -l:libstdc++.so.6 -l:libtier0.so -l:libvstdlib.so +LDFLAGS=-shared -L$(realpath $(LIB_DIR)) +SOURCES=$(shell find $(SRC_DIR) -name "*.c*" -print) + ifndef CLANG -CXX=$(shell sh -c "which g++-7 || which g++-6 || which g++") -CC=$(shell sh -c "which gcc-7 || which gcc-6 || which gcc") +CXX=$(shell sh -c "which g++-6 || which g++") +CC=$(shell sh -c "which gcc-6 || which gcc") LD=$(CXX) +LDFLAGS+=-m32 -fno-gnu-unique else CXX=clang++ CC=clang LD=ld.lld +LDFLAGS+=-melf_i386 endif -DEFINES=_GLIBCXX_USE_CXX11_ABI=0 _POSIX=1 FREETYPE_GL_USE_VAO RAD_TELEMETRY_DISABLED LINUX=1 USE_SDL _LINUX=1 POSIX=1 GNUC=1 NO_MALLOC_OVERRIDE +DEFINES:=_GLIBCXX_USE_CXX11_ABI=0 _POSIX=1 FREETYPE_GL_USE_VAO=1 RAD_TELEMETRY_DISABLED=1 LINUX=1 USE_SDL=1 _LINUX=1 POSIX=1 GNUC=1 NO_MALLOC_OVERRIDE=1 +DEFINES+=ENABLE_VISUALS=$(ENABLE_VISUALS) ENABLE_GUI=$(ENABLE_GUI) ENABLE_IPC=$(ENABLE_IPC) BUILD_GAME=$(GAME) ENABLE_NULL_GRAPHICS=$(ENABLE_NULL_GRAPHICS) TEXTMODE_STDIN=$(TEXTMODE_STDIN) TEXTMODE_VAC=$(TEXTMODE_VAC) DATA_PATH="\"$(DATA_PATH)\"" WARNING_FLAGS=-pedantic -Wall -Wextra -Wcast-align -Wcast-qual -Wctor-dtor-privacy -Wdisabled-optimization -Wformat=2 -Winit-self -Wlogical-op -Wmissing-declarations -Wmissing-include-dirs -Wnoexcept -Wold-style-cast -Woverloaded-virtual -Wredundant-decls -Wshadow -Wsign-conversion -Wsign-promo -Wstrict-null-sentinel -Wstrict-overflow=5 -Wswitch-default -Wundef COMMON_FLAGS=-fpermissive -O3 -shared -Wno-unknown-pragmas -fmessage-length=0 -m32 -fvisibility=hidden -fPIC -march=native -mtune=native - ifdef CLANG COMMON_FLAGS+=-Wno-c++11-narrowing endif @@ -21,92 +81,49 @@ endif ifdef BUILD_DEBUG COMMON_FLAGS+=-g3 -ggdb else -ifndef CLANG +ifneq ($(NO_LTO),1) COMMON_FLAGS+=-flto endif endif CFLAGS=$(COMMON_FLAGS) -CXXFLAGS=-std=gnu++14 $(COMMON_FLAGS) +CXXFLAGS=-std=gnu++1z $(COMMON_FLAGS) -ifndef NO_WARNINGS -CFLAGS+=$(WARNING_FLAGS) -CXXFLAGS+=$(WARNING_FLAGS) -else +ifdef NO_WARNINGS CFLAGS+=-w CXXFLAGS+=-w -endif - -SDKFOLDER=$(realpath source-sdk-2013/mp/src) -SIMPLE_IPC_DIR = $(realpath simple-ipc/src/include) -INCLUDES=-Iucccccp -isystemsrc/freetype-gl -isystemsrc/imgui -isystem/usr/local/include/freetype2 -isystem/usr/include/freetype2 -I$(SIMPLE_IPC_DIR) -isystem$(SDKFOLDER)/public -isystem$(SDKFOLDER)/mathlib -isystem$(SDKFOLDER)/common -isystem$(SDKFOLDER)/public/tier1 -isystem$(SDKFOLDER)/public/tier0 -isystem$(SDKFOLDER) -LIB_DIR=lib -LDFLAGS=-shared -L$(realpath $(LIB_DIR)) -ifdef CLANG -LDFLAGS+=-melf_i386 else -LDFLAGS+=-m32 -fno-gnu-unique +CFLAGS+=$(WARNING_FLAGS) +CXXFLAGS+=$(WARNING_FLAGS) endif -ifndef BUILD_DEBUG -ifndef CLANG -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 +ifeq ($(ENABLE_VISUALS),1) +INCLUDES+=-isystemsrc/freetype-gl -isystemsrc/imgui -isystem/usr/local/include/freetype2 -isystem/usr/include/freetype2 -I$(SIPC_DIR) +LDLIBS+=-lssl -l:libSDL2-2.0.so.0 -l:libGLEW.so -l:libfreetype.so +CXXFLAGS+=$(shell sdl2-config --cflags) +CFLAGS+=$(shell sdl2-config --cflags) +else +EXCL_SOURCES:=hacks/ESP.cpp hacks/SkinChanger.cpp hacks/SpyAlert.cpp hacks/Radar.cpp fidgetspinner.cpp ftrender.cpp hooks/sdl.cpp drawing.cpp drawmgr.cpp drawgl.cpp hooks/PaintTraverse.cpp EffectChams.cpp EffectGlow.cpp atlas.cpp +EXCL_SOURCES:=$(addprefix $(SRC_DIR)/,$(EXCL_SOURCES)) -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 +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 $(EXCL_SOURCES),$(SOURCES)) endif -ifdef TEXTMODE_STDIN -DEFINES+=-DTEXTMODE_STDIN -endif - -SRC_DIR = src -RES_DIR = res -TARGET_DIR = bin -TARGET = $(TARGET_DIR)/$(OUT_NAME) -SOURCES = $(shell find $(SRC_DIR) -name "*.c*" -print) -ifdef NOGUI -$(info GUI disabled) +ifneq ($(ENABLE_GUI),1) SOURCES := $(filter-out $(shell find $(SRC_DIR)/gui -name "*.cpp" -print),$(SOURCES)) -DEFINES+=NOGUI=1 -else -$(info GUI enabled) endif -ifdef GAME -$(info Building for: $(GAME)) -DEFINES+=BUILD_GAME=$(GAME) -else -$(info GUI enabled) -endif -SOURCES += $(shell find $(SIMPLE_IPC_DIR) -name "*.cpp" -print) -OBJECTS = $(patsubst %.c,%.o, $(patsubst %.cpp,%.o, $(SOURCES))) -OBJECTS += $(shell find $(RES_DIR) -name "*.o" -print) -DEPENDS = $(patsubst %.c,%.d, $(patsubst %.cpp,%.d, $(SOURCES))) -SRC_SUBDIRS=$(shell find $(SRC_DIR) -type d -print) + GIT_COMMIT_HASH=$(shell git log -1 --pretty="%h") GIT_COMMIT_DATE=$(shell git log -1 --pretty="%ai") DEFINES+=GIT_COMMIT_HASH="\"$(GIT_COMMIT_HASH)\"" GIT_COMMIT_DATE="\"$(GIT_COMMIT_DATE)\"" -ifdef GAME -DEFINES+=GAME=$(GAME) -endif - -ifdef NOIPC -$(info IPC disabled) -DEFINES += NO_IPC +ifeq ($(ENABLE_IPC),1) +SOURCES += $(shell find $(SIPC_DIR) -name "*.cpp" -print) endif CXXFLAGS+=$(addprefix -D,$(DEFINES)) @@ -115,38 +132,34 @@ CFLAGS+=$(addprefix -D,$(DEFINES)) CXXFLAGS+=$(INCLUDES) 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 hooks/PaintTraverse.cpp EffectChams.cpp EffectGlow.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 +OBJECTS = $(patsubst %.c,%.o, $(patsubst %.cpp,%.o, $(SOURCES))) +OBJECTS += $(shell find $(RES_DIR) -name "*.o" -print) +DEPENDS = $(patsubst %.c,%.d, $(patsubst %.cpp,%.d, $(SOURCES))) .PHONY: clean directories echo all: - mkdir -p $(TARGET_DIR) + mkdir -p $(OUT_DIR) $(MAKE) $(TARGET) echo: echo $(OBJECTS) +# 3rd party source files, we don't need warnings there + +# c++ src/imgui/imgui_demo.o : CXXFLAGS+=-w src/imgui/imgui_draw.o : CXXFLAGS+=-w src/imgui/imgui_impl_sdl.o : CXXFLAGS+=-w src/imgui/imgui.o : CXXFLAGS+=-w +src/sdk/checksum_md5.o : CXXFLAGS+=-w +src/sdk/convar.o : CXXFLAGS+=-w +src/sdk/KeyValues.o : CXXFLAGS+=-w +src/sdk/MaterialSystemUtil.o : CXXFLAGS+=-w +src/sdk/tier1.o : CXXFLAGS+=-w +src/sdk/utlbuffer.o : CXXFLAGS+=-w +# c src/freetype-gl/distance-field.o : CFLAGS+=-w src/freetype-gl/edtaa3func.o : CFLAGS+=-w src/freetype-gl/font-manager.o : CFLAGS+=-w @@ -160,12 +173,8 @@ src/freetype-gl/texture-font.o : CFLAGS+=-w src/freetype-gl/vector.o : CFLAGS+=-w src/freetype-gl/vertex-attribute.o : CFLAGS+=-w src/freetype-gl/vertex-buffer.o : CFLAGS+=-w -src/sdk/checksum_md5.o : CFLAGS+=-w -src/sdk/convar.o : CFLAGS+=-w -src/sdk/KeyValues.o : CFLAGS+=-w -src/sdk/MaterialSystemUtil.o : CFLAGS+=-w -src/sdk/tier1.o : CFLAGS+=-w -src/sdk/utlbuffer.o : CFLAGS+=-w + +# end of 3rd party sources .cpp.o: @echo Compiling $< @@ -180,7 +189,10 @@ src/sdk/utlbuffer.o : CFLAGS+=-w $(TARGET): $(OBJECTS) @echo Building cathook - $(LD) -o $(TARGET) $(LDFLAGS) $(OBJECTS) $(LDLIBS) + $(LD) -o $@ $(LDFLAGS) $(OBJECTS) $(LDLIBS) +ifndef BUILD_DEBUG + strip --strip-all $@ +endif clean: find src -type f -name '*.o' -delete diff --git a/src/atlas.cpp b/src/atlas.cpp index f1230bcc..8ec70eb1 100644 --- a/src/atlas.cpp +++ b/src/atlas.cpp @@ -5,7 +5,7 @@ * Author: nullifiedcat */ -#ifndef TEXTMODE +#if ENABLE_VISUALS == 1 #include "atlas.hpp" diff --git a/src/common.h b/src/common.h index e739c8d9..2e9de26f 100644 --- a/src/common.h +++ b/src/common.h @@ -42,7 +42,7 @@ #include "macros.hpp" #include "colors.hpp" -#ifndef TEXTMODE +#if ENABLE_VISUALS == 1 extern "C" { #include diff --git a/src/drawing.cpp b/src/drawing.cpp index 169a7466..5d812c90 100644 --- a/src/drawing.cpp +++ b/src/drawing.cpp @@ -5,7 +5,7 @@ * Author: nullifiedcat */ -#ifndef TEXTMODE +#if ENABLE_VISUALS == 1 #include "common.h" #include "sdk.h" diff --git a/src/hack.cpp b/src/hack.cpp index 66d9955a..fd4cc96e 100644 --- a/src/hack.cpp +++ b/src/hack.cpp @@ -40,7 +40,7 @@ #define STRINGIFY(x) #x #define TO_STRING(x) STRINGIFY(x) -#ifndef TEXTMODE +#if ENABLE_VISUALS == 1 #include "ftrender.hpp" #endif @@ -97,8 +97,8 @@ const std::string& hack::GetType() { version += " DYNAMIC"; #endif -#ifdef TEXTMODE - version += " TEXTMODE"; +#if not ENABLE_VISUALS + version += " NOVISUALS"; #endif version = version.substr(1); @@ -112,7 +112,7 @@ std::stack& hack::command_stack() { return stack; } -#ifndef TEXTMODE /* Why would we need colored chat stuff in textmode? */ +#if ENABLE_VISUALS == 1 /* Why would we need colored chat stuff in textmode? */ class AdvancedEventListener : public IGameEventListener { public: @@ -163,7 +163,7 @@ void hack::CC_Cat(const CCommand& args) { void hack::Initialize() { // Essential files must always exist, except when the game is running in text mode. -#ifndef TEXTMODE +#if ENABLE_VISUALS == 1 { std::vector essential = { @@ -196,7 +196,7 @@ void hack::Initialize() { logging::Info("Is TF? %d", IsTF()); InitClassTable(); -#ifndef TEXTMODE /* We don't need medal to flip 100% when running textmode */ +#if ENABLE_VISUALS == 1 /* 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); @@ -220,7 +220,7 @@ void hack::Initialize() { g_Settings.Init(); EndConVars(); -#ifndef TEXTMODE +#if ENABLE_VISUALS == 1 draw::Initialize(); #if ENABLE_GUI @@ -234,7 +234,7 @@ void hack::Initialize() { InitNetVars(); g_pLocalPlayer = new LocalPlayer(); g_pPlayerResource = new TFPlayerResource(); -#ifndef TEXTMODE +#if ENABLE_VISUALS == 1 hooks::panel.Set(g_IPanel); hooks::panel.HookMethod((void*)PaintTraverse_hook, offsets::PaintTraverse()); hooks::panel.Apply(); @@ -247,7 +247,7 @@ void hack::Initialize() { } hooks::clientmode.Set((void*)clientMode); hooks::clientmode.HookMethod((void*)CreateMove_hook, offsets::CreateMove()); -#ifndef TEXTMODE +#if ENABLE_VISUALS == 1 hooks::clientmode.HookMethod((void*)OverrideView_hook, offsets::OverrideView()); #endif /* TEXTMODE */ hooks::clientmode.HookMethod((void*)LevelInit_hook, offsets::LevelInit()); @@ -260,10 +260,11 @@ void hack::Initialize() { hooks::client.HookMethod((void*)FrameStageNotify_hook, offsets::FrameStageNotify()); hooks::client.HookMethod((void*)DispatchUserMessage_hook, offsets::DispatchUserMessage()); -#if TEXTMODE - //g_IMaterialSystem->SetInStubMode(true); - /*IF_GAME(IsTF2()) { +#if ENABLE_NULL_GRAPHICS == 1 + g_IMaterialSystem->SetInStubMode(true); + IF_GAME(IsTF2()) { logging::Info("Graphics Nullified"); + logging::Info("The game will crash"); // TODO offsets::()? hooks::materialsystem.Set((void*)g_IMaterialSystem); uintptr_t base = *(uintptr_t*)(g_IMaterialSystem); @@ -275,16 +276,16 @@ void hack::Initialize() { hooks::materialsystem.HookMethod((void*)FindMaterialEx_null_hook, 123); hooks::materialsystem.Apply(); //hooks::materialsystem.HookMethod(); - }*/ + } #endif -#ifndef TEXTMODE +#if ENABLE_VISUALS == 1 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 +#if ENABLE_VISUALS == 1 hooks::modelrender.Set(g_IVModelRender); hooks::modelrender.HookMethod((void*)DrawModelExecute_hook, offsets::DrawModelExecute()); hooks::modelrender.Apply(); @@ -310,7 +311,7 @@ void hack::Initialize() { velocity::Init(); playerlist::Load(); -#ifndef TEXTMODE +#if ENABLE_VISUALS == 1 InitStrings(); #if ENABLE_GUI @@ -334,7 +335,7 @@ void hack::Initialize() { hacks::shared::anticheat::Init(); hacks::tf2::healarrow::Init(); -#ifndef TEXTMODE +#if ENABLE_VISUALS == 1 InitSpinner(); logging::Info("Initialized Fidget Spinner"); hacks::shared::spam::Init(); @@ -351,7 +352,7 @@ void hack::Initialize() { } logging::Info("Initializer stack done"); -#ifdef TEXTMODE +#if not ENABLE_VISUALS hack::command_stack().push("exec cat_autoexec_textmode"); #endif hack::command_stack().push("exec cat_autoexec"); diff --git a/src/hacks/Aimbot.cpp b/src/hacks/Aimbot.cpp index 294f48d5..cbab4e8c 100644 --- a/src/hacks/Aimbot.cpp +++ b/src/hacks/Aimbot.cpp @@ -143,7 +143,7 @@ void CreateMove() { } } -#ifndef TEXTMODE +#if ENABLE_VISUALS == 1 // Set target esp color to pink hacks::shared::esp::SetEntityColor(target, colors::pink); #endif @@ -965,7 +965,7 @@ void Reset() { projectile_mode = false; } -#ifndef TEXTMODE +#if ENABLE_VISUALS == 1 // 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"); diff --git a/src/hacks/Aimbot.h b/src/hacks/Aimbot.h index 84c8824e..924de27a 100644 --- a/src/hacks/Aimbot.h +++ b/src/hacks/Aimbot.h @@ -39,7 +39,7 @@ extern int target_eid; // Functions called by other functions for when certian game calls are run void CreateMove(); -#ifndef TEXTMODE +#if ENABLE_VISUALS == 1 void DrawText(); #endif void Reset(); diff --git a/src/hacks/FollowBot.cpp b/src/hacks/FollowBot.cpp index d42a3ed5..e5301695 100644 --- a/src/hacks/FollowBot.cpp +++ b/src/hacks/FollowBot.cpp @@ -76,7 +76,7 @@ void AfterCreateMove() { if (CE_BAD(entity)) { selection.erase(it++); } else { -#ifndef TEXTMODE +#if ENABLE_VISUALS == 1 hacks::shared::esp::AddEntityString(entity, "[SELECTED]", colors::orange); if (fmod(g_GlobalVars->curtime, 2.0f) < 1.0f) { hacks::shared::esp::SetEntityColor(entity, colors::yellow); @@ -94,7 +94,7 @@ void AfterCreateMove() { if (CE_BAD(entity)) { selection_secondary.erase(it++); } else { -#ifndef TEXTMODE +#if ENABLE_VISUALS == 1 hacks::shared::esp::AddEntityString(entity, "[SELECTED (SECONDARY)]", colors::orange); if (fmod(g_GlobalVars->curtime, 2.0f) < 1.0f) { hacks::shared::esp::SetEntityColor(entity, colors::yellow); @@ -203,7 +203,7 @@ void DoWalking() { int following_idx2 = 0; if (CE_GOOD(found_entity)) { following_idx2 = found_entity->m_IDX; -#ifndef TEXTMODE +#if ENABLE_VISUALS == 1 hacks::shared::esp::AddEntityString(found_entity, "[FOLLOWING]", colors::green); hacks::shared::esp::SetEntityColor(found_entity, colors::green); #endif @@ -695,7 +695,7 @@ void CrumbBottomAdd() { logging::Info("Crumb Over-Prune!\nDumping array"); } } -#ifndef TEXTMODE +#if ENABLE_VISUALS == 1 // Function called when we need to draw onto the screen void Draw() { diff --git a/src/hacks/FollowBot.h b/src/hacks/FollowBot.h index 2e60a5f2..770babcf 100644 --- a/src/hacks/FollowBot.h +++ b/src/hacks/FollowBot.h @@ -34,7 +34,7 @@ extern int following_idx; bool IsBot(CachedEntity* entity); void AddMessageHandlers(ipc::peer_t* peer); void AfterCreateMove(); -#ifndef TEXTMODE +#if ENABLE_VISUALS == 1 void Draw(); #endif void CrumbReset(); diff --git a/src/hacks/HealArrows.cpp b/src/hacks/HealArrows.cpp index 94ee9b52..f061cf45 100644 --- a/src/hacks/HealArrows.cpp +++ b/src/hacks/HealArrows.cpp @@ -77,7 +77,7 @@ void CreateMove() { } void Draw() { -#ifndef TEXTMODE +#if ENABLE_VISUALS == 1 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); diff --git a/src/hacks/Misc.cpp b/src/hacks/Misc.cpp index 83c48d73..bf4f098a 100644 --- a/src/hacks/Misc.cpp +++ b/src/hacks/Misc.cpp @@ -349,7 +349,7 @@ void CreateMove() { } } -#ifndef TEXTMODE +#if ENABLE_VISUALS == 1 void DrawText() { if (crit_info && CE_GOOD(LOCAL_W)) { diff --git a/src/hacks/Misc.h b/src/hacks/Misc.h index 276e8b0f..7622d280 100644 --- a/src/hacks/Misc.h +++ b/src/hacks/Misc.h @@ -13,7 +13,7 @@ namespace hacks { namespace shared { namespace misc { void CreateMove(); -#ifndef TEXTMODE +#if ENABLE_VISUALS == 1 void DrawText(); #endif diff --git a/src/hacks/Walkbot.cpp b/src/hacks/Walkbot.cpp index ab34a53c..ca08b83b 100644 --- a/src/hacks/Walkbot.cpp +++ b/src/hacks/Walkbot.cpp @@ -796,7 +796,7 @@ void RecordNode() { state::active_node = node; } -#ifndef TEXTMODE +#if ENABLE_VISUALS == 1 // Draws a single colored connection between 2 nodes void DrawConnection(index_t a, connection_s& b) { diff --git a/src/hacks/Walkbot.hpp b/src/hacks/Walkbot.hpp index ce20930e..0f90b01b 100644 --- a/src/hacks/Walkbot.hpp +++ b/src/hacks/Walkbot.hpp @@ -10,7 +10,7 @@ namespace hacks { namespace shared { namespace walkbot { void Initialize(); -#ifndef TEXTMODE +#if ENABLE_VISUALS == 1 void Draw(); #endif void Move(); diff --git a/src/hacks/hacklist.h b/src/hacks/hacklist.h index fe4cd48a..ce620fc5 100644 --- a/src/hacks/hacklist.h +++ b/src/hacks/hacklist.h @@ -8,7 +8,7 @@ #ifndef HACKS_HACKLIST_H_ #define HACKS_HACKLIST_H_ -#ifndef TEXTMODE +#if ENABLE_VISUALS == 1 #include "ESP.h" #include "SkinChanger.hpp" diff --git a/src/helpers.cpp b/src/helpers.cpp index e9434758..2293de11 100644 --- a/src/helpers.cpp +++ b/src/helpers.cpp @@ -779,7 +779,7 @@ CatCommand print_classnames("debug_print_classnames", "Lists classnames currentl }); void PrintChat(const char* fmt, ...) { -#if TEXTMODE +#if not ENABLE_VISUALS return; #endif CHudBaseChat* chat = (CHudBaseChat*)g_CHUD->FindElement("CHudChat"); diff --git a/src/hooks/CreateMove.cpp b/src/hooks/CreateMove.cpp index 15e420af..e77f103b 100644 --- a/src/hooks/CreateMove.cpp +++ b/src/hooks/CreateMove.cpp @@ -268,7 +268,7 @@ bool CreateMove_hook(void* thisptr, float inputSample, CUserCmd* cmd) { SAFE_CALL(UpdateHoovyList()); } g_pLocalPlayer->v_OrigViewangles = cmd->viewangles; -#ifndef TEXTMODE +#if ENABLE_VISUALS == 1 { PROF_SECTION(CM_esp); SAFE_CALL(hacks::shared::esp::CreateMove()); diff --git a/src/hooks/PaintTraverse.cpp b/src/hooks/PaintTraverse.cpp index f703f7df..837c211e 100644 --- a/src/hooks/PaintTraverse.cpp +++ b/src/hooks/PaintTraverse.cpp @@ -41,7 +41,7 @@ void PaintTraverse_hook(void* _this, unsigned int vp, bool fr, bool ar) { if (!segvcatch::handler_segv) segvcatch::init_fpe(); } #endif -#ifndef TEXTMODE +#if ENABLE_VISUALS == 1 if (!textures_loaded) { textures_loaded = true; hacks::tf::radar::Init(); @@ -130,7 +130,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 +#if ENABLE_VISUALS == 1 draw::UpdateWTS(); BeginCheatVisuals(); DrawCheatVisuals(); diff --git a/src/hooks/others.cpp b/src/hooks/others.cpp index 0176c423..57b660aa 100644 --- a/src/hooks/others.cpp +++ b/src/hooks/others.cpp @@ -12,7 +12,7 @@ #include "ucccccp.hpp" #include "hookedmethods.h" -#ifndef TEXTMODE +#if ENABLE_VISUALS == 1 static CatVar no_invisibility(CV_SWITCH, "no_invis", "0", "Remove Invisibility", "Useful with chams!"); @@ -385,7 +385,7 @@ 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; -#ifndef TEXTMODE +#if ENABLE_VISUALS == 1 { PROF_SECTION(FSN_skinchanger); hacks::tf2::skinchanger::FrameStageNotify(stage); @@ -436,7 +436,7 @@ void FrameStageNotify_hook(void* _this, int stage) { hack::command_stack().pop(); } } -#if defined(TEXTMODE) and defined(TEXTMODE_STDIN) +#if TEXTMODE_STDIN == 1 static auto last_stdin = std::chrono::system_clock::from_time_t(0); auto ms = std::chrono::duration_cast(std::chrono::system_clock::now() - last_stdin).count(); if (ms > 500) { @@ -445,7 +445,7 @@ void FrameStageNotify_hook(void* _this, int stage) { } #endif } -#ifndef TEXTMODE +#if ENABLE_VISUALS == 1 if (cathook && !g_Settings.bInvalid && stage == FRAME_RENDER_START) { #if ENABLE_GUI if (cursor_fix_experimental) { diff --git a/src/hooks/others.h b/src/hooks/others.h index dfbfe301..4fa3845d 100644 --- a/src/hooks/others.h +++ b/src/hooks/others.h @@ -27,7 +27,7 @@ void LevelInit_hook(void*, const char*); void LevelShutdown_hook(void*); -#ifdef TEXTMODE +#if ENABLE_NULL_GRAPHICS == 1 typedef ITexture*(*FindTexture_t)(void*, const char*, const char*, bool, int); typedef IMaterial*(*FindMaterialEx_t)(void*, const char*, const char*, int, bool, const char*); typedef IMaterial*(*FindMaterial_t)(void*, const char*, const char*, bool, const char*); diff --git a/src/interfaces.cpp b/src/interfaces.cpp index 0ea76c7c..e1cbd62b 100644 --- a/src/interfaces.cpp +++ b/src/interfaces.cpp @@ -131,7 +131,7 @@ void CreateInterfaces() { } g_IMaterialSystem = BruteforceInterface("VMaterialSystem", sharedobj::materialsystem()); -#ifndef TEXTMODE +#if ENABLE_VISUALS == 1 g_IVDebugOverlay = BruteforceInterface("VDebugOverlay", sharedobj::engine()); g_IPanel = BruteforceInterface("VGUI_Panel", sharedobj::vgui2()); g_ISurface = BruteforceInterface("VGUI_Surface", sharedobj::vguimatsurface()); diff --git a/src/logging.cpp b/src/logging.cpp index de101f70..0967876c 100644 --- a/src/logging.cpp +++ b/src/logging.cpp @@ -39,7 +39,7 @@ void logging::Info(const char* fmt, ...) { sprintf(result, "%% [%s] %s\n", timeString, buffer); fprintf(logging::handle, "%s", result); fflush(logging::handle); -#ifndef TEXTMODE +#if ENABLE_VISUALS == 1 if (g_ICvar) { if (console_logging.convar_parent && console_logging) g_ICvar->ConsolePrintf("%s", result); diff --git a/src/macros.hpp b/src/macros.hpp index 5d71f284..62fa5759 100644 --- a/src/macros.hpp +++ b/src/macros.hpp @@ -10,10 +10,3 @@ #ifndef DATA_PATH # define DATA_PATH "/opt/cathook-data" #endif - -#if defined(NOGUI) and NOGUI == 1 or defined(TEXTMODE) -#define ENABLE_GUI false -#else -#define ENABLE_GUI true -#endif - diff --git a/src/prediction.cpp b/src/prediction.cpp index 21d03410..7ea9b129 100644 --- a/src/prediction.cpp +++ b/src/prediction.cpp @@ -81,7 +81,7 @@ void Prediction_CreateMove() { } } } -#ifndef TEXTMODE +#if ENABLE_VISUALS == 1 void Prediction_PaintTraverse() { if (!debug_enginepred) return; for (int i = 1; i < predicted_player_count; i++) { diff --git a/src/prediction.h b/src/prediction.h index bd4bab32..21165252 100644 --- a/src/prediction.h +++ b/src/prediction.h @@ -24,7 +24,7 @@ float PlayerGravityMod(CachedEntity* player); Vector EnginePrediction(CachedEntity* player, float time); void Prediction_CreateMove(); -#ifndef TEXTMODE +#if ENABLE_VISUALS == 1 void Prediction_PaintTraverse(); #endif diff --git a/src/sharedobj.cpp b/src/sharedobj.cpp index 3f12bb14..826fca32 100644 --- a/src/sharedobj.cpp +++ b/src/sharedobj.cpp @@ -80,7 +80,7 @@ void LoadAllSharedObjects() { tier0().Load(); inputsystem().Load(); materialsystem().Load(); -#ifndef TEXTMODE +#if ENABLE_VISUALS == 1 vguimatsurface().Load(); vgui2().Load(); studiorender().Load(); @@ -119,7 +119,7 @@ SharedObject& materialsystem() { static SharedObject obj("materialsystem.so", true); return obj; } -#ifndef TEXTMODE +#if ENABLE_VISUALS == 1 SharedObject& vguimatsurface() { static SharedObject obj("vguimatsurface.so", true); return obj; diff --git a/src/sharedobj.h b/src/sharedobj.h index 57356101..60a975a3 100644 --- a/src/sharedobj.h +++ b/src/sharedobj.h @@ -43,7 +43,7 @@ SharedObject& vstdlib(); SharedObject& tier0(); SharedObject& inputsystem(); SharedObject& materialsystem(); -#ifndef TEXTMODE +#if ENABLE_VISUALS == 1 SharedObject& vguimatsurface(); SharedObject& vgui2(); SharedObject& studiorender(); diff --git a/src/textmode.cpp b/src/textmode.cpp index 8c689c53..ef2745af 100644 --- a/src/textmode.cpp +++ b/src/textmode.cpp @@ -32,19 +32,20 @@ CatCommand fixvac("fixvac", "Lemme in to secure servers", []() { *allowSecureServers = true; }); -#ifdef TEXTMODE InitRoutine init([]() { -#ifdef TEXTMODE_STDIN +#if TEXTMODE_STDIN == 1 logging::Info("[TEXTMODE] Setting up input handling"); int flags = fcntl(0, F_GETFL, 0); flags |= O_NONBLOCK; fcntl(0, F_SETFL, flags); logging::Info("[TEXTMODE] stdin is now non-blocking"); #endif +#if TEXTMODE_VAC == 1 EXPOSED_Epic_VACBypass_1337_DoNotSteal_xXx_$1_xXx_MLG(); -}); #endif +}); +#if TEXTMODE_STDIN == 1 void UpdateInput() { char buffer[256]; int bytes = read(0, buffer, 255); @@ -53,3 +54,4 @@ void UpdateInput() { g_IEngine->ExecuteClientCmd(buffer); } } +#endif