|
|
@ -20,14 +20,10 @@ GNU General Public License for more details. |
|
|
|
#include "build.h" |
|
|
|
#include "build.h" |
|
|
|
|
|
|
|
|
|
|
|
#if !XASH_WIN32 |
|
|
|
#if !XASH_WIN32 |
|
|
|
#include <dlfcn.h> |
|
|
|
|
|
|
|
#include <unistd.h> |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
#define PATH_SPLITTER "/" |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
#if XASH_APPLE |
|
|
|
#if XASH_APPLE |
|
|
|
#include <sys/syslimits.h> |
|
|
|
#include <sys/syslimits.h> |
|
|
|
#include "TargetConditionals.h" |
|
|
|
|
|
|
|
#define OS_LIB_EXT "dylib" |
|
|
|
#define OS_LIB_EXT "dylib" |
|
|
|
#define OPEN_COMMAND "open" |
|
|
|
#define OPEN_COMMAND "open" |
|
|
|
#else |
|
|
|
#else |
|
|
@ -54,20 +50,35 @@ GNU General Public License for more details. |
|
|
|
|
|
|
|
|
|
|
|
#define _inline static inline |
|
|
|
#define _inline static inline |
|
|
|
#define FORCEINLINE inline __attribute__((always_inline)) |
|
|
|
#define FORCEINLINE inline __attribute__((always_inline)) |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
#if XASH_POSIX |
|
|
|
|
|
|
|
#define PATH_SPLITTER "/" |
|
|
|
|
|
|
|
#include <unistd.h> |
|
|
|
|
|
|
|
#include <dlfcn.h> |
|
|
|
#define O_BINARY 0 // O_BINARY is Windows extension
|
|
|
|
#define O_BINARY 0 // O_BINARY is Windows extension
|
|
|
|
#define O_TEXT 0 // O_TEXT is Windows extension
|
|
|
|
#define O_TEXT 0 // O_TEXT is Windows extension
|
|
|
|
|
|
|
|
// Windows functions to posix equivalent
|
|
|
|
// Windows functions to Linux equivalent
|
|
|
|
|
|
|
|
#define _mkdir( x ) mkdir( x, S_IRWXU | S_IRWXG | S_IROTH | S_IXOTH ) |
|
|
|
#define _mkdir( x ) mkdir( x, S_IRWXU | S_IRWXG | S_IROTH | S_IXOTH ) |
|
|
|
#define LoadLibrary( x ) dlopen( x, RTLD_NOW ) |
|
|
|
#define LoadLibrary( x ) dlopen( x, RTLD_NOW ) |
|
|
|
#define GetProcAddress( x, y ) dlsym( x, y ) |
|
|
|
#define GetProcAddress( x, y ) dlsym( x, y ) |
|
|
|
#define SetCurrentDirectory( x ) (!chdir( x )) |
|
|
|
#define SetCurrentDirectory( x ) (!chdir( x )) |
|
|
|
#define FreeLibrary( x ) dlclose( x ) |
|
|
|
#define FreeLibrary( x ) dlclose( x ) |
|
|
|
|
|
|
|
#define tell( a ) lseek(a, 0, SEEK_CUR) |
|
|
|
|
|
|
|
#define HAVE_DUP |
|
|
|
|
|
|
|
#endif |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
#if XASH_DOS4GW |
|
|
|
|
|
|
|
#define PATH_SPLITTER "\\" |
|
|
|
|
|
|
|
#define LoadLibrary( x ) (0) |
|
|
|
|
|
|
|
#define GetProcAddress( x, y ) (0) |
|
|
|
|
|
|
|
#define FreeLibrary( x ) (0) |
|
|
|
|
|
|
|
#define SetCurrentDirectory( x ) (!chdir( x )) |
|
|
|
|
|
|
|
#endif |
|
|
|
//#define MAKEWORD( a, b ) ((short int)(((unsigned char)(a))|(((short int)((unsigned char)(b)))<<8)))
|
|
|
|
//#define MAKEWORD( a, b ) ((short int)(((unsigned char)(a))|(((short int)((unsigned char)(b)))<<8)))
|
|
|
|
#define max( a, b ) (((a) > (b)) ? (a) : (b)) |
|
|
|
#define max( a, b ) (((a) > (b)) ? (a) : (b)) |
|
|
|
#define min( a, b ) (((a) < (b)) ? (a) : (b)) |
|
|
|
#define min( a, b ) (((a) < (b)) ? (a) : (b)) |
|
|
|
#define tell( a ) lseek(a, 0, SEEK_CUR) |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/// TODO: check if we may clean this defines, it should not appear in non-platform code!
|
|
|
|
typedef unsigned char BYTE; |
|
|
|
typedef unsigned char BYTE; |
|
|
|
typedef short int WORD; |
|
|
|
typedef short int WORD; |
|
|
|
typedef unsigned int DWORD; |
|
|
|
typedef unsigned int DWORD; |
|
|
@ -125,6 +136,8 @@ GNU General Public License for more details. |
|
|
|
// windows NameForFunction not implemented yet
|
|
|
|
// windows NameForFunction not implemented yet
|
|
|
|
#define XASH_ALLOW_SAVERESTORE_OFFSETS |
|
|
|
#define XASH_ALLOW_SAVERESTORE_OFFSETS |
|
|
|
#endif |
|
|
|
#endif |
|
|
|
|
|
|
|
#define HAVE_DUP |
|
|
|
|
|
|
|
|
|
|
|
#endif //WIN32
|
|
|
|
#endif //WIN32
|
|
|
|
#ifndef XASH_LOW_MEMORY |
|
|
|
#ifndef XASH_LOW_MEMORY |
|
|
|
#define XASH_LOW_MEMORY 0 |
|
|
|
#define XASH_LOW_MEMORY 0 |
|
|
|