Merge pull request #247 from nullifiedcat/textmode-debug

Textmode
This commit is contained in:
nullifiedcat 2017-07-31 09:19:15 +03:00 committed by GitHub
commit 4c97ff621c
42 changed files with 670 additions and 218 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 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="-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"/>
<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"/>
@ -66,6 +66,7 @@
<listOptionValue builtIn="false" value="POSIX=1"/>
<listOptionValue builtIn="false" value="GNUC=1"/>
<listOptionValue builtIn="false" value="NO_MALLOC_OVERRIDE"/>
<listOptionValue builtIn="false" value="TEXTMODE=1"/>
</option>
<option id="gnu.cpp.compiler.option.debugging.other.1695695237" name="Other debugging flags" superClass="gnu.cpp.compiler.option.debugging.other" useByScannerDiscovery="false" value="-ggdb" valueType="string"/>
<option id="gnu.cpp.compiler.option.dialect.flags.1534861554" name="Other dialect flags" superClass="gnu.cpp.compiler.option.dialect.flags" useByScannerDiscovery="true" value="-std=gnu++11" valueType="string"/>

View File

@ -13,6 +13,7 @@ DEFINES=_GLIBCXX_USE_CXX11_ABI=0 _POSIX=1 FREETYPE_GL_USE_VAO RAD_TELEMETRY_DISA
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
@ -53,9 +54,25 @@ LDFLAGS+=-flto
endif
endif
LDLIBS=-lssl -l:libSDL2-2.0.so.0 -static -l:libc.so.6 -static -l:libstdc++.so.6 -l:libtier0.so -l:libvstdlib.so -static -l:libGLEW.so -l:libfreetype.so
OUT_NAME = libcathook.so
ifdef TEXTMODE
$(info Compiling for text mode only!)
N_LDLIBS = -lssl -l:libSDL2-2.0.so.0 -l:libGLEW.so -l:libfreetype.so
LDLIBS := $(filter-out $(N_LDLIBS),$(LDLIBS))
N_INCLUDES = -isystemsrc/freetype-gl -isystemsrc/imgui -isystem/usr/local/include/freetype2 -isystem/usr/include/freetype2
INCLUDES := $(filter-out $(N_INCLUDES),$(INCLUDES))
DEFINES += TEXTMODE=1
#OUT_NAME := libcathook-textmode.so
endif
ifdef TEXTMODE_STDIN
DEFINES+=-DTEXTMODE_STDIN
endif
SRC_DIR = src
RES_DIR = res
OUT_NAME = libcathook.so
TARGET_DIR = bin
TARGET = $(TARGET_DIR)/$(OUT_NAME)
SOURCES = $(shell find $(SRC_DIR) -name "*.c*" -print)
@ -96,10 +113,26 @@ CXXFLAGS+=$(addprefix -D,$(DEFINES))
CFLAGS+=$(addprefix -D,$(DEFINES))
CXXFLAGS+=$(INCLUDES)
CXXFLAGS+=$(shell sdl2-config --cflags)
CFLAGS+=$(INCLUDES)
ifdef TEXTMODE
N_SOURCES := hacks/ESP.cpp hacks/SkinChanger.cpp hacks/SpyAlert.cpp hacks/Radar.cpp fidgetspinner.cpp ftrender.cpp hooks/sdl.cpp drawmgr.cpp drawgl.cpp 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
all:

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

View File

@ -5,6 +5,8 @@
* Author: nullifiedcat
*/
#ifndef TEXTMODE
#include "atlas.hpp"
#include "drawing.h"
@ -36,3 +38,5 @@ void Init() {
}
}
#endif

View File

@ -8,23 +8,38 @@
#include "common.h"
#include "init.hpp"
#include <pwd.h>
#include <unistd.h>
namespace chatlog {
CatVar enabled(CV_SWITCH, "chat_log", "0", "Chat log", "Log chat to file");
CatVar message_template(CV_STRING, "chat_log_template", "[U:1:%u] %n: %m", "Log template", "%u - SteamID\n%n - name\n%m - message");
CatVar message_template(CV_STRING, "chat_log_template", "[%t] [U:1:%u] %n: %m", "Log template", "%u - SteamID\n%n - name\n%m - message\n%t - time");
CatVar dont_log_spam(CV_SWITCH, "chat_log_nospam", "1", "No Spam", "Don't log your messages if spam is active");
CatVar dont_log_ipc(CV_SWITCH, "chat_log_noipc", "1", "No IPC", "Don't log messages sent by bots");
class RAIILog {
public:
RAIILog() {
stream.open("cathook/chat.log", std::ios::out | std::ios::app);
open();
}
~RAIILog() {
stream.close();
}
void open() {
logging::Info("Trying to open log file");
uid_t uid = geteuid();
struct passwd *pw = getpwuid(uid);
std::string uname = "";
if (pw) {
uname = std::string(pw->pw_name);
}
stream.open("cathook/chat-" + uname + ".log", std::ios::out | std::ios::app);
}
void log(const std::string& msg) {
if (stream.bad()) {
if (stream.bad() or not stream.is_open()) {
logging::Info("[ERROR] RAIILog stream is bad!");
open();
return;
}
stream << msg << "\n";
@ -47,14 +62,23 @@ void LogMessage(int eid, std::string message) {
player_info_s info;
if (not g_IEngine->GetPlayerInfo(eid, &info))
return;
if (dont_log_ipc && playerlist::AccessData(info.friendsID).state == playerlist::k_EState::IPC)
return;
std::string name(info.name);
for (auto& x : name) {
if (x < 32) x = '*';
if (x == '\n' || x == '\r') x = '*';
}
for (auto& x : message) {
if (x < 32) x = '*';
if (x == '\n' || x == '\r') x = '*';
}
time_t current_time;
struct tm * time_info;
char timeString[9];
time(&current_time);
time_info = localtime(&current_time);
strftime(timeString, sizeof(timeString), "%H:%M:%S", time_info);
std::string msg(message_template.GetString());
ReplaceString(msg, "%t", std::string(timeString));
ReplaceString(msg, "%u", std::to_string(info.friendsID));
ReplaceString(msg, "%n", name);
ReplaceString(msg, "%m", message);

View File

@ -34,20 +34,34 @@
#include <unordered_map>
#include <algorithm>
#include "timer.hpp"
#include "averager.hpp"
#include "aftercheaders.h"
#include "macros.hpp"
#include "colors.hpp"
#ifndef TEXTMODE
extern "C" {
#include <vec234.h>
}
#include "macros.hpp"
#include "colors.hpp"
#include "profiler.h"
#include "ftrender.hpp"
#include "offsets.hpp"
#include "drawing.h"
#include "entitycache.h"
#include "fidgetspinner.hpp"
#include "drawgl.hpp"
#include "EffectGlow.hpp"
#include "atlas.hpp"
#include "EffectChams.hpp"
#include "drawmgr.hpp"
#endif
#include "profiler.h"
#include "offsets.hpp"
#include "entitycache.h"
#include "hoovy.hpp"
#include "enums.h"
#include "projlogging.hpp"
@ -57,14 +71,12 @@ extern "C" {
#include "entityhitboxcache.hpp"
#include "globals.h"
#include "helpers.h"
#include "drawgl.hpp"
#include "playerlist.hpp"
#include "interfaces.h"
#include "EffectGlow.hpp"
#include "drawmgr.hpp"
#include "localplayer.h"
#include "conditions.h"
#include "logging.h"
#include "targethelper.h"
#include "playerresource.h"
#include "usercmd.h"
#include "trace.h"
@ -72,17 +84,16 @@ extern "C" {
#include "netvars.h"
#include "vfunc.h"
#include "hooks.h"
#include "atlas.hpp"
#include "prediction.h"
#include "conditions.h"
#include "itemtypes.h"
#include "chatstack.h"
#include "textfile.h"
#include "EffectChams.hpp"
#include "ipc.h"
#include "hooks/hookedmethods.h"
#include "classinfo/classinfo.hpp"
#include "crits.h"
#include "textmode.hpp"
#include "backpacktf.hpp"
#if ENABLE_GUI

View File

@ -5,6 +5,8 @@
* Author: nullifiedcat
*/
#ifndef TEXTMODE
#include "common.h"
#include "sdk.h"
#include "ftrender.hpp"
@ -112,3 +114,4 @@ bool draw::WorldToScreen(const Vector& origin, Vector& screen) {
return false;
}
#endif

View File

@ -40,7 +40,10 @@
#define STRINGIFY(x) #x
#define TO_STRING(x) STRINGIFY(x)
#ifndef TEXTMODE
#include "ftrender.hpp"
#endif
#include "hooks/hookedmethods.h"
#include "init.hpp"
@ -94,6 +97,10 @@ const std::string& hack::GetType() {
version += " DYNAMIC";
#endif
#ifdef TEXTMODE
version += " TEXTMODE";
#endif
version = version.substr(1);
version_set = true;
return version;
@ -105,6 +112,8 @@ std::stack<std::string>& hack::command_stack() {
return stack;
}
#ifndef TEXTMODE /* Why would we need colored chat stuff in textmode? */
class AdvancedEventListener : public IGameEventListener {
public:
virtual void FireGameEvent( KeyValues * event) {
@ -136,6 +145,8 @@ public:
AdvancedEventListener adv_event_listener {};
#endif /* TEXTMODE */
void hack::ExecuteCommand(const std::string command) {
std::lock_guard<std::mutex> guard(hack::command_stack_mutex);
hack::command_stack().push(command);
@ -151,7 +162,9 @@ void hack::CC_Cat(const CCommand& args) {
}
void hack::Initialize() {
// Essential files must always exist
// Essential files must always exist, except when the game is running in text mode.
#ifndef TEXTMODE
{
std::vector<std::string> essential = {
"shaders/v2f-c4f.frag", "shaders/v2f-c4f.vert",
@ -167,6 +180,8 @@ void hack::Initialize() {
}
}
#endif /* TEXTMODE */
logging::Info("Initializing...");
srand(time(0));
prctl(PR_SET_DUMPABLE,0,42,42,42);
@ -180,6 +195,9 @@ void hack::Initialize() {
logging::Info("Is CSS? %d", IsCSS());
logging::Info("Is TF? %d", IsTF());
InitClassTable();
#ifndef TEXTMODE /* We don't need medal to flip 100% when running textmode */
IF_GAME (IsTF2()) {
uintptr_t mmmf = (gSignatures.GetClientSignature("C7 44 24 04 09 00 00 00 BB ? ? ? ? C7 04 24 00 00 00 00 E8 ? ? ? ? BA ? ? ? ? 85 C0 B8 ? ? ? ? 0F 44 DA") + 37);
if (mmmf) {
@ -194,26 +212,33 @@ void hack::Initialize() {
Patch((void*)canInspectSig, (void*)patch, 3);
}*/
}
#endif /* TEXTMODE */
BeginConVars();
hack::c_Cat = CreateConCommand(CON_NAME, &hack::CC_Cat, "Info");
g_Settings.Init();
EndConVars();
#ifndef TEXTMODE
draw::Initialize();
#if ENABLE_GUI
g_pGUI = new CatGUI();
g_pGUI->Setup();
#endif
#endif /* TEXTMODE */
gNetvars.init();
InitNetVars();
g_pLocalPlayer = new LocalPlayer();
g_pPlayerResource = new TFPlayerResource();
/*
* TIME FOR HOOKING! wow
*/
#ifndef TEXTMODE
hooks::panel.Set(g_IPanel);
hooks::panel.HookMethod((void*)PaintTraverse_hook, offsets::PaintTraverse());
hooks::panel.Apply();
#endif
uintptr_t* clientMode = 0;
// Bad way to get clientmode.
// FIXME [MP]?
@ -222,7 +247,9 @@ void hack::Initialize() {
}
hooks::clientmode.Set((void*)clientMode);
hooks::clientmode.HookMethod((void*)CreateMove_hook, offsets::CreateMove());
#ifndef TEXTMODE
hooks::clientmode.HookMethod((void*)OverrideView_hook, offsets::OverrideView());
#endif /* TEXTMODE */
hooks::clientmode.HookMethod((void*)LevelInit_hook, offsets::LevelInit());
hooks::clientmode.HookMethod((void*)LevelShutdown_hook, offsets::LevelShutdown());
hooks::clientmode.Apply();
@ -232,14 +259,18 @@ void hack::Initialize() {
hooks::client.Set(g_IBaseClient);
hooks::client.HookMethod((void*)FrameStageNotify_hook, offsets::FrameStageNotify());
hooks::client.HookMethod((void*)DispatchUserMessage_hook, offsets::DispatchUserMessage());
#ifndef TEXTMODE
hooks::client.HookMethod((void*)IN_KeyEvent_hook, offsets::IN_KeyEvent());
#endif /* TEXTMODE */
hooks::client.Apply();
hooks::input.Set(g_IInput);
hooks::input.HookMethod((void*)GetUserCmd_hook, offsets::GetUserCmd());
hooks::input.Apply();
#ifndef TEXTMODE
hooks::modelrender.Set(g_IVModelRender);
hooks::modelrender.HookMethod((void*)DrawModelExecute_hook, offsets::DrawModelExecute());
hooks::modelrender.Apply();
#endif /* TEXTMODE */
hooks::steamfriends.Set(g_ISteamFriends);
hooks::steamfriends.HookMethod((void*)GetFriendPersonaName_hook, offsets::GetFriendPersonaName());
hooks::steamfriends.Apply();
@ -256,18 +287,21 @@ void hack::Initialize() {
//hooks::hkBaseClientState8->Apply();
// FIXME [MP]
InitStrings();
hacks::shared::killsay::Init();
#if ENABLE_GUI
// cat_reloadscheme to load imgui
hack::command_stack().push("cat_reloadscheme");
#endif
hack::command_stack().push("exec cat_autoexec");
hack::command_stack().push("cat_killsay_reload");
hack::command_stack().push("cat_spam_reload");
logging::Info("Hooked!");
velocity::Init();
playerlist::Load();
#ifndef TEXTMODE
InitStrings();
#if ENABLE_GUI
// cat_reloadscheme to load imgui
hack::command_stack().push("cat_reloadscheme");
#endif
if (g_ppScreenSpaceRegistrationHead && g_pScreenSpaceEffects) {
effect_chams::g_pEffectChams = new CScreenSpaceEffectRegistration("_cathook_chams", &effect_chams::g_EffectChams);
g_pScreenSpaceEffects->EnableScreenSpaceEffect("_cathook_chams");
@ -275,20 +309,24 @@ void hack::Initialize() {
effect_glow::g_pEffectGlow = new CScreenSpaceEffectRegistration("_cathook_glow", &effect_glow::g_EffectGlow);
g_pScreenSpaceEffects->EnableScreenSpaceEffect("_cathook_glow");
}
//for (CScreenSpaceEffectRegistration* reg = *g_ppScreenSpaceRegistrationHead; reg; reg = reg->m_pNext) {
// logging::Info("%s", reg->m_pEffectName);
//}
logging::Info("SSE enabled..");
DoSDLHooking();
logging::Info("SDL hooking done");
g_IGameEventManager->AddListener(&adv_event_listener, false);
#endif /* TEXTMODE */
hacks::shared::anticheat::Init();
hacks::tf2::healarrow::Init();
#ifndef TEXTMODE
InitSpinner();
logging::Info("Initialized Fidget Spinner");
hacks::shared::spam::Init();
backpacktf::init();
logging::Info("Initialized Backpack.TF integration");
#endif
hacks::shared::walkbot::Initialize();
logging::Info("Clearing initializer stack");

View File

@ -5,36 +5,7 @@
* Author: nullifiedcat
*/
#include "Aimbot.h"
#include <globalvars_base.h>
#include <icliententity.h>
#include <inputsystem/ButtonCode.h>
#include <inputsystem/iinputsystem.h>
#include <mathlib/vector.h>
#include <cmath>
#include "../aftercheaders.h"
#include "../common.h"
#include "../conditions.h"
#include "../crits.h"
#include "../cvwrapper.h"
#include "../drawing.h"
#include "../entitycache.h"
#include "../globals.h"
#include "../helpers.h"
#include "../hoovy.hpp"
#include "../interfaces.h"
#include "../localplayer.h"
#include "../netvars.h"
#include "../playerlist.hpp"
#include "../prediction.h"
#include "../sdk/in_buttons.h"
#include "../targethelper.h"
#include "../usercmd.h"
#include "AntiAim.h"
#include "ESP.h"
#include "FollowBot.h"
namespace hacks { namespace shared { namespace aimbot {
@ -172,8 +143,10 @@ void CreateMove() {
}
}
#ifndef TEXTMODE
// Set target esp color to pink
hacks::shared::esp::SetEntityColor(target, colors::pink);
#endif
// Check if player can aim and if aimkey allows aiming
// We also preform a CanShoot check here per the old canshoot method
@ -992,6 +965,8 @@ void Reset() {
projectile_mode = false;
}
#ifndef TEXTMODE
// Function called when we need to draw to screen
static CatVar fov_draw(CV_SWITCH, "aimbot_fov_draw", "0", "Draw Fov Ring", "Draws a ring to represent your current aimbot fov");
void DrawText() {
@ -1054,5 +1029,6 @@ void DrawText() {
}
}
#endif
}}}

View File

@ -39,7 +39,9 @@ extern int target_eid;
// Functions called by other functions for when certian game calls are run
void CreateMove();
#ifndef TEXTMODE
void DrawText();
#endif
void Reset();
// Stuff to make storing functions easy

View File

@ -305,11 +305,15 @@ void CreateMove() {
CachedEntity* target = ENTITY(m_iCurrentHealingTarget);
Vector out;
GetHitbox(target, 7, out);
if (m_iNewTarget || !(g_GlobalVars->tickcount % 300)) {
AimAt(g_pLocalPlayer->v_Eye, out, g_pUserCmd);
if (silent) g_pLocalPlayer->bUseSilentAngles = true;
if (!m_iNewTarget && (g_GlobalVars->tickcount % 300)) g_pUserCmd->buttons |= IN_ATTACK;
/*if (m_iNewTarget || !(g_GlobalVars->tickcount % 300)) {
if (silent) g_pLocalPlayer->bUseSilentAngles = true;
AimAt(g_pLocalPlayer->v_Eye, out, g_pUserCmd);
g_pUserCmd->buttons |= IN_ATTACK;
}
}*/
if (IsVaccinator() && CE_GOOD(target) && auto_vacc) {
int opt = OptimalResistance(target, &pop);
if (!pop && opt != -1) SetResistance(opt);

View File

@ -11,6 +11,10 @@
namespace hacks { namespace shared { namespace autojoin {
/*
* Credits to Blackfire for helping me with auto-requeue!
*/
CatEnum classes_enum({ "DISABLED", "SCOUT", "SNIPER", "SOLDIER", "DEMOMAN", "MEDIC", "HEAVY", "PYRO", "SPY", "ENGINEER" });
CatVar autojoin_team(CV_SWITCH, "autojoin_team", "0", "AutoJoin", "Automatically joins a team");
CatVar preferred_class(classes_enum, "autojoin_class", "0", "AutoJoin class", "You will pick a class automatically");
@ -24,6 +28,11 @@ const std::string classnames[] = {
CatCommand debug_startsearch("debug_startsearch", "DEBUG StartSearch", []() {
logging::Info("%d", g_TFGCClientSystem->RequestSelectWizardStep(4));
});
CatCommand debug_casual("debug_casual", "DEBUG Casual", []() {
g_IEngine->ExecuteClientCmd("OpenMatchmakingLobby casual");
g_TFGCClientSystem->LoadSearchCriteria();
//logging::Info("%d", g_TFGCClientSystem->RequestSelectWizardStep(6));
});
CatCommand debug_readytosearch("debug_gcstate", "DEBUG GCState", []() {
logging::Info("%d", g_TFGCClientSystem->GetState());
@ -49,6 +58,10 @@ void UpdateSearch() {
if (g_TFGCClientSystem->GetState() == 6) {
logging::Info("Sending MM request");
g_TFGCClientSystem->RequestSelectWizardStep(4);
} else if (g_TFGCClientSystem->GetState() == 5) {
g_IEngine->ExecuteClientCmd("OpenMatchmakingLobby casual");
g_TFGCClientSystem->LoadSearchCriteria();
//logging::Info("%d", g_TFGCClientSystem->RequestSelectWizardStep(6));
}
last_check = std::chrono::system_clock::now();
@ -68,6 +81,8 @@ void Update() {
if (int(preferred_class) < 10)
g_IEngine->ExecuteClientCmd(format("join_class ", classnames[int(preferred_class) - 1]).c_str());
}
last_check = std::chrono::system_clock::now();
}
}}}

View File

@ -69,6 +69,7 @@ void SetEntityColor(CachedEntity* entity, const rgba_t& color) {
void AddEntityString(CachedEntity* entity, const std::string& string, const rgba_t& color) {
ESPData& entity_data = data[entity->m_IDX];
if (entity_data.string_count >= 15) return;
entity_data.strings[entity_data.string_count].data = string;
entity_data.strings[entity_data.string_count].color = color;
entity_data.string_count++;

View File

@ -76,10 +76,12 @@ void AfterCreateMove() {
if (CE_BAD(entity)) {
selection.erase(it++);
} else {
#ifndef TEXTMODE
hacks::shared::esp::AddEntityString(entity, "[SELECTED]", colors::orange);
if (fmod(g_GlobalVars->curtime, 2.0f) < 1.0f) {
hacks::shared::esp::SetEntityColor(entity, colors::yellow);
}
#endif
++it;
}
}
@ -92,10 +94,12 @@ void AfterCreateMove() {
if (CE_BAD(entity)) {
selection_secondary.erase(it++);
} else {
#ifndef TEXTMODE
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);
}
#endif
++it;
}
}
@ -198,8 +202,10 @@ void DoWalking() {
int following_idx2 = 0;
if (CE_GOOD(found_entity)) {
following_idx2 = found_entity->m_IDX;
#ifndef TEXTMODE
hacks::shared::esp::AddEntityString(found_entity, "[FOLLOWING]", colors::green);
hacks::shared::esp::SetEntityColor(found_entity, colors::green);
#endif
} else {
crumbStopped = true;
return;
@ -689,7 +695,7 @@ void CrumbBottomAdd() {
logging::Info("Crumb Over-Prune!\nDumping array");
}
}
#ifndef TEXTMODE
// Function called when we need to draw onto the screen
void Draw() {
@ -821,7 +827,7 @@ void DrawFollowbot() {
}
return;
}
#endif
}}}
#endif

View File

@ -34,7 +34,9 @@ extern int following_idx;
bool IsBot(CachedEntity* entity);
void AddMessageHandlers(ipc::peer_t* peer);
void AfterCreateMove();
#ifndef TEXTMODE
void Draw();
#endif
void CrumbReset();
void CrumbTopAdd(Vector crumbToAdd);
void CrumbBottomAdd();

View File

@ -77,6 +77,7 @@ void CreateMove() {
}
void Draw() {
#ifndef TEXTMODE
if (healarrow) {
if ((g_GlobalVars->curtime - healarrow_time) < float(healarrow_timeout)) {
AddCenterString(format("Heal arrow charge: ", int(min(100.0f, (g_GlobalVars->curtime - healarrow_time) / float(healarrow_timeout)) * 100.0f), '%'), colors::yellow);
@ -85,6 +86,9 @@ void Draw() {
AddCenterString("Heal arrow ready", colors::green);
}
}
#else
logging::Info("[WTF] THIS SHOULD NEVER BE CALLED!!! CALL THE POLICE!!!");
#endif
}
}}}

View File

@ -349,6 +349,8 @@ void CreateMove() {
}
}
#ifndef TEXTMODE
void DrawText() {
if (crit_info && CE_GOOD(LOCAL_W)) {
if (CritKeyDown() || experimental_crit_hack.KeyDown()) {
@ -433,6 +435,8 @@ void DrawText() {
}
}
#endif
void Schema_Reload() {
logging::Info("Custom schema loading is not supported right now.");
/*

View File

@ -13,7 +13,9 @@
namespace hacks { namespace shared { namespace misc {
void CreateMove();
#ifndef TEXTMODE
void DrawText();
#endif
extern IClientEntity* found_crit_weapon;
extern int found_crit_number;

View File

@ -702,6 +702,8 @@ void UpdateSlot() {
}
}
}
last_check = std::chrono::system_clock::now();
}
void UpdateWalker() {
@ -741,7 +743,6 @@ void UpdateWalker() {
state::active_node = SelectNextNode();
state::last_node = last;
state::time = std::chrono::system_clock::now();
logging::Info("[wb] Reached node %u, moving to %u", state::last_node, state::active_node);
if (state::node_good(state::active_node)) {
if (state::nodes[state::active_node].flags & NF_JUMP) {
g_pUserCmd->buttons |= IN_DUCK;
@ -750,13 +751,53 @@ void UpdateWalker() {
}
} else {
if (not state::recovery) {
logging::Info("[wb] FATAL: Next node is bad");
state::recovery = true;
}
}
}
}
bool ShouldSpawnNode() {
if (not state::node_good(state::active_node))
return true;
bool was_jumping = state::last_node_buttons & IN_JUMP;
bool is_jumping = g_pUserCmd->buttons & IN_JUMP;
if (was_jumping != is_jumping and is_jumping)
return true;
if ((state::last_node_buttons & IN_DUCK) != (g_pUserCmd->buttons & IN_DUCK))
return true;
auto& node = state::nodes[state::active_node];
if (distance_2d(node.xyz()) > float(spawn_distance)) {
return true;
}
return false;
}
void RecordNode() {
index_t node = CreateNode(g_pLocalPlayer->v_Origin);
auto& n = state::nodes[node];
if (g_pUserCmd->buttons & IN_DUCK)
n.flags |= NF_DUCK;
if (g_pUserCmd->buttons & IN_JUMP)
n.flags |= NF_JUMP;
if (state::node_good(state::active_node)) {
auto& c = state::nodes[state::active_node];
n.link(state::active_node);
c.link(node);
logging::Info("[wb] Node %u auto-linked to node %u at (%.2f %.2f %.2f)", node, state::active_node, c.x, c.y, c.z);
}
state::last_node_buttons = g_pUserCmd->buttons;
state::active_node = node;
}
#ifndef TEXTMODE
// Draws a single colored connection between 2 nodes
void DrawConnection(index_t a, connection_s& b) {
if (b.free())
@ -834,45 +875,6 @@ void DrawNode(index_t node, bool draw_back) {
}
}
bool ShouldSpawnNode() {
if (not state::node_good(state::active_node))
return true;
bool was_jumping = state::last_node_buttons & IN_JUMP;
bool is_jumping = g_pUserCmd->buttons & IN_JUMP;
if (was_jumping != is_jumping and is_jumping)
return true;
if ((state::last_node_buttons & IN_DUCK) != (g_pUserCmd->buttons & IN_DUCK))
return true;
auto& node = state::nodes[state::active_node];
if (distance_2d(node.xyz()) > float(spawn_distance)) {
return true;
}
return false;
}
void RecordNode() {
index_t node = CreateNode(g_pLocalPlayer->v_Origin);
auto& n = state::nodes[node];
if (g_pUserCmd->buttons & IN_DUCK)
n.flags |= NF_DUCK;
if (g_pUserCmd->buttons & IN_JUMP)
n.flags |= NF_JUMP;
if (state::node_good(state::active_node)) {
auto& c = state::nodes[state::active_node];
n.link(state::active_node);
c.link(node);
logging::Info("[wb] Node %u auto-linked to node %u at (%.2f %.2f %.2f)", node, state::active_node, c.x, c.y, c.z);
}
state::last_node_buttons = g_pUserCmd->buttons;
state::active_node = node;
}
void DrawPath() {
for (index_t i = 0; i < state::nodes.size(); i++) {
DrawNode(i, true);
@ -914,12 +916,55 @@ void Draw() {
DrawPath();
}
#endif
void OnLevelInit() {
if (leave_if_empty && state::state == WB_REPLAYING) {
nodes.clear();
}
}
static CatVar wb_abandon_too_many_bots(CV_INT, "wb_population_control", "0", "Abandon if bots >");
void CheckLivingSpace() {
#if IPC_ENABLED
if (ipc::peer && wb_abandon_too_many_bots) {
std::vector<unsigned> players {};
for (int j = 1; j < 32; j++) {
player_info_s info;
if (g_IEngine->GetPlayerInfo(j, &info)) {
if (info.friendsID)
players.push_back(info.friendsID);
}
}
int count = 0;
unsigned highest = 0;
std::vector<unsigned> botlist {};
for (unsigned i = 1; 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) {
botlist.push_back(i);
count++;
highest = i;
}
}
}
}
if (ipc::peer->client_id == highest && count > int(wb_abandon_too_many_bots)) {
static Timer timer {};
if (timer.test_and_set(1000 * 5)) {
logging::Info("Found %d other bots in-game, abandoning (%u)", count, ipc::peer->client_id);
for (auto i : botlist) {
logging::Info("-> Bot %d with ID %u", i, ipc::peer->memory->peer_user_data[i].friendid);
}
g_TFGCClientSystem->SendExitMatchmaking(true);
}
}
}
#endif
}
void Move() {
if (state::state == WB_DISABLED) return;
switch (state::state) {
@ -938,7 +983,7 @@ void Move() {
Load("default");
if (nodes.size() == 0) {
static auto last_abandon = std::chrono::system_clock::from_time_t(0);
auto s = std::chrono::duration_cast<std::chrono::milliseconds>(std::chrono::system_clock::now() - last_abandon).count();
auto s = std::chrono::duration_cast<std::chrono::seconds>(std::chrono::system_clock::now() - last_abandon).count();
if (s < 3) {
return;
@ -949,6 +994,10 @@ void Move() {
}
}
}
static Timer livingspace_timer {};
if (livingspace_timer.test_and_set(1000 * 8)) {
CheckLivingSpace();
}
if (nodes.size() == 0) return;
if (force_slot)
UpdateSlot();

View File

@ -10,7 +10,9 @@
namespace hacks { namespace shared { namespace walkbot {
void Initialize();
#ifndef TEXTMODE
void Draw();
#endif
void Move();
void OnLevelInit();

View File

@ -8,6 +8,15 @@
#ifndef HACKS_HACKLIST_H_
#define HACKS_HACKLIST_H_
#ifndef TEXTMODE
#include "ESP.h"
#include "SkinChanger.hpp"
#include "Radar.hpp"
#include "SpyAlert.h"
#endif
#include "Aimbot.h"
#include "AntiAim.h"
#include "AntiDisguise.h"
@ -16,7 +25,6 @@
#include "AutoSticky.h"
#include "AntiCheat.hpp"
#include "Bunnyhop.h"
#include "ESP.h"
#include "LagExploit.hpp"
#include "Walkbot.hpp"
#include "AutoJoin.hpp"
@ -25,15 +33,12 @@
#include "FollowBot.h"
#include "HealArrows.hpp"
#include "Misc.h"
#include "SpyAlert.h"
#include "Trigger.h"
#include "KillSay.h"
#include "UberSpam.hpp"
#include "SkinChanger.hpp"
#include "Achievement.h"
#include "Spam.h"
#include "Noisemaker.h"
#include "FollowBot.h"
#include "Radar.hpp"
#endif /* HACKS_HACKLIST_H_ */

View File

@ -148,6 +148,9 @@ bool CreateMove_hook(void* thisptr, float inputSample, CUserCmd* cmd) {
hooks::netchannel.HookMethod((void*)SendNetMsg_hook, offsets::SendNetMsg());
hooks::netchannel.HookMethod((void*)Shutdown_hook, offsets::Shutdown());
hooks::netchannel.Apply();
#if IPC_ENABLED
ipc::UpdateServerAddress();
#endif
}
/**bSendPackets = true;
@ -264,11 +267,13 @@ bool CreateMove_hook(void* thisptr, float inputSample, CUserCmd* cmd) {
IF_GAME (IsTF2()) {
SAFE_CALL(UpdateHoovyList());
}
g_pLocalPlayer->v_OrigViewangles = cmd->viewangles;
g_pLocalPlayer->v_OrigViewangles = cmd->viewangles;
#ifndef TEXTMODE
{
PROF_SECTION(CM_esp);
SAFE_CALL(hacks::shared::esp::CreateMove());
}
#endif
if (!g_pLocalPlayer->life_state && CE_GOOD(g_pLocalPlayer->weapon())) {
{
PROF_SECTION(CM_walkbot);
@ -353,13 +358,16 @@ bool CreateMove_hook(void* thisptr, float inputSample, CUserCmd* cmd) {
// TODO Auto Steam Friend
if (g_GlobalVars->framecount % 1000 == 0) {
#if IPC_ENABLED
{
PROF_SECTION(CM_playerlist);
// playerlist::DoNotKillMe();
#ifdef IPC_ENABLED
ipc::UpdatePlayerlist();
#endif
static Timer ipc_update_timer {};
// playerlist::DoNotKillMe();
if (ipc_update_timer.test_and_set(1000 * 10)) {
ipc::UpdatePlayerlist();
}
}
#endif
*bSendPackets = true;

View File

@ -41,10 +41,12 @@ void PaintTraverse_hook(void* _this, unsigned int vp, bool fr, bool ar) {
if (!segvcatch::handler_segv) segvcatch::init_fpe();
}
#endif
#ifndef TEXTMODE
if (!textures_loaded) {
textures_loaded = true;
hacks::tf::radar::Init();
}
#endif
if (pure_bypass) {
if (!pure_addr) {
pure_addr = *reinterpret_cast<void***>(gSignatures.GetEngineSignature("55 89 E5 83 EC 18 A1 ? ? ? ? 89 04 24 E8 0D FF FF FF A1 ? ? ? ? 85 C0 74 08 89 04 24 E8 ? ? ? ? C9 C3") + 7);
@ -87,7 +89,6 @@ void PaintTraverse_hook(void* _this, unsigned int vp, bool fr, bool ar) {
PROF_SECTION(PT_total);
hacks::shared::autojoin::UpdateSearch();
if (vp == panel_top) draw_flag = true;
if (!cathook) return;
@ -124,22 +125,12 @@ void PaintTraverse_hook(void* _this, unsigned int vp, bool fr, bool ar) {
if (!draw_flag) return;
draw_flag = false;
if (!hack::command_stack().empty()) {
PROF_SECTION(PT_command_stack);
std::lock_guard<std::mutex> guard(hack::command_stack_mutex);
while (!hack::command_stack().empty()) {
logging::Info("executing %s", hack::command_stack().top().c_str());
g_IEngine->ClientCmd_Unrestricted(hack::command_stack().top().c_str());
hack::command_stack().pop();
}
}
if (disable_visuals) return;
if (clean_screenshots && g_IEngine->IsTakingScreenshot()) return;
PROF_SECTION(PT_active);
#ifndef TEXTMODE
draw::UpdateWTS();
BeginCheatVisuals();
DrawCheatVisuals();
@ -151,6 +142,7 @@ void PaintTraverse_hook(void* _this, unsigned int vp, bool fr, bool ar) {
EndCheatVisuals();
#endif
SEGV_END;
}

View File

@ -12,6 +12,8 @@
#include "ucccccp.hpp"
#include "hookedmethods.h"
#ifndef TEXTMODE
static CatVar no_invisibility(CV_SWITCH, "no_invis", "0", "Remove Invisibility", "Useful with chams!");
// This hook isn't used yet!
@ -68,6 +70,41 @@ void DrawModelExecute_hook(IVModelRender* _this, const DrawModelState_t& state,
original(_this, state, info, matrix);
}
int IN_KeyEvent_hook(void* _this, int eventcode, int keynum, const char* pszCurrentBinding) {
static const IN_KeyEvent_t original = (IN_KeyEvent_t)hooks::client.GetMethod(offsets::IN_KeyEvent());
#if ENABLE_GUI
SEGV_BEGIN;
if (g_pGUI->ConsumesKey((ButtonCode_t)keynum) && g_pGUI->Visible()) {
return 0;
}
SEGV_END;
#endif
return original(_this, eventcode, keynum, pszCurrentBinding);
}
CatVar override_fov_zoomed(CV_FLOAT, "fov_zoomed", "0", "FOV override (zoomed)", "Overrides FOV with this value when zoomed in (default FOV when zoomed is 20)");
CatVar override_fov(CV_FLOAT, "fov", "0", "FOV override", "Overrides FOV with this value");
void OverrideView_hook(void* _this, CViewSetup* setup) {
static const OverrideView_t original = (OverrideView_t)hooks::clientmode.GetMethod(offsets::OverrideView());
static bool zoomed;
SEGV_BEGIN;
original(_this, setup);
if (!cathook) return;
if (g_pLocalPlayer->bZoomed && override_fov_zoomed) {
setup->fov = override_fov_zoomed;
} else {
if (override_fov) {
setup->fov = override_fov;
}
}
draw::fov = setup->fov;
SEGV_END;
}
#endif
bool CanPacket_hook(void* _this) {
const CanPacket_t original = (CanPacket_t)hooks::netchannel.GetMethod(offsets::CanPacket());
SEGV_BEGIN;
@ -96,18 +133,6 @@ CUserCmd* GetUserCmd_hook(IInput* _this, int sequence_number) {
return def;
}
int IN_KeyEvent_hook(void* _this, int eventcode, int keynum, const char* pszCurrentBinding) {
static const IN_KeyEvent_t original = (IN_KeyEvent_t)hooks::client.GetMethod(offsets::IN_KeyEvent());
#if ENABLE_GUI
SEGV_BEGIN;
if (g_pGUI->ConsumesKey((ButtonCode_t)keynum) && g_pGUI->Visible()) {
return 0;
}
SEGV_END;
#endif
return original(_this, eventcode, keynum, pszCurrentBinding);
}
static CatVar log_sent(CV_SWITCH, "debug_log_sent_messages", "0", "Log sent messages");
static CatCommand plus_use_action_slot_item_server("+cat_use_action_slot_item_server", "use_action_slot_item_server", []() {
@ -203,6 +228,10 @@ bool SendNetMsg_hook(void* _this, INetMessage& msg, bool bForceReliable = false,
void Shutdown_hook(void* _this, const char* reason) {
// This is a INetChannel hook - it SHOULDN'T be static because netchannel changes.
const Shutdown_t original = (Shutdown_t)hooks::netchannel.GetMethod(offsets::Shutdown());
logging::Info("Disconnect: %s", reason);
#if IPC_ENABLED
ipc::UpdateServerAddress(true);
#endif
SEGV_BEGIN;
if (cathook && (disconnect_reason.convar_parent->m_StringLength > 3) && strstr(reason, "user")) {
original(_this, disconnect_reason_newlined);
@ -282,9 +311,22 @@ bool StolenName(){
return false;
}
static CatVar ipc_name(CV_STRING, "name_ipc", "", "IPC Name");
const char* GetFriendPersonaName_hook(ISteamFriends* _this, CSteamID steamID) {
static const GetFriendPersonaName_t original = (GetFriendPersonaName_t)hooks::steamfriends.GetMethod(offsets::GetFriendPersonaName());
#if IPC_ENABLED
if (ipc::peer) {
static std::string namestr(ipc_name.GetString());
namestr.assign(ipc_name.GetString());
if (namestr.length() > 3) {
ReplaceString(namestr, "%%", std::to_string(ipc::peer->client_id));
return namestr.c_str();
}
}
#endif
// Check User settings if namesteal is allowed
if (namesteal && steamID == g_ISteamUser->GetSteamID()) {
@ -332,11 +374,12 @@ void FrameStageNotify_hook(void* _this, int stage) {
static const FrameStageNotify_t original = (FrameStageNotify_t)hooks::client.GetMethod(offsets::FrameStageNotify());
SEGV_BEGIN;
if (!g_IEngine->IsInGame()) g_Settings.bInvalid = true;
// TODO hack FSN hook
#ifndef TEXTMODE
{
PROF_SECTION(FSN_skinchanger);
hacks::tf2::skinchanger::FrameStageNotify(stage);
}
#endif
if (stage == FRAME_NET_UPDATE_POSTDATAUPDATE_START) {
angles::Update();
hacks::shared::anticheat::CreateMove();
@ -356,6 +399,42 @@ void FrameStageNotify_hook(void* _this, int stage) {
}
}
}
if (stage == FRAME_START) {
#if IPC_ENABLED
static Timer nametimer {};
if (nametimer.test_and_set(1000 * 10)) {
if (ipc::peer) {
ipc::StoreClientData();
}
}
static Timer ipc_timer {};
if (ipc_timer.test_and_set(1000)) {
if (ipc::peer) {
ipc::Heartbeat();
ipc::UpdateTemporaryData();
}
}
#endif
hacks::shared::autojoin::UpdateSearch();
if (!hack::command_stack().empty()) {
PROF_SECTION(PT_command_stack);
std::lock_guard<std::mutex> guard(hack::command_stack_mutex);
while (!hack::command_stack().empty()) {
logging::Info("executing %s", hack::command_stack().top().c_str());
g_IEngine->ClientCmd_Unrestricted(hack::command_stack().top().c_str());
hack::command_stack().pop();
}
}
#if defined(TEXTMODE) and defined(TEXTMODE_STDIN)
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) {
UpdateInput();
last_stdin = std::chrono::system_clock::now();
}
#endif
}
#ifndef TEXTMODE
if (cathook && !g_Settings.bInvalid && stage == FRAME_RENDER_START) {
#if ENABLE_GUI
if (cursor_fix_experimental) {
@ -379,30 +458,11 @@ void FrameStageNotify_hook(void* _this, int stage) {
}
}
}
#endif /* TEXTMODE */
SAFE_CALL(original(_this, stage));
SEGV_END;
}
CatVar override_fov_zoomed(CV_FLOAT, "fov_zoomed", "0", "FOV override (zoomed)", "Overrides FOV with this value when zoomed in (default FOV when zoomed is 20)");
CatVar override_fov(CV_FLOAT, "fov", "0", "FOV override", "Overrides FOV with this value");
void OverrideView_hook(void* _this, CViewSetup* setup) {
static const OverrideView_t original = (OverrideView_t)hooks::clientmode.GetMethod(offsets::OverrideView());
static bool zoomed;
SEGV_BEGIN;
original(_this, setup);
if (!cathook) return;
if (g_pLocalPlayer->bZoomed && override_fov_zoomed) {
setup->fov = override_fov_zoomed;
} else {
if (override_fov) {
setup->fov = override_fov;
}
}
draw::fov = setup->fov;
SEGV_END;
}
static CatVar clean_chat(CV_SWITCH, "clean_chat", "0", "Clean chat", "Removes newlines from chat");
static CatVar dispatch_log(CV_SWITCH, "debug_log_usermessages", "0", "Log dispatched user messages");

View File

@ -77,17 +77,12 @@ void CreateInterfaces() {
g_IEngine = BruteforceInterface<IVEngineClient013>("VEngineClient", sharedobj::engine());
g_AppID = g_IEngine->GetAppID();
g_IEntityList = BruteforceInterface<IClientEntityList>("VClientEntityList", sharedobj::client());
g_IPanel = BruteforceInterface<vgui::IPanel>("VGUI_Panel", sharedobj::vgui2());
g_ISteamClient = BruteforceInterface<ISteamClient>("SteamClient", sharedobj::steamclient(), 17);
g_ISurface = BruteforceInterface<vgui::ISurface>("VGUI_Surface", sharedobj::vguimatsurface());
g_IEventManager2 = BruteforceInterface<IGameEventManager2>("GAMEEVENTSMANAGER", sharedobj::engine(), 2);
g_IGameEventManager = BruteforceInterface<IGameEventManager>("GAMEEVENTSMANAGER", sharedobj::engine(), 1);
g_IBaseClient = BruteforceInterface<IBaseClientDLL>("VClient", sharedobj::client());
g_ITrace = BruteforceInterface<IEngineTrace>("EngineTraceClient", sharedobj::engine());
g_IModelInfo = BruteforceInterface<IVModelInfoClient>("VModelInfoClient", sharedobj::engine());
g_IInputSystem = BruteforceInterface<IInputSystem>("InputSystemVersion", sharedobj::inputsystem());
g_IStudioRender = BruteforceInterface<IStudioRender>("VStudioRender", sharedobj::studiorender());
g_IVDebugOverlay = BruteforceInterface<IVDebugOverlay>("VDebugOverlay", sharedobj::engine());
HSteamPipe sp = g_ISteamClient->CreateSteamPipe();
HSteamUser su = g_ISteamClient->ConnectToGlobalUser(sp);
g_IVModelRender = BruteforceInterface<IVModelRender>("VEngineModel", sharedobj::engine(), 16);
@ -103,8 +98,43 @@ void CreateInterfaces() {
g_GlobalVars = **(reinterpret_cast<CGlobalVarsBase***>((uintptr_t)11 + gSignatures.GetClientSignature("55 89 E5 83 EC ? 8B 45 08 8B 15 ? ? ? ? F3 0F 10")));
g_IPrediction = BruteforceInterface<IPrediction>("VClientPrediction", sharedobj::client());
g_IGameMovement = BruteforceInterface<IGameMovement>("GameMovement", sharedobj::client());
g_IVRenderView = BruteforceInterface<IVRenderView>("VEngineRenderView", sharedobj::engine());
IF_GAME (IsTF2()) {
//g_IMoveHelper = *(reinterpret_cast<IMoveHelper**>(gSignatures.GetClientSignature("? ? ? ? 8B 10 89 04 24 FF 52 28 0F B7 CF 8B 10 89 4C 24 04 89 04 24 FF 52 1C 8B 13 89 1C 24 89 44 24 04 FF 92 74 05 00 00 8D 95 C8 FE FF FF C7 44 24 08 00 00 00 00")));
}
IF_GAME (IsTF2()) {
g_IInput = **(reinterpret_cast<IInput***>((uintptr_t)1 + gSignatures.GetClientSignature("A1 ? ? ? ? C6 05 ? ? ? ? 01 8B 10 89 04 24 FF 92 B4 00 00 00 A1 ? ? ? ? 8B 10")));
} else IF_GAME (IsTF2C()) {
g_IInput = **(reinterpret_cast<IInput***>((uintptr_t)1 + gSignatures.GetClientSignature("A1 ? ? ? ? C6 05 ? ? ? ? 01 8B 10 89 04 24 FF 92 A8 00 00 00 A1 ? ? ? ? 8B 10")));
} else {
g_IInput = **(reinterpret_cast<IInput***>((uintptr_t)1 + gSignatures.GetClientSignature("A1 ? ? ? ? 8B 10 89 04 24 FF 52 78 A1 ? ? ? ? 8B 10")));
}
g_ISteamUser = g_ISteamClient->GetISteamUser(su, sp, "SteamUser018");
g_IModelInfo = BruteforceInterface<IVModelInfoClient>("VModelInfoClient", sharedobj::engine());
g_IBaseClientState = *(reinterpret_cast<CBaseClientState**>(gSignatures.GetEngineSignature("55 89 E5 83 EC 18 C7 44 24 04 01 00 00 00 C7 04 24 ? ? ? ? E8 ? ? ? ? C7 04 24 ? ? ? ? 89 44 24 04 E8 ? ? ? ? A1 ? ? ? ? 85 C0 74 15 A1 ? ? ? ? 8B 10 89 04 24 FF 52 38 C9 C3") + 17));
logging::Info("BaseClientState: 0x%08x", g_IBaseClientState);
g_IAchievementMgr = g_IEngine->GetAchievementMgr();
g_ISteamUserStats = g_ISteamClient->GetISteamUserStats(su, sp, "STEAMUSERSTATS_INTERFACE_VERSION011");
IF_GAME (IsTF2()) {
uintptr_t sig = gSignatures.GetClientSignature("89 1C 24 D9 5D D4 FF 90 3C 01 00 00 89 C7 8B 06 89 34 24 C1 E7 08 FF 90 3C 01 00 00 09 C7 33 3D ? ? ? ? 39 BB 34 0B 00 00 74 0E 89 BB 34 0B 00 00 89 3C 24 E8 ? ? ? ? C7 44 24 04 0F 27 00 00");
g_PredictionRandomSeed = *reinterpret_cast<int**>(sig + (uintptr_t)32);
}
IF_GAME (IsTF2()) {
uintptr_t gcsystem_sig = gSignatures.GetClientSignature("E8 ? ? ? ? C7 44 24 04 04 00 00 00 89 04 24 E8 ? ? ? ? E9 17 FF FF FF") + 1;
typedef TFGCClientSystem*(*func_t)(void);
logging::Info("GCSystem = 0x%08x", gcsystem_sig);
uintptr_t gcc_p = *(uintptr_t*)(gcsystem_sig);
func_t get_gc = (gcc_p + gcsystem_sig + 4);
logging::Info("GTFGCClientSystem() = 0x%08x", get_gc);
g_TFGCClientSystem = get_gc();
}
#ifndef TEXTMODE
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());
g_IStudioRender = BruteforceInterface<IStudioRender>("VStudioRender", sharedobj::studiorender());
g_IMaterialSystem = BruteforceInterface<IMaterialSystemFixed>("VMaterialSystem", sharedobj::materialsystem());
g_IVRenderView = BruteforceInterface<IVRenderView>("VEngineRenderView", sharedobj::engine());
g_IMaterialSystemHL = (IMaterialSystem*)g_IMaterialSystem;
IF_GAME (IsTF2()) {
g_pScreenSpaceEffects = **(IScreenSpaceEffectManager***)(gSignatures.GetClientSignature("F3 0F 10 83 40 05 00 00 C7 44 24 04 ? ? ? ? 89 34 24 F3 0F 11 44 24 08 E8 ? ? ? ? A1 ? ? ? ? 8B 10 89 04 24 89 74 24 08 C7 44 24 04 ? ? ? ? FF 52 0C A1 ? ? ? ? 8B 10 C7 44 24 04 ? ? ? ? 89 04 24 FF 52 14") + 31);
@ -117,39 +147,11 @@ void CreateInterfaces() {
g_pScreenSpaceEffects = **(IScreenSpaceEffectManager***)(gSignatures.GetClientSignature("FF 52 14 E9 E0 FE FF FF 8D 76 00 A1 ? ? ? ? 8B 5D F4 8B 75 F8 8B 7D FC 8B 10 C7 45 0C ? ? ? ? 89 45 08 8B 42 1C 89 EC 5D FF E0") + 12);
g_ppScreenSpaceRegistrationHead = *(CScreenSpaceEffectRegistration***)(gSignatures.GetClientSignature("E8 ? ? ? ? 8B 10 C7 44 24 04 ? ? ? ? 89 04 24 FF 52 28 85 C0 75 4B 8B 35 ? ? ? ? 85 F6 74 31 90 8B 5E 04 85 DB 74 22 8B 03 89 1C 24") + 27);
}
IF_GAME (IsTF2()) {
//g_IMoveHelper = *(reinterpret_cast<IMoveHelper**>(gSignatures.GetClientSignature("? ? ? ? 8B 10 89 04 24 FF 52 28 0F B7 CF 8B 10 89 4C 24 04 89 04 24 FF 52 1C 8B 13 89 1C 24 89 44 24 04 FF 92 74 05 00 00 8D 95 C8 FE FF FF C7 44 24 08 00 00 00 00")));
}
IF_GAME (IsTF2()) {
g_IInput = **(reinterpret_cast<IInput***>((uintptr_t)1 + gSignatures.GetClientSignature("A1 ? ? ? ? C6 05 ? ? ? ? 01 8B 10 89 04 24 FF 92 B4 00 00 00 A1 ? ? ? ? 8B 10")));
} else IF_GAME (IsTF2C()) {
g_IInput = **(reinterpret_cast<IInput***>((uintptr_t)1 + gSignatures.GetClientSignature("A1 ? ? ? ? C6 05 ? ? ? ? 01 8B 10 89 04 24 FF 92 A8 00 00 00 A1 ? ? ? ? 8B 10")));
} else {
g_IInput = **(reinterpret_cast<IInput***>((uintptr_t)1 + gSignatures.GetClientSignature("A1 ? ? ? ? 8B 10 89 04 24 FF 52 78 A1 ? ? ? ? 8B 10")));
}
g_ISteamUser = g_ISteamClient->GetISteamUser(su, sp, "SteamUser018");
g_IBaseClientState = *(reinterpret_cast<CBaseClientState**>(gSignatures.GetEngineSignature("55 89 E5 83 EC 18 C7 44 24 04 01 00 00 00 C7 04 24 ? ? ? ? E8 ? ? ? ? C7 04 24 ? ? ? ? 89 44 24 04 E8 ? ? ? ? A1 ? ? ? ? 85 C0 74 15 A1 ? ? ? ? 8B 10 89 04 24 FF 52 38 C9 C3") + 17));
logging::Info("BaseClientState: 0x%08x", g_IBaseClientState);
g_IAchievementMgr = g_IEngine->GetAchievementMgr();
g_ISteamUserStats = g_ISteamClient->GetISteamUserStats(su, sp, "STEAMUSERSTATS_INTERFACE_VERSION011");
IF_GAME (IsTF2()) {
uintptr_t sig = gSignatures.GetClientSignature("89 1C 24 D9 5D D4 FF 90 3C 01 00 00 89 C7 8B 06 89 34 24 C1 E7 08 FF 90 3C 01 00 00 09 C7 33 3D ? ? ? ? 39 BB 34 0B 00 00 74 0E 89 BB 34 0B 00 00 89 3C 24 E8 ? ? ? ? C7 44 24 04 0F 27 00 00");
g_PredictionRandomSeed = *reinterpret_cast<int**>(sig + (uintptr_t)32);
}
logging::Info("Finding HUD");
{
uintptr_t hud_sig = gSignatures.GetClientSignature("FF 50 08 D9 9D 24 FE FF FF 89 3C 24 E8 ? ? ? ? C7 44 24 04 ? ? ? ? C7 04 24 ? ? ? ? D9 9D 20 FE FF FF E8 ? ? ? ? 85 C0 74 3B 66 0F 6E C3 C7 44 24 10 00 00 00 00 F3 0F 5C 85 20 FE FF FF") + 28;
g_CHUD = *reinterpret_cast<CHud**>(hud_sig);
logging::Info("HUD 0x%08x 0x%08x", hud_sig, g_CHUD);
}
IF_GAME (IsTF2()) {
uintptr_t gcsystem_sig = gSignatures.GetClientSignature("E8 ? ? ? ? C7 44 24 04 04 00 00 00 89 04 24 E8 ? ? ? ? E9 17 FF FF FF") + 1;
typedef TFGCClientSystem*(*func_t)(void);
logging::Info("GCSystem = 0x%08x", gcsystem_sig);
uintptr_t gcc_p = *(uintptr_t*)(gcsystem_sig);
func_t get_gc = (gcc_p + gcsystem_sig + 4);
logging::Info("GTFGCClientSystem() = 0x%08x", get_gc);
g_TFGCClientSystem = get_gc();
}
#endif
}

View File

@ -121,20 +121,68 @@ CatVar server_name(CV_STRING, "ipc_server", "cathook_followbot_server", "IPC ser
peer_t* peer { nullptr };
void StoreClientData() {
void UpdateServerAddress(bool shutdown) {
if (not peer)
return;
const char* s_addr = "0.0.0.0";
if (not shutdown and g_IEngine->GetNetChannelInfo()) {
s_addr = g_IEngine->GetNetChannelInfo()->GetAddress();
}
peer_t::MutexLock lock(peer);
user_data_s& data = peer->memory->peer_user_data[peer->client_id];
data.friendid = g_ISteamUser->GetSteamID().GetAccountID();
strncpy(data.server, s_addr, sizeof(data.server));
}
void UpdateTemporaryData() {
user_data_s& data = peer->memory->peer_user_data[peer->client_id];
data.connected = g_IEngine->IsInGame();
if (data.connected) {
IClientEntity* player = g_IEntityList->GetClientEntity(g_IEngine->GetLocalPlayer());
if (player) {
data.good = true;
data.health = NET_INT(player, netvar.iHealth);
data.health_max = g_pPlayerResource->GetMaxHealth(LOCAL_E);
data.clazz = g_pPlayerResource->GetClass(LOCAL_E);
data.life_state = NET_BYTE(player, netvar.iLifeState);
data.score = g_pPlayerResource->GetScore(g_IEngine->GetLocalPlayer());
if (data.last_score != data.score) {
if (data.last_score > data.score) {
data.total_score += data.score;
} else {
data.total_score += (data.score - data.last_score);
}
data.last_score = data.score;
}
data.team = g_pPlayerResource->GetTeam(g_IEngine->GetLocalPlayer());
} else {
data.good = false;
}
}
}
void StoreClientData() {
UpdateServerAddress();
user_data_s& data = peer->memory->peer_user_data[peer->client_id];
data.friendid = g_ISteamUser->GetSteamID().GetAccountID();
strncpy(data.name, g_ISteamFriends->GetPersonaName(), sizeof(data.name));
}
static CatVar fbPlayUpdate(CV_SWITCH, "fb_auto_playerlist", "1", "Assign State", "Automaticly assign playerstates for bots");
void Heartbeat() {
user_data_s& data = peer->memory->peer_user_data[peer->client_id];
data.heartbeat = time(nullptr);
}
static CatVar ipc_update_list(CV_SWITCH, "ipc_update_list", "1", "IPC Auto-Ignore", "Automaticly assign playerstates for bots");
void UpdatePlayerlist() {
if (peer && fbPlayUpdate) {
if (peer && ipc_update_list) {
for (unsigned i = 1; 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)
if (info.state == playerlist::k_EState::DEFAULT)
info.state = playerlist::k_EState::IPC;
}
}

View File

@ -13,6 +13,7 @@
#include "beforecheaders.h"
#include "ipcb.hpp"
#include "pthread.h"
#include <time.h>
#include "aftercheaders.h"
class CatCommand;
@ -47,13 +48,28 @@ struct server_data_s {
struct user_data_s {
char name[32];
char server[22];
unsigned friendid;
bool connected;
bool good;
int health;
int health_max;
char life_state;
int team;
int clazz;
int score;
int last_score;
int total_score;
time_t heartbeat;
};
using peer_t = cat_ipc::Peer<server_data_s, user_data_s>;
extern peer_t* peer;
void Heartbeat();
void UpdateTemporaryData();
void UpdateServerAddress(bool shutdown = false);
void StoreClientData();
void UpdatePlayerlist();

View File

@ -29,14 +29,24 @@ void logging::Info(const char* fmt, ...) {
vsprintf(buffer, fmt, list);
va_end(list);
size_t length = strlen(buffer);
char* result = new char[length + 9];
sprintf(result, "[CAT] %s\n", buffer);
char* result = new char[length + 24];
time_t current_time;
struct tm * time_info = nullptr;
char timeString[10];
time(&current_time);
time_info = localtime(&current_time);
strftime(timeString, sizeof(timeString), "%H:%M:%S", time_info);
sprintf(result, "%% [%s] %s\n", timeString, buffer);
fprintf(logging::handle, "%s", result);
fflush(logging::handle);
#ifndef TEXTMODE
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

@ -8,7 +8,7 @@
#ifndef MACROS_HPP_
#define MACROS_HPP_
#if defined(NOGUI) and NOGUI == 1
#if defined(NOGUI) and NOGUI == 1 or defined(TEXTMODE)
#define ENABLE_GUI false
#else
#define ENABLE_GUI true

View File

@ -48,6 +48,7 @@ void NetVars::Init() {
m_iTauntIndex = gNetvars.get_offset("DT_TFPlayer", "m_Shared", "m_iTauntIndex");
m_iTauntConcept = gNetvars.get_offset("DT_TFPlayer", "m_Shared", "m_iTauntConcept");
}
this->res_iScore = gNetvars.get_offset("DT_TFPlayerResource", "baseclass", "m_iScore");
IF_GAME (IsTF()) {
this->res_iMaxHealth = gNetvars.get_offset("DT_TFPlayerResource", "m_iMaxHealth");
this->res_iPlayerClass = gNetvars.get_offset("DT_TFPlayerResource", "m_iPlayerClass");

View File

@ -125,6 +125,7 @@ public:
offset_t m_bReadyToBackstab;
offset_t m_Collision;
offset_t res_iTeam;
offset_t res_iScore;
offset_t m_nChargeResistType;
offset_t m_flChargeLevel;

View File

@ -53,6 +53,15 @@ int TFPlayerResource::GetTeam(int idx) {
return *(int*)((unsigned)ent + netvar.res_iTeam + 4 * idx);
}
int TFPlayerResource::GetScore(int idx) {
IClientEntity *ent;
if (idx >= 32 || idx < 1) return 0;
ent = g_IEntityList->GetClientEntity(entity);
if (!ent || ent->GetClientClass()->m_ClassID != RCC_PLAYERRESOURCE) return 0;
return *(int*)((unsigned)ent + netvar.res_iScore + 4 * idx);
}
int TFPlayerResource::GetClass(CachedEntity* player) {
IClientEntity *ent;
int idx;

View File

@ -17,6 +17,7 @@ public:
int GetMaxBuffedHealth(CachedEntity* player);
int GetClass(CachedEntity* player);
int GetTeam(int idx);
int GetScore(int idx);
int entity;
};

View File

@ -81,7 +81,7 @@ void Prediction_CreateMove() {
}
}
}
#ifndef TEXTMODE
void Prediction_PaintTraverse() {
if (!debug_enginepred) return;
for (int i = 1; i < predicted_player_count; i++) {
@ -104,7 +104,7 @@ void Prediction_PaintTraverse() {
}
}
}
#endif
Vector EnginePrediction(CachedEntity* entity, float time) {
Vector result = entity->m_vecOrigin;
IClientEntity* ent = RAW_ENT(entity);

View File

@ -24,7 +24,9 @@ float PlayerGravityMod(CachedEntity* player);
Vector EnginePrediction(CachedEntity* player, float time);
void Prediction_CreateMove();
#ifndef TEXTMODE
void Prediction_PaintTraverse();
#endif
float DistanceToGround(CachedEntity* ent);
float DistanceToGround(Vector origin);

View File

@ -29,3 +29,11 @@ int TFGCClientSystem::SendExitMatchmaking(bool abandon) {
logging::Info("Calling 0x%08x", SendExitMatchmaking_fn);
return SendExitMatchmaking_fn(this, abandon);
}
int TFGCClientSystem::LoadSearchCriteria() {
static uintptr_t LoadSearchCriteria_loc = gSignatures.GetClientSignature("55 89 E5 57 56 53 8D 5D A8 81 EC DC 00 00 00 C7 44 24 0C 00 00 00 00 C7 44 24 08 00 00 00 00 C7 44 24 04 00 00 00 00 89 1C 24 E8 ? ? ? ? C7 44 24 08 01 00 00 00 C7 44 24 04 01 00 00 00 89 1C 24 E8 ? ? ? ? A1 ? ? ? ? 8D 50 04");
typedef int(*LoadSearchCriteria_t)(TFGCClientSystem*);
static LoadSearchCriteria_t LoadSearchCriteria_fn = (LoadSearchCriteria_t)LoadSearchCriteria_loc;
logging::Info("Calling 0x%08x", LoadSearchCriteria_fn);
return LoadSearchCriteria_fn(this);
}

View File

@ -13,5 +13,6 @@ public:
int GetState();
/* 55 89 E5 57 56 8D 75 C8 53 81 EC 8C 00 00 00 8B 45 0C C7 04 24 ? ? ? ? 8B 5D 08 89 45 A4 0F B6 C0 89 44 24 04 E8 ? ? ? ? C7 44 24 04 91 18 00 00 89 34 24 E8 ? ? ? ? A1 ? ? ? ? */
int SendExitMatchmaking(bool abandon);
int LoadSearchCriteria();
};

View File

@ -76,14 +76,16 @@ void LoadAllSharedObjects() {
steamclient().Load();
client().Load();
engine().Load();
vguimatsurface().Load();
vgui2().Load();
vstdlib().Load();
tier0().Load();
inputsystem().Load();
#ifndef TEXTMODE
vguimatsurface().Load();
vgui2().Load();
studiorender().Load();
materialsystem().Load();
libsdl().Load();
#endif
} catch (std::exception& ex) {
logging::Info("Exception: %s", ex.what());
}
@ -101,14 +103,6 @@ SharedObject& engine() {
static SharedObject obj("engine.so", true);
return obj;
}
SharedObject& vguimatsurface() {
static SharedObject obj("vguimatsurface.so", true);
return obj;
}
SharedObject& vgui2() {
static SharedObject obj("vgui2.so", true);
return obj;
}
SharedObject& vstdlib() {
static SharedObject obj("libvstdlib.so", true);
return obj;
@ -121,6 +115,15 @@ SharedObject& inputsystem() {
static SharedObject obj("inputsystem.so", true);
return obj;
}
#ifndef TEXTMODE
SharedObject& vguimatsurface() {
static SharedObject obj("vguimatsurface.so", true);
return obj;
}
SharedObject& vgui2() {
static SharedObject obj("vgui2.so", true);
return obj;
}
SharedObject& studiorender() {
static SharedObject obj("studiorender.so", true);
return obj;
@ -133,5 +136,6 @@ SharedObject& libsdl() {
static SharedObject obj("libSDL2-2.0.so.0", false);
return obj;
}
#endif
}

View File

@ -39,14 +39,16 @@ public:
SharedObject& steamclient();
SharedObject& client();
SharedObject& engine();
SharedObject& vguimatsurface();
SharedObject& vgui2();
SharedObject& vstdlib();
SharedObject& tier0();
SharedObject& inputsystem();
#ifndef TEXTMODE
SharedObject& vguimatsurface();
SharedObject& vgui2();
SharedObject& studiorender();
SharedObject& materialsystem();
SharedObject& libsdl();
#endif
void LoadAllSharedObjects();

55
src/textmode.cpp Normal file
View File

@ -0,0 +1,55 @@
/*
* textmode.cpp
*
* Created on: Jul 28, 2017
* Author: nullifiedcat
*/
#include "common.h"
#include "init.hpp"
#include "copypasted/CSignature.h"
#include "cvwrapper.h"
#include <fcntl.h>
#include <unistd.h>
bool *allowSecureServers { nullptr };
void EXPOSED_Epic_VACBypass_1337_DoNotSteal_xXx_$1_xXx_MLG() {
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);
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..?");
}
CatCommand fixvac("fixvac", "Lemme in to secure servers", []() {
*allowSecureServers = true;
});
#ifdef TEXTMODE
InitRoutine init([]() {
#ifdef TEXTMODE_STDIN
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
EXPOSED_Epic_VACBypass_1337_DoNotSteal_xXx_$1_xXx_MLG();
});
#endif
void UpdateInput() {
char buffer[256];
int bytes = read(0, buffer, 255);
if (bytes > 0) {
buffer[bytes] = '\0';
g_IEngine->ExecuteClientCmd(buffer);
}
}

10
src/textmode.hpp Normal file
View File

@ -0,0 +1,10 @@
/*
* textmode.hpp
*
* Created on: Jul 28, 2017
* Author: nullifiedcat
*/
#pragma once
void UpdateInput();

36
src/timer.hpp Normal file
View File

@ -0,0 +1,36 @@
/*
* timer.hpp
*
* Created on: Jul 29, 2017
* Author: nullifiedcat
*/
#pragma once
#include <chrono>
class Timer {
public:
typedef std::chrono::system_clock clock;
inline Timer() {};
inline bool check(unsigned ms) const {
return std::chrono::duration_cast<std::chrono::milliseconds>(clock::now() - last).count() >= ms;
}
inline bool test_and_set(unsigned ms) {
if (check(ms)) {
update();
return true;
}
return false;
}
inline void update() {
last = clock::now();
}
public:
std::chrono::time_point<clock> last {};
};