/
main.h
177 lines (150 loc) · 3.83 KB
/
main.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
/*
* Version: MPL 1.1
*
* The contents of this file are subject to the Mozilla Public License Version
* 1.1 (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
* http://www.mozilla.org/MPL/
*
* Software distributed under the License is distributed on an "AS IS" basis,
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
* for the specific language governing rights and limitations under the
* License.
*
* The Original Code is the YSI 2.0 SA:MP plugin.
*
* The Initial Developer of the Original Code is Alex "Y_Less" Cole.
* Portions created by the Initial Developer are Copyright (C) 2008
* the Initial Developer. All Rights Reserved. The development was abandobed
* around 2010, afterwards kurta999 has continued it.
*
* Contributor(s):
*
* 0x688, balika011, Gamer_Z, iFarbod, karimcambridge, Mellnik, P3ti, Riddick94
* Slice, sprtik, uint32, Whitetigerswt, Y_Less, ziggi and complete SA-MP community
*
* Special Thanks to:
*
* SA:MP Team past, present and future
* Incognito, maddinat0r, OrMisicL, Zeex
*
*/
#ifndef YSF_MAIN_H
#define YSF_MAIN_H
// -------
// DEFINES
// -------
#pragma warning(disable: 4995)
//#define NEW_PICKUP_SYSTEM
#define PI 3.14159265
#define ARRAY_SIZE(a) ( sizeof((a)) / sizeof(*(a)) )
#define SAFE_DELETE(p) { if (p) { delete (p); (p) = NULL; } }
#define SAFE_RELEASE(p) { if (p) { (p)->Release(); (p) = NULL; } }
#define PAD(a, b) char a[b]
#define _OFFSET(p_type, p_member) (size_t)(&((p_type *)NULL)->p_member)
#ifndef PAGESIZE
#define PAGESIZE (4096)
#endif
// ------------
// VERSION INFO
// ------------
#define PROJECT_NAME "YSF"
#define PROJECT_VERSION "R19"
// ------------
// OS SPECIFICS
// ------------
#ifdef _WIN32
#define WIN32_LEAN_AND_MEAN
#define SLEEP(x) { Sleep(x); }
#define OS_NAME "Windows"
#include <windows.h>
#include <Psapi.h>
#include <tchar.h>
#include <Strsafe.h>
#include <mmsystem.h>
#include <malloc.h>
#include <shellapi.h>
#include <time.h>
#else
#define SLEEP(x) { usleep(x * 1000); }
#define MAX_PATH 260
#define OS_NAME "Linux"
#include <dlfcn.h>
#include <unistd.h>
#include <sys/time.h>
#include <sys/times.h>
#include <sys/socket.h>
#include <signal.h>
#include <sys/types.h>
#include <sys/sysinfo.h>
#include <sys/stat.h>
#include <dirent.h>
#include <cstring>
#include <netinet/in.h>
#include <arpa/inet.h>
#include <sys/mman.h>
#include <fnmatch.h>
typedef unsigned long DWORD;
typedef const char *PCHAR;
typedef int SOCKET;
#define INVALID_SOCKET -1
#ifndef stricmp
#define stricmp strcasecmp
#endif
typedef unsigned char uchar;
typedef unsigned short ushort;
typedef unsigned int uint;
typedef unsigned long ulong;
typedef unsigned long DWORD;
typedef int BOOL;
typedef unsigned char BYTE;
typedef unsigned short WORD;
typedef float FLOAT;
#ifndef MAX_PATH
#define MAX_PATH 260
#endif
#endif
// --------
// INCLUDES
// --------
// Regular crap
#include <stdio.h>
#include <stdlib.h>
#include <math.h>
#include <stdarg.h>
// STL
#include <unordered_map>
#include <string>
#include <vector>
#include <fstream>
#include <iostream>
#include <sstream>
// Subhook
#include <subhook/subhook.h>
// YSF
#include "CAddresses.h"
#include "amxfunctions.h"
#include "CScriptParams.h"
#include "CCallbackManager.h"
#include "CGangZonePool.h"
#include "CModelSizes.h"
#include "CPickupPool.h"
#include "CPlayerData.h"
#include "CVector.h"
#include "CServer.h"
#include "CFunctions.h"
#include "Hooks.h"
#include "RPCs.h"
#include "Natives.h"
#include "Structs.h"
#include "Utils.h"
// ---------
// EXTERNALS
// ---------
extern void *pAMXFunctions;
extern void **ppPluginData;
extern CNetGame *pNetGame;
extern void *pConsole;
extern void *pRakServer;
extern CPlayerData *pPlayerData[MAX_PLAYERS];
#endif