2
0
mirror of https://github.com/FWGS/xash3d-fwgs synced 2024-11-22 01:45:19 +01:00

filesystem: drop direct path hacks for WAD files, let VFS decide how to open WAD archives

This commit is contained in:
Alibek Omarov 2024-06-27 05:55:06 +03:00
parent 244b9dc02b
commit 42f6719e8d
3 changed files with 5 additions and 30 deletions

View File

@ -387,9 +387,6 @@ void FS_AddGameDirectory( const char *dir, uint flags )
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++ )
{
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] );
FS_AddArchive_Fullpath( archive, fullpath, flags );
}
FS_AllowDirectPaths( false );
}
stringlistfreecontents( &list );

View File

@ -60,7 +60,7 @@ struct file_s
#endif
};
enum
typedef enum searchpathtype_e
{
SEARCHPATH_PLAIN = 0,
SEARCHPATH_PAK,
@ -68,7 +68,7 @@ enum
SEARCHPATH_ZIP,
SEARCHPATH_PK3DIR, // it's actually a plain directory but it must behave like a ZIP archive,
SEARCHPATH_ANDROID_ASSETS
};
} searchpathtype_t;
typedef struct stringlist_s
{
@ -81,7 +81,7 @@ typedef struct stringlist_s
typedef struct searchpath_s
{
string filename;
int type;
searchpathtype_t type;
int flags;
union

View File

@ -293,29 +293,9 @@ static wfile_t *W_Open( const char *filename, int *error )
dlumpinfo_t *srclumps;
size_t lat_size;
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)
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 );
}
wad->handle = FS_Open( basename, "rb", false );
if( wad->handle == NULL )
{