[Scummvm-cvs-logs] SF.net SVN: scummvm: [27684] scummvm/trunk/engines/parallaction

peres001 at users.sourceforge.net peres001 at users.sourceforge.net
Sat Jun 23 23:53:13 CEST 2007


Revision: 27684
          http://scummvm.svn.sourceforge.net/scummvm/?rev=27684&view=rev
Author:   peres001
Date:     2007-06-23 14:53:13 -0700 (Sat, 23 Jun 2007)

Log Message:
-----------
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.

Modified Paths:
--------------
    scummvm/trunk/engines/parallaction/archive.cpp
    scummvm/trunk/engines/parallaction/disk.cpp
    scummvm/trunk/engines/parallaction/disk.h
    scummvm/trunk/engines/parallaction/parallaction.cpp

Modified: scummvm/trunk/engines/parallaction/archive.cpp
===================================================================
--- scummvm/trunk/engines/parallaction/archive.cpp	2007-06-23 21:42:45 UTC (rev 27683)
+++ scummvm/trunk/engines/parallaction/archive.cpp	2007-06-23 21:53:13 UTC (rev 27684)
@@ -37,7 +37,7 @@
 //  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 @@
 	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 @@
 	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);

Modified: scummvm/trunk/engines/parallaction/disk.cpp
===================================================================
--- scummvm/trunk/engines/parallaction/disk.cpp	2007-06-23 21:42:45 UTC (rev 27683)
+++ scummvm/trunk/engines/parallaction/disk.cpp	2007-06-23 21:53:13 UTC (rev 27684)
@@ -90,8 +90,10 @@
 }
 
 
-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) {

Modified: scummvm/trunk/engines/parallaction/disk.h
===================================================================
--- scummvm/trunk/engines/parallaction/disk.h	2007-06-23 21:42:45 UTC (rev 27683)
+++ scummvm/trunk/engines/parallaction/disk.h	2007-06-23 21:53:13 UTC (rev 27684)
@@ -60,6 +60,7 @@
 	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 @@
 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 @@
 	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;

Modified: scummvm/trunk/engines/parallaction/parallaction.cpp
===================================================================
--- scummvm/trunk/engines/parallaction/parallaction.cpp	2007-06-23 21:42:45 UTC (rev 27683)
+++ scummvm/trunk/engines/parallaction/parallaction.cpp	2007-06-23 21:53:13 UTC (rev 27684)
@@ -759,7 +759,7 @@
 		// 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 @@
 			if (!(getFeatures() & GF_DEMO))
 				parseLocation("common");
 		}
+
+		if (!oldArchive.empty())
+			_disk->selectArchive(oldArchive);
 	}
 
 	strcpy(_characterName1, fullName);


This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.




More information about the Scummvm-git-logs mailing list