-
Notifications
You must be signed in to change notification settings - Fork 3
/
dllapi.cpp
191 lines (179 loc) · 5.85 KB
/
dllapi.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
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
#include "framework.h"
DLL_FUNCTIONS g_DllFunctionTable =
{
NULL, // pfnGameInit
NULL, // pfnSpawn
NULL, // pfnThink
NULL, // pfnUse
NULL, // pfnTouch
NULL, // pfnBlocked
NULL, // pfnKeyValue
NULL, // pfnSave
NULL, // pfnRestore
NULL, // pfnSetAbsBox
NULL, // pfnSaveWriteFields
NULL, // pfnSaveReadFields
NULL, // pfnSaveGlobalState
NULL, // pfnRestoreGlobalState
NULL, // pfnResetGlobalState
NULL, // pfnClientConnect
NULL, // pfnClientDisconnect
NULL, // pfnClientKill
NULL, // pfnClientPutInServer
NULL, // pfnClientCommand
NULL, // pfnClientUserInfoChanged
NULL, // pfnServerActivate
NULL, // pfnServerDeactivate
NULL, // pfnPlayerPreThink
NULL, // pfnPlayerPostThink
NULL, // pfnStartFrame
NULL, // pfnParmsNewLevel
NULL, // pfnParmsChangeLevel
NULL, // pfnGetGameDescription
NULL, // pfnPlayerCustomization
NULL, // pfnSpectatorConnect
NULL, // pfnSpectatorDisconnect
NULL, // pfnSpectatorThink
NULL, // pfnSys_Error
NULL, // pfnPM_Move
NULL, // pfnPM_Init
NULL, // pfnPM_FindTextureType
NULL, // pfnSetupVisibility
NULL, // pfnUpdateClientData
&AddToFullPack_Pre, // pfnAddToFullPack
NULL, // pfnCreateBaseline
NULL, // pfnRegisterEncoders
NULL, // pfnGetWeaponData
NULL, // pfnCmdStart
NULL, // pfnCmdEnd
NULL, // pfnConnectionlessPacket
NULL, // pfnGetHullBounds
NULL, // pfnCreateInstancedBaselines
NULL, // pfnInconsistentFile
NULL, // pfnAllowLagCompensation
};
DLL_FUNCTIONS g_DllFunctionTable_Post =
{
NULL, // pfnGameInit
NULL, // pfnSpawn
NULL, // pfnThink
NULL, // pfnUse
NULL, // pfnTouch
NULL, // pfnBlocked
NULL, // pfnKeyValue
NULL, // pfnSave
NULL, // pfnRestore
NULL, // pfnSetAbsBox
NULL, // pfnSaveWriteFields
NULL, // pfnSaveReadFields
NULL, // pfnSaveGlobalState
NULL, // pfnRestoreGlobalState
NULL, // pfnResetGlobalState
NULL, // pfnClientConnect
NULL, // pfnClientDisconnect
NULL, // pfnClientKill
NULL, // pfnClientPutInServer
NULL, // pfnClientCommand
NULL, // pfnClientUserInfoChanged
NULL, // pfnServerActivate
NULL, // pfnServerDeactivate
NULL, // pfnPlayerPreThink
NULL, // pfnPlayerPostThink
&StartFrame_Post, // pfnStartFrame
NULL, // pfnParmsNewLevel
NULL, // pfnParmsChangeLevel
NULL, // pfnGetGameDescription
NULL, // pfnPlayerCustomization
NULL, // pfnSpectatorConnect
NULL, // pfnSpectatorDisconnect
NULL, // pfnSpectatorThink
NULL, // pfnSys_Error
NULL, // pfnPM_Move
NULL, // pfnPM_Init
NULL, // pfnPM_FindTextureType
NULL, // pfnSetupVisibility
NULL, // pfnUpdateClientData
&AddToFullPack_Post, // pfnAddToFullPack
NULL, // pfnCreateBaseline
NULL, // pfnRegisterEncoders
NULL, // pfnGetWeaponData
NULL, // pfnCmdStart
NULL, // pfnCmdEnd
NULL, // pfnConnectionlessPacket
NULL, // pfnGetHullBounds
NULL, // pfnCreateInstancedBaselines
NULL, // pfnInconsistentFile
NULL, // pfnAllowLagCompensation
};
NEW_DLL_FUNCTIONS g_NewDllFunctionTable =
{
NULL, //! pfnOnFreeEntPrivateData() Called right before the object's memory is freed. Calls its destructor.
NULL, //! pfnGameShutdown()
NULL, //! pfnShouldCollide()
NULL, //! pfnCvarValue()
NULL, //! pfnCvarValue2()
};
NEW_DLL_FUNCTIONS g_NewDllFunctionTable_Post =
{
NULL, //! pfnOnFreeEntPrivateData() Called right before the object's memory is freed. Calls its destructor.
NULL, //! pfnGameShutdown()
NULL, //! pfnShouldCollide()
NULL, //! pfnCvarValue()
NULL, //! pfnCvarValue2()
};
C_DLLEXPORT int GetEntityAPI2(DLL_FUNCTIONS *pFunctionTable, int *interfaceVersion)
{
if (!pFunctionTable) {
ALERT(at_logged, "%s called with null pFunctionTable", __FUNCTION__);
return FALSE;
}
if (*interfaceVersion != INTERFACE_VERSION) {
ALERT(at_logged, "%s version mismatch; requested=%d ours=%d", __FUNCTION__, *interfaceVersion, INTERFACE_VERSION);
*interfaceVersion = INTERFACE_VERSION;
return FALSE;
}
memcpy(pFunctionTable, &g_DllFunctionTable, sizeof(DLL_FUNCTIONS));
return TRUE;
}
C_DLLEXPORT int GetEntityAPI2_Post(DLL_FUNCTIONS *pFunctionTable, int *interfaceVersion)
{
if (!pFunctionTable) {
ALERT(at_logged, "%s called with null pFunctionTable", __FUNCTION__);
return FALSE;
}
if (*interfaceVersion != INTERFACE_VERSION) {
ALERT(at_logged, "%s version mismatch; requested=%d ours=%d", __FUNCTION__, *interfaceVersion, INTERFACE_VERSION);
*interfaceVersion = INTERFACE_VERSION;
return FALSE;
}
memcpy(pFunctionTable, &g_DllFunctionTable_Post, sizeof(DLL_FUNCTIONS));
return TRUE;
}
C_DLLEXPORT int GetNewDLLFunctions(NEW_DLL_FUNCTIONS *pNewFunctionTable, int *interfaceVersion)
{
if (!pNewFunctionTable) {
ALERT(at_logged, "%s called with null pNewFunctionTable", __FUNCTION__);
return FALSE;
}
if (*interfaceVersion != NEW_DLL_FUNCTIONS_VERSION) {
ALERT(at_logged, "%s version mismatch; requested=%d ours=%d", __FUNCTION__, *interfaceVersion, NEW_DLL_FUNCTIONS_VERSION);
*interfaceVersion = NEW_DLL_FUNCTIONS_VERSION;
return FALSE;
}
memcpy(pNewFunctionTable, &g_NewDllFunctionTable, sizeof(NEW_DLL_FUNCTIONS));
return TRUE;
}
C_DLLEXPORT int GetNewDLLFunctions_Post(NEW_DLL_FUNCTIONS *pNewFunctionTable, int *interfaceVersion)
{
if (!pNewFunctionTable) {
ALERT(at_logged, "%s called with null pNewFunctionTable", __FUNCTION__);
return FALSE;
}
if (*interfaceVersion != NEW_DLL_FUNCTIONS_VERSION) {
ALERT(at_logged, "%s version mismatch; requested=%d ours=%d", __FUNCTION__, *interfaceVersion, NEW_DLL_FUNCTIONS_VERSION);
*interfaceVersion = NEW_DLL_FUNCTIONS_VERSION;
return FALSE;
}
memcpy(pNewFunctionTable, &g_NewDllFunctionTable_Post, sizeof(NEW_DLL_FUNCTIONS));
return TRUE;
}