Merge pull request #279 from nullifiedcat/move-data

Move data
This commit is contained in:
nullifiedcat 2017-08-16 12:07:04 +03:00 committed by GitHub
commit 5230cb2228
56 changed files with 317 additions and 229 deletions

View File

@ -35,7 +35,7 @@
<folderInfo id="cdt.managedbuild.config.gnu.exe.debug.1168214098." name="/" resourcePath="">
<toolChain id="cdt.managedbuild.toolchain.gnu.exe.debug.965909756" name="Linux GCC" nonInternalBuilderId="cdt.managedbuild.target.gnu.builder.exe.debug" superClass="cdt.managedbuild.toolchain.gnu.exe.debug">
<targetPlatform id="cdt.managedbuild.target.gnu.platform.exe.debug.1799148153" name="Debug Platform" superClass="cdt.managedbuild.target.gnu.platform.exe.debug"/>
<builder arguments="-e GAME=tf2 NOIPC=1 BUILD_DEBUG=1 TEXTMODE=1 NO_WARNINGS=1 CC=gcc-7 CXX=g++-7" buildPath="${workspace_loc:/cathook}" command="make" id="cdt.managedbuild.target.gnu.builder.exe.debug.1548213350" keepEnvironmentInBuildfile="false" managedBuildOn="false" name="Gnu Make Builder" parallelBuildOn="true" parallelizationNumber="optimal" superClass="cdt.managedbuild.target.gnu.builder.exe.debug"/>
<builder arguments="" buildPath="${workspace_loc:/cathook}" command="make" id="cdt.managedbuild.target.gnu.builder.exe.debug.1548213350" keepEnvironmentInBuildfile="false" managedBuildOn="false" name="Gnu Make Builder" parallelBuildOn="true" parallelizationNumber="optimal" superClass="cdt.managedbuild.target.gnu.builder.exe.debug"/>
<tool id="cdt.managedbuild.tool.gnu.archiver.base.782611349" name="GCC Archiver" superClass="cdt.managedbuild.tool.gnu.archiver.base"/>
<tool command="g++" id="cdt.managedbuild.tool.gnu.cpp.compiler.exe.debug.883030293" name="GCC C++ Compiler" superClass="cdt.managedbuild.tool.gnu.cpp.compiler.exe.debug">
<option id="gnu.cpp.compiler.exe.debug.option.optimization.level.908662295" name="Optimization Level" superClass="gnu.cpp.compiler.exe.debug.option.optimization.level" useByScannerDiscovery="false" value="gnu.cpp.compiler.optimization.level.none" valueType="enumerated"/>
@ -129,21 +129,15 @@
</cconfiguration>
</storageModule>
<storageModule moduleId="cdtBuildSystem" version="4.0.0">
<project id="UranHack.cdt.managedbuild.target.gnu.exe.1493648584" name="Executable" projectType="cdt.managedbuild.target.gnu.exe"/>
<project id="cathook.null.2129761708" name="cathook"/>
</storageModule>
<storageModule moduleId="org.eclipse.cdt.core.LanguageSettingsProviders"/>
<storageModule moduleId="refreshScope" versionNumber="2">
<configuration configurationName="TF2"/>
<configuration configurationName="Lilac"/>
<configuration configurationName="Main">
<resource resourceType="PROJECT" workspacePath="/kathook"/>
<resource resourceType="PROJECT" workspacePath="/cathook"/>
</configuration>
<configuration configurationName="Release">
<resource resourceType="PROJECT" workspacePath="/UranHack"/>
</configuration>
<configuration configurationName="HL2DM"/>
<configuration configurationName="Debug">
<resource resourceType="PROJECT" workspacePath="/UranHack"/>
<configuration configurationName="Default">
<resource resourceType="PROJECT" workspacePath="/cathook"/>
</configuration>
</storageModule>
<storageModule moduleId="org.eclipse.cdt.internal.ui.text.commentOwnerProjectMappings"/>

53
attach-noscramble Executable file
View File

@ -0,0 +1,53 @@
#!/usr/bin/env bash
if [ $UID == "0" ]; then
echo "Don't run as root!"
exit
fi
user=$USER
if [ "$#" == 1 ]; then
user=$1
fi
proc="0"
for pid in $(pidof hl2_linux)
do
if sudo -H -u $user kill -0 $pid
then
proc=$pid
break
fi
done
echo Attaching to "$proc"
if sudo grep -q "libcathook.so" /proc/"$proc"/maps; then
echo already loaded
exit
fi
# pBypass for crash dumps being sent
# You may also want to consider using -nobreakpad in your launch options.
sudo rm -rf /tmp/dumps # Remove if it exists
sudo mkdir /tmp/dumps # Make it as root
sudo chmod 000 /tmp/dumps # No permissions
cp "bin/libcathook.so" /tmp
FILENAME=/tmp/libcathook.so
echo loading "$FILENAME" to "$proc"
sudo gdb -n -q -batch \
-ex "attach $proc" \
-ex "set \$dlopen = (void*(*)(char*, int)) dlopen" \
-ex "call \$dlopen(\"$FILENAME\", 1)" \
-ex "call dlerror()" \
-ex 'print (char *) $2' \
-ex "detach" \
-ex "quit"
rm /tmp/libcathook.so

View File

@ -1 +1 @@
make -j4 -e GAME=tf2 BUILD_DEBUG=1
make -j4 BUILD_DEBUG=1

View File

@ -1,2 +1 @@
make -j4 -e GAME=tf2 NO_WARNINGS=1
strip --strip-all bin/libcathook.so
make -j4 NO_WARNINGS=1

9
check-data Executable file
View File

@ -0,0 +1,9 @@
#!/usr/bin/env bash
if ! [ -d "$1" ]; then
echo "Creating cathook data directory at $1"
sudo mkdir -p "$1"
sudo chown -R $USER "$1"
sudo chmod -R 777 "$1"
rsync -avh --progress "data/" "$1"
fi

201
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
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,50 @@ 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
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)
INCLUDES+=-I$(SIPC_DIR)
endif
CXXFLAGS+=$(addprefix -D,$(DEFINES))
@ -115,38 +133,38 @@ CFLAGS+=$(addprefix -D,$(DEFINES))
CXXFLAGS+=$(INCLUDES)
CFLAGS+=$(INCLUDES)
ifdef TEXTMODE
OBJECTS = $(patsubst %.c,%.o, $(patsubst %.cpp,%.o, $(SOURCES)))
OBJECTS += $(shell find $(RES_DIR) -name "*.o" -print)
DEPENDS = $(patsubst %.c,%.d, $(patsubst %.cpp,%.d, $(SOURCES)))
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
.PHONY: clean directories echo
.PHONY: clean directories echo data
all:
mkdir -p $(TARGET_DIR)
mkdir -p $(OUT_DIR)
$(MAKE) data
$(MAKE) $(TARGET)
echo:
echo $(OBJECTS)
data:
./check-data "$(DATA_PATH)"
# 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 +178,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 +194,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

@ -1 +1 @@
Subproject commit e532876ffd707a48389d54ff904dcc40a84f2839
Subproject commit 94b3e53b00ac5be465ebe44ea5fe1b1fbc18aa8f

View File

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

View File

@ -34,7 +34,7 @@ public:
if (pw) {
uname = std::string(pw->pw_name);
}
stream.open("cathook/chat-" + uname + ".log", std::ios::out | std::ios::app);
stream.open(DATA_PATH "/chat-" + uname + ".log", std::ios::out | std::ios::app);
}
void log(const std::string& msg) {
if (stream.bad() or not stream.is_open()) {

View File

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

View File

@ -43,7 +43,7 @@ void Initialize() {
mat4_set_orthographic(&projection, 0, draw::width, draw::height, 0, -1, 1);
//view.m11 = -1;
shader_v2fc4f = shader_load("cathook/shaders/v2f-c4f.vert", "cathook/shaders/v2f-c4f.frag");
shader_v2fc4f = shader_load(DATA_PATH "/shaders/v2f-c4f.vert", DATA_PATH "/shaders/v2f-c4f.frag");
glUseProgram(shader_v2fc4f);
{
glUniformMatrix4fv(glGetUniformLocation(shader_v2fc4f, "model"), 1, 0, model.data);
@ -51,7 +51,7 @@ void Initialize() {
glUniformMatrix4fv(glGetUniformLocation(shader_v2fc4f, "projection"), 1, 0, projection.data);
}
shader_v2ft2fc4f = shader_load("cathook/shaders/v2f-t2f-c4f.vert", "cathook/shaders/v2f-t2f-c4f.frag");
shader_v2ft2fc4f = shader_load(DATA_PATH "/shaders/v2f-t2f-c4f.vert", DATA_PATH "/shaders/v2f-t2f-c4f.frag");
glUseProgram(shader_v2ft2fc4f);
{
glUniform1i(glGetUniformLocation(shader_v2ft2fc4f, "texture"), 0);

View File

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

View File

@ -40,7 +40,7 @@ void FTGL_PreInit() {
mat4_set_identity(&view);
mat4_set_identity(&model);
mat4_set_orthographic(&projection, 0, draw::width, 0, draw::height, -1, 1);
fonts::ftgl_ESP = ftgl::texture_font_new_from_file(atlas, 14, "cathook/fonts/opensans-bold.ttf");
fonts::ftgl_ESP = ftgl::texture_font_new_from_file(atlas, 14, DATA_PATH "/fonts/opensans-bold.ttf");
logging::Info("Pre-Init done %d %d", draw::width, draw::height);
}
@ -50,7 +50,7 @@ void FTGL_Init() {
logging::Info("Done...");
glGenTextures(1, &atlas->id);
logging::Info("Loading shaders...");
shader = shader_load("cathook/shaders/v3f-t2f-c4f.vert", "cathook/shaders/v3f-t2f-c4f.frag");
shader = shader_load(DATA_PATH "/shaders/v3f-t2f-c4f.vert", DATA_PATH "/shaders/v3f-t2f-c4f.frag");
logging::Info("Done init");
}
@ -113,7 +113,7 @@ void FTGL_NewFrame() {
void FTGL_ChangeFont(texture_font_t** font, const char* newfont) {
texture_atlas_clear(atlas);
texture_font_t* replacement = texture_font_new_from_file(atlas, 14, strfmt("cathook/fonts/%s.ttf", newfont));
texture_font_t* replacement = texture_font_new_from_file(atlas, 14, strfmt(DATA_PATH "/fonts/%s.ttf", newfont));
if (replacement) {
texture_font_delete(*font);
*font = replacement;

View File

@ -9,6 +9,7 @@
#include "sdk.h"
#include "copypasted/CSignature.h"
time_t time_injected { 0 };
int g_AppID = 0;

View File

@ -8,6 +8,8 @@
#ifndef GLOBALS_H_
#define GLOBALS_H_
#include <time.h>
class Vector;
class ConVar;
class CatVar;
@ -37,6 +39,8 @@ extern int last_cmd_number;
extern char* disconnect_reason_newlined;
extern CatVar disconnect_reason;
extern time_t time_injected;
class GlobalSettings {
public:
void Init();

View File

@ -116,7 +116,7 @@ void TraverseList(const ListEntry_List* list) {
CatCommand reloadscheme("reloadscheme", "Reload Scheme", []() {
main_list_array.clear();
try {
std::ifstream in("cathook/menu.json", std::ios::in);
std::ifstream in(DATA_PATH "/menu.json", std::ios::in);
nlohmann::json jo("[]");
if (in.good()) {
jo = jo.parse(in);

View File

@ -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<std::string>& 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:
@ -162,8 +162,9 @@ void hack::CC_Cat(const CCommand& args) {
}
void hack::Initialize() {
time_injected = time(nullptr);
// 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 = {
@ -173,9 +174,9 @@ void hack::Initialize() {
"menu.json", "fonts/opensans-bold.ttf"
};
for (const auto& s : essential) {
std::ifstream exists("cathook/" + s, std::ios::in);
std::ifstream exists(DATA_PATH "/" + s, std::ios::in);
if (not exists) {
Error("Missing essential file: cathook/%s\nYou MUST run update-data script to finish installation", s.c_str());
Error("Missing essential file: " DATA_PATH "/%s\nYou MUST run update-data script to finish installation", s.c_str());
}
}
}
@ -196,7 +197,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 +221,7 @@ void hack::Initialize() {
g_Settings.Init();
EndConVars();
#ifndef TEXTMODE
#if ENABLE_VISUALS == 1
draw::Initialize();
#if ENABLE_GUI
@ -234,7 +235,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 +248,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 +261,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 +277,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 +312,7 @@ void hack::Initialize() {
velocity::Init();
playerlist::Load();
#ifndef TEXTMODE
#if ENABLE_VISUALS == 1
InitStrings();
#if ENABLE_GUI
@ -334,7 +336,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 +353,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");

View File

@ -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");

View File

@ -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();

View File

@ -502,7 +502,7 @@ void _FASTCALL ProcessEntity(CachedEntity* ent) {
#ifdef IPC_ENABLED
// ipc bot esp
if (show_bot_id && ipc::peer && ent != LOCAL_E) {
for (unsigned i = 1; i < cat_ipc::max_peers; i++) {
for (unsigned i = 0; i < cat_ipc::max_peers; i++) {
if (!ipc::peer->memory->peer_data[i].free && ipc::peer->memory->peer_user_data[i].friendid == info.friendsID) {
AddEntityString(ent, format("BOT #", i));
break;

View File

@ -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
@ -523,7 +523,7 @@ bool IsBot(CachedEntity* entity) {
if (!ipc::peer) return false;
if (entity->m_Type == ENTITY_PLAYER) {
if (ipc::peer) {
for (unsigned i = 1; i < cat_ipc::max_peers; i++) {
for (unsigned i = 0; i < cat_ipc::max_peers; i++) {
if (!ipc::peer->memory->peer_data[i].free && ipc::peer->memory->peer_user_data[i].friendid == entity->player_info.friendsID) {
return true;
}
@ -541,7 +541,7 @@ unsigned MakeMask() {
for (const auto& idx : selection) {
CachedEntity* ent = ENTITY(idx);
if (CE_BAD(ent)) continue;
for (unsigned i = 1; i < cat_ipc::max_peers; i++) {
for (unsigned i = 0; i < cat_ipc::max_peers; i++) {
if (!ipc::peer->memory->peer_data[i].free && ipc::peer->memory->peer_user_data[i].friendid == ent->player_info.friendsID) {
result |= (1 << i);
}
@ -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() {

View File

@ -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();

View File

@ -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);

View File

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

View File

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

View File

@ -205,13 +205,13 @@ void DrawText() {
#define BINARY_FILE_READ(handle, data) handle.read(reinterpret_cast<char*>(&data), sizeof(data))
void Save(std::string filename) {
DIR* cathook_directory = opendir("cathook/skinchanger");
DIR* cathook_directory = opendir(DATA_PATH "/skinchanger");
if (!cathook_directory) {
logging::Info("Skinchanger directory doesn't exist, creating one!");
mkdir(strfmt("cathook/skinchanger"), S_IRWXU | S_IRWXG);
mkdir(DATA_PATH "/skinchanger", S_IRWXU | S_IRWXG);
} else closedir(cathook_directory);
try {
std::ofstream file("cathook/skinchanger/" + filename, std::ios::out | std::ios::binary);
std::ofstream file(DATA_PATH "/skinchanger/" + filename, std::ios::out | std::ios::binary);
BINARY_FILE_WRITE(file, SERIALIZE_VERSION);
size_t size = modifier_map.size();
BINARY_FILE_WRITE(file, size);
@ -235,13 +235,13 @@ void Save(std::string filename) {
}
void Load(std::string filename, bool merge) {
DIR* cathook_directory = opendir("cathook/skinchanger");
DIR* cathook_directory = opendir(DATA_PATH "/skinchanger");
if (!cathook_directory) {
logging::Info("Skinchanger directory doesn't exist, creating one!");
mkdir(strfmt("cathook/skinchanger"), S_IRWXU | S_IRWXG);
mkdir(DATA_PATH "/skinchanger", S_IRWXU | S_IRWXG);
} else closedir(cathook_directory);
try {
std::ifstream file("cathook/skinchanger/" + filename, std::ios::in | std::ios::binary);
std::ifstream file(DATA_PATH "/skinchanger/" + filename, std::ios::in | std::ios::binary);
unsigned file_serialize = 0;
BINARY_FILE_READ(file, file_serialize);
if (file_serialize != SERIALIZE_VERSION) {

View File

@ -225,13 +225,13 @@ void Save(std::string filename) {
return;
}
{
DIR* walkbot_dir = opendir("cathook/walkbot");
DIR* walkbot_dir = opendir(DATA_PATH "/walkbot");
if (!walkbot_dir) {
logging::Info("Walkbot directory doesn't exist, creating one!");
mkdir("cathook/walkbot", S_IRWXU | S_IRWXG);
mkdir(DATA_PATH "/walkbot", S_IRWXU | S_IRWXG);
} else closedir(walkbot_dir);
}
std::string path = format("cathook/walkbot/", GetLevelName());
std::string path = format(DATA_PATH "/walkbot/", GetLevelName());
{
DIR* level_dir = opendir(path.c_str());
if (!level_dir) {
@ -267,13 +267,13 @@ void Save(std::string filename) {
bool Load(std::string filename) {
{
DIR* walkbot_dir = opendir("cathook/walkbot");
DIR* walkbot_dir = opendir(DATA_PATH "/walkbot");
if (!walkbot_dir) {
logging::Info("Walkbot directory doesn't exist, creating one!");
mkdir("cathook/walkbot", S_IRWXU | S_IRWXG);
mkdir(DATA_PATH "/walkbot", S_IRWXU | S_IRWXG);
} else closedir(walkbot_dir);
}
std::string path = format("cathook/walkbot/", GetLevelName());
std::string path = format(DATA_PATH "/walkbot/", GetLevelName());
{
DIR* level_dir = opendir(path.c_str());
if (!level_dir) {
@ -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) {
@ -939,7 +939,7 @@ void CheckLivingSpace() {
int count = 0;
unsigned highest = 0;
std::vector<unsigned> botlist {};
for (unsigned i = 1; i < cat_ipc::max_peers; i++) {
for (unsigned i = 0; i < cat_ipc::max_peers; i++) {
if (!ipc::peer->memory->peer_data[i].free) {
for (auto& k : players) {
if (ipc::peer->memory->peer_user_data[i].friendid && k == ipc::peer->memory->peer_user_data[i].friendid) {

View File

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

View File

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

View File

@ -781,7 +781,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");

View File

@ -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());

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();
}
#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();

View File

@ -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::milliseconds>(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) {
@ -531,6 +531,11 @@ void LevelInit_hook(void* _this, const char* newmap) {
hacks::shared::anticheat::ResetEverything();
original(_this, newmap);
hacks::shared::walkbot::OnLevelInit();
#if IPC_ENABLED
if (ipc::peer) {
ipc::peer->memory->peer_user_data[ipc::peer->client_id].ts_connected = time(nullptr);
}
#endif
}
void LevelShutdown_hook(void* _this) {
@ -542,5 +547,10 @@ void LevelShutdown_hook(void* _this) {
chat_stack::Reset();
hacks::shared::anticheat::ResetEverything();
original(_this);
#if IPC_ENABLED
if (ipc::peer) {
ipc::peer->memory->peer_user_data[ipc::peer->client_id].ts_disconnected = time(nullptr);
}
#endif
}

View File

@ -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*);

View File

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

View File

@ -39,7 +39,7 @@ CatCommand connect("ipc_connect", "Connect to IPC server", []() {
logging::Info("Already connected!");
return;
}
peer = new peer_t("cathook_followbot_server", false, false);
peer = new peer_t(std::string(server_name.GetString()), false, false);
try {
peer->Connect();
logging::Info("peer count: %i", peer->memory->peer_count);
@ -52,7 +52,13 @@ CatCommand connect("ipc_connect", "Connect to IPC server", []() {
hack::command_stack().push(std::string((const char*)payload));
});
hacks::shared::followbot::AddMessageHandlers(peer);
user_data_s& data = peer->memory->peer_user_data[peer->client_id];
// Preserve total score
int o_total_score = data.total_score;
memset(&data, 0, sizeof(data));
data.total_score = o_total_score;
StoreClientData();
Heartbeat();
thread_running = true;
pthread_create(&listener_thread, nullptr, listen, nullptr);
} catch (std::exception& error) {
@ -133,7 +139,7 @@ CatCommand debug_get_ingame_ipc("ipc_debug_dump_server", "Show other bots on ser
int count = 0;
unsigned highest = 0;
std::vector<unsigned> botlist {};
for (unsigned i = 1; i < cat_ipc::max_peers; i++) {
for (unsigned i = 1; 0 < cat_ipc::max_peers; i++) {
if (!ipc::peer->memory->peer_data[i].free) {
for (auto& k : players) {
if (ipc::peer->memory->peer_user_data[i].friendid && k == ipc::peer->memory->peer_user_data[i].friendid) {
@ -183,6 +189,9 @@ void UpdateTemporaryData() {
data.last_score = data.score;
}
data.team = g_pPlayerResource->GetTeam(g_IEngine->GetLocalPlayer());
data.x = g_pLocalPlayer->v_Origin.x;
data.y = g_pLocalPlayer->v_Origin.y;
data.z = g_pLocalPlayer->v_Origin.z;
} else {
data.good = false;
}
@ -193,6 +202,7 @@ void StoreClientData() {
UpdateServerAddress();
user_data_s& data = peer->memory->peer_user_data[peer->client_id];
data.friendid = g_ISteamUser->GetSteamID().GetAccountID();
data.ts_injected = time_injected;
strncpy(data.name, GetFriendPersonaName_hook(g_ISteamFriends, g_ISteamUser->GetSteamID()), sizeof(data.name));
}
@ -205,7 +215,7 @@ void Heartbeat() {
static CatVar ipc_update_list(CV_SWITCH, "ipc_update_list", "1", "IPC Auto-Ignore", "Automaticly assign playerstates for bots");
void UpdatePlayerlist() {
if (peer && ipc_update_list) {
for (unsigned i = 1; i < cat_ipc::max_peers; i++) {
for (unsigned i = 0; i < cat_ipc::max_peers; i++) {
if (!peer->memory->peer_data[i].free) {
playerlist::userdata& info = playerlist::AccessData(peer->memory->peer_user_data[i].friendid);
if (info.state == playerlist::k_EState::DEFAULT)

View File

@ -61,6 +61,12 @@ struct user_data_s {
int last_score;
int total_score;
time_t heartbeat;
float x;
float y;
float z;
time_t ts_injected;
time_t ts_connected;
time_t ts_disconnected;
};
using peer_t = cat_ipc::Peer<server_data_s, user_data_s>;

View File

@ -39,13 +39,11 @@ 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);
}
#else
printf("%s", result);
#endif
delete [] buffer;
delete [] result;

View File

@ -5,13 +5,8 @@
* Author: nullifiedcat
*/
#ifndef MACROS_HPP_
#define MACROS_HPP_
#pragma once
#if defined(NOGUI) and NOGUI == 1 or defined(TEXTMODE)
#define ENABLE_GUI false
#else
#define ENABLE_GUI true
#ifndef DATA_PATH
# define DATA_PATH "/opt/cathook-data"
#endif
#endif /* MACROS_HPP_ */

View File

@ -30,13 +30,13 @@ bool ShouldSave(const userdata& data) {
}
void Save() {
DIR* cathook_directory = opendir("cathook");
DIR* cathook_directory = opendir(DATA_PATH);
if (!cathook_directory) {
logging::Info("[WARNING] cathook data directory doesn't exist! How did the cheat even get injected?");
mkdir("cathook", S_IRWXU | S_IRWXG);
logging::Info("[ERROR] cathook data directory doesn't exist! How did the cheat even get injected?");
return;
} else closedir(cathook_directory);
try {
std::ofstream file("cathook/plist", std::ios::out | std::ios::binary);
std::ofstream file(DATA_PATH "/plist", std::ios::out | std::ios::binary);
file.write(reinterpret_cast<const char*>(&SERIALIZE_VERSION), sizeof(SERIALIZE_VERSION));
int size = 0;
for (const auto& item : data) {
@ -57,13 +57,13 @@ void Save() {
void Load() {
data.clear();
DIR* cathook_directory = opendir("cathook");
DIR* cathook_directory = opendir(DATA_PATH);
if (!cathook_directory) {
logging::Info("[WARNING] cathook data directory doesn't exist! How did the cheat even get injected?");
mkdir("cathook", S_IRWXU | S_IRWXG);
logging::Info("[ERROR] cathook data directory doesn't exist! How did the cheat even get injected?");
return;
} else closedir(cathook_directory);
try {
std::ifstream file("cathook/plist", std::ios::in | std::ios::binary);
std::ifstream file(DATA_PATH "/plist", std::ios::in | std::ios::binary);
int file_serialize = 0;
file.read(reinterpret_cast<char*>(&file_serialize), sizeof(file_serialize));
if (file_serialize != SERIALIZE_VERSION) {

View File

@ -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++) {

View File

@ -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

View File

@ -53,6 +53,7 @@
#include <engine/ivdebugoverlay.h>
#include <iprediction.h>
#include <engine/ICollideable.h>
#include <icommandline.h>
#include "sdk/TFGCClientSystem.hpp"
#include "sdk/in_buttons.h"

View File

@ -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;

View File

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

View File

@ -20,7 +20,7 @@ TextFile::TextFile()
bool TextFile::TryLoad(std::string name) {
if (name.length() == 0) return false;
std::string filename = format("cathook/", name);
std::string filename = format(DATA_PATH "/", name);
std::ifstream file(filename, std::ios::in);
if (!file) {
return false;
@ -34,7 +34,7 @@ bool TextFile::TryLoad(std::string name) {
}
void TextFile::Load(std::string name) {
std::string filename = format("cathook/", name);
std::string filename = format(DATA_PATH "/", name);
std::ifstream file(filename, std::ios::in);
if (file.bad()) {
logging::Info("Could not open the file: %s", filename.c_str());

View File

@ -15,36 +15,42 @@
bool *allowSecureServers { nullptr };
// valve pls no ban
void EXPOSED_Epic_VACBypass_1337_DoNotSteal_xXx_$1_xXx_MLG() {
// Does not work
// ((ICommandLine*(*)(void))dlsym(sharedobj::tier0().lmap, "CommandLine_Tier0"))()->RemoveParm("-textmode");
// ((ICommandLine*(*)(void))dlsym(sharedobj::tier0().lmap, "CommandLine_Tier0"))()->RemoveParm("-insecure");
static unsigned char patch[] = { 0x55, 0x89, 0xE5, 0x83, 0xEC, 0x18, 0xB8, 0x01, 0x00, 0x00, 0x00, 0xC9, 0xC3 };
uintptr_t Host_IsSecureServerAllowed_addr = gSignatures.GetEngineSignature("55 89 E5 83 EC 18 E8 ? ? ? ? 8B 10 C7 44 24 04 ? ? ? ? 89 04 24 FF 52 2C 85 C0 74 11 C6 05 90 43 88 00 00");
// +0x21 = allowSecureServers
logging::Info("1337 VAC bypass: 0x%08x", Host_IsSecureServerAllowed_addr);
//logging::Info("1337 VAC bypass: 0x%08x", Host_IsSecureServerAllowed_addr);
Patch((void*)Host_IsSecureServerAllowed_addr, (void*)patch, sizeof(patch));
uintptr_t allowSecureServers_addr = Host_IsSecureServerAllowed_addr + 0x21;
allowSecureServers = *(bool**)(allowSecureServers_addr);
logging::Info("Allow Secure Servers: 0x%08x", allowSecureServers);
*allowSecureServers = true;
logging::Info("Done..?");
logging::Info("Allow Secure Servers: %d", *allowSecureServers);
}
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 +59,4 @@ void UpdateInput() {
g_IEngine->ExecuteClientCmd(buffer);
}
}
#endif

View File

@ -1,18 +0,0 @@
#!/usr/bin/env bash
echo "Searching for Team Fortress 2"
echo "Please wait..."
find / -type d -name "Team Fortress 2" 2>/dev/null | while read path; do
if [ -e "$path/tf/gameinfo.txt" ]; then
if grep -q 440 "$path/tf/gameinfo.txt"; then
echo "Found Team Fortress 2 installation at $path"
mkdir -p "$path/cathook"
ln -s "$path/cathook" "Data Folder"
rsync -avh --progress tf-settings/ "$path/cathook"
echo "Symbolic link created (Data Folder)"
echo "You can close this window"
read -p "Press ENTER to continue"
fi
fi
done