diff options
author | Nicola Mettifogo | 2007-06-23 21:53:13 +0000 |
---|---|---|
committer | Nicola Mettifogo | 2007-06-23 21:53:13 +0000 |
commit | caa69a55fc3b449b02c4b1ecd03d52f9257d7c75 (patch) | |
tree | f866913741dea330c12379b0b2181e166525c4a3 /engines | |
parent | 2fb22f2eea03a2e45daef5adcf35237c8e7cf923 (diff) | |
download | scummvm-rg350-caa69a55fc3b449b02c4b1ecd03d52f9257d7c75.tar.gz scummvm-rg350-caa69a55fc3b449b02c4b1ecd03d52f9257d7c75.tar.bz2 scummvm-rg350-caa69a55fc3b449b02c4b1ecd03d52f9257d7c75.zip |
Made changeCharacter restore the previous open Archive after completing its duties: this fixes known crash when mini-Dino activates robot, and possibly many unknown others.
svn-id: r27684
Diffstat (limited to 'engines')
-rw-r--r-- | engines/parallaction/archive.cpp | 8 | ||||
-rw-r--r-- | engines/parallaction/disk.cpp | 6 | ||||
-rw-r--r-- | engines/parallaction/disk.h | 7 | ||||
-rw-r--r-- | engines/parallaction/parallaction.cpp | 5 |
4 files changed, 20 insertions, 6 deletions
diff --git a/engines/parallaction/archive.cpp b/engines/parallaction/archive.cpp index b678b6df3c..9eef3f44e9 100644 --- a/engines/parallaction/archive.cpp +++ b/engines/parallaction/archive.cpp @@ -37,7 +37,7 @@ namespace Parallaction { // Amiga version of Nippon Safes, and one archive ('fr') in the Amiga Demo of // Nippon Safes used different internal offsets than all the other archives. // -// When an archive is opened in the Amiga demo, its size is checked against +// When an archive is opened in the Amiga demo, its size is checked against // SIZEOF_SMALL_ARCHIVE to detect when the smaller archive is used. // // When an archive is opened in Amiga multi-lingual version, the header is @@ -72,6 +72,8 @@ void Archive::open(const char *file) { if (!_archive.open(path)) error("archive '%s' not found", path); + _archiveName = file; + bool isSmallArchive = false; if (_vm->getPlatform() == Common::kPlatformAmiga) { if (_vm->getFeatures() & GF_DEMO) { @@ -105,8 +107,12 @@ void Archive::close() { resetArchivedFile(); _archive.close(); + _archiveName.clear(); } +Common::String Archive::name() const { + return _archiveName; +} bool Archive::openArchivedFile(const char *filename) { debugC(3, kDebugDisk, "Archive::openArchivedFile(%s)", filename); diff --git a/engines/parallaction/disk.cpp b/engines/parallaction/disk.cpp index 7b11fbbbed..03d33dae37 100644 --- a/engines/parallaction/disk.cpp +++ b/engines/parallaction/disk.cpp @@ -90,8 +90,10 @@ void Disk::errorFileNotFound(const char *s) { } -void Disk::selectArchive(const char *name) { - _resArchive.open(name); +Common::String Disk::selectArchive(const Common::String& name) { + Common::String oldName = _resArchive.name(); + _resArchive.open(name.c_str()); + return oldName; } void Disk::setLanguage(uint16 language) { diff --git a/engines/parallaction/disk.h b/engines/parallaction/disk.h index bfef6d81df..408e1f7c6b 100644 --- a/engines/parallaction/disk.h +++ b/engines/parallaction/disk.h @@ -60,6 +60,7 @@ protected: uint32 _fileCursor; uint32 _fileEndOffset; + Common::String _archiveName; char _archiveDir[MAX_ARCHIVE_ENTRIES][32]; uint32 _archiveLenghts[MAX_ARCHIVE_ENTRIES]; uint32 _archiveOffsets[MAX_ARCHIVE_ENTRIES]; @@ -74,9 +75,11 @@ protected: public: Archive(); - void open(const char *file); + void open(const char* file); void close(); + Common::String name() const; + bool openArchivedFile(const char *name); void closeArchivedFile(); @@ -103,7 +106,7 @@ public: Disk(Parallaction *vm); virtual ~Disk(); - void selectArchive(const char *name); + Common::String selectArchive(const Common::String &name); void setLanguage(uint16 language); virtual Script* loadLocation(const char *name) = 0; diff --git a/engines/parallaction/parallaction.cpp b/engines/parallaction/parallaction.cpp index e0291c5a2a..9c16a40fd4 100644 --- a/engines/parallaction/parallaction.cpp +++ b/engines/parallaction/parallaction.cpp @@ -759,7 +759,7 @@ void Parallaction::changeCharacter(const char *name) { // character for sanity before memory is freed freeCharacter(); - _disk->selectArchive((_vm->getPlatform() == Common::kPlatformAmiga) ? "disk0" : "disk1"); + Common::String oldArchive = _disk->selectArchive((_vm->getPlatform() == Common::kPlatformAmiga) ? "disk0" : "disk1"); _vm->_char._ani._cnv = _disk->loadFrames(fullName); if (!IS_DUMMY_CHARACTER(name)) { @@ -774,6 +774,9 @@ void Parallaction::changeCharacter(const char *name) { if (!(getFeatures() & GF_DEMO)) parseLocation("common"); } + + if (!oldArchive.empty()) + _disk->selectArchive(oldArchive); } strcpy(_characterName1, fullName); |