FS2_Open
Open source remastering of the Freespace 2 engine
config.h
Go to the documentation of this file.
1 // config.h
2 
3 
4 
5 #ifndef _CONFIG_H
6 #define _CONFIG_H
7 
8 
9 #if defined _WIN32
10 
11 // Goober5000 - now these warnings will only be disabled when compiling with MSVC :)
12 #if defined _MSC_VER
13 
14 // 4002 is too many actual parameters for macro 'Assertion'
15 // 4100 is unreferenced formal parameters,
16 // 4127 is constant conditional (assert)
17 // 4201 nonstandard extension used: nameless struct/union (happens a lot in Windows include headers)
18 // 4290 C++ exception specification ignored except to indicate a function is not __declspec(nothrow)
19 // 4390 empty control statement (triggered by nprintf and mprintf's inside of one-line if's, etc)
20 // 4410 illegal size for operand... ie... fxch st(1)
21 // 4511 copy constructor could not be generated (happens a lot in Windows include headers)
22 // 4512 assignment operator could not be generated (happens a lot in Windows include headers)
23 // 4514 unreferenced inline function removed,
24 // 4611 _setjmp warning. Since we use setjmp alot, and we don't really use constructors or destructors, this warning doesn't really apply to us.
25 // 4663 C++ language change (template specification)
26 // 4710 is inline function not expanded (who cares?)
27 // 4711 tells us an inline function was expanded (who cares?)
28 // 4725 is the pentium division bug warning, and I can't seem to get rid of it, even with this pragma.
29 // JS: I figured out the disabling 4725 works, but not on the first function in the module.
30 // So to disable this, I add in a stub function at the top of each module that does nothing.
31 // 4786 is identifier truncated to 255 characters (happens all the time in Microsoft #includes) -- Goober5000
32 // 4996 deprecated strcpy, strcat, sprintf, etc. (from MSVC 2005) - taylor
33 #pragma warning(disable: 4002 4100 4127 4201 4290 4390 4410 4511 4512 4514 4611 4663 4710 4711 4725 4786 4996)
34 
35 #ifdef NDEBUG
36 // Try/Catch in MSVC is not handling these right, so for Release Builds
37 // we are disabling unreferenced local variable warnings from showing. Zacam.
38 #pragma warning(disable: 4101)
39 #endif
40 
41 #endif
42 
43 #if !defined BYTE_ORDER
44  #define LITTLE_ENDIAN 1234
45  #define BIG_ENDIAN 4321
46 
47  #if defined _M_IX86 || defined _X86_
48  #define BYTE_ORDER LITTLE_ENDIAN
49  #else
50  #error unknown byte order
51  #endif
52 #endif // BYTE_ORDER
53 
54 #ifndef snprintf
55 #define snprintf _snprintf
56 #endif
57 
58 #else // ! Win32
59 
60 
61 #include <unistd.h>
62 #include "SDL.h"
63 #include "SDL_thread.h"
64 
65 
66 // don't verbose stub funtions unless we're debugging
67 #define STUB_FUNCTION nprintf(( "Warning", "STUB: %s in " __FILE__ " at line %d, thread %d\n", __FUNCTION__, __LINE__, getpid() ))
68 #define DEBUGME(d1) nprintf(( "Warning", "DEBUGME: %s in " __FILE__ " at line %d, msg \"%s\", thread %d\n", __FUNCTION__, __LINE__, d1, getpid() ))
69 
70 
71 #define _cdecl
72 #define __cdecl
73 #define __stdcall
74 #define PASCAL
75 #define CALLBACK
76 #define WINAPI
77 #define FAR
78 
79 // Standard data types
80 typedef int BOOL;
81 typedef unsigned short WORD;
82 typedef unsigned int UINT;
83 #ifdef IAM_64BIT
84 // force 32-bit version of DWORD
85 typedef unsigned int DWORD;
86 typedef unsigned int FOURCC;
87 typedef unsigned int *PDWORD, *LPDWORD;
88 #else
89 typedef unsigned long FOURCC;
90 typedef unsigned long DWORD, *PDWORD, *LPDWORD;
91 #endif
92 //typedef void *HMMIO;
93 typedef SDL_RWops *HMMIO;
94 typedef void *HACMSTREAM;
95 typedef long LONG;
96 typedef long HRESULT;
97 typedef long HTASK;
98 typedef unsigned long SEGPTR;
99 typedef long LONG_PTR, *PLONG_PTR;
100 typedef long LRESULT;
101 typedef long LPARAM;
102 typedef long (CALLBACK *FARPROC16)();
103 typedef unsigned int MMRESULT;
104 typedef void *HWND;
105 typedef void *HINSTANCE;
106 typedef void *HANDLE;
107 typedef char *LPSTR;
108 typedef char *HPSTR;
109 typedef void *LPMMIOPROC;
110 #if __WORDSIZE == 64
111 #define __int64 long int
112 #else
113 #define __int64 long long int // TODO: really need a compile-time assert on all of this
114 #endif
115 #define __int32 int
116 
117 typedef struct _LARGE_INTEGER {
119 } LARGE_INTEGER;
120 
121 // networking/socket stuff
122 #define SOCKET int
123 #define SOCKADDR struct sockaddr
124 #define SOCKADDR_IN struct sockaddr_in
125 #define LPSOCKADDR struct sockaddr*
126 #define HOSTENT struct hostent
127 #define SERVENT struct servent
128 #define closesocket(x) close(x)
129 #define WSAEALREADY EALREADY
130 #define WSAEINVAL EINVAL
131 #define WSAEWOULDBLOCK EINPROGRESS
132 #define WSAEISCONN EISCONN
133 #define WSAENOTSOCK ENOTSOCK
134 #define WSAECONNRESET ECONNRESET
135 #define WSAECONNABORTED ECONNABORTED
136 #define WSAESHUTDOWN ESHUTDOWN
137 #define WSAEADDRINUSE EADDRINUSE
138 #define SOCKET_ERROR (-1)
139 #define ioctlsocket(x, y, z) ioctl(x, y, z)
140 
141 #ifndef INVALID_SOCKET
142 #define INVALID_SOCKET ((SOCKET) -1)
143 #endif
144 
145 // sound defines/structs
146 #define WAVE_FORMAT_PCM 1
147 #define WAVE_FORMAT_ADPCM 2
148 #define WAVE_FORMAT_IEEE_FLOAT 3
149 
150 #pragma pack(1) // required to get proper values in ds_parse_wave()
151 typedef struct {
157 } WAVEFORMAT;
158 
159 typedef struct {
162 } PCMWAVEFORMAT;
163 
164 typedef struct {
172 } WAVEFORMATEX;
173 #pragma pack()
174 
175 // MessageBox-Codes and stuff
176 #define MB_ABORTRETRYIGNORE 0
177 #define MB_CANCELTRYCONTINUE 0
178 #define MB_HELP 0
179 #define MB_OK 0
180 #define MB_OKCANCEL 0
181 #define MB_RETRYCANCEL 0
182 #define MB_YESNO 0
183 #define MB_YESNOCANCEL 0
184 #define MB_ICONEXCLAMATION 0
185 #define MB_ICONWARNING 0
186 #define MB_ICONINFORMATION 0
187 #define MB_ICONASTERISK 0
188 #define MB_ICONQUESTION 0
189 #define MB_ICONSTOP 0
190 #define MB_ICONERROR 0
191 #define MB_ICONHAND 0
192 #define MB_DEFBUTTON1 0
193 #define MB_DEFBUTTON2 0
194 #define MB_DEFBUTTON3 0
195 #define MB_DEFBUTTON4 0
196 #define MB_APPLMODAL 0
197 #define MB_SYSTEMMODAL 0
198 #define MB_TASKMODAL 0
199 #define MB_DEFAULT_DESKTOP_ONLY 0
200 #define MB_RIGHT 0
201 #define MB_RTLREADING 0
202 #define MB_SETFOREGROUND 0
203 #define MB_TOPMOST 0
204 #define MB_SERVICE_NOTIFICATION 0
205 #define MB_SERVICE_NOTIFICATION_NT3X 0
206 
207 int MessageBox(HWND h, const char *s1, const char *s2, int i);
208 
209 // thread/process related stuff
210 #define _beginthread(x, y, z)
211 #define _endthread()
212 
213 typedef SDL_mutex* CRITICAL_SECTION;
214 
215 // timer stuff
216 typedef timeval TIMEVAL;
218 
219 // file related items
220 #define _MAX_FNAME 255
221 #define _MAX_PATH 255
222 #define MAX_PATH 255
223 #define SetCurrentDirectory(s) _chdir(s)
224 #define GetCurrentDirectory(i, s) _getcwd((s), (i))
225 #define _unlink(s) unlink(s)
226 
227 // mmio stuff
228 typedef struct {
241  DWORD adwInfo[4];
245 } MMIOINFO;
246 
248 
249 #define FOURCC_MEM 0
250 
251 #define MMIO_READ (1<<0)
252 #define MMIO_READWRITE (1<<1)
253 #define MMIO_WRITE (1<<2)
254 #define MMIO_ALLOCBUF (1<<3)
255 
256 #define MMIOERR_CANNOTWRITE 1
257 
258 HMMIO mmioOpen(LPSTR szFilename, LPMMIOINFO lpmmioinfo, DWORD dwOpenFlags);
259 long mmioSeek(HMMIO hmmio, long lOffset, int iOrigin);
260 long mmioRead(HMMIO hmmio, HPSTR pch, long cch);
261 MMRESULT mmioClose(HMMIO hmmio, uint wFlags);
262 
263 
264 int filelength(int fd);
265 int _chdir(const char *path);
266 int _getcwd(char *buffer, unsigned int len);
267 int _mkdir(const char *path);
268 void _splitpath(char *path, char *drive, char *dir, char *fname, char *ext);
269 
270 // string related
271 #define stricmp(s1, s2) strcasecmp((s1), (s2))
272 #define strnicmp(s1, s2, n) strncasecmp((s1), (s2), (n))
273 #define _strnicmp(s1, s2, n) strncasecmp((s1), (s2), (n))
274 #define _strlwr(s) strlwr(s)
275 
276 void strlwr(char *s);
277 char *strnset( char *string, int fill, size_t count);
278 
279 // other stuff
280 #define _isnan(f) isnan(f)
281 #define _hypot(x, y) hypot(x, y)
282 
283 int MulDiv(int number, int numerator, int denominator);
284 void Sleep(int mili);
285 
286 struct POINT {
287  int x, y;
288 };
289 
290 #endif // if !defined (WINDOWS)
291 
292 #endif // ifndef _CONFIG_H
int filelength(int fd)
void * HWND
Definition: config.h:104
int i
Definition: multi_pxo.cpp:466
LPMMIOPROC pIOProc
Definition: config.h:231
unsigned long SEGPTR
Definition: config.h:98
HPSTR pchEndWrite
Definition: config.h:238
#define __int64
Definition: config.h:113
GLfloat GLfloat GLfloat GLfloat h
Definition: Glext.h:7280
WAVEFORMAT wf
Definition: config.h:160
DWORD dwReserved1
Definition: config.h:242
Definition: config.h:286
HTASK hTask
Definition: config.h:233
FOURCC fccIOProc
Definition: config.h:230
HPSTR pchEndRead
Definition: config.h:237
bool QueryPerformanceCounter(LARGE_INTEGER *pcount)
void * HINSTANCE
Definition: config.h:105
WORD nChannels
Definition: config.h:166
LONG lBufOffset
Definition: config.h:239
DWORD nAvgBytesPerSec
Definition: config.h:168
WORD nBlockAlign
Definition: config.h:169
unsigned long * LPDWORD
Definition: config.h:90
SDL_RWops * HMMIO
Definition: config.h:93
void * HACMSTREAM
Definition: config.h:94
SDL_mutex * CRITICAL_SECTION
Definition: config.h:213
WORD nChannels
Definition: config.h:153
long HRESULT
Definition: config.h:96
struct waveformat_tag WAVEFORMAT
WORD wBitsPerSample
Definition: config.h:161
unsigned int UINT
Definition: config.h:82
MMRESULT mmioClose(HMMIO hmmio, uint wFlags)
long LPARAM
Definition: config.h:101
__int64 QuadPart
Definition: config.h:118
LONG cchBuffer
Definition: config.h:234
int _getcwd(char *buffer, unsigned int len)
char * LPSTR
Definition: config.h:107
unsigned int uint
Definition: pstypes.h:64
HMMIO hmmio
Definition: config.h:244
int _mkdir(const char *path)
long LONG_PTR
Definition: config.h:99
int _chdir(const char *path)
long mmioSeek(HMMIO hmmio, long lOffset, int iOrigin)
DWORD dwReserved2
Definition: config.h:243
INT32 * numerator
Definition: wglext.h:659
long * PLONG_PTR
Definition: config.h:99
DWORD dwFlags
Definition: config.h:229
unsigned long * PDWORD
Definition: config.h:90
GLuint buffer
Definition: Glext.h:5492
DWORD nAvgBytesPerSec
Definition: config.h:155
GLdouble s
Definition: Glext.h:5321
char * strnset(char *string, int fill, size_t count)
long HTASK
Definition: config.h:97
WORD wFormatTag
Definition: config.h:165
unsigned long DWORD
Definition: config.h:90
struct tWAVEFORMATEX WAVEFORMATEX
struct _LARGE_INTEGER LARGE_INTEGER
void * LPMMIOPROC
Definition: config.h:109
timeval TIMEVAL
Definition: config.h:216
HPSTR pchNext
Definition: config.h:236
unsigned long FOURCC
Definition: config.h:89
int x
Definition: config.h:287
long(CALLBACK * FARPROC16)()
Definition: config.h:102
void _splitpath(char *path, char *drive, char *dir, char *fname, char *ext)
long LONG
Definition: config.h:95
WORD cbSize
Definition: config.h:171
#define CALLBACK
Definition: config.h:75
WORD nBlockAlign
Definition: config.h:156
int BOOL
Definition: config.h:80
DWORD nSamplesPerSec
Definition: config.h:167
INT32 INT32 * denominator
Definition: wglext.h:659
int MulDiv(int number, int numerator, int denominator)
LONG lDiskOffset
Definition: config.h:240
unsigned short WORD
Definition: config.h:81
char * HPSTR
Definition: config.h:108
WORD wBitsPerSample
Definition: config.h:170
unsigned int MMRESULT
Definition: config.h:103
UINT wErrorRet
Definition: config.h:232
long LRESULT
Definition: config.h:100
UINT MMRESULT
Definition: msacm.h:153
GLsizei const GLchar ** path
Definition: Glext.h:6795
void Sleep(int mili)
WORD wFormatTag
Definition: config.h:152
int MessageBox(HWND h, const char *s1, const char *s2, int i)
struct pcmwaveformat_tag PCMWAVEFORMAT
long mmioRead(HMMIO hmmio, HPSTR pch, long cch)
GLint GLsizei count
Definition: Gl.h:1491
GLenum GLsizei len
Definition: Glext.h:6283
DWORD nSamplesPerSec
Definition: config.h:154
MMIOINFO * LPMMIOINFO
Definition: config.h:247
void * HANDLE
Definition: config.h:106
int y
Definition: config.h:287
void strlwr(char *s)
HPSTR pchBuffer
Definition: config.h:235
HMMIO mmioOpen(LPSTR szFilename, LPMMIOINFO lpmmioinfo, DWORD dwOpenFlags)