commit
0e253119c2
14
.cproject
14
.cproject
@ -43,7 +43,7 @@
|
||||
<option id="gnu.cpp.compiler.option.dialect.std.362725251" name="Language standard" superClass="gnu.cpp.compiler.option.dialect.std" useByScannerDiscovery="true" value="gnu.cpp.compiler.dialect.c++11" valueType="enumerated"/>
|
||||
<option id="gnu.cpp.compiler.option.other.other.1916750610" name="Other flags" superClass="gnu.cpp.compiler.option.other.other" useByScannerDiscovery="false" value="-c -shared -Wall -Wno-unknown-pragmas -fmessage-length=0 -m32 -fvisibility=hidden" valueType="string"/>
|
||||
<option id="gnu.cpp.compiler.option.other.pic.920050344" name="Position Independent Code (-fPIC)" superClass="gnu.cpp.compiler.option.other.pic" useByScannerDiscovery="false" value="true" valueType="boolean"/>
|
||||
<option id="gnu.cpp.compiler.option.include.paths.1848710724" name="Include paths (-I)" superClass="gnu.cpp.compiler.option.include.paths" useByScannerDiscovery="false" valueType="includePath">
|
||||
<option IS_BUILTIN_EMPTY="false" IS_VALUE_EMPTY="false" id="gnu.cpp.compiler.option.include.paths.1848710724" name="Include paths (-I)" superClass="gnu.cpp.compiler.option.include.paths" useByScannerDiscovery="false" valueType="includePath">
|
||||
<listOptionValue builtIn="false" value=""${workspace_loc:/${ProjName}/source-sdk-2013/mp/src/common}""/>
|
||||
<listOptionValue builtIn="false" value=""${workspace_loc:/${ProjName}/source-sdk-2013/mp/src}""/>
|
||||
<listOptionValue builtIn="false" value=""${workspace_loc:/${ProjName}/source-sdk-2013/mp/src/public}""/>
|
||||
@ -55,7 +55,7 @@
|
||||
<listOptionValue builtIn="false" value=""${workspace_loc:/cathook/include}""/>
|
||||
</option>
|
||||
<option id="gnu.cpp.compiler.option.other.verbose.1509393088" name="Verbose (-v)" superClass="gnu.cpp.compiler.option.other.verbose" useByScannerDiscovery="false" value="false" valueType="boolean"/>
|
||||
<option id="gnu.cpp.compiler.option.preprocessor.def.116822749" name="Defined symbols (-D)" superClass="gnu.cpp.compiler.option.preprocessor.def" useByScannerDiscovery="false" valueType="definedSymbols">
|
||||
<option IS_BUILTIN_EMPTY="false" IS_VALUE_EMPTY="false" id="gnu.cpp.compiler.option.preprocessor.def.116822749" name="Defined symbols (-D)" superClass="gnu.cpp.compiler.option.preprocessor.def" useByScannerDiscovery="false" valueType="definedSymbols">
|
||||
<listOptionValue builtIn="false" value="TF2"/>
|
||||
<listOptionValue builtIn="false" value="_DEVELOPER=1"/>
|
||||
<listOptionValue builtIn="false" value="_POSIX=1"/>
|
||||
@ -79,7 +79,7 @@
|
||||
<option id="gnu.c.compiler.option.dialect.std.1436721060" name="Language standard" superClass="gnu.c.compiler.option.dialect.std" useByScannerDiscovery="true" value="gnu.c.compiler.dialect.default" valueType="enumerated"/>
|
||||
<option id="gnu.c.compiler.option.misc.other.743672320" name="Other flags" superClass="gnu.c.compiler.option.misc.other" useByScannerDiscovery="false" value="-c -fmessage-length=0 -shared -m32" valueType="string"/>
|
||||
<option id="gnu.c.compiler.option.misc.pic.1956969567" name="Position Independent Code (-fPIC)" superClass="gnu.c.compiler.option.misc.pic" useByScannerDiscovery="false" value="true" valueType="boolean"/>
|
||||
<option id="gnu.c.compiler.option.include.paths.634898295" name="Include paths (-I)" superClass="gnu.c.compiler.option.include.paths" useByScannerDiscovery="false" valueType="includePath">
|
||||
<option IS_BUILTIN_EMPTY="false" IS_VALUE_EMPTY="false" id="gnu.c.compiler.option.include.paths.634898295" name="Include paths (-I)" superClass="gnu.c.compiler.option.include.paths" useByScannerDiscovery="false" valueType="includePath">
|
||||
<listOptionValue builtIn="false" value=""${workspace_loc:/cathook/include}""/>
|
||||
</option>
|
||||
<inputType id="cdt.managedbuild.tool.gnu.c.compiler.input.720576197" superClass="cdt.managedbuild.tool.gnu.c.compiler.input"/>
|
||||
@ -88,7 +88,7 @@
|
||||
<option defaultValue="true" id="gnu.c.link.option.shared.1258791465" name="Shared (-shared)" superClass="gnu.c.link.option.shared" valueType="boolean"/>
|
||||
</tool>
|
||||
<tool command="g++" id="cdt.managedbuild.tool.gnu.cpp.linker.exe.debug.344565173" name="GCC C++ Linker" superClass="cdt.managedbuild.tool.gnu.cpp.linker.exe.debug">
|
||||
<option id="gnu.cpp.link.option.libs.1198519366" name="Libraries (-l)" superClass="gnu.cpp.link.option.libs" useByScannerDiscovery="false" valueType="libs">
|
||||
<option IS_BUILTIN_EMPTY="false" IS_VALUE_EMPTY="false" id="gnu.cpp.link.option.libs.1198519366" name="Libraries (-l)" superClass="gnu.cpp.link.option.libs" useByScannerDiscovery="false" valueType="libs">
|
||||
<listOptionValue builtIn="false" value="vstdlib"/>
|
||||
<listOptionValue builtIn="false" value=":libc.so.6"/>
|
||||
<listOptionValue builtIn="false" value=":libstdc++.so.6"/>
|
||||
@ -96,7 +96,7 @@
|
||||
</option>
|
||||
<option defaultValue="true" id="gnu.cpp.link.option.shared.1427554773" name="Shared (-shared)" superClass="gnu.cpp.link.option.shared" useByScannerDiscovery="false" valueType="boolean"/>
|
||||
<option id="gnu.cpp.link.option.flags.1488605018" name="Linker flags" superClass="gnu.cpp.link.option.flags" useByScannerDiscovery="false" value="-m32 -fno-gnu-unique -D_GLIBCXX_USE_CXX11_ABI=0" valueType="string"/>
|
||||
<option id="gnu.cpp.link.option.paths.2112746191" name="Library search path (-L)" superClass="gnu.cpp.link.option.paths" useByScannerDiscovery="false" valueType="libPaths">
|
||||
<option IS_BUILTIN_EMPTY="false" IS_VALUE_EMPTY="false" id="gnu.cpp.link.option.paths.2112746191" name="Library search path (-L)" superClass="gnu.cpp.link.option.paths" useByScannerDiscovery="false" valueType="libPaths">
|
||||
<listOptionValue builtIn="false" value=""${workspace_loc:/${ProjName}/lib}""/>
|
||||
</option>
|
||||
<option id="gnu.cpp.link.option.nodeflibs.746396171" name="Do not use default libraries (-nodefaultlibs)" superClass="gnu.cpp.link.option.nodeflibs" useByScannerDiscovery="false" value="false" valueType="boolean"/>
|
||||
@ -107,7 +107,7 @@
|
||||
</inputType>
|
||||
</tool>
|
||||
<tool id="cdt.managedbuild.tool.gnu.assembler.exe.debug.1494960833" name="GCC Assembler" superClass="cdt.managedbuild.tool.gnu.assembler.exe.debug">
|
||||
<option id="gnu.both.asm.option.include.paths.536294380" name="Include paths (-I)" superClass="gnu.both.asm.option.include.paths" valueType="includePath">
|
||||
<option IS_BUILTIN_EMPTY="false" IS_VALUE_EMPTY="false" id="gnu.both.asm.option.include.paths.536294380" name="Include paths (-I)" superClass="gnu.both.asm.option.include.paths" valueType="includePath">
|
||||
<listOptionValue builtIn="false" value=""${workspace_loc:/cathook/include}""/>
|
||||
<listOptionValue builtIn="false" value=""${workspace_loc:/cathook/xoverlay}""/>
|
||||
</option>
|
||||
@ -130,8 +130,6 @@
|
||||
<entry flags="VALUE_WORKSPACE_PATH|RESOLVED" kind="sourcePath" name="include/visual"/>
|
||||
<entry excluding="reclasses|autogen|segvcatch|targeting|visual|classinfo|vtables|gui|ipc|mem|memory|imgui|hacks/ac" flags="VALUE_WORKSPACE_PATH|RESOLVED" kind="sourcePath" name="src"/>
|
||||
<entry flags="VALUE_WORKSPACE_PATH|RESOLVED" kind="sourcePath" name="src/classinfo"/>
|
||||
<entry excluding="cmdui|im|depr|ncc" flags="VALUE_WORKSPACE_PATH|RESOLVED" kind="sourcePath" name="src/gui"/>
|
||||
<entry flags="VALUE_WORKSPACE_PATH|RESOLVED" kind="sourcePath" name="src/gui/cmdui"/>
|
||||
<entry flags="VALUE_WORKSPACE_PATH|RESOLVED" kind="sourcePath" name="src/hacks/ac"/>
|
||||
<entry flags="VALUE_WORKSPACE_PATH|RESOLVED" kind="sourcePath" name="src/reclasses"/>
|
||||
<entry flags="VALUE_WORKSPACE_PATH|RESOLVED" kind="sourcePath" name="src/visual"/>
|
||||
|
@ -20,7 +20,7 @@ set(EnableVisuals 1 CACHE BOOL "Enable Visuals")
|
||||
set(ExternalDrawing 0 CACHE BOOL "External Visuals")
|
||||
set(EnableGUI 1 CACHE BOOL "Enable GUI")
|
||||
set(EnableIPC 1 CACHE BOOL "Enable IPC")
|
||||
set(DataPath "/opt/cathook/data" CACHE STRING "Data location")
|
||||
set(DataPath "/opt/cathook/data" CACHE FILEPATH "Data location")
|
||||
set(VACBypass 0 CACHE BOOL "Textmode VAC bypass")
|
||||
set(Textmode 0 CACHE BOOL "Various textmode-only features for bots")
|
||||
set(EnableTextmodeStdin 0 CACHE BOOL "Textmode Stdin -> Console bridge (EXPERIMENTAL)")
|
||||
@ -79,7 +79,7 @@ endif()
|
||||
configure_file(include/config.h.in ${CMAKE_SOURCE_DIR}/include/config.h @ONLY)
|
||||
configure_file(include/version.h.in ${CMAKE_SOURCE_DIR}/include/version.h @ONLY)
|
||||
|
||||
set_target_properties(cathook PROPERTIES COMPILE_FLAGS "-m32 -msse -msse2 -msse3" LINK_FLAGS "-m32 -static")
|
||||
set_target_properties(cathook PROPERTIES COMPILE_FLAGS "-m32 -msse -msse2 -msse3 -fexceptions" LINK_FLAGS "-m32 -fno-gnu-unique -fexceptions")
|
||||
|
||||
target_compile_definitions(cathook PRIVATE
|
||||
_GLIBCXX_USE_CXX11_ABI=0
|
||||
@ -117,7 +117,7 @@ add_custom_target(data
|
||||
VERBATIM)
|
||||
|
||||
# TODO glez_LIBRARIES?
|
||||
target_link_libraries(cathook ${ValveLibraryTier0} ${ValveLibraryVStdLib} ssl stdc++)
|
||||
target_link_libraries(cathook ${ValveLibraryTier0} ${ValveLibraryVStdLib} ssl)
|
||||
set_target_properties(cathook PROPERTIES LIBRARY_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/bin)
|
||||
|
||||
# Strip
|
||||
|
@ -53,7 +53,8 @@ target_sources(cathook PRIVATE
|
||||
"${CMAKE_CURRENT_LIST_DIR}/velocity.hpp"
|
||||
"${CMAKE_CURRENT_LIST_DIR}/vfunc.hpp"
|
||||
"${CMAKE_CURRENT_LIST_DIR}/votelogger.hpp"
|
||||
"${CMAKE_CURRENT_LIST_DIR}/xorstring.hpp")
|
||||
"${CMAKE_CURRENT_LIST_DIR}/xorstring.hpp"
|
||||
"${CMAKE_CURRENT_LIST_DIR}/MiscTemporary.hpp")
|
||||
|
||||
target_include_directories(cathook PRIVATE "${CMAKE_CURRENT_LIST_DIR}")
|
||||
|
||||
|
29
include/MiscTemporary.hpp
Normal file
29
include/MiscTemporary.hpp
Normal file
@ -0,0 +1,29 @@
|
||||
/*
|
||||
Created by Jenny White on 29.04.18.
|
||||
Copyright (c) 2018 nullworks. All rights reserved.
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
|
||||
#include "common.hpp"
|
||||
|
||||
// This is a temporary file to put code that needs moving/refactoring in.
|
||||
|
||||
extern bool *bSendPackets;
|
||||
extern CatVar no_zoom;
|
||||
extern CatVar clean_screenshots;
|
||||
extern CatVar disable_visuals;
|
||||
extern CatVar disconnect_reason;
|
||||
extern CatVar crypt_chat;
|
||||
extern CatVar minigun_jump;
|
||||
extern CatVar nolerp;
|
||||
extern CatVar joinclass;
|
||||
extern CatVar jointeam;
|
||||
extern CatVar fakelag_amount;
|
||||
extern CatVar serverlag_amount;
|
||||
extern CatVar debug_projectiles;
|
||||
extern CatVar semiauto;
|
||||
extern CatVar engine_pred;
|
||||
#if ENABLE_VISUALS
|
||||
extern int spectator_target;
|
||||
#endif
|
@ -7,6 +7,8 @@
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <string>
|
||||
|
||||
namespace chatlog
|
||||
{
|
||||
|
||||
|
@ -94,7 +94,7 @@
|
||||
#include "textfile.hpp"
|
||||
#include "ipc.hpp"
|
||||
#include "tfmm.hpp"
|
||||
#include "hooks/hookedmethods.hpp"
|
||||
#include "hooks/HookedMethods.hpp"
|
||||
#include "classinfo/classinfo.hpp"
|
||||
#include "votelogger.hpp"
|
||||
#include "crits.hpp"
|
||||
|
8
include/hooks.hpp
Executable file → Normal file
8
include/hooks.hpp
Executable file → Normal file
@ -37,7 +37,12 @@ public:
|
||||
~VMTHook();
|
||||
void Set(ptr_t inst, uint32_t offset = 0);
|
||||
void Release();
|
||||
void HookMethod(ptr_t func, uint32_t idx);
|
||||
template <typename T>
|
||||
inline void HookMethod(T func, uint32_t idx, T *backup)
|
||||
{
|
||||
HookMethod(ptr_t(func), idx, (ptr_t *) (backup));
|
||||
}
|
||||
void HookMethod(ptr_t func, uint32_t idx, ptr_t *backup);
|
||||
void *GetMethod(uint32_t idx) const;
|
||||
void Apply();
|
||||
|
||||
@ -64,4 +69,5 @@ extern VMTHook steamfriends;
|
||||
extern VMTHook materialsystem;
|
||||
extern VMTHook enginevgui;
|
||||
extern VMTHook vstd;
|
||||
extern VMTHook eventmanager2;
|
||||
}
|
||||
|
@ -1,11 +1,4 @@
|
||||
target_sources(cathook PRIVATE
|
||||
"${CMAKE_CURRENT_LIST_DIR}/CreateMove.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()
|
||||
"${CMAKE_CURRENT_LIST_DIR}/HookedMethods.hpp")
|
||||
|
||||
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 *);
|
122
include/hooks/HookedMethods.hpp
Normal file
122
include/hooks/HookedMethods.hpp
Normal file
@ -0,0 +1,122 @@
|
||||
|
||||
/*
|
||||
Created by Jenny White on 28.04.18.
|
||||
Copyright (c) 2018 nullworks. All rights reserved.
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
|
||||
#include "common.hpp"
|
||||
|
||||
#if ENABLE_VISUALS
|
||||
union SDL_Event;
|
||||
struct SDL_Window;
|
||||
#endif
|
||||
|
||||
#define DECLARE_HOOKED_METHOD(name, rtype, ...) \
|
||||
namespace types \
|
||||
{ \
|
||||
using name = rtype (*)(__VA_ARGS__); \
|
||||
} \
|
||||
namespace methods \
|
||||
{ \
|
||||
rtype name(__VA_ARGS__); \
|
||||
} \
|
||||
namespace original \
|
||||
{ \
|
||||
extern types::name name; \
|
||||
}
|
||||
|
||||
#define DEFINE_HOOKED_METHOD(name, rtype, ...) \
|
||||
types::name original::name{ nullptr }; \
|
||||
rtype methods::name(__VA_ARGS__)
|
||||
|
||||
#define HOOK_ARGS(name) \
|
||||
hooked_methods::methods::name, offsets::name(), \
|
||||
&hooked_methods::original::name
|
||||
|
||||
namespace hooked_methods
|
||||
{
|
||||
// ClientMode
|
||||
DECLARE_HOOKED_METHOD(CreateMove, bool, void *, float, CUserCmd *);
|
||||
DECLARE_HOOKED_METHOD(LevelInit, void, void *, const char *);
|
||||
DECLARE_HOOKED_METHOD(LevelShutdown, void, void *);
|
||||
// ClientMode + 4
|
||||
DECLARE_HOOKED_METHOD(FireGameEvent, void, void *, IGameEvent *);
|
||||
// IBaseClient
|
||||
DECLARE_HOOKED_METHOD(DispatchUserMessage, bool, void *, int, bf_read &);
|
||||
DECLARE_HOOKED_METHOD(IN_KeyEvent, int, void *, int, ButtonCode_t,
|
||||
const char *);
|
||||
// IInput
|
||||
DECLARE_HOOKED_METHOD(GetUserCmd, CUserCmd *, IInput *, int);
|
||||
// INetChannel
|
||||
DECLARE_HOOKED_METHOD(SendNetMsg, bool, INetChannel *, INetMessage &, bool,
|
||||
bool);
|
||||
DECLARE_HOOKED_METHOD(CanPacket, bool, INetChannel *);
|
||||
DECLARE_HOOKED_METHOD(Shutdown, void, INetChannel *, const char *);
|
||||
// ISteamFriends
|
||||
DECLARE_HOOKED_METHOD(GetFriendPersonaName, const char *, ISteamFriends *,
|
||||
CSteamID);
|
||||
// IEngineVGui
|
||||
DECLARE_HOOKED_METHOD(Paint, void, IEngineVGui *, PaintMode_t);
|
||||
// IGameEventManager2
|
||||
DECLARE_HOOKED_METHOD(FireEvent, bool, IGameEventManager2 *, IGameEvent *,
|
||||
bool);
|
||||
DECLARE_HOOKED_METHOD(FireEventClientSide, bool, IGameEventManager2 *,
|
||||
IGameEvent *);
|
||||
|
||||
#if ENABLE_VISUALS
|
||||
// ClientMode
|
||||
DECLARE_HOOKED_METHOD(OverrideView, void, void *, CViewSetup *);
|
||||
// IVModelRender
|
||||
DECLARE_HOOKED_METHOD(DrawModelExecute, void, IVModelRender *,
|
||||
const DrawModelState_t &, const ModelRenderInfo_t &,
|
||||
matrix3x4_t *);
|
||||
// IStudioRender
|
||||
DECLARE_HOOKED_METHOD(BeginFrame, void, IStudioRender *);
|
||||
// IBaseClient
|
||||
DECLARE_HOOKED_METHOD(FrameStageNotify, void, void *, ClientFrameStage_t);
|
||||
// vgui::IPanel
|
||||
DECLARE_HOOKED_METHOD(PaintTraverse, void, vgui::IPanel *, unsigned int, bool,
|
||||
bool);
|
||||
// SDL
|
||||
DECLARE_HOOKED_METHOD(SDL_GL_SwapWindow, void, SDL_Window *);
|
||||
DECLARE_HOOKED_METHOD(SDL_PollEvent, int, SDL_Event *);
|
||||
// IUniformRandomStream
|
||||
DECLARE_HOOKED_METHOD(RandomInt, int, IUniformRandomStream *, int, int);
|
||||
#endif
|
||||
}
|
||||
|
||||
// TODO
|
||||
// wontfix.club
|
||||
#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;
|
@ -51,6 +51,7 @@ class IGameEventManager;
|
||||
class TFGCClientSystem;
|
||||
class CGameRules;
|
||||
class IEngineVGui;
|
||||
class IUniformRandomStream;
|
||||
|
||||
extern TFGCClientSystem *g_TFGCClientSystem;
|
||||
extern CHud *g_CHUD;
|
||||
|
@ -164,4 +164,8 @@ struct offsets
|
||||
{
|
||||
return PlatformOffset(2, undefined, undefined);
|
||||
}
|
||||
static constexpr uint32_t Paint()
|
||||
{
|
||||
return PlatformOffset(14, undefined, undefined);
|
||||
}
|
||||
};
|
||||
|
1
include/projlogging.hpp
Executable file → Normal file
1
include/projlogging.hpp
Executable file → Normal file
@ -5,7 +5,6 @@
|
||||
* Author: nullifiedcat
|
||||
*/
|
||||
|
||||
|
||||
#pragma once
|
||||
|
||||
namespace projectile_logging
|
||||
|
1
include/sdk/ScreenSpaceEffects.h
Executable file → Normal file
1
include/sdk/ScreenSpaceEffects.h
Executable file → Normal file
@ -87,4 +87,3 @@ extern CScreenSpaceEffectRegistration **g_ppScreenSpaceRegistrationHead;
|
||||
CEffect pEffectName##_effect; \
|
||||
CScreenSpaceEffectRegistration pEffectName##_reg(#pEffectName, \
|
||||
&pEffectName##_effect);
|
||||
|
||||
|
@ -6,7 +6,8 @@ target_sources(cathook PRIVATE
|
||||
"${CMAKE_CURRENT_LIST_DIR}/drawmgr.hpp"
|
||||
"${CMAKE_CURRENT_LIST_DIR}/EffectChams.hpp"
|
||||
"${CMAKE_CURRENT_LIST_DIR}/EffectGlow.hpp"
|
||||
"${CMAKE_CURRENT_LIST_DIR}/fidgetspinner.hpp")
|
||||
"${CMAKE_CURRENT_LIST_DIR}/fidgetspinner.hpp"
|
||||
"${CMAKE_CURRENT_LIST_DIR}/SDLHooks.hpp")
|
||||
|
||||
if(EnableGUI)
|
||||
add_subdirectory(menu)
|
||||
|
18
include/visual/SDLHooks.hpp
Normal file
18
include/visual/SDLHooks.hpp
Normal file
@ -0,0 +1,18 @@
|
||||
/*
|
||||
Created by Jenny White on 29.04.18.
|
||||
Copyright (c) 2018 nullworks. All rights reserved.
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
|
||||
struct SDL_Window;
|
||||
|
||||
namespace sdl_hooks
|
||||
{
|
||||
|
||||
extern SDL_Window *window;
|
||||
|
||||
void applySdlHooks();
|
||||
void cleanSdlHooks();
|
||||
|
||||
}
|
@ -39,7 +39,8 @@ target_sources(cathook PRIVATE
|
||||
"${CMAKE_CURRENT_LIST_DIR}/trace.cpp"
|
||||
"${CMAKE_CURRENT_LIST_DIR}/ucccccp_cmds.cpp"
|
||||
"${CMAKE_CURRENT_LIST_DIR}/velocity.cpp"
|
||||
"${CMAKE_CURRENT_LIST_DIR}/votelogger.cpp")
|
||||
"${CMAKE_CURRENT_LIST_DIR}/votelogger.cpp"
|
||||
"${CMAKE_CURRENT_LIST_DIR}/MiscTemporary.cpp")
|
||||
|
||||
add_subdirectory(classinfo)
|
||||
add_subdirectory(copypasted)
|
||||
|
36
src/MiscTemporary.cpp
Normal file
36
src/MiscTemporary.cpp
Normal file
@ -0,0 +1,36 @@
|
||||
/*
|
||||
Created by Jenny White on 29.04.18.
|
||||
Copyright (c) 2018 nullworks. All rights reserved.
|
||||
*/
|
||||
|
||||
#include "MiscTemporary.hpp"
|
||||
|
||||
CatVar minigun_jump(CV_SWITCH, "minigun_jump", "0", "TF2C minigun jump",
|
||||
"Allows jumping while shooting with minigun");
|
||||
|
||||
CatVar jointeam(CV_SWITCH, "fb_autoteam", "1",
|
||||
"Joins player team automatically (NYI)");
|
||||
CatVar joinclass(CV_STRING, "fb_autoclass", "spy",
|
||||
"Class that will be picked after joining a team (NYI)");
|
||||
|
||||
CatVar nolerp(CV_SWITCH, "nolerp", "0", "NoLerp mode (experimental)");
|
||||
|
||||
CatVar engine_pred(CV_SWITCH, "engine_prediction", "0", "Engine Prediction");
|
||||
CatVar debug_projectiles(CV_SWITCH, "debug_projectiles", "0",
|
||||
"Debug Projectiles");
|
||||
|
||||
CatVar fakelag_amount(CV_INT, "fakelag", "0", "Bad Fakelag");
|
||||
CatVar serverlag_amount(
|
||||
CV_INT, "serverlag", "0", "serverlag",
|
||||
"Lag the server by spamming this many voicecommands per tick");
|
||||
CatVar semiauto(CV_INT, "semiauto", "0", "Semiauto");
|
||||
CatVar servercrash(CV_SWITCH, "servercrash", "0", "crash servers",
|
||||
"Crash servers by spamming signon net messages");
|
||||
bool *bSendPackets;
|
||||
|
||||
|
||||
CatVar crypt_chat(
|
||||
CV_SWITCH, "chat_crypto", "1", "Crypto chat",
|
||||
"Start message with !! and it will be only visible to cathook users");
|
||||
|
||||
int spectator_target;
|
1
src/chatlog.cpp
Executable file → Normal file
1
src/chatlog.cpp
Executable file → Normal file
@ -27,6 +27,7 @@ public:
|
||||
{
|
||||
};
|
||||
static end_t end;
|
||||
|
||||
public:
|
||||
csv_stream()
|
||||
{
|
||||
|
4
src/copypasted/CSignature.cpp
Executable file → Normal file
4
src/copypasted/CSignature.cpp
Executable file → Normal file
@ -79,7 +79,9 @@ uintptr_t CSignature::dwFindPattern(uintptr_t dwAddress, uintptr_t dwLength,
|
||||
}
|
||||
}
|
||||
|
||||
logging::Info("THIS IS SERIOUS: Could not locate signature: \n============\n\"%s\"\n============", szPattern);
|
||||
logging::Info("THIS IS SERIOUS: Could not locate signature: "
|
||||
"\n============\n\"%s\"\n============",
|
||||
szPattern);
|
||||
|
||||
return NULL;
|
||||
}
|
||||
|
@ -17,6 +17,7 @@ CatVar crit_experimental(CV_SWITCH, "crit_experimental", "0",
|
||||
"Experimental crithack");
|
||||
|
||||
std::unordered_map<int, int> command_number_mod{};
|
||||
|
||||
int *g_PredictionRandomSeed = nullptr;
|
||||
|
||||
namespace criticals
|
||||
|
112
src/hack.cpp
112
src/hack.cpp
@ -5,6 +5,7 @@
|
||||
* Author: nullifiedcat
|
||||
*/
|
||||
|
||||
#include <visual/SDLHooks.hpp>
|
||||
#include "hack.hpp"
|
||||
#include "common.hpp"
|
||||
|
||||
@ -79,7 +80,7 @@ std::stack<std::string> &hack::command_stack()
|
||||
return stack;
|
||||
}
|
||||
|
||||
#if ENABLE_VISUALS /* Why would we need colored chat stuff in textmode? \
|
||||
#if ENABLE_VISUALS /* Why would we need colored chat stuff in textmode? \
|
||||
*/
|
||||
#define red 184, 56, 59, 255
|
||||
#define blu 88, 133, 162, 255
|
||||
@ -245,8 +246,9 @@ free(logname);*/
|
||||
if (not exists)
|
||||
{
|
||||
Error(("Missing essential file: " + s +
|
||||
"/%s\nYou MUST run install-data script to finish "
|
||||
"installation").c_str(),
|
||||
"/%s\nYou MUST run install-data script to finish "
|
||||
"installation")
|
||||
.c_str(),
|
||||
s.c_str());
|
||||
}
|
||||
}
|
||||
@ -287,12 +289,7 @@ free(logname);*/
|
||||
InitNetVars();
|
||||
g_pLocalPlayer = new LocalPlayer();
|
||||
g_pPlayerResource = new TFPlayerResource();
|
||||
#if ENABLE_VISUALS
|
||||
hooks::panel.Set(g_IPanel);
|
||||
hooks::panel.HookMethod((void *) PaintTraverse_hook,
|
||||
offsets::PaintTraverse());
|
||||
hooks::panel.Apply();
|
||||
#endif
|
||||
|
||||
uintptr_t *clientMode = 0;
|
||||
// Bad way to get clientmode.
|
||||
// FIXME [MP]?
|
||||
@ -303,35 +300,58 @@ free(logname);*/
|
||||
usleep(10000);
|
||||
}
|
||||
hooks::clientmode.Set((void *) clientMode);
|
||||
hooks::clientmode.HookMethod((void *) CreateMove_hook,
|
||||
offsets::CreateMove());
|
||||
hooks::clientmode.HookMethod(HOOK_ARGS(CreateMove));
|
||||
#if ENABLE_VISUALS
|
||||
hooks::clientmode.HookMethod((void *) OverrideView_hook,
|
||||
offsets::OverrideView());
|
||||
hooks::clientmode.HookMethod(HOOK_ARGS(OverrideView));
|
||||
#endif
|
||||
hooks::clientmode.HookMethod((void *) LevelInit_hook, offsets::LevelInit());
|
||||
hooks::clientmode.HookMethod((void *) LevelShutdown_hook,
|
||||
offsets::LevelShutdown());
|
||||
hooks::clientmode.HookMethod(HOOK_ARGS(LevelInit));
|
||||
hooks::clientmode.HookMethod(HOOK_ARGS(LevelShutdown));
|
||||
hooks::clientmode.Apply();
|
||||
hooks::clientmode4.Set((void *) (clientMode), 4);
|
||||
hooks::clientmode4.HookMethod((void *) FireGameEvent_hook,
|
||||
offsets::FireGameEvent());
|
||||
hooks::clientmode4.Apply();
|
||||
hooks::client.Set(g_IBaseClient);
|
||||
|
||||
hooks::clientmode4.Set((void *) (clientMode), 4);
|
||||
hooks::clientmode4.HookMethod(HOOK_ARGS(FireGameEvent));
|
||||
hooks::clientmode4.Apply();
|
||||
|
||||
hooks::client.Set(g_IBaseClient);
|
||||
hooks::client.HookMethod(HOOK_ARGS(DispatchUserMessage));
|
||||
#if ENABLE_VISUALS
|
||||
hooks::client.HookMethod((void *) FrameStageNotify_hook,
|
||||
offsets::FrameStageNotify());
|
||||
hooks::client.HookMethod(HOOK_ARGS(FrameStageNotify));
|
||||
hooks::client.HookMethod(HOOK_ARGS(IN_KeyEvent));
|
||||
#endif
|
||||
hooks::client.HookMethod((void *) DispatchUserMessage_hook,
|
||||
offsets::DispatchUserMessage());
|
||||
hooks::client.Apply();
|
||||
|
||||
#if ENABLE_VISUALS
|
||||
hooks::vstd.Set((void *) g_pUniformStream);
|
||||
hooks::vstd.HookMethod((void *) RandomInt_hook, offsets::RandomInt());
|
||||
hooks::vstd.HookMethod(HOOK_ARGS(RandomInt));
|
||||
hooks::vstd.Apply();
|
||||
|
||||
hooks::panel.Set(g_IPanel);
|
||||
hooks::panel.HookMethod(hooked_methods::methods::PaintTraverse,
|
||||
offsets::PaintTraverse(), &hooked_methods::original::PaintTraverse);
|
||||
hooks::panel.Apply();
|
||||
#endif
|
||||
|
||||
hooks::input.Set(g_IInput);
|
||||
hooks::input.HookMethod(HOOK_ARGS(GetUserCmd));
|
||||
hooks::input.Apply();
|
||||
#if ENABLE_VISUALS
|
||||
hooks::modelrender.Set(g_IVModelRender);
|
||||
hooks::modelrender.HookMethod(HOOK_ARGS(DrawModelExecute));
|
||||
hooks::modelrender.Apply();
|
||||
#endif
|
||||
hooks::enginevgui.Set(g_IEngineVGui);
|
||||
hooks::enginevgui.HookMethod(HOOK_ARGS(Paint));
|
||||
hooks::enginevgui.Apply();
|
||||
|
||||
hooks::eventmanager2.Set(g_IEventManager2);
|
||||
hooks::eventmanager2.HookMethod(HOOK_ARGS(FireEvent));
|
||||
hooks::eventmanager2.HookMethod(HOOK_ARGS(FireEventClientSide));
|
||||
hooks::eventmanager2.Apply();
|
||||
|
||||
hooks::steamfriends.Set(g_ISteamFriends);
|
||||
hooks::steamfriends.HookMethod(HOOK_ARGS(GetFriendPersonaName));
|
||||
hooks::steamfriends.Apply();
|
||||
|
||||
#if ENABLE_NULL_GRAPHICS
|
||||
g_IMaterialSystem->SetInStubMode(true);
|
||||
IF_GAME(IsTF2())
|
||||
@ -354,42 +374,6 @@ free(logname);*/
|
||||
// hooks::materialsystem.HookMethod();
|
||||
}
|
||||
#endif
|
||||
#if ENABLE_VISUALS
|
||||
hooks::client.HookMethod((void *) IN_KeyEvent_hook, offsets::IN_KeyEvent());
|
||||
#endif
|
||||
hooks::client.Apply();
|
||||
hooks::input.Set(g_IInput);
|
||||
hooks::input.HookMethod((void *) GetUserCmd_hook, offsets::GetUserCmd());
|
||||
hooks::input.Apply();
|
||||
#ifndef HOOK_DME_DISABLED
|
||||
#if ENABLE_VISUALS
|
||||
hooks::modelrender.Set(g_IVModelRender);
|
||||
hooks::modelrender.HookMethod((void *) DrawModelExecute_hook,
|
||||
offsets::DrawModelExecute());
|
||||
hooks::modelrender.Apply();
|
||||
hooks::enginevgui.Set(g_IEngineVGui);
|
||||
hooks::enginevgui.HookMethod(
|
||||
(void *) Paint_hook,
|
||||
offsets::PlatformOffset(14, offsets::undefined, offsets::undefined));
|
||||
hooks::enginevgui.Apply();
|
||||
#endif
|
||||
#endif
|
||||
hooks::steamfriends.Set(g_ISteamFriends);
|
||||
hooks::steamfriends.HookMethod((void *) GetFriendPersonaName_hook,
|
||||
offsets::GetFriendPersonaName());
|
||||
hooks::steamfriends.Apply();
|
||||
// logging::Info("After hacking: %s", g_ISteamFriends->GetPersonaName());
|
||||
// Sadly, it doesn't work as expected :(
|
||||
/*hooks::hkBaseClientState = new hooks::VMTHook();
|
||||
hooks::hkBaseClientState->Init((void*)g_IBaseClientState, 0);
|
||||
hooks::hkBaseClientState->HookMethod((void*)GetClientName_hook,
|
||||
hooks::offGetClientName); hooks::hkBaseClientState->Apply();*/
|
||||
// hooks::hkBaseClientState8 = new hooks::VMTHook();
|
||||
// hooks::hkBaseClientState8->Init((void*)g_IBaseClientState, 8);
|
||||
// hooks::hkBaseClientState8->HookMethod((void*)ProcessSetConVar_hook,
|
||||
// hooks::offProcessSetConVar);
|
||||
// hooks::hkBaseClientState8->HookMethod((void*)ProcessGetCvarValue_hook,
|
||||
// hooks::offProcessGetCvarValue); hooks::hkBaseClientState8->Apply();
|
||||
|
||||
// FIXME [MP]
|
||||
hacks::shared::killsay::Init();
|
||||
@ -420,7 +404,7 @@ free(logname);*/
|
||||
}
|
||||
logging::Info("SSE enabled..");
|
||||
#endif
|
||||
DoSDLHooking();
|
||||
sdl_hooks::applySdlHooks();
|
||||
logging::Info("SDL hooking done");
|
||||
g_IGameEventManager->AddListener(&adv_event_listener, false);
|
||||
|
||||
@ -470,7 +454,7 @@ void hack::Shutdown()
|
||||
hack::shutdown = true;
|
||||
playerlist::Save();
|
||||
#if ENABLE_VISUALS
|
||||
DoSDLUnhooking();
|
||||
sdl_hooks::cleanSdlHooks();
|
||||
#endif
|
||||
logging::Info("Unregistering convars..");
|
||||
ConVar_Unregister();
|
||||
|
@ -402,8 +402,8 @@ void _FASTCALL emoji(CachedEntity *ent)
|
||||
}
|
||||
glez_rgba_t white = glez_rgba(255, 255, 255, 255);
|
||||
while (!textur || textur == 4294967295)
|
||||
textur = glez_texture_load_png_rgba(DATA_PATH
|
||||
"/textures/atlas.png");
|
||||
textur = glez_texture_load_png_rgba(
|
||||
DATA_PATH "/textures/atlas.png");
|
||||
player_info_s info;
|
||||
unsigned int steamID;
|
||||
unsigned int steamidarray[32]{};
|
||||
|
5
src/hacks/Killstreak.cpp
Executable file → Normal file
5
src/hacks/Killstreak.cpp
Executable file → Normal file
@ -137,11 +137,6 @@ bool FireEventClientSide(IGameEventManager2 *manager, IGameEvent *event)
|
||||
|
||||
void init()
|
||||
{
|
||||
hook.Set(g_IEventManager2, 0);
|
||||
// hook.HookMethod(FireEvent_hook, offsets::FireEvent());
|
||||
hook.HookMethod((void *) FireEventClientSide,
|
||||
offsets::FireEventClientSide());
|
||||
hook.Apply();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
2
src/hacks/SkinChanger.cpp
Executable file → Normal file
2
src/hacks/SkinChanger.cpp
Executable file → Normal file
@ -398,7 +398,7 @@ void def_attribute_modifier::Set(int id, float value)
|
||||
logging::Info("Woah there, that's too many! Remove some.");
|
||||
return;
|
||||
}
|
||||
modifiers.push_back(attribute_s{ (uint16_t)id, value });
|
||||
modifiers.push_back(attribute_s{ (uint16_t) id, value });
|
||||
logging::Info("Added new attribute: %i %.2f (%i)", id, value,
|
||||
modifiers.size());
|
||||
}
|
||||
|
@ -1194,7 +1194,8 @@ void Move()
|
||||
prevlvlname = g_IEngine->GetLevelName();
|
||||
std::string prvlvlname = format(prevlvlname);
|
||||
logging::Info("%s %s", prevlvlname, prvlvlname.c_str());
|
||||
if (boost::contains(prvlvlname, "pl_") || boost::contains(prvlvlname, "cp_"))
|
||||
if (boost::contains(prvlvlname, "pl_") ||
|
||||
boost::contains(prvlvlname, "cp_"))
|
||||
{
|
||||
logging::Info("1");
|
||||
bool ret = false;
|
||||
|
10
src/hooks.cpp
Executable file → Normal file
10
src/hooks.cpp
Executable file → Normal file
@ -77,10 +77,13 @@ void *VMTHook::GetMethod(uint32_t idx) const
|
||||
return vtable_original[idx];
|
||||
}
|
||||
|
||||
void VMTHook::HookMethod(ptr_t func, uint32_t idx)
|
||||
void VMTHook::HookMethod(ptr_t func, uint32_t idx, ptr_t *backup)
|
||||
{
|
||||
logging::Info("Hooking method %d of vtable 0x%08x, replacing 0x%08x with 0x%08x", idx,
|
||||
vtable_original, GetMethod(idx), func);
|
||||
logging::Info(
|
||||
"Hooking method %d of vtable 0x%08x, replacing 0x%08x with 0x%08x", idx,
|
||||
vtable_original, GetMethod(idx), func);
|
||||
if (backup)
|
||||
*backup = vtable_hooked[2 + idx];
|
||||
vtable_hooked[2 + idx] = func;
|
||||
}
|
||||
|
||||
@ -106,4 +109,5 @@ VMTHook clientmode4{};
|
||||
VMTHook materialsystem{};
|
||||
VMTHook enginevgui{};
|
||||
VMTHook vstd{};
|
||||
VMTHook eventmanager2{};
|
||||
}
|
||||
|
@ -1,11 +1,20 @@
|
||||
target_sources(cathook PRIVATE
|
||||
"${CMAKE_CURRENT_LIST_DIR}/CanPacket.cpp"
|
||||
"${CMAKE_CURRENT_LIST_DIR}/CreateMove.cpp"
|
||||
"${CMAKE_CURRENT_LIST_DIR}/DispatchUserMessage.cpp"
|
||||
"${CMAKE_CURRENT_LIST_DIR}/FireGameEvent.cpp"
|
||||
"${CMAKE_CURRENT_LIST_DIR}/GetFriendPersonaName.cpp"
|
||||
"${CMAKE_CURRENT_LIST_DIR}/GetUserCmd.cpp"
|
||||
"${CMAKE_CURRENT_LIST_DIR}/LevelInit.cpp"
|
||||
"${CMAKE_CURRENT_LIST_DIR}/LevelShutdown.cpp"
|
||||
"${CMAKE_CURRENT_LIST_DIR}/nographics.cpp"
|
||||
"${CMAKE_CURRENT_LIST_DIR}/others.cpp")
|
||||
"${CMAKE_CURRENT_LIST_DIR}/others.cpp"
|
||||
"${CMAKE_CURRENT_LIST_DIR}/Paint.cpp"
|
||||
"${CMAKE_CURRENT_LIST_DIR}/SendNetMsg.cpp"
|
||||
"${CMAKE_CURRENT_LIST_DIR}/Shutdown.cpp"
|
||||
"${CMAKE_CURRENT_LIST_DIR}/FireEvent.cpp"
|
||||
"${CMAKE_CURRENT_LIST_DIR}/FireEventClientSide.cpp")
|
||||
|
||||
if(EnableVisuals)
|
||||
target_sources(cathook PRIVATE
|
||||
"${CMAKE_CURRENT_LIST_DIR}/Paint.cpp"
|
||||
"${CMAKE_CURRENT_LIST_DIR}/PaintTraverse.cpp"
|
||||
"${CMAKE_CURRENT_LIST_DIR}/sdl.cpp")
|
||||
add_subdirectory(visual)
|
||||
endif()
|
15
src/hooks/CanPacket.cpp
Normal file
15
src/hooks/CanPacket.cpp
Normal file
@ -0,0 +1,15 @@
|
||||
/*
|
||||
Created by Jenny White on 29.04.18.
|
||||
Copyright (c) 2018 nullworks. All rights reserved.
|
||||
*/
|
||||
|
||||
#include "HookedMethods.hpp"
|
||||
|
||||
namespace hooked_methods
|
||||
{
|
||||
|
||||
DEFINE_HOOKED_METHOD(CanPacket, bool, INetChannel *this_)
|
||||
{
|
||||
return original::CanPacket(this_);
|
||||
}
|
||||
}
|
@ -7,18 +7,12 @@
|
||||
|
||||
#include "common.hpp"
|
||||
#include "hack.hpp"
|
||||
#include "MiscTemporary.hpp"
|
||||
|
||||
#include <link.h>
|
||||
|
||||
static CatVar minigun_jump(CV_SWITCH, "minigun_jump", "0", "TF2C minigun jump",
|
||||
"Allows jumping while shooting with minigun");
|
||||
#include "HookedMethods.hpp"
|
||||
|
||||
CatVar jointeam(CV_SWITCH, "fb_autoteam", "1",
|
||||
"Joins player team automatically (NYI)");
|
||||
CatVar joinclass(CV_STRING, "fb_autoclass", "spy",
|
||||
"Class that will be picked after joining a team (NYI)");
|
||||
|
||||
CatVar nolerp(CV_SWITCH, "nolerp", "0", "NoLerp mode (experimental)");
|
||||
|
||||
class CMoveData;
|
||||
namespace engine_prediction
|
||||
@ -36,9 +30,9 @@ void RunEnginePrediction(IClientEntity *ent, CUserCmd *ucmd)
|
||||
|
||||
void **predictionVtable = *((void ***) g_IPrediction);
|
||||
SetupMoveFn oSetupMove =
|
||||
(SetupMoveFn)(*(unsigned *) (predictionVtable + 19));
|
||||
(SetupMoveFn) (*(unsigned *) (predictionVtable + 19));
|
||||
FinishMoveFn oFinishMove =
|
||||
(FinishMoveFn)(*(unsigned *) (predictionVtable + 20));
|
||||
(FinishMoveFn) (*(unsigned *) (predictionVtable + 20));
|
||||
|
||||
// CMoveData *pMoveData = (CMoveData*)(sharedobj::client->lmap->l_addr +
|
||||
// 0x1F69C0C); CMoveData movedata {};
|
||||
@ -46,7 +40,7 @@ void RunEnginePrediction(IClientEntity *ent, CUserCmd *ucmd)
|
||||
CMoveData *pMoveData = (CMoveData *) object;
|
||||
|
||||
float frameTime = g_GlobalVars->frametime;
|
||||
float curTime = g_GlobalVars->curtime;
|
||||
float curTime = g_GlobalVars->curtime;
|
||||
|
||||
CUserCmd defaultCmd;
|
||||
if (ucmd == NULL)
|
||||
@ -57,76 +51,40 @@ void RunEnginePrediction(IClientEntity *ent, CUserCmd *ucmd)
|
||||
NET_VAR(ent, 4188, CUserCmd *) = ucmd;
|
||||
|
||||
g_GlobalVars->curtime =
|
||||
g_GlobalVars->interval_per_tick * NET_INT(ent, netvar.nTickBase);
|
||||
g_GlobalVars->interval_per_tick * NET_INT(ent, netvar.nTickBase);
|
||||
g_GlobalVars->frametime = g_GlobalVars->interval_per_tick;
|
||||
|
||||
*g_PredictionRandomSeed =
|
||||
MD5_PseudoRandom(g_pUserCmd->command_number) & 0x7FFFFFFF;
|
||||
MD5_PseudoRandom(g_pUserCmd->command_number) & 0x7FFFFFFF;
|
||||
g_IGameMovement->StartTrackPredictionErrors(
|
||||
reinterpret_cast<CBasePlayer *>(ent));
|
||||
reinterpret_cast<CBasePlayer *>(ent));
|
||||
oSetupMove(g_IPrediction, ent, ucmd, NULL, pMoveData);
|
||||
g_IGameMovement->ProcessMovement(reinterpret_cast<CBasePlayer *>(ent),
|
||||
pMoveData);
|
||||
oFinishMove(g_IPrediction, ent, ucmd, pMoveData);
|
||||
g_IGameMovement->FinishTrackPredictionErrors(
|
||||
reinterpret_cast<CBasePlayer *>(ent));
|
||||
reinterpret_cast<CBasePlayer *>(ent));
|
||||
|
||||
NET_VAR(ent, 4188, CUserCmd *) = nullptr;
|
||||
|
||||
g_GlobalVars->frametime = frameTime;
|
||||
g_GlobalVars->curtime = curTime;
|
||||
g_GlobalVars->curtime = curTime;
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
/*float o_curtime;
|
||||
float o_frametime;
|
||||
|
||||
void Start() {
|
||||
g_IGameMovement->StartTrackPredictionErrors((CBasePlayer*)(RAW_ENT(LOCAL_E)));
|
||||
|
||||
IClientEntity* player = RAW_ENT(LOCAL_E);
|
||||
// CPredictableId::ResetInstanceCounters();
|
||||
*(reinterpret_cast<CUserCmd*>(reinterpret_cast<uintptr_t>(player) + 1047)) =
|
||||
g_pUserCmd; o_curtime = g_GlobalVars->curtime; o_frametime =
|
||||
g_GlobalVars->frametime; *g_PredictionRandomSeed =
|
||||
MD5_PseudoRandom(g_pUserCmd->command_number) & 0x7FFFFFFF; g_GlobalVars->curtime
|
||||
= CE_INT(LOCAL_E, netvar.nTickBase) * g_GlobalVars->interval_per_tick;
|
||||
g_GlobalVars->frametime = g_GlobalVars->interval_per_tick;
|
||||
|
||||
CMoveData data;
|
||||
|
||||
}
|
||||
|
||||
void End() {
|
||||
*g_PredictionRandomSeed = -1;
|
||||
g_GlobalVars->curtime = o_curtime;
|
||||
g_GlobalVars->frametime = o_frametime;
|
||||
}*/
|
||||
}
|
||||
namespace hooked_methods
|
||||
{
|
||||
|
||||
static CatVar engine_pred(CV_SWITCH, "engine_prediction", "0",
|
||||
"Engine Prediction");
|
||||
static CatVar debug_projectiles(CV_SWITCH, "debug_projectiles", "0",
|
||||
"Debug Projectiles");
|
||||
|
||||
static CatVar fakelag_amount(CV_INT, "fakelag", "0", "Bad Fakelag");
|
||||
static CatVar serverlag_amount(
|
||||
CV_INT, "serverlag", "0", "serverlag",
|
||||
"Lag the server by spamming this many voicecommands per tick");
|
||||
CatVar semiauto(CV_INT, "semiauto", "0", "Semiauto");
|
||||
CatVar servercrash(CV_SWITCH, "servercrash", "0", "crash servers",
|
||||
"Crash servers by spamming signon net messages");
|
||||
bool *bSendPackets;
|
||||
bool CreateMove_hook(void *thisptr, float inputSample, CUserCmd *cmd)
|
||||
DEFINE_HOOKED_METHOD(CreateMove, bool, void *this_, float input_sample_time,
|
||||
CUserCmd *cmd)
|
||||
{
|
||||
uintptr_t **fp;
|
||||
__asm__("mov %%ebp, %0" : "=r"(fp));
|
||||
bSendPackets = reinterpret_cast<bool *>(**fp - 8);
|
||||
|
||||
g_Settings.is_create_move = true;
|
||||
static CreateMove_t original_method =
|
||||
(CreateMove_t) hooks::clientmode.GetMethod(offsets::CreateMove());
|
||||
bool time_replaced, ret, speedapplied;
|
||||
float curtime_old, servertime, speed, yaw;
|
||||
Vector vsilent, ang;
|
||||
@ -143,7 +101,7 @@ bool CreateMove_hook(void *thisptr, float inputSample, CUserCmd *cmd)
|
||||
}
|
||||
}
|
||||
|
||||
ret = original_method(thisptr, inputSample, cmd);
|
||||
ret = original::CreateMove(this_, input_sample_time, cmd);
|
||||
|
||||
PROF_SECTION(CreateMove);
|
||||
|
||||
@ -260,7 +218,7 @@ bool CreateMove_hook(void *thisptr, float inputSample, CUserCmd *cmd)
|
||||
{
|
||||
logging::Info("Trying to change CLASS");
|
||||
g_IEngine->ExecuteClientCmd(
|
||||
format("join_class ", joinclass.GetString()).c_str());
|
||||
format("join_class ", joinclass.GetString()).c_str());
|
||||
}
|
||||
team_joining_state = 0;
|
||||
}
|
||||
@ -482,7 +440,7 @@ bool CreateMove_hook(void *thisptr, float inputSample, CUserCmd *cmd)
|
||||
speedapplied = false;
|
||||
if (roll_speedhack &&
|
||||
g_IInputSystem->IsButtonDown(
|
||||
(ButtonCode_t)((int) roll_speedhack)) &&
|
||||
(ButtonCode_t)((int) roll_speedhack)) &&
|
||||
!(cmd->buttons & IN_ATTACK))
|
||||
{
|
||||
speed = cmd->forwardmove;
|
||||
@ -542,3 +500,30 @@ bool CreateMove_hook(void *thisptr, float inputSample, CUserCmd *cmd)
|
||||
g_Settings.is_create_move = false;
|
||||
return ret;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/*float o_curtime;
|
||||
float o_frametime;
|
||||
|
||||
void Start() {
|
||||
g_IGameMovement->StartTrackPredictionErrors((CBasePlayer*)(RAW_ENT(LOCAL_E)));
|
||||
|
||||
IClientEntity* player = RAW_ENT(LOCAL_E);
|
||||
// CPredictableId::ResetInstanceCounters();
|
||||
*(reinterpret_cast<CUserCmd*>(reinterpret_cast<uintptr_t>(player) + 1047)) =
|
||||
g_pUserCmd; o_curtime = g_GlobalVars->curtime; o_frametime =
|
||||
g_GlobalVars->frametime; *g_PredictionRandomSeed =
|
||||
MD5_PseudoRandom(g_pUserCmd->command_number) & 0x7FFFFFFF; g_GlobalVars->curtime
|
||||
= CE_INT(LOCAL_E, netvar.nTickBase) * g_GlobalVars->interval_per_tick;
|
||||
g_GlobalVars->frametime = g_GlobalVars->interval_per_tick;
|
||||
|
||||
CMoveData data;
|
||||
|
||||
}
|
||||
|
||||
void End() {
|
||||
*g_PredictionRandomSeed = -1;
|
||||
g_GlobalVars->curtime = o_curtime;
|
||||
g_GlobalVars->frametime = o_frametime;
|
||||
}*/
|
||||
|
272
src/hooks/DispatchUserMessage.cpp
Normal file
272
src/hooks/DispatchUserMessage.cpp
Normal file
@ -0,0 +1,272 @@
|
||||
/*
|
||||
Created by Jenny White on 29.04.18.
|
||||
Copyright (c) 2018 nullworks. All rights reserved.
|
||||
*/
|
||||
|
||||
#include <chatlog.hpp>
|
||||
#include <ucccccp.hpp>
|
||||
#include <boost/algorithm/string.hpp>
|
||||
#include <MiscTemporary.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");
|
||||
std::string clear = "";
|
||||
std::string lastfilter{};
|
||||
std::string lastname{};
|
||||
|
||||
namespace hooked_methods
|
||||
{
|
||||
|
||||
DEFINE_HOOKED_METHOD(DispatchUserMessage, bool, void *this_, int type,
|
||||
bf_read &buf)
|
||||
{
|
||||
if (retrun && gitgud.test_and_set(10000))
|
||||
{
|
||||
PrintChat("\x07%06X%s\x01: %s", 0xe05938, lastname.c_str(),
|
||||
lastfilter.c_str());
|
||||
retrun = false;
|
||||
}
|
||||
int loop_index, s, i, j;
|
||||
char *data, c;
|
||||
|
||||
if (type == 4)
|
||||
{
|
||||
loop_index = 0;
|
||||
s = buf.GetNumBytesLeft();
|
||||
if (s < 256)
|
||||
{
|
||||
data = (char *) alloca(s);
|
||||
for (i = 0; i < s; i++)
|
||||
data[i] = buf.ReadByte();
|
||||
j = 0;
|
||||
std::string name;
|
||||
std::string message;
|
||||
for (i = 0; i < 3; i++)
|
||||
{
|
||||
while ((c = data[j++]) && (loop_index < 128))
|
||||
{
|
||||
loop_index++;
|
||||
if (clean_chat)
|
||||
if ((c == '\n' || c == '\r') && (i == 1 || i == 2))
|
||||
data[j - 1] = '*';
|
||||
if (i == 1)
|
||||
name.push_back(c);
|
||||
if (i == 2)
|
||||
message.push_back(c);
|
||||
}
|
||||
}
|
||||
if (chat_filter_enabled && data[0] != LOCAL_E->m_IDX)
|
||||
{
|
||||
if (!strcmp(chat_filter.GetString(), ""))
|
||||
{
|
||||
std::string tmp = {};
|
||||
std::string tmp2 = {};
|
||||
int iii = 0;
|
||||
player_info_s info;
|
||||
g_IEngine->GetPlayerInfo(LOCAL_E->m_IDX, &info);
|
||||
std::string name1 = info.name;
|
||||
std::vector<std::string> name2{};
|
||||
std::vector<std::string> name3{};
|
||||
std::string claz = {};
|
||||
switch (g_pLocalPlayer->clazz)
|
||||
{
|
||||
case tf_scout:
|
||||
claz = "scout";
|
||||
break;
|
||||
case tf_soldier:
|
||||
claz = "soldier";
|
||||
break;
|
||||
case tf_pyro:
|
||||
claz = "pyro";
|
||||
break;
|
||||
case tf_demoman:
|
||||
claz = "demo";
|
||||
break;
|
||||
case tf_engineer:
|
||||
claz = "engi";
|
||||
break;
|
||||
case tf_heavy:
|
||||
claz = "heavy";
|
||||
break;
|
||||
case tf_medic:
|
||||
claz = "med";
|
||||
break;
|
||||
case tf_sniper:
|
||||
claz = "sniper";
|
||||
break;
|
||||
case tf_spy:
|
||||
claz = "spy";
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
for (char i : name1)
|
||||
{
|
||||
if (iii == 2)
|
||||
{
|
||||
iii = 0;
|
||||
tmp += i;
|
||||
name2.push_back(tmp);
|
||||
tmp = "";
|
||||
}
|
||||
else if (iii < 2)
|
||||
{
|
||||
iii++;
|
||||
tmp += i;
|
||||
}
|
||||
}
|
||||
iii = 0;
|
||||
for (char i : name1)
|
||||
{
|
||||
if (iii == 3)
|
||||
{
|
||||
iii = 0;
|
||||
tmp += i;
|
||||
name3.push_back(tmp2);
|
||||
tmp2 = "";
|
||||
}
|
||||
else if (iii < 3)
|
||||
{
|
||||
iii++;
|
||||
tmp2 += i;
|
||||
}
|
||||
}
|
||||
if (tmp.size() > 2)
|
||||
name2.push_back(tmp);
|
||||
if (tmp2.size() > 2)
|
||||
name3.push_back(tmp2);
|
||||
iii = 0;
|
||||
std::vector<std::string> res = {
|
||||
"skid", "script", "cheat", "hak", "hac", "f1",
|
||||
"hax", "vac", "ban", "lmao", "bot", "report",
|
||||
"cat", "insta", "revv", "brass", "kick", claz
|
||||
};
|
||||
for (auto i : name2)
|
||||
{
|
||||
boost::to_lower(i);
|
||||
res.push_back(i);
|
||||
}
|
||||
for (auto i : name3)
|
||||
{
|
||||
boost::to_lower(i);
|
||||
res.push_back(i);
|
||||
}
|
||||
std::string message2 = message;
|
||||
boost::to_lower(message2);
|
||||
boost::replace_all(message2, "4", "a");
|
||||
boost::replace_all(message2, "3", "e");
|
||||
boost::replace_all(message2, "0", "o");
|
||||
boost::replace_all(message2, "6", "g");
|
||||
boost::replace_all(message2, "5", "s");
|
||||
boost::replace_all(message2, "7", "t");
|
||||
for (auto filter : res)
|
||||
{
|
||||
if (retrun)
|
||||
break;
|
||||
if (boost::contains(message2, filter))
|
||||
{
|
||||
|
||||
if (clear == "")
|
||||
{
|
||||
for (int i = 0; i < 120; i++)
|
||||
clear += "\n";
|
||||
}
|
||||
*bSendPackets = true;
|
||||
chat_stack::Say(". " + clear, true);
|
||||
retrun = true;
|
||||
lastfilter = format(filter);
|
||||
lastname = format(name);
|
||||
}
|
||||
}
|
||||
}
|
||||
else if (data[0] != LOCAL_E->m_IDX)
|
||||
{
|
||||
std::string input = chat_filter.GetString();
|
||||
boost::to_lower(input);
|
||||
std::string message2 = message;
|
||||
std::vector<std::string> result{};
|
||||
boost::split(result, input, boost::is_any_of(","));
|
||||
boost::replace_all(message2, "4", "a");
|
||||
boost::replace_all(message2, "3", "e");
|
||||
boost::replace_all(message2, "0", "o");
|
||||
boost::replace_all(message2, "6", "g");
|
||||
boost::replace_all(message2, "5", "s");
|
||||
boost::replace_all(message2, "7", "t");
|
||||
for (auto filter : result)
|
||||
{
|
||||
if (retrun)
|
||||
break;
|
||||
if (boost::contains(message2, filter))
|
||||
{
|
||||
if (clear == "")
|
||||
{
|
||||
clear = "";
|
||||
for (int i = 0; i < 120; i++)
|
||||
clear += "\n";
|
||||
}
|
||||
*bSendPackets = true;
|
||||
chat_stack::Say(". " + clear, true);
|
||||
retrun = true;
|
||||
lastfilter = format(filter);
|
||||
lastname = format(name);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
if (sendmsg.test_and_set(300000) &&
|
||||
hacks::shared::antiaim::communicate)
|
||||
chat_stack::Say("!!meow");
|
||||
if (crypt_chat)
|
||||
{
|
||||
if (message.find("!!") == 0)
|
||||
{
|
||||
if (ucccccp::validate(message))
|
||||
{
|
||||
if (ucccccp::decrypt(message) == "meow" &&
|
||||
hacks::shared::antiaim::communicate &&
|
||||
data[0] != LOCAL_E->m_IDX &&
|
||||
playerlist::AccessData(ENTITY(data[0])).state !=
|
||||
playerlist::k_EState::CAT)
|
||||
{
|
||||
playerlist::AccessData(ENTITY(data[0])).state =
|
||||
playerlist::k_EState::CAT;
|
||||
chat_stack::Say("!!meow");
|
||||
}
|
||||
PrintChat("\x07%06X%s\x01: %s", 0xe05938, name.c_str(),
|
||||
ucccccp::decrypt(message).c_str());
|
||||
}
|
||||
}
|
||||
}
|
||||
chatlog::LogMessage(data[0], message);
|
||||
buf = bf_read(data, s);
|
||||
buf.Seek(0);
|
||||
}
|
||||
}
|
||||
if (dispatch_log)
|
||||
{
|
||||
logging::Info("D> %i", type);
|
||||
std::ostringstream str{};
|
||||
while (buf.GetNumBytesLeft())
|
||||
{
|
||||
unsigned char byte = buf.ReadByte();
|
||||
str << std::hex << std::setw(2) << std::setfill('0')
|
||||
<< static_cast<int>(byte) << ' ';
|
||||
}
|
||||
logging::Info("MESSAGE %d, DATA = [ %s ]", type, str.str().c_str());
|
||||
buf.Seek(0);
|
||||
}
|
||||
votelogger::user_message(buf, type);
|
||||
return original::DispatchUserMessage(this_, type, buf);
|
||||
}
|
||||
}
|
16
src/hooks/FireEvent.cpp
Normal file
16
src/hooks/FireEvent.cpp
Normal file
@ -0,0 +1,16 @@
|
||||
/*
|
||||
Created by Jenny White on 29.04.18.
|
||||
Copyright (c) 2018 nullworks. All rights reserved.
|
||||
*/
|
||||
|
||||
#include "HookedMethods.hpp"
|
||||
|
||||
namespace hooked_methods
|
||||
{
|
||||
|
||||
DEFINE_HOOKED_METHOD(FireEvent, bool, IGameEventManager2 *this_,
|
||||
IGameEvent *event, bool no_broadcast)
|
||||
{
|
||||
return original::FireEvent(this_, event, no_broadcast);
|
||||
}
|
||||
}
|
16
src/hooks/FireEventClientSide.cpp
Normal file
16
src/hooks/FireEventClientSide.cpp
Normal file
@ -0,0 +1,16 @@
|
||||
/*
|
||||
Created by Jenny White on 29.04.18.
|
||||
Copyright (c) 2018 nullworks. All rights reserved.
|
||||
*/
|
||||
|
||||
#include "HookedMethods.hpp"
|
||||
|
||||
namespace hooked_methods
|
||||
{
|
||||
|
||||
DEFINE_HOOKED_METHOD(FireEventClientSide, bool, IGameEventManager2 *this_,
|
||||
IGameEvent *event)
|
||||
{
|
||||
return original::FireEventClientSide(this_, event);
|
||||
}
|
||||
}
|
29
src/hooks/FireGameEvent.cpp
Normal file
29
src/hooks/FireGameEvent.cpp
Normal file
@ -0,0 +1,29 @@
|
||||
/*
|
||||
Created by Jenny White on 29.04.18.
|
||||
Copyright (c) 2018 nullworks. All rights reserved.
|
||||
*/
|
||||
|
||||
#include "HookedMethods.hpp"
|
||||
|
||||
namespace hooked_methods
|
||||
{
|
||||
|
||||
DEFINE_HOOKED_METHOD(FireGameEvent, void, void *this_, IGameEvent *event)
|
||||
{
|
||||
const char *name = event->GetName();
|
||||
if (name)
|
||||
{
|
||||
if (event_log)
|
||||
{
|
||||
if (!strcmp(name, "player_connect_client") ||
|
||||
!strcmp(name, "player_disconnect") ||
|
||||
!strcmp(name, "player_team"))
|
||||
{
|
||||
return;
|
||||
}
|
||||
}
|
||||
// hacks::tf2::killstreak::fire_event(event);
|
||||
}
|
||||
original::FireGameEvent(this_, event);
|
||||
}
|
||||
}
|
153
src/hooks/GetFriendPersonaName.cpp
Normal file
153
src/hooks/GetFriendPersonaName.cpp
Normal file
@ -0,0 +1,153 @@
|
||||
/*
|
||||
Created by Jenny White on 29.04.18.
|
||||
Copyright (c) 2018 nullworks. All rights reserved.
|
||||
*/
|
||||
|
||||
#include "HookedMethods.hpp"
|
||||
|
||||
static CatVar ipc_name(CV_STRING, "name_ipc", "", "IPC Name");
|
||||
|
||||
CatEnum namesteal_enum({ "OFF", "PASSIVE", "ACTIVE" });
|
||||
CatVar namesteal(namesteal_enum, "name_stealer", "0", "Name Stealer",
|
||||
"Attemt to steal your teammates names. Usefull for avoiding "
|
||||
"kicks\nPassive only changes when the name stolen is no "
|
||||
"longer the best name to use\nActive Attemps to change the "
|
||||
"name whenever possible");
|
||||
|
||||
static std::string stolen_name;
|
||||
|
||||
// Func to get a new entity to steal name from and returns true if a target has
|
||||
// been found
|
||||
bool StolenName()
|
||||
{
|
||||
|
||||
// Array to store potential namestealer targets with a bookkeeper to tell
|
||||
// how full it is
|
||||
int potential_targets[32];
|
||||
int potential_targets_length = 0;
|
||||
|
||||
// Go through entities looking for potential targets
|
||||
for (int i = 1; i < HIGHEST_ENTITY; i++)
|
||||
{
|
||||
CachedEntity *ent = ENTITY(i);
|
||||
|
||||
// Check if ent is a good target
|
||||
if (!ent)
|
||||
continue;
|
||||
if (ent == LOCAL_E)
|
||||
continue;
|
||||
if (!ent->m_Type == ENTITY_PLAYER)
|
||||
continue;
|
||||
if (ent->m_bEnemy)
|
||||
continue;
|
||||
|
||||
// Check if name is current one
|
||||
player_info_s info;
|
||||
if (g_IEngine->GetPlayerInfo(ent->m_IDX, &info))
|
||||
{
|
||||
|
||||
// If our name is the same as current, than change it
|
||||
if (std::string(info.name) == stolen_name)
|
||||
{
|
||||
// Since we found the ent we stole our name from and it is still
|
||||
// good, if user settings are passive, then we return true and
|
||||
// dont alter our name
|
||||
if ((int) namesteal == 1)
|
||||
{
|
||||
return true;
|
||||
// Otherwise we continue to change our name to something
|
||||
// else
|
||||
}
|
||||
else
|
||||
continue;
|
||||
}
|
||||
|
||||
// a ent without a name is no ent we need, contine for a different
|
||||
// one
|
||||
}
|
||||
else
|
||||
continue;
|
||||
|
||||
// Save the ent to our array
|
||||
potential_targets[potential_targets_length] = i;
|
||||
potential_targets_length++;
|
||||
|
||||
// With our maximum amount of players reached, dont search for anymore
|
||||
if (potential_targets_length >= 32)
|
||||
break;
|
||||
}
|
||||
|
||||
// Checks to prevent crashes
|
||||
if (potential_targets_length == 0)
|
||||
return false;
|
||||
|
||||
// Get random number that we can use with our array
|
||||
int target_random_num =
|
||||
floor(RandFloatRange(0, potential_targets_length - 0.1F));
|
||||
|
||||
// Get a idx from our random array position
|
||||
int new_target = potential_targets[target_random_num];
|
||||
|
||||
// Grab username of user
|
||||
player_info_s info;
|
||||
if (g_IEngine->GetPlayerInfo(new_target, &info))
|
||||
{
|
||||
|
||||
// If our name is the same as current, than change it and return true
|
||||
stolen_name = std::string(info.name);
|
||||
return true;
|
||||
}
|
||||
|
||||
// Didnt get playerinfo
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
namespace hooked_methods
|
||||
{
|
||||
|
||||
DEFINE_HOOKED_METHOD(GetFriendPersonaName, const char *, ISteamFriends *this_,
|
||||
CSteamID steam_id)
|
||||
{
|
||||
#if ENABLE_IPC
|
||||
if (ipc::peer)
|
||||
{
|
||||
static std::string namestr(ipc_name.GetString());
|
||||
namestr.assign(ipc_name.GetString());
|
||||
if (namestr.length() > 3)
|
||||
{
|
||||
ReplaceString(namestr, "%%", std::to_string(ipc::peer->client_id));
|
||||
return namestr.c_str();
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
// Check User settings if namesteal is allowed
|
||||
if (namesteal && steam_id == g_ISteamUser->GetSteamID())
|
||||
{
|
||||
|
||||
// We dont want to steal names while not in-game as there are no targets
|
||||
// to steal from. We want to be on a team as well to get teammates names
|
||||
if (g_IEngine->IsInGame() && g_pLocalPlayer->team)
|
||||
{
|
||||
|
||||
// Check if we have a username to steal, func automaticly steals a
|
||||
// name in it.
|
||||
if (StolenName())
|
||||
{
|
||||
|
||||
// Return the name that has changed from the func above
|
||||
return format(stolen_name, "\x0F").c_str();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if ((strlen(force_name.GetString()) > 1) &&
|
||||
steam_id == g_ISteamUser->GetSteamID())
|
||||
{
|
||||
|
||||
return force_name_newlined;
|
||||
}
|
||||
return original::GetFriendPersonaName(this_, steam_id);
|
||||
}
|
||||
}
|
42
src/hooks/GetUserCmd.cpp
Normal file
42
src/hooks/GetUserCmd.cpp
Normal file
@ -0,0 +1,42 @@
|
||||
/*
|
||||
Created by Jenny White on 29.04.18.
|
||||
Copyright (c) 2018 nullworks. All rights reserved.
|
||||
*/
|
||||
|
||||
#include "HookedMethods.hpp"
|
||||
|
||||
namespace hooked_methods
|
||||
{
|
||||
|
||||
DEFINE_HOOKED_METHOD(GetUserCmd, CUserCmd *, IInput *this_, int sequence_number)
|
||||
{
|
||||
CUserCmd *def = original::GetUserCmd(this_, sequence_number);
|
||||
int oldcmd;
|
||||
INetChannel *ch;
|
||||
|
||||
if (def == nullptr)
|
||||
return def;
|
||||
|
||||
if (command_number_mod.find(def->command_number) !=
|
||||
command_number_mod.end())
|
||||
{
|
||||
// logging::Info("Replacing command %i with %i", def->command_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(unsigned(def->command_number)) &
|
||||
0x7fffffff;
|
||||
command_number_mod.erase(command_number_mod.find(oldcmd));
|
||||
*(int *) ((unsigned) g_IBaseClientState +
|
||||
offsets::lastoutgoingcommand()) = def->command_number - 1;
|
||||
ch =
|
||||
(INetChannel *) g_IEngine
|
||||
->GetNetChannelInfo(); //*(INetChannel**)((unsigned)g_IBaseClientState
|
||||
//+ offsets::m_NetChannel());
|
||||
*(int *) ((unsigned) ch + offsets::m_nOutSequenceNr()) =
|
||||
def->command_number - 1;
|
||||
}
|
||||
return def;
|
||||
}
|
||||
}
|
125
src/hooks/LevelInit.cpp
Normal file
125
src/hooks/LevelInit.cpp
Normal file
@ -0,0 +1,125 @@
|
||||
/*
|
||||
Created by Jenny White on 29.04.18.
|
||||
Copyright (c) 2018 nullworks. All rights reserved.
|
||||
*/
|
||||
|
||||
#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
|
||||
{
|
||||
|
||||
DEFINE_HOOKED_METHOD(LevelInit, void, void *this_, const char *name)
|
||||
{
|
||||
playerlist::Save();
|
||||
votelogger::antikick_ticks = 0;
|
||||
hacks::shared::lagexploit::bcalled = false;
|
||||
#if ENABLE_VISUALS
|
||||
typedef bool *(*LoadNamedSkys_Fn)(const char *);
|
||||
uintptr_t addr = gSignatures.GetEngineSignature(
|
||||
"55 89 E5 57 31 FF 56 8D B5 ? ? ? ? 53 81 EC 6C 01 00 00");
|
||||
static LoadNamedSkys_Fn LoadNamedSkys = LoadNamedSkys_Fn(addr);
|
||||
bool succ;
|
||||
logging::Info("Going to load the skybox");
|
||||
#ifdef __clang__
|
||||
asm("movl %1, %%edi; push skynum[(int) skybox_changer]; call %%edi; mov "
|
||||
"%%eax, %0; add %%esp, 4h"
|
||||
: "=r"(succ)
|
||||
: "r"(LoadNamedSkys));
|
||||
#else
|
||||
succ = LoadNamedSkys(skynum[(int) skybox_changer]);
|
||||
#endif
|
||||
logging::Info("Loaded Skybox: %s", succ ? "true" : "false");
|
||||
ConVar *holiday = g_ICvar->FindVar("tf_forced_holiday");
|
||||
|
||||
if (halloween_mode)
|
||||
holiday->SetValue(2);
|
||||
else if (holiday->m_nValue == 2)
|
||||
holiday->SetValue(2);
|
||||
#endif
|
||||
|
||||
g_IEngine->ClientCmd_Unrestricted("exec cat_matchexec");
|
||||
hacks::shared::aimbot::Reset();
|
||||
chat_stack::Reset();
|
||||
hacks::shared::anticheat::ResetEverything();
|
||||
original::LevelInit(this_, name);
|
||||
hacks::shared::walkbot::OnLevelInit();
|
||||
#if ENABLE_IPC
|
||||
if (ipc::peer)
|
||||
{
|
||||
ipc::peer->memory->peer_user_data[ipc::peer->client_id].ts_connected =
|
||||
time(nullptr);
|
||||
}
|
||||
#endif
|
||||
}
|
||||
}
|
28
src/hooks/LevelShutdown.cpp
Normal file
28
src/hooks/LevelShutdown.cpp
Normal file
@ -0,0 +1,28 @@
|
||||
/*
|
||||
Created by Jenny White on 29.04.18.
|
||||
Copyright (c) 2018 nullworks. All rights reserved.
|
||||
*/
|
||||
|
||||
#include "HookedMethods.hpp"
|
||||
|
||||
namespace hooked_methods
|
||||
{
|
||||
|
||||
DEFINE_HOOKED_METHOD(LevelShutdown, void, void *this_)
|
||||
{
|
||||
need_name_change = true;
|
||||
playerlist::Save();
|
||||
g_Settings.bInvalid = true;
|
||||
hacks::shared::aimbot::Reset();
|
||||
chat_stack::Reset();
|
||||
hacks::shared::anticheat::ResetEverything();
|
||||
#if ENABLE_IPC
|
||||
if (ipc::peer)
|
||||
{
|
||||
ipc::peer->memory->peer_user_data[ipc::peer->client_id]
|
||||
.ts_disconnected = time(nullptr);
|
||||
}
|
||||
#endif
|
||||
return original::LevelShutdown(this_);
|
||||
}
|
||||
}
|
11
src/hooks/Paint.cpp
Executable file → Normal file
11
src/hooks/Paint.cpp
Executable file → Normal file
@ -12,11 +12,11 @@
|
||||
static CatVar cursor_fix_experimental(CV_SWITCH, "experimental_cursor_fix", "1",
|
||||
"Cursor fix");
|
||||
|
||||
void Paint_hook(IEngineVGui *_this, PaintMode_t mode)
|
||||
namespace hooked_methods
|
||||
{
|
||||
static const Paint_t original = (Paint_t) hooks::enginevgui.GetMethod(
|
||||
offsets::PlatformOffset(14, offsets::undefined, offsets::undefined));
|
||||
|
||||
DEFINE_HOOKED_METHOD(Paint, void, IEngineVGui *this_, PaintMode_t mode)
|
||||
{
|
||||
if (!g_IEngine->IsInGame())
|
||||
g_Settings.bInvalid = true;
|
||||
|
||||
@ -61,7 +61,7 @@ void Paint_hook(IEngineVGui *_this, PaintMode_t mode)
|
||||
// logging::Info("executing %s",
|
||||
// hack::command_stack().top().c_str());
|
||||
g_IEngine->ClientCmd_Unrestricted(
|
||||
hack::command_stack().top().c_str());
|
||||
hack::command_stack().top().c_str());
|
||||
hack::command_stack().pop();
|
||||
}
|
||||
}
|
||||
@ -88,5 +88,6 @@ void Paint_hook(IEngineVGui *_this, PaintMode_t mode)
|
||||
#endif
|
||||
}
|
||||
|
||||
original(_this, mode);
|
||||
return original::Paint(this_, mode);
|
||||
}
|
||||
}
|
106
src/hooks/SendNetMsg.cpp
Normal file
106
src/hooks/SendNetMsg.cpp
Normal file
@ -0,0 +1,106 @@
|
||||
/*
|
||||
Created by Jenny White on 29.04.18.
|
||||
Copyright (c) 2018 nullworks. All rights reserved.
|
||||
*/
|
||||
|
||||
#include <ucccccp.hpp>
|
||||
#include <MiscTemporary.hpp>
|
||||
#include "HookedMethods.hpp"
|
||||
|
||||
static CatVar newlines_msg(CV_INT, "chat_newlines", "0", "Prefix newlines",
|
||||
"Add # newlines before each your message", 0, 24);
|
||||
|
||||
|
||||
static CatVar log_sent(CV_SWITCH, "debug_log_sent_messages", "0",
|
||||
"Log sent messages");
|
||||
static CatVar airstuck(CV_KEY, "airstuck", "0", "Airstuck", "");
|
||||
|
||||
namespace hooked_methods
|
||||
{
|
||||
|
||||
DEFINE_HOOKED_METHOD(SendNetMsg, bool, INetChannel *this_, INetMessage &msg,
|
||||
bool force_reliable, bool voice)
|
||||
{
|
||||
size_t say_idx, say_team_idx;
|
||||
int offset;
|
||||
std::string newlines;
|
||||
NET_StringCmd stringcmd;
|
||||
|
||||
// net_StringCmd
|
||||
if (msg.GetType() == 4 && (newlines_msg || crypt_chat))
|
||||
{
|
||||
std::string str(msg.ToString());
|
||||
say_idx = str.find("net_StringCmd: \"say \"");
|
||||
say_team_idx = str.find("net_StringCmd: \"say_team \"");
|
||||
if (!say_idx || !say_team_idx)
|
||||
{
|
||||
offset = say_idx ? 26 : 21;
|
||||
bool crpt = false;
|
||||
if (crypt_chat)
|
||||
{
|
||||
std::string msg(str.substr(offset));
|
||||
msg = msg.substr(0, msg.length() - 2);
|
||||
if (msg.find("!!") == 0)
|
||||
{
|
||||
msg = ucccccp::encrypt(msg.substr(2));
|
||||
str = str.substr(0, offset) + msg + "\"\"";
|
||||
crpt = true;
|
||||
}
|
||||
}
|
||||
if (!crpt && newlines_msg)
|
||||
{
|
||||
// TODO move out? update in a value change callback?
|
||||
newlines = std::string((int) newlines_msg, '\n');
|
||||
str.insert(offset, newlines);
|
||||
}
|
||||
str = str.substr(16, str.length() - 17);
|
||||
// if (queue_messages && !chat_stack::CanSend()) {
|
||||
stringcmd.m_szCommand = str.c_str();
|
||||
return original::SendNetMsg(this_, stringcmd, force_reliable, voice);
|
||||
//}
|
||||
}
|
||||
}
|
||||
static ConVar *sv_player_usercommand_timeout =
|
||||
g_ICvar->FindVar("sv_player_usercommand_timeout");
|
||||
static float lastcmd = 0.0f;
|
||||
if (lastcmd > g_GlobalVars->absoluteframetime)
|
||||
{
|
||||
lastcmd = g_GlobalVars->absoluteframetime;
|
||||
}
|
||||
if (airstuck.KeyDown() && !g_Settings.bInvalid)
|
||||
{
|
||||
if (CE_GOOD(LOCAL_E))
|
||||
{
|
||||
if (lastcmd + sv_player_usercommand_timeout->GetFloat() - 0.1f <
|
||||
g_GlobalVars->curtime)
|
||||
{
|
||||
if (msg.GetType() == clc_Move)
|
||||
return false;
|
||||
}
|
||||
else
|
||||
{
|
||||
lastcmd = g_GlobalVars->absoluteframetime;
|
||||
}
|
||||
}
|
||||
}
|
||||
if (log_sent && msg.GetType() != 3 && msg.GetType() != 9)
|
||||
{
|
||||
logging::Info("=> %s [%i] %s", msg.GetName(), msg.GetType(),
|
||||
msg.ToString());
|
||||
unsigned char buf[4096];
|
||||
bf_write buffer("cathook_debug_buffer", buf, 4096);
|
||||
logging::Info("Writing %i", msg.WriteToBuffer(buffer));
|
||||
std::string bytes = "";
|
||||
constexpr char h2c[] = "0123456789abcdef";
|
||||
for (int i = 0; i < buffer.GetNumBytesWritten(); i++)
|
||||
{
|
||||
// bytes += format(h2c[(buf[i] & 0xF0) >> 4], h2c[(buf[i] & 0xF)], '
|
||||
// ');
|
||||
bytes += format((unsigned short) buf[i], ' ');
|
||||
}
|
||||
logging::Info("%i bytes => %s", buffer.GetNumBytesWritten(),
|
||||
bytes.c_str());
|
||||
}
|
||||
return original::SendNetMsg(this_, msg, force_reliable, voice);
|
||||
}
|
||||
}
|
44
src/hooks/Shutdown.cpp
Normal file
44
src/hooks/Shutdown.cpp
Normal file
@ -0,0 +1,44 @@
|
||||
/*
|
||||
Created by Jenny White on 29.04.18.
|
||||
Copyright (c) 2018 nullworks. All rights reserved.
|
||||
*/
|
||||
|
||||
#include "HookedMethods.hpp"
|
||||
|
||||
static CatVar die_if_vac(CV_SWITCH, "die_if_vac", "0", "Die if VAC banned");
|
||||
|
||||
namespace hooked_methods
|
||||
{
|
||||
|
||||
DEFINE_HOOKED_METHOD(Shutdown, void, INetChannel *this_, const char *reason)
|
||||
{
|
||||
g_Settings.bInvalid = true;
|
||||
// This is a INetChannel hook - it SHOULDN'T be static because netchannel
|
||||
// changes.
|
||||
logging::Info("Disconnect: %s", reason);
|
||||
if (strstr(reason, "banned"))
|
||||
{
|
||||
if (die_if_vac)
|
||||
{
|
||||
logging::Info("VAC banned");
|
||||
*(int *) 0 = 0;
|
||||
exit(1);
|
||||
}
|
||||
}
|
||||
#if ENABLE_IPC
|
||||
ipc::UpdateServerAddress(true);
|
||||
#endif
|
||||
if (cathook && (disconnect_reason.convar_parent->m_StringLength > 3) &&
|
||||
strstr(reason, "user"))
|
||||
{
|
||||
original::Shutdown(this_, disconnect_reason_newlined);
|
||||
}
|
||||
else
|
||||
{
|
||||
original::Shutdown(this_, reason);
|
||||
}
|
||||
|
||||
if (hacks::shared::autojoin::auto_queue)
|
||||
tfmm::queue_start();
|
||||
}
|
||||
}
|
1035
src/hooks/others.cpp
1035
src/hooks/others.cpp
File diff suppressed because it is too large
Load Diff
@ -1,133 +0,0 @@
|
||||
/*
|
||||
* sdl.cpp
|
||||
*
|
||||
* Created on: May 19, 2017
|
||||
* Author: nullifiedcat
|
||||
*/
|
||||
|
||||
#include "common.hpp"
|
||||
|
||||
#include "hooks/hookedmethods.hpp"
|
||||
#include "hack.hpp"
|
||||
|
||||
#include <SDL2/SDL.h>
|
||||
#include <SDL2/SDL_syswm.h>
|
||||
#include <SDL2/SDL_events.h>
|
||||
#include <GL/glew.h>
|
||||
#include <GL/gl.h>
|
||||
#include <X11/Xlib.h>
|
||||
#include <GL/glx.h>
|
||||
|
||||
SDL_Window *sdl_current_window{ nullptr };
|
||||
SDL_GL_SwapWindow_t *SDL_GL_SwapWindow_loc{ nullptr };
|
||||
SDL_GL_SwapWindow_t SDL_GL_SwapWindow_o{ nullptr };
|
||||
|
||||
SDL_PollEvent_t *SDL_PollEvent_loc{ nullptr };
|
||||
SDL_PollEvent_t SDL_PollEvent_o{ nullptr };
|
||||
|
||||
typedef uint32_t (*SDL_GetWindowFlags_t)(SDL_Window *window);
|
||||
|
||||
SDL_GetWindowFlags_t *SDL_GetWindowFlags_loc{ nullptr };
|
||||
SDL_GetWindowFlags_t SDL_GetWindowFlags_o{ nullptr };
|
||||
|
||||
uint32_t SDL_GetWindowFlags_hook(SDL_Window *window)
|
||||
{
|
||||
uint32_t flags = SDL_GetWindowFlags_o(window);
|
||||
flags &= ~(SDL_WINDOW_MINIMIZED | SDL_WINDOW_HIDDEN);
|
||||
flags |= SDL_WINDOW_SHOWN;
|
||||
return flags;
|
||||
}
|
||||
|
||||
void SDL_GL_SwapWindow_hook(SDL_Window *window)
|
||||
{
|
||||
static SDL_SysWMinfo wminfo;
|
||||
wminfo.version.major = 2;
|
||||
wminfo.version.minor = 0;
|
||||
typedef SDL_bool (*SDL_GetWindowWMInfo_t)(SDL_Window * window,
|
||||
SDL_SysWMinfo * info);
|
||||
static SDL_GetWindowWMInfo_t GetWindowWMInfo =
|
||||
*reinterpret_cast<SDL_GetWindowWMInfo_t *>(
|
||||
sharedobj::libsdl().Pointer(0xFD4D8));
|
||||
static bool init_wminfo{ false };
|
||||
if (!init_wminfo)
|
||||
{
|
||||
GetWindowWMInfo(window, &wminfo);
|
||||
init_wminfo = true;
|
||||
}
|
||||
if (!sdl_current_window)
|
||||
sdl_current_window = window;
|
||||
|
||||
static bool init{ false };
|
||||
|
||||
static SDL_GLContext tf2_sdl = SDL_GL_GetCurrentContext();
|
||||
|
||||
if (cathook && !disable_visuals)
|
||||
{
|
||||
PROF_SECTION(SWAPWINDOW_cathook);
|
||||
if (not init)
|
||||
{
|
||||
draw_api::initialize();
|
||||
init = true;
|
||||
}
|
||||
render_cheat_visuals();
|
||||
}
|
||||
{
|
||||
PROF_SECTION(SWAPWINDOW_tf2);
|
||||
SDL_GL_MakeCurrent(window, tf2_sdl);
|
||||
SDL_GL_SwapWindow_o(window);
|
||||
// glXMakeContextCurrent(wminfo.info.x11.display,
|
||||
// wminfo.info.x11.window,
|
||||
// wminfo.info.x11.window, tf2);
|
||||
// glXSwapBuffers(wminfo.info.x11.display, wminfo.info.x11.window);
|
||||
}
|
||||
}
|
||||
|
||||
int SDL_PollEvent_hook(SDL_Event *event)
|
||||
{
|
||||
int ret = SDL_PollEvent_o(event);
|
||||
if (ret)
|
||||
{
|
||||
logging::Info("event %x %x", event->type, event->common.type);
|
||||
if (event->type == SDL_WINDOWEVENT)
|
||||
{
|
||||
switch (event->window.event)
|
||||
{
|
||||
case SDL_WINDOWEVENT_HIDDEN:
|
||||
logging::Info("Window hidden");
|
||||
return 0;
|
||||
case SDL_WINDOWEVENT_MINIMIZED:
|
||||
logging::Info("Window minimized");
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
|
||||
void DoSDLHooking()
|
||||
{
|
||||
SDL_GL_SwapWindow_loc = reinterpret_cast<SDL_GL_SwapWindow_t *>(
|
||||
sharedobj::libsdl().Pointer(0xFD648));
|
||||
|
||||
SDL_GL_SwapWindow_o = *SDL_GL_SwapWindow_loc;
|
||||
*SDL_GL_SwapWindow_loc = SDL_GL_SwapWindow_hook;
|
||||
|
||||
// SDL_GetWindowFlags_loc =
|
||||
// reinterpret_cast<SDL_GetWindowFlags_t*>(sharedobj::libsdl().Pointer(0xFD588));
|
||||
|
||||
// SDL_GetWindowFlags_o = *SDL_GetWindowFlags_loc;
|
||||
// *SDL_GetWindowFlags_loc = SDL_GetWindowFlags_hook;
|
||||
|
||||
// SDL_PollEvent_loc =
|
||||
// reinterpret_cast<SDL_PollEvent_t*>(sharedobj::libsdl().Pointer(0xFCF64));
|
||||
|
||||
// SDL_PollEvent_o = *SDL_PollEvent_loc;
|
||||
// *SDL_PollEvent_loc = SDL_PollEvent_hook;
|
||||
}
|
||||
|
||||
void DoSDLUnhooking()
|
||||
{
|
||||
*SDL_GL_SwapWindow_loc = SDL_GL_SwapWindow_o;
|
||||
// *SDL_GetWindowFlags_loc = SDL_GetWindowFlags_o;
|
||||
// *SDL_PollEvent_loc = SDL_PollEvent_o;
|
||||
}
|
15
src/hooks/visual/BeginFrame.cpp
Normal file
15
src/hooks/visual/BeginFrame.cpp
Normal file
@ -0,0 +1,15 @@
|
||||
/*
|
||||
Created by Jenny White on 29.04.18.
|
||||
Copyright (c) 2018 nullworks. All rights reserved.
|
||||
*/
|
||||
|
||||
#include "HookedMethods.hpp"
|
||||
|
||||
namespace hooked_methods
|
||||
{
|
||||
|
||||
DEFINE_HOOKED_METHOD(BeginFrame, void, IStudioRender *this_)
|
||||
{
|
||||
return original::BeginFrame(this_);
|
||||
}
|
||||
}
|
10
src/hooks/visual/CMakeLists.txt
Normal file
10
src/hooks/visual/CMakeLists.txt
Normal file
@ -0,0 +1,10 @@
|
||||
target_sources(cathook PRIVATE
|
||||
"${CMAKE_CURRENT_LIST_DIR}/BeginFrame.cpp"
|
||||
"${CMAKE_CURRENT_LIST_DIR}/DrawModelExecute.cpp"
|
||||
"${CMAKE_CURRENT_LIST_DIR}/FrameStageNotify.cpp"
|
||||
"${CMAKE_CURRENT_LIST_DIR}/OverrideView.cpp"
|
||||
"${CMAKE_CURRENT_LIST_DIR}/PaintTraverse.cpp"
|
||||
"${CMAKE_CURRENT_LIST_DIR}/RandomInt.cpp"
|
||||
"${CMAKE_CURRENT_LIST_DIR}/SDL_GL_SwapWindow.cpp"
|
||||
"${CMAKE_CURRENT_LIST_DIR}/SDL_PollEvent.cpp"
|
||||
"${CMAKE_CURRENT_LIST_DIR}/IN_KeyEvent.cpp")
|
76
src/hooks/visual/DrawModelExecute.cpp
Normal file
76
src/hooks/visual/DrawModelExecute.cpp
Normal file
@ -0,0 +1,76 @@
|
||||
/*
|
||||
Created by Jenny White on 29.04.18.
|
||||
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
|
||||
{
|
||||
|
||||
DEFINE_HOOKED_METHOD(DrawModelExecute, void, IVModelRender *this_,
|
||||
const DrawModelState_t &state,
|
||||
const ModelRenderInfo_t &info, matrix3x4_t *bone)
|
||||
{
|
||||
static const char *name;
|
||||
static std::string sname;
|
||||
static IClientUnknown *unk;
|
||||
static IClientEntity *ent;
|
||||
|
||||
if (!cathook ||
|
||||
!(spectator_target || no_arms || no_hats ||
|
||||
(clean_screenshots && g_IEngine->IsTakingScreenshot())))
|
||||
{
|
||||
return original::DrawModelExecute(this_, state, info, bone);
|
||||
}
|
||||
|
||||
PROF_SECTION(DrawModelExecute);
|
||||
|
||||
if (no_arms || no_hats)
|
||||
{
|
||||
if (info.pModel)
|
||||
{
|
||||
name = g_IModelInfo->GetModelName(info.pModel);
|
||||
if (name)
|
||||
{
|
||||
sname = name;
|
||||
if (no_arms && sname.find("arms") != std::string::npos)
|
||||
{
|
||||
return;
|
||||
}
|
||||
else if (no_hats &&
|
||||
sname.find("player/items") != std::string::npos)
|
||||
{
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
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;
|
||||
}
|
||||
}
|
||||
|
||||
return original::DrawModelExecute(this_, state, info, bone);
|
||||
}
|
||||
}
|
132
src/hooks/visual/FrameStageNotify.cpp
Normal file
132
src/hooks/visual/FrameStageNotify.cpp
Normal file
@ -0,0 +1,132 @@
|
||||
/*
|
||||
Created by Jenny White on 29.04.18.
|
||||
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
|
||||
{
|
||||
|
||||
DEFINE_HOOKED_METHOD(FrameStageNotify, void, void *this_,
|
||||
ClientFrameStage_t stage)
|
||||
{
|
||||
if (nightmode)
|
||||
{
|
||||
static int OldNightmode = 0;
|
||||
if (OldNightmode != (int) nightmode)
|
||||
{
|
||||
|
||||
static ConVar *r_DrawSpecificStaticProp =
|
||||
g_ICvar->FindVar("r_DrawSpecificStaticProp");
|
||||
if (!r_DrawSpecificStaticProp)
|
||||
{
|
||||
r_DrawSpecificStaticProp =
|
||||
g_ICvar->FindVar("r_DrawSpecificStaticProp");
|
||||
return;
|
||||
}
|
||||
r_DrawSpecificStaticProp->SetValue(0);
|
||||
|
||||
for (MaterialHandle_t i = g_IMaterialSystem->FirstMaterial();
|
||||
i != g_IMaterialSystem->InvalidMaterial();
|
||||
i = g_IMaterialSystem->NextMaterial(i))
|
||||
{
|
||||
IMaterial *pMaterial = g_IMaterialSystem->GetMaterial(i);
|
||||
|
||||
if (!pMaterial)
|
||||
continue;
|
||||
if (strstr(pMaterial->GetTextureGroupName(), "World") ||
|
||||
strstr(pMaterial->GetTextureGroupName(), "StaticProp"))
|
||||
{
|
||||
if (nightmode)
|
||||
if (strstr(pMaterial->GetTextureGroupName(),
|
||||
"StaticProp"))
|
||||
pMaterial->ColorModulate(0.3f, 0.3f, 0.3f);
|
||||
else
|
||||
pMaterial->ColorModulate(0.05f, 0.05f, 0.05f);
|
||||
else
|
||||
pMaterial->ColorModulate(1.0f, 1.0f, 1.0f);
|
||||
}
|
||||
}
|
||||
OldNightmode = nightmode;
|
||||
}
|
||||
}
|
||||
static IClientEntity *ent;
|
||||
|
||||
PROF_SECTION(FrameStageNotify_TOTAL);
|
||||
|
||||
if (!g_IEngine->IsInGame())
|
||||
g_Settings.bInvalid = true;
|
||||
{
|
||||
PROF_SECTION(FSN_skinchanger);
|
||||
hacks::tf2::skinchanger::FrameStageNotify(stage);
|
||||
}
|
||||
if (resolver && cathook && !g_Settings.bInvalid &&
|
||||
stage == FRAME_NET_UPDATE_POSTDATAUPDATE_START)
|
||||
{
|
||||
PROF_SECTION(FSN_resolver);
|
||||
for (int i = 1; i < 32 && i < HIGHEST_ENTITY; i++)
|
||||
{
|
||||
if (i == g_IEngine->GetLocalPlayer())
|
||||
continue;
|
||||
ent = g_IEntityList->GetClientEntity(i);
|
||||
if (ent && !ent->IsDormant() && !NET_BYTE(ent, netvar.iLifeState))
|
||||
{
|
||||
Vector &angles = NET_VECTOR(ent, netvar.m_angEyeAngles);
|
||||
if (angles.x >= 90)
|
||||
angles.x = -89;
|
||||
if (angles.x <= -90)
|
||||
angles.x = 89;
|
||||
angles.y = fmod(angles.y + 180.0f, 360.0f);
|
||||
if (angles.y < 0)
|
||||
angles.y += 360.0f;
|
||||
angles.y -= 180.0f;
|
||||
}
|
||||
}
|
||||
}
|
||||
if (cathook && stage == FRAME_RENDER_START)
|
||||
{
|
||||
INetChannel *ch;
|
||||
ch = (INetChannel *) g_IEngine->GetNetChannelInfo();
|
||||
if (ch && !hooks::IsHooked((void *) ch))
|
||||
{
|
||||
hooks::netchannel.Set(ch);
|
||||
hooks::netchannel.HookMethod(HOOK_ARGS(CanPacket));
|
||||
hooks::netchannel.HookMethod(HOOK_ARGS(SendNetMsg));
|
||||
hooks::netchannel.HookMethod(HOOK_ARGS(Shutdown));
|
||||
hooks::netchannel.Apply();
|
||||
#if ENABLE_IPC
|
||||
ipc::UpdateServerAddress();
|
||||
#endif
|
||||
}
|
||||
}
|
||||
if (cathook && !g_Settings.bInvalid && stage == FRAME_RENDER_START)
|
||||
{
|
||||
IF_GAME(IsTF())
|
||||
{
|
||||
if (CE_GOOD(LOCAL_E) && no_zoom)
|
||||
RemoveCondition<TFCond_Zoomed>(LOCAL_E);
|
||||
}
|
||||
if (force_thirdperson && !g_pLocalPlayer->life_state &&
|
||||
CE_GOOD(g_pLocalPlayer->entity))
|
||||
{
|
||||
CE_INT(g_pLocalPlayer->entity, netvar.nForceTauntCam) = 1;
|
||||
}
|
||||
if (stage == 5 && show_antiaim && g_IInput->CAM_IsThirdPerson())
|
||||
{
|
||||
if (CE_GOOD(g_pLocalPlayer->entity))
|
||||
{
|
||||
CE_FLOAT(g_pLocalPlayer->entity, netvar.deadflag + 4) =
|
||||
g_Settings.last_angles.x;
|
||||
CE_FLOAT(g_pLocalPlayer->entity, netvar.deadflag + 8) =
|
||||
g_Settings.last_angles.y;
|
||||
}
|
||||
}
|
||||
}
|
||||
return original::FrameStageNotify(this_, stage);
|
||||
}
|
||||
}
|
23
src/hooks/visual/IN_KeyEvent.cpp
Normal file
23
src/hooks/visual/IN_KeyEvent.cpp
Normal file
@ -0,0 +1,23 @@
|
||||
/*
|
||||
Created by Jenny White on 29.04.18.
|
||||
Copyright (c) 2018 nullworks. All rights reserved.
|
||||
*/
|
||||
|
||||
#include "HookedMethods.hpp"
|
||||
|
||||
namespace hooked_methods
|
||||
{
|
||||
|
||||
DEFINE_HOOKED_METHOD(IN_KeyEvent, int, void *this_, int eventcode,
|
||||
ButtonCode_t keynum, const char *binding)
|
||||
{
|
||||
#if ENABLE_GUI
|
||||
/*
|
||||
if (g_pGUI->ConsumesKey((ButtonCode_t)keynum) && g_pGUI->Visible()) {
|
||||
return 0;
|
||||
}
|
||||
*/
|
||||
#endif
|
||||
return original::IN_KeyEvent(this_, eventcode, keynum, binding);
|
||||
}
|
||||
}
|
92
src/hooks/visual/OverrideView.cpp
Normal file
92
src/hooks/visual/OverrideView.cpp
Normal file
@ -0,0 +1,92 @@
|
||||
/*
|
||||
Created by Jenny White on 29.04.18.
|
||||
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
|
||||
{
|
||||
|
||||
DEFINE_HOOKED_METHOD(OverrideView, void, void *this_, CViewSetup *setup)
|
||||
{
|
||||
static bool zoomed;
|
||||
original::OverrideView(this_, setup);
|
||||
if (!cathook)
|
||||
return;
|
||||
if (g_pLocalPlayer->bZoomed && override_fov_zoomed)
|
||||
{
|
||||
setup->fov = override_fov_zoomed;
|
||||
}
|
||||
else
|
||||
{
|
||||
if (override_fov)
|
||||
{
|
||||
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 (g_IInputSystem->IsButtonDown(ButtonCode_t::KEY_SPACE))
|
||||
{
|
||||
spectator_target = 0;
|
||||
}
|
||||
}
|
||||
|
||||
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;
|
||||
}
|
||||
}
|
@ -1,15 +1,9 @@
|
||||
/*
|
||||
* PaintTraverse.cpp
|
||||
*
|
||||
* Created on: Jan 8, 2017
|
||||
* Author: nullifiedcat
|
||||
*/
|
||||
Created by Jenny White on 29.04.18.
|
||||
Copyright (c) 2018 nullworks. All rights reserved.
|
||||
*/
|
||||
|
||||
#include "common.hpp"
|
||||
|
||||
#if ENABLE_GUI
|
||||
#include "GUI.h"
|
||||
#endif
|
||||
#include "HookedMethods.hpp"
|
||||
|
||||
CatVar clean_screenshots(CV_SWITCH, "clean_screenshots", "1",
|
||||
"Clean screenshots",
|
||||
@ -26,14 +20,16 @@ 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");
|
||||
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)
|
||||
namespace hooked_methods
|
||||
{
|
||||
|
||||
DEFINE_HOOKED_METHOD(PaintTraverse, void, vgui::IPanel *this_,
|
||||
unsigned int panel, bool force, bool allow_force)
|
||||
{
|
||||
static const PaintTraverse_t original =
|
||||
(PaintTraverse_t) hooks::panel.GetMethod(offsets::PaintTraverse());
|
||||
static bool textures_loaded = false;
|
||||
static unsigned long panel_focus = 0;
|
||||
static unsigned long panel_scope = 0;
|
||||
@ -58,9 +54,9 @@ void PaintTraverse_hook(void *_this, unsigned int vp, bool fr, bool ar)
|
||||
if (!pure_addr)
|
||||
{
|
||||
pure_addr = *reinterpret_cast<void ***>(
|
||||
gSignatures.GetEngineSignature(
|
||||
"A1 ? ? ? ? 85 C0 74 ? C7 44 24 ? ? ? ? ? 89 04 24") +
|
||||
1);
|
||||
gSignatures.GetEngineSignature(
|
||||
"A1 ? ? ? ? 85 C0 74 ? C7 44 24 ? ? ? ? ? 89 04 24") +
|
||||
1);
|
||||
}
|
||||
if (*pure_addr)
|
||||
pure_orig = *pure_addr;
|
||||
@ -72,7 +68,7 @@ void PaintTraverse_hook(void *_this, unsigned int vp, bool fr, bool ar)
|
||||
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)
|
||||
@ -105,44 +101,44 @@ void PaintTraverse_hook(void *_this, unsigned int vp, bool fr, bool ar)
|
||||
}
|
||||
|
||||
if (call_default)
|
||||
original(_this, vp, fr, ar);
|
||||
original::PaintTraverse(this_, panel, force, allow_force);
|
||||
// To avoid threading problems.
|
||||
|
||||
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())
|
||||
@ -150,7 +146,7 @@ void PaintTraverse_hook(void *_this, unsigned int vp, bool fr, bool ar)
|
||||
g_Settings.bInvalid = true;
|
||||
}
|
||||
|
||||
if (vp != panel_focus)
|
||||
if (panel != panel_focus)
|
||||
return;
|
||||
g_IPanel->SetTopmostPopup(panel_focus, true);
|
||||
if (!draw_flag)
|
||||
@ -168,3 +164,4 @@ void PaintTraverse_hook(void *_this, unsigned int vp, bool fr, bool ar)
|
||||
PROF_SECTION(PT_active);
|
||||
draw::UpdateWTS();
|
||||
}
|
||||
}
|
22
src/hooks/visual/RandomInt.cpp
Normal file
22
src/hooks/visual/RandomInt.cpp
Normal file
@ -0,0 +1,22 @@
|
||||
/*
|
||||
Created by Jenny White on 29.04.18.
|
||||
Copyright (c) 2018 nullworks. All rights reserved.
|
||||
*/
|
||||
|
||||
#include "HookedMethods.hpp"
|
||||
|
||||
static CatVar medal_flip(CV_SWITCH, "medal_flip", "0", "Infinite Medal Flip",
|
||||
"");
|
||||
|
||||
namespace hooked_methods
|
||||
{
|
||||
|
||||
DEFINE_HOOKED_METHOD(RandomInt, int, IUniformRandomStream *this_, int min,
|
||||
int max)
|
||||
{
|
||||
if (medal_flip && min == 0 && max == 9)
|
||||
return 0;
|
||||
|
||||
return original::RandomInt(this_, min, max);
|
||||
}
|
||||
}
|
57
src/hooks/visual/SDL_GL_SwapWindow.cpp
Normal file
57
src/hooks/visual/SDL_GL_SwapWindow.cpp
Normal file
@ -0,0 +1,57 @@
|
||||
/*
|
||||
Created by Jenny White on 29.04.18.
|
||||
Copyright (c) 2018 nullworks. All rights reserved.
|
||||
*/
|
||||
|
||||
#include <SDL_syswm.h>
|
||||
#include <MiscTemporary.hpp>
|
||||
#include <visual/SDLHooks.hpp>
|
||||
#include "HookedMethods.hpp"
|
||||
|
||||
namespace hooked_methods
|
||||
{
|
||||
|
||||
DEFINE_HOOKED_METHOD(SDL_GL_SwapWindow, void, SDL_Window *window)
|
||||
{
|
||||
static SDL_SysWMinfo wminfo;
|
||||
wminfo.version.major = 2;
|
||||
wminfo.version.minor = 0;
|
||||
typedef SDL_bool (*SDL_GetWindowWMInfo_t)(SDL_Window * window,
|
||||
SDL_SysWMinfo * info);
|
||||
static SDL_GetWindowWMInfo_t GetWindowWMInfo =
|
||||
*reinterpret_cast<SDL_GetWindowWMInfo_t *>(
|
||||
sharedobj::libsdl().Pointer(0xFD4D8));
|
||||
static bool init_wminfo{ false };
|
||||
if (!init_wminfo)
|
||||
{
|
||||
GetWindowWMInfo(window, &wminfo);
|
||||
init_wminfo = true;
|
||||
}
|
||||
if (!sdl_hooks::window)
|
||||
sdl_hooks::window = window;
|
||||
|
||||
static bool init{ false };
|
||||
|
||||
static SDL_GLContext tf2_sdl = SDL_GL_GetCurrentContext();
|
||||
|
||||
if (cathook && !disable_visuals)
|
||||
{
|
||||
PROF_SECTION(SWAPWINDOW_cathook);
|
||||
if (not init)
|
||||
{
|
||||
draw_api::initialize();
|
||||
init = true;
|
||||
}
|
||||
render_cheat_visuals();
|
||||
}
|
||||
{
|
||||
PROF_SECTION(SWAPWINDOW_tf2);
|
||||
SDL_GL_MakeCurrent(window, tf2_sdl);
|
||||
original::SDL_GL_SwapWindow(window);
|
||||
// glXMakeContextCurrent(wminfo.info.x11.display,
|
||||
// wminfo.info.x11.window,
|
||||
// wminfo.info.x11.window, tf2);
|
||||
// glXSwapBuffers(wminfo.info.x11.display, wminfo.info.x11.window);
|
||||
}
|
||||
}
|
||||
}
|
15
src/hooks/visual/SDL_PollEvent.cpp
Normal file
15
src/hooks/visual/SDL_PollEvent.cpp
Normal file
@ -0,0 +1,15 @@
|
||||
/*
|
||||
Created by Jenny White on 29.04.18.
|
||||
Copyright (c) 2018 nullworks. All rights reserved.
|
||||
*/
|
||||
|
||||
#include "HookedMethods.hpp"
|
||||
|
||||
namespace hooked_methods
|
||||
{
|
||||
|
||||
DEFINE_HOOKED_METHOD(SDL_PollEvent, int, SDL_Event *event)
|
||||
{
|
||||
return original::SDL_PollEvent(event);
|
||||
}
|
||||
}
|
4
src/ipc.cpp
Executable file → Normal file
4
src/ipc.cpp
Executable file → Normal file
@ -261,8 +261,8 @@ void StoreClientData()
|
||||
user_data_s &data = peer->memory->peer_user_data[peer->client_id];
|
||||
data.friendid = g_ISteamUser->GetSteamID().GetAccountID();
|
||||
data.ts_injected = time_injected;
|
||||
strncpy(data.name, GetFriendPersonaName_hook(g_ISteamFriends,
|
||||
g_ISteamUser->GetSteamID()),
|
||||
strncpy(data.name, hooked_methods::methods::GetFriendPersonaName(
|
||||
g_ISteamFriends, g_ISteamUser->GetSteamID()),
|
||||
sizeof(data.name));
|
||||
}
|
||||
|
||||
|
BIN
src/menu.tar.xz
BIN
src/menu.tar.xz
Binary file not shown.
10
src/playerlist.cpp
Executable file → Normal file
10
src/playerlist.cpp
Executable file → Normal file
@ -140,15 +140,7 @@ rgba_t Color(CachedEntity *player)
|
||||
|
||||
userdata &AccessData(unsigned steamid)
|
||||
{
|
||||
try
|
||||
{
|
||||
return data.at(steamid);
|
||||
}
|
||||
catch (std::out_of_range &oor)
|
||||
{
|
||||
data.emplace(steamid, userdata{});
|
||||
return data.at(steamid);
|
||||
}
|
||||
return data[steamid];
|
||||
}
|
||||
|
||||
// Assume player is non-null
|
||||
|
@ -12,7 +12,7 @@ CTFInventoryManager *CTFInventoryManager::GTFInventoryManager()
|
||||
typedef CTFInventoryManager *(*GTFInventoryManager_t)();
|
||||
uintptr_t address = gSignatures.GetClientSignature(
|
||||
"55 A1 ? ? ? ? 89 E5 5D C3 8D B6 00 00 00 00 55 89 E5 56 53 83 EC ? 8B "
|
||||
"5D ? C7 44 24 ? ? ? ? ?");
|
||||
"5D ? C7 44 24");
|
||||
GTFInventoryManager_t GTFInventoryManager_fn =
|
||||
GTFInventoryManager_t(address);
|
||||
return GTFInventoryManager_fn();
|
||||
@ -34,7 +34,7 @@ CTFPlayerInventory *CTFPlayerInventory::GTFPlayerInventory()
|
||||
typedef CTFPlayerInventory *(*GTFPlayerInventory_t)();
|
||||
uintptr_t address = gSignatures.GetClientSignature(
|
||||
"55 B8 ? ? ? ? 89 E5 5D C3 8D B6 00 00 00 00 55 B8 ? ? ? ? 89 E5 5D C3 "
|
||||
"8D B6 00 00 00 00 55 89 E5 57 56 53 83 EC ? 8B 45 ? 8B 5D ?");
|
||||
"8D B6 00 00 00 00 55 89 E5 57 56 53 83 EC ? 8B 45 ? 8B 5D");
|
||||
GTFPlayerInventory_t GTFPlayerInventory_fn = GTFPlayerInventory_t(address);
|
||||
return GTFPlayerInventory_fn();
|
||||
}
|
||||
@ -42,7 +42,7 @@ CEconItem *CTFPlayerInventory::GetFirstItemOfItemDef(int id)
|
||||
{
|
||||
typedef CEconItem *(*GetFirstItemOfItemDef_t)(CTFPlayerInventory *, int);
|
||||
uintptr_t address = gSignatures.GetClientSignature(
|
||||
"55 89 E5 57 56 53 83 EC ? 8B 4D ? 0F B7 45 ?");
|
||||
"55 89 E5 57 56 53 83 EC ? 8B 4D ? 0F B7 45");
|
||||
GetFirstItemOfItemDef_t GetFirstItemOfItemDef_fn =
|
||||
GetFirstItemOfItemDef_t(address);
|
||||
return GetFirstItemOfItemDef_fn(this, id);
|
||||
|
@ -46,8 +46,8 @@ re::CTFPartyClient::MutLocalGroupCriteria(re::CTFPartyClient *client)
|
||||
{
|
||||
typedef re::ITFGroupMatchCriteria *(*MutLocalGroupCriteria_t)(
|
||||
re::CTFPartyClient *);
|
||||
static uintptr_t addr = gSignatures.GetClientSignature(
|
||||
"55 89 E5 8B 45 ? 8B 50 ? C6 80 ? ? ? ? ?");
|
||||
static uintptr_t addr =
|
||||
gSignatures.GetClientSignature("55 89 E5 8B 45 ? 8B 50 ? C6 80");
|
||||
static MutLocalGroupCriteria_t MutLocalGroupCriteria_fn =
|
||||
MutLocalGroupCriteria_t(addr);
|
||||
|
||||
@ -58,7 +58,7 @@ int re::CTFPartyClient::LoadSavedCasualCriteria()
|
||||
{
|
||||
typedef int (*LoadSavedCasualCriteria_t)(re::CTFPartyClient *);
|
||||
uintptr_t addr = gSignatures.GetClientSignature(
|
||||
"55 89 E5 83 EC ? 8B 45 ? 8B 50 ? C6 80 ? ? ? ? ?");
|
||||
"55 89 E5 83 EC ? 8B 45 ? 8B 50 ? C6 80");
|
||||
LoadSavedCasualCriteria_t LoadSavedCasualCriteria_fn =
|
||||
LoadSavedCasualCriteria_t(addr);
|
||||
|
||||
@ -69,7 +69,7 @@ char re::CTFPartyClient::RequestQueueForMatch(int type)
|
||||
{
|
||||
typedef char (*RequestQueueForMatch_t)(re::CTFPartyClient *, int);
|
||||
uintptr_t addr = gSignatures.GetClientSignature(
|
||||
"55 89 E5 57 56 53 81 EC ? ? ? ? 8B 75 ? 89 F0");
|
||||
"55 89 E5 57 56 53 81 EC ? ? ? ? 8B 45 ? E8");
|
||||
RequestQueueForMatch_t RequestQueueForMatch_fn =
|
||||
RequestQueueForMatch_t(addr);
|
||||
|
||||
@ -80,7 +80,7 @@ char re::CTFPartyClient::RequestLeaveForMatch(int type)
|
||||
typedef char (*RequestLeaveForMatch_t)(re::CTFPartyClient *, int);
|
||||
uintptr_t addr = gSignatures.GetClientSignature(
|
||||
"55 89 E5 57 56 53 83 EC ? 8B 45 ? 89 44 24 ? 8B 45 ? 89 04 24 E8 ? ? "
|
||||
"? ? 84 C0 89 C6 75 ?");
|
||||
"? ? 84 C0 89 C6 75");
|
||||
RequestLeaveForMatch_t RequestLeaveForMatch_fn =
|
||||
RequestLeaveForMatch_t(addr);
|
||||
|
||||
|
17
src/velocity.cpp
Executable file → Normal file
17
src/velocity.cpp
Executable file → Normal file
@ -14,14 +14,15 @@ namespace velocity
|
||||
|
||||
EstimateAbsVelocity_t EstimateAbsVelocity{};
|
||||
|
||||
void Init() {
|
||||
void Init()
|
||||
{
|
||||
EstimateAbsVelocity =
|
||||
(void (*)(IClientEntity *, Vector &)) gSignatures.GetClientSignature(
|
||||
"55 89 E5 56 53 83 EC 20 8B 5D 08 8B 75 0C E8 ? ? ? ? 39 D8 74 79 "
|
||||
"0F B6 05 ? ? ? ? 81 C3 B8 02 00 00 C6 05 ? ? ? ? 01 F3 0F 10 05 ? "
|
||||
"? ? ? F3 0F 11 45 F0 88 45 EC A1 ? ? ? ? 89 45 E8 8D 45 E8 A3 ? ? "
|
||||
"? ? A1 ? ? ? ? F3 0F 10 40 0C 89 74 24 04 89 1C 24 F3 0F 11 44 24 "
|
||||
"08 E8 ? ? ? ? 0F B6 45 EC F3 0F 10 45 F0 F3 0F 11 05 ? ? ? ? A2 ? "
|
||||
"? ? ? 8B 45 E8 A3 ? ? ? ? 83 C4 20 5B 5E 5D C3");
|
||||
(void (*)(IClientEntity *, Vector &)) gSignatures.GetClientSignature(
|
||||
"55 89 E5 56 53 83 EC 20 8B 5D 08 8B 75 0C E8 ? ? ? ? 39 D8 74 79 "
|
||||
"0F B6 05 ? ? ? ? 81 C3 B8 02 00 00 C6 05 ? ? ? ? 01 F3 0F 10 05 ? "
|
||||
"? ? ? F3 0F 11 45 F0 88 45 EC A1 ? ? ? ? 89 45 E8 8D 45 E8 A3 ? ? "
|
||||
"? ? A1 ? ? ? ? F3 0F 10 40 0C 89 74 24 04 89 1C 24 F3 0F 11 44 24 "
|
||||
"08 E8 ? ? ? ? 0F B6 45 EC F3 0F 10 45 F0 F3 0F 11 05 ? ? ? ? A2 ? "
|
||||
"? ? ? 8B 45 E8 A3 ? ? ? ? 83 C4 20 5B 5E 5D C3");
|
||||
}
|
||||
}
|
||||
|
@ -6,7 +6,8 @@ target_sources(cathook PRIVATE
|
||||
"${CMAKE_CURRENT_LIST_DIR}/drawmgr.cpp"
|
||||
"${CMAKE_CURRENT_LIST_DIR}/EffectChams.cpp"
|
||||
"${CMAKE_CURRENT_LIST_DIR}/EffectGlow.cpp"
|
||||
"${CMAKE_CURRENT_LIST_DIR}/fidgetspinner.cpp")
|
||||
"${CMAKE_CURRENT_LIST_DIR}/fidgetspinner.cpp"
|
||||
"${CMAKE_CURRENT_LIST_DIR}/SDLHooks.cpp")
|
||||
|
||||
if(EnableGUI)
|
||||
add_subdirectory(menu)
|
||||
|
@ -6,6 +6,7 @@
|
||||
*/
|
||||
|
||||
#include <visual/EffectChams.hpp>
|
||||
#include <MiscTemporary.hpp>
|
||||
#include "common.hpp"
|
||||
|
||||
// static CatVar chams_experimental(CV_SWITCH, "chams_effect", "0",
|
||||
|
@ -6,6 +6,7 @@
|
||||
*/
|
||||
|
||||
#include <visual/EffectGlow.hpp>
|
||||
#include <MiscTemporary.hpp>
|
||||
#include "common.hpp"
|
||||
|
||||
IMaterialSystem *materials = nullptr;
|
||||
|
33
src/visual/SDLHooks.cpp
Normal file
33
src/visual/SDLHooks.cpp
Normal file
@ -0,0 +1,33 @@
|
||||
/*
|
||||
Created by Jenny White on 29.04.18.
|
||||
Copyright (c) 2018 nullworks. All rights reserved.
|
||||
*/
|
||||
|
||||
#include "SDLHooks.hpp"
|
||||
#include "HookedMethods.hpp"
|
||||
|
||||
namespace sdl_hooks
|
||||
{
|
||||
|
||||
SDL_Window *window{ nullptr };
|
||||
|
||||
namespace pointers
|
||||
{
|
||||
hooked_methods::types::SDL_GL_SwapWindow *SDL_GL_SwapWindow{ nullptr };
|
||||
}
|
||||
|
||||
|
||||
void applySdlHooks()
|
||||
{
|
||||
pointers::SDL_GL_SwapWindow = reinterpret_cast<hooked_methods::types::SDL_GL_SwapWindow *>(sharedobj::libsdl().Pointer(0xFD648));
|
||||
|
||||
hooked_methods::original::SDL_GL_SwapWindow = *pointers::SDL_GL_SwapWindow;
|
||||
*pointers::SDL_GL_SwapWindow = hooked_methods::methods::SDL_GL_SwapWindow;
|
||||
}
|
||||
|
||||
void cleanSdlHooks()
|
||||
{
|
||||
*pointers::SDL_GL_SwapWindow = hooked_methods::original::SDL_GL_SwapWindow;
|
||||
}
|
||||
|
||||
}
|
@ -12,6 +12,7 @@
|
||||
|
||||
#include <GL/glew.h>
|
||||
#include <GL/gl.h>
|
||||
#include <visual/SDLHooks.hpp>
|
||||
|
||||
#if EXTERNAL_DRAWING
|
||||
extern "C" {
|
||||
@ -77,7 +78,7 @@ void initialize()
|
||||
}
|
||||
xoverlay_show();
|
||||
#else
|
||||
context = SDL_GL_CreateContext(sdl_current_window);
|
||||
context = SDL_GL_CreateContext(sdl_hooks::window);
|
||||
glClearColor(1.0, 0.0, 0.0, 0.5);
|
||||
glewExperimental = GL_TRUE;
|
||||
glewInit();
|
||||
@ -159,7 +160,7 @@ void draw_begin()
|
||||
#if EXTERNAL_DRAWING
|
||||
xoverlay_draw_begin();
|
||||
#else
|
||||
SDL_GL_MakeCurrent(sdl_current_window, context);
|
||||
SDL_GL_MakeCurrent(sdl_hooks::window, context);
|
||||
#endif
|
||||
glez_begin();
|
||||
}
|
||||
@ -168,7 +169,7 @@ void draw_end()
|
||||
{
|
||||
PROF_SECTION(DRAWEX_draw_end);
|
||||
glez_end();
|
||||
SDL_GL_MakeCurrent(sdl_current_window, nullptr);
|
||||
SDL_GL_MakeCurrent(sdl_hooks::window, nullptr);
|
||||
#if EXTERNAL_DRAWING
|
||||
xoverlay_draw_end();
|
||||
#endif
|
||||
|
@ -5,6 +5,7 @@
|
||||
* Author: nullifiedcat
|
||||
*/
|
||||
|
||||
#include <MiscTemporary.hpp>
|
||||
#include "common.hpp"
|
||||
#include "visual/drawing.hpp"
|
||||
#include "hack.hpp"
|
||||
@ -27,9 +28,9 @@ void render_cheat_visuals()
|
||||
|
||||
void BeginCheatVisuals()
|
||||
{
|
||||
/*#if RENDERING_ENGINE_OPENGL
|
||||
std::lock_guard<std::mutex> draw_lock(drawing_mutex);
|
||||
#endif*/
|
||||
/*#if RENDERING_ENGINE_OPENGL
|
||||
std::lock_guard<std::mutex> draw_lock(drawing_mutex);
|
||||
#endif*/
|
||||
draw_api::draw_begin();
|
||||
ResetStrings();
|
||||
}
|
||||
@ -45,9 +46,9 @@ CatVar enable_logo(CV_SWITCH, "nullcore_mode_logo", "1",
|
||||
|
||||
void DrawCheatVisuals()
|
||||
{
|
||||
/*#if RENDERING_ENGINE_OPENGL
|
||||
std::lock_guard<std::mutex> draw_lock(drawing_mutex);
|
||||
#endif*/
|
||||
/*#if RENDERING_ENGINE_OPENGL
|
||||
std::lock_guard<std::mutex> draw_lock(drawing_mutex);
|
||||
#endif*/
|
||||
{
|
||||
PROF_SECTION(DRAW_misc);
|
||||
hacks::shared::misc::DrawText();
|
||||
|
Reference in New Issue
Block a user