Skip to content

Commit

Permalink
engine: pass launcher's default game directory all the way down to Pl…
Browse files Browse the repository at this point in the history
…atform_Init, so we mount correct extras.pk3 on Mac
  • Loading branch information
a1batross committed Jan 23, 2025
1 parent 7bbc3e8 commit bccd3f2
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 10 deletions.
2 changes: 1 addition & 1 deletion engine/common/host.c
Original file line number Diff line number Diff line change
Expand Up @@ -1131,7 +1131,7 @@ static void Host_InitCommon( int argc, char **argv, const char *progname, qboole
#if XASH_DEDICATED
Platform_SetupSigtermHandling();
#endif
Platform_Init( Host_IsDedicated( ) || developer >= DEV_EXTENDED );
Platform_Init( Host_IsDedicated( ) || developer >= DEV_EXTENDED, basedir );
FS_Init( basedir );

Sys_InitLog();
Expand Down
6 changes: 3 additions & 3 deletions engine/platform/platform.h
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ char *Posix_Input( void );
#endif

#if XASH_SDL
void SDLash_Init( void );
void SDLash_Init( const char *basedir );
void SDLash_Shutdown( void );
#endif

Expand Down Expand Up @@ -104,15 +104,15 @@ void Linux_SetTimer( float time );
int Linux_GetProcessID( void );
#endif

static inline void Platform_Init( qboolean con_showalways )
static inline void Platform_Init( qboolean con_showalways, const char *basedir )
{
#if XASH_POSIX
// daemonize as early as possible, because we need to close our file descriptors
Posix_Daemonize( );
#endif

#if XASH_SDL
SDLash_Init( );
SDLash_Init( basedir );
#endif

#if XASH_ANDROID
Expand Down
15 changes: 9 additions & 6 deletions engine/platform/sdl/sys_sdl.c
Original file line number Diff line number Diff line change
Expand Up @@ -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
char buf[MAX_VA_STRING];
char *path;
path = SDL_GetBasePath();
Q_snprintf( buf, sizeof( buf ), "%svalve/extras.pk3", path );
setenv("XASH3D_EXTRAS_PAK1", buf, true);
char *path = SDL_GetBasePath();
if( path != NULL )
{
char buf[MAX_VA_STRING];

Q_snprintf( buf, sizeof( buf ), "%s%s/extras.pk3", basedir, path );
setenv( "XASH3D_EXTRAS_PAK1", buf, true );
}
#endif

SDL_LogSetOutputFunction( SDLash_LogOutputFunction, NULL );
Expand Down

0 comments on commit bccd3f2

Please sign in to comment.