MASSIVE makefile changes

This commit is contained in:
nullifiedcat 2017-08-14 23:02:11 +03:00
parent d4eb7c0eb9
commit c78b4bce1c
28 changed files with 162 additions and 154 deletions

198
makefile
View File

@ -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 ifndef CLANG
CXX=$(shell sh -c "which g++-7 || which g++-6 || which g++") CXX=$(shell sh -c "which g++-6 || which g++")
CC=$(shell sh -c "which gcc-7 || which gcc-6 || which gcc") CC=$(shell sh -c "which gcc-6 || which gcc")
LD=$(CXX) LD=$(CXX)
LDFLAGS+=-m32 -fno-gnu-unique
else else
CXX=clang++ CXX=clang++
CC=clang CC=clang
LD=ld.lld LD=ld.lld
LDFLAGS+=-melf_i386
endif 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 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 COMMON_FLAGS=-fpermissive -O3 -shared -Wno-unknown-pragmas -fmessage-length=0 -m32 -fvisibility=hidden -fPIC -march=native -mtune=native
ifdef CLANG ifdef CLANG
COMMON_FLAGS+=-Wno-c++11-narrowing COMMON_FLAGS+=-Wno-c++11-narrowing
endif endif
@ -21,92 +81,49 @@ endif
ifdef BUILD_DEBUG ifdef BUILD_DEBUG
COMMON_FLAGS+=-g3 -ggdb COMMON_FLAGS+=-g3 -ggdb
else else
ifndef CLANG ifneq ($(NO_LTO),1)
COMMON_FLAGS+=-flto COMMON_FLAGS+=-flto
endif endif
endif endif
CFLAGS=$(COMMON_FLAGS) CFLAGS=$(COMMON_FLAGS)
CXXFLAGS=-std=gnu++14 $(COMMON_FLAGS) CXXFLAGS=-std=gnu++1z $(COMMON_FLAGS)
ifndef NO_WARNINGS ifdef NO_WARNINGS
CFLAGS+=$(WARNING_FLAGS)
CXXFLAGS+=$(WARNING_FLAGS)
else
CFLAGS+=-w CFLAGS+=-w
CXXFLAGS+=-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 else
LDFLAGS+=-m32 -fno-gnu-unique CFLAGS+=$(WARNING_FLAGS)
CXXFLAGS+=$(WARNING_FLAGS)
endif endif
ifndef BUILD_DEBUG ifeq ($(ENABLE_VISUALS),1)
ifndef CLANG INCLUDES+=-isystemsrc/freetype-gl -isystemsrc/imgui -isystem/usr/local/include/freetype2 -isystem/usr/include/freetype2 -I$(SIPC_DIR)
LDFLAGS+=-flto LDLIBS+=-lssl -l:libSDL2-2.0.so.0 -l:libGLEW.so -l:libfreetype.so
endif CXXFLAGS+=$(shell sdl2-config --cflags)
endif CFLAGS+=$(shell sdl2-config --cflags)
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 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 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))
ifdef TEXTMODE SOURCES:=$(filter-out $(shell find $(SRC_DIR)/imgui -name "*.c*" -print),$(SOURCES))
$(info Compiling for text mode only!) SOURCES:=$(filter-out $(EXCL_SOURCES),$(SOURCES))
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 endif
ifdef TEXTMODE_STDIN ifneq ($(ENABLE_GUI),1)
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)
SOURCES := $(filter-out $(shell find $(SRC_DIR)/gui -name "*.cpp" -print),$(SOURCES)) SOURCES := $(filter-out $(shell find $(SRC_DIR)/gui -name "*.cpp" -print),$(SOURCES))
DEFINES+=NOGUI=1
else
$(info GUI enabled)
endif 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_HASH=$(shell git log -1 --pretty="%h")
GIT_COMMIT_DATE=$(shell git log -1 --pretty="%ai") GIT_COMMIT_DATE=$(shell git log -1 --pretty="%ai")
DEFINES+=GIT_COMMIT_HASH="\"$(GIT_COMMIT_HASH)\"" GIT_COMMIT_DATE="\"$(GIT_COMMIT_DATE)\"" DEFINES+=GIT_COMMIT_HASH="\"$(GIT_COMMIT_HASH)\"" GIT_COMMIT_DATE="\"$(GIT_COMMIT_DATE)\""
ifdef GAME ifeq ($(ENABLE_IPC),1)
DEFINES+=GAME=$(GAME) SOURCES += $(shell find $(SIPC_DIR) -name "*.cpp" -print)
endif
ifdef NOIPC
$(info IPC disabled)
DEFINES += NO_IPC
endif endif
CXXFLAGS+=$(addprefix -D,$(DEFINES)) CXXFLAGS+=$(addprefix -D,$(DEFINES))
@ -115,38 +132,34 @@ CFLAGS+=$(addprefix -D,$(DEFINES))
CXXFLAGS+=$(INCLUDES) CXXFLAGS+=$(INCLUDES)
CFLAGS+=$(INCLUDES) CFLAGS+=$(INCLUDES)
ifdef TEXTMODE OBJECTS = $(patsubst %.c,%.o, $(patsubst %.cpp,%.o, $(SOURCES)))
OBJECTS += $(shell find $(RES_DIR) -name "*.o" -print)
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 DEPENDS = $(patsubst %.c,%.d, $(patsubst %.cpp,%.d, $(SOURCES)))
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 .PHONY: clean directories echo
all: all:
mkdir -p $(TARGET_DIR) mkdir -p $(OUT_DIR)
$(MAKE) $(TARGET) $(MAKE) $(TARGET)
echo: echo:
echo $(OBJECTS) echo $(OBJECTS)
# 3rd party source files, we don't need warnings there
# c++
src/imgui/imgui_demo.o : CXXFLAGS+=-w src/imgui/imgui_demo.o : CXXFLAGS+=-w
src/imgui/imgui_draw.o : CXXFLAGS+=-w src/imgui/imgui_draw.o : CXXFLAGS+=-w
src/imgui/imgui_impl_sdl.o : CXXFLAGS+=-w src/imgui/imgui_impl_sdl.o : CXXFLAGS+=-w
src/imgui/imgui.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/distance-field.o : CFLAGS+=-w
src/freetype-gl/edtaa3func.o : CFLAGS+=-w src/freetype-gl/edtaa3func.o : CFLAGS+=-w
src/freetype-gl/font-manager.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/vector.o : CFLAGS+=-w
src/freetype-gl/vertex-attribute.o : CFLAGS+=-w src/freetype-gl/vertex-attribute.o : CFLAGS+=-w
src/freetype-gl/vertex-buffer.o : CFLAGS+=-w src/freetype-gl/vertex-buffer.o : CFLAGS+=-w
src/sdk/checksum_md5.o : CFLAGS+=-w
src/sdk/convar.o : CFLAGS+=-w # end of 3rd party sources
src/sdk/KeyValues.o : CFLAGS+=-w
src/sdk/MaterialSystemUtil.o : CFLAGS+=-w
src/sdk/tier1.o : CFLAGS+=-w
src/sdk/utlbuffer.o : CFLAGS+=-w
.cpp.o: .cpp.o:
@echo Compiling $< @echo Compiling $<
@ -180,7 +189,10 @@ src/sdk/utlbuffer.o : CFLAGS+=-w
$(TARGET): $(OBJECTS) $(TARGET): $(OBJECTS)
@echo Building cathook @echo Building cathook
$(LD) -o $(TARGET) $(LDFLAGS) $(OBJECTS) $(LDLIBS) $(LD) -o $@ $(LDFLAGS) $(OBJECTS) $(LDLIBS)
ifndef BUILD_DEBUG
strip --strip-all $@
endif
clean: clean:
find src -type f -name '*.o' -delete find src -type f -name '*.o' -delete

View File

@ -5,7 +5,7 @@
* Author: nullifiedcat * Author: nullifiedcat
*/ */
#ifndef TEXTMODE #if ENABLE_VISUALS == 1
#include "atlas.hpp" #include "atlas.hpp"

View File

@ -42,7 +42,7 @@
#include "macros.hpp" #include "macros.hpp"
#include "colors.hpp" #include "colors.hpp"
#ifndef TEXTMODE #if ENABLE_VISUALS == 1
extern "C" { extern "C" {
#include <vec234.h> #include <vec234.h>

View File

@ -5,7 +5,7 @@
* Author: nullifiedcat * Author: nullifiedcat
*/ */
#ifndef TEXTMODE #if ENABLE_VISUALS == 1
#include "common.h" #include "common.h"
#include "sdk.h" #include "sdk.h"

View File

@ -40,7 +40,7 @@
#define STRINGIFY(x) #x #define STRINGIFY(x) #x
#define TO_STRING(x) STRINGIFY(x) #define TO_STRING(x) STRINGIFY(x)
#ifndef TEXTMODE #if ENABLE_VISUALS == 1
#include "ftrender.hpp" #include "ftrender.hpp"
#endif #endif
@ -97,8 +97,8 @@ const std::string& hack::GetType() {
version += " DYNAMIC"; version += " DYNAMIC";
#endif #endif
#ifdef TEXTMODE #if not ENABLE_VISUALS
version += " TEXTMODE"; version += " NOVISUALS";
#endif #endif
version = version.substr(1); version = version.substr(1);
@ -112,7 +112,7 @@ std::stack<std::string>& hack::command_stack() {
return 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 { class AdvancedEventListener : public IGameEventListener {
public: public:
@ -163,7 +163,7 @@ void hack::CC_Cat(const CCommand& args) {
void hack::Initialize() { void hack::Initialize() {
// Essential files must always exist, except when the game is running in text mode. // Essential files must always exist, except when the game is running in text mode.
#ifndef TEXTMODE #if ENABLE_VISUALS == 1
{ {
std::vector<std::string> essential = { std::vector<std::string> essential = {
@ -196,7 +196,7 @@ void hack::Initialize() {
logging::Info("Is TF? %d", IsTF()); logging::Info("Is TF? %d", IsTF());
InitClassTable(); 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()) { 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); 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(); g_Settings.Init();
EndConVars(); EndConVars();
#ifndef TEXTMODE #if ENABLE_VISUALS == 1
draw::Initialize(); draw::Initialize();
#if ENABLE_GUI #if ENABLE_GUI
@ -234,7 +234,7 @@ void hack::Initialize() {
InitNetVars(); InitNetVars();
g_pLocalPlayer = new LocalPlayer(); g_pLocalPlayer = new LocalPlayer();
g_pPlayerResource = new TFPlayerResource(); g_pPlayerResource = new TFPlayerResource();
#ifndef TEXTMODE #if ENABLE_VISUALS == 1
hooks::panel.Set(g_IPanel); hooks::panel.Set(g_IPanel);
hooks::panel.HookMethod((void*)PaintTraverse_hook, offsets::PaintTraverse()); hooks::panel.HookMethod((void*)PaintTraverse_hook, offsets::PaintTraverse());
hooks::panel.Apply(); hooks::panel.Apply();
@ -247,7 +247,7 @@ void hack::Initialize() {
} }
hooks::clientmode.Set((void*)clientMode); hooks::clientmode.Set((void*)clientMode);
hooks::clientmode.HookMethod((void*)CreateMove_hook, offsets::CreateMove()); hooks::clientmode.HookMethod((void*)CreateMove_hook, offsets::CreateMove());
#ifndef TEXTMODE #if ENABLE_VISUALS == 1
hooks::clientmode.HookMethod((void*)OverrideView_hook, offsets::OverrideView()); hooks::clientmode.HookMethod((void*)OverrideView_hook, offsets::OverrideView());
#endif /* TEXTMODE */ #endif /* TEXTMODE */
hooks::clientmode.HookMethod((void*)LevelInit_hook, offsets::LevelInit()); 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*)FrameStageNotify_hook, offsets::FrameStageNotify());
hooks::client.HookMethod((void*)DispatchUserMessage_hook, offsets::DispatchUserMessage()); hooks::client.HookMethod((void*)DispatchUserMessage_hook, offsets::DispatchUserMessage());
#if TEXTMODE #if ENABLE_NULL_GRAPHICS == 1
//g_IMaterialSystem->SetInStubMode(true); g_IMaterialSystem->SetInStubMode(true);
/*IF_GAME(IsTF2()) { IF_GAME(IsTF2()) {
logging::Info("Graphics Nullified"); logging::Info("Graphics Nullified");
logging::Info("The game will crash");
// TODO offsets::()? // TODO offsets::()?
hooks::materialsystem.Set((void*)g_IMaterialSystem); hooks::materialsystem.Set((void*)g_IMaterialSystem);
uintptr_t base = *(uintptr_t*)(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.HookMethod((void*)FindMaterialEx_null_hook, 123);
hooks::materialsystem.Apply(); hooks::materialsystem.Apply();
//hooks::materialsystem.HookMethod(); //hooks::materialsystem.HookMethod();
}*/ }
#endif #endif
#ifndef TEXTMODE #if ENABLE_VISUALS == 1
hooks::client.HookMethod((void*)IN_KeyEvent_hook, offsets::IN_KeyEvent()); hooks::client.HookMethod((void*)IN_KeyEvent_hook, offsets::IN_KeyEvent());
#endif /* TEXTMODE */ #endif /* TEXTMODE */
hooks::client.Apply(); hooks::client.Apply();
hooks::input.Set(g_IInput); hooks::input.Set(g_IInput);
hooks::input.HookMethod((void*)GetUserCmd_hook, offsets::GetUserCmd()); hooks::input.HookMethod((void*)GetUserCmd_hook, offsets::GetUserCmd());
hooks::input.Apply(); hooks::input.Apply();
#ifndef TEXTMODE #if ENABLE_VISUALS == 1
hooks::modelrender.Set(g_IVModelRender); hooks::modelrender.Set(g_IVModelRender);
hooks::modelrender.HookMethod((void*)DrawModelExecute_hook, offsets::DrawModelExecute()); hooks::modelrender.HookMethod((void*)DrawModelExecute_hook, offsets::DrawModelExecute());
hooks::modelrender.Apply(); hooks::modelrender.Apply();
@ -310,7 +311,7 @@ void hack::Initialize() {
velocity::Init(); velocity::Init();
playerlist::Load(); playerlist::Load();
#ifndef TEXTMODE #if ENABLE_VISUALS == 1
InitStrings(); InitStrings();
#if ENABLE_GUI #if ENABLE_GUI
@ -334,7 +335,7 @@ void hack::Initialize() {
hacks::shared::anticheat::Init(); hacks::shared::anticheat::Init();
hacks::tf2::healarrow::Init(); hacks::tf2::healarrow::Init();
#ifndef TEXTMODE #if ENABLE_VISUALS == 1
InitSpinner(); InitSpinner();
logging::Info("Initialized Fidget Spinner"); logging::Info("Initialized Fidget Spinner");
hacks::shared::spam::Init(); hacks::shared::spam::Init();
@ -351,7 +352,7 @@ void hack::Initialize() {
} }
logging::Info("Initializer stack done"); logging::Info("Initializer stack done");
#ifdef TEXTMODE #if not ENABLE_VISUALS
hack::command_stack().push("exec cat_autoexec_textmode"); hack::command_stack().push("exec cat_autoexec_textmode");
#endif #endif
hack::command_stack().push("exec cat_autoexec"); hack::command_stack().push("exec cat_autoexec");

View File

@ -143,7 +143,7 @@ void CreateMove() {
} }
} }
#ifndef TEXTMODE #if ENABLE_VISUALS == 1
// Set target esp color to pink // Set target esp color to pink
hacks::shared::esp::SetEntityColor(target, colors::pink); hacks::shared::esp::SetEntityColor(target, colors::pink);
#endif #endif
@ -965,7 +965,7 @@ void Reset() {
projectile_mode = false; projectile_mode = false;
} }
#ifndef TEXTMODE #if ENABLE_VISUALS == 1
// Function called when we need to draw to screen // 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"); static CatVar fov_draw(CV_SWITCH, "aimbot_fov_draw", "0", "Draw Fov Ring", "Draws a ring to represent your current aimbot fov");

View File

@ -39,7 +39,7 @@ extern int target_eid;
// Functions called by other functions for when certian game calls are run // Functions called by other functions for when certian game calls are run
void CreateMove(); void CreateMove();
#ifndef TEXTMODE #if ENABLE_VISUALS == 1
void DrawText(); void DrawText();
#endif #endif
void Reset(); void Reset();

View File

@ -76,7 +76,7 @@ void AfterCreateMove() {
if (CE_BAD(entity)) { if (CE_BAD(entity)) {
selection.erase(it++); selection.erase(it++);
} else { } else {
#ifndef TEXTMODE #if ENABLE_VISUALS == 1
hacks::shared::esp::AddEntityString(entity, "[SELECTED]", colors::orange); hacks::shared::esp::AddEntityString(entity, "[SELECTED]", colors::orange);
if (fmod(g_GlobalVars->curtime, 2.0f) < 1.0f) { if (fmod(g_GlobalVars->curtime, 2.0f) < 1.0f) {
hacks::shared::esp::SetEntityColor(entity, colors::yellow); hacks::shared::esp::SetEntityColor(entity, colors::yellow);
@ -94,7 +94,7 @@ void AfterCreateMove() {
if (CE_BAD(entity)) { if (CE_BAD(entity)) {
selection_secondary.erase(it++); selection_secondary.erase(it++);
} else { } else {
#ifndef TEXTMODE #if ENABLE_VISUALS == 1
hacks::shared::esp::AddEntityString(entity, "[SELECTED (SECONDARY)]", colors::orange); hacks::shared::esp::AddEntityString(entity, "[SELECTED (SECONDARY)]", colors::orange);
if (fmod(g_GlobalVars->curtime, 2.0f) < 1.0f) { if (fmod(g_GlobalVars->curtime, 2.0f) < 1.0f) {
hacks::shared::esp::SetEntityColor(entity, colors::yellow); hacks::shared::esp::SetEntityColor(entity, colors::yellow);
@ -203,7 +203,7 @@ void DoWalking() {
int following_idx2 = 0; int following_idx2 = 0;
if (CE_GOOD(found_entity)) { if (CE_GOOD(found_entity)) {
following_idx2 = found_entity->m_IDX; following_idx2 = found_entity->m_IDX;
#ifndef TEXTMODE #if ENABLE_VISUALS == 1
hacks::shared::esp::AddEntityString(found_entity, "[FOLLOWING]", colors::green); hacks::shared::esp::AddEntityString(found_entity, "[FOLLOWING]", colors::green);
hacks::shared::esp::SetEntityColor(found_entity, colors::green); hacks::shared::esp::SetEntityColor(found_entity, colors::green);
#endif #endif
@ -695,7 +695,7 @@ void CrumbBottomAdd() {
logging::Info("Crumb Over-Prune!\nDumping array"); logging::Info("Crumb Over-Prune!\nDumping array");
} }
} }
#ifndef TEXTMODE #if ENABLE_VISUALS == 1
// Function called when we need to draw onto the screen // Function called when we need to draw onto the screen
void Draw() { void Draw() {

View File

@ -34,7 +34,7 @@ extern int following_idx;
bool IsBot(CachedEntity* entity); bool IsBot(CachedEntity* entity);
void AddMessageHandlers(ipc::peer_t* peer); void AddMessageHandlers(ipc::peer_t* peer);
void AfterCreateMove(); void AfterCreateMove();
#ifndef TEXTMODE #if ENABLE_VISUALS == 1
void Draw(); void Draw();
#endif #endif
void CrumbReset(); void CrumbReset();

View File

@ -77,7 +77,7 @@ void CreateMove() {
} }
void Draw() { void Draw() {
#ifndef TEXTMODE #if ENABLE_VISUALS == 1
if (healarrow) { if (healarrow) {
if ((g_GlobalVars->curtime - healarrow_time) < float(healarrow_timeout)) { 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); AddCenterString(format("Heal arrow charge: ", int(min(100.0f, (g_GlobalVars->curtime - healarrow_time) / float(healarrow_timeout)) * 100.0f), '%'), colors::yellow);

View File

@ -349,7 +349,7 @@ void CreateMove() {
} }
} }
#ifndef TEXTMODE #if ENABLE_VISUALS == 1
void DrawText() { void DrawText() {
if (crit_info && CE_GOOD(LOCAL_W)) { if (crit_info && CE_GOOD(LOCAL_W)) {

View File

@ -13,7 +13,7 @@
namespace hacks { namespace shared { namespace misc { namespace hacks { namespace shared { namespace misc {
void CreateMove(); void CreateMove();
#ifndef TEXTMODE #if ENABLE_VISUALS == 1
void DrawText(); void DrawText();
#endif #endif

View File

@ -796,7 +796,7 @@ void RecordNode() {
state::active_node = node; state::active_node = node;
} }
#ifndef TEXTMODE #if ENABLE_VISUALS == 1
// Draws a single colored connection between 2 nodes // Draws a single colored connection between 2 nodes
void DrawConnection(index_t a, connection_s& b) { void DrawConnection(index_t a, connection_s& b) {

View File

@ -10,7 +10,7 @@
namespace hacks { namespace shared { namespace walkbot { namespace hacks { namespace shared { namespace walkbot {
void Initialize(); void Initialize();
#ifndef TEXTMODE #if ENABLE_VISUALS == 1
void Draw(); void Draw();
#endif #endif
void Move(); void Move();

View File

@ -8,7 +8,7 @@
#ifndef HACKS_HACKLIST_H_ #ifndef HACKS_HACKLIST_H_
#define HACKS_HACKLIST_H_ #define HACKS_HACKLIST_H_
#ifndef TEXTMODE #if ENABLE_VISUALS == 1
#include "ESP.h" #include "ESP.h"
#include "SkinChanger.hpp" #include "SkinChanger.hpp"

View File

@ -779,7 +779,7 @@ CatCommand print_classnames("debug_print_classnames", "Lists classnames currentl
}); });
void PrintChat(const char* fmt, ...) { void PrintChat(const char* fmt, ...) {
#if TEXTMODE #if not ENABLE_VISUALS
return; return;
#endif #endif
CHudBaseChat* chat = (CHudBaseChat*)g_CHUD->FindElement("CHudChat"); CHudBaseChat* chat = (CHudBaseChat*)g_CHUD->FindElement("CHudChat");

View File

@ -268,7 +268,7 @@ bool CreateMove_hook(void* thisptr, float inputSample, CUserCmd* cmd) {
SAFE_CALL(UpdateHoovyList()); SAFE_CALL(UpdateHoovyList());
} }
g_pLocalPlayer->v_OrigViewangles = cmd->viewangles; g_pLocalPlayer->v_OrigViewangles = cmd->viewangles;
#ifndef TEXTMODE #if ENABLE_VISUALS == 1
{ {
PROF_SECTION(CM_esp); PROF_SECTION(CM_esp);
SAFE_CALL(hacks::shared::esp::CreateMove()); SAFE_CALL(hacks::shared::esp::CreateMove());

View File

@ -41,7 +41,7 @@ void PaintTraverse_hook(void* _this, unsigned int vp, bool fr, bool ar) {
if (!segvcatch::handler_segv) segvcatch::init_fpe(); if (!segvcatch::handler_segv) segvcatch::init_fpe();
} }
#endif #endif
#ifndef TEXTMODE #if ENABLE_VISUALS == 1
if (!textures_loaded) { if (!textures_loaded) {
textures_loaded = true; textures_loaded = true;
hacks::tf::radar::Init(); 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; if (clean_screenshots && g_IEngine->IsTakingScreenshot()) return;
PROF_SECTION(PT_active); PROF_SECTION(PT_active);
#ifndef TEXTMODE #if ENABLE_VISUALS == 1
draw::UpdateWTS(); draw::UpdateWTS();
BeginCheatVisuals(); BeginCheatVisuals();
DrawCheatVisuals(); DrawCheatVisuals();

View File

@ -12,7 +12,7 @@
#include "ucccccp.hpp" #include "ucccccp.hpp"
#include "hookedmethods.h" #include "hookedmethods.h"
#ifndef TEXTMODE #if ENABLE_VISUALS == 1
static CatVar no_invisibility(CV_SWITCH, "no_invis", "0", "Remove Invisibility", "Useful with chams!"); 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()); static const FrameStageNotify_t original = (FrameStageNotify_t)hooks::client.GetMethod(offsets::FrameStageNotify());
SEGV_BEGIN; SEGV_BEGIN;
if (!g_IEngine->IsInGame()) g_Settings.bInvalid = true; if (!g_IEngine->IsInGame()) g_Settings.bInvalid = true;
#ifndef TEXTMODE #if ENABLE_VISUALS == 1
{ {
PROF_SECTION(FSN_skinchanger); PROF_SECTION(FSN_skinchanger);
hacks::tf2::skinchanger::FrameStageNotify(stage); hacks::tf2::skinchanger::FrameStageNotify(stage);
@ -436,7 +436,7 @@ void FrameStageNotify_hook(void* _this, int stage) {
hack::command_stack().pop(); 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); static auto last_stdin = std::chrono::system_clock::from_time_t(0);
auto ms = std::chrono::duration_cast<std::chrono::milliseconds>(std::chrono::system_clock::now() - last_stdin).count(); auto ms = std::chrono::duration_cast<std::chrono::milliseconds>(std::chrono::system_clock::now() - last_stdin).count();
if (ms > 500) { if (ms > 500) {
@ -445,7 +445,7 @@ void FrameStageNotify_hook(void* _this, int stage) {
} }
#endif #endif
} }
#ifndef TEXTMODE #if ENABLE_VISUALS == 1
if (cathook && !g_Settings.bInvalid && stage == FRAME_RENDER_START) { if (cathook && !g_Settings.bInvalid && stage == FRAME_RENDER_START) {
#if ENABLE_GUI #if ENABLE_GUI
if (cursor_fix_experimental) { if (cursor_fix_experimental) {

View File

@ -27,7 +27,7 @@ void LevelInit_hook(void*, const char*);
void LevelShutdown_hook(void*); void LevelShutdown_hook(void*);
#ifdef TEXTMODE #if ENABLE_NULL_GRAPHICS == 1
typedef ITexture*(*FindTexture_t)(void*, const char*, const char*, bool, int); 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*(*FindMaterialEx_t)(void*, const char*, const char*, int, bool, const char*);
typedef IMaterial*(*FindMaterial_t)(void*, const char*, const char*, bool, const char*); typedef IMaterial*(*FindMaterial_t)(void*, const char*, const char*, bool, const char*);

View File

@ -131,7 +131,7 @@ void CreateInterfaces() {
} }
g_IMaterialSystem = BruteforceInterface<IMaterialSystemFixed>("VMaterialSystem", sharedobj::materialsystem()); g_IMaterialSystem = BruteforceInterface<IMaterialSystemFixed>("VMaterialSystem", sharedobj::materialsystem());
#ifndef TEXTMODE #if ENABLE_VISUALS == 1
g_IVDebugOverlay = BruteforceInterface<IVDebugOverlay>("VDebugOverlay", sharedobj::engine()); g_IVDebugOverlay = BruteforceInterface<IVDebugOverlay>("VDebugOverlay", sharedobj::engine());
g_IPanel = BruteforceInterface<vgui::IPanel>("VGUI_Panel", sharedobj::vgui2()); g_IPanel = BruteforceInterface<vgui::IPanel>("VGUI_Panel", sharedobj::vgui2());
g_ISurface = BruteforceInterface<vgui::ISurface>("VGUI_Surface", sharedobj::vguimatsurface()); g_ISurface = BruteforceInterface<vgui::ISurface>("VGUI_Surface", sharedobj::vguimatsurface());

View File

@ -39,7 +39,7 @@ void logging::Info(const char* fmt, ...) {
sprintf(result, "%% [%s] %s\n", timeString, buffer); sprintf(result, "%% [%s] %s\n", timeString, buffer);
fprintf(logging::handle, "%s", result); fprintf(logging::handle, "%s", result);
fflush(logging::handle); fflush(logging::handle);
#ifndef TEXTMODE #if ENABLE_VISUALS == 1
if (g_ICvar) { if (g_ICvar) {
if (console_logging.convar_parent && console_logging) if (console_logging.convar_parent && console_logging)
g_ICvar->ConsolePrintf("%s", result); g_ICvar->ConsolePrintf("%s", result);

View File

@ -10,10 +10,3 @@
#ifndef DATA_PATH #ifndef DATA_PATH
# define DATA_PATH "/opt/cathook-data" # define DATA_PATH "/opt/cathook-data"
#endif #endif
#if defined(NOGUI) and NOGUI == 1 or defined(TEXTMODE)
#define ENABLE_GUI false
#else
#define ENABLE_GUI true
#endif

View File

@ -81,7 +81,7 @@ void Prediction_CreateMove() {
} }
} }
} }
#ifndef TEXTMODE #if ENABLE_VISUALS == 1
void Prediction_PaintTraverse() { void Prediction_PaintTraverse() {
if (!debug_enginepred) return; if (!debug_enginepred) return;
for (int i = 1; i < predicted_player_count; i++) { for (int i = 1; i < predicted_player_count; i++) {

View File

@ -24,7 +24,7 @@ float PlayerGravityMod(CachedEntity* player);
Vector EnginePrediction(CachedEntity* player, float time); Vector EnginePrediction(CachedEntity* player, float time);
void Prediction_CreateMove(); void Prediction_CreateMove();
#ifndef TEXTMODE #if ENABLE_VISUALS == 1
void Prediction_PaintTraverse(); void Prediction_PaintTraverse();
#endif #endif

View File

@ -80,7 +80,7 @@ void LoadAllSharedObjects() {
tier0().Load(); tier0().Load();
inputsystem().Load(); inputsystem().Load();
materialsystem().Load(); materialsystem().Load();
#ifndef TEXTMODE #if ENABLE_VISUALS == 1
vguimatsurface().Load(); vguimatsurface().Load();
vgui2().Load(); vgui2().Load();
studiorender().Load(); studiorender().Load();
@ -119,7 +119,7 @@ SharedObject& materialsystem() {
static SharedObject obj("materialsystem.so", true); static SharedObject obj("materialsystem.so", true);
return obj; return obj;
} }
#ifndef TEXTMODE #if ENABLE_VISUALS == 1
SharedObject& vguimatsurface() { SharedObject& vguimatsurface() {
static SharedObject obj("vguimatsurface.so", true); static SharedObject obj("vguimatsurface.so", true);
return obj; return obj;

View File

@ -43,7 +43,7 @@ SharedObject& vstdlib();
SharedObject& tier0(); SharedObject& tier0();
SharedObject& inputsystem(); SharedObject& inputsystem();
SharedObject& materialsystem(); SharedObject& materialsystem();
#ifndef TEXTMODE #if ENABLE_VISUALS == 1
SharedObject& vguimatsurface(); SharedObject& vguimatsurface();
SharedObject& vgui2(); SharedObject& vgui2();
SharedObject& studiorender(); SharedObject& studiorender();

View File

@ -32,19 +32,20 @@ CatCommand fixvac("fixvac", "Lemme in to secure servers", []() {
*allowSecureServers = true; *allowSecureServers = true;
}); });
#ifdef TEXTMODE
InitRoutine init([]() { InitRoutine init([]() {
#ifdef TEXTMODE_STDIN #if TEXTMODE_STDIN == 1
logging::Info("[TEXTMODE] Setting up input handling"); logging::Info("[TEXTMODE] Setting up input handling");
int flags = fcntl(0, F_GETFL, 0); int flags = fcntl(0, F_GETFL, 0);
flags |= O_NONBLOCK; flags |= O_NONBLOCK;
fcntl(0, F_SETFL, flags); fcntl(0, F_SETFL, flags);
logging::Info("[TEXTMODE] stdin is now non-blocking"); logging::Info("[TEXTMODE] stdin is now non-blocking");
#endif #endif
#if TEXTMODE_VAC == 1
EXPOSED_Epic_VACBypass_1337_DoNotSteal_xXx_$1_xXx_MLG(); EXPOSED_Epic_VACBypass_1337_DoNotSteal_xXx_$1_xXx_MLG();
});
#endif #endif
});
#if TEXTMODE_STDIN == 1
void UpdateInput() { void UpdateInput() {
char buffer[256]; char buffer[256];
int bytes = read(0, buffer, 255); int bytes = read(0, buffer, 255);
@ -53,3 +54,4 @@ void UpdateInput() {
g_IEngine->ExecuteClientCmd(buffer); g_IEngine->ExecuteClientCmd(buffer);
} }
} }
#endif