Paint
This commit is contained in:
parent
9d3925c48f
commit
ec9a36c340
@ -16,6 +16,7 @@ bool should_ignore_player(CachedEntity *player);
|
|||||||
void update_ipc_data(ipc::user_data_s& data);
|
void update_ipc_data(ipc::user_data_s& data);
|
||||||
void update();
|
void update();
|
||||||
void init();
|
void init();
|
||||||
|
void level_init();
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -13,6 +13,7 @@ namespace hitrate
|
|||||||
extern int count_shots;
|
extern int count_shots;
|
||||||
extern int count_hits;
|
extern int count_hits;
|
||||||
extern int count_hits_head;
|
extern int count_hits_head;
|
||||||
|
extern CatVar hitrate_check;
|
||||||
|
|
||||||
void Update();
|
void Update();
|
||||||
|
|
||||||
|
@ -63,6 +63,7 @@ extern VMTHook baseclientstate;
|
|||||||
extern VMTHook baseclientstate8;
|
extern VMTHook baseclientstate8;
|
||||||
extern VMTHook steamfriends;
|
extern VMTHook steamfriends;
|
||||||
extern VMTHook materialsystem;
|
extern VMTHook materialsystem;
|
||||||
|
extern VMTHook enginevgui;
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif /* HOOKS_H_ */
|
#endif /* HOOKS_H_ */
|
||||||
|
@ -29,6 +29,8 @@ typedef CUserCmd *(*GetUserCmd_t)(IInput *, int);
|
|||||||
typedef const char *(*GetClientName_t)(CBaseClientState *);
|
typedef const char *(*GetClientName_t)(CBaseClientState *);
|
||||||
typedef bool (*ProcessSetConVar_t)(CBaseClientState *, NET_SetConVar *);
|
typedef bool (*ProcessSetConVar_t)(CBaseClientState *, NET_SetConVar *);
|
||||||
typedef bool (*ProcessGetCvarValue_t)(CBaseClientState *, SVC_GetCvarValue *);
|
typedef bool (*ProcessGetCvarValue_t)(CBaseClientState *, SVC_GetCvarValue *);
|
||||||
|
typedef void (*Paint_t)(IEngineVGui *, PaintMode_t);
|
||||||
|
|
||||||
const char *GetClientName_hook(CBaseClientState *_this);
|
const char *GetClientName_hook(CBaseClientState *_this);
|
||||||
bool ProcessSetConVar_hook(CBaseClientState *_this, NET_SetConVar *msg);
|
bool ProcessSetConVar_hook(CBaseClientState *_this, NET_SetConVar *msg);
|
||||||
bool ProcessGetCvarValue_hook(CBaseClientState *_this, SVC_GetCvarValue *msg);
|
bool ProcessGetCvarValue_hook(CBaseClientState *_this, SVC_GetCvarValue *msg);
|
||||||
@ -45,6 +47,9 @@ CUserCmd *GetUserCmd_hook(IInput *, int);
|
|||||||
void DrawModelExecute_hook(IVModelRender *_this, const DrawModelState_t &state,
|
void DrawModelExecute_hook(IVModelRender *_this, const DrawModelState_t &state,
|
||||||
const ModelRenderInfo_t &info, matrix3x4_t *matrix);
|
const ModelRenderInfo_t &info, matrix3x4_t *matrix);
|
||||||
|
|
||||||
|
void Paint_hook(IEngineVGui *_this, PaintMode_t mode);
|
||||||
|
|
||||||
|
|
||||||
/* SDL HOOKS */
|
/* SDL HOOKS */
|
||||||
union SDL_Event;
|
union SDL_Event;
|
||||||
class SDL_Window;
|
class SDL_Window;
|
||||||
|
@ -51,6 +51,7 @@ class CHud;
|
|||||||
class IGameEventManager;
|
class IGameEventManager;
|
||||||
class TFGCClientSystem;
|
class TFGCClientSystem;
|
||||||
class CGameRules;
|
class CGameRules;
|
||||||
|
class IEngineVGui;
|
||||||
|
|
||||||
extern TFGCClientSystem *g_TFGCClientSystem;
|
extern TFGCClientSystem *g_TFGCClientSystem;
|
||||||
extern CHud *g_CHUD;
|
extern CHud *g_CHUD;
|
||||||
@ -83,6 +84,7 @@ extern IMoveHelperServer *g_IMoveHelperServer;
|
|||||||
extern CBaseClientState *g_IBaseClientState;
|
extern CBaseClientState *g_IBaseClientState;
|
||||||
extern IGameEventManager *g_IGameEventManager;
|
extern IGameEventManager *g_IGameEventManager;
|
||||||
extern CGameRules *g_pGameRules;
|
extern CGameRules *g_pGameRules;
|
||||||
|
extern IEngineVGui *g_IEngineVGui;
|
||||||
|
|
||||||
void CreateInterfaces();
|
void CreateInterfaces();
|
||||||
|
|
||||||
|
@ -54,6 +54,7 @@
|
|||||||
#include <icommandline.h>
|
#include <icommandline.h>
|
||||||
#include <netmessage.hpp>
|
#include <netmessage.hpp>
|
||||||
#include <dbg.h>
|
#include <dbg.h>
|
||||||
|
#include <ienginevgui.h>
|
||||||
|
|
||||||
#include "sdk/in_buttons.h"
|
#include "sdk/in_buttons.h"
|
||||||
#include "sdk/imaterialsystemfixed.h"
|
#include "sdk/imaterialsystemfixed.h"
|
||||||
|
@ -280,8 +280,11 @@ g_pGUI->Setup();
|
|||||||
offsets::FireGameEvent());
|
offsets::FireGameEvent());
|
||||||
hooks::clientmode4.Apply();
|
hooks::clientmode4.Apply();
|
||||||
hooks::client.Set(g_IBaseClient);
|
hooks::client.Set(g_IBaseClient);
|
||||||
|
|
||||||
|
#if ENABLE_VISUALS == 1
|
||||||
hooks::client.HookMethod((void *) FrameStageNotify_hook,
|
hooks::client.HookMethod((void *) FrameStageNotify_hook,
|
||||||
offsets::FrameStageNotify());
|
offsets::FrameStageNotify());
|
||||||
|
#endif
|
||||||
hooks::client.HookMethod((void *) DispatchUserMessage_hook,
|
hooks::client.HookMethod((void *) DispatchUserMessage_hook,
|
||||||
offsets::DispatchUserMessage());
|
offsets::DispatchUserMessage());
|
||||||
|
|
||||||
@ -322,6 +325,9 @@ g_pGUI->Setup();
|
|||||||
hooks::modelrender.Apply();
|
hooks::modelrender.Apply();
|
||||||
#endif
|
#endif
|
||||||
#endif
|
#endif
|
||||||
|
hooks::enginevgui.Set(g_IEngineVGui);
|
||||||
|
hooks::enginevgui.HookMethod((void *)Paint_hook, offsets::PlatformOffset(14, offsets::undefined, offsets::undefined));
|
||||||
|
hooks::enginevgui.Apply();
|
||||||
hooks::steamfriends.Set(g_ISteamFriends);
|
hooks::steamfriends.Set(g_ISteamFriends);
|
||||||
hooks::steamfriends.HookMethod((void *) GetFriendPersonaName_hook,
|
hooks::steamfriends.HookMethod((void *) GetFriendPersonaName_hook,
|
||||||
offsets::GetFriendPersonaName());
|
offsets::GetFriendPersonaName());
|
||||||
|
@ -152,6 +152,8 @@ void update_ipc_data(ipc::user_data_s& data)
|
|||||||
data.ingame.bot_count = count_bots;
|
data.ingame.bot_count = count_bots;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Timer level_init_timer{};
|
||||||
|
|
||||||
void update()
|
void update()
|
||||||
{
|
{
|
||||||
if (!enabled)
|
if (!enabled)
|
||||||
@ -167,7 +169,7 @@ void update()
|
|||||||
do_random_votekick();
|
do_random_votekick();
|
||||||
if (timer_catbot_list.test_and_set(3000))
|
if (timer_catbot_list.test_and_set(3000))
|
||||||
update_catbot_list();
|
update_catbot_list();
|
||||||
if (timer_abandon.test_and_set(2000))
|
if (timer_abandon.test_and_set(2000) && level_init_timer.check(13000))
|
||||||
{
|
{
|
||||||
count_bots = 0;
|
count_bots = 0;
|
||||||
int count_ipc = 0;
|
int count_ipc = 0;
|
||||||
@ -235,6 +237,11 @@ void init()
|
|||||||
g_IEventManager2->AddListener(&listener(), "player_death", false);
|
g_IEventManager2->AddListener(&listener(), "player_death", false);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void level_init()
|
||||||
|
{
|
||||||
|
level_init_timer.update();
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -18,6 +18,8 @@ int count_shots{ 0 };
|
|||||||
int count_hits{ 0 };
|
int count_hits{ 0 };
|
||||||
int count_hits_head{ 0 };
|
int count_hits_head{ 0 };
|
||||||
|
|
||||||
|
CatVar hitrate_check(CV_SWITCH, "hitrate", "1", "Monitor hitrate");
|
||||||
|
|
||||||
std::vector<std::chrono::time_point<std::chrono::high_resolution_clock>>
|
std::vector<std::chrono::time_point<std::chrono::high_resolution_clock>>
|
||||||
shots{};
|
shots{};
|
||||||
|
|
||||||
|
@ -103,4 +103,5 @@ VMTHook studiorender{};
|
|||||||
VMTHook modelrender{};
|
VMTHook modelrender{};
|
||||||
VMTHook clientmode4{};
|
VMTHook clientmode4{};
|
||||||
VMTHook materialsystem{};
|
VMTHook materialsystem{};
|
||||||
|
VMTHook enginevgui{};
|
||||||
}
|
}
|
||||||
|
@ -423,6 +423,11 @@ bool CreateMove_hook(void *thisptr, float inputSample, CUserCmd *cmd)
|
|||||||
PROF_SECTION(CM_spam);
|
PROF_SECTION(CM_spam);
|
||||||
hacks::shared::spam::CreateMove();
|
hacks::shared::spam::CreateMove();
|
||||||
}
|
}
|
||||||
|
{
|
||||||
|
PROF_SECTION(CM_AC);
|
||||||
|
angles::Update();
|
||||||
|
hacks::shared::anticheat::CreateMove();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
if (time_replaced)
|
if (time_replaced)
|
||||||
g_GlobalVars->curtime = curtime_old;
|
g_GlobalVars->curtime = curtime_old;
|
||||||
|
91
src/hooks/Paint.cpp
Normal file
91
src/hooks/Paint.cpp
Normal file
@ -0,0 +1,91 @@
|
|||||||
|
/*
|
||||||
|
* Paint.cpp
|
||||||
|
*
|
||||||
|
* Created on: Dec 31, 2017
|
||||||
|
* Author: nullifiedcat
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include "common.hpp"
|
||||||
|
#include "hitrate.hpp"
|
||||||
|
#include "hack.hpp"
|
||||||
|
|
||||||
|
static CatVar cursor_fix_experimental(CV_SWITCH, "experimental_cursor_fix", "1",
|
||||||
|
"Cursor fix");
|
||||||
|
|
||||||
|
void Paint_hook(IEngineVGui *_this, PaintMode_t mode)
|
||||||
|
{
|
||||||
|
static const Paint_t original = (Paint_t)hooks::enginevgui.GetMethod(offsets::PlatformOffset(14, offsets::undefined, offsets::undefined));
|
||||||
|
|
||||||
|
if (!g_IEngine->IsInGame())
|
||||||
|
g_Settings.bInvalid = true;
|
||||||
|
|
||||||
|
if (mode & PaintMode_t::PAINT_UIPANELS)
|
||||||
|
{
|
||||||
|
hacks::tf2::killstreak::apply_killstreaks();
|
||||||
|
hacks::shared::catbot::update();
|
||||||
|
if (hitrate::hitrate_check)
|
||||||
|
{
|
||||||
|
hitrate::Update();
|
||||||
|
}
|
||||||
|
#if ENABLE_IPC
|
||||||
|
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)
|
||||||
|
{
|
||||||
|
if (ipc::peer->HasCommands())
|
||||||
|
{
|
||||||
|
ipc::peer->ProcessCommands();
|
||||||
|
}
|
||||||
|
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 TEXTMODE_STDIN == 1
|
||||||
|
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
|
||||||
|
#if ENABLE_GUI
|
||||||
|
if (cursor_fix_experimental)
|
||||||
|
{
|
||||||
|
/* if (gui_visible) {
|
||||||
|
g_ISurface->SetCursorAlwaysVisible(true);
|
||||||
|
} else {
|
||||||
|
g_ISurface->SetCursorAlwaysVisible(false);
|
||||||
|
}*/
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
|
||||||
|
original(_this, mode);
|
||||||
|
}
|
@ -557,9 +557,6 @@ const char *GetFriendPersonaName_hook(ISteamFriends *_this, CSteamID steamID)
|
|||||||
return original(_this, steamID);
|
return original(_this, steamID);
|
||||||
}
|
}
|
||||||
|
|
||||||
static CatVar cursor_fix_experimental(CV_SWITCH, "experimental_cursor_fix", "1",
|
|
||||||
"Cursor fix");
|
|
||||||
|
|
||||||
void FireGameEvent_hook(void *_this, IGameEvent *event)
|
void FireGameEvent_hook(void *_this, IGameEvent *event)
|
||||||
{
|
{
|
||||||
static const FireGameEvent_t original =
|
static const FireGameEvent_t original =
|
||||||
@ -582,36 +579,23 @@ void FireGameEvent_hook(void *_this, IGameEvent *event)
|
|||||||
original(_this, event);
|
original(_this, event);
|
||||||
}
|
}
|
||||||
|
|
||||||
static CatVar hitrate_check(CV_SWITCH, "hitrate", "1", "Monitor hitrate");
|
#if ENABLE_VISUALS == 1
|
||||||
|
|
||||||
void FrameStageNotify_hook(void *_this, int stage)
|
void FrameStageNotify_hook(void *_this, int stage)
|
||||||
{
|
{
|
||||||
static IClientEntity *ent;
|
static IClientEntity *ent;
|
||||||
|
|
||||||
PROF_SECTION(FrameStageNotify_TOTAL);
|
PROF_SECTION(FrameStageNotify_TOTAL);
|
||||||
hacks::tf2::killstreak::apply_killstreaks();
|
|
||||||
|
|
||||||
static const FrameStageNotify_t original =
|
static const FrameStageNotify_t original =
|
||||||
(FrameStageNotify_t) hooks::client.GetMethod(
|
(FrameStageNotify_t) hooks::client.GetMethod(
|
||||||
offsets::FrameStageNotify());
|
offsets::FrameStageNotify());
|
||||||
|
|
||||||
if (!g_IEngine->IsInGame())
|
if (!g_IEngine->IsInGame())
|
||||||
g_Settings.bInvalid = true;
|
g_Settings.bInvalid = true;
|
||||||
#if ENABLE_VISUALS == 1
|
|
||||||
{
|
{
|
||||||
PROF_SECTION(FSN_skinchanger);
|
PROF_SECTION(FSN_skinchanger);
|
||||||
hacks::tf2::skinchanger::FrameStageNotify(stage);
|
hacks::tf2::skinchanger::FrameStageNotify(stage);
|
||||||
}
|
}
|
||||||
#endif
|
|
||||||
if (stage == FRAME_NET_UPDATE_POSTDATAUPDATE_START && !g_Settings.bInvalid)
|
|
||||||
{
|
|
||||||
hacks::shared::catbot::update();
|
|
||||||
angles::Update();
|
|
||||||
hacks::shared::anticheat::CreateMove();
|
|
||||||
if (hitrate_check)
|
|
||||||
{
|
|
||||||
hitrate::Update();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if (resolver && cathook && !g_Settings.bInvalid &&
|
if (resolver && cathook && !g_Settings.bInvalid &&
|
||||||
stage == FRAME_NET_UPDATE_POSTDATAUPDATE_START)
|
stage == FRAME_NET_UPDATE_POSTDATAUPDATE_START)
|
||||||
{
|
{
|
||||||
@ -635,70 +619,8 @@ void FrameStageNotify_hook(void *_this, int stage)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (stage == FRAME_START)
|
|
||||||
{
|
|
||||||
#if ENABLE_IPC
|
|
||||||
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)
|
|
||||||
{
|
|
||||||
if (ipc::peer->HasCommands())
|
|
||||||
{
|
|
||||||
ipc::peer->ProcessCommands();
|
|
||||||
}
|
|
||||||
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 TEXTMODE_STDIN == 1
|
|
||||||
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
|
|
||||||
}
|
|
||||||
#if ENABLE_VISUALS == 1
|
|
||||||
if (cathook && !g_Settings.bInvalid && stage == FRAME_RENDER_START)
|
if (cathook && !g_Settings.bInvalid && stage == FRAME_RENDER_START)
|
||||||
{
|
{
|
||||||
#if ENABLE_GUI
|
|
||||||
if (cursor_fix_experimental)
|
|
||||||
{
|
|
||||||
/* if (gui_visible) {
|
|
||||||
g_ISurface->SetCursorAlwaysVisible(true);
|
|
||||||
} else {
|
|
||||||
g_ISurface->SetCursorAlwaysVisible(false);
|
|
||||||
}*/
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
IF_GAME(IsTF())
|
IF_GAME(IsTF())
|
||||||
{
|
{
|
||||||
if (CE_GOOD(LOCAL_E) && no_zoom)
|
if (CE_GOOD(LOCAL_E) && no_zoom)
|
||||||
@ -720,9 +642,9 @@ void FrameStageNotify_hook(void *_this, int stage)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
#endif /* TEXTMODE */
|
|
||||||
original(_this, stage);
|
original(_this, stage);
|
||||||
}
|
}
|
||||||
|
#endif /* TEXTMODE */
|
||||||
|
|
||||||
static CatVar clean_chat(CV_SWITCH, "clean_chat", "0", "Clean chat",
|
static CatVar clean_chat(CV_SWITCH, "clean_chat", "0", "Clean chat",
|
||||||
"Removes newlines from chat");
|
"Removes newlines from chat");
|
||||||
|
@ -48,6 +48,7 @@ IGameEventManager *g_IGameEventManager = nullptr;
|
|||||||
TFGCClientSystem *g_TFGCClientSystem = nullptr;
|
TFGCClientSystem *g_TFGCClientSystem = nullptr;
|
||||||
CHud *g_CHUD = nullptr;
|
CHud *g_CHUD = nullptr;
|
||||||
CGameRules *g_pGameRules = nullptr;
|
CGameRules *g_pGameRules = nullptr;
|
||||||
|
IEngineVGui *g_IEngineVGui = nullptr;
|
||||||
|
|
||||||
template <typename T>
|
template <typename T>
|
||||||
T *BruteforceInterface(std::string name, sharedobj::SharedObject &object,
|
T *BruteforceInterface(std::string name, sharedobj::SharedObject &object,
|
||||||
@ -101,6 +102,7 @@ void CreateInterfaces()
|
|||||||
g_IVModelRender = BruteforceInterface<IVModelRender>(
|
g_IVModelRender = BruteforceInterface<IVModelRender>(
|
||||||
"VEngineModel", sharedobj::engine(), 16);
|
"VEngineModel", sharedobj::engine(), 16);
|
||||||
g_ISteamFriends = nullptr;
|
g_ISteamFriends = nullptr;
|
||||||
|
g_IEngineVGui = BruteforceInterface<IEngineVGui>("VEngineVGui", sharedobj::engine());
|
||||||
IF_GAME(IsTF2())
|
IF_GAME(IsTF2())
|
||||||
{
|
{
|
||||||
uintptr_t sig_steamapi = gSignatures.GetEngineSignature(
|
uintptr_t sig_steamapi = gSignatures.GetEngineSignature(
|
||||||
|
Reference in New Issue
Block a user