Skip to content

Commit

Permalink
filesystem: fix mounting wads again
Browse files Browse the repository at this point in the history
Because of the mounting order, VFS fails to automatically find unpacked WADs
  • Loading branch information
a1batross committed Jun 28, 2024
1 parent 5694610 commit c73fa3d
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 5 deletions.
2 changes: 1 addition & 1 deletion filesystem/filesystem.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
1 change: 1 addition & 0 deletions filesystem/filesystem.h
Original file line number Diff line number Diff line change
Expand Up @@ -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
};
Expand Down
15 changes: 11 additions & 4 deletions filesystem/wad.c
Original file line number Diff line number Diff line change
Expand Up @@ -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 )
{
Expand Down Expand Up @@ -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 )
{
Expand Down

0 comments on commit c73fa3d

Please sign in to comment.