filesystem: drop direct path hacks for WAD files, let VFS decide how to open WAD archives
This commit is contained in:
parent
244b9dc02b
commit
42f6719e8d
3 changed files with 5 additions and 30 deletions
|
@ -387,9 +387,6 @@ void FS_AddGameDirectory( const char *dir, uint flags )
|
||||||
|
|
||||||
for( archive = g_archives; archive->ext; archive++ )
|
for( archive = g_archives; archive->ext; archive++ )
|
||||||
{
|
{
|
||||||
if( archive->type == SEARCHPATH_WAD ) // HACKHACK: wads need direct paths but only in this function
|
|
||||||
FS_AllowDirectPaths( true );
|
|
||||||
|
|
||||||
for( i = 0; i < list.numstrings; i++ )
|
for( i = 0; i < list.numstrings; i++ )
|
||||||
{
|
{
|
||||||
const char *ext = COM_FileExtension( list.strings[i] );
|
const char *ext = COM_FileExtension( list.strings[i] );
|
||||||
|
@ -400,8 +397,6 @@ void FS_AddGameDirectory( const char *dir, uint flags )
|
||||||
Q_snprintf( fullpath, sizeof( fullpath ), "%s%s", dir, list.strings[i] );
|
Q_snprintf( fullpath, sizeof( fullpath ), "%s%s", dir, list.strings[i] );
|
||||||
FS_AddArchive_Fullpath( archive, fullpath, flags );
|
FS_AddArchive_Fullpath( archive, fullpath, flags );
|
||||||
}
|
}
|
||||||
|
|
||||||
FS_AllowDirectPaths( false );
|
|
||||||
}
|
}
|
||||||
|
|
||||||
stringlistfreecontents( &list );
|
stringlistfreecontents( &list );
|
||||||
|
|
|
@ -60,7 +60,7 @@ struct file_s
|
||||||
#endif
|
#endif
|
||||||
};
|
};
|
||||||
|
|
||||||
enum
|
typedef enum searchpathtype_e
|
||||||
{
|
{
|
||||||
SEARCHPATH_PLAIN = 0,
|
SEARCHPATH_PLAIN = 0,
|
||||||
SEARCHPATH_PAK,
|
SEARCHPATH_PAK,
|
||||||
|
@ -68,7 +68,7 @@ enum
|
||||||
SEARCHPATH_ZIP,
|
SEARCHPATH_ZIP,
|
||||||
SEARCHPATH_PK3DIR, // it's actually a plain directory but it must behave like a ZIP archive,
|
SEARCHPATH_PK3DIR, // it's actually a plain directory but it must behave like a ZIP archive,
|
||||||
SEARCHPATH_ANDROID_ASSETS
|
SEARCHPATH_ANDROID_ASSETS
|
||||||
};
|
} searchpathtype_t;
|
||||||
|
|
||||||
typedef struct stringlist_s
|
typedef struct stringlist_s
|
||||||
{
|
{
|
||||||
|
@ -81,7 +81,7 @@ typedef struct stringlist_s
|
||||||
typedef struct searchpath_s
|
typedef struct searchpath_s
|
||||||
{
|
{
|
||||||
string filename;
|
string filename;
|
||||||
int type;
|
searchpathtype_t type;
|
||||||
int flags;
|
int flags;
|
||||||
|
|
||||||
union
|
union
|
||||||
|
|
|
@ -293,29 +293,9 @@ static wfile_t *W_Open( const char *filename, int *error )
|
||||||
dlumpinfo_t *srclumps;
|
dlumpinfo_t *srclumps;
|
||||||
size_t lat_size;
|
size_t lat_size;
|
||||||
dwadinfo_t header;
|
dwadinfo_t header;
|
||||||
|
const char *basename = COM_FileWithoutPath( filename );
|
||||||
|
|
||||||
// NOTE: FS_Open is load wad file from the first pak in the list (while fs_ext_path is false)
|
wad->handle = FS_Open( basename, "rb", false );
|
||||||
if( fs_ext_path )
|
|
||||||
{
|
|
||||||
int ind;
|
|
||||||
searchpath_t *search = FS_FindFile( filename, &ind, NULL, 0, false );
|
|
||||||
|
|
||||||
// allow direct absolute paths
|
|
||||||
// TODO: catch them in FS_FindFile_DIR!
|
|
||||||
if( !search || ind < 0 )
|
|
||||||
{
|
|
||||||
wad->handle = FS_SysOpen( filename, "rb" );
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
wad->handle = search->pfnOpenFile( search, filename, "rb", ind );
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
const char *basename = COM_FileWithoutPath( filename );
|
|
||||||
wad->handle = FS_Open( basename, "rb", false );
|
|
||||||
}
|
|
||||||
|
|
||||||
if( wad->handle == NULL )
|
if( wad->handle == NULL )
|
||||||
{
|
{
|
||||||
|
|
Loading…
Add table
Reference in a new issue