2002-12-17 06:46:56 +00:00
|
|
|
#ifndef ARCH_SETUP_WINDOWS_H
|
|
|
|
|
#define ARCH_SETUP_WINDOWS_H
|
|
|
|
|
|
2003-04-20 22:04:09 +00:00
|
|
|
/* Fix VC breakage. */
|
2002-12-17 06:46:56 +00:00
|
|
|
#define PATH_MAX _MAX_PATH
|
|
|
|
|
|
2003-04-20 22:04:09 +00:00
|
|
|
#if _MSC_VER < 1300 /* VC6, not VC7 */
|
|
|
|
|
#define NEED_MINMAX_TEMPLATES 1
|
|
|
|
|
#endif
|
|
|
|
|
|
2003-11-14 17:16:07 +00:00
|
|
|
/* Don't include windows.h everywhere; when we do eventually include it, use this: */
|
|
|
|
|
#define WIN32_LEAN_AND_MEAN
|
2004-01-05 19:52:48 +00:00
|
|
|
|
|
|
|
|
/* If this isn't defined to 0, VC fails to define things like stat and alloca. */
|
|
|
|
|
#define __STDC__ 0
|
2003-11-14 17:16:07 +00:00
|
|
|
|
2002-12-17 08:20:55 +00:00
|
|
|
#include <direct.h> /* has stuff that should be in unistd.h */
|
2003-04-20 22:04:09 +00:00
|
|
|
#include <wchar.h> /* needs to be included before our fixes below */
|
2002-12-17 08:20:55 +00:00
|
|
|
|
2004-01-05 19:52:48 +00:00
|
|
|
#define lstat stat
|
2003-12-21 06:21:19 +00:00
|
|
|
#define fsync _commit
|
2002-12-17 08:24:11 +00:00
|
|
|
/* mkdir is missing the mode arg */
|
|
|
|
|
#define mkdir(p,m) mkdir(p)
|
2002-12-17 08:20:55 +00:00
|
|
|
|
2004-02-14 08:22:30 +00:00
|
|
|
typedef time_t time_t;
|
|
|
|
|
struct tm;
|
|
|
|
|
struct tm *my_localtime_r( const time_t *timep, struct tm *result );
|
|
|
|
|
#define localtime_r my_localtime_r
|
|
|
|
|
struct tm *my_gmtime_r( const time_t *timep, struct tm *result );
|
|
|
|
|
#define gmtime_r my_gmtime_r
|
2004-05-13 21:09:42 +00:00
|
|
|
void my_usleep( unsigned long usec );
|
|
|
|
|
#define usleep my_usleep
|
2004-02-14 08:22:30 +00:00
|
|
|
|
2004-01-19 22:19:42 +00:00
|
|
|
/* Missing stdint types: */
|
2004-05-14 05:37:05 +00:00
|
|
|
typedef signed char int8_t;
|
|
|
|
|
typedef unsigned char uint8_t;
|
|
|
|
|
typedef signed short int16_t;
|
|
|
|
|
typedef unsigned short uint16_t;
|
|
|
|
|
typedef int int32_t;
|
|
|
|
|
typedef unsigned int uint32_t;
|
2004-01-19 22:19:42 +00:00
|
|
|
typedef __int64 int64_t;
|
|
|
|
|
typedef unsigned __int64 uint64_t;
|
|
|
|
|
static inline int64_t llabs( int64_t i ) { return i >= 0? i: -i; }
|
2003-11-14 17:16:07 +00:00
|
|
|
|
|
|
|
|
#pragma warning (disable : 4201) // nonstandard extension used : nameless struct/union (Windows headers do this)
|
2003-04-20 22:04:09 +00:00
|
|
|
#pragma warning (disable : 4786) // turn off broken debugger warning
|
|
|
|
|
#pragma warning (disable : 4512) // assignment operator could not be generated (so?)
|
|
|
|
|
/* "unreferenced formal parameter"; we *want* that in many cases */
|
|
|
|
|
#pragma warning (disable : 4100)
|
|
|
|
|
/* "case 'aaa' is not a valid value for switch of enum 'bbb'
|
|
|
|
|
* Actually, this is a valid warning, but we do it all over the
|
|
|
|
|
* place, eg. with ScreenMessages. Those should be fixed, but later. XXX */
|
|
|
|
|
#pragma warning (disable : 4063)
|
|
|
|
|
#pragma warning (disable : 4127)
|
|
|
|
|
#pragma warning (disable : 4786) /* VC6: identifier was truncated to '255' characters in the debug information */
|
|
|
|
|
|
|
|
|
|
#undef min
|
|
|
|
|
#undef max
|
|
|
|
|
#define NOMINMAX /* make sure Windows doesn't try to define this */
|
|
|
|
|
|
2003-06-30 04:42:17 +00:00
|
|
|
/* Windows is missing some basic math functions: */
|
|
|
|
|
#define NEED_TRUNCF
|
|
|
|
|
#define NEED_ROUNDF
|
2004-01-19 22:19:42 +00:00
|
|
|
#define MISSING_STDINT_H
|
2003-06-30 04:42:17 +00:00
|
|
|
|
2004-05-01 05:17:58 +00:00
|
|
|
inline int lrintf( float f )
|
|
|
|
|
{
|
|
|
|
|
int retval;
|
|
|
|
|
|
|
|
|
|
_asm fld f;
|
|
|
|
|
_asm fistp retval;
|
|
|
|
|
|
|
|
|
|
return retval;
|
|
|
|
|
}
|
|
|
|
|
|
2004-05-06 09:14:10 +00:00
|
|
|
/* For RageLog. */
|
2003-08-02 12:51:25 +00:00
|
|
|
#define HAVE_VERSION_INFO
|
|
|
|
|
|
2004-05-06 09:14:10 +00:00
|
|
|
/* We implement the crash handler interface (though that interface isn't completely
|
|
|
|
|
* uniform across platforms yet). */
|
|
|
|
|
#define CRASH_HANDLER
|
|
|
|
|
|
2003-12-07 04:17:17 +00:00
|
|
|
#ifdef _XBOX
|
|
|
|
|
#include <xtl.h>
|
|
|
|
|
#include <xgraphics.h>
|
|
|
|
|
#include <stdio.h>
|
|
|
|
|
#endif
|
|
|
|
|
|
2002-12-17 06:46:56 +00:00
|
|
|
#endif
|
|
|
|
|
|
2004-05-15 20:13:19 +00:00
|
|
|
/*
|
|
|
|
|
* (c) 2002-2004 Glenn Maynard
|
|
|
|
|
* All rights reserved.
|
|
|
|
|
*
|
|
|
|
|
* Permission is hereby granted, free of charge, to any person obtaining a
|
|
|
|
|
* copy of this software and associated documentation files (the
|
|
|
|
|
* "Software"), to deal in the Software without restriction, including
|
|
|
|
|
* without limitation the rights to use, copy, modify, merge, publish,
|
|
|
|
|
* distribute, and/or sell copies of the Software, and to permit persons to
|
|
|
|
|
* whom the Software is furnished to do so, provided that the above
|
|
|
|
|
* copyright notice(s) and this permission notice appear in all copies of
|
|
|
|
|
* the Software and that both the above copyright notice(s) and this
|
|
|
|
|
* permission notice appear in supporting documentation.
|
|
|
|
|
*
|
|
|
|
|
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
|
|
|
|
|
* OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
|
|
|
|
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT OF
|
|
|
|
|
* THIRD PARTY RIGHTS. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR HOLDERS
|
|
|
|
|
* INCLUDED IN THIS NOTICE BE LIABLE FOR ANY CLAIM, OR ANY SPECIAL INDIRECT
|
|
|
|
|
* OR CONSEQUENTIAL DAMAGES, OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS
|
|
|
|
|
* OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
|
|
|
|
|
* OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
|
|
|
|
|
* PERFORMANCE OF THIS SOFTWARE.
|
|
|
|
|
*/
|