-
Notifications
You must be signed in to change notification settings - Fork 5
/
Copy pathHooks.cpp
126 lines (104 loc) · 4.8 KB
/
Hooks.cpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
#include "Hooks.h"
CPlist plist = CPlist();
double PlistArray[102][200];
RecvVarProxyFn oRecvLowerBodyTarget = NULL;
namespace Hooks
{
CHookedEvents hooked_events;
VFTableHook* g_pClientModeHook;
VFTableHook* g_pMaterialSystemHook;
VFTableHook* g_pModelRenderHook;
VFTableHook* g_pPredictionHook;
VFTableHook* g_pMatSurfaceHook;
VFTableHook* g_pPanelHook;
VFTableHook* g_pClientHook;
VFTableHook* g_pEngineHook;
VFTableHook* g_pGameEventHook;
VFTableHook* g_pSurfaceHook;
VFTableHook* g_pRenderViewHook;
CreateMove_t g_fnOriginalCreateMove;
PaintTraverse_t g_fnOriginalPaintTraverse;
DrawModelExecute_t g_fnOriginalDrawModelExecute;
FrameStageNotify_t g_fnOriginalFrameStageNotify;
FireEventClientSide_t g_fnOriginalFireEventClientSide;
OverrideView_t g_fnOriginalOverrideView;
IsPlayingTimeDemo_t g_fnOriginalPlayingTimeDemo;
PlaySound_t g_fnOriginalPlaySound;
RecvVarProxyFn g_fnSequenceProxyFn = NULL;
DoPostScreenEffects_t g_fnOriginalDoPostScreenEffects;
SceneEnd_t g_fnOriginalSceneEnd;
void Initialise()
{
g_pClientModeHook = new VFTableHook(m_pClientMode);
g_pModelRenderHook = new VFTableHook(m_pModelRender);
g_pMaterialSystemHook = new VFTableHook(m_pMaterialSystem);
g_pPredictionHook = new VFTableHook(m_pPrediction);
g_pPanelHook = new VFTableHook(m_pPanels);
g_pClientHook = new VFTableHook(m_pClient);
g_pEngineHook = new VFTableHook(m_pEngine);
g_pGameEventHook = new VFTableHook(m_pGameEventManager);
g_pSurfaceHook = new VFTableHook(m_pSurface);
g_pRenderViewHook = new VFTableHook(m_pRenderView);
enum FontFlags
{
FONTFLAG_NONE,
FONTFLAG_ITALIC = 0x001,
FONTFLAG_UNDERLINE = 0x002,
FONTFLAG_STRIKEOUT = 0x004,
FONTFLAG_SYMBOL = 0x008,
FONTFLAG_ANTIALIAS = 0x010,
FONTFLAG_GAUSSIANBLUR = 0x020,
FONTFLAG_ROTARY = 0x040,
FONTFLAG_DROPSHADOW = 0x080,
FONTFLAG_ADDITIVE = 0x100,
FONTFLAG_OUTLINE = 0x200,
FONTFLAG_CUSTOM = 0x400,
FONTFLAG_BITMAP = 0x800,
};
draw.fonts.menu = m_pSurface->FontCreate();
m_pSurface->SetFontGlyphSet(draw.fonts.menu, XorStr("Verdana"), 12, 400, 0, 0, (int)FONTFLAG_ANTIALIAS);
draw.fonts.menu_bold = m_pSurface->FontCreate();
m_pSurface->SetFontGlyphSet(draw.fonts.menu_bold, XorStr("Verdana"), 12, 700, 0, 0, (int)FONTFLAG_ANTIALIAS | (int)FONTFLAG_OUTLINE | (int)FONTFLAG_DROPSHADOW);
draw.fonts.font_icons = m_pSurface->FontCreate();
m_pSurface->SetFontGlyphSet(draw.fonts.font_icons, XorStr("Untitled1"), 50, 400, 0, 0, (int)FONTFLAG_ANTIALIAS | (int)FONTFLAG_DROPSHADOW);
draw.fonts.esp = m_pSurface->FontCreate( );
m_pSurface->SetFontGlyphSet( draw.fonts.esp, XorStr( "Arial" ), 11, 700, 0, 0, FONTFLAG_OUTLINE );
draw.fonts.esp_extra = m_pSurface->FontCreate();
m_pSurface->SetFontGlyphSet(draw.fonts.esp_extra, XorStr("Arial"), 10, 700, 0, 0, (int)FONTFLAG_OUTLINE );
draw.fonts.esp_small = m_pSurface->FontCreate();
m_pSurface->SetFontGlyphSet(draw.fonts.esp_small, XorStr("Verdana"), 11, 230, 0, 0, FONTFLAG_OUTLINE);
draw.fonts.indicator = m_pSurface->FontCreate();
m_pSurface->SetFontGlyphSet(draw.fonts.indicator, XorStr("Verdana"), 24, 700, 0, 0, FONTFLAG_ANTIALIAS | FONTFLAG_DROPSHADOW);
chams = new Chams;
g_fnOriginalPaintTraverse = g_pPanelHook->Hook(41, (PaintTraverse_t)Hooked_PaintTraverse);
g_fnOriginalCreateMove = g_pClientModeHook->Hook(24, (CreateMove_t)Hooked_CreateMove);
g_fnOriginalOverrideView = g_pClientModeHook->Hook(18, (OverrideView_t)Hooked_OverrideView);
g_fnOriginalDoPostScreenEffects = g_pClientModeHook->Hook(44, (DoPostScreenEffects_t)Hooked_DoPostScreenEffects);
g_fnOriginalFireEventClientSide = g_pGameEventHook->Hook(9, (FireEventClientSide_t)Hooked_FireEventClientSide);
g_fnOriginalFrameStageNotify = g_pClientHook->Hook(36, (FrameStageNotify_t)Hooked_FrameStageNotify);
g_fnOriginalPlayingTimeDemo = g_pEngineHook->Hook(85, (IsPlayingTimeDemo_t)Hooked_IsPlayingTimeDemo);
g_fnOriginalPlaySound = g_pSurfaceHook->Hook(82, (PlaySound_t)Hooked_PlaySound);
g_fnOriginalSceneEnd = g_pRenderViewHook->Hook(9, (SceneEnd_t)Hooked_SceneEnd);
g_pModelRenderHook->Hook(21, (DrawModelExecute_t)Hooked_DrawModelExecute);
g_pClientModeHook->Hook(35, (GetViewmodelFov_t)Hooked_GetViewmodelFov);
g_pMaterialSystemHook->Hook(84, Hooked_FindMaterial);
g_pPredictionHook->Hook(19, (RunCommand_t)Hooked_RunCommand);
initialize_events();
for (ClientClass* pClass = m_pClient->GetAllClasses(); pClass; pClass = pClass->m_pNext) {
if (!strcmp(pClass->m_pNetworkName, "DT_CSPlayer")) {
RecvTable* pClassTable = pClass->m_pRecvTable;
for (int nIndex = 0; nIndex < pClassTable->m_nProps; nIndex++) {
RecvProp* pProp = &pClassTable->m_pProps[nIndex];
if (!pProp || strcmp(pProp->m_pVarName, "m_flLowerBodyYawTarget"))
continue;
pProp->m_ProxyFn = (RecvVarProxyFn)LowerbodyProxy;
break;
}
break;
}
}
}
void UndoHooks()
{
}
}