This repository has been archived by the owner on Dec 27, 2020. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathAdd-on API.h
297 lines (271 loc) · 9.94 KB
/
Add-on API.h
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
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
#ifndef addonH
#define addonH
/* IMPORTANT: Need to finish these before alpha testing start.
* MAIN IMPORTANT FOR API!!! - Check chars length in H-Ext before allow over the limit length go through
* (Must do this to avoid further crash & override data.)
*
*/
#ifndef dllport
#define dllport __declspec(dllimport)
#endif
#define dllAPI CNATIVE __declspec(dllexport)
#define WINAPIC __cdecl
#if _MSC_VER >= 1600
#define static_assert_check static_assert //This is needed to verify correctly and prevent to compile if something is incorrect.
#elif _MSC_VER >=1500
//TODO: Need find a way to add assert support for older than Visual Studio 2010.
#define static_assert_check(e, m) typedef char __C_ASSERT__[(e)?1:-1]
#else
#define static_assert_check(a, b) //Only necessary for Visual Studio 2008 and below to compile.
#endif
#define STRINGIZE_HELPER(x) #x
#define STRINGIZE(x) STRINGIZE_HELPER(x)
#define STRINGIZE_WIDE_HELPER(x) L##x
#define STRINGIZE_WIDE(x) STRINGIZE_WIDE_HELPER(x)
#define WARNING(desc) message(__FILE__ "(" STRINGIZE(__LINE__) ") : warning: " #desc)
#define COMPILER_ERROR(desc) message(__FILE__ "(" STRINGIZE(__LINE__) ") : error: " #desc)
#define STR_CAT(a,b) a##b
#define STR_CAT_DELAYED(a,b) STR_CAT(a,b)
#define UNKNOWN(size) char STR_CAT_DELAYED(_unused_,__COUNTER__)[size]
#define PADDING UNKNOWN
#ifdef __cplusplus
#define CNATIVE extern "C"
#else
#define CNATIVE
#ifndef _STDBOOL
typedef _Bool bool;
#endif
#endif
#define toggle char
typedef enum EAO_RETURN {
EAO_ONE_TIME_UPDATE = 2,
EAO_OVERRIDE = 1,
EAO_CONTINUE = 0,
EAO_FAIL = -1
} EAO_RETURN;
typedef enum CMD_RETURN {
CMD_FAIL = -1,
CMD_NO_MATCH = 0,
CMD_SUCCESS = 1,
CMD_SUCCESS_SILENT = 2,
CMD_FAIL_SILENT = 3
} CMD_RETURN;
typedef enum e_boolean {
BOOL_INVALID = -2,
BOOL_FAIL = -1,
BOOL_FALSE = 0,
BOOL_TRUE = 1
} e_boolean;
#define CALL_MEMBER_FN(self, FUNC, ...) self->FUNC(self, ## __VA_ARGS__)
#include "C\cseries\cseries.h"
//Vanilla Tags
#ifdef __cplusplus
#include "CPlusPlus\tags\tag_include.hpp"
#endif
#include "C\tags\tag_include.h"
#include "C\struct.h"
#include "C\util.h"
#include "C\hext.h"
#ifdef EXT_ICINIFILE
#include "C\iniFile.h"
#endif
#if defined(EXT_IDATABASE) || defined(EXT_IDATABASESTATEMENT)
#include "C\database.h"
#endif
#include "C\object.h"
#include "C\player.h"
#ifdef EXT_IUTIL
typedef CMD_RETURN (WINAPIC *CmdFunc)(PlayerInfo plI, ArgContainer* arg, MSG_PROTOCOL protocolMsg, unsigned int idTimer, bool* showChat);
#endif
#ifdef EXT_IADMIN
#include "C\admin.h"
#endif
#ifdef EXT_ICOMMAND
#include "C\command.h"
#endif
#ifdef __cplusplus
CNATIVE {
#endif
#pragma pack(push,1)
typedef struct addon_section_names {
wchar_t sect_name1[24];
wchar_t sect_name2[24];
wchar_t sect_name3[24];
wchar_t sect_name4[24];
wchar_t sect_name5[24];
} addon_section_names;
typedef struct addon_info {
wchar_t name[128];
wchar_t version[15];
wchar_t author[128];
wchar_t description[255];
wchar_t config_folder[24];
addon_section_names sectors;
} addon_info;
typedef struct addon_version {
unsigned short size; //Used by sizeof(versionEAO);
unsigned short requiredAPI; //API requirement revision (Including command functions)
unsigned short general; //General revision specifically for events in Halo.
unsigned short version; //addon_version revision
unsigned short pIHaloEngine; //Halo Engine interface revision
unsigned short pIObject; //Object interface revision
unsigned short pIPlayer; //Player interface revision
unsigned short pIAdmin; //Admin interface revision
unsigned short pICommand; //Command interface revision
unsigned short pIDatabase; //Database interface revision
unsigned short pIDBStmt; //Database Statement interface revision
unsigned short pICIniFile; //CiniFile interface revision
unsigned short pITimer; //Timer interface revision
unsigned short pIUtil; //Util interface revision
unsigned short pINetwork; //Network interface revision - reserved (DO NOT USE!)
unsigned short pISound; //Sound interface revision - reserved (DO NOT USE!)
unsigned short pIDirectX9; //DirectX9 interface revision - reserved (DO NOT USE!)
unsigned short reserved1; //reserved
unsigned short reserved2; //reserved
unsigned short reserved3; //reserved
unsigned short hkDatabase; //Database hook revision
unsigned short hkTimer; //Timer hook revision
unsigned short hkExternal; //External account revision - reserved (DO NOT USE!)
unsigned short reserved4; //reserved
unsigned short reserved5; //reserved
unsigned short reserved6; //reserved
unsigned short reserved7; //reserved
unsigned short reserved8; //reserved
} addon_version;
#pragma pack(pop)
#ifdef EXT_ITIMER
#ifndef EXT_HKTIMER
#pragma WARNING("If you're using addon_version structure, recommended to include EXT_HKTIMER since EXT_ITIMER required hooks to be include.")
#endif
typedef struct ITimer {
/// <summary>
/// Register a timer event delay.
/// </summary>
/// <param name="hash">Add-on unique ID.</param>
/// <param name="plI">Bind to specific player or use null for general.</param>
/// <param name="execTime">Amount of ticks later to execute a timer event. (1 tick = 1/30 second)</param>
/// <returns>Return ID of timer event.</returns>
unsigned int (*m_add)(unsigned int hash, PlayerInfo* plI, unsigned int execTime);
/// <summary>
/// Remove a timer event.
/// </summary>
/// <param name="hash">Add-on unique ID.</param>
/// <param name="id">Can be used only with registered ID number bind to specific Add-on.</param>
/// <returns>Return true or false if unable to reload Add-on.</returns>
void (*m_delete)(unsigned int hash, unsigned int id);
} ITimer;
CNATIVE dllport ITimer* getITimer(unsigned int hash);
#endif
static addon_version EAOversion = {
sizeof(addon_version), //size
6, //requiredAPI - API requirement revision (Including command interface)
5, //general - General revision specifically for events in Halo.
4, //addon_version - format revision requirement enforced if needed
#ifdef EXT_IHALOENGINE
2, //pIHaloEngine - Halo Engine class revision
#else
0, //pIHaloEngine - excluded
#endif
#ifdef EXT_IOBJECT
4, //pIObject - Object class revision
#else
0, //pIObject - excluded
#endif
#ifdef EXT_IPLAYER
5, //pIPlayer - Player class revision
#else
0, //pIPlayer - excluded
#endif
#ifdef EXT_IADMIN
2, //pIAdmin - Admin class revision
#else
0, //pIAdmin - excluded
#endif
#ifdef EXT_ICOMMAND
2, //pICommand - Command class revision
#else
0, //pICommand - excluded
#endif
#ifdef EXT_IDATABASE
4, //pIDatabase - Database class revision
#else
0, //pIDatabase - excluded
#endif
#ifdef EXT_IDATABASESTATEMENT
4, //pIDBStmt - Database Statement class revision
#else
0, //pIDBStmt - excluded
#endif
#ifdef EXT_ICINIFILE
3, //iniFile - CiniFile class revision
#else
0, //iniFile - excluded
#endif
#ifdef EXT_ITIMER
1, //pITimer - Timer class revision
#else
0, //pITimer - excluded
#endif
#ifdef EXT_IUTIL
1, //pIUtil - IUtil class revision
#else
0, //pIUtil - excluded
#endif
#ifdef EXT_INETWORK
0, //pINetwork - INetwork class revision
#else
0, //pINetwork - excluded
#endif
#ifdef EXT_ISOUND
0, //pISound - ISound class revision
#else
0, //pISound - excluded
#endif
#ifdef EXT_IDIRECTX9
0, //pIDirectX9 - IDirectX9 class revision
#else
0, //pIDirectX9 - excluded
#endif
#ifdef EXT_RESERVED
0, //reserved1 - reserved1 class revision
#else
0, //reserved1 - excluded
#endif
#ifdef EXT_RESERVED
0, //reserved2 - reserved2 class revision
#else
0, //reserved2 - excluded
#endif
#ifdef EXT_RESERVED
0, //reserved3 - reserved3 class revision
#else
0, //reserved3 - excluded
#endif
#ifdef EXT_HKDATABASE
4, //hkDatabase - Database hook revision
#else
0, //hkDatabase - excluded
#endif
#ifdef EXT_HKTIMER
1, //hkTimer - Timer hook revision
#else
0, //hkTimer - excluded
#endif
#ifdef EXT_HKEXTERNAL
0, //hkExternal - External account revision (for Remote Control or other external possiblities)
#else
0, //hkExternal - excluded
#endif
0, //reserved5
0, //reserved6
0, //reserved7
0, //reserved8
0 }; //reserved9
static_assert_check(sizeof(addon_version)==0x38, "Error, incorrect size of addon_version struct");
#ifdef __cplusplus
}
#endif
#ifdef EXT_IHALOENGINE
#include "C\haloEngine.h"
#endif
#endif