game_launch: simplify

This commit is contained in:
Alibek Omarov
2026-03-05 02:58:00 +05:00
parent b2886dd2e9
commit 0389ef3b04
2 changed files with 7 additions and 22 deletions

View File

@@ -29,36 +29,26 @@ GNU General Public License for more details.
#error "Single-binary or dedicated builds aren't supported for Windows!" #error "Single-binary or dedicated builds aren't supported for Windows!"
#endif #endif
static char szGameDir[128]; // safe place to keep gamedir static int szArgc;
static int szArgc; static char **szArgv;
static char **szArgv;
static void Sys_ChangeGame( const char *progname ) static void Sys_ChangeGame( const char *progname )
{ {
// stub // stub
} }
static int Sys_Start( void )
{
Q_strncpy( szGameDir, XASH_GAMEDIR, sizeof( szGameDir ));
#if XASH_IOS
IOS_LaunchDialog();
szArgc = IOS_GetArgs( &szArgv );
#endif // XASH_IOS
return Host_Main( szArgc, szArgv, szGameDir, 0, Sys_ChangeGame );
}
int main( int argc, char **argv ) int main( int argc, char **argv )
{ {
#if XASH_PSVITA #if XASH_PSVITA
// inject -dev -console into args if required // inject -dev -console into args if required
szArgc = PSVita_GetArgv( argc, argv, &szArgv ); szArgc = PSVita_GetArgv( argc, argv, &szArgv );
#elif XASH_IOS
IOS_LaunchDialog();
szArgc = IOS_GetArgs( &szArgv );
#else #else
szArgc = argc; szArgc = argc;
szArgv = argv; szArgv = argv;
#endif // XASH_PSVITA #endif // XASH_PSVITA
return Sys_Start(); return Host_Main( szArgc, szArgv, XASH_GAMEDIR, 0, Sys_ChangeGame );
} }
#endif // XASH_ENABLE_MAIN #endif // XASH_ENABLE_MAIN

View File

@@ -52,7 +52,6 @@ typedef void (*pfnShutdown)( void );
static pfnInit Host_Main; static pfnInit Host_Main;
static pfnShutdown Host_Shutdown = NULL; static pfnShutdown Host_Shutdown = NULL;
static char szGameDir[128]; // safe place to keep gamedir
static int szArgc; static int szArgc;
static char **szArgv; static char **szArgv;
static HINSTANCE hEngine; static HINSTANCE hEngine;
@@ -172,12 +171,8 @@ static int Sys_Start( void )
setenv( "XASH3D_RODIR", "/usr/share/harbour-xash3d-fwgs/rodir", true ); setenv( "XASH3D_RODIR", "/usr/share/harbour-xash3d-fwgs/rodir", true );
#endif // XASH_SAILFISH #endif // XASH_SAILFISH
strncpy( szGameDir, XASH_GAMEDIR, sizeof( szGameDir ) - 1 );
Sys_LoadEngine(); Sys_LoadEngine();
ret = Host_Main( szArgc, szArgv, XASH_GAMEDIR, 0, XASH_DISABLE_MENU_CHANGEGAME ? NULL : Sys_ChangeGame );
ret = Host_Main( szArgc, szArgv, szGameDir, 0, XASH_DISABLE_MENU_CHANGEGAME ? NULL : Sys_ChangeGame );
Sys_UnloadEngine(); Sys_UnloadEngine();
return ret; return ret;