Merge pull request #6 from nullifiedcat/master

update fork
This commit is contained in:
julianacat 2017-07-04 17:26:43 -05:00 committed by GitHub
commit 82c240ab32
21 changed files with 258 additions and 63 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" 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="-e GAME=tf2 NOIPC=1 BUILD_DEBUG=1" 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"/>

View File

@ -6,50 +6,52 @@
# INSTALLATION
Ubuntu (and probably Debian) users can run this script:
Ubuntu dependencies installation:
```bash
sudo apt update && sudo apt install build-essential software-properties-common -y && sudo add-apt-repository ppa:ubuntu-toolchain-r/test -y && sudo apt update && sudo apt install gcc-snapshot -y && sudo apt update && sudo apt install git libc6-dev gcc-6 g++-6 libc6-dev:i386 g++-6-multilib gdb libsdl2-dev libglew-dev libfreetype6-dev libfreetype6-dev:i386 -y && git clone --recursive https://github.com/nullifiedcat/cathook && cd cathook && make -j4
sudo apt update && sudo apt install build-essential software-properties-common -y && sudo add-apt-repository ppa:ubuntu-toolchain-r/test -y && sudo apt update && sudo apt install gcc-snapshot -y && sudo apt update && sudo apt install git libc6-dev gcc-6 g++-6 libc6-dev:i386 g++-6-multilib gdb libsdl2-dev libglew-dev libfreetype6-dev libfreetype6-dev:i386 -y &&
```
Arch install script (requires you find gcc6 on your own):
Arch dependencies installation::
```bash
sudo pacman -Syu && sudo pacman -S base-devel gcc-multilib gdb gdb-common glew1.10 lib32-glew1.10 && git clone --recursive https://github.com/nullifiedcat/cathook && cd cathook && make -j4 && bash update-menu
sudo pacman -Syu && sudo pacman -S gdb gdb-common glew1.10 lib32-glew1.10 --noconfirm && yes | sudo pacman -U https://archive.archlinux.org/packages/g/gcc-multilib/gcc-multilib-6.3.1-2-x86_64.pkg.tar.xz https://archive.archlinux.org/packages/g/gcc-libs-multilib/gcc-libs-multilib-6.3.1-2-x86_64.pkg.tar.xz https://archive.archlinux.org/packages/l/lib32-gcc-libs/lib32-gcc-libs-6.3.1-2-x86_64.pkg.tar.xz
```
Cathook installation script:
```bash
git clone --recursive https://github.com/nullifiedcat/cathook && cd cathook && make -j4 && bash update-data
```
**Errors while installing?**
`/usr/include/c++/5/string:38:28: fatal error: bits/c++config.h: No such file or directory` - You don't have g++6 or g++6 multilib installed correctly
`/usr/include/c++/5/string:38:28: fatal error: bits/c++config.h: No such file or directory`
You don't have gcc-multilib-6 installed correctly.
`src/<any file>: fatal error: mathlib/vector.h: No such file or directory` - You didn't download Source SDK. **DO NOT DOWNLOAD CATHOOK USING "DOWNLOAD .ZIP" FROM GITHUB. USE git clone --recursive**!
`src/<any file>: fatal error: mathlib/vector.h: No such file or directory`
You didn't download Source SDK. **DO NOT DOWNLOAD CATHOOK USING "DOWNLOAD .ZIP" FROM GITHUB. USE git clone --recursive!**
If you are using other distro, make sure to have g++-6, gdb, libc6 and build essentials installed.
If you are using another distro, make sure to have g++-6, gdb, libc6 and build essentials installed.
## Updating cathook
Run the `update` script in cathook folder.
The shader folder needs to be placed into the Team fortress 2 folder otherwise cathook will crash. To install them just copy the tf-settings folder into your Team fortress 2 folder and rename it to "cathook"
The `update-data` script does this automaticly and you will want to update those files if you wish to have an updated menu.
Cathook requires the shader folder provided in order to launch properly. To install this, run the `update-data` script. This will create a sym-link for the required folders.
If you wish to do this manually, copy the tf-settings folder inside Cathook into your Team Fortress 2 folder and rename it to "cathook".
You will want to update these files if you wish to have an updated menu.
## Injection
`sudo ./attach` to attach to tf2 process (can take argument number 0-N - # of tf2 instance to attach to (for bots))
`sudo ./attach` to attach cathook into TF2. Optionally, you can provide an argument number (0-n - #) to provide the TF2 process ID (for bots).
`sudo ./attach-backtrace` to attach and print backtrace if tf2 crashes. Some users reported that this method makes you get less FPS ingame.
`sudo ./attach-backtrace` to attach and print backtrace incase TF2 crashes. Some users report that this causes FPS drop in-game. This is recommended to grab a log of what went wrong if Cathook is crashing on you.
## Followbots
`cathook-ipc-server` allows you to run and control Followbots to do your evil bidding in-game. The installation for Followbots is quite complex, and will not be covered on this page. Obviously, you must have several user accounts ready to run TF2.
A guide for Followbots can be found here: [How to setup and use followbots.](https://www.youtube.com/watch?v=kns5-nw7xUg)
You may also ask someone in our discord server to help you out.
Followbot installation is quite complex and I won't cover it fully here.
You have to have several user accounts ready to run tf2 - use google for that.
You can ask someone in my discord server for help with installation.
To control followbots, you need to download and install `cathook-ipc-server`.
### Followbot server installation script
The installation script is as followed:
```bash
git clone --recursive https://github.com/nullifiedcat/cathook-ipc-server && cd cathook-ipc-server && make -j4
```
git clone --recursive https://github.com/nullifiedcat/cathook-ipc-server && \
cd cathook-ipc-server && \
make -j4
```
### Updating script is the same as updating cathook
### Running followbot server
`./bin/cathook-ipc-server` or `./bin/cathook-ipc-server &>/dev/null &` to run it in background
To run the Followbot server, run `./bin/cathook-ipc-server`. You can also use `./bin/cathook-ipc-server &>/dev/null &` to run it in background.

31
attach
View File

@ -24,17 +24,36 @@ echo Attaching to "$proc"
#sudo ./detach $inst bin/libcathook.so
if grep -q "$(realpath bin/libcathook.so)" /proc/"$proc"/maps; then
echo already loaded
exit
fi
#if grep -q "$(realpath bin/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
FILENAME="/tmp/.gl$(cat /dev/urandom | tr -dc 'a-zA-Z0-9' | fold -w 6 | head -n 1)"
cp "bin/libcathook.so" "$FILENAME"
echo loading "$FILENAME" to "$proc"
sudo killall -19 steam
sudo killall -19 steamwebhelper
echo loading "$(realpath bin/libcathook.so)" to "$proc"
gdb -n -q -batch \
-ex "attach $proc" \
-ex "set \$dlopen = (void*(*)(char*, int)) dlopen" \
-ex "call \$dlopen(\"$(realpath bin/libcathook.so)\", 1)" \
-ex "call \$dlopen(\"$FILENAME\", 1)" \
-ex "call dlerror()" \
-ex 'print (char *) $2' \
-ex "detach" \
-ex "quit"
rm $FILENAME
sudo killall -18 steamwebhelper
sudo killall -18 steam

1
build-debug-tf2 Executable file
View File

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

2
build-tf2 Executable file
View File

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

View File

@ -4,15 +4,33 @@ CC=$(shell sh -c "which gcc-6 || which gcc")
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
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 -g3 -ggdb -shared -Wno-unknown-pragmas -fmessage-length=0 -m32 -fvisibility=hidden -fPIC -march=native
COMMON_FLAGS=-fpermissive -O3 -shared -Wno-unknown-pragmas -fmessage-length=0 -m32 -fvisibility=hidden -fPIC -march=native
ifdef BUILD_DEBUG
COMMON_FLAGS+=-g3 -ggdb
else
COMMON_FLAGS+=-flto
endif
CFLAGS=$(COMMON_FLAGS)
CXXFLAGS=-std=gnu++1z $(COMMON_FLAGS)
ifndef NO_WARNINGS
CFLAGS+=$(WARNING_FLAGS)
CXXFLAGS+=$(WARNING_FLAGS)
else
CFLAGS+=-w
CXXFLAGS+=-w
endif
CFLAGS=$(COMMON_FLAGS) $(WARNING_FLAGS)
CXXFLAGS=-std=gnu++1z $(COMMON_FLAGS) $(WARNING_FLAGS)
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=-m32 -fno-gnu-unique -D_GLIBCXX_USE_CXX11_ABI=0 -shared -L$(realpath $(LIB_DIR))
ifndef BUILD_DEBUG
LDFLAGS+=-flto
endif
LDLIBS=-static -lc -lstdc++ -ltier0 -lvstdlib -l:libSDL2-2.0.so.0 -static -lGLEW -lfreetype -lpthread
SRC_DIR = src
RES_DIR = res

BIN
res/atlas

Binary file not shown.

Binary file not shown.

Before

Width:  |  Height:  |  Size: 272 KiB

After

Width:  |  Height:  |  Size: 310 KiB

Binary file not shown.

Binary file not shown.

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

View File

@ -47,6 +47,7 @@ extern "C" {
#include "offsets.hpp"
#include "drawing.h"
#include "entitycache.h"
#include "fidgetspinner.hpp"
#include "hoovy.hpp"
#include "enums.h"
#include "projlogging.hpp"

View File

@ -28,17 +28,6 @@ vertex_buffer_t* buffer_triangles_textured;
GLuint shader_v2fc4f;
GLuint shader_v2ft2fc4f;
struct vertex_v2c4_t {
vec2 xy;
vec4 rgba;
};
struct vertex_v2t2c4_t {
vec2 xy;
vec2 st;
vec4 rgba;
};
mat4 model, view, projection;
bool ready_state = false;

View File

@ -10,8 +10,29 @@
#include "drawing.h"
extern "C" {
#include "freetype-gl/vec234.h"
#include "freetype-gl/vertex-buffer.h"
}
namespace drawgl {
struct vertex_v2c4_t {
ftgl::vec2 xy;
ftgl::vec4 rgba;
};
struct vertex_v2t2c4_t {
ftgl::vec2 xy;
ftgl::vec2 st;
ftgl::vec4 rgba;
};
extern ftgl::vertex_buffer_t* buffer_lines;
extern ftgl::vertex_buffer_t* buffer_triangles_plain;
extern ftgl::vertex_buffer_t* buffer_triangles_textured;
extern const float white[4];
void Initialize();

View File

@ -24,7 +24,6 @@ CatVar info_text(CV_SWITCH, "info", "1", "Show info", "Show cathook version in t
void DrawCheatVisuals() {
std::lock_guard<std::mutex> draw_lock(drawing_mutex);
if (drawgl::ready_state) {
{
PROF_SECTION(DRAW_misc);
SAFE_CALL(hacks::shared::misc::DrawText());
@ -84,6 +83,7 @@ void DrawCheatVisuals() {
PROF_SECTION(DRAW_esp);
hacks::shared::esp::Draw();
}
DrawSpinner();
Prediction_PaintTraverse();
}
{

98
src/fidgetspinner.cpp Normal file
View File

@ -0,0 +1,98 @@
/*
* fidgetspinner.cpp
*
* Created on: Jul 4, 2017
* Author: nullifiedcat
*/
#include "fidgetspinner.hpp"
CatVar enable_spinner(CV_SWITCH, "fidgetspinner", "0", "Fidget Spinner", "Part of Cathook Autism Awareness program");
std::vector<textures::AtlasTexture> spinner_states {};
float spinning_speed = 0.0f;
float angle = 0;
// DEBUG
/*CatCommand add_spinner_speed("fidgetspinner_debug_speedup", "Add speed", []() {
spinning_speed += 100.0f;
});*/
class SpinnerListener : public IGameEventListener {
public:
virtual void FireGameEvent(KeyValues* event) {
std::string name(event->GetName());
if (name == "player_death") {
int attacker = event->GetInt("attacker");
int eid = g_IEngine->GetPlayerForUserID(attacker);
if (eid == g_IEngine->GetLocalPlayer()) {
spinning_speed += 300.0f;
//logging::Info("Spinning %.2f", spinning_speed);
}
}
}
};
SpinnerListener listener;
void InitSpinner() {
for (int i = 0; i < 4; i++)
spinner_states.emplace_back(i * 64, textures::atlas_height - 64 * 4, 64, 64);
g_IGameEventManager->AddListener(&listener, false);
}
CatVar spinner_speed_cap(CV_FLOAT, "fidgetspinner_speed_cap", "30", "Speed cap");
CatVar spinner_speed_scale(CV_FLOAT, "fidgetspinner_speed_scale", "0.03", "Speed scale");
CatVar spinner_decay_speed(CV_FLOAT, "fidgetspinner_decay_speed", "0.1", "Decay speed");
CatVar spinner_scale(CV_FLOAT, "fidgetspinner_scale", "32", "Spinner Size");
CatVar spinner_min_speed(CV_FLOAT, "fidgetspinner_min_speed", "2", "Spinner Min Speed");
void DrawSpinner() {
if (not enable_spinner) return;
spinning_speed -= (spinning_speed > 150.0f) ? float(spinner_decay_speed) : float(spinner_decay_speed) / 2.0f;
if (spinning_speed < float(spinner_min_speed)) spinning_speed = float(spinner_min_speed);
if (spinning_speed > 1000) spinning_speed = 1000;
float real_speed = 0;
const float speed_cap(spinner_speed_cap);
if (spinning_speed < 250) real_speed = speed_cap * (spinning_speed / 250.0f);
else if (spinning_speed < 500) real_speed = speed_cap - (speed_cap - 10) * ((spinning_speed - 250.0f) / 250.0f);
else if (spinning_speed < 750) real_speed = 10 + (speed_cap - 20) * ((spinning_speed - 500.0f) / 250.0f);
else real_speed = (speed_cap - 10) + 10 * ((spinning_speed - 750.0f) / 250.0f);
const float speed_scale(spinner_speed_scale);
const float size(spinner_scale);
ftgl::vec2 positions[4] = {
{ -size, -size },
{ size, -size },
{ size, size },
{ -size, size}
};
angle += speed_scale * real_speed;
for (int i = 0; i < 4; i++) {
float x = positions[i].x;
float y = positions[i].y;
positions[i].x = x * cos(angle) - y * sin(angle);
positions[i].y = x * sin(angle) + y * cos(angle);
positions[i].x += draw::width / 2;
positions[i].y += draw::height / 2;
}
int state = min(3, spinning_speed / 250.0f);
// Paste from drawgl::
using namespace drawgl;
using namespace ftgl;
const auto& u1v1 = spinner_states[state].tex_coords[0];
const auto& u2v2 = spinner_states[state].tex_coords[1];
GLuint idx = buffer_triangles_textured->vertices->size;
GLuint indices[] = { idx, idx + 1, idx + 2, idx, idx + 2, idx + 3 };
vertex_v2t2c4_t vertices[] = {
{ vec2{ positions[0].x, positions[0].y }, vec2{ u1v1.x, u2v2.y }, *reinterpret_cast<const vec4*>(&colors::white) },
{ vec2{ positions[1].x, positions[1].y }, vec2{ u2v2.x, u2v2.y }, *reinterpret_cast<const vec4*>(&colors::white) },
{ vec2{ positions[2].x, positions[2].y }, vec2{ u2v2.x, u1v1.y }, *reinterpret_cast<const vec4*>(&colors::white) },
{ vec2{ positions[3].x, positions[3].y }, vec2{ u1v1.x, u1v1.y }, *reinterpret_cast<const vec4*>(&colors::white) }
};
vertex_buffer_push_back_indices(buffer_triangles_textured, indices, 6);
vertex_buffer_push_back_vertices(buffer_triangles_textured, vertices, 4);
if (angle > PI * 4) angle -= PI * 4;
}

19
src/fidgetspinner.hpp Normal file
View File

@ -0,0 +1,19 @@
/*
* fidgetspinner.hpp
*
* Created on: Jul 4, 2017
* Author: nullifiedcat
*/
#pragma once
#include "common.h"
#include "atlas.hpp"
class CatVar;
extern CatVar enable_spinner;
extern std::vector<textures::AtlasTexture> spinner_states;
void InitSpinner();
void DrawSpinner();

View File

@ -270,6 +270,8 @@ void hack::Initialize() {
logging::Info("SDL hooking done");
g_IGameEventManager->AddListener(&adv_event_listener, false);
hacks::shared::anticheat::Init();
InitSpinner();
logging::Info("Initialized Fidget Spinner");
}

View File

@ -588,6 +588,13 @@ std::unordered_map<studiohdr_t*, bonelist_s> bonelist_map {};
* According to profiler, this function is the most time-consuming (and gets called up to 200K times a second)
*/
CatEnum emoji_esp({ "None", "Joy", "Thinking" });
CatVar joy_esp(CV_SWITCH, "esp_emoji", "0", "Emoji ESP");
CatVar joy_esp_size(CV_FLOAT, "esp_emoji_size", "32", "Emoji ESP Size");
CatVar emoji_esp_scaling(CV_SWITCH, "esp_emoji_scaling", "0", "Emoji ESP Scaling");
textures::AtlasTexture joy_texture(64 * 4, textures::atlas_height - 64 * 4, 64, 64);
textures::AtlasTexture thinking_texture(64 * 5, textures::atlas_height - 64 * 4, 64, 64);
void _FASTCALL ProcessEntityPT(CachedEntity* ent) {
PROF_SECTION(PT_esp_process_entity);
@ -643,6 +650,21 @@ void _FASTCALL ProcessEntityPT(CachedEntity* ent) {
if (vischeck && !ent->IsVisible()) transparent = true;
if (!fg) fg = colors::EntityF(ent);
if (transparent) fg = colors::Transparent(fg);
if (joy_esp) {
auto hb = ent->hitboxes.GetHitbox(0);
Vector hbm, hbx;
if (draw::WorldToScreen(hb->min, hbm) && draw::WorldToScreen(hb->max, hbx)) {
Vector head_scr;
if (draw::WorldToScreen(hb->center, head_scr)) {
float size = emoji_esp_scaling ? fabs(hbm.y - hbx.y) : float(joy_esp_size);
textures::AtlasTexture* tx = nullptr;
if (int(joy_esp) == 1) tx = &joy_texture;
if (int(joy_esp) == 2) tx = &thinking_texture;
if (tx)
tx->Draw(head_scr.x - size / 2, head_scr.y - size / 2, size, size);
}
}
}
DrawBox(ent, fg, static_cast<bool>(box_healthbar), CE_INT(ent, netvar.iHealth), ent->m_iMaxHealth);
break;
}

16
update
View File

@ -1,14 +1,2 @@
#!/usr/bin/env bash
git pull origin master
git submodule update --remote --recursive
make clean
make -j4
## Ask user if they would like to update the menu
#read -r -p "Update menu? (Y/n) " key
## If the user chose yes, then we run the script here
#if [ $key == "y"* ] || [ $key == "Y"* ]; then
# bash update-menu
#fi
bash ./update-nobuild
./build-tf2

13
update-nobuild Executable file
View File

@ -0,0 +1,13 @@
#!/usr/bin/env bash
git pull origin master
git submodule update --remote --recursive
make clean
## Ask user if they would like to update the menu
#read -r -p "Update menu? (Y/n) " key
## If the user chose yes, then we run the script here
#if [ $key == "y"* ] || [ $key == "Y"* ]; then
# bash update-menu
#fi