aboutsummaryrefslogtreecommitdiff
path: root/engines/kyra/resource.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'engines/kyra/resource.cpp')
-rw-r--r--engines/kyra/resource.cpp27
1 files changed, 16 insertions, 11 deletions
diff --git a/engines/kyra/resource.cpp b/engines/kyra/resource.cpp
index 798290b16c..9d43d6976a 100644
--- a/engines/kyra/resource.cpp
+++ b/engines/kyra/resource.cpp
@@ -62,12 +62,6 @@ bool Resource::reset() {
if (!dir.exists() || !dir.isDirectory())
error("invalid game path '%s'", dir.getPath().c_str());
- if (!loadPakFile(StaticResource::staticDataFilename()) || !StaticResource::checkKyraDat(this)) {
- Common::String errorMessage = "You're missing the '" + StaticResource::staticDataFilename() + "' file or it got corrupted, (re)get it from the ScummVM website";
- GUIErrorMessage(errorMessage);
- error(errorMessage.c_str());
- }
-
if (_vm->game() == GI_KYRA1) {
// We only need kyra.dat for the demo.
if (_vm->gameFlags().isDemo)
@@ -276,16 +270,27 @@ Common::ArchivePtr Resource::loadArchive(const Common::String &file) {
if (cachedArchive != _archiveCache.end())
return cachedArchive->_value;
- Common::SeekableReadStream *stream = getFileStream(file);
+ Common::ArchiveMemberList list;
+ _files.listMatchingMembers(list, file);
+
+ if (list.empty())
+ return Common::ArchivePtr();
+
+ return loadArchive(file, *list.begin());
+}
+
+Common::ArchivePtr Resource::loadArchive(const Common::String &name, Common::SharedPtr<Common::ArchiveMember> member) {
+ Common::SeekableReadStream *stream = member->open();
+
if (!stream)
return Common::ArchivePtr();
Common::ArchivePtr archive;
for (LoaderList::const_iterator i = _loaders.begin(); i != _loaders.end(); ++i) {
- if ((*i)->checkFilename(file)) {
- if ((*i)->isLoadable(file, *stream)) {
+ if ((*i)->checkFilename(name)) {
+ if ((*i)->isLoadable(name, *stream)) {
stream->seek(0, SEEK_SET);
- archive = Common::ArchivePtr((*i)->load(this, file, *stream));
+ archive = Common::ArchivePtr((*i)->load(member, *stream));
break;
} else {
stream->seek(0, SEEK_SET);
@@ -298,7 +303,7 @@ Common::ArchivePtr Resource::loadArchive(const Common::String &file) {
if (!archive)
return Common::ArchivePtr();
- _archiveCache[file] = archive;
+ _archiveCache[name] = archive;
return archive;
}