[Scummvm-cvs-logs] SF.net SVN: scummvm: [26299] scummvm/trunk/engines/parallaction/archive.cpp
peres001 at users.sourceforge.net
peres001 at users.sourceforge.net
Sun Mar 25 00:57:30 CET 2007
Revision: 26299
http://scummvm.svn.sourceforge.net/scummvm/?rev=26299&view=rev
Author: peres001
Date: 2007-03-24 16:57:29 -0700 (Sat, 24 Mar 2007)
Log Message:
-----------
Changed detection of the dreaded 'fr' archive in Nippon Safes Amiga Demo. This is not a better hack than before, except that now it works.
Modified Paths:
--------------
scummvm/trunk/engines/parallaction/archive.cpp
Modified: scummvm/trunk/engines/parallaction/archive.cpp
===================================================================
--- scummvm/trunk/engines/parallaction/archive.cpp 2007-03-24 23:35:48 UTC (rev 26298)
+++ scummvm/trunk/engines/parallaction/archive.cpp 2007-03-24 23:57:29 UTC (rev 26299)
@@ -27,13 +27,13 @@
namespace Parallaction {
-// this PSEUDOID is used here to tell ONE archive from the others, namely the 'fr' archive in the
-// amiga demo of Nippon Safes. It's the only archive using different internal offsets.
+// HACK: one archive ('fr') in Nippon Safes Demo for Amiga uses different
+// internal offsets than all the other archives. When an archive is opened
+// its size if checked against SIZEOF_SMALL_ARCHIVE ('fr' size) so Archive
+// can behave properly.
//
-#define PSEUDOID_OFS 5
+#define SIZEOF_SMALL_ARCHIVE 12778
-#define ID_SMALL_ARCHIVE 5 // marks the aforementioned 'fr' archive
-
#define ARCHIVE_FILENAMES_OFS 0x16
#define NORMAL_ARCHIVE_FILES_NUM 384
@@ -61,17 +61,16 @@
if (!_archive.open(path))
error("archive '%s' not found", path);
- _archive.seek(PSEUDOID_OFS);
- uint32 pseudoid = _archive.readByte();
+ bool isSmallArchive = _archive.size() == SIZEOF_SMALL_ARCHIVE;
- _numFiles = (pseudoid == ID_SMALL_ARCHIVE) ? SMALL_ARCHIVE_FILES_NUM : NORMAL_ARCHIVE_FILES_NUM;
+ _numFiles = (isSmallArchive) ? SMALL_ARCHIVE_FILES_NUM : NORMAL_ARCHIVE_FILES_NUM;
_archive.seek(ARCHIVE_FILENAMES_OFS);
_archive.read(_archiveDir, _numFiles*32);
- _archive.seek((pseudoid == ID_SMALL_ARCHIVE) ? SMALL_ARCHIVE_SIZES_OFS : NORMAL_ARCHIVE_SIZES_OFS);
+ _archive.seek((isSmallArchive) ? SMALL_ARCHIVE_SIZES_OFS : NORMAL_ARCHIVE_SIZES_OFS);
- uint32 dataOffset = (pseudoid == ID_SMALL_ARCHIVE) ? SMALL_ARCHIVE_DATA_OFS : NORMAL_ARCHIVE_DATA_OFS;
+ uint32 dataOffset = (isSmallArchive) ? SMALL_ARCHIVE_DATA_OFS : NORMAL_ARCHIVE_DATA_OFS;
for (uint16 i = 0; i < _numFiles; i++) {
_archiveOffsets[i] = dataOffset;
_archiveLenghts[i] = _archive.readUint32BE();
@@ -96,6 +95,9 @@
bool Archive::openArchivedFile(const char *filename) {
resetArchivedFile();
+ if (!_archive.isOpen())
+ error("Archive::openArchivedFile: the archive is not open");
+
uint16 i = 0;
for ( ; i < _numFiles; i++) {
if (!scumm_stricmp(_archiveDir[i], filename)) break;
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