Browse Source

wscript: allow to setup engine default gamedir during configure

pull/2/head
Alibek Omarov 2 years ago
parent
commit
f571a41cf3
  1. 6
      engine/common/launcher.c
  2. 6
      game_launch/game.cpp
  3. 6
      wscript

6
engine/common/launcher.c

@ -35,7 +35,9 @@ __declspec(dllexport) int AmdPowerXpressRequestHighPerformance = 1; @@ -35,7 +35,9 @@ __declspec(dllexport) int AmdPowerXpressRequestHighPerformance = 1;
#endif
#define E_GAME "XASH3D_GAME" // default env dir to start from
#define GAME_PATH "valve" // default dir to start from
#ifndef XASH_GAMEDIR
#define XASH_GAMEDIR "valve"
#endif
static char szGameDir[128]; // safe place to keep gamedir
static int szArgc;
@ -56,7 +58,7 @@ _inline int Sys_Start( void ) @@ -56,7 +58,7 @@ _inline int Sys_Start( void )
const char *game = getenv( E_GAME );
if( !game )
game = GAME_PATH;
game = XASH_GAMEDIR;
Q_strncpy( szGameDir, game, sizeof( szGameDir ));
#if XASH_EMSCRIPTEN

6
game_launch/game.cpp

@ -45,7 +45,9 @@ __declspec(dllexport) int AmdPowerXpressRequestHighPerformance = 1; @@ -45,7 +45,9 @@ __declspec(dllexport) int AmdPowerXpressRequestHighPerformance = 1;
#endif
#define E_GAME "XASH3D_GAME" // default env dir to start from
#define GAME_PATH "valve" // default dir to start from
#ifndef XASH_GAMEDIR
#define XASH_GAMEDIR "valve"
#endif
typedef void (*pfnChangeGame)( const char *progname );
typedef int (*pfnInit)( int argc, char **argv, const char *progname, int bChangeGame, pfnChangeGame func );
@ -152,7 +154,7 @@ _inline int Sys_Start( void ) @@ -152,7 +154,7 @@ _inline int Sys_Start( void )
const char *game = getenv( E_GAME );
if( !game )
game = GAME_PATH;
game = XASH_GAMEDIR;
strncpy( szGameDir, game, sizeof( szGameDir ) - 1 );

6
wscript

@ -64,6 +64,9 @@ def options(opt): @@ -64,6 +64,9 @@ def options(opt):
grp.add_option('-d', '--dedicated', action = 'store_true', dest = 'DEDICATED', default = False,
help = 'build Xash Dedicated Server [default: %default]')
grp.add_option('--gamedir', action = 'store', dest = 'GAMEDIR', default = 'valve',
help = 'engine default game directory [default: %default]')
grp.add_option('--single-binary', action = 'store_true', dest = 'SINGLE_BINARY', default = False,
help = 'build single "xash" binary (always enabled for dedicated) [default: %default]')
@ -268,6 +271,9 @@ def configure(conf): @@ -268,6 +271,9 @@ def configure(conf):
conf.env.GL = conf.options.GL or conf.options.ALL_RENDERERS
conf.env.SOFT = conf.options.SOFT or conf.options.ALL_RENDERERS
conf.env.GAMEDIR = conf.options.GAMEDIR
conf.define('XASH_GAMEDIR', conf.options.GAMEDIR)
if conf.env.DEST_OS != 'win32':
conf.check_cc(lib='dl', mandatory=False)

Loading…
Cancel
Save