WIP hooks refactor
This commit is contained in:
parent
a3f8e222e9
commit
ca11b4355b
@ -94,7 +94,7 @@
|
|||||||
#include "textfile.hpp"
|
#include "textfile.hpp"
|
||||||
#include "ipc.hpp"
|
#include "ipc.hpp"
|
||||||
#include "tfmm.hpp"
|
#include "tfmm.hpp"
|
||||||
#include "hooks/hookedmethods.hpp"
|
#include "hooks/HookedMethods.hpp"
|
||||||
#include "classinfo/classinfo.hpp"
|
#include "classinfo/classinfo.hpp"
|
||||||
#include "votelogger.hpp"
|
#include "votelogger.hpp"
|
||||||
#include "crits.hpp"
|
#include "crits.hpp"
|
||||||
|
@ -1,11 +1,4 @@
|
|||||||
target_sources(cathook PRIVATE
|
target_sources(cathook PRIVATE
|
||||||
"${CMAKE_CURRENT_LIST_DIR}/CreateMove.hpp"
|
"${CMAKE_CURRENT_LIST_DIR}/HookedMethods.hpp")
|
||||||
"${CMAKE_CURRENT_LIST_DIR}/hookedmethods.hpp"
|
|
||||||
"${CMAKE_CURRENT_LIST_DIR}/others.hpp")
|
|
||||||
|
|
||||||
if(EnableVisuals)
|
|
||||||
target_sources(cathook PRIVATE
|
|
||||||
"${CMAKE_CURRENT_LIST_DIR}/PaintTraverse.hpp")
|
|
||||||
endif()
|
|
||||||
|
|
||||||
target_include_directories(cathook PRIVATE "${CMAKE_CURRENT_LIST_DIR}")
|
target_include_directories(cathook PRIVATE "${CMAKE_CURRENT_LIST_DIR}")
|
@ -1,13 +0,0 @@
|
|||||||
/*
|
|
||||||
* CreateMove.h
|
|
||||||
*
|
|
||||||
* Created on: Jan 8, 2017
|
|
||||||
* Author: nullifiedcat
|
|
||||||
*/
|
|
||||||
|
|
||||||
#pragma once
|
|
||||||
|
|
||||||
class CUserCmd;
|
|
||||||
|
|
||||||
extern bool *bSendPackets;
|
|
||||||
bool CreateMove_hook(void *, float, CUserCmd *);
|
|
151
include/hooks/HookedMethods.hpp
Normal file
151
include/hooks/HookedMethods.hpp
Normal file
@ -0,0 +1,151 @@
|
|||||||
|
|
||||||
|
/*
|
||||||
|
Created by Jenny White on 28.04.18.
|
||||||
|
Copyright (c) 2018 nullworks. All rights reserved.
|
||||||
|
*/
|
||||||
|
|
||||||
|
|
||||||
|
#pragma once
|
||||||
|
|
||||||
|
#include "common.hpp"
|
||||||
|
|
||||||
|
extern bool *bSendPackets;
|
||||||
|
extern CatVar no_zoom;
|
||||||
|
extern CatVar clean_screenshots;
|
||||||
|
extern CatVar disable_visuals;
|
||||||
|
extern CatVar disconnect_reason;
|
||||||
|
#if ENABLE_VISUALS
|
||||||
|
extern int spectator_target;
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#if ENABLE_VISUALS
|
||||||
|
union SDL_Event;
|
||||||
|
#endif
|
||||||
|
|
||||||
|
namespace types
|
||||||
|
{
|
||||||
|
// ClientMode
|
||||||
|
using CreateMove = bool(*)(void *, float, CUserCmd *);
|
||||||
|
using LevelInit = void(*)(void *, const char *);
|
||||||
|
using LevelShutdown = void(*)(void *);
|
||||||
|
// ClientMode + 4
|
||||||
|
using FireGameEvent = void(*)(void *_this, IGameEvent *event);
|
||||||
|
// IBaseClient
|
||||||
|
using DispatchUserMessage = bool(*)(void *, int, bf_read &);
|
||||||
|
// IInput
|
||||||
|
using GetUserCmd = CUserCmd *(*)(IInput *, int);
|
||||||
|
|
||||||
|
using CanPacket = bool(*)(void *);
|
||||||
|
using IN_KeyEvent = int(*)(void *, int, int, const char *);
|
||||||
|
using SendNetMsg = bool(*)(void *, INetMessage &, bool, bool);
|
||||||
|
using Shutdown = void(*)(void *, const char *);
|
||||||
|
using BeginFrame = void(*)(IStudioRender *);
|
||||||
|
using CanInspect = bool(*)(IClientEntity *);
|
||||||
|
using GetClientName = const char *(*)(CBaseClientState *);
|
||||||
|
using ProcessSetConVar = bool(*)(CBaseClientState *, NET_SetConVar *);
|
||||||
|
using ProcessGetCvarValue = bool(*)(CBaseClientState *, SVC_GetCvarValue *);
|
||||||
|
// ISteamFriends
|
||||||
|
using GetFriendPersonaName = const char *(*)(ISteamFriends *, CSteamID);
|
||||||
|
|
||||||
|
#if ENABLE_VISUALS
|
||||||
|
// ClientMode
|
||||||
|
using OverrideView = void(*)(void *, CViewSetup *);
|
||||||
|
// IEngineVGui
|
||||||
|
using Paint = void(*)(IEngineVGui *, PaintMode_t);
|
||||||
|
//IVModelRender
|
||||||
|
using DrawModelExecute = void(*)(IVModelRender *, const DrawModelState_t &,
|
||||||
|
const ModelRenderInfo_t &, matrix3x4_t *);
|
||||||
|
// IBaseClient
|
||||||
|
using FrameStageNotify = void(*)(void *, int);
|
||||||
|
|
||||||
|
using PaintTraverse = void(*)(void *, unsigned int, bool, bool);
|
||||||
|
// SDL
|
||||||
|
using SDL_GL_SwapWindow = void(*)(SDL_Window *window);
|
||||||
|
using SDL_PollEvent = int(*)(SDL_Event *event);
|
||||||
|
// Manual
|
||||||
|
using RandomInt = int(*)(void *, int, int);
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
|
||||||
|
namespace methods
|
||||||
|
{
|
||||||
|
bool CreateMove(void *, float, CUserCmd *);
|
||||||
|
void PaintTraverse(void *, unsigned int, bool, bool);
|
||||||
|
const char *GetClientName(CBaseClientState *_this);
|
||||||
|
bool ProcessSetConVar(CBaseClientState *_this, NET_SetConVar *msg);
|
||||||
|
bool ProcessGetCvarValue(CBaseClientState *_this, SVC_GetCvarValue *msg);
|
||||||
|
const char *GetFriendPersonaName(ISteamFriends *_this, CSteamID steamID);
|
||||||
|
void FireGameEvent(void *_this, IGameEvent *event);
|
||||||
|
CUserCmd *GetUserCmd(IInput *, int);
|
||||||
|
void DrawModelExecute(IVModelRender *_this, const DrawModelState_t &state,
|
||||||
|
const ModelRenderInfo_t &info, matrix3x4_t *matrix);
|
||||||
|
bool CanPacket(void *);
|
||||||
|
int IN_KeyEvent(void *, int, int, const char *);
|
||||||
|
bool SendNetMsg(void *, INetMessage &, bool, bool);
|
||||||
|
void Shutdown(void *, const char *);
|
||||||
|
void OverrideView(void *, CViewSetup *);
|
||||||
|
bool DispatchUserMessage(void *, int, bf_read &);
|
||||||
|
void FrameStageNotify(void *, int);
|
||||||
|
void LevelInit(void *, const char *);
|
||||||
|
void LevelShutdown(void *);
|
||||||
|
int RandomInt(void *, int, int);
|
||||||
|
int SDL_PollEvent(SDL_Event *event);
|
||||||
|
void SDL_GL_SwapWindow(SDL_Window *window);
|
||||||
|
void Paint(IEngineVGui *_this, PaintMode_t mode);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
// typedef void(*CInput__CreateMove_t)(void*, int, float, bool);
|
||||||
|
// void CInput__CreateMove_hook(void*, int sequence_number, float
|
||||||
|
// input_sample_frametime, bool active);
|
||||||
|
|
||||||
|
|
||||||
|
#if ENABLE_VISUALS
|
||||||
|
|
||||||
|
/* SDL HOOKS */
|
||||||
|
union SDL_Event;
|
||||||
|
class SDL_Window;
|
||||||
|
|
||||||
|
extern SDL_Window *sdl_current_window;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
void DoSDLHooking();
|
||||||
|
void DoSDLUnhooking();
|
||||||
|
#endif
|
||||||
|
|
||||||
|
|
||||||
|
// TODO!
|
||||||
|
#if 0
|
||||||
|
|
||||||
|
#if ENABLE_NULL_GRAPHICS
|
||||||
|
typedef ITexture *(*FindTexture_t)(void *, const char *, const char *, bool,
|
||||||
|
int);
|
||||||
|
typedef IMaterial *(*FindMaterialEx_t)(void *, const char *, const char *, int,
|
||||||
|
bool, const char *);
|
||||||
|
typedef IMaterial *(*FindMaterial_t)(void *, const char *, const char *, bool,
|
||||||
|
const char *);
|
||||||
|
|
||||||
|
/* 70 */ void ReloadTextures_null_hook(void *this_);
|
||||||
|
/* 71 */ void ReloadMaterials_null_hook(void *this_, const char *pSubString);
|
||||||
|
/* 73 */ IMaterial *FindMaterial_null_hook(void *this_,
|
||||||
|
char const *pMaterialName,
|
||||||
|
const char *pTextureGroupName,
|
||||||
|
bool complain,
|
||||||
|
const char *pComplainPrefix);
|
||||||
|
/* 81 */ ITexture *FindTexture_null_hook(void *this_, char const *pTextureName,
|
||||||
|
const char *pTextureGroupName,
|
||||||
|
bool complain,
|
||||||
|
int nAdditionalCreationFlags);
|
||||||
|
/* 121 */ void ReloadFilesInList_null_hook(void *this_,
|
||||||
|
IFileList *pFilesToReload);
|
||||||
|
/* 123 */ IMaterial *FindMaterialEx_null_hook(void *this_,
|
||||||
|
char const *pMaterialName,
|
||||||
|
const char *pTextureGroupName,
|
||||||
|
int nContext, bool complain,
|
||||||
|
const char *pComplainPrefix);
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#endif
|
@ -1,15 +0,0 @@
|
|||||||
/*
|
|
||||||
* PaintTraverse.h
|
|
||||||
*
|
|
||||||
* Created on: Jan 8, 2017
|
|
||||||
* Author: nullifiedcat
|
|
||||||
*/
|
|
||||||
|
|
||||||
#pragma once
|
|
||||||
|
|
||||||
class CatVar;
|
|
||||||
|
|
||||||
extern CatVar no_zoom;
|
|
||||||
extern CatVar clean_screenshots;
|
|
||||||
extern CatVar disable_visuals;
|
|
||||||
void PaintTraverse_hook(void *, unsigned int, bool, bool);
|
|
@ -1,73 +0,0 @@
|
|||||||
/*
|
|
||||||
* hooks.h
|
|
||||||
*
|
|
||||||
* Created on: Jan 8, 2017
|
|
||||||
* Author: nullifiedcat
|
|
||||||
*/
|
|
||||||
|
|
||||||
#pragma once
|
|
||||||
|
|
||||||
#include "common.hpp"
|
|
||||||
|
|
||||||
typedef bool (*CreateMove_t)(void *, float, CUserCmd *);
|
|
||||||
typedef void (*PaintTraverse_t)(void *, unsigned int, bool, bool);
|
|
||||||
typedef bool (*CanPacket_t)(void *);
|
|
||||||
typedef int (*IN_KeyEvent_t)(void *, int, int, const char *);
|
|
||||||
typedef bool (*SendNetMsg_t)(void *, INetMessage &, bool, bool);
|
|
||||||
typedef void (*Shutdown_t)(void *, const char *);
|
|
||||||
typedef void (*OverrideView_t)(void *, CViewSetup *);
|
|
||||||
typedef bool (*DispatchUserMessage_t)(void *, int, bf_read &);
|
|
||||||
typedef void (*FrameStageNotify_t)(void *, int);
|
|
||||||
typedef void (*LevelInit_t)(void *, const char *);
|
|
||||||
typedef void (*LevelShutdown_t)(void *);
|
|
||||||
|
|
||||||
typedef void (*BeginFrame_t)(IStudioRender *);
|
|
||||||
typedef bool (*CanInspect_t)(IClientEntity *);
|
|
||||||
typedef void (*DrawModelExecute_t)(IVModelRender *, const DrawModelState_t &,
|
|
||||||
const ModelRenderInfo_t &, matrix3x4_t *);
|
|
||||||
typedef CUserCmd *(*GetUserCmd_t)(IInput *, int);
|
|
||||||
typedef const char *(*GetClientName_t)(CBaseClientState *);
|
|
||||||
typedef bool (*ProcessSetConVar_t)(CBaseClientState *, NET_SetConVar *);
|
|
||||||
typedef bool (*ProcessGetCvarValue_t)(CBaseClientState *, SVC_GetCvarValue *);
|
|
||||||
typedef void (*Paint_t)(IEngineVGui *, PaintMode_t);
|
|
||||||
|
|
||||||
typedef int (*RandomInt_t)(void *, int, int);
|
|
||||||
|
|
||||||
const char *GetClientName_hook(CBaseClientState *_this);
|
|
||||||
bool ProcessSetConVar_hook(CBaseClientState *_this, NET_SetConVar *msg);
|
|
||||||
bool ProcessGetCvarValue_hook(CBaseClientState *_this, SVC_GetCvarValue *msg);
|
|
||||||
// typedef void(*CInput__CreateMove_t)(void*, int, float, bool);
|
|
||||||
// void CInput__CreateMove_hook(void*, int sequence_number, float
|
|
||||||
// input_sample_frametime, bool active);
|
|
||||||
typedef const char *(*GetFriendPersonaName_t)(ISteamFriends *, CSteamID);
|
|
||||||
const char *GetFriendPersonaName_hook(ISteamFriends *_this, CSteamID steamID);
|
|
||||||
|
|
||||||
typedef void (*FireGameEvent_t)(void *_this, IGameEvent *event);
|
|
||||||
void FireGameEvent_hook(void *_this, IGameEvent *event);
|
|
||||||
|
|
||||||
CUserCmd *GetUserCmd_hook(IInput *, int);
|
|
||||||
void DrawModelExecute_hook(IVModelRender *_this, const DrawModelState_t &state,
|
|
||||||
const ModelRenderInfo_t &info, matrix3x4_t *matrix);
|
|
||||||
|
|
||||||
#if ENABLE_VISUALS
|
|
||||||
void Paint_hook(IEngineVGui *_this, PaintMode_t mode);
|
|
||||||
|
|
||||||
/* SDL HOOKS */
|
|
||||||
union SDL_Event;
|
|
||||||
class SDL_Window;
|
|
||||||
|
|
||||||
extern SDL_Window *sdl_current_window;
|
|
||||||
|
|
||||||
typedef int (*SDL_PollEvent_t)(SDL_Event *event);
|
|
||||||
typedef void (*SDL_GL_SwapWindow_t)(SDL_Window *window);
|
|
||||||
|
|
||||||
int SDL_PollEvent_hook(SDL_Event *event);
|
|
||||||
void SDL_GL_SwapWindow_hook(SDL_Window *window);
|
|
||||||
|
|
||||||
void DoSDLHooking();
|
|
||||||
void DoSDLUnhooking();
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#include "CreateMove.hpp"
|
|
||||||
#include "PaintTraverse.hpp"
|
|
||||||
#include "others.hpp"
|
|
@ -1,63 +0,0 @@
|
|||||||
/*
|
|
||||||
* others.h
|
|
||||||
*
|
|
||||||
* Created on: Jan 8, 2017
|
|
||||||
* Author: nullifiedcat
|
|
||||||
*/
|
|
||||||
|
|
||||||
#pragma once
|
|
||||||
|
|
||||||
#include "config.h"
|
|
||||||
|
|
||||||
class INetMessage;
|
|
||||||
class CViewSetup;
|
|
||||||
class bf_read;
|
|
||||||
class SDL_Window;
|
|
||||||
class CatVar;
|
|
||||||
|
|
||||||
extern CatVar disconnect_reason;
|
|
||||||
#if ENABLE_VISUALS
|
|
||||||
extern int spectator_target;
|
|
||||||
#endif
|
|
||||||
|
|
||||||
bool CanPacket_hook(void *);
|
|
||||||
int IN_KeyEvent_hook(void *, int, int, const char *);
|
|
||||||
bool SendNetMsg_hook(void *, INetMessage &, bool, bool);
|
|
||||||
void Shutdown_hook(void *, const char *);
|
|
||||||
void OverrideView_hook(void *, CViewSetup *);
|
|
||||||
bool DispatchUserMessage_hook(void *, int, bf_read &);
|
|
||||||
void FrameStageNotify_hook(void *, int);
|
|
||||||
void LevelInit_hook(void *, const char *);
|
|
||||||
void LevelShutdown_hook(void *);
|
|
||||||
int RandomInt_hook(void *, int, int);
|
|
||||||
|
|
||||||
#if ENABLE_NULL_GRAPHICS
|
|
||||||
typedef ITexture *(*FindTexture_t)(void *, const char *, const char *, bool,
|
|
||||||
int);
|
|
||||||
typedef IMaterial *(*FindMaterialEx_t)(void *, const char *, const char *, int,
|
|
||||||
bool, const char *);
|
|
||||||
typedef IMaterial *(*FindMaterial_t)(void *, const char *, const char *, bool,
|
|
||||||
const char *);
|
|
||||||
|
|
||||||
/* 70 */ void ReloadTextures_null_hook(void *this_);
|
|
||||||
/* 71 */ void ReloadMaterials_null_hook(void *this_, const char *pSubString);
|
|
||||||
/* 73 */ IMaterial *FindMaterial_null_hook(void *this_,
|
|
||||||
char const *pMaterialName,
|
|
||||||
const char *pTextureGroupName,
|
|
||||||
bool complain,
|
|
||||||
const char *pComplainPrefix);
|
|
||||||
/* 81 */ ITexture *FindTexture_null_hook(void *this_, char const *pTextureName,
|
|
||||||
const char *pTextureGroupName,
|
|
||||||
bool complain,
|
|
||||||
int nAdditionalCreationFlags);
|
|
||||||
/* 121 */ void ReloadFilesInList_null_hook(void *this_,
|
|
||||||
IFileList *pFilesToReload);
|
|
||||||
/* 123 */ IMaterial *FindMaterialEx_null_hook(void *this_,
|
|
||||||
char const *pMaterialName,
|
|
||||||
const char *pTextureGroupName,
|
|
||||||
int nContext, bool complain,
|
|
||||||
const char *pComplainPrefix);
|
|
||||||
#endif
|
|
||||||
|
|
||||||
// extern unsigned int* swapwindow_ptr;
|
|
||||||
// extern unsigned int swapwindow_orig;
|
|
@ -7,7 +7,7 @@
|
|||||||
|
|
||||||
#include "common.hpp"
|
#include "common.hpp"
|
||||||
|
|
||||||
#include "hooks/hookedmethods.hpp"
|
#include "hooks/HookedMethods.hpp"
|
||||||
#include "hack.hpp"
|
#include "hack.hpp"
|
||||||
|
|
||||||
#include <SDL2/SDL.h>
|
#include <SDL2/SDL.h>
|
||||||
|
Reference in New Issue
Block a user