[Scummvm-cvs-logs] SF.net SVN: scummvm: [30949] scummvm/trunk/engines/kyra
lordhoto at users.sourceforge.net
lordhoto at users.sourceforge.net
Sun Feb 24 13:30:13 CET 2008
Revision: 30949
http://scummvm.svn.sourceforge.net/scummvm/?rev=30949&view=rev
Author: lordhoto
Date: 2008-02-24 04:30:12 -0800 (Sun, 24 Feb 2008)
Log Message:
-----------
Also add extrapath to default search location for Kyrandia resources.
Modified Paths:
--------------
scummvm/trunk/engines/kyra/resource.cpp
scummvm/trunk/engines/kyra/resource.h
Modified: scummvm/trunk/engines/kyra/resource.cpp
===================================================================
--- scummvm/trunk/engines/kyra/resource.cpp 2008-02-24 01:12:39 UTC (rev 30948)
+++ scummvm/trunk/engines/kyra/resource.cpp 2008-02-24 12:30:12 UTC (rev 30949)
@@ -252,20 +252,50 @@
}
void Resource::unloadAllPakFiles() {
+ // remove all entries
+ _map.clear();
+
+ addSearchPath(ConfMan.get("path"));
+ addSearchPath(ConfMan.get("extrapath"));
+
+ Common::File temp;
+
+ ResFileMap::iterator iter = _map.find(StaticResource::staticDataFilename());
+ if (iter == _map.end()) {
+ if (temp.open(StaticResource::staticDataFilename())) {
+ ResFileEntry entry;
+ entry.parent = "";
+ entry.size = temp.size();
+ entry.mounted = true;
+ entry.preload = false;
+ entry.prot = false;
+ entry.type = ResFileEntry::kAutoDetect;
+ entry.offset = 0;
+ _map[StaticResource::staticDataFilename()] = entry;
+ temp.close();
+ }
+ }
+}
+
+bool Resource::addSearchPath(const Common::String &path) {
+ if (path.empty())
+ return false;
+
FilesystemNode dir(ConfMan.get("path"));
- if (!dir.exists() || !dir.isDirectory())
- error("invalid game path '%s'", dir.getPath().c_str());
+ if (!dir.exists() || !dir.isDirectory()) {
+ warning("invalid data path '%s'", dir.getPath().c_str());
+ return false;
+ }
FSList fslist;
- if (!dir.getChildren(fslist, FilesystemNode::kListFilesOnly))
- error("can't list files inside game path '%s'", dir.getPath().c_str());
+ if (!dir.getChildren(fslist, FilesystemNode::kListFilesOnly)) {
+ warning("can't list files inside path '%s'", dir.getPath().c_str());
+ return false;
+ }
- // remove all entries
- _map.clear();
-
Common::File temp;
-
+
for (FSList::const_iterator file = fslist.begin(); file != fslist.end(); ++file) {
ResFileEntry entry;
entry.parent = "";
@@ -281,23 +311,8 @@
temp.close();
}
- ResFileMap::iterator iter = _map.find(StaticResource::staticDataFilename());
- if (iter == _map.end()) {
- if (temp.open(StaticResource::staticDataFilename())) {
- ResFileEntry entry;
- entry.parent = "";
- entry.size = temp.size();
- entry.mounted = true;
- entry.preload = false;
- entry.prot = false;
- entry.type = ResFileEntry::kAutoDetect;
- entry.offset = 0;
- _map[StaticResource::staticDataFilename()] = entry;
- temp.close();
- }
- }
-
detectFileTypes();
+ return true;
}
uint8 *Resource::fileData(const char *file, uint32 *size) const {
Modified: scummvm/trunk/engines/kyra/resource.h
===================================================================
--- scummvm/trunk/engines/kyra/resource.h 2008-02-24 01:12:39 UTC (rev 30948)
+++ scummvm/trunk/engines/kyra/resource.h 2008-02-24 12:30:12 UTC (rev 30949)
@@ -90,6 +90,8 @@
bool reset();
+ bool addSearchPath(const Common::String &path);
+
bool loadPakFile(const Common::String &filename);
void unloadPakFile(const Common::String &filename);
bool isInPakList(const Common::String &filename) const;
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
More information about the Scummvm-git-logs
mailing list