From 12066e377cda619908b7085693d91cbecf411b67 Mon Sep 17 00:00:00 2001 From: nullifiedcat Date: Sat, 16 Dec 2017 15:16:37 +0300 Subject: [PATCH] small update --- include/common.hpp | 1 + scripts/catlibs | 4 ++-- src/hack.cpp | 9 ++++++++- src/hacks/Aimbot.cpp | 23 +++++++++++++++-------- src/hacks/AntiAim.cpp | 17 ++++++++++++++--- src/hooks/others.cpp | 4 ++-- src/hooks/sdl.cpp | 1 - 7 files changed, 42 insertions(+), 17 deletions(-) diff --git a/include/common.hpp b/include/common.hpp index 21a3efde..d29b9aa5 100644 --- a/include/common.hpp +++ b/include/common.hpp @@ -45,6 +45,7 @@ #include #include #include +#include #include #include "timer.hpp" diff --git a/scripts/catlibs b/scripts/catlibs index 30459f9b..87752f78 100755 --- a/scripts/catlibs +++ b/scripts/catlibs @@ -13,7 +13,7 @@ if ! command -v gksu; then fi pushd ../libxoverlay -if ! make -e ARCH=32 >/tmp/buildxoverlay.log; then +if ! make -e ARCH=32 >/tmp/buildxoverlay.log 2>&1; then $DIALOG --title "Build failed" --msgbox "Failed to build libxoverlay. See /tmp/buildxoverlay.log for more info." 9 78 exit fi @@ -21,7 +21,7 @@ $SU make install popd pushd ../libglez -if ! make -e ARCH=32 >/tmp/buildglez.log; then +if ! make -e ARCH=32 >/tmp/buildglez.log 2>&1; then $DIALOG --title "Build failed" --msgbox "Failed to build libglez. See /tmp/buildglez.log for more info." 9 78 exit fi diff --git a/src/hack.cpp b/src/hack.cpp index 548b057a..eb2782d2 100644 --- a/src/hack.cpp +++ b/src/hack.cpp @@ -155,7 +155,14 @@ void hack::Initialize() { signal(SIGPIPE, SIG_IGN); time_injected = time(nullptr); -// Essential files must always exist, except when the game is running in text + passwd *pwd = getpwuid(getuid()); + char *logname = strfmt("/tmp/cathook-game-stdout-%s-%u.log", pwd->pw_name, time_injected); + freopen(logname, "w", stdout); + free(logname); + logname = strfmt("/tmp/cathook-game-stderr-%s-%u.log", pwd->pw_name, time_injected); + freopen(logname, "w", stderr); + free(logname); + // Essential files must always exist, except when the game is running in text // mode. #if ENABLE_VISUALS == 1 diff --git a/src/hacks/Aimbot.cpp b/src/hacks/Aimbot.cpp index 68942a60..e9f7a75f 100644 --- a/src/hacks/Aimbot.cpp +++ b/src/hacks/Aimbot.cpp @@ -186,9 +186,9 @@ void CreateMove() projectile_mode = (GetProjectileData(g_pLocalPlayer->weapon(), cur_proj_speed, cur_proj_grav)); if (proj_speed) - cur_proj_speed = (float) proj_speed; + cur_proj_speed = float(proj_speed); if (proj_gravity) - cur_proj_grav = (float) proj_gravity; + cur_proj_grav = float(proj_gravity); // We do this as we need to pass whether the aimkey allows aiming to both // the find target and aiming system. If we just call the func than toggle @@ -196,8 +196,8 @@ void CreateMove() bool aimkey_status = UpdateAimkey(); // Refresh our best target - CachedEntity *target = RetrieveBestTarget(aimkey_status); - if (CE_BAD(target) || !foundTarget) + CachedEntity *target_entity = RetrieveBestTarget(aimkey_status); + if (CE_BAD(target_entity) || !foundTarget) return; // Auto-zoom @@ -216,7 +216,7 @@ void CreateMove() } #if ENABLE_VISUALS == 1 - hacks::shared::esp::SetEntityColor(target, colors::pink); + hacks::shared::esp::SetEntityColor(target_entity, colors::pink); #endif // Local player check + Aimkey @@ -245,7 +245,7 @@ void CreateMove() currently_charging_huntsman) { currently_charging_huntsman = false; - Aim(target); + Aim(target_entity); } else return; @@ -254,10 +254,10 @@ void CreateMove() } else if (CanShoot() && (g_pUserCmd->buttons & IN_ATTACK) && CE_INT(g_pLocalPlayer->weapon(), netvar.m_iClip1) != 0) - Aim(target); + Aim(target_entity); } else - Aim(target); + Aim(target_entity); return; } @@ -416,6 +416,8 @@ CachedEntity *RetrieveBestTarget(bool aimkey_state) case 3: // Health Priority scr = 450.0f - ent->m_iHealth; break; + default: + break; } } // Compare the top score to our current ents score @@ -962,6 +964,8 @@ int BestHitbox(CachedEntity *target) return (int) hitbox; } break; + default: + break; } // Hitbox machine :b:roke return -1; @@ -1098,6 +1102,9 @@ bool UpdateAimkey() aimkey_flip = !aimkey_flip; if (!aimkey_flip) allow_aimkey = false; + break; + default: + break; } pressed_last_tick = key_down; } diff --git a/src/hacks/AntiAim.cpp b/src/hacks/AntiAim.cpp index 723937b4..14f10828 100644 --- a/src/hacks/AntiAim.cpp +++ b/src/hacks/AntiAim.cpp @@ -66,6 +66,8 @@ float GetAAAAPitch() return aaaa_stage ? -271 : -89; case 1: return aaaa_stage ? 271 : 89; + default: + break; } return 0; } @@ -174,6 +176,8 @@ void FuckPitch(float &io_pitch) { case k_EFuckMode::FM_RANDOMVARS: io_pitch = RandFloatRange(min_pitch, max_pitch); + default: + break; } if (io_pitch < min_pitch) @@ -195,6 +199,8 @@ void FuckYaw(float &io_yaw) { case k_EFuckMode::FM_RANDOMVARS: io_yaw = RandFloatRange(min_yaw, max_yaw); + default: + break; } if (io_yaw < min_yaw) @@ -246,6 +252,9 @@ bool ShouldAA(CUserCmd *cmd) SetSafeSpace(8); return false; } + break; + default: + break; } if (safe_space) { @@ -414,12 +423,14 @@ void ProcessUserCmd(CUserCmd *cmd) case 8: FuckYaw(y); clamp = false; + default: + break; } - switch ((int) pitch_mode) + switch (int(pitch_mode)) { case 1: - p = (float) pitch; + p = float(pitch); break; case 2: if (flip) @@ -463,7 +474,7 @@ void ProcessUserCmd(CUserCmd *cmd) if (clamp) fClampAngle(cmd->viewangles); if (roll) - cmd->viewangles.z = (float) roll; + cmd->viewangles.z = float(roll); if (aaaa_enabled) { UpdateAAAAKey(); diff --git a/src/hooks/others.cpp b/src/hooks/others.cpp index d065861e..0ede3c58 100644 --- a/src/hooks/others.cpp +++ b/src/hooks/others.cpp @@ -240,7 +240,7 @@ CUserCmd *GetUserCmd_hook(IInput *_this, int sequence_number) // command_number_mod[def->command_number]); oldcmd = def->command_number; def->command_number = command_number_mod[def->command_number]; - def->random_seed = MD5_PseudoRandom(def->command_number) & 0x7fffffff; + def->random_seed = MD5_PseudoRandom(unsigned(def->command_number)) & 0x7fffffff; command_number_mod.erase(command_number_mod.find(oldcmd)); *(int *) ((unsigned) g_IBaseClientState + offsets::lastoutgoingcommand()) = def->command_number - 1; @@ -811,7 +811,7 @@ void LevelInit_hook(void *_this, const char *newmap) void LevelShutdown_hook(void *_this) { static const LevelShutdown_t original = - (LevelShutdown_t) hooks::clientmode.GetMethod(offsets::LevelShutdown()); + LevelShutdown_t(hooks::clientmode.GetMethod(offsets::LevelShutdown())); need_name_change = true; playerlist::Save(); g_Settings.bInvalid = true; diff --git a/src/hooks/sdl.cpp b/src/hooks/sdl.cpp index 92f3e76d..0afa74d5 100644 --- a/src/hooks/sdl.cpp +++ b/src/hooks/sdl.cpp @@ -59,7 +59,6 @@ void SDL_GL_SwapWindow_hook(SDL_Window *window) static bool init{ false }; - static GLXContext tf2 = glXGetCurrentContext(); static SDL_GLContext tf2_sdl = SDL_GL_GetCurrentContext(); if (cathook && !disable_visuals)