View Issue Details

IDProjectCategoryView StatusLast Update
0002490DarkRadiantGeneralpublic31.07.2011 04:44
Reporterdersaidin Assigned Togreebo  
PrioritynormalSeveritynormalReproducibilityN/A
Status closedResolutionfixed 
Product Version1.5.0 
Target Version1.5.0Fixed in Version1.5.0 
Summary0002490: Xreal: Configurable archive extension
DescriptionXreal uses pk3 files for content.

This patch makes use of the configurable archive extension in the game.xml; game node archivetypes property.
Additional InformationThis patch currently assumes any listed extensions use the ArchivePK4API class. You may prefer ArchivePK3 as a separate library, but in that case I think its still desirable to make use of the archivetypes property. A PK3 loading class could be added after.
TagsNo tags attached.
Attached Files
darkradiant6246_archiveext.patch (4,445 bytes)   
Index: plugins/archivezip/plugin.cpp
===================================================================
--- plugins/archivezip/plugin.cpp	(revision 6246)
+++ plugins/archivezip/plugin.cpp	(working copy)
@@ -39,7 +39,7 @@
 	}
 
 	virtual const std::string& getExtension() {
-		static std::string _ext("PK4");
+		static std::string _ext("pk4");
 		return _ext;
 	}
 
Index: plugins/vfspk3/Doom3FileSystem.cpp
===================================================================
--- plugins/vfspk3/Doom3FileSystem.cpp	(revision 6246)
+++ plugins/vfspk3/Doom3FileSystem.cpp	(working copy)
@@ -52,6 +52,7 @@
 #include "iradiant.h"
 #include "idatastream.h"
 #include "ifilesystem.h"
+#include "iregistry.h"
 #include "igame.h"
 
 #include "string/string.h"
@@ -61,6 +62,8 @@
 
 #include <boost/algorithm/string/case_conv.hpp>
 #include <boost/algorithm/string/predicate.hpp>
+#include <boost/algorithm/string/split.hpp>
+#include <boost/algorithm/string/classification.hpp>
 
 #include "DirectoryArchive.h"
 #include "SortedFilenames.h"
@@ -123,6 +126,9 @@
 {
 	globalOutputStream() << "filesystem initialised" << std::endl;
 
+	std::string extensions = GlobalRegistry().getAttribute("game", "archivetypes");
+	boost::algorithm::split(_allowedExtensions, extensions, boost::algorithm::is_any_of(" "));
+
 	// Get the VFS search paths from the game manager
 	const game::IGameManager::PathList& paths =
 		GlobalGameManager().getVFSSearchPaths();
@@ -276,10 +282,10 @@
 
 void Doom3FileSystem::initPakFile(ArchiveLoader& archiveModule, const std::string& filename) {
 	std::string fileExt(os::getExtension(filename));
-	boost::to_upper(fileExt);
+	boost::to_lower(fileExt);
 
 	// matching extension?
-	if (fileExt == archiveModule.getExtension()) {
+	if (_allowedExtensions.find(fileExt) != _allowedExtensions.end()) {
 		ArchiveDescriptor entry;
 
 		entry.name = filename;
@@ -302,6 +308,7 @@
 
 	if (_dependencies.empty()) {
 		_dependencies.insert("ArchivePK4");
+		_dependencies.insert(MODULE_XMLREGISTRY);
 		_dependencies.insert(MODULE_GAMEMANAGER);
 	}
 
Index: plugins/vfspk3/Doom3FileSystem.h
===================================================================
--- plugins/vfspk3/Doom3FileSystem.h	(revision 6246)
+++ plugins/vfspk3/Doom3FileSystem.h	(working copy)
@@ -42,6 +42,7 @@
 {
 	std::string _directories[VFS_MAXDIRS];
 	int _numDirectories;
+	std::set<std::string> _allowedExtensions;
 
 	struct ArchiveDescriptor {
 		std::string name;
Index: tools/vcprojects/vfspk3.vcproj
===================================================================
--- tools/vcprojects/vfspk3.vcproj	(revision 6246)
+++ tools/vcprojects/vfspk3.vcproj	(working copy)
@@ -241,7 +241,7 @@
 				InlineFunctionExpansion="2"
 				EnableIntrinsicFunctions="true"
 				FavorSizeOrSpeed="1"
-				AdditionalIncludeDirectories="&quot;$(SolutionDir)/../../include&quot;;&quot;$(SolutionDir)/../../libs&quot;;&quot;$(SolutionDir)/../../w32deps/boost/include&quot;;&quot;$(SolutionDir)/../../w32deps/libxml2/include&quot;;&quot;$(SolutionDir)/../../w32deps/gtk2/include/gtk-2.0&quot;;&quot;$(SolutionDir)/../../w32deps/gtk2/include/atk-1.0&quot;;&quot;$(SolutionDir)/../../w32deps/gtk2/include/glib-2.0&quot;;&quot;$(SolutionDir)/../../w32deps/gtk2/include/cairo&quot;;&quot;$(SolutionDir)/../../w32deps/gtk2/include/pango-1.0&quot;;&quot;$(SolutionDir)/../../w32deps/gtk2/lib/glib-2.0/include&quot;;&quot;$(SolutionDir)/../../w32deps/gtk2/lib/gtk-2.0/include&quot;;&quot;$(SolutionDir)/../../w32deps/win_iconv/include&quot;"
+				AdditionalIncludeDirectories="&quot;$(SolutionDir)/../../include&quot;;&quot;$(SolutionDir)/../../libs&quot;;&quot;$(SolutionDir)/../../w32deps/boost/include&quot;;&quot;$(SolutionDir)/../../w32deps/libxml2/include&quot;;&quot;$(SolutionDir)/../../w32deps/gtk2/include/gtk-2.0&quot;;&quot;$(SolutionDir)/../../w32deps/gtk2/include/atk-1.0&quot;;&quot;$(SolutionDir)/../../w32deps/gtk2/include/glib-2.0&quot;;&quot;$(SolutionDir)/../../w32deps/gtk2/include/cairo&quot;;&quot;$(SolutionDir)/../../w32deps/gtk2/include/pango-1.0&quot;;&quot;$(SolutionDir)/../../w32deps/gtk2/lib/glib-2.0/include&quot;;&quot;$(SolutionDir)/../../w32deps/gtk2/lib/gtk-2.0/include&quot;;&quot;$(SolutionDir)/../../w32deps/win_iconv/include&quot;;&quot;$(SolutionDir)/../../w32deps/gtkmm/include&quot;"
 				PreprocessorDefinitions="NDEBUG;_CRT_SECURE_NO_DEPRECATE;WIN32;"
 				StringPooling="true"
 				ExceptionHandling="0"

Activities

greebo

greebo

21.12.2010 10:00

administrator   ~0003396

Should be fixed now.

Issue History

Date Modified Username Field Change
20.12.2010 10:32 dersaidin New Issue
20.12.2010 10:32 dersaidin File Added: darkradiant6246_archiveext.patch
20.12.2010 11:57 greebo Status new => acknowledged
21.12.2010 09:59 greebo Priority high => normal
21.12.2010 09:59 greebo Assigned To => greebo
21.12.2010 09:59 greebo Status acknowledged => assigned
21.12.2010 09:59 greebo Product Version => 1.5.0
21.12.2010 09:59 greebo Target Version => 1.5.0
21.12.2010 10:00 greebo Note Added: 0003396
21.12.2010 10:00 greebo Status assigned => resolved
21.12.2010 10:00 greebo Fixed in Version => 1.5.0
21.12.2010 10:00 greebo Resolution open => fixed
31.07.2011 04:44 greebo Status resolved => closed