aboutsummaryrefslogtreecommitdiff
path: root/engines/kyra
diff options
context:
space:
mode:
authorJohannes Schickel2008-02-24 12:30:12 +0000
committerJohannes Schickel2008-02-24 12:30:12 +0000
commitcb36b056ba1537ad69c08ed51ee110f2fdb73f0a (patch)
treee8f68922297db2bd389b9daff779b209f7a99a93 /engines/kyra
parentf3b497787aaa710c7228d48973598377da024d67 (diff)
downloadscummvm-rg350-cb36b056ba1537ad69c08ed51ee110f2fdb73f0a.tar.gz
scummvm-rg350-cb36b056ba1537ad69c08ed51ee110f2fdb73f0a.tar.bz2
scummvm-rg350-cb36b056ba1537ad69c08ed51ee110f2fdb73f0a.zip
Also add extrapath to default search location for Kyrandia resources.
svn-id: r30949
Diffstat (limited to 'engines/kyra')
-rw-r--r--engines/kyra/resource.cpp63
-rw-r--r--engines/kyra/resource.h2
2 files changed, 41 insertions, 24 deletions
diff --git a/engines/kyra/resource.cpp b/engines/kyra/resource.cpp
index b9c29bc747..4ab24852d2 100644
--- a/engines/kyra/resource.cpp
+++ b/engines/kyra/resource.cpp
@@ -252,35 +252,14 @@ bool Resource::isInPakList(const Common::String &filename) const {
}
void Resource::unloadAllPakFiles() {
- FilesystemNode dir(ConfMan.get("path"));
-
- if (!dir.exists() || !dir.isDirectory())
- error("invalid game path '%s'", dir.getPath().c_str());
-
- FSList fslist;
- if (!dir.getChildren(fslist, FilesystemNode::kListFilesOnly))
- error("can't list files inside game path '%s'", dir.getPath().c_str());
-
// remove all entries
_map.clear();
+
+ addSearchPath(ConfMan.get("path"));
+ addSearchPath(ConfMan.get("extrapath"));
Common::File temp;
- for (FSList::const_iterator file = fslist.begin(); file != fslist.end(); ++file) {
- ResFileEntry entry;
- entry.parent = "";
- if (!temp.open(file->getPath()))
- error("couldn't open file '%s'", file->getName().c_str());
- entry.size = temp.size();
- entry.offset = 0;
- entry.mounted = false;
- entry.preload = false;
- entry.prot = false;
- entry.type = ResFileEntry::kAutoDetect;
- _map[file->getName()] = entry;
- temp.close();
- }
-
ResFileMap::iterator iter = _map.find(StaticResource::staticDataFilename());
if (iter == _map.end()) {
if (temp.open(StaticResource::staticDataFilename())) {
@@ -296,8 +275,44 @@ void Resource::unloadAllPakFiles() {
temp.close();
}
}
+}
+
+bool Resource::addSearchPath(const Common::String &path) {
+ if (path.empty())
+ return false;
+
+ FilesystemNode dir(ConfMan.get("path"));
+
+ if (!dir.exists() || !dir.isDirectory()) {
+ warning("invalid data path '%s'", dir.getPath().c_str());
+ return false;
+ }
+
+ FSList fslist;
+ if (!dir.getChildren(fslist, FilesystemNode::kListFilesOnly)) {
+ warning("can't list files inside path '%s'", dir.getPath().c_str());
+ return false;
+ }
+
+ Common::File temp;
+
+ for (FSList::const_iterator file = fslist.begin(); file != fslist.end(); ++file) {
+ ResFileEntry entry;
+ entry.parent = "";
+ if (!temp.open(file->getPath()))
+ error("couldn't open file '%s'", file->getName().c_str());
+ entry.size = temp.size();
+ entry.offset = 0;
+ entry.mounted = false;
+ entry.preload = false;
+ entry.prot = false;
+ entry.type = ResFileEntry::kAutoDetect;
+ _map[file->getName()] = entry;
+ temp.close();
+ }
detectFileTypes();
+ return true;
}
uint8 *Resource::fileData(const char *file, uint32 *size) const {
diff --git a/engines/kyra/resource.h b/engines/kyra/resource.h
index cde5df4bf2..c0aa05f77d 100644
--- a/engines/kyra/resource.h
+++ b/engines/kyra/resource.h
@@ -90,6 +90,8 @@ public:
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;