]> de.git.xonotic.org Git - xonotic/netradiant.git/commitdiff
vfs: support .pk3dir like in darkplaces engine - directories auto-added to the search...
authorRudolf Polzer <rpolzer@nb-04.(none)>
Fri, 19 Mar 2010 13:29:02 +0000 (14:29 +0100)
committerRudolf Polzer <rpolzer@nb-04.(none)>
Fri, 19 Mar 2010 13:55:47 +0000 (14:55 +0100)
plugins/vfspk3/vfs.cpp
tools/quake3/common/vfs.c
tools/quake3/common/vfs.h

index 688374830ea7727ab8adf9eca47a8ac72ffa6bbb..6220f773982757ca5262498c7bb3ce3986cc6c91 100644 (file)
@@ -353,6 +353,26 @@ void InitDirectory(const char* directory, ArchiveModules& archiveModules)
           break;
 
         const char *ext = strrchr (name, '.');
+
+       if(ext && !string_compare_nocase_upper(ext, ".pk3dir"))
+       {
+         if (g_numDirs == (VFS_MAXDIRS-1))
+           continue;
+         snprintf(g_strDirs[g_numDirs], PATH_MAX, "%s%s/", path, name);
+         g_strDirs[g_numDirs][PATH_MAX] = '\0';
+         FixDOSName (g_strDirs[g_numDirs]);
+         AddSlash (g_strDirs[g_numDirs]);
+         g_numDirs++;
+
+         {
+           archive_entry_t entry;
+           entry.name = g_strDirs[g_numDirs-1];
+           entry.archive = OpenArchive(g_strDirs[g_numDirs-1]);
+           entry.is_pakfile = false;
+           g_archives.push_back(entry);
+         }
+       }
+
         if ((ext == 0) || *(++ext) == '\0' || GetArchiveTable(archiveModules, ext) == 0)
           continue;
 
index 258656612827fb9ae69dd23966b66ce1aedb1f57..f706aee501faad057759274f2e661083567a5001 100644 (file)
@@ -195,6 +195,18 @@ void vfsInitDirectory (const char *path)
 
         {
           char *ext = strrchr (dirlist, '.');
+
+         if(ext && !Q_stricmp(ext, ".pk3dir"))
+         {
+           if (g_numDirs == (VFS_MAXDIRS-1))
+             continue;
+           snprintf(g_strDirs[g_numDirs], PATH_MAX, "%s/%s", path, name);
+           g_strDirs[g_numDirs][PATH_MAX] = '\0';
+           vfsFixDOSName (g_strDirs[g_numDirs]);
+           vfsAddSlash (g_strDirs[g_numDirs]);
+           ++g_numDirs;
+         }
+
           if ((ext == NULL) || (Q_stricmp (ext, ".pk3") != 0))
             continue;
         }
index 44b3ffad32965aa27ae47eeb578ead8cb2ab726c..d2e4d6fd402b115030e14655f415be4b1429e63b 100644 (file)
@@ -31,7 +31,7 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 #ifndef _VFS_H_
 #define _VFS_H_
 
-#define VFS_MAXDIRS 8
+#define VFS_MAXDIRS 64
 
 void vfsInitDirectory (const char *path);
 void vfsShutdown ();