commit
aeb042bade
@ -66,7 +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"/>
|
||||
<listOptionValue builtIn="false" value="ENABLE_VISUALS=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"/>
|
||||
|
BIN
data/fonts/roboto.ttf
Executable file
BIN
data/fonts/roboto.ttf
Executable file
Binary file not shown.
BIN
data/fonts/tf2build.ttf
Executable file
BIN
data/fonts/tf2build.ttf
Executable file
Binary file not shown.
BIN
data/fonts/unispace.ttf
Normal file
BIN
data/fonts/unispace.ttf
Normal file
Binary file not shown.
BIN
data/fonts/verasans.ttf
Normal file
BIN
data/fonts/verasans.ttf
Normal file
Binary file not shown.
@ -1 +1 @@
|
||||
Subproject commit e532876ffd707a48389d54ff904dcc40a84f2839
|
||||
Subproject commit 98934e7579ac276ba1a1972db3e1eb741c789068
|
@ -9,9 +9,9 @@
|
||||
#define COMMON_H_
|
||||
|
||||
#if defined(LINUX) and not defined(NO_IPC)
|
||||
#define IPC_ENABLED 1
|
||||
#define ENABLE_IPC 1
|
||||
#else
|
||||
#undef IPC_ENABLED
|
||||
#undef ENABLE_IPC
|
||||
#endif
|
||||
|
||||
|
||||
|
@ -39,15 +39,15 @@ void AddSideString(const std::string& string, const rgba_t& color) {
|
||||
void DrawStrings() {
|
||||
int y { 8 };
|
||||
for (size_t i = 0; i < side_strings_count; ++i) {
|
||||
FTGL_Draw(side_strings[i], 8, y, fonts::ftgl_ESP, side_strings_colors[i]);
|
||||
y += fonts::ftgl_ESP->height + 1;
|
||||
FTGL_Draw(side_strings[i], 8, y, fonts::font_main, side_strings_colors[i]);
|
||||
y += fonts::font_main->height + 1;
|
||||
}
|
||||
y = draw::height / 2;
|
||||
for (size_t i = 0; i < center_strings_count; ++i) {
|
||||
int sx;
|
||||
FTGL_StringLength(center_strings[i], fonts::ftgl_ESP, &sx, nullptr);
|
||||
FTGL_Draw(center_strings[i], (draw::width - sx) / 2, y, fonts::ftgl_ESP, center_strings_colors[i]);
|
||||
y += fonts::ftgl_ESP->height + 1;
|
||||
FTGL_StringLength(center_strings[i], fonts::font_main, &sx, nullptr);
|
||||
FTGL_Draw(center_strings[i], (draw::width - sx) / 2, y, fonts::font_main, center_strings_colors[i]);
|
||||
y += fonts::font_main->height + 1;
|
||||
}
|
||||
}
|
||||
|
||||
@ -65,8 +65,8 @@ float draw::fov = 90.0f;
|
||||
|
||||
namespace fonts {
|
||||
|
||||
ftgl::texture_font_t* ftgl_ESP = nullptr;
|
||||
CatVar esp_ftgl_font(CV_STRING, "font_ftgl_esp", "opensans-bold", "FTGL Font");
|
||||
ftgl::texture_font_t* font_main = nullptr;
|
||||
CatVar font_ftgl(CV_STRING, "font_ftgl", "tf2build", "FTGL Font");
|
||||
|
||||
}
|
||||
|
||||
@ -77,8 +77,8 @@ void draw::Initialize() {
|
||||
|
||||
FTGL_PreInit();
|
||||
|
||||
fonts::esp_ftgl_font.InstallChangeCallback([](IConVar* var, const char* pOldValue, float flOldValue) {
|
||||
FTGL_ChangeFont(&fonts::ftgl_ESP, fonts::esp_ftgl_font.GetString());
|
||||
fonts::font_ftgl.InstallChangeCallback([](IConVar* var, const char* pOldValue, float flOldValue) {
|
||||
FTGL_ChangeFont(&fonts::font_main, fonts::font_ftgl.GetString());
|
||||
(void)flOldValue;
|
||||
});
|
||||
}
|
||||
|
@ -22,7 +22,7 @@ class CatEnum;
|
||||
|
||||
namespace fonts {
|
||||
|
||||
extern ftgl::texture_font_t* ftgl_ESP;
|
||||
extern ftgl::texture_font_t* font_main;
|
||||
|
||||
}
|
||||
|
||||
|
@ -20,6 +20,7 @@ void BeginCheatVisuals() {
|
||||
std::mutex drawing_mutex;
|
||||
|
||||
CatVar info_text(CV_SWITCH, "info", "1", "Show info", "Show cathook version in top left corner");
|
||||
CatVar info_text_min(CV_SWITCH, "info_min", "0", "Show minimal info", "Only show cathook title in top left corner");
|
||||
|
||||
void DrawCheatVisuals() {
|
||||
std::lock_guard<std::mutex> draw_lock(drawing_mutex);
|
||||
@ -33,24 +34,26 @@ void DrawCheatVisuals() {
|
||||
std::string name_s, reason_s;
|
||||
PROF_SECTION(PT_info_text);
|
||||
AddSideString("cathook by nullifiedcat", colors::RainbowCurrent());
|
||||
AddSideString(hack::GetVersion(), GUIColor()); // github commit and date
|
||||
AddSideString(hack::GetType(), GUIColor()); // Compile type
|
||||
if (!info_text_min) {
|
||||
AddSideString(hack::GetVersion(), GUIColor()); // github commit and date
|
||||
AddSideString(hack::GetType(), GUIColor()); // Compile type
|
||||
#if ENABLE_GUI
|
||||
AddSideString("Press 'INSERT' or 'F11' key to open/close cheat menu.", GUIColor());
|
||||
AddSideString("Use mouse to navigate in menu.", GUIColor());
|
||||
AddSideString("Press 'INSERT' or 'F11' key to open/close cheat menu.", GUIColor());
|
||||
AddSideString("Use mouse to navigate in menu.", GUIColor());
|
||||
#endif
|
||||
if (!g_IEngine->IsInGame()
|
||||
if (!g_IEngine->IsInGame()
|
||||
#if ENABLE_GUI
|
||||
|| g_pGUI->Visible()
|
||||
|| g_pGUI->Visible()
|
||||
#endif
|
||||
) {
|
||||
name_s = force_name.GetString();
|
||||
if (name_s.length() < 3) name_s = "*Not Set*";
|
||||
reason_s = disconnect_reason.GetString();
|
||||
if (reason_s.length() < 3) reason_s = "*Not Set*";
|
||||
AddSideString(""); // foolish
|
||||
AddSideString(format("Custom Name: ", name_s), GUIColor());
|
||||
AddSideString(format("Custom Disconnect Reason: ", reason_s), GUIColor());
|
||||
) {
|
||||
name_s = force_name.GetString();
|
||||
if (name_s.length() < 3) name_s = "*Not Set*";
|
||||
reason_s = disconnect_reason.GetString();
|
||||
if (reason_s.length() < 3) reason_s = "*Not Set*";
|
||||
AddSideString(""); // foolish
|
||||
AddSideString(format("Custom Name: ", name_s), GUIColor());
|
||||
AddSideString(format("Custom Disconnect Reason: ", reason_s), GUIColor());
|
||||
}
|
||||
}
|
||||
}
|
||||
if (CE_GOOD(g_pLocalPlayer->entity) && !g_Settings.bInvalid) {
|
||||
@ -83,7 +86,7 @@ void DrawCheatVisuals() {
|
||||
PROF_SECTION(PT_spyalert);
|
||||
SAFE_CALL(hacks::tf::spyalert::Draw());
|
||||
}
|
||||
#ifdef IPC_ENABLED
|
||||
#if ENABLE_IPC == 1
|
||||
IF_GAME(IsTF()) SAFE_CALL(hacks::shared::followbot::Draw());
|
||||
#endif
|
||||
{
|
||||
|
@ -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, DATA_PATH "/fonts/opensans-bold.ttf");
|
||||
fonts::font_main = ftgl::texture_font_new_from_file(atlas, 14, DATA_PATH "/fonts/tf2build.ttf");
|
||||
logging::Info("Pre-Init done %d %d", draw::width, draw::height);
|
||||
}
|
||||
|
||||
|
@ -34,7 +34,7 @@ ListEntry_Dummy* FromJson(nlohmann::json json) {
|
||||
}
|
||||
return cv;
|
||||
} else if (json.is_object()) {
|
||||
#ifndef IPC_ENABLED
|
||||
#ifndef ENABLE_IPC
|
||||
if (json.find("data") != json.end()) {
|
||||
if (json["data"] == "ipc") {
|
||||
return nullptr;
|
||||
|
@ -76,7 +76,7 @@ const std::string& hack::GetType() {
|
||||
static bool version_set = false;
|
||||
if (version_set) return version;
|
||||
version = "";
|
||||
#if not defined(IPC_ENABLED)
|
||||
#if not defined(ENABLE_IPC)
|
||||
version += " NOIPC";
|
||||
#endif
|
||||
#if not ENABLE_GUI
|
||||
|
@ -393,7 +393,7 @@ int HealingPriority(int idx) {
|
||||
priority += 50 * (1 - healthp);
|
||||
priority += 10 * (1 - overhealp);
|
||||
}
|
||||
#ifdef IPC_ENABLED
|
||||
#if ENABLE_IPC == 1
|
||||
if (ipc::peer) {
|
||||
if (hacks::shared::followbot::bot && hacks::shared::followbot::following_idx == idx) {
|
||||
priority *= 3.0f;
|
||||
|
@ -500,13 +500,13 @@ void _FASTCALL ProcessEntityPT(CachedEntity* ent) {
|
||||
draw_point = Vector(max_x + 2, min_y, 0);
|
||||
} break;
|
||||
case 1: { // BOTTOM RIGHT
|
||||
draw_point = Vector(max_x + 2, max_y - data.at(ent->m_IDX).string_count * ((int)fonts::ftgl_ESP->height), 0);
|
||||
draw_point = Vector(max_x + 2, max_y - data.at(ent->m_IDX).string_count * ((int)fonts::font_main->height), 0);
|
||||
} break;
|
||||
case 2: { // CENTER
|
||||
origin_is_zero = true; // origin is still zero so we set to true
|
||||
} break;
|
||||
case 3: { // ABOVE
|
||||
draw_point = Vector(min_x, min_y - data.at(ent->m_IDX).string_count * ((int)fonts::ftgl_ESP->height), 0);
|
||||
draw_point = Vector(min_x, min_y - data.at(ent->m_IDX).string_count * ((int)fonts::font_main->height), 0);
|
||||
} break;
|
||||
case 4: { // BELOW
|
||||
draw_point = Vector(min_x, max_y, 0);
|
||||
@ -530,15 +530,15 @@ void _FASTCALL ProcessEntityPT(CachedEntity* ent) {
|
||||
|
||||
// If the origin is centered, we use one method. if not, the other
|
||||
if (!origin_is_zero) {
|
||||
FTGL_Draw(string.data, draw_point.x, draw_point.y, fonts::ftgl_ESP, color);
|
||||
FTGL_Draw(string.data, draw_point.x, draw_point.y, fonts::font_main, color);
|
||||
} else {
|
||||
int size_x;
|
||||
FTGL_StringLength(string.data, fonts::ftgl_ESP, &size_x);
|
||||
FTGL_Draw(string.data, draw_point.x - size_x / 2, draw_point.y, fonts::ftgl_ESP, color);
|
||||
FTGL_StringLength(string.data, fonts::font_main, &size_x);
|
||||
FTGL_Draw(string.data, draw_point.x - size_x / 2, draw_point.y, fonts::font_main, color);
|
||||
}
|
||||
|
||||
// Add to the y due to their being text in that spot
|
||||
draw_point.y += (int)fonts::ftgl_ESP->height - 1;
|
||||
draw_point.y += (int)fonts::font_main->height - 1;
|
||||
}
|
||||
}
|
||||
|
||||
@ -791,7 +791,7 @@ void _FASTCALL ProcessEntity(CachedEntity* ent) {
|
||||
AddEntityString(ent, classes[pclass - 1]);
|
||||
}
|
||||
|
||||
#ifdef IPC_ENABLED
|
||||
#if ENABLE_IPC == 1
|
||||
// ipc bot esp
|
||||
if (show_bot_id && ipc::peer && ent != LOCAL_E) {
|
||||
for (unsigned i = 0; i < cat_ipc::max_peers; i++) {
|
||||
|
@ -9,7 +9,7 @@
|
||||
|
||||
#include "../common.h"
|
||||
|
||||
#ifdef IPC_ENABLED
|
||||
#if ENABLE_IPC == 1
|
||||
|
||||
namespace hacks { namespace shared { namespace followbot {
|
||||
|
||||
|
@ -5,7 +5,7 @@
|
||||
* Author: nullifiedcat
|
||||
*/
|
||||
|
||||
#ifdef IPC_ENABLED
|
||||
#if ENABLE_IPC == 1
|
||||
|
||||
#ifndef HACKS_FOLLOWBOT_H_
|
||||
#define HACKS_FOLLOWBOT_H_
|
||||
@ -13,6 +13,7 @@
|
||||
class CatCommand;
|
||||
class CatVar;
|
||||
class CachedEntity;
|
||||
class Vector;
|
||||
|
||||
#include "../ipc.h"
|
||||
|
||||
|
@ -835,8 +835,8 @@ void DrawConnection(index_t a, connection_s& b) {
|
||||
if (b.flags & CF_LOW_AMMO) flags += "A";
|
||||
if (b.flags & CF_LOW_HEALTH) flags += "H";
|
||||
int size_x = 0, size_y = 0;
|
||||
FTGL_StringLength(flags, fonts::ftgl_ESP, &size_x, &size_y);
|
||||
FTGL_Draw(flags, wts_cc.x - size_x / 2, wts_cc.y - size_y - 4, fonts::ftgl_ESP);
|
||||
FTGL_StringLength(flags, fonts::font_main, &size_x, &size_y);
|
||||
FTGL_Draw(flags, wts_cc.x - size_x / 2, wts_cc.y - size_y - 4, fonts::font_main);
|
||||
}
|
||||
}
|
||||
|
||||
@ -880,7 +880,7 @@ void DrawNode(index_t node, bool draw_back) {
|
||||
if (not draw::WorldToScreen(n.xyz(), wts))
|
||||
return;
|
||||
|
||||
FTGL_Draw(std::to_string(node), wts.x, wts.y, fonts::ftgl_ESP, *color);
|
||||
FTGL_Draw(std::to_string(node), wts.x, wts.y, fonts::font_main, *color);
|
||||
}
|
||||
}
|
||||
|
||||
@ -935,7 +935,7 @@ void OnLevelInit() {
|
||||
|
||||
static CatVar wb_abandon_too_many_bots(CV_INT, "wb_population_control", "0", "Abandon if bots >");
|
||||
void CheckLivingSpace() {
|
||||
#if IPC_ENABLED
|
||||
#if ENABLE_IPC
|
||||
if (ipc::peer && wb_abandon_too_many_bots) {
|
||||
std::vector<unsigned> players {};
|
||||
for (int j = 1; j < 32; j++) {
|
||||
|
@ -148,7 +148,7 @@ 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
|
||||
#if ENABLE_IPC
|
||||
ipc::UpdateServerAddress();
|
||||
#endif
|
||||
}
|
||||
@ -210,7 +210,7 @@ bool CreateMove_hook(void* thisptr, float inputSample, CUserCmd* cmd) {
|
||||
|
||||
hacks::shared::autojoin::Update();
|
||||
|
||||
#ifdef IPC_ENABLED
|
||||
#if ENABLE_IPC == 1
|
||||
static int team_joining_state = 0;
|
||||
static float last_jointeam_try = 0;
|
||||
CachedEntity *found_entity, *ent;
|
||||
@ -358,7 +358,7 @@ bool CreateMove_hook(void* thisptr, float inputSample, CUserCmd* cmd) {
|
||||
|
||||
// TODO Auto Steam Friend
|
||||
|
||||
#if IPC_ENABLED
|
||||
#if ENABLE_IPC
|
||||
{
|
||||
PROF_SECTION(CM_playerlist);
|
||||
static Timer ipc_update_timer {};
|
||||
@ -412,7 +412,7 @@ bool CreateMove_hook(void* thisptr, float inputSample, CUserCmd* cmd) {
|
||||
|
||||
ret = false;
|
||||
}
|
||||
#ifdef IPC_ENABLED
|
||||
#if ENABLE_IPC == 1
|
||||
if (CE_GOOD(g_pLocalPlayer->entity) && !g_pLocalPlayer->life_state) {
|
||||
PROF_SECTION(CM_followbot);
|
||||
SAFE_CALL(hacks::shared::followbot::AfterCreateMove());
|
||||
|
@ -39,7 +39,7 @@ void DrawModelExecute_hook(IVModelRender* _this, const DrawModelState_t& state,
|
||||
static IClientUnknown *unk;
|
||||
static IClientEntity *ent;
|
||||
|
||||
if (!cathook || !(no_arms || no_hats || (clean_screenshots && g_IEngine->IsTakingScreenshot()))) {
|
||||
if (!cathook || !(spectator_target || no_arms || no_hats || (clean_screenshots && g_IEngine->IsTakingScreenshot()))) {
|
||||
original(_this, state, info, matrix);
|
||||
return;
|
||||
}
|
||||
@ -63,6 +63,11 @@ void DrawModelExecute_hook(IVModelRender* _this, const DrawModelState_t& state,
|
||||
unk = info.pRenderable->GetIClientUnknown();
|
||||
if (unk) {
|
||||
ent = unk->GetIClientEntity();
|
||||
if (ent) {
|
||||
if (ent->entindex() == spectator_target) {
|
||||
return;
|
||||
}
|
||||
}
|
||||
if (ent && !effect_chams::g_EffectChams.drawing && effect_chams::g_EffectChams.ShouldRenderChams(ent)) {
|
||||
return;
|
||||
}
|
||||
@ -87,6 +92,21 @@ int IN_KeyEvent_hook(void* _this, int eventcode, int keynum, const char* pszCurr
|
||||
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");
|
||||
|
||||
CatVar freecam(CV_KEY, "debug_freecam", "0", "Freecam");
|
||||
int spectator_target { 0 };
|
||||
|
||||
CatCommand spectate("debug_spectate", "Spectate", [](const CCommand& args) {
|
||||
if (args.ArgC() < 1) {
|
||||
spectator_target = 0;
|
||||
return;
|
||||
}
|
||||
int id = atoi(args.Arg(1));
|
||||
if (!id) spectator_target = 0;
|
||||
else {
|
||||
spectator_target = g_IEngine->GetPlayerForUserID(id);
|
||||
}
|
||||
});
|
||||
|
||||
void OverrideView_hook(void* _this, CViewSetup* setup) {
|
||||
static const OverrideView_t original = (OverrideView_t)hooks::clientmode.GetMethod(offsets::OverrideView());
|
||||
static bool zoomed;
|
||||
@ -100,6 +120,45 @@ void OverrideView_hook(void* _this, CViewSetup* setup) {
|
||||
setup->fov = override_fov;
|
||||
}
|
||||
}
|
||||
|
||||
if (spectator_target) {
|
||||
CachedEntity* spec = ENTITY(spectator_target);
|
||||
if (CE_GOOD(spec) && !CE_BYTE(spec, netvar.iLifeState)) {
|
||||
setup->origin = spec->m_vecOrigin + CE_VECTOR(spec, netvar.vViewOffset);
|
||||
// why not spectate yourself
|
||||
if (spec == LOCAL_E) {
|
||||
setup->angles = CE_VAR(spec, netvar.m_angEyeAnglesLocal, QAngle);
|
||||
} else {
|
||||
setup->angles = CE_VAR(spec, netvar.m_angEyeAngles, QAngle);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (freecam) {
|
||||
static Vector freecam_origin { 0 };
|
||||
static bool freecam_last { false };
|
||||
if (freecam.KeyDown()) {
|
||||
if (not freecam_last) {
|
||||
freecam_origin = setup->origin;
|
||||
}
|
||||
float sp, sy, cp, cy;
|
||||
QAngle angle;
|
||||
Vector forward;
|
||||
g_IEngine->GetViewAngles(angle);
|
||||
sy = sinf(DEG2RAD(angle[1]));
|
||||
cy = cosf(DEG2RAD(angle[1]));
|
||||
sp = sinf(DEG2RAD(angle[0]));
|
||||
cp = cosf(DEG2RAD(angle[0]));
|
||||
forward.x = cp * cy;
|
||||
forward.y = cp * sy;
|
||||
forward.z = -sp;
|
||||
forward *= 4;
|
||||
freecam_origin += forward;
|
||||
setup->origin = freecam_origin;
|
||||
}
|
||||
freecam_last = freecam.KeyDown();
|
||||
}
|
||||
|
||||
draw::fov = setup->fov;
|
||||
SEGV_END;
|
||||
}
|
||||
@ -241,7 +300,7 @@ void Shutdown_hook(void* _this, const char* reason) {
|
||||
} else if (strstr(reason, "VAC")) {
|
||||
logging::Info("VAC error?");
|
||||
}
|
||||
#if IPC_ENABLED
|
||||
#if ENABLE_IPC
|
||||
ipc::UpdateServerAddress(true);
|
||||
#endif
|
||||
SEGV_BEGIN;
|
||||
@ -328,7 +387,7 @@ 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 ENABLE_IPC
|
||||
if (ipc::peer) {
|
||||
static std::string namestr(ipc_name.GetString());
|
||||
namestr.assign(ipc_name.GetString());
|
||||
@ -417,7 +476,7 @@ void FrameStageNotify_hook(void* _this, int stage) {
|
||||
}
|
||||
}
|
||||
if (stage == FRAME_START) {
|
||||
#if IPC_ENABLED
|
||||
#if ENABLE_IPC
|
||||
static Timer nametimer {};
|
||||
if (nametimer.test_and_set(1000 * 10)) {
|
||||
if (ipc::peer) {
|
||||
@ -427,6 +486,9 @@ void FrameStageNotify_hook(void* _this, int stage) {
|
||||
static Timer ipc_timer {};
|
||||
if (ipc_timer.test_and_set(1000)) {
|
||||
if (ipc::peer) {
|
||||
if (ipc::peer->HasCommands()) {
|
||||
ipc::peer->ProcessCommands();
|
||||
}
|
||||
ipc::Heartbeat();
|
||||
ipc::UpdateTemporaryData();
|
||||
}
|
||||
@ -537,7 +599,7 @@ void LevelInit_hook(void* _this, const char* newmap) {
|
||||
hacks::shared::anticheat::ResetEverything();
|
||||
original(_this, newmap);
|
||||
hacks::shared::walkbot::OnLevelInit();
|
||||
#if IPC_ENABLED
|
||||
#if ENABLE_IPC
|
||||
if (ipc::peer) {
|
||||
ipc::peer->memory->peer_user_data[ipc::peer->client_id].ts_connected = time(nullptr);
|
||||
}
|
||||
@ -553,7 +615,7 @@ void LevelShutdown_hook(void* _this) {
|
||||
chat_stack::Reset();
|
||||
hacks::shared::anticheat::ResetEverything();
|
||||
original(_this);
|
||||
#if IPC_ENABLED
|
||||
#if ENABLE_IPC
|
||||
if (ipc::peer) {
|
||||
ipc::peer->memory->peer_user_data[ipc::peer->client_id].ts_disconnected = time(nullptr);
|
||||
}
|
||||
|
@ -15,6 +15,7 @@ class SDL_Window;
|
||||
class CatVar;
|
||||
|
||||
extern CatVar disconnect_reason;
|
||||
extern int spectator_target;
|
||||
|
||||
bool CanPacket_hook(void*);
|
||||
int IN_KeyEvent_hook(void*, int, int, const char*);
|
||||
|
23
src/ipc.cpp
23
src/ipc.cpp
@ -12,23 +12,10 @@
|
||||
#include "hack.h"
|
||||
#include "hitrate.hpp"
|
||||
|
||||
#ifdef IPC_ENABLED
|
||||
#if ENABLE_IPC == 1
|
||||
|
||||
namespace ipc {
|
||||
|
||||
std::atomic<bool> thread_running(false);
|
||||
pthread_t listener_thread { 0 };
|
||||
|
||||
void* listen(void*) {
|
||||
while (thread_running) {
|
||||
if (peer->HasCommands()) {
|
||||
peer->ProcessCommands();
|
||||
}
|
||||
usleep(10000);
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
CatCommand fix_deadlock("ipc_fix_deadlock", "Fix deadlock", []() {
|
||||
if (peer) {
|
||||
pthread_mutex_unlock(&peer->memory->mutex);
|
||||
@ -36,7 +23,7 @@ CatCommand fix_deadlock("ipc_fix_deadlock", "Fix deadlock", []() {
|
||||
});
|
||||
|
||||
CatCommand connect("ipc_connect", "Connect to IPC server", []() {
|
||||
if (peer || thread_running) {
|
||||
if (peer) {
|
||||
logging::Info("Already connected!");
|
||||
return;
|
||||
}
|
||||
@ -60,8 +47,6 @@ CatCommand connect("ipc_connect", "Connect to IPC server", []() {
|
||||
data.total_score = o_total_score;
|
||||
StoreClientData();
|
||||
Heartbeat();
|
||||
thread_running = true;
|
||||
pthread_create(&listener_thread, nullptr, listen, nullptr);
|
||||
} catch (std::exception& error) {
|
||||
logging::Info("Runtime error: %s", error.what());
|
||||
delete peer;
|
||||
@ -83,10 +68,7 @@ CatCommand lobby("ipc_lobby", "Join a lobby", [](const CCommand& args) {
|
||||
peer->SendMessage(format("connect_lobby ", lobby64).c_str(), 0, ipc::commands::execute_client_cmd, 0, 0);
|
||||
});
|
||||
CatCommand disconnect("ipc_disconnect", "Disconnect from IPC server", []() {
|
||||
thread_running = false;
|
||||
pthread_join(listener_thread, nullptr);
|
||||
if (peer) delete peer;
|
||||
listener_thread = 0;
|
||||
peer = nullptr;
|
||||
});
|
||||
CatCommand exec("ipc_exec", "Execute command (first argument = bot ID)", [](const CCommand& args) {
|
||||
@ -163,7 +145,6 @@ void UpdateServerAddress(bool shutdown) {
|
||||
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));
|
||||
|
@ -5,7 +5,7 @@
|
||||
* Author: nullifiedcat
|
||||
*/
|
||||
|
||||
#ifdef IPC_ENABLED
|
||||
#if ENABLE_IPC == 1
|
||||
|
||||
#ifndef IPC_H_
|
||||
#define IPC_H_
|
||||
@ -39,7 +39,6 @@ extern CatCommand exec_all;
|
||||
extern CatCommand lobby;
|
||||
extern CatVar server_name;
|
||||
|
||||
extern pthread_t listener_thread;
|
||||
constexpr unsigned cathook_magic_number = 0x0DEADCA7;
|
||||
|
||||
struct server_data_s {
|
||||
|
Reference in New Issue
Block a user