engine: big refactoring commit, instead of using platform-specific platform-specific macros, use appropriate macros set by public/build.h

This commit is contained in:
Alibek Omarov 2019-11-24 03:52:08 +03:00
parent ac4a14ef6c
commit 9421457b3a
55 changed files with 190 additions and 211 deletions

View File

@ -26,7 +26,7 @@ SETUP BACKENDS DEFINITIONS
===================================================================
*/
#ifndef XASH_DEDICATED
#if !XASH_DEDICATED
#if XASH_SDL
// we are building using libSDL
#ifndef XASH_VIDEO

View File

@ -19,13 +19,13 @@ GNU General Public License for more details.
#include "build.h"
#if !defined(_WIN32)
#if !XASH_WIN32
#include <dlfcn.h>
#include <unistd.h>
#define PATH_SPLITTER "/"
#if defined(__APPLE__)
#if XASH_APPLE
#include <sys/syslimits.h>
#include "TargetConditionals.h"
#define OS_LIB_EXT "dylib"
@ -37,7 +37,7 @@ GNU General Public License for more details.
#define OS_LIB_PREFIX "lib"
#if defined(__ANDROID__)
#if XASH_ANDROID
//#if defined(LOAD_HARDFP)
// #define POSTFIX "_hardfp"
//#else

View File

@ -13,7 +13,8 @@ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
*/
#ifndef _WIN32
#include "build.h"
#if !XASH_WIN32
#include "common.h"
int AVI_GetVideoFrameNumber( movie_state_t *Avi, float time )

View File

@ -13,7 +13,8 @@ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
*/
#ifdef _WIN32
#include "build.h"
#if XASH_WIN32
#include "common.h"
#include "client.h"
#include <vfw.h> // video for windows

View File

@ -1960,7 +1960,7 @@ GetWindowCenterX
static int pfnGetWindowCenterX( void )
{
int x = 0;
#ifdef _WIN32
#if XASH_WIN32
if( m_ignore->value )
{
POINT pos;
@ -1985,7 +1985,7 @@ GetWindowCenterY
static int pfnGetWindowCenterY( void )
{
int y = 0;
#ifdef _WIN32
#if XASH_WIN32
if( m_ignore->value )
{
POINT pos;

View File

@ -13,8 +13,6 @@ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
*/
#ifndef XASH_DEDICATED
#include "common.h"
#include "client.h"
#include "mobility_int.h"
@ -136,4 +134,3 @@ void Mobile_Shutdown( void )
{
Cmd_RemoveCommand( "vibrate" );
}
#endif // XASH_DEDICATED

View File

@ -13,8 +13,6 @@ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
*/
#ifndef XASH_DEDICATED
#include "common.h"
#include "client.h"
#include "library.h"
@ -345,5 +343,3 @@ qboolean R_InitRenderAPI( void )
// render interface is missed
return true;
}
#endif // XASH_DEDICATED

View File

@ -14,8 +14,6 @@ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
*/
#ifndef XASH_DEDICATED
#include "common.h"
#include "input.h"
#include "keydefs.h"
@ -439,5 +437,3 @@ void Joy_Shutdown( void )
{
Cvar_FullSet( "joy_found", 0, FCVAR_READ_ONLY );
}
#endif // XASH_DEDICATED

View File

@ -12,8 +12,6 @@ but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
*/
#ifndef XASH_DEDICATED
#include "common.h"
#include "input.h"
#include "client.h"
@ -1975,4 +1973,3 @@ void Touch_Shutdown( void )
touch.initialized = false;
Mem_FreePool( &touch.mempool );
}
#endif

View File

@ -225,7 +225,7 @@ void IN_ToggleClientMouse( int newstate, int oldstate )
SDL_SetRelativeMouseMode( SDL_FALSE );
#endif
#endif // XASH_SDL
#ifdef __ANDROID__
#if XASH_ANDROID
Android_ShowMouse( true );
#endif
#ifdef XASH_USE_EVDEV
@ -234,7 +234,7 @@ void IN_ToggleClientMouse( int newstate, int oldstate )
}
else
{
#ifdef __ANDROID__
#if XASH_ANDROID
Android_ShowMouse( false );
#endif
#ifdef XASH_USE_EVDEV
@ -422,12 +422,12 @@ void IN_MouseEvent( void )
}
else
{
#if XASH_SDL && !defined(_WIN32)
#if XASH_SDL && !XASH_WIN32
#if SDL_VERSION_ATLEAST( 2, 0, 0 )
SDL_SetRelativeMouseMode( SDL_FALSE );
#endif // SDL_VERSION_ATLEAST( 2, 0, 0 )
SDL_ShowCursor( SDL_TRUE );
#endif // XASH_SDL && !defined(_WIN32)
#endif // XASH_SDL && !XASH_WIN32
IN_MouseMove();
}
}
@ -579,7 +579,7 @@ void IN_CollectInput( float *forward, float *side, float *pitch, float *yaw, qbo
}
#endif // INPUT_SDL
#ifdef __ANDROID__
#if XASH_INPUT == INPUT_ANDROID
{
float x, y;
Android_MouseMove( &x, &y );

View File

@ -566,7 +566,7 @@ static void SetWidthAndHeightFromCommandLine( void )
static void SetFullscreenModeFromCommandLine( void )
{
#ifndef __ANDROID__
#if !XASH_MOBILE_PLATFORM
if ( Sys_CheckParm("-fullscreen") )
{
Cvar_Set( "fullscreen", "1" );

View File

@ -12,9 +12,6 @@ but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
*/
#ifndef XASH_DEDICATED
#include <string.h>
#include "common.h"
#include "client.h"
@ -551,4 +548,3 @@ void *GAME_EXPORT VGui_GetPanel( void )
return vgui.GetPanel();
return NULL;
}
#endif

View File

@ -999,7 +999,7 @@ void Cmd_ExecuteString( char *text )
// forward the command line to the server, so the entity DLL can parse it
if( host.type == HOST_NORMAL )
{
#ifndef XASH_DEDICATED
#if !XASH_DEDICATED
if( cls.state >= ca_connected )
{
Cmd_ForwardToServer();
@ -1022,7 +1022,7 @@ things like godmode, noclip, etc, are commands directed to the server,
so when they are typed in at the console, they will need to be forwarded.
===================
*/
#ifndef XASH_DEDICATED
#if !XASH_DEDICATED
void Cmd_ForwardToServer( void )
{
char str[MAX_CMD_BUFFER];
@ -1248,9 +1248,9 @@ void Cmd_Init( void )
Cmd_AddCommand( "cmdlist", Cmd_List_f, "display all console commands beginning with the specified prefix" );
Cmd_AddCommand( "stuffcmds", Cmd_StuffCmds_f, "execute commandline parameters (must be present in .rc script)" );
Cmd_AddCommand( "apropos", Cmd_Apropos_f, "lists all console variables/commands/aliases containing the specified string in the name or description" );
#ifndef XASH_DEDICATED
#if !XASH_DEDICATED
Cmd_AddCommand( "cmd", Cmd_ForwardToServer, "send a console commandline to the server" );
#endif
#endif // XASH_DEDICATED
Cmd_AddCommand( "alias", Cmd_Alias_f, "create a script function. Without arguments show the list of all alias" );
Cmd_AddCommand( "unalias", Cmd_UnAlias_f, "remove a script function" );
Cmd_AddCommand( "if", Cmd_If_f, "compare and set condition bits" );

View File

@ -45,7 +45,7 @@ XASH SPECIFIC - sort of hack that works only in Xash3D not in GoldSrc
#include <stdlib.h> // rand, adbs
#include <stdarg.h> // va
#ifndef _WIN32
#if !XASH_WIN32
#include <stddef.h> // size_t
#else
#include <sys/types.h> // off_t
@ -60,7 +60,7 @@ XASH SPECIFIC - sort of hack that works only in Xash3D not in GoldSrc
#error "Please select timer backend"
#endif
#ifndef XASH_DEDICATED
#if !XASH_DEDICATED
#if XASH_VIDEO == VIDEO_NULL
#error "Please select video backend"
#endif

View File

@ -481,7 +481,7 @@ qboolean Cmd_GetSoundList( const char *s, char *completedname, int length )
return true;
}
#ifndef XASH_DEDICATED
#if !XASH_DEDICATED
/*
=====================================
Cmd_GetItemsList
@ -986,7 +986,7 @@ autocomplete_list_t cmd_list[] =
{ "music", 1, Cmd_GetMusicList, },
{ "movie", 1, Cmd_GetMovieList },
{ "exec", 1, Cmd_GetConfigList },
#ifndef XASH_DEDICATED
#if !XASH_DEDICATED
{ "give", 1, Cmd_GetItemsList },
{ "drop", 1, Cmd_GetItemsList },
{ "bind", 1, Cmd_GetKeysList },
@ -1314,9 +1314,7 @@ void Cmd_WriteOpenGLVariables( file_t *f )
Cvar_LookupVars( FCVAR_GLCONFIG, NULL, f, (setpair_t)Cmd_WriteOpenGLCvar );
}
#ifndef XASH_DEDICATED
#if !XASH_DEDICATED
void Host_FinalizeConfig( file_t *f, const char *config )
{
string backup, newcfg;

View File

@ -233,7 +233,7 @@ void Sys_RestoreCrashHandler( void )
#include "library.h"
#if defined(__FreeBSD__) || defined(__NetBSD__) || defined(__ANDROID__) || defined(__linux__)
#if XASH_FREEBSD || XASH_NETBSD || XASH_ANDROID || XASH_LINUX
#define HAVE_UCONTEXT_H 1
#endif
@ -276,22 +276,22 @@ static void Sys_Crash( int signal, siginfo_t *si, void *context)
int len, logfd, i = 0;
size_t pagesize;
#if defined(__OpenBSD__)
#if XASH_OPENBSD
struct sigcontext *ucontext = (struct sigcontext*)context;
#else
ucontext_t *ucontext = (ucontext_t*)context;
#endif
#if defined(__x86_64__)
#if defined(__FreeBSD__)
#if XASH_AMD64
#if XASH_FREEBSD
pc = (void*)ucontext->uc_mcontext.mc_rip;
bp = (void**)ucontext->uc_mcontext.mc_rbp;
sp = (void**)ucontext->uc_mcontext.mc_rsp;
#elif defined(__NetBSD__)
#elif XASH_NETBSD
pc = (void*)ucontext->uc_mcontext.__gregs[REG_RIP];
bp = (void**)ucontext->uc_mcontext.__gregs[REG_RBP];
sp = (void**)ucontext->uc_mcontext.__gregs[REG_RSP];
#elif defined(__OpenBSD__)
#elif XASH_OPENBSD
pc = (void*)ucontext->sc_rip;
bp = (void**)ucontext->sc_rbp;
sp = (void**)ucontext->sc_rsp;
@ -300,16 +300,16 @@ static void Sys_Crash( int signal, siginfo_t *si, void *context)
bp = (void**)ucontext->uc_mcontext.gregs[REG_RBP];
sp = (void**)ucontext->uc_mcontext.gregs[REG_RSP];
#endif
#elif defined(__i386__)
#if defined(__FreeBSD__)
#elif XASH_X86
#if XASH_FREEBSD
pc = (void*)ucontext->uc_mcontext.mc_eip;
bp = (void**)ucontext->uc_mcontext.mc_ebp;
sp = (void**)ucontext->uc_mcontext.mc_esp;
#elif defined(__NetBSD__)
#elif XASH_NETBSD
pc = (void*)ucontext->uc_mcontext.__gregs[REG_EIP];
bp = (void**)ucontext->uc_mcontext.__gregs[REG_EBP];
sp = (void**)ucontext->uc_mcontext.__gregs[REG_ESP];
#elif defined(__OpenBSD__)
#elif XASH_OPENBSD
pc = (void*)ucontext->sc_eip;
bp = (void**)ucontext->sc_ebp;
sp = (void**)ucontext->sc_esp;
@ -318,11 +318,11 @@ static void Sys_Crash( int signal, siginfo_t *si, void *context)
bp = (void**)ucontext->uc_mcontext.gregs[REG_EBP];
sp = (void**)ucontext->uc_mcontext.gregs[REG_ESP];
#endif
#elif defined(__aarch64__) // arm not tested
#elif XASH_ARM64
pc = (void*)ucontext->uc_mcontext.pc;
bp = (void*)ucontext->uc_mcontext.regs[29];
sp = (void*)ucontext->uc_mcontext.sp;
#elif defined(__arm__)
#elif XASH_ARM
pc = (void*)ucontext->uc_mcontext.arm_pc;
bp = (void*)ucontext->uc_mcontext.arm_fp;
sp = (void*)ucontext->uc_mcontext.arm_sp;
@ -334,7 +334,7 @@ static void Sys_Crash( int signal, siginfo_t *si, void *context)
len = Q_snprintf( message, sizeof( message ), "Ver: %s %s (build %i-%s, %s-%s)\n",
XASH_ENGINE_NAME, XASH_VERSION, Q_buildnum(), Q_buildcommit(), Q_buildos(), Q_buildarch() );
#if !defined(__FreeBSD__) && !defined(__NetBSD__) && !defined(__OpenBSD__)
#if !XASH_BSD
len += Q_snprintf( message + len, sizeof( message ) - len, "Crash: signal %d errno %d with code %d at %p %p\n", signal, si->si_errno, si->si_code, si->si_addr, si->si_ptr );
#else
len += Q_snprintf( message + len, sizeof( message ) - len, "Crash: signal %d errno %d with code %d at %p\n", signal, si->si_errno, si->si_code, si->si_addr );

View File

@ -45,7 +45,7 @@ void COM_ClearCustomizationList( customization_t *pHead, qboolean bCleanDecals )
if( pCurrent->bInUse && pCurrent->pInfo )
{
#ifndef XASH_DEDICATED
#if !XASH_DEDICATED
if( pCurrent->resource.type == t_decal )
{
if( bCleanDecals && CL_Active( ))

View File

@ -113,7 +113,7 @@ static qboolean Cvar_UpdateInfo( convar_t *var, const char *value, qboolean noti
Info_SetValueForKey( SV_Serverinfo(), var->name, value, MAX_SERVERINFO_STRING ),
SV_BroadcastCommand( "fullserverinfo \"%s\"\n", SV_Serverinfo( ));
}
#ifndef XASH_DEDICATED
#if !XASH_DEDICATED
else
{
if( !Info_SetValueForKey( CL_Userinfo(), var->name, value, MAX_INFO_STRING ))

View File

@ -12,7 +12,7 @@ but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
*/
#ifdef XASH_DEDICATED
#if XASH_DEDICATED
#include "common.h"
#include "mathlib.h"
#include "ref_api.h"

View File

@ -13,10 +13,11 @@ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
*/
#include "build.h"
#include <fcntl.h>
#include <sys/stat.h>
#include <time.h>
#ifdef _WIN32
#if XASH_WIN32
#include <direct.h>
#include <io.h>
#else
@ -143,7 +144,7 @@ char fs_gamedir[MAX_SYSPATH]; // game current directory
char fs_writedir[MAX_SYSPATH]; // path that game allows to overwrite, delete and rename files (and create new of course)
qboolean fs_ext_path = false; // attempt to read\write from ./ or ../ pathes
#ifndef _WIN32
#if !XASH_WIN32
qboolean fs_caseinsensitive = true; // try to search missing files
#endif
@ -248,7 +249,7 @@ static void listdirectory( stringlist_t *list, const char *path, qboolean lowerc
{
int i;
signed char *c;
#ifdef _WIN32
#if XASH_WIN32
char pattern[4096];
struct _finddata_t n_file;
int hFile;
@ -257,7 +258,7 @@ static void listdirectory( stringlist_t *list, const char *path, qboolean lowerc
struct dirent *entry;
#endif
#ifdef _WIN32
#if XASH_WIN32
Q_snprintf( pattern, sizeof( pattern ), "%s*", path );
// ask for the directory listing handle
@ -304,7 +305,7 @@ emulate WIN32 FS behaviour when opening local file
*/
static const char *FS_FixFileCase( const char *path )
{
#if !defined _WIN32 && !TARGET_OS_IPHONE // assume case insensitive
#if !XASH_WIN32 && !XASH_IOS // assume case insensitive
DIR *dir; struct dirent *entry;
char path2[PATH_MAX], *fname;
@ -491,7 +492,7 @@ pack_t *FS_LoadPackPAK( const char *packfile, int *error )
packhandle = open( packfile, O_RDONLY|O_BINARY );
#ifndef _WIN32
#if !XASH_WIN32
if( packhandle < 0 )
{
const char *fpackfile = FS_FixFileCase( packfile );
@ -602,7 +603,7 @@ static zip_t *FS_LoadZip( const char *zipfile, int *error )
zip->handle = FS_Open( zipfile, "rb", true );
#ifndef _WIN32
#if !XASH_WIN32
if( !zip->handle )
{
const char *fzipfile = FS_FixFileCase( zipfile );
@ -1269,16 +1270,11 @@ void FS_Rescan( void )
FS_ClearSearchPath();
#if TARGET_OS_IPHONE
#if XASH_IOS
{
FS_AddPak_Fullpath( va( "%sextras.pak", SDL_GetBasePath() ), NULL, extrasFlags );
FS_AddPak_Fullpath( va( "%sextras_%s.pak", SDL_GetBasePath(), GI->gamefolder ), NULL, extrasFlags );
}
#elif defined(__SAILFISH__)
{
FS_AddPak_Fullpath( va( SHAREPATH"/extras.pak" ), NULL, extrasFlags );
FS_AddPak_Fullpath( va( SHAREPATH"/%s/extras.pak", GI->gamefolder ), NULL, extrasFlags );
}
#else
if( ( str = getenv( "XASH3D_EXTRAS_PAK1" ) ) )
FS_AddPak_Fullpath( str, NULL, extrasFlags );
@ -1922,7 +1918,7 @@ void FS_Init( void )
Cmd_AddCommand( "fs_path", FS_Path_f, "show filesystem search pathes" );
Cmd_AddCommand( "fs_clearpaths", FS_ClearPaths_f, "clear filesystem search pathes" );
#ifndef _WIN32
#if !XASH_WIN32
if( Sys_CheckParm( "-casesensitive" ) )
fs_caseinsensitive = false;
@ -2116,7 +2112,7 @@ static file_t *FS_SysOpen( const char *filepath, const char *mode )
file->handle = open( filepath, mod|opt, 0666 );
#ifndef _WIN32
#if !XASH_WIN32
if( file->handle < 0 )
{
const char *ffilepath = FS_FixFileCase( filepath );
@ -2182,7 +2178,7 @@ Look for a file in the filesystem only
*/
qboolean FS_SysFileExists( const char *path, qboolean caseinsensitive )
{
#ifdef _WIN32
#if XASH_WIN32
int desc;
if(( desc = open( path, O_RDONLY|O_BINARY )) < 0 )
@ -2220,7 +2216,7 @@ Look for a existing folder
*/
qboolean FS_SysFolderExists( const char *path )
{
#ifdef _WIN32
#if XASH_WIN32
DWORD dwFlags = GetFileAttributes( path );
return ( dwFlags != -1 ) && ( dwFlags & FILE_ATTRIBUTE_DIRECTORY );

View File

@ -13,19 +13,20 @@ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
*/
#include "build.h"
#ifdef XASH_SDL
#include <SDL.h>
#endif // XASH_SDL
#include <stdarg.h> // va_args
#include <errno.h> // errno
#include <string.h> // strerror
#ifndef _WIN32
#if !XASH_WIN32
#include <unistd.h> // fork
#include <sys/types.h>
#include <sys/stat.h>
#include <fcntl.h>
#endif
#ifdef __EMSCRIPTEN__
#if XASH_EMSCRIPTEN
#include <emscripten/emscripten.h>
#endif
#include <errno.h>
@ -113,7 +114,7 @@ qboolean Host_IsQuakeCompatible( void )
if( FBitSet( host.features, ENGINE_QUAKE_COMPATIBLE ))
return true;
#ifndef XASH_DEDICATED
#if !XASH_DEDICATED
// quake demo playing
if( cls.demoplayback == DEMO_QUAKE1 )
return true;
@ -139,7 +140,7 @@ void Host_EndGame( qboolean abort, const char *message, ... )
Con_Printf( "Host_EndGame: %s\n", string );
SV_Shutdown( "\n" );
#ifndef XASH_DEDICATED
#if !XASH_DEDICATED
CL_Disconnect();
// recreate world if needs
@ -451,7 +452,7 @@ double Host_CalcFPS( void )
{
fps = sys_ticrate.value;
}
#ifndef XASH_DEDICATED
#if !XASH_DEDICATED
else if( CL_IsPlaybackDemo() || CL_IsRecordDemo( )) // NOTE: we should play demos with same fps as it was recorded
{
fps = CL_GetDemoFramerate();
@ -800,7 +801,7 @@ void Host_InitCommon( int argc, char **argv, const char *progname, qboolean bCha
host.con_showalways = true;
#ifdef XASH_DEDICATED
#if XASH_DEDICATED
host.type = HOST_DEDICATED; // predict state
#else
if( Sys_CheckParm("-dedicated") || progname[0] == '#' )
@ -1057,7 +1058,7 @@ void EXPORT Host_Shutdown( void )
if( host.status != HOST_ERR_FATAL ) host.status = HOST_SHUTDOWN; // prepare host to normal shutdown
if( !host.change_game ) Q_strncpy( host.finalmsg, "Server shutdown", sizeof( host.finalmsg ));
#ifndef XASH_DEDICATED
#if !XASH_DEDICATED
if( host.type == HOST_NORMAL )
Host_WriteConfig();
#endif

View File

@ -136,7 +136,7 @@ void Host_ShutdownGame( void )
void Host_RunFrame( float time )
{
// at this time, we don't need to get events from OS on dedicated
#ifndef XASH_DEDICATED
#if !XASH_DEDICATED
Platform_RunEvents();
#endif // XASH_DEDICATED

View File

@ -15,7 +15,7 @@ GNU General Public License for more details.
#include "common.h"
#include <fcntl.h>
#ifndef _WIN32
#if !XASH_WIN32
#include <dirent.h>
#endif
static char id_md5[33];
@ -161,8 +161,7 @@ void ID_VerifyHEX_f( void )
Msg( "Bad\n" );
}
#ifdef __linux__
#if XASH_LINUX
qboolean ID_ProcessCPUInfo( bloomfilter_t *value )
{
int cpuinfofd = open( "/proc/cpuinfo", O_RDONLY );
@ -317,7 +316,7 @@ qboolean ID_ProcessFile( bloomfilter_t *value, const char *path )
return true;
}
#ifndef _WIN32
#if !XASH_WIN32
int ID_ProcessFiles( bloomfilter_t *value, const char *prefix, const char *postfix )
{
DIR *dir;
@ -483,7 +482,7 @@ int ID_CheckWMIC( bloomfilter_t value, const char *cmdline )
#endif
#if TARGET_OS_IOS
#if XASH_IOS
char *IOS_GetUDID( void );
#endif
@ -492,8 +491,8 @@ bloomfilter_t ID_GenerateRawId( void )
bloomfilter_t value = 0;
int count = 0;
#ifdef __linux__
#if defined(__ANDROID__) && !defined(XASH_DEDICATED)
#if XASH_LINUX
#if XASH_ANDROID && !XASH_DEDICATED
{
const char *androidid = Android_GetAndroidID();
if( androidid && ID_VerifyHEX( androidid ) )
@ -507,11 +506,11 @@ bloomfilter_t ID_GenerateRawId( void )
count += ID_ProcessFiles( &value, "/sys/block", "device/cid" );
count += ID_ProcessNetDevices( &value );
#endif
#ifdef _WIN32
#if XASH_WIN32
count += ID_ProcessWMIC( &value, "wmic path win32_physicalmedia get SerialNumber " );
count += ID_ProcessWMIC( &value, "wmic bios get serialnumber " );
#endif
#if TARGET_OS_IOS
#if XASH_IOS
{
value |= BloomFilter_ProcessStr(IOS_GetUDID());
count ++;
@ -525,8 +524,8 @@ uint ID_CheckRawId( bloomfilter_t filter )
bloomfilter_t value = 0;
int count = 0;
#ifdef __linux__
#if defined(__ANDROID__) && !defined(XASH_DEDICATED)
#if XASH_LINUX
#if XASH_ANDROID && !XASH_DEDICATED
{
const char *androidid = Android_GetAndroidID();
if( androidid && ID_VerifyHEX( androidid ) )
@ -543,12 +542,12 @@ uint ID_CheckRawId( bloomfilter_t filter )
count += (filter & value) == value;
#endif
#ifdef _WIN32
#if XASH_WIN32
count += ID_CheckWMIC( filter, "wmic path win32_physicalmedia get SerialNumber" );
count += ID_CheckWMIC( filter, "wmic bios get serialnumber" );
#endif
#if TARGET_OS_IOS
#if XASH_IOS
{
value = BloomFilter_ProcessStr(IOS_GetUDID());
count += (filter & value) == value;
@ -617,11 +616,11 @@ void ID_Init( void )
Cmd_AddCommand( "bloomfilter", ID_BloomFilter_f, "print bloomfilter raw value of arguments set");
Cmd_AddCommand( "verifyhex", ID_VerifyHEX_f, "check if id source seems to be fake" );
#ifdef __linux__
#if XASH_LINUX
Cmd_AddCommand( "testcpuinfo", ID_TestCPUInfo_f, "try read cpu serial" );
#endif
#if defined(__ANDROID__) && !defined(XASH_DEDICATED)
#if XASH_ANDROID && !XASH_DEDICATED
sscanf( Android_LoadID(), "%016llX", &id );
if( id )
{
@ -629,7 +628,7 @@ void ID_Init( void )
ID_Check();
}
#elif defined _WIN32
#elif XASH_WIN32
{
CHAR szBuf[MAX_PATH];
ID_GetKeyData( HKEY_CURRENT_USER, "Software\\Xash3D\\", "xash_id", szBuf, MAX_PATH );
@ -680,9 +679,9 @@ void ID_Init( void )
for( i = 0; i < 16; i++ )
Q_sprintf( &id_md5[i*2], "%02hhx", md5[i] );
#if defined(__ANDROID__) && !defined(XASH_DEDICATED)
#if XASH_ANDROID && !XASH_DEDICATED
Android_SaveID( va("%016llX", id^SYSTEM_XOR_MASK ) );
#elif defined _WIN32
#elif XASH_WIN32
{
CHAR Buf[MAX_PATH];
sprintf( Buf, "%016llX", id^SYSTEM_XOR_MASK );

View File

@ -17,7 +17,7 @@ GNU General Public License for more details.
#include "mathlib.h"
#define BI_SIZE 40 //size of bitmap info header.
#ifndef _WIN32
#if !XASH_WIN32
#define BI_RGB 0
typedef struct tagRGBQUAD {

View File

@ -17,7 +17,7 @@ GNU General Public License for more details.
#include "miniz.h"
#include "imagelib.h"
#include "mathlib.h"
#ifndef _WIN32
#if !XASH_WIN32
#include <netinet/in.h>
#endif

View File

@ -131,7 +131,7 @@ qboolean Info_IsValid( const char *s )
return true;
}
#ifndef XASH_DEDICATED
#if !XASH_DEDICATED
/*
==============
Info_WriteVars

View File

@ -17,12 +17,12 @@ GNU General Public License for more details.
#include <stdlib.h>
#include <string.h>
#include "build.h"
#ifdef XASH_SDLMAIN
#include "SDL.h"
#endif
#ifdef __EMSCRIPTEN__
#if XASH_EMSCRIPTEN
#include <emscripten.h>
#endif
typedef void (*pfnChangeGame)( const char *progname );
@ -78,14 +78,14 @@ int main( int argc, char** argv )
gamedir = gamedir_buf;
}
#ifdef __EMSCRIPTEN__
#if XASH_EMSCRIPTEN
#ifdef EMSCRIPTEN_LIB_FS
// For some unknown reason emscripten refusing to load libraries later
Com_LoadLibrary("menu", 0 );
Com_LoadLibrary("server", 0 );
Com_LoadLibrary("client", 0 );
#endif
#ifdef XASH_DEDICATED
#if XASH_DEDICATED
// NodeJS support for debug
EM_ASM(try{
FS.mkdir('/xash');
@ -97,7 +97,7 @@ int main( int argc, char** argv )
g_iArgc = argc;
g_pszArgv = argv;
#if TARGET_OS_IPHONE
#if XASH_IOS
{
void IOS_LaunchDialog( void );
IOS_LaunchDialog();

View File

@ -1085,7 +1085,7 @@ static void Mod_CalcSurfaceExtents( msurface_t *surf )
info->lightextents[i] = surf->extents[i];
}
#if !defined XASH_DEDICATED && 0 // REFTODO:
#if !XASH_DEDICATED && 0 // REFTODO:
if( !FBitSet( tex->flags, TEX_SPECIAL ) && ( surf->extents[i] > 16384 ) && ( tr.block_size == BLOCK_SIZE_DEFAULT ))
Con_Reportf( S_ERROR "Bad surface extents %i\n", surf->extents[i] );
#endif // XASH_DEDICATED
@ -1912,7 +1912,7 @@ static void Mod_LoadTextures( dbspmodel_t *bmod )
if( bmod->isworld )
{
#ifndef XASH_DEDICATED
#if !XASH_DEDICATED
// release old sky layers first
if( !Host_IsDedicated() )
{
@ -1944,7 +1944,7 @@ static void Mod_LoadTextures( dbspmodel_t *bmod )
loadmodel->textures[i] = tx;
Q_strncpy( tx->name, "*default", sizeof( tx->name ));
#ifndef XASH_DEDICATED
#if !XASH_DEDICATED
if( !Host_IsDedicated() )
{
tx->gl_texturenum = R_GetBuiltinTexture( REF_DEFAULT_TEXTURE );
@ -1993,7 +1993,7 @@ static void Mod_LoadTextures( dbspmodel_t *bmod )
if( remaining >= 770 ) custom_palette = true;
}
#ifndef XASH_DEDICATED
#if !XASH_DEDICATED
if( !Host_IsDedicated() )
{
// check for multi-layered sky texture (quake1 specific)
@ -2370,7 +2370,7 @@ static void Mod_LoadSurfaces( dbspmodel_t *bmod )
next_lightofs = 99999999;
}
#ifndef XASH_DEDICATED // TODO: Do we need subdivide on server?
#if !XASH_DEDICATED // TODO: Do we need subdivide on server?
if( FBitSet( out->flags, SURF_DRAWTURB ) && !Host_IsDedicated() )
ref.dllFuncs.GL_SubdivideSurface( out ); // cut up polygon for warps
#endif
@ -2820,7 +2820,7 @@ qboolean Mod_LoadBmodelLumps( const byte *mod_base, qboolean isworld )
if( isworld )
{
loadmodel = mod; // restore pointer to world
#ifndef XASH_DEDICATED
#if !XASH_DEDICATED
Mod_InitDebugHulls(); // FIXME: build hulls for separate bmodels (shells, medkits etc)
world.deluxedata = bmod->deluxedata_out; // deluxemap data pointer
world.shadowdata = bmod->shadowdata_out; // occlusion data pointer

View File

@ -17,7 +17,7 @@ GNU General Public License for more details.
#include "common.h"
#include "sprite.h"
#include "studio.h"
#ifndef XASH_DEDICATED
#if !XASH_DEDICATED
#include "ref_common.h"
#endif // XASH_DEDICATED

View File

@ -85,7 +85,7 @@ static void Mod_FreeUserData( model_t *mod )
svgame.physFuncs.Mod_ProcessUserData( mod, false, NULL );
}
}
#ifndef XASH_DEDICATED
#if !XASH_DEDICATED
else
{
ref.dllFuncs.Mod_ProcessRenderData( mod, false, NULL );
@ -154,7 +154,7 @@ void Mod_FreeAll( void )
{
int i;
#ifndef XASH_DEDICATED
#if !XASH_DEDICATED
Mod_ReleaseHullPolygons();
#endif
for( i = 0; i < mod_numknown; i++ )
@ -327,7 +327,7 @@ model_t *Mod_LoadModel( model_t *mod, qboolean crash )
svgame.physFuncs.Mod_ProcessUserData( mod, true, buf );
}
}
#ifndef XASH_DEDICATED
#if !XASH_DEDICATED
else
{
loaded = ref.dllFuncs.Mod_ProcessRenderData( mod, true, buf );
@ -404,7 +404,7 @@ static void Mod_PurgeStudioCache( void )
// refresh hull data
SetBits( r_showhull->flags, FCVAR_CHANGED );
#ifndef XASH_DEDICATED
#if !XASH_DEDICATED
Mod_ReleaseHullPolygons();
#endif
// release previois map

View File

@ -1312,7 +1312,7 @@ Netchan_UpdateProgress
*/
void Netchan_UpdateProgress( netchan_t *chan )
{
#ifndef XASH_DEDICATED
#if !XASH_DEDICATED
fragbuf_t *p;
int i, c = 0;
int total = 0;

View File

@ -1558,7 +1558,7 @@ Read the clientdata
*/
void MSG_ReadClientData( sizebuf_t *msg, clientdata_t *from, clientdata_t *to, float timebase )
{
#ifndef XASH_DEDICATED
#if !XASH_DEDICATED
delta_t *pField;
delta_info_t *dt;
int i;
@ -1779,7 +1779,7 @@ Can go from either a baseline or a previous packet_entity
*/
qboolean MSG_ReadDeltaEntity( sizebuf_t *msg, entity_state_t *from, entity_state_t *to, int number, int delta_type, float timebase )
{
#ifndef XASH_DEDICATED
#if !XASH_DEDICATED
delta_info_t *dt = NULL;
delta_t *pField;
int i, fRemoveType;

View File

@ -17,7 +17,7 @@ GNU General Public License for more details.
#include "client.h" // ConnectionProgress
#include "netchan.h"
#include "mathlib.h"
#ifdef _WIN32
#if XASH_WIN32
// Winsock
#include <WS2tcpip.h>
#else
@ -44,7 +44,7 @@ GNU General Public License for more details.
#define SPLITPACKET_MAX_SIZE 64000
#define NET_MAX_FRAGMENTS ( NET_MAX_FRAGMENT / (SPLITPACKET_MIN_SIZE - sizeof( SPLITPACKET )) )
#ifndef _WIN32 // not available in XP
#if !XASH_WIN32 // not available in XP
#define HAVE_GETADDRINFO
#define WSAGetLastError() errno
#define WSAEINTR EINTR
@ -84,16 +84,16 @@ GNU General Public License for more details.
#define WSAENAMETOOLONG ENAMETOOLONG
#define WSAEHOSTDOWN EHOSTDOWN
#ifdef __EMSCRIPTEN__
#if XASH_EMSCRIPTEN
/* All socket operations are non-blocking already */
static int ioctl_stub( int d, unsigned long r, ... )
{
return 0;
}
#define ioctlsocket ioctl_stub
#else // __EMSCRIPTEN__
#else // XASH_EMSCRIPTEN
#define ioctlsocket ioctl
#endif // __EMSCRIPTEN__
#endif // XASH_EMSCRIPTEN
#define closesocket close
#define SOCKET int
#define INVALID_SOCKET -1
@ -157,7 +157,7 @@ typedef struct
qboolean threads_initialized;
qboolean configured;
qboolean allow_ip;
#ifdef _WIN32
#if XASH_WIN32
WSADATA winsockdata;
#endif
} net_state_t;
@ -181,7 +181,7 @@ NET_ErrorString
*/
char *NET_ErrorString( void )
{
#ifdef _WIN32
#if XASH_WIN32
int err = WSANOTINITIALISED;
if( net.initialized )
@ -242,7 +242,7 @@ char *NET_ErrorString( void )
_inline qboolean NET_IsSocketError( int retval )
{
#ifdef _WIN32
#if XASH_WIN32
return retval == SOCKET_ERROR ? true : false;
#else
return retval < 0 ? true : false;
@ -251,7 +251,7 @@ _inline qboolean NET_IsSocketError( int retval )
_inline qboolean NET_IsSocketValid( int socket )
{
#ifdef _WIN32
#if XASH_WIN32
return socket != INVALID_SOCKET;
#else
return socket >= 0;
@ -335,14 +335,14 @@ int NET_GetHostByName( const char *hostname )
#endif
}
#if !defined XASH_NO_ASYNC_NS_RESOLVE && ( defined _WIN32 || !defined __EMSCRIPTEN__ )
#if !defined XASH_NO_ASYNC_NS_RESOLVE && ( XASH_WIN32 || !XASH_EMSCRIPTEN )
#define CAN_ASYNC_NS_RESOLVE
#endif
#ifdef CAN_ASYNC_NS_RESOLVE
static void NET_ResolveThread( void );
#if !defined _WIN32
#if !XASH_WIN32
#include <pthread.h>
#define mutex_lock pthread_mutex_lock
#define mutex_unlock pthread_mutex_unlock
@ -386,12 +386,12 @@ static struct nsthread_s
string hostname;
qboolean busy;
} nsthread
#ifndef _WIN32
#if !XASH_WIN32
= { PTHREAD_MUTEX_INITIALIZER, PTHREAD_MUTEX_INITIALIZER }
#endif
;
#ifdef _WIN32
#if XASH_WIN32
static void NET_InitializeCriticalSections( void )
{
net.threads_initialized = true;
@ -1107,7 +1107,7 @@ qboolean NET_QueuePacket( netsrc_t sock, netadr_t *from, byte *data, size_t *len
// Transfer data
memcpy( data, buf, ret );
*length = ret;
#ifndef XASH_DEDICATED
#if !XASH_DEDICATED
if( CL_LegacyMode() )
return NET_LagPacket( true, sock, from, length, data );
@ -1702,7 +1702,7 @@ void NET_Init( void )
net.ip_sockets[i] = INVALID_SOCKET;
}
#ifdef _WIN32
#if XASH_WIN32
if( WSAStartup( MAKEWORD( 1, 1 ), &net.winsockdata ))
{
Con_DPrintf( S_ERROR "network initialization failed.\n" );
@ -1748,7 +1748,7 @@ void NET_Shutdown( void )
NET_ClearLagData( true, true );
NET_Config( false );
#ifdef _WIN32
#if XASH_WIN32
WSACleanup();
#endif
net.initialized = false;
@ -2137,10 +2137,10 @@ void HTTP_Run( void )
// but download will lock engine, maybe you will need to add manual returns
mode = 1;
ioctlsocket( curfile->socket, FIONBIO, &mode );
#ifdef __linux__
#if XASH_LINUX
// SOCK_NONBLOCK is not portable, so use fcntl
fcntl( curfile->socket, F_SETFL, fcntl( curfile->socket, F_GETFL, 0 ) | O_NONBLOCK );
#endif
#endif
curfile->state = HTTP_SOCKET;
}

View File

@ -68,7 +68,7 @@ void NET_SendPacket( netsrc_t sock, size_t length, const void *data, netadr_t to
void NET_SendPacketEx( netsrc_t sock, size_t length, const void *data, netadr_t to, size_t splitsize );
void NET_ClearLagData( qboolean bClient, qboolean bServer );
#ifndef XASH_DEDICATED
#if !XASH_DEDICATED
qboolean CL_LegacyMode( void );
int CL_GetSplitSize( void );
#endif

View File

@ -16,7 +16,7 @@ GNU General Public License for more details.
#include "common.h"
#include "mathlib.h"
#include "pm_local.h"
#ifndef XASH_DEDICATED
#if !XASH_DEDICATED
#include "client.h" // CL_Particle
#endif
@ -32,7 +32,7 @@ draw line from particles
*/
void PM_ParticleLine( const vec3_t start, const vec3_t end, int pcolor, float life, float zvel )
{
#ifndef XASH_DEDICATED
#if !XASH_DEDICATED
float len, curdist;
vec3_t diff, pos;
@ -72,7 +72,7 @@ PM_DrawBBox
*/
void PM_DrawBBox( const vec3_t mins, const vec3_t maxs, const vec3_t origin, int pcolor, float life )
{
#ifndef XASH_DEDICATED
#if !XASH_DEDICATED
vec3_t p[8], tmp;
float gap = BOX_GAP;
int i;

View File

@ -461,7 +461,7 @@ pmtrace_t PM_PlayerTraceExt( playermove_t *pmove, vec3_t start, vec3_t end, int
// run custom sweep callback
if( pmove->server || Host_IsLocalClient( ))
SV_ClipPMoveToEntity( pe, start, mins, maxs, end, &trace_bbox );
#ifndef XASH_DEDICATED
#if !XASH_DEDICATED
else CL_ClipPMoveToEntity( pe, start, mins, maxs, end, &trace_bbox );
#endif
}
@ -630,7 +630,7 @@ int PM_TestPlayerPosition( playermove_t *pmove, vec3_t pos, pmtrace_t *ptrace, p
// run custom sweep callback
if( pmove->server || Host_IsLocalClient( ))
SV_ClipPMoveToEntity( pe, pos, mins, maxs, pos, &trace );
#ifndef XASH_DEDICATED
#if !XASH_DEDICATED
else CL_ClipPMoveToEntity( pe, pos, mins, maxs, pos, &trace );
#endif

View File

@ -14,11 +14,11 @@ GNU General Public License for more details.
*/
#include "common.h"
#ifdef __ANDROID__
#if XASH_ANDROID
#include <android/log.h>
#endif
#if !defined( _WIN32 ) && !defined( XASH_MOBILE_PLATFORM )
#if !XASH_WIN32 && !XASH_MOBILE_PLATFORM
#define XASH_COLORIZE_CONSOLE
// use with caution, running engine in Qt Creator may cause a freeze in read() call
// I was never encountered this bug anywhere else, so still enable by default
@ -68,7 +68,7 @@ char *Sys_Input( void )
}
}
#endif
#ifdef _WIN32
#if XASH_WIN32
return Wcon_Input();
#endif
return NULL;
@ -78,7 +78,7 @@ void Sys_DestroyConsole( void )
{
// last text message into console or log
Con_Reportf( "Sys_DestroyConsole: Exiting!\n" );
#ifdef _WIN32
#if XASH_WIN32
Wcon_DestroyConsole();
#endif
}
@ -219,7 +219,7 @@ void Sys_PrintLog( const char *pMsg )
}
#else
#if !defined __ANDROID__ || defined XASH_DEDICATED
#if !XASH_ANDROID || XASH_DEDICATED
printf( "%s %s", logtime, pMsg );
fflush( stdout );
#endif

View File

@ -22,12 +22,12 @@ GNU General Public License for more details.
#include <SDL.h>
#endif
#ifndef _WIN32
#if !XASH_WIN32
#include <unistd.h>
#include <signal.h>
#include <dlfcn.h>
#ifndef __ANDROID__
#if !XASH_ANDROID
#include <pwd.h>
#endif
#endif
@ -47,14 +47,14 @@ double GAME_EXPORT Sys_DoubleTime( void )
return Platform_DoubleTime();
}
#if defined __linux__ || ( defined _WIN32 && !defined XASH_64BIT )
#if XASH_LINUX || ( XASH_WIN32 && !XASH_64BIT )
#undef DEBUG_BREAK
qboolean Sys_DebuggerPresent( void ); // see sys_linux.c
#ifdef _MSC_VER
#if XASH_MSVC
#define DEBUG_BREAK \
if( Sys_DebuggerPresent() ) \
_asm{ int 3 }
#elif __i386__
#elif XASH_X86
#define DEBUG_BREAK \
if( Sys_DebuggerPresent() ) \
asm volatile("int $3;")
@ -65,7 +65,7 @@ double GAME_EXPORT Sys_DoubleTime( void )
#endif
#endif
#ifndef XASH_DEDICATED
#if !XASH_DEDICATED
/*
================
Sys_GetClipboardData
@ -122,13 +122,13 @@ returns username for current profile
*/
char *Sys_GetCurrentUser( void )
{
#if defined(_WIN32)
#if XASH_WIN32
static string s_userName;
unsigned long size = sizeof( s_userName );
if( GetUserName( s_userName, &size ))
return s_userName;
#elif !defined(__ANDROID__)
#elif !XASH_ANDROID
uid_t uid = geteuid();
struct passwd *pw = getpwuid( uid );
@ -248,7 +248,7 @@ qboolean Sys_GetIntFromCmdLine( const char* argName, int *out )
void Sys_SendKeyEvents( void )
{
#ifdef _WIN32
#if XASH_WIN32
MSG msg;
while( PeekMessage( &msg, NULL, 0, 0, PM_NOREMOVE ))
@ -353,7 +353,7 @@ wait for 'Esc' key will be hit
*/
void Sys_WaitForQuit( void )
{
#ifdef _WIN32
#if XASH_WIN32
MSG msg;
Wcon_RegisterHotkeys();
@ -433,7 +433,7 @@ void Sys_Error( const char *error, ... )
if( host_developer.value )
{
#ifdef _WIN32
#if XASH_WIN32
Wcon_ShowConsole( true );
Wcon_DisableInput(); // disable input line for dedicated server
#endif
@ -442,7 +442,7 @@ void Sys_Error( const char *error, ... )
}
else
{
#ifdef _WIN32
#if XASH_WIN32
Wcon_ShowConsole( false );
#endif
MSGBOX( text );
@ -451,7 +451,7 @@ void Sys_Error( const char *error, ... )
Sys_Quit();
}
#ifdef __EMSCRIPTEN__
#if XASH_EMSCRIPTEN
/* strange glitchy bug on emscripten
_exit->_Exit->asm._exit->_exit
As we do not need atexit(), just throw hidden exception
@ -486,14 +486,14 @@ print into window console
*/
void Sys_Print( const char *pMsg )
{
#ifndef XASH_DEDICATED
#if !XASH_DEDICATED
if( !Host_IsDedicated() )
{
Con_Print( pMsg );
}
#endif
#ifdef _WIN32
#if XASH_WIN32
{
const char *msg;
static char buffer[MAX_PRINT_MSG];

View File

@ -83,7 +83,7 @@ int Sys_LogFileNo( void );
//
// con_win.c
//
#ifdef _WIN32
#if XASH_WIN32
void Wcon_InitConsoleCommands( void );
void Wcon_ShowConsole( qboolean show );
void Wcon_Init( void );

View File

@ -13,7 +13,8 @@ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
*/
#pragma once
#ifdef __EMSCRIPTEN__
#include "build.h"
#ifdef XASH_EMSCRIPTEN
#ifndef EM_LIB_H
#define EM_LIB_H

View File

@ -133,7 +133,7 @@ static int KeycodeFromEvdev(int keycode, int value)
}
static void Evdev_CheckPermissions( void )
{
#ifdef __ANDROID__
#if XASH_ANDROID
system( "su 0 chmod 664 /dev/input/event*" );
#endif
}
@ -142,7 +142,7 @@ void Evdev_Setup( void )
{
if( evdev.initialized )
return;
#ifdef __ANDROID__
#if XASH_ANDROID
system( "su 0 supolicy --live \"allow appdomain input_device dir { ioctl read getattr search open }\" \"allow appdomain input_device chr_file { ioctl read write getattr lock append open }\"" );
system( "su 0 setenforce permissive" );
#endif

View File

@ -10,7 +10,7 @@
#include <linux/fb.h>
#include <sys/mman.h>
#include <sys/ioctl.h>
#ifdef __ANDROID__
#if XASH_ANDROID
#include <linux/kd.h>
#else
#include <sys/kd.h>

View File

@ -36,7 +36,7 @@ void Platform_MessageBox( const char *title, const char *message, qboolean paren
// see system.c
// qboolean Sys_DebuggerPresent( void );
#ifdef __ANDROID__
#if XASH_ANDROID
const char *Android_GetAndroidID( void );
const char *Android_LoadID( void );
void Android_SaveID( const char *id );
@ -83,7 +83,7 @@ void Platform_SetClipboardText( const char *buffer, size_t size );
#define SDL_VERSION_ATLEAST( x, y, z ) 0
#endif
#ifdef __ANDROID__
#if XASH_ANDROID
void Android_ShowMouse( qboolean show );
void Android_MouseMove( float *x, float *y );
#endif

View File

@ -13,7 +13,8 @@ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
*/
#ifndef _WIN32 // see win_lib.c
#include "build.h"
#if !XASH_WIN32 // see win_lib.c
#define _GNU_SOURCE
#include "common.h"

View File

@ -66,7 +66,7 @@ static qboolean Sys_FindExecutable( const char *baseName, char *buf, size_t size
return false;
}
#ifndef __ANDROID__
#if !XASH_ANDROID
void Platform_ShellExecute( const char *path, const char *parms )
{
char xdgOpen[128];
@ -90,7 +90,7 @@ void Platform_ShellExecute( const char *path, const char *parms )
Con_Reportf( S_WARN "Could not find "OPEN_COMMAND" utility\n" );
}
}
#endif // __ANDROID__
#endif // XASH_ANDROID
#if XASH_MESSAGEBOX == MSGBOX_STDERR
void Platform_MessageBox( const char *title, const char *message, qboolean parentMainWindow )

View File

@ -12,8 +12,7 @@ but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
*/
#if defined( XASH_SDL ) && !defined( XASH_DEDICATED )
#if defined( XASH_SDL ) && !XASH_DEDICATED
#include <SDL.h>
#include <ctype.h>
@ -627,4 +626,4 @@ void Platform_PreCreateMove( void )
}
}
#endif // defined( XASH_SDL ) && !defined( XASH_DEDICATED )
#endif // defined( XASH_SDL ) && !XASH_DEDICATED

View File

@ -12,7 +12,7 @@ but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
*/
#ifndef XASH_DEDICATED
#if !XASH_DEDICATED
#include <SDL.h>
#include "common.h"

View File

@ -237,12 +237,12 @@ void SNDDMA_Shutdown( void )
{
SNDDMA_Activate( false );
#ifndef __EMSCRIPTEN__
#if !XASH_EMSCRIPTEN
SDL_CloseAudioDevice( sdl_dev );
#endif
}
#ifndef __EMSCRIPTEN__
#if !XASH_EMSCRIPTEN
if( SDL_WasInit( SDL_INIT_AUDIO ) )
SDL_QuitSubSystem( SDL_INIT_AUDIO );
#endif

View File

@ -12,7 +12,7 @@ but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
*/
#ifndef XASH_DEDICATED
#if !XASH_DEDICATED
#include <SDL.h>
#include "common.h"
#include "client.h"
@ -597,7 +597,7 @@ void VID_RestoreScreenResolution( void )
#endif // SDL_VERSION_ATLEAST( 2, 0, 0 )
}
#if defined(_WIN32) && !defined(XASH_64BIT) // ICO support only for Win32
#if XASH_WIN32 && !XASH_64BIT // ICO support only for Win32
#include "SDL_syswm.h"
static void WIN_SetWindowIcon( HICON ico )
{
@ -685,7 +685,7 @@ qboolean VID_CreateWindow( int width, int height, qboolean fullscreen )
VID_RestoreScreenResolution();
}
#if defined(_WIN32) && !defined(XASH_64BIT) // ICO support only for Win32
#if XASH_WIN32 && !XASH_64BIT // ICO support only for Win32
if( FS_FileExists( GI->iconpath, true ) )
{
HICON ico;
@ -727,7 +727,7 @@ qboolean VID_CreateWindow( int width, int height, qboolean fullscreen )
}
}
#if defined(_WIN32) && !defined(XASH_64BIT) // ICO support only for Win32
#if XASH_WIN32 && !XASH_64BIT // ICO support only for Win32
if( !iconLoaded )
{
WIN_SetWindowIcon( LoadIcon( host.hInst, MAKEINTRESOURCE( 101 ) ) );
@ -971,13 +971,13 @@ qboolean R_Init_Video( const int type )
refState.desktopBitsPixel = 16;
#endif
#if SDL_VERSION_ATLEAST( 2, 0, 0 ) && !defined(_WIN32)
#if SDL_VERSION_ATLEAST( 2, 0, 0 ) && !XASH_WIN32
SDL_SetHint( "SDL_VIDEO_X11_XRANDR", "1" );
SDL_SetHint( "SDL_VIDEO_X11_XVIDMODE", "1" );
#endif
// must be initialized before creating window
#ifdef _WIN32
#if XASH_WIN32
WIN_SetDPIAwareness();
#endif

View File

@ -589,7 +589,7 @@ void SV_RestartAmbientSounds( void )
SV_StartSound( pfnPEntityOfEntIndex( si->entnum ), CHAN_STATIC, si->name, si->volume, si->attenuation, 0, si->pitch );
}
#ifndef XASH_DEDICATED // TODO: ???
#if !XASH_DEDICATED // TODO: ???
// restart soundtrack
if( S_StreamGetCurrentState( curtrack, looptrack, &position ))
{
@ -618,7 +618,7 @@ void SV_RestartDecals( void )
// g-cont. add space for studiodecals if present
host.decalList = (decallist_t *)Z_Calloc( sizeof( decallist_t ) * MAX_RENDER_DECALS * 2 );
#ifndef XASH_DEDICATED
#if !XASH_DEDICATED
if( !Host_IsDedicated() )
{
host.numdecals = ref.dllFuncs.R_CreateDecalList( host.decalList );
@ -3049,7 +3049,7 @@ void SV_SetStringArrayMode( qboolean dynamic )
}
#ifdef XASH_64BIT
#ifndef _WIN32
#if !XASH_WIN32
#define USE_MMAP
#include <sys/mman.h>
#endif

View File

@ -21,7 +21,7 @@ GNU General Public License for more details.
#include "ref_common.h"
typedef int (*PHYSICAPI)( int, server_physics_api_t*, physics_interface_t* );
#ifndef XASH_DEDICATED
#if !XASH_DEDICATED
extern triangleapi_t gTriApi;
#endif
@ -2005,7 +2005,7 @@ const char* pfnGetModelName( int modelindex )
static const byte *GL_TextureData( unsigned int texnum )
{
#ifndef XASH_DEDICATED
#if !XASH_DEDICATED
return Host_IsDedicated() ? NULL : ref.dllFuncs.GL_TextureData( texnum );
#else // XASH_DEDICATED
return NULL;
@ -2021,7 +2021,7 @@ static server_physics_api_t gPhysicsAPI =
SV_GetHeadNode,
SV_ServerState,
Host_Error,
#ifndef XASH_DEDICATED
#if !XASH_DEDICATED
&gTriApi, // ouch!
pfnDrawConsoleString,
pfnDrawSetTextColor,

View File

@ -498,7 +498,7 @@ static void AgeSaveList( const char *pName, int count )
FS_Delete( newName );
FS_Delete( newShot );
#ifndef XASH_DEDICATED
#if !XASH_DEDICATED
// unloading the shot footprint
GL_FreeImage( newShot );
#endif // XASH_DEDICATED
@ -521,7 +521,7 @@ static void AgeSaveList( const char *pName, int count )
Q_snprintf( newName, sizeof( newName ), "%s%s%02d.sav", DEFAULT_SAVE_DIRECTORY, pName, count );
Q_snprintf( newShot, sizeof( newShot ), "%s%s%02d.bmp", DEFAULT_SAVE_DIRECTORY, pName, count );
#ifndef XASH_DEDICATED
#if !XASH_DEDICATED
// unloading the oldshot footprint too
GL_FreeImage( oldShot );
#endif // XASH_DEDICATED
@ -1111,7 +1111,7 @@ static void SaveClientState( SAVERESTOREDATA *pSaveData, const char *level, int
decalList = (decallist_t *)Z_Calloc( sizeof( decallist_t ) * MAX_RENDER_DECALS * 2 );
// initialize client header
#ifndef XASH_DEDICATED
#if !XASH_DEDICATED
if( !Host_IsDedicated() )
{
header.decalCount = ref.dllFuncs.R_CreateDecalList( decalList );
@ -1128,7 +1128,7 @@ static void SaveClientState( SAVERESTOREDATA *pSaveData, const char *level, int
{
// sounds won't going across transition
header.soundCount = S_GetCurrentDynamicSounds( soundInfo, MAX_CHANNELS );
#ifndef XASH_DEDICATED
#if !XASH_DEDICATED
// music not reqiured to save position: it's just continue playing on a next level
S_StreamGetCurrentState( header.introTrack, header.mainTrack, &header.trackPosition );
#endif
@ -2104,7 +2104,7 @@ void SV_SaveGame( const char *pName )
}
else Q_strncpy( savename, pName, sizeof( savename ));
#ifndef XASH_DEDICATED
#if !XASH_DEDICATED
// unload previous image from memory (it's will be overwritten)
GL_FreeImage( va( "%s%s.bmp", DEFAULT_SAVE_DIRECTORY, savename ));
#endif // XASH_DEDICATED
@ -2112,7 +2112,7 @@ void SV_SaveGame( const char *pName )
SaveBuildComment( comment, sizeof( comment ));
result = SaveGameSlot( savename, comment );
#ifndef XASH_DEDICATED
#if !XASH_DEDICATED
if( result && !FBitSet( host.features, ENGINE_QUAKE_COMPATIBLE ))
CL_HudMessage( "GAMESAVED" ); // defined in titles.txt
#endif // XASH_DEDICATED

View File

@ -666,7 +666,7 @@ void GL_InitExtensionsBigGL( void )
if( GL_CheckExtension( "GL_EXT_texture_filter_anisotropic", NULL, "gl_texture_anisotropic_filter", GL_ANISOTROPY_EXT ))
pglGetFloatv( GL_MAX_TEXTURE_MAX_ANISOTROPY_EXT, &glConfig.max_texture_anisotropy );
#ifdef _WIN32 // Win32 only drivers?
#if XASH_WIN32 // Win32 only drivers?
// g-cont. because lodbias it too glitchy on Intel's cards
if( glConfig.hardware_type != GLHW_INTEL )
#endif
@ -691,7 +691,7 @@ void GL_InitExtensionsBigGL( void )
pglGetIntegerv( GL_MAX_VERTEX_UNIFORM_COMPONENTS_ARB, &glConfig.max_vertex_uniforms );
pglGetIntegerv( GL_MAX_VERTEX_ATTRIBS_ARB, &glConfig.max_vertex_attribs );
#ifdef _WIN32 // Win32 only drivers?
#if XASH_WIN32 // Win32 only drivers?
if( glConfig.hardware_type == GLHW_RADEON && glConfig.max_vertex_uniforms > 512 )
glConfig.max_vertex_uniforms /= 4; // radeon returns not correct info
#endif
@ -769,7 +769,7 @@ void GL_InitExtensions( void )
gEngfuncs.Image_AddCmdFlags( IL_DDS_HARDWARE );
// MCD has buffering issues
#ifdef _WIN32
#if XASH_WIN32
if( Q_strstr( glConfig.renderer_string, "gdi" ))
gEngfuncs.Cvar_SetValue( "gl_finish", 1 );
#endif

View File

@ -2221,7 +2221,7 @@ static void R_AdditionalPasses( vboarray_t *vbo, int indexlen, void *indexarray,
pglScalef( glt->xscale, glt->yscale, 1 );
// draw
#if !defined XASH_NANOGL || defined XASH_WES && defined __EMSCRIPTEN__ // WebGL need to know array sizes
#if !defined XASH_NANOGL || defined XASH_WES && XASH_EMSCRIPTEN // WebGL need to know array sizes
if( pglDrawRangeElements )
pglDrawRangeElements( GL_TRIANGLES, 0, vbo->array_len, indexlen, GL_UNSIGNED_SHORT, indexarray );
else
@ -2252,7 +2252,7 @@ Draw array for given vbotexture_t. build and draw dynamic lightmaps if present
*/
static void R_DrawLightmappedVBO( vboarray_t *vbo, vbotexture_t *vbotex, texture_t *texture, int lightmap, qboolean skiplighting )
{
#if !defined XASH_NANOGL || defined XASH_WES && defined __EMSCRIPTEN__ // WebGL need to know array sizes
#if !defined XASH_NANOGL || defined XASH_WES && XASH_EMSCRIPTEN // WebGL need to know array sizes
if( pglDrawRangeElements )
pglDrawRangeElements( GL_TRIANGLES, 0, vbo->array_len, vbotex->curindex, GL_UNSIGNED_SHORT, vbotex->indexarray );
else
@ -2269,7 +2269,7 @@ static void R_DrawLightmappedVBO( vboarray_t *vbo, vbotexture_t *vbotex, texture
GL_SelectTexture( XASH_TEXTURE0 );
pglDisable( GL_TEXTURE_2D );
pglDisable( GL_DEPTH_TEST );
#if !defined XASH_NANOGL || defined XASH_WES && defined __EMSCRIPTEN__ // WebGL need to know array sizes
#if !defined XASH_NANOGL || defined XASH_WES && XASH_EMSCRIPTEN // WebGL need to know array sizes
if( pglDrawRangeElements )
pglDrawRangeElements( GL_LINES, 0, vbo->array_len, vbotex->curindex, GL_UNSIGNED_SHORT, vbotex->indexarray );
else
@ -2340,7 +2340,7 @@ static void R_DrawLightmappedVBO( vboarray_t *vbo, vbotexture_t *vbotex, texture
// out of free block space. Draw all generated index array and clear it
// upload already generated block
LM_UploadDynamicBlock();
#if !defined XASH_NANOGL || defined XASH_WES && defined __EMSCRIPTEN__ // WebGL need to know array sizes
#if !defined XASH_NANOGL || defined XASH_WES && XASH_EMSCRIPTEN // WebGL need to know array sizes
if( pglDrawRangeElements )
pglDrawRangeElements( GL_TRIANGLES, 0, vbo->array_len, dlightindex, GL_UNSIGNED_SHORT, dlightarray );
else
@ -2520,7 +2520,7 @@ static void R_DrawLightmappedVBO( vboarray_t *vbo, vbotexture_t *vbotex, texture
LM_UploadDynamicBlock();
// draw remaining array
#if !defined XASH_NANOGL || defined XASH_WES && defined __EMSCRIPTEN__ // WebGL need to know array sizes
#if !defined XASH_NANOGL || defined XASH_WES && XASH_EMSCRIPTEN // WebGL need to know array sizes
if( pglDrawRangeElements )
pglDrawRangeElements( GL_TRIANGLES, 0, vbo->array_len, dlightindex, GL_UNSIGNED_SHORT, dlightarray );
else

View File

@ -2264,7 +2264,7 @@ _inline void R_StudioDrawArrays( uint startverts, uint startelems )
pglColorPointer( 4, GL_UNSIGNED_BYTE, 0, g_studio.arraycolor );
}
#if !defined XASH_NANOGL || defined XASH_WES && defined __EMSCRIPTEN__ // WebGL need to know array sizes
#if !defined XASH_NANOGL || defined XASH_WES && XASH_EMSCRIPTEN // WebGL need to know array sizes
if( pglDrawRangeElements )
pglDrawRangeElements( GL_TRIANGLES, startverts, g_studio.numverts,
g_studio.numelems - startelems, GL_UNSIGNED_SHORT, &g_studio.arrayelems[startelems] );