-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathhooks.cpp
More file actions
137 lines (87 loc) · 3.1 KB
/
Copy pathhooks.cpp
File metadata and controls
137 lines (87 loc) · 3.1 KB
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
127
128
129
130
//
// hooks.cpp
// IdleSow
//
// Created by IX on 12-08-04.
// Copyright 2012 __MyCompanyName__. All rights reserved.
//
#include "globals.h"
cg_state_t *pCg = NULL;
cg_static_t *pCgs = NULL;
centity_t* pEnts = NULL;
client_state_t *pCl = NULL;
// Engine functions
cgame_import_t *oImport = NULL;
cgame_export_t *oExport = NULL;
void (*orig_R_Renderscene) ( const struct refdef_s *fd) = NULL;
// R_AddEntityToScene
void (*orig_R_AddEntityToScene) (const struct entity_s *ent) = NULL;
// RenderView
void ( *orig_RenderView )( float frameTime, float realFrameTime, int realTime, unsigned int serverTime, float stereo_separation, unsigned int extrapolationTime ) = NULL;
// Shutdown
void (*orig_Shutdown)() = NULL;
void VecToAngles( const vec3_t vec, vec3_t angles );
void start_hook()
{
// All pointers and structs are up-to-date here.
oImport->Print("^9Initializing IdleSow...\n");
// Apply hooks
// Hook Renderscene
orig_R_Renderscene = oImport->R_RenderScene;
oImport->R_RenderScene = &hk_R_RenderScene;
oImport->Print("^9[+] R_RenderScene hooked\n");
// Hook AddEntity
orig_R_AddEntityToScene = oImport->R_AddEntityToScene;
oImport->R_AddEntityToScene = hk_R_AddEntityToScene;
oImport->Print("^9[+] R_AddEntityToScene hooked\n");
// Hook RenderView
orig_RenderView = oExport->RenderView;
oExport->RenderView = &hk_RenderView;
// Hook Shutdown to rerun agent
orig_Shutdown = oExport->Shutdown;
oExport->Shutdown = &hk_Shutdown;
oImport->Print("^9[+] RenderView hooked\n");
// Add gui menu commands
oImport->Cmd_AddCommand("menu_moveup", &GUI_MoveUp);
oImport->Cmd_AddCommand("menu_movedn", &GUI_MoveDown);
oImport->Cmd_AddCommand("menu_select", &GUI_MenuSelect);
oImport->Print("^9[+] GUI Injected\n");
// Add keybinds
oImport->Cmd_ExecuteText(EXEC_NOW, "bind i menu_moveup");
oImport->Cmd_ExecuteText(EXEC_NOW, "bind o menu_movedn");
oImport->Cmd_ExecuteText(EXEC_NOW, "bind p menu_select");
oImport->Print("^9[+] Keybinds i, o, p added\n");
oImport->Print("^9***************************************************\n");
oImport->Print("^9If you are seeing this message, all systems are go.\n");
oImport->Print("^9***************************************************\n");
}
void hk_R_RenderScene(const struct refdef_s *fd)
{
(*orig_R_Renderscene)(fd);
gEsp.DoESP();
gAimbot.DoAim();
gGui.Draw();
gCamera.Draw(fd);
}
void hk_R_AddEntityToScene(const struct entity_s* ent)
{
(*orig_R_AddEntityToScene)(ent);
}
void hk_RenderView( float frameTime, float realFrameTime, int realTime, unsigned int serverTime, float stereo_separation, unsigned int extrapolationTime )
{
(*orig_RenderView)(frameTime, realFrameTime, realTime, serverTime, stereo_separation, extrapolationTime);
}
void hk_Shutdown()
{
// Release info
oImport = NULL;
oExport = NULL;
pCg = NULL;
pCgs = NULL;
pEnts = NULL;
// Unload ESP font(s)
gEsp.Unload();
gGui.Shutdown();
start_agent();
(*orig_Shutdown)();
}