Browse Source

engine: filesystem: allow extras ZIPs

pull/2/head
Alibek Omarov 3 years ago
parent
commit
13cf909b99
  1. 29
      engine/common/filesystem.c

29
engine/common/filesystem.c

@ -1192,7 +1192,7 @@ static qboolean FS_AddPak_Fullpath( const char *pakfile, qboolean *already_loade @@ -1192,7 +1192,7 @@ static qboolean FS_AddPak_Fullpath( const char *pakfile, qboolean *already_loade
}
}
qboolean FS_AddZip_Fullpath( const char *zipfile, qboolean *already_loaded, int flags )
static qboolean FS_AddZip_Fullpath( const char *zipfile, qboolean *already_loaded, int flags )
{
searchpath_t *search;
zip_t *zip = NULL;
@ -1245,6 +1245,24 @@ qboolean FS_AddZip_Fullpath( const char *zipfile, qboolean *already_loaded, int @@ -1245,6 +1245,24 @@ qboolean FS_AddZip_Fullpath( const char *zipfile, qboolean *already_loaded, int
}
}
/*
================
FS_AddArchive_Fullpath
================
*/
static qboolean FS_AddArchive_Fullpath( const char *file, qboolean *already_loaded, int flags )
{
const char *ext = COM_FileExtension( file );
if( !Q_stricmp( ext, "zip" ) || !Q_stricmp( ext, "pk3" ))
return FS_AddZip_Fullpath( file, already_loaded, flags );
else if ( !Q_stricmp( ext, "pak" ))
return FS_AddPak_Fullpath( file, already_loaded, flags );
// skip wads, this function only meant to be used for extras
return false;
}
/*
================
FS_AddGameDirectory
@ -1470,11 +1488,12 @@ void FS_Rescan( void ) @@ -1470,11 +1488,12 @@ void FS_Rescan( void )
}
#else
str = getenv( "XASH3D_EXTRAS_PAK1" );
if( COM_CheckString( str ) )
FS_AddPak_Fullpath( str, NULL, extrasFlags );
if( COM_CheckString( str ))
FS_AddArchive_Fullpath( str, NULL, extrasFlags );
str = getenv( "XASH3D_EXTRAS_PAK2" );
if( COM_CheckString( str ) )
FS_AddPak_Fullpath( str, NULL, extrasFlags );
if( COM_CheckString( str ))
FS_AddArchive_Fullpath( str, NULL, extrasFlags );
#endif
if( Q_stricmp( GI->basedir, GI->gamefolder ))

Loading…
Cancel
Save