mirror of
https://github.com/FWGS/xash3d-fwgs.git
synced 2026-08-11 06:32:10 +08:00
engine: turn old pfnGetGameDir behavior into a bugcomp flag get_game_dir_full
This function is kinda nasty, some mods (like old RCBot builds) expect a slash, some newer mods (like Sandbot) doesn't. To preserve compatibility with both old and new mods, just add it as bug compatibility flag.
This commit is contained in:
+12
-5
@@ -4638,14 +4638,21 @@ static void GAME_EXPORT pfnGetGameDir( char *out )
|
||||
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 )
|
||||
if( !FBitSet( host.bugcomp, BUGCOMP_GET_GAME_DIR_FULL_PATH ))
|
||||
{
|
||||
Q_strncpy( out, GI->gamefolder, 256 );
|
||||
}
|
||||
else
|
||||
{
|
||||
// in GoldSrc pre-1.1.1.1, 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
|
||||
|
||||
Reference in New Issue
Block a user