filesystem: zip: pk3 support

This commit is contained in:
Mr0maks 2019-05-26 00:38:21 +05:00
parent 039b42868d
commit 3c0a34926a
2 changed files with 77 additions and 78 deletions

View file

@ -644,7 +644,6 @@ static zipfile_t *FS_AddFileToZip( const char *name, zip_t *zip, fs_offset_t off
static zip_t *FS_LoadZip( const char *zipfile, int *error ) static zip_t *FS_LoadZip( const char *zipfile, int *error )
{ {
zip_header_t header;
int numpackfiles = 0; int numpackfiles = 0;
zip_cdf_header_t header_cdf; zip_cdf_header_t header_cdf;
zip_header_eocd_t header_eocd; zip_header_eocd_t header_eocd;
@ -1059,7 +1058,7 @@ qboolean FS_AddZip_Fullpath( const char *zipfile, qboolean *already_loaded, int
if( already_loaded ) *already_loaded = false; if( already_loaded ) *already_loaded = false;
if( !Q_stricmp( ext, "zip" )) if( !Q_stricmp( ext, "zip" ) || !Q_stricmp( ext, "pk3" ) )
zip = FS_LoadZip( zipfile, &errorcode ); zip = FS_LoadZip( zipfile, &errorcode );
if( zip ) if( zip )
@ -1126,7 +1125,7 @@ void FS_AddGameDirectory( const char *dir, uint flags )
// add any Zip package in the directory // add any Zip package in the directory
for( i = 0; i < list.numstrings; i++ ) for( i = 0; i < list.numstrings; i++ )
{ {
if( !Q_stricmp( COM_FileExtension( list.strings[i] ), "zip" )) if( !Q_stricmp( COM_FileExtension( list.strings[i] ), "zip" ) || !Q_stricmp( COM_FileExtension( list.strings[i] ), "pk3" ))
{ {
Q_sprintf( fullpath, "%s%s", dir, list.strings[i] ); Q_sprintf( fullpath, "%s%s", dir, list.strings[i] );
FS_AddZip_Fullpath( fullpath, NULL, flags ); FS_AddZip_Fullpath( fullpath, NULL, flags );