mirror of
https://github.com/FWGS/xash3d-fwgs.git
synced 2026-08-05 03:24:56 +08:00
engine: remove the code that calls pfnChangeGame from game_launch, as we never use it anyway
This commit is contained in:
@@ -38,7 +38,6 @@ GNU General Public License for more details.
|
||||
#include "tests.h"
|
||||
|
||||
host_parm_t host; // host parms
|
||||
static pfnChangeGame pChangeGame = NULL;
|
||||
static jmp_buf return_from_main_buf;
|
||||
|
||||
/*
|
||||
@@ -389,12 +388,10 @@ static int Host_CalcSleep( void )
|
||||
|
||||
static void Host_NewInstance( const char *name, const char *finalmsg )
|
||||
{
|
||||
if( !pChangeGame ) return;
|
||||
|
||||
host.change_game = true;
|
||||
|
||||
if( !Sys_NewInstance( name, finalmsg ))
|
||||
pChangeGame( name ); // call from hl.exe
|
||||
Con_Printf( S_ERROR "Failed to restart the engine\n" );
|
||||
}
|
||||
|
||||
/*
|
||||
@@ -1191,7 +1188,7 @@ static void Sys_Quit_f( void )
|
||||
Host_Main
|
||||
=================
|
||||
*/
|
||||
int EXPORT Host_Main( int argc, char **argv, const char *progname, int bChangeGame, pfnChangeGame func )
|
||||
int EXPORT Host_Main( int argc, char **argv, const char *progname, int bChangeGame, pfnChangeGame pChangeGame )
|
||||
{
|
||||
static double oldtime;
|
||||
string demoname, exename;
|
||||
@@ -1201,8 +1198,6 @@ int EXPORT Host_Main( int argc, char **argv, const char *progname, int bChangeGa
|
||||
|
||||
host.starttime = Platform_DoubleTime();
|
||||
|
||||
pChangeGame = func; // may be NULL
|
||||
|
||||
Host_InitCommon( argc, argv, progname, bChangeGame, exename, sizeof( exename ));
|
||||
|
||||
// init commands and vars
|
||||
@@ -1250,7 +1245,7 @@ int EXPORT Host_Main( int argc, char **argv, const char *progname, int bChangeGa
|
||||
Netchan_Init();
|
||||
|
||||
// allow to change game from the console
|
||||
if( pChangeGame != NULL )
|
||||
if( pChangeGame != NULL && Sys_CanRestart( ))
|
||||
{
|
||||
Cmd_AddRestrictedCommand( "game", Host_ChangeGame_f, "change game" );
|
||||
Cvar_Get( "host_allow_changegame", "1", FCVAR_READ_ONLY, "allows to change games" );
|
||||
|
||||
@@ -21,10 +21,6 @@ GNU General Public License for more details.
|
||||
#include <SDL.h>
|
||||
#endif
|
||||
|
||||
#if XASH_EMSCRIPTEN
|
||||
#include <emscripten.h>
|
||||
#endif
|
||||
|
||||
#ifndef XASH_GAMEDIR
|
||||
#define XASH_GAMEDIR "valve" // !!! Replace with your default (base) game directory !!!
|
||||
#endif
|
||||
@@ -46,20 +42,6 @@ static int Sys_Start( void )
|
||||
{
|
||||
Q_strncpy( szGameDir, XASH_GAMEDIR, sizeof( szGameDir ));
|
||||
|
||||
#if XASH_EMSCRIPTEN
|
||||
#if !XASH_DEDICATED
|
||||
EM_ASM( try {
|
||||
FS.mkdir( '/rwdir' );
|
||||
FS.mount( IDBFS, { root: '.' }, '/rwdir' );
|
||||
} catch( e ) { };);
|
||||
#else // XASH_DEDICATED
|
||||
EM_ASM(try {
|
||||
FS.mkdir( '/xash' );
|
||||
FS.mount( NODEFS, { root: '.'}, '/xash' );
|
||||
} catch( e ) { };);
|
||||
#endif // XASH_DEDICATED
|
||||
#endif // XASH_EMSCRIPTEN
|
||||
|
||||
#if XASH_IOS
|
||||
IOS_LaunchDialog();
|
||||
szArgc = IOS_GetArgs( &szArgv );
|
||||
|
||||
@@ -523,6 +523,24 @@ void Sys_Print( const char *pMsg )
|
||||
Rcon_Print( &host.rd, pMsg );
|
||||
}
|
||||
|
||||
/*
|
||||
==================
|
||||
Sys_CanRestart
|
||||
|
||||
Returns true if execv-like syscall is available
|
||||
==================
|
||||
*/
|
||||
qboolean Sys_CanRestart( void )
|
||||
{
|
||||
#if XASH_NSWITCH || XASH_PSVITA
|
||||
return true;
|
||||
#else
|
||||
int exelen = wai_getExecutablePath( NULL, 0, NULL );
|
||||
|
||||
return exelen > 0;
|
||||
#endif
|
||||
}
|
||||
|
||||
/*
|
||||
==================
|
||||
Sys_ChangeGame
|
||||
|
||||
@@ -67,6 +67,7 @@ qboolean _Sys_GetParmFromCmdLine( const char *parm, char *out, size_t size );
|
||||
qboolean Sys_GetIntFromCmdLine( const char *parm, int *out );
|
||||
void Sys_Print( const char *pMsg );
|
||||
void Sys_Quit( const char *reason ) NORETURN;
|
||||
qboolean Sys_CanRestart( void );
|
||||
qboolean Sys_NewInstance( const char *gamedir, const char *finalmsg );
|
||||
void *Sys_GetNativeObject( const char *obj );
|
||||
|
||||
|
||||
Reference in New Issue
Block a user