filesystem: fix mounting wads again

Because of the mounting order, VFS fails to automatically find unpacked WADs
This commit is contained in:
Alibek Omarov 2024-06-28 18:00:36 +03:00
parent 5694610478
commit c73fa3d7a6
3 changed files with 13 additions and 5 deletions

View file

@ -333,7 +333,7 @@ searchpath_t *FS_AddArchive_Fullpath( const fs_archive_t *archive, const char *f
char fullpath[MAX_SYSPATH];
Q_snprintf( fullpath, sizeof( fullpath ), "%s/%s", file, list.strings[i] );
if(( wad = FS_AddWad_Fullpath( fullpath, flags )))
if(( wad = FS_AddWad_Fullpath( fullpath, flags | FS_LOAD_PACKED_WAD )))
{
wad->next = fs_searchpaths;
fs_searchpaths = wad;

View file

@ -45,6 +45,7 @@ enum
FS_GAMERODIR_PATH = BIT( 4 ), // gamedir but read-only
FS_SKIP_ARCHIVED_WADS = BIT( 5 ), // don't mount wads inside archives automatically
FS_LOAD_PACKED_WAD = BIT( 6 ), // this wad is packed inside other archive
FS_GAMEDIRONLY_SEARCH_FLAGS = FS_GAMEDIR_PATH | FS_CUSTOM_PATH | FS_GAMERODIR_PATH
};

View file

@ -286,16 +286,23 @@ W_Open
open the wad for reading & writing
===========
*/
static wfile_t *W_Open( const char *filename, int *error )
static wfile_t *W_Open( const char *filename, int *error, uint flags )
{
wfile_t *wad = (wfile_t *)Mem_Calloc( fs_mempool, sizeof( wfile_t ));
int i, lumpcount;
dlumpinfo_t *srclumps;
size_t lat_size;
dwadinfo_t header;
const char *basename = COM_FileWithoutPath( filename );
wad->handle = FS_Open( basename, "rb", false );
if( FBitSet( flags, FS_LOAD_PACKED_WAD ))
{
const char *basename = COM_FileWithoutPath( filename );
wad->handle = FS_Open( basename, "rb", false );
}
else
{
wad->handle = FS_SysOpen( filename, "rb" );
}
if( wad->handle == NULL )
{
@ -629,7 +636,7 @@ searchpath_t *FS_AddWad_Fullpath( const char *wadfile, int flags )
wfile_t *wad;
int errorcode = WAD_LOAD_COULDNT_OPEN;
wad = W_Open( wadfile, &errorcode );
wad = W_Open( wadfile, &errorcode, flags );
if( !wad )
{