diff options
author | Nicola Mettifogo | 2007-03-24 23:57:29 +0000 |
---|---|---|
committer | Nicola Mettifogo | 2007-03-24 23:57:29 +0000 |
commit | 7708186cba215ca8cb6e7fcd29c344d90884a228 (patch) | |
tree | ba33492f75e79393d0e47c2f9d34853f56d22212 | |
parent | 7909c312bdef64b06edb9c46bf7f141a5e60f4af (diff) | |
download | scummvm-rg350-7708186cba215ca8cb6e7fcd29c344d90884a228.tar.gz scummvm-rg350-7708186cba215ca8cb6e7fcd29c344d90884a228.tar.bz2 scummvm-rg350-7708186cba215ca8cb6e7fcd29c344d90884a228.zip |
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.
svn-id: r26299
-rw-r--r-- | engines/parallaction/archive.cpp | 22 |
1 files changed, 12 insertions, 10 deletions
diff --git a/engines/parallaction/archive.cpp b/engines/parallaction/archive.cpp index e515ada645..34d1165092 100644 --- a/engines/parallaction/archive.cpp +++ b/engines/parallaction/archive.cpp @@ -27,12 +27,12 @@ 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 ID_SMALL_ARCHIVE 5 // marks the aforementioned 'fr' archive +#define SIZEOF_SMALL_ARCHIVE 12778 #define ARCHIVE_FILENAMES_OFS 0x16 @@ -61,17 +61,16 @@ void Archive::open(const char *file) { 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 @@ void Archive::close() { 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; |