mirror of
https://github.com/YGGverse/xash3d-fwgs.git
synced 2025-01-17 18:40:02 +00:00
game_launch: declare environ variable, by standard it must be declared by user program
This commit is contained in:
parent
07a9c4602d
commit
a717b7fc49
@ -25,6 +25,9 @@ GNU General Public License for more details.
|
|||||||
#include <emscripten.h>
|
#include <emscripten.h>
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#include <unistd.h>
|
||||||
|
|
||||||
|
extern char **environ;
|
||||||
static char szGameDir[128]; // safe place to keep gamedir
|
static char szGameDir[128]; // safe place to keep gamedir
|
||||||
static int g_iArgc;
|
static int g_iArgc;
|
||||||
static char **g_pszArgv;
|
static char **g_pszArgv;
|
||||||
@ -40,17 +43,18 @@ static char **g_pszArgv;
|
|||||||
|
|
||||||
void Launcher_ChangeGame( const char *progname )
|
void Launcher_ChangeGame( const char *progname )
|
||||||
{
|
{
|
||||||
|
char envstr[256];
|
||||||
|
|
||||||
#if USE_EXECVE_FOR_CHANGE_GAME
|
#if USE_EXECVE_FOR_CHANGE_GAME
|
||||||
Host_Shutdown();
|
Host_Shutdown();
|
||||||
|
|
||||||
#if XASH_WIN32
|
#if XASH_WIN32
|
||||||
_putenv_s( E_GAME, progname );
|
_putenv_s( E_GAME, progname );
|
||||||
_execve( szArgv[0], szArgv, environ );
|
_execve( g_pszArgv[0], g_pszArgv, _environ );
|
||||||
#else
|
#else
|
||||||
char envstr[256];
|
|
||||||
snprintf( envstr, sizeof( envstr ), E_GAME "=%s", progname );
|
snprintf( envstr, sizeof( envstr ), E_GAME "=%s", progname );
|
||||||
putenv( envstr );
|
putenv( envstr );
|
||||||
execve( szArgv[0], szArgv, environ );
|
execve( g_pszArgv[0], g_pszArgv, environ );
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#else
|
#else
|
||||||
@ -100,7 +104,7 @@ int main( int argc, char** argv )
|
|||||||
if( !game )
|
if( !game )
|
||||||
game = GAME_PATH;
|
game = GAME_PATH;
|
||||||
|
|
||||||
Q_strncpy( szGameDir, gamedir, sizeof( szGameDir ));
|
Q_strncpy( szGameDir, game, sizeof( szGameDir ));
|
||||||
|
|
||||||
#if XASH_EMSCRIPTEN
|
#if XASH_EMSCRIPTEN
|
||||||
#ifdef EMSCRIPTEN_LIB_FS
|
#ifdef EMSCRIPTEN_LIB_FS
|
||||||
|
@ -56,6 +56,7 @@ typedef void (*pfnChangeGame)( const char *progname );
|
|||||||
typedef int (*pfnInit)( int argc, char **argv, const char *progname, int bChangeGame, pfnChangeGame func );
|
typedef int (*pfnInit)( int argc, char **argv, const char *progname, int bChangeGame, pfnChangeGame func );
|
||||||
typedef void (*pfnShutdown)( void );
|
typedef void (*pfnShutdown)( void );
|
||||||
|
|
||||||
|
extern char **environ;
|
||||||
static pfnInit Xash_Main;
|
static pfnInit Xash_Main;
|
||||||
static pfnShutdown Xash_Shutdown = NULL;
|
static pfnShutdown Xash_Shutdown = NULL;
|
||||||
static char szGameDir[128]; // safe place to keep gamedir
|
static char szGameDir[128]; // safe place to keep gamedir
|
||||||
@ -129,7 +130,7 @@ static void Sys_ChangeGame( const char *progname )
|
|||||||
_putenv_s( E_GAME, progname );
|
_putenv_s( E_GAME, progname );
|
||||||
|
|
||||||
Sys_UnloadEngine();
|
Sys_UnloadEngine();
|
||||||
_execve( szArgv[0], szArgv, environ );
|
_execve( szArgv[0], szArgv, _environ );
|
||||||
#else
|
#else
|
||||||
char envstr[256];
|
char envstr[256];
|
||||||
snprintf( envstr, sizeof( envstr ), E_GAME "=%s", progname );
|
snprintf( envstr, sizeof( envstr ), E_GAME "=%s", progname );
|
||||||
|
Loading…
x
Reference in New Issue
Block a user