AGOS: Fix engine crash when playing Feeble Files from cabinet datafiles.

Playing with cabinet datafiles, this failed to find the "Charisma.smk"
file in the cabinets when in the Recreation (TV) room on Cygnus Alpha
and this caused an engine abort after the GUI dialog warning of the
"missing" video file. This was due to animation.cpp code using
Common::file::exists() instead of going via the ArchiveMan.

However,a hasFile() method implementation was also required to implement
fallback to decompressed (movie) files if the file requested is not in
the cabinet or the cabinet has been externally decompressed to files.

Thanks to fuzzie for the hasFile() patch.

Also, removed noisy warning which this correction triggers repeatedly in
installshield_cab.cpp hasFile(). This looks like leftover from
debugging, so not critical.
This commit is contained in:
D G Turner 2011-11-13 23:35:02 +00:00
parent 4b433c2961
commit 783e3fea62
4 changed files with 12 additions and 5 deletions

View File

@ -197,6 +197,7 @@ public:
void registerArchive(const Common::String &filename, int priority);
#endif
bool hasFile(const Common::String &name);
Common::SeekableReadStream *open(const Common::String &filename);
private:

View File

@ -525,25 +525,25 @@ MoviePlayer *makeMoviePlayer(AGOSEngine_Feeble *vm, const char *name) {
memcpy(shortName, baseName, 6);
sprintf(filename, "%s~1.dxa", shortName);
if (Common::File::exists(filename)) {
if (vm->_archives.hasFile(filename)) {
memset(baseName, 0, sizeof(baseName));
memcpy(baseName, filename, 8);
}
sprintf(filename, "%s~1.smk", shortName);
if (Common::File::exists(filename)) {
if (vm->_archives.hasFile(filename)) {
memset(baseName, 0, sizeof(baseName));
memcpy(baseName, filename, 8);
}
}
sprintf(filename, "%s.dxa", baseName);
if (Common::File::exists(filename)) {
if (vm->_archives.hasFile(filename)) {
return new MoviePlayerDXA(vm, baseName);
}
sprintf(filename, "%s.smk", baseName);
if (Common::File::exists(filename)) {
if (vm->_archives.hasFile(filename)) {
return new MoviePlayerSMK(vm, baseName);
}

View File

@ -162,7 +162,6 @@ InstallShieldCabinet::InstallShieldCabinet(const Common::String &filename) : _in
}
bool InstallShieldCabinet::hasFile(const Common::String &name) {
warning("hasFile: Filename %s", name.c_str());
return _map.contains(name);
}

View File

@ -47,6 +47,13 @@ void ArchiveMan::registerArchive(const Common::String &filename, int priority) {
}
#endif
bool ArchiveMan::hasFile(const Common::String &name) {
if (_fallBack && SearchMan.hasFile(name))
return true;
return Common::SearchSet::hasFile(name);
}
Common::SeekableReadStream *ArchiveMan::open(const Common::String &filename) {
if (_fallBack && SearchMan.hasFile(filename)) {
return SearchMan.createReadStreamForMember(filename);