Check all 'kyra.dat' files in setup paths instead of only the first one found.

svn-id: r34735
This commit is contained in:
Johannes Schickel 2008-10-03 18:18:42 +00:00
parent e417471177
commit f3469eae94
6 changed files with 131 additions and 95 deletions

View file

@ -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;
}