engine: return full path in server's pfnGetGameDir, if possible
This commit is contained in:
parent
4798cd6d1e
commit
1f5c97964b
4 changed files with 25 additions and 13 deletions
|
@ -1167,6 +1167,14 @@ static void GAME_EXPORT pfnSetCursor( void *hCursor )
|
||||||
Platform_SetCursorType( cursor );
|
Platform_SetCursorType( cursor );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static void GAME_EXPORT pfnGetGameDir( char *out )
|
||||||
|
{
|
||||||
|
if( !out )
|
||||||
|
return;
|
||||||
|
|
||||||
|
Q_strncpy( out, GI->gamefolder, sizeof( GI->gamefolder ));
|
||||||
|
}
|
||||||
|
|
||||||
// engine callbacks
|
// engine callbacks
|
||||||
static const ui_enginefuncs_t gEngfuncs =
|
static const ui_enginefuncs_t gEngfuncs =
|
||||||
{
|
{
|
||||||
|
|
|
@ -897,18 +897,6 @@ float GAME_EXPORT pfnTime( void )
|
||||||
return (float)Sys_DoubleTime();
|
return (float)Sys_DoubleTime();
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
|
||||||
=============
|
|
||||||
pfnGetGameDir
|
|
||||||
|
|
||||||
=============
|
|
||||||
*/
|
|
||||||
void GAME_EXPORT pfnGetGameDir( char *szGetGameDir )
|
|
||||||
{
|
|
||||||
if( !szGetGameDir ) return;
|
|
||||||
Q_strncpy( szGetGameDir, GI->gamefolder, sizeof( GI->gamefolder ));
|
|
||||||
}
|
|
||||||
|
|
||||||
qboolean COM_IsSafeFileToDownload( const char *filename )
|
qboolean COM_IsSafeFileToDownload( const char *filename )
|
||||||
{
|
{
|
||||||
char lwrfilename[4096];
|
char lwrfilename[4096];
|
||||||
|
|
|
@ -592,7 +592,6 @@ void *Cache_Check( poolhandle_t mempool, struct cache_user_s *c );
|
||||||
void COM_TrimSpace( const char *source, char *dest );
|
void COM_TrimSpace( const char *source, char *dest );
|
||||||
void pfnGetModelBounds( model_t *mod, float *mins, float *maxs );
|
void pfnGetModelBounds( model_t *mod, float *mins, float *maxs );
|
||||||
int COM_CheckParm( char *parm, char **ppnext );
|
int COM_CheckParm( char *parm, char **ppnext );
|
||||||
void pfnGetGameDir( char *szGetGameDir );
|
|
||||||
int pfnGetModelType( model_t *mod );
|
int pfnGetModelType( model_t *mod );
|
||||||
int pfnIsMapValid( char *filename );
|
int pfnIsMapValid( char *filename );
|
||||||
void Con_Reportf( const char *szFmt, ... ) FORMAT_CHECK( 1 );
|
void Con_Reportf( const char *szFmt, ... ) FORMAT_CHECK( 1 );
|
||||||
|
|
|
@ -4631,6 +4631,23 @@ static int GAME_EXPORT pfnGetTimesTutorMessageShown( int mid )
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static void GAME_EXPORT pfnGetGameDir( char *out )
|
||||||
|
{
|
||||||
|
char rootdir[MAX_SYSPATH];
|
||||||
|
|
||||||
|
if( !out )
|
||||||
|
return;
|
||||||
|
|
||||||
|
// in GoldSrc, it's a full path to game directory, limited by 256 characters
|
||||||
|
// however the full path might easily overflow that limitation
|
||||||
|
// here we check if it would overflow and just return game folder in that case
|
||||||
|
if( !g_fsapi.GetRootDirectory( rootdir, sizeof( rootdir ))
|
||||||
|
|| Q_snprintf( out, 256, "%s/%s", rootdir, GI->gamefolder ) < 0 )
|
||||||
|
{
|
||||||
|
Q_strncpy( out, GI->gamefolder, 256 );
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// engine callbacks
|
// engine callbacks
|
||||||
static enginefuncs_t gEngfuncs =
|
static enginefuncs_t gEngfuncs =
|
||||||
{
|
{
|
||||||
|
|
Loading…
Add table
Reference in a new issue