From 42f6719e8d354328103f8d9ed9f23d2325e95db7 Mon Sep 17 00:00:00 2001 From: Alibek Omarov Date: Thu, 27 Jun 2024 05:55:06 +0300 Subject: [PATCH] filesystem: drop direct path hacks for WAD files, let VFS decide how to open WAD archives --- filesystem/filesystem.c | 5 ----- filesystem/filesystem_internal.h | 6 +++--- filesystem/wad.c | 24 ++---------------------- 3 files changed, 5 insertions(+), 30 deletions(-) diff --git a/filesystem/filesystem.c b/filesystem/filesystem.c index 264a79b5..e226d78b 100644 --- a/filesystem/filesystem.c +++ b/filesystem/filesystem.c @@ -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 ); diff --git a/filesystem/filesystem_internal.h b/filesystem/filesystem_internal.h index 8ef42183..d262eec9 100644 --- a/filesystem/filesystem_internal.h +++ b/filesystem/filesystem_internal.h @@ -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 diff --git a/filesystem/wad.c b/filesystem/wad.c index 0bd8ade3..10070985 100644 --- a/filesystem/wad.c +++ b/filesystem/wad.c @@ -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 ) {