mirror of
https://github.com/DrBeef/ioq3quest.git
synced 2025-01-31 13:00:52 +00:00
* Centralise architecture defines in q_platform.h
This commit is contained in:
parent
7067f0aa92
commit
a87185a96f
3 changed files with 69 additions and 131 deletions
|
@ -2348,7 +2348,7 @@ Com_Init
|
||||||
void Com_Init( char *commandLine ) {
|
void Com_Init( char *commandLine ) {
|
||||||
char *s;
|
char *s;
|
||||||
|
|
||||||
Com_Printf( "%s %s %s\n", Q3_VERSION, CPUSTRING, __DATE__ );
|
Com_Printf( "%s %s %s\n", Q3_VERSION, PLATFORM_STRING, __DATE__ );
|
||||||
|
|
||||||
if ( setjmp (abortframe) ) {
|
if ( setjmp (abortframe) ) {
|
||||||
Sys_Error ("Error during initialization");
|
Sys_Error ("Error during initialization");
|
||||||
|
@ -2455,7 +2455,7 @@ void Com_Init( char *commandLine ) {
|
||||||
Cmd_AddCommand ("changeVectors", MSG_ReportChangeVectors_f );
|
Cmd_AddCommand ("changeVectors", MSG_ReportChangeVectors_f );
|
||||||
Cmd_AddCommand ("writeconfig", Com_WriteConfig_f );
|
Cmd_AddCommand ("writeconfig", Com_WriteConfig_f );
|
||||||
|
|
||||||
s = va("%s %s %s", Q3_VERSION, CPUSTRING, __DATE__ );
|
s = va("%s %s %s", Q3_VERSION, PLATFORM_STRING, __DATE__ );
|
||||||
com_version = Cvar_Get ("version", s, CVAR_ROM | CVAR_SERVERINFO );
|
com_version = Cvar_Get ("version", s, CVAR_ROM | CVAR_SERVERINFO );
|
||||||
|
|
||||||
Sys_Init();
|
Sys_Init();
|
||||||
|
|
|
@ -71,33 +71,31 @@ float FloatSwap (const float *f);
|
||||||
#undef QDECL
|
#undef QDECL
|
||||||
#define QDECL __cdecl
|
#define QDECL __cdecl
|
||||||
|
|
||||||
// buildstring will be incorporated into the version string
|
|
||||||
#ifdef _MSC_VER
|
#ifdef _MSC_VER
|
||||||
#ifdef NDEBUG
|
#define OS_STRING "win_msvc"
|
||||||
|
|
||||||
#ifdef _M_IX86
|
#ifdef _M_IX86
|
||||||
#define CPUSTRING "win-x86"
|
#define ARCH_STRING "x86"
|
||||||
#elif defined _M_ALPHA
|
#elif defined _M_ALPHA
|
||||||
#define CPUSTRING "win-AXP"
|
#define ARCH_STRING "AXP"
|
||||||
#endif
|
|
||||||
#else
|
#else
|
||||||
#ifdef _M_IX86
|
#error "Unsupported architecture"
|
||||||
#define CPUSTRING "win-x86-debug"
|
|
||||||
#elif defined _M_ALPHA
|
|
||||||
#define CPUSTRING "win-AXP-debug"
|
|
||||||
#endif
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#elif defined __MINGW32__
|
#elif defined __MINGW32__
|
||||||
#ifdef NDEBUG
|
#define OS_STRING "win_mingw"
|
||||||
|
|
||||||
#ifdef __i386__
|
#ifdef __i386__
|
||||||
#define CPUSTRING "mingw-x86"
|
#define ARCH_STRING "x86"
|
||||||
#endif
|
|
||||||
#else
|
#else
|
||||||
#ifdef __i386__
|
#error "Unsupported architecture"
|
||||||
#define CPUSTRING "mingw-x86-debug"
|
|
||||||
#endif
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#else
|
||||||
|
#error "Unsupported compiler"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
||||||
#define ID_INLINE __inline
|
#define ID_INLINE __inline
|
||||||
|
|
||||||
static ID_INLINE short BigShort( short l) { return ShortSwap(l); }
|
static ID_INLINE short BigShort( short l) { return ShortSwap(l); }
|
||||||
|
@ -120,12 +118,14 @@ static ID_INLINE float BigFloat(const float l) { return FloatSwap(&l); }
|
||||||
#define stricmp strcasecmp
|
#define stricmp strcasecmp
|
||||||
#define ID_INLINE inline
|
#define ID_INLINE inline
|
||||||
|
|
||||||
|
#define OS_STRING "macosx"
|
||||||
|
|
||||||
#ifdef __ppc__
|
#ifdef __ppc__
|
||||||
#define CPUSTRING "MacOSX-ppc"
|
#define ARCH_STRING "ppc"
|
||||||
#elif defined __i386__
|
#elif defined __i386__
|
||||||
#define CPUSTRING "MacOSX-i386"
|
#define ARCH_STRING "i386"
|
||||||
#else
|
#else
|
||||||
#define CPUSTRING "MacOSX-other"
|
#error "Unsupported architecture"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#define PATH_SEP '/'
|
#define PATH_SEP '/'
|
||||||
|
@ -174,7 +174,8 @@ static ID_INLINE float LittleFloat(const float l) { return FloatSwap(&l); }
|
||||||
#include <MacTypes.h>
|
#include <MacTypes.h>
|
||||||
#define ID_INLINE inline
|
#define ID_INLINE inline
|
||||||
|
|
||||||
#define CPUSTRING "MacOS-PPC"
|
#define OS_STRING "macos"
|
||||||
|
#define ARCH_STRING "ppc"
|
||||||
|
|
||||||
#define PATH_SEP ':'
|
#define PATH_SEP ':'
|
||||||
|
|
||||||
|
@ -200,24 +201,38 @@ static ID_INLINE float LittleFloat(const float l) { return FloatSwap(&l); }
|
||||||
|
|
||||||
#define ID_INLINE inline
|
#define ID_INLINE inline
|
||||||
|
|
||||||
#ifdef __i386__
|
#define OS_STRING "linux"
|
||||||
#define CPUSTRING "linux-i386"
|
|
||||||
#elif defined __axp__
|
#if defined __i386__
|
||||||
#define CPUSTRING "linux-alpha"
|
#define ARCH_STRING "i386"
|
||||||
#elif defined __x86_64__
|
#elif defined __x86_64__
|
||||||
#define CPUSTRING "linux-x86_64"
|
#define ARCH_STRING "x86_64"
|
||||||
#elif defined __powerpc64__
|
#elif defined __powerpc64__
|
||||||
#define CPUSTRING "linux-ppc64"
|
#define ARCH_STRING "ppc64"
|
||||||
#elif defined __powerpc__
|
#elif defined __powerpc__
|
||||||
#define CPUSTRING "linux-ppc"
|
#define ARCH_STRING "ppc"
|
||||||
#elif defined __s390__
|
#elif defined __s390__
|
||||||
#define CPUSTRING "linux-s390"
|
#define ARCH_STRING "s390"
|
||||||
#elif defined __s390x__
|
#elif defined __s390x__
|
||||||
#define CPUSTRING "linux-s390x"
|
#define ARCH_STRING "s390x"
|
||||||
#elif defined __ia64__
|
#elif defined __ia64__
|
||||||
#define CPUSTRING "linux-ia64"
|
#define ARCH_STRING "ia64"
|
||||||
|
#elif defined __alpha__
|
||||||
|
#define ARCH_STRING "alpha"
|
||||||
|
#elif defined __sparc__
|
||||||
|
#define ARCH_STRING "sparc"
|
||||||
|
#elif defined __arm__
|
||||||
|
#define ARCH_STRING "arm"
|
||||||
|
#elif defined __cris__
|
||||||
|
#define ARCH_STRING "cris"
|
||||||
|
#elif defined __hppa__
|
||||||
|
#define ARCH_STRING "hppa"
|
||||||
|
#elif defined __mips__
|
||||||
|
#define ARCH_STRING "mips"
|
||||||
|
#elif defined __sh__
|
||||||
|
#define ARCH_STRING "sh"
|
||||||
#else
|
#else
|
||||||
#define CPUSTRING "linux-other"
|
#error "Unsupported architecture"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#define PATH_SEP '/'
|
#define PATH_SEP '/'
|
||||||
|
@ -248,12 +263,14 @@ ID_INLINE static float LittleFloat(const float l) { return FloatSwap(&l); }
|
||||||
|
|
||||||
#define ID_INLINE inline
|
#define ID_INLINE inline
|
||||||
|
|
||||||
|
#define OS_STRING "freebsd"
|
||||||
|
|
||||||
#ifdef __i386__
|
#ifdef __i386__
|
||||||
#define CPUSTRING "freebsd-i386"
|
#define ARCH_STRING "i386"
|
||||||
#elif defined __axp__
|
#elif defined __axp__
|
||||||
#define CPUSTRING "freebsd-alpha"
|
#define ARCH_STRING "alpha"
|
||||||
#else
|
#else
|
||||||
#define CPUSTRING "freebsd-other"
|
#error "Unsupported architecture"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#define PATH_SEP '/'
|
#define PATH_SEP '/'
|
||||||
|
@ -288,10 +305,12 @@ static float LittleFloat(const float l) { return FloatSwap(&l); }
|
||||||
|
|
||||||
#define ID_INLINE inline
|
#define ID_INLINE inline
|
||||||
|
|
||||||
|
#define OS_STRING "solaris"
|
||||||
|
|
||||||
#ifdef __i386__
|
#ifdef __i386__
|
||||||
#define CPUSTRING "Solaris-i386"
|
#define ARCH_STRING "i386"
|
||||||
#elif defined __sparc
|
#elif defined __sparc
|
||||||
#define CPUSTRING "Solaris-sparc"
|
#define ARCH_STRING "sparc"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#define PATH_SEP '/'
|
#define PATH_SEP '/'
|
||||||
|
@ -324,7 +343,8 @@ ID_INLINE static float BigFloat(const float l) { return FloatSwap(&l); }
|
||||||
|
|
||||||
#define ID_INLINE
|
#define ID_INLINE
|
||||||
|
|
||||||
#define CPUSTRING "q3vm"
|
#define OS_STRING "q3vm"
|
||||||
|
#define ARCH_STRING "bytecode"
|
||||||
|
|
||||||
#define PATH_SEP '/'
|
#define PATH_SEP '/'
|
||||||
|
|
||||||
|
@ -340,8 +360,8 @@ ID_INLINE static float BigFloat(const float l) { return FloatSwap(&l); }
|
||||||
//===========================================================================
|
//===========================================================================
|
||||||
|
|
||||||
//catch missing defines in above blocks
|
//catch missing defines in above blocks
|
||||||
#ifndef CPUSTRING
|
#if !defined( OS_STRING ) || !defined( ARCH_STRING )
|
||||||
#error "CPUSTRING not defined"
|
#error "OS_STRING or ARCH_STRING not defined"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifndef ID_INLINE
|
#ifndef ID_INLINE
|
||||||
|
@ -356,6 +376,12 @@ ID_INLINE static float BigFloat(const float l) { return FloatSwap(&l); }
|
||||||
#error "Endianness not defined"
|
#error "Endianness not defined"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#ifdef NDEBUG
|
||||||
|
#define PLATFORM_STRING OS_STRING "-" ARCH_STRING
|
||||||
|
#else
|
||||||
|
#define PLATFORM_STRING OS_STRING "-" ARCH_STRING "-debug"
|
||||||
|
#endif
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -353,65 +353,7 @@ void Sys_Init(void)
|
||||||
{
|
{
|
||||||
Cmd_AddCommand ("in_restart", Sys_In_Restart_f);
|
Cmd_AddCommand ("in_restart", Sys_In_Restart_f);
|
||||||
|
|
||||||
#if defined __linux__
|
Cvar_Set( "arch", OS_STRING " " ARCH_STRING );
|
||||||
# if defined __i386__
|
|
||||||
Cvar_Set( "arch", "linux i386" );
|
|
||||||
# elif defined __x86_64__
|
|
||||||
Cvar_Set( "arch", "linux x86_64" );
|
|
||||||
# elif defined __powerpc64__
|
|
||||||
Cvar_Set( "arch", "linux ppc64" );
|
|
||||||
# elif defined __powerpc__
|
|
||||||
Cvar_Set( "arch", "linux ppc" );
|
|
||||||
# elif defined __s390__
|
|
||||||
Cvar_Set( "arch", "linux s390" );
|
|
||||||
# elif defined __s390x__
|
|
||||||
Cvar_Set( "arch", "linux s390x" );
|
|
||||||
# elif defined __ia64__
|
|
||||||
Cvar_Set( "arch", "linux ia64" );
|
|
||||||
# elif defined __alpha__
|
|
||||||
Cvar_Set( "arch", "linux alpha" );
|
|
||||||
# elif defined __sparc__
|
|
||||||
Cvar_Set( "arch", "linux sparc" );
|
|
||||||
# elif defined __arm__
|
|
||||||
Cvar_Set( "arch", "linux arm" );
|
|
||||||
# elif defined __cris__
|
|
||||||
Cvar_Set( "arch", "linux cris" );
|
|
||||||
# elif defined __hppa__
|
|
||||||
Cvar_Set( "arch", "linux hppa" );
|
|
||||||
# elif defined __mips__
|
|
||||||
Cvar_Set( "arch", "linux mips" );
|
|
||||||
# elif defined __sh__
|
|
||||||
Cvar_Set( "arch", "linux sh" );
|
|
||||||
# else
|
|
||||||
# error unsupported architecture
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#elif defined __FreeBSD__
|
|
||||||
|
|
||||||
#if defined __i386__ // FreeBSD
|
|
||||||
Cvar_Set( "arch", "freebsd i386" );
|
|
||||||
#elif defined __alpha__
|
|
||||||
Cvar_Set( "arch", "freebsd alpha" );
|
|
||||||
#else
|
|
||||||
Cvar_Set( "arch", "freebsd unknown" );
|
|
||||||
#endif
|
|
||||||
#elif defined(__sun)
|
|
||||||
#if defined __i386__
|
|
||||||
Cvar_Set( "arch", "solaris x86" );
|
|
||||||
#elif defined __sparc__
|
|
||||||
Cvar_Set( "arch", "solaris sparc" );
|
|
||||||
#else
|
|
||||||
Cvar_Set( "arch", "solaris unknown" );
|
|
||||||
#endif
|
|
||||||
#elif defined __sgi__
|
|
||||||
#if defined __mips__
|
|
||||||
Cvar_Set( "arch", "sgi mips" );
|
|
||||||
#else
|
|
||||||
Cvar_Set( "arch", "sgi unknown" );
|
|
||||||
#endif
|
|
||||||
#else
|
|
||||||
Cvar_Set( "arch", "unknown" );
|
|
||||||
#endif
|
|
||||||
|
|
||||||
Cvar_Set( "username", Sys_GetCurrentUser() );
|
Cvar_Set( "username", Sys_GetCurrentUser() );
|
||||||
|
|
||||||
|
@ -779,37 +721,7 @@ void *Sys_LoadDll( const char *name, char *fqpath ,
|
||||||
assert( name );
|
assert( name );
|
||||||
|
|
||||||
getcwd(curpath, sizeof(curpath));
|
getcwd(curpath, sizeof(curpath));
|
||||||
#if defined __i386__
|
snprintf (fname, sizeof(fname), "%s" ARCH_STRING ".so", name);
|
||||||
snprintf (fname, sizeof(fname), "%si386.so", name);
|
|
||||||
#elif defined __x86_64__
|
|
||||||
snprintf (fname, sizeof(fname), "%sx86_64.so", name);
|
|
||||||
#elif defined __powerpc64__
|
|
||||||
snprintf (fname, sizeof(fname), "%sppc64.so", name);
|
|
||||||
#elif defined __powerpc__ //rcg010207 - PPC support.
|
|
||||||
snprintf (fname, sizeof(fname), "%sppc.so", name);
|
|
||||||
#elif defined __s390__
|
|
||||||
snprintf (fname, sizeof(fname), "%ss390.so", name);
|
|
||||||
#elif defined __s390x__
|
|
||||||
snprintf (fname, sizeof(fname), "%ss390x.so", name);
|
|
||||||
#elif defined __ia64__
|
|
||||||
snprintf (fname, sizeof(fname), "%sia64.so", name);
|
|
||||||
#elif defined __alpha__
|
|
||||||
snprintf (fname, sizeof(fname), "%saxp.so", name);
|
|
||||||
#elif defined __mips__
|
|
||||||
snprintf (fname, sizeof(fname), "%smips.so", name);
|
|
||||||
#elif defined __arm__
|
|
||||||
snprintf (fname, sizeof(fname), "%sarm.so", name);
|
|
||||||
#elif defined __cris__
|
|
||||||
snprintf (fname, sizeof(fname), "%scris.so", name);
|
|
||||||
#elif defined __hppa__
|
|
||||||
snprintf (fname, sizeof(fname), "%shppa.so", name);
|
|
||||||
#elif defined __sh__
|
|
||||||
snprintf (fname, sizeof(fname), "%ssh.so", name);
|
|
||||||
#elif defined __sparc__
|
|
||||||
snprintf (fname, sizeof(fname), "%ssparc.so", name);
|
|
||||||
#else
|
|
||||||
#error Unknown arch
|
|
||||||
#endif
|
|
||||||
|
|
||||||
// TODO: use fs_searchpaths from files.c
|
// TODO: use fs_searchpaths from files.c
|
||||||
pwdpath = Sys_Cwd();
|
pwdpath = Sys_Cwd();
|
||||||
|
|
Loading…
Reference in a new issue