engine: pass launcher's default game directory all the way down to Platform_Init, so we mount correct extras.pk3 on Mac

This commit is contained in:
Alibek Omarov 2025-01-23 10:22:53 +03:00
parent 7bbc3e8238
commit bccd3f2271
3 changed files with 13 additions and 10 deletions

View file

@ -1131,7 +1131,7 @@ static void Host_InitCommon( int argc, char **argv, const char *progname, qboole
#if XASH_DEDICATED #if XASH_DEDICATED
Platform_SetupSigtermHandling(); Platform_SetupSigtermHandling();
#endif #endif
Platform_Init( Host_IsDedicated( ) || developer >= DEV_EXTENDED ); Platform_Init( Host_IsDedicated( ) || developer >= DEV_EXTENDED, basedir );
FS_Init( basedir ); FS_Init( basedir );
Sys_InitLog(); Sys_InitLog();

View file

@ -55,7 +55,7 @@ char *Posix_Input( void );
#endif #endif
#if XASH_SDL #if XASH_SDL
void SDLash_Init( void ); void SDLash_Init( const char *basedir );
void SDLash_Shutdown( void ); void SDLash_Shutdown( void );
#endif #endif
@ -104,7 +104,7 @@ void Linux_SetTimer( float time );
int Linux_GetProcessID( void ); int Linux_GetProcessID( void );
#endif #endif
static inline void Platform_Init( qboolean con_showalways ) static inline void Platform_Init( qboolean con_showalways, const char *basedir )
{ {
#if XASH_POSIX #if XASH_POSIX
// daemonize as early as possible, because we need to close our file descriptors // daemonize as early as possible, because we need to close our file descriptors
@ -112,7 +112,7 @@ static inline void Platform_Init( qboolean con_showalways )
#endif #endif
#if XASH_SDL #if XASH_SDL
SDLash_Init( ); SDLash_Init( basedir );
#endif #endif
#if XASH_ANDROID #if XASH_ANDROID

View file

@ -78,14 +78,17 @@ static void SDLCALL SDLash_LogOutputFunction( void *userdata, int category, SDL_
} }
} }
void SDLash_Init( void ) void SDLash_Init( const char *basedir )
{ {
#if XASH_APPLE #if XASH_APPLE
char *path = SDL_GetBasePath();
if( path != NULL )
{
char buf[MAX_VA_STRING]; char buf[MAX_VA_STRING];
char *path;
path = SDL_GetBasePath(); Q_snprintf( buf, sizeof( buf ), "%s%s/extras.pk3", basedir, path );
Q_snprintf( buf, sizeof( buf ), "%svalve/extras.pk3", path );
setenv( "XASH3D_EXTRAS_PAK1", buf, true ); setenv( "XASH3D_EXTRAS_PAK1", buf, true );
}
#endif #endif
SDL_LogSetOutputFunction( SDLash_LogOutputFunction, NULL ); SDL_LogSetOutputFunction( SDLash_LogOutputFunction, NULL );