working on moving code to new files

This commit is contained in:
Jenny White 2018-04-29 09:29:42 +03:00
parent 22c8a56cfb
commit 1c253f12af
12 changed files with 153 additions and 147 deletions

View File

@ -14,6 +14,7 @@ extern CatVar no_zoom;
extern CatVar clean_screenshots;
extern CatVar disable_visuals;
extern CatVar disconnect_reason;
#if ENABLE_VISUALS
extern int spectator_target;
#endif

View File

@ -3,13 +3,35 @@
Copyright (c) 2018 nullworks. All rights reserved.
*/
#include <chatlog.hpp>
#include <ucccccp.hpp>
#include <boost/algorithm/string.hpp>
#include "HookedMethods.hpp"
static bool retrun = false;
static Timer sendmsg{};
static Timer gitgud{};
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");
static CatVar chat_filter(CV_STRING, "chat_censor", "", "Censor words",
"Spam Chat with newlines if the chosen words are "
"said, seperate with commas");
static CatVar chat_filter_enabled(CV_SWITCH, "chat_censor_enabled", "0",
"Enable censor", "Censor Words in chat");
static CatVar crypt_chat(
CV_SWITCH, "chat_crypto", "1", "Crypto chat",
"Start message with !! and it will be only visible to cathook users");
std::string clear = "";
std::string lastfilter{};
std::string lastname{};
namespace hooked_methods
{
DEFINE_HOOKED_METHOD(DispatchUserMessage, bool, void *this_, int type,
bf_read &buffer)
bf_read &buf)
{
if (retrun && gitgud.test_and_set(10000))
{
@ -20,9 +42,6 @@ DEFINE_HOOKED_METHOD(DispatchUserMessage, bool, void *this_, int type,
int loop_index, s, i, j;
char *data, c;
static const DispatchUserMessage_t original =
(DispatchUserMessage_t) hooks::client.GetMethod(
offsets::DispatchUserMessage());
if (type == 4)
{
loop_index = 0;
@ -250,6 +269,6 @@ DEFINE_HOOKED_METHOD(DispatchUserMessage, bool, void *this_, int type,
buf.Seek(0);
}
votelogger::user_message(buf, type);
return original::DispatchUserMessage(this_, type, buffer);
return original::DispatchUserMessage(this_, type, buf);
}
}

View File

@ -5,6 +5,77 @@
#include "HookedMethods.hpp"
const char *skynum[] = { "sky_tf2_04",
"sky_upward",
"sky_dustbowl_01",
"sky_goldrush_01",
"sky_granary_01",
"sky_well_01",
"sky_gravel_01",
"sky_badlands_01",
"sky_hydro_01",
"sky_night_01",
"sky_nightfall_01",
"sky_trainyard_01",
"sky_stormfront_01",
"sky_morningsnow_01",
"sky_alpinestorm_01",
"sky_harvest_01",
"sky_harvest_night_01",
"sky_halloween",
"sky_halloween_night_01",
"sky_halloween_night2014_01",
"sky_island_01",
"sky_jungle_01",
"sky_invasion2fort_01",
"sky_well_02",
"sky_outpost_01",
"sky_coastal_01",
"sky_rainbow_01",
"sky_badlands_pyroland_01",
"sky_pyroland_01",
"sky_pyroland_02",
"sky_pyroland_03" };
CatEnum skys({ "sky_tf2_04",
"sky_upward",
"sky_dustbowl_01",
"sky_goldrush_01",
"sky_granary_01",
"sky_well_01",
"sky_gravel_01",
"sky_badlands_01",
"sky_hydro_01",
"sky_night_01",
"sky_nightfall_01",
"sky_trainyard_01",
"sky_stormfront_01",
"sky_morningsnow_01",
"sky_alpinestorm_01",
"sky_harvest_01",
"sky_harvest_night_01",
"sky_halloween",
"sky_halloween_night_01",
"sky_halloween_night2014_01",
"sky_island_01",
"sky_jungle_01",
"sky_invasion2fort_01",
"sky_well_02",
"sky_outpost_01",
"sky_coastal_01",
"sky_rainbow_01",
"sky_badlands_pyroland_01",
"sky_pyroland_01",
"sky_pyroland_02",
"sky_pyroland_03" });
static CatVar
skybox_changer(skys, "skybox_changer", "0", "Change Skybox to this skybox",
"Change Skybox to this skybox, only changes on map load");
static CatVar halloween_mode(CV_SWITCH, "halloween_mode", "0",
"Forced Halloween mode",
"forced tf_forced_holiday 2");
namespace hooked_methods
{

View File

@ -9,6 +9,9 @@
#include "hitrate.hpp"
#include "hack.hpp"
static CatVar cursor_fix_experimental(CV_SWITCH, "experimental_cursor_fix", "1",
"Cursor fix");
namespace hooked_methods
{
@ -87,7 +90,4 @@ DEFINE_HOOKED_METHOD(Paint, void, IEngineVGui *this_, PaintMode_t mode)
return original::Paint(this_, mode);
}
}
static CatVar cursor_fix_experimental(CV_SWITCH, "experimental_cursor_fix", "1",
"Cursor fix");
}

View File

@ -11,24 +11,7 @@
#include "GUI.h"
#endif
CatVar clean_screenshots(CV_SWITCH, "clean_screenshots", "1",
"Clean screenshots",
"Don't draw visuals while taking a screenshot");
CatVar disable_visuals(CV_SWITCH, "no_visuals", "0", "Disable ALL drawing",
"Completely hides cathook");
CatVar no_zoom(CV_SWITCH, "no_zoom", "0", "Disable scope",
"Disables black scope overlay");
CatVar pure_bypass(CV_SWITCH, "pure_bypass", "0", "Pure Bypass",
"Bypass sv_pure");
void *pure_orig = nullptr;
void **pure_addr = nullptr;
CatEnum software_cursor_enum({ "KEEP", "ALWAYS", "NEVER", "MENU ON",
"MENU OFF" });
CatVar
software_cursor_mode(software_cursor_enum, "software_cursor_mode", "0",
"Software cursor",
"Try to change this and see what works best for you");
void PaintTraverse_hook(void *_this, unsigned int vp, bool fr, bool ar)
{

View File

@ -3,6 +3,7 @@
Copyright (c) 2018 nullworks. All rights reserved.
*/
#include <ucccccp.hpp>
#include "HookedMethods.hpp"
namespace hooked_methods
@ -16,10 +17,6 @@ DEFINE_HOOKED_METHOD(SendNetMsg, bool, INetChannel *this_, INetMessage &message,
std::string newlines;
NET_StringCmd stringcmd;
// This is a INetChannel hook - it SHOULDN'T be static because netchannel
// changes.
const SendNetMsg_t original =
(SendNetMsg_t) hooks::netchannel.GetMethod(offsets::SendNetMsg());
// net_StringCmd
if (msg.GetType() == 4 && (newlines_msg || crypt_chat))
{

View File

@ -15,9 +15,6 @@
#if ENABLE_VISUALS
static CatVar medal_flip(CV_SWITCH, "medal_flip", "0", "Infinite Medal Flip",
"");
// This hook isn't used yet!
/*int C_TFPlayer__DrawModel_hook(IClientEntity *_this, int flags)
{
@ -33,20 +30,10 @@ static CatVar medal_flip(CV_SWITCH, "medal_flip", "0", "Infinite Medal Flip",
*(float *) ((uintptr_t) _this + 79u) = old_invis;
}*/
static CatVar no_arms(CV_SWITCH, "no_arms", "0", "No Arms",
"Removes arms from first person");
static CatVar no_hats(CV_SWITCH, "no_hats", "0", "No Hats",
"Removes non-stock hats");
float last_say = 0.0f;
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("spectate", "Spectate", [](const CCommand &args) {
if (args.ArgC() < 1)
@ -91,20 +78,11 @@ static CatVar newlines_msg(CV_INT, "chat_newlines", "0", "Prefix newlines",
// (without having your msgs eaten by valve cooldown)");
static CatVar airstuck(CV_KEY, "airstuck", "0", "Airstuck", "");
static CatVar crypt_chat(
CV_SWITCH, "chat_crypto", "1", "Crypto chat",
"Start message with !! and it will be only visible to cathook users");
static CatVar chat_filter(CV_STRING, "chat_censor", "", "Censor words",
"Spam Chat with newlines if the chosen words are "
"said, seperate with commas");
static CatVar chat_filter_enabled(CV_SWITCH, "chat_censor_enabled", "0",
"Enable censor", "Censor Words in chat");
static CatVar server_crash_key(CV_KEY, "crash_server", "0", "Server crash key",
"hold key and wait...");
static CatVar die_if_vac(CV_SWITCH, "die_if_vac", "0", "Die if VAC banned");
static CatVar resolver(CV_SWITCH, "resolver", "0", "Resolve angles");
CatEnum namesteal_enum({ "OFF", "PASSIVE", "ACTIVE" });
CatVar namesteal(namesteal_enum, "name_stealer", "0", "Name Stealer",
@ -203,85 +181,5 @@ bool StolenName()
static CatVar ipc_name(CV_STRING, "name_ipc", "", "IPC Name");
CatVar nightmode(CV_SWITCH, "nightmode", "0", "Enable nightmode", "");
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");
std::string clear = "";
std::string lastfilter{};
std::string lastname{};
static bool retrun = false;
static Timer sendmsg{};
static Timer gitgud{};
const char *skynum[] = { "sky_tf2_04",
"sky_upward",
"sky_dustbowl_01",
"sky_goldrush_01",
"sky_granary_01",
"sky_well_01",
"sky_gravel_01",
"sky_badlands_01",
"sky_hydro_01",
"sky_night_01",
"sky_nightfall_01",
"sky_trainyard_01",
"sky_stormfront_01",
"sky_morningsnow_01",
"sky_alpinestorm_01",
"sky_harvest_01",
"sky_harvest_night_01",
"sky_halloween",
"sky_halloween_night_01",
"sky_halloween_night2014_01",
"sky_island_01",
"sky_jungle_01",
"sky_invasion2fort_01",
"sky_well_02",
"sky_outpost_01",
"sky_coastal_01",
"sky_rainbow_01",
"sky_badlands_pyroland_01",
"sky_pyroland_01",
"sky_pyroland_02",
"sky_pyroland_03" };
CatEnum skys({ "sky_tf2_04",
"sky_upward",
"sky_dustbowl_01",
"sky_goldrush_01",
"sky_granary_01",
"sky_well_01",
"sky_gravel_01",
"sky_badlands_01",
"sky_hydro_01",
"sky_night_01",
"sky_nightfall_01",
"sky_trainyard_01",
"sky_stormfront_01",
"sky_morningsnow_01",
"sky_alpinestorm_01",
"sky_harvest_01",
"sky_harvest_night_01",
"sky_halloween",
"sky_halloween_night_01",
"sky_halloween_night2014_01",
"sky_island_01",
"sky_jungle_01",
"sky_invasion2fort_01",
"sky_well_02",
"sky_outpost_01",
"sky_coastal_01",
"sky_rainbow_01",
"sky_badlands_pyroland_01",
"sky_pyroland_01",
"sky_pyroland_02",
"sky_pyroland_03" });
static CatVar
skybox_changer(skys, "skybox_changer", "0", "Change Skybox to this skybox",
"Change Skybox to this skybox, only changes on map load");
static CatVar halloween_mode(CV_SWITCH, "halloween_mode", "0",
"Forced Halloween mode",
"forced tf_forced_holiday 2");

View File

@ -3,8 +3,14 @@
Copyright (c) 2018 nullworks. All rights reserved.
*/
#include <MiscTemporary.hpp>
#include "HookedMethods.hpp"
static CatVar no_arms(CV_SWITCH, "no_arms", "0", "No Arms",
"Removes arms from first person");
static CatVar no_hats(CV_SWITCH, "no_hats", "0", "No Hats",
"Removes non-stock hats");
namespace hooked_methods
{
@ -12,9 +18,6 @@ DEFINE_HOOKED_METHOD(DrawModelExecute, void, IVModelRender *this_,
const DrawModelState_t &state,
const ModelRenderInfo_t &info, matrix3x4_t *bone)
{
static const DrawModelExecute_t original =
(DrawModelExecute_t) hooks::modelrender.GetMethod(
offsets::DrawModelExecute());
static const char *name;
static std::string sname;
static IClientUnknown *unk;
@ -24,8 +27,7 @@ DEFINE_HOOKED_METHOD(DrawModelExecute, void, IVModelRender *this_,
!(spectator_target || no_arms || no_hats ||
(clean_screenshots && g_IEngine->IsTakingScreenshot())))
{
original(_this, state, info, matrix);
return;
return original::DrawModelExecute(this_, state, info, bone);
}
PROF_SECTION(DrawModelExecute);

View File

@ -3,8 +3,12 @@
Copyright (c) 2018 nullworks. All rights reserved.
*/
#include <MiscTemporary.hpp>
#include "HookedMethods.hpp"
CatVar resolver(CV_SWITCH, "resolver", "0", "Resolve angles");
CatVar nightmode(CV_SWITCH, "nightmode", "0", "Enable nightmode", "");
namespace hooked_methods
{

View File

@ -3,8 +3,17 @@
Copyright (c) 2018 nullworks. All rights reserved.
*/
#include <MiscTemporary.hpp>
#include "HookedMethods.hpp"
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");
namespace hooked_methods
{

View File

@ -5,6 +5,25 @@
#include "HookedMethods.hpp"
CatVar clean_screenshots(CV_SWITCH, "clean_screenshots", "1",
"Clean screenshots",
"Don't draw visuals while taking a screenshot");
CatVar disable_visuals(CV_SWITCH, "no_visuals", "0", "Disable ALL drawing",
"Completely hides cathook");
CatVar no_zoom(CV_SWITCH, "no_zoom", "0", "Disable scope",
"Disables black scope overlay");
CatVar pure_bypass(CV_SWITCH, "pure_bypass", "0", "Pure Bypass",
"Bypass sv_pure");
void *pure_orig = nullptr;
void **pure_addr = nullptr;
CatEnum software_cursor_enum({ "KEEP", "ALWAYS", "NEVER", "MENU ON",
"MENU OFF" });
CatVar
software_cursor_mode(software_cursor_enum, "software_cursor_mode", "0",
"Software cursor",
"Try to change this and see what works best for you");
namespace hooked_methods
{
@ -49,7 +68,7 @@ DEFINE_HOOKED_METHOD(PaintTraverse, void, vgui::IPanel *this_,
pure_orig = (void *) 0;
}
call_default = true;
if (cathook && panel_scope && no_zoom && vp == panel_scope)
if (cathook && panel_scope && no_zoom && panel == panel_scope)
call_default = false;
if (software_cursor_mode)
@ -87,39 +106,39 @@ DEFINE_HOOKED_METHOD(PaintTraverse, void, vgui::IPanel *this_,
PROF_SECTION(PT_total);
if (vp == panel_top)
if (panel == panel_top)
draw_flag = true;
if (!cathook)
return;
if (!panel_top)
{
name = g_IPanel->GetName(vp);
name = g_IPanel->GetName(panel);
if (strlen(name) > 4)
{
if (name[0] == 'M' && name[3] == 'S')
{
panel_top = vp;
panel_top = panel;
}
}
}
if (!panel_focus)
{
name = g_IPanel->GetName(vp);
name = g_IPanel->GetName(panel);
if (strlen(name) > 5)
{
if (name[0] == 'F' && name[5] == 'O')
{
panel_focus = vp;
panel_focus = panel;
}
}
}
if (!panel_scope)
{
name = g_IPanel->GetName(vp);
name = g_IPanel->GetName(panel);
if (!strcmp(name, "HudScope"))
{
panel_scope = vp;
panel_scope = panel;
}
}
if (!g_IEngine->IsInGame())
@ -127,7 +146,7 @@ DEFINE_HOOKED_METHOD(PaintTraverse, void, vgui::IPanel *this_,
g_Settings.bInvalid = true;
}
if (vp != panel_focus)
if (panel != panel_focus)
return;
g_IPanel->SetTopmostPopup(panel_focus, true);
if (!draw_flag)

View File

@ -5,6 +5,9 @@
#include "HookedMethods.hpp"
static CatVar medal_flip(CV_SWITCH, "medal_flip", "0", "Infinite Medal Flip",
"");
namespace hooked_methods
{