engine: psvita: keep old arguments in Sys_NewInstance

This commit is contained in:
fgsfds 2023-02-26 22:25:50 +01:00 committed by Alibek Omarov
parent 957154f097
commit 41c819f3d3

View File

@ -590,22 +590,6 @@ qboolean Sys_NewInstance( const char *gamedir )
Host_Shutdown( ); Host_Shutdown( );
envSetNextLoad( exe, newargs ); envSetNextLoad( exe, newargs );
exit( 0 ); exit( 0 );
#elif XASH_PSVITA
const char *exe = "app0:/eboot.bin";
char newgamedir[256];
char *newargv[4];
int newargc = 0;
// make a copy of the gamedir name just in case
Q_strncpy( newgamedir, gamedir, sizeof( newgamedir ) );
// TODO: carry over the old args
newargv[newargc++] = host.argv[0]; // this is not usually the executable path
newargv[newargc++] = (char *)"-game";
newargv[newargc++] = newgamedir;
newargv[newargc] = NULL;
// just restart the entire thing
Host_Shutdown( );
sceAppMgrLoadExec( exe, newargv, NULL );
exit( 0 );
#else #else
int i = 0; int i = 0;
qboolean replacedArg = false; qboolean replacedArg = false;
@ -638,6 +622,12 @@ qboolean Sys_NewInstance( const char *gamedir )
newargs[i++] = strdup( "-changegame" ); newargs[i++] = strdup( "-changegame" );
newargs[i] = NULL; newargs[i] = NULL;
#if XASH_PSVITA
// under normal circumstances it's always going to be the same path
exe = strdup( "app0:/eboot.bin" );
Host_Shutdown( );
sceAppMgrLoadExec( exe, newargs, NULL );
#else
exelen = wai_getExecutablePath( NULL, 0, NULL ); exelen = wai_getExecutablePath( NULL, 0, NULL );
exe = malloc( exelen + 1 ); exe = malloc( exelen + 1 );
wai_getExecutablePath( exe, exelen, NULL ); wai_getExecutablePath( exe, exelen, NULL );
@ -646,6 +636,7 @@ qboolean Sys_NewInstance( const char *gamedir )
Host_Shutdown(); Host_Shutdown();
execv( exe, newargs ); execv( exe, newargs );
#endif
// if execv returned, it's probably an error // if execv returned, it's probably an error
printf( "execv failed: %s", strerror( errno )); printf( "execv failed: %s", strerror( errno ));