[Scummvm-git-logs] scummvm master -> decc738ff2ee3795714586bdaa2b402feec3d8d1
djsrv
dservilla at gmail.com
Wed Aug 12 01:28:15 UTC 2020
This automated email contains information about 4 new commits which have been
pushed to the 'scummvm' repo located at https://github.com/scummvm/scummvm .
Summary:
49e7a9d80f DIRECTOR: Refactor RIFXArchive::openStream
5fdc06e7e4 DIRECTOR: Implement readVarInt
43fd94166d DIRECTOR: Implement readZlibData
decc738ff2 DIRECTOR: Read ABMP
Commit: 49e7a9d80fdd3484252514911f26d66943738202
https://github.com/scummvm/scummvm/commit/49e7a9d80fdd3484252514911f26d66943738202
Author: djsrv (dservilla at gmail.com)
Date: 2020-08-11T21:25:33-04:00
Commit Message:
DIRECTOR: Refactor RIFXArchive::openStream
Separate it into helper functions
Changed paths:
engines/director/archive.cpp
engines/director/archive.h
diff --git a/engines/director/archive.cpp b/engines/director/archive.cpp
index 1b1d9cbefc..771833e284 100644
--- a/engines/director/archive.cpp
+++ b/engines/director/archive.cpp
@@ -390,8 +390,20 @@ Common::SeekableSubReadStreamEndian *RIFFArchive::getResource(uint32 tag, uint16
}
// RIFX Archive code
+
+RIFXArchive::RIFXArchive() : Archive(){
+ _isBigEndian = true;
+ _rifxType = 0;
+}
+
+RIFXArchive::~RIFXArchive() {
+}
+
bool RIFXArchive::openStream(Common::SeekableReadStream *stream, uint32 startOffset) {
- close();
+ if (stream != _stream) {
+ close();
+ _stream = stream;
+ }
stream->seek(startOffset);
@@ -424,9 +436,10 @@ bool RIFXArchive::openStream(Common::SeekableReadStream *stream, uint32 startOff
return false;
}
- Common::SeekableSubReadStreamEndian subStream(stream, startOffset + 4 + moreOffset, stream->size(), _isBigEndian, DisposeAfterUse::NO);
+ Common::SeekableSubReadStreamEndian endianStream(stream, 0, stream->size(), _isBigEndian, DisposeAfterUse::NO);
+ endianStream.seek(startOffset + moreOffset + 4);
- uint32 sz = subStream.readUint32(); // size
+ uint32 sz = endianStream.readUint32(); // size
// If it is an embedded file, dump it if requested
if (ConfMan.getBool("dump_scripts") && startOffset) {
@@ -452,88 +465,33 @@ bool RIFXArchive::openStream(Common::SeekableReadStream *stream, uint32 startOff
}
}
- uint32 rifxType = subStream.readUint32();
-
- if (rifxType != MKTAG('M', 'V', '9', '3') &&
- rifxType != MKTAG('A', 'P', 'P', 'L') &&
- rifxType != MKTAG('M', 'C', '9', '5'))
- return false;
+ _rifxType = endianStream.readUint32();
+ warning("RIFX: type: %s", tag2str(_rifxType));
- if (subStream.readUint32() != MKTAG('i', 'm', 'a', 'p'))
+ if (_rifxType != MKTAG('M', 'V', '9', '3') &&
+ _rifxType != MKTAG('A', 'P', 'P', 'L') &&
+ _rifxType != MKTAG('M', 'C', '9', '5'))
return false;
- subStream.readUint32(); // imap length
- subStream.readUint32(); // unknown
- uint32 mmapOffset = subStream.readUint32() - startOffset - 4;
- uint32 version = subStream.readUint32(); // 0 for 4.0, 0x4c1 for 5.0, 0x4c7 for 6.0, 0x708 for 8.5, 0x742 for 10.0
- warning("RIFX: version: %x type: %s", version, tag2str(rifxType));
-
- subStream.seek(mmapOffset);
-
- if (subStream.readUint32() != MKTAG('m', 'm', 'a', 'p')) {
- warning("RIFXArchive::openStream(): mmap expected but not found");
+ if (!readMemoryMap(endianStream, moreOffset))
return false;
- }
-
- subStream.readUint32(); // mmap length
- subStream.readUint16(); // unknown
- subStream.readUint16(); // unknown
- subStream.readUint32(); // resCount + empty entries
- uint32 resCount = subStream.readUint32();
- subStream.skip(8); // all 0xFF
- subStream.readUint32(); // id of the first free resource, -1 if none.
-
- Common::Array<Resource *> resources;
- resources.reserve(resCount);
-
- // Need to look for these two resources
- const Resource *keyRes = 0;
- const Resource *casRes = 0;
-
- for (uint32 i = 0; i < resCount; i++) {
- uint32 tag = subStream.readUint32();
- uint32 size = subStream.readUint32();
- uint32 offset = subStream.readUint32() + moreOffset;
- uint16 flags = subStream.readUint16();
- uint16 unk1 = subStream.readUint16();
- uint32 nextFreeResourceId = subStream.readUint32(); // for free resources, the next id, flag like for imap and mmap resources
-
- debug(3, "Found RIFX resource index %d: '%s', %d bytes @ 0x%08x (%d), flags: %x unk1: %x nextFreeResourceId: %d",
- i, tag2str(tag), size, offset, offset, flags, unk1, nextFreeResourceId);
- // APPL is a special case; it has an embedded "normal" archive
- if (rifxType == MKTAG('A', 'P', 'P', 'L') && tag == MKTAG('F', 'i', 'l', 'e'))
- return openStream(stream, offset);
-
- Resource &res = _types[tag][i];
- res.index = i;
- res.offset = offset;
- res.size = size;
- res.tag = tag;
- resources.push_back(&res);
-
- // Looking for two types here
- if (tag == MKTAG('K', 'E', 'Y', '*'))
- keyRes = &res;
- else if (tag == MKTAG('C', 'A', 'S', '*'))
- casRes = &res;
- }
if (ConfMan.getBool("dump_scripts")) {
- debug("RIFXArchive::openStream(): Dumping %d resources", resources.size());
+ debug("RIFXArchive::openStream(): Dumping %d resources", _resources.size());
byte *data = nullptr;
uint dataSize = 0;
Common::DumpFile out;
- for (uint i = 0; i < resources.size(); i++) {
- stream->seek(resources[i]->offset);
+ for (uint i = 0; i < _resources.size(); i++) {
+ stream->seek(_resources[i]->offset);
- uint32 len = resources[i]->size;
+ uint32 len = _resources[i]->size;
- if (dataSize < resources[i]->size) {
+ if (dataSize < _resources[i]->size) {
free(data);
- data = (byte *)malloc(resources[i]->size);
- dataSize = resources[i]->size;
+ data = (byte *)malloc(_resources[i]->size);
+ dataSize = _resources[i]->size;
}
Common::String prepend;
if (_pathName.size() != 0)
@@ -541,7 +499,7 @@ bool RIFXArchive::openStream(Common::SeekableReadStream *stream, uint32 startOff
else
prepend = "stream";
- Common::String filename = Common::String::format("./dumps/%s-%s-%d", prepend.c_str(), tag2str(resources[i]->tag), i);
+ Common::String filename = Common::String::format("./dumps/%s-%s-%d", prepend.c_str(), tag2str(_resources[i]->tag), i);
stream->read(data, len);
if (!out.open(filename, true)) {
@@ -556,45 +514,108 @@ bool RIFXArchive::openStream(Common::SeekableReadStream *stream, uint32 startOff
}
}
-
-
- // We need to have found the 'File' resource already
- if (rifxType == MKTAG('A', 'P', 'P', 'L')) {
- warning("No 'File' resource present in APPL archive");
- return false;
+ Common::SeekableSubReadStreamEndian *casRes = getFirstResource(MKTAG('C', 'A', 'S', '*'));
+ // Parse the CAS*, if present
+ if (casRes) {
+ readCast(*casRes);
+ delete casRes;
}
+ Common::SeekableSubReadStreamEndian *keyRes = getFirstResource(MKTAG('K', 'E', 'Y', '*'), true);
// A KEY* must be present
if (!keyRes) {
warning("No 'KEY*' resource present");
return false;
}
+ // Parse the KEY*
+ readKeyTable(*keyRes);
+ delete keyRes;
- uint castTag = MKTAG('C', 'A', 'S', 't');
+ return true;
+}
- // Parse the CAS*, if present
- if (casRes) {
- Common::SeekableSubReadStreamEndian casStream(stream, casRes->offset + 8, casRes->offset + 8 + casRes->size, _isBigEndian, DisposeAfterUse::NO);
+bool RIFXArchive::readMemoryMap(Common::SeekableSubReadStreamEndian &stream, uint32 moreOffset) {
+ if (stream.readUint32() != MKTAG('i', 'm', 'a', 'p'))
+ return false;
+
+ stream.readUint32(); // imap length
+ stream.readUint32(); // unknown
+ uint32 mmapOffset = stream.readUint32() + moreOffset;
+ uint32 version = stream.readUint32(); // 0 for 4.0, 0x4c1 for 5.0, 0x4c7 for 6.0, 0x708 for 8.5, 0x742 for 10.0
+ warning("mmap: version: %x", version);
+
+ stream.seek(mmapOffset);
- uint casSize = casRes->size / 4;
+ if (stream.readUint32() != MKTAG('m', 'm', 'a', 'p')) {
+ warning("RIFXArchive::readMemoryMap(): mmap expected but not found");
+ return false;
+ }
- debugCN(2, kDebugLoading, "CAS*: %d [", casSize);
+ stream.readUint32(); // mmap length
+ stream.readUint16(); // unknown
+ stream.readUint16(); // unknown
+ stream.readUint32(); // resCount + empty entries
+ uint32 resCount = stream.readUint32();
+ stream.skip(8); // all 0xFF
+ stream.readUint32(); // id of the first free resource, -1 if none.
- for (uint i = 0; i < casSize; i++) {
- uint32 castIndex = casStream.readUint32BE();
- debugCN(2, kDebugLoading, "%d ", castIndex);
+ if (_rifxType != MKTAG('A', 'P', 'P', 'L'))
+ _resources.reserve(resCount);
- if (castIndex == 0) {
- continue;
- }
- Resource &res = _types[castTag][castIndex];
- res.castId = i;
+ for (uint32 i = 0; i < resCount; i++) {
+ uint32 tag = stream.readUint32();
+ uint32 size = stream.readUint32();
+ uint32 offset = stream.readUint32() + moreOffset;
+ uint16 flags = stream.readUint16();
+ uint16 unk1 = stream.readUint16();
+ uint32 nextFreeResourceId = stream.readUint32(); // for free resources, the next id, flag like for imap and mmap resources
+
+ debug(3, "Found RIFX resource index %d: '%s', %d bytes @ 0x%08x (%d), flags: %x unk1: %x nextFreeResourceId: %d",
+ i, tag2str(tag), size, offset, offset, flags, unk1, nextFreeResourceId);
+ // APPL is a special case; it has an embedded "normal" archive
+ if (_rifxType == MKTAG('A', 'P', 'P', 'L')) {
+ if (tag == MKTAG('F', 'i', 'l', 'e'))
+ return openStream(_stream, offset);
+ } else {
+ Resource &res = _types[tag][i];
+ res.index = i;
+ res.offset = offset;
+ res.size = size;
+ res.tag = tag;
+ _resources.push_back(&res);
}
- debugC(2, kDebugLoading, "]");
}
- // Parse the KEY*
- Common::SeekableSubReadStreamEndian keyStream(stream, keyRes->offset + 8, keyRes->offset + 8 + keyRes->size, _isBigEndian, DisposeAfterUse::NO);
+ // We need to have found the 'File' resource already
+ if (_rifxType == MKTAG('A', 'P', 'P', 'L')) {
+ warning("No 'File' resource present in APPL archive");
+ return false;
+ }
+
+ return true;
+}
+
+void RIFXArchive::readCast(Common::SeekableSubReadStreamEndian &casStream) {
+ uint castTag = MKTAG('C', 'A', 'S', 't');
+
+ uint casSize = casStream.size() / 4;
+
+ debugCN(2, kDebugLoading, "CAS*: %d [", casSize);
+
+ for (uint i = 0; i < casSize; i++) {
+ uint32 castIndex = casStream.readUint32BE();
+ debugCN(2, kDebugLoading, "%d ", castIndex);
+
+ if (castIndex == 0) {
+ continue;
+ }
+ Resource &res = _types[castTag][castIndex];
+ res.castId = i;
+ }
+ debugC(2, kDebugLoading, "]");
+}
+
+void RIFXArchive::readKeyTable(Common::SeekableSubReadStreamEndian &keyStream) {
uint16 entrySize = keyStream.readUint16(); // Should always be 12 (3 uint32's)
uint16 entrySize2 = keyStream.readUint16();
uint32 entryCount = keyStream.readUint32(); // There are more entries than actually used
@@ -608,15 +629,24 @@ bool RIFXArchive::openStream(Common::SeekableReadStream *stream, uint32 startOff
uint32 childTag = keyStream.readUint32();
debugC(2, kDebugLoading, "KEY*: childIndex: %d parentIndex: %d childTag: %s", childIndex, parentIndex, tag2str(childTag));
- if (childIndex < resources.size() && parentIndex < resources.size())
- resources[parentIndex]->children.push_back(*resources[childIndex]);
+ if (childIndex < _resources.size() && parentIndex < _resources.size())
+ _resources[parentIndex]->children.push_back(*_resources[childIndex]);
}
+}
- _stream = stream;
- return true;
+Common::SeekableSubReadStreamEndian *RIFXArchive::getFirstResource(uint32 tag) {
+ return getResource(tag, getResourceIDList(tag)[0], false);
+}
+
+Common::SeekableSubReadStreamEndian *RIFXArchive::getFirstResource(uint32 tag, bool fileEndianness) {
+ return getResource(tag, getResourceIDList(tag)[0], fileEndianness);
}
Common::SeekableSubReadStreamEndian *RIFXArchive::getResource(uint32 tag, uint16 id) {
+ return getResource(tag, id, false);
+}
+
+Common::SeekableSubReadStreamEndian *RIFXArchive::getResource(uint32 tag, uint16 id, bool fileEndianness) {
if (!_types.contains(tag))
error("RIFXArchive::getResource(): Archive does not contain '%s' %d", tag2str(tag), id);
@@ -629,8 +659,9 @@ Common::SeekableSubReadStreamEndian *RIFXArchive::getResource(uint32 tag, uint16
uint32 offset = res.offset + 8;
uint32 size = res.size;
+ bool bigEndian = fileEndianness ? _isBigEndian : true;
- return new Common::SeekableSubReadStreamEndian(_stream, offset, offset + size, true, DisposeAfterUse::NO);
+ return new Common::SeekableSubReadStreamEndian(_stream, offset, offset + size, bigEndian, DisposeAfterUse::NO);
}
Resource RIFXArchive::getResourceDetail(uint32 tag, uint16 id) {
diff --git a/engines/director/archive.h b/engines/director/archive.h
index 934802230c..2542b0c720 100644
--- a/engines/director/archive.h
+++ b/engines/director/archive.h
@@ -62,7 +62,7 @@ public:
bool hasResource(uint32 tag, int id) const;
bool hasResource(uint32 tag, const Common::String &resName) const;
virtual Common::SeekableSubReadStreamEndian *getResource(uint32 tag, uint16 id);
- Common::SeekableSubReadStreamEndian *getFirstResource(uint32 tag);
+ virtual Common::SeekableSubReadStreamEndian *getFirstResource(uint32 tag);
virtual Resource getResourceDetail(uint32 tag, uint16 id);
uint32 getOffset(uint32 tag, uint16 id) const;
uint16 findResourceID(uint32 tag, const Common::String &resName) const;
@@ -111,12 +111,24 @@ public:
class RIFXArchive : public Archive {
public:
- RIFXArchive() : Archive(){ _isBigEndian = true; }
- ~RIFXArchive() override {}
+ RIFXArchive();
+ ~RIFXArchive() override;
bool openStream(Common::SeekableReadStream *stream, uint32 startOffset = 0) override;
+ Common::SeekableSubReadStreamEndian *getFirstResource(uint32 tag) override;
+ virtual Common::SeekableSubReadStreamEndian *getFirstResource(uint32 tag, bool fileEndianness);
Common::SeekableSubReadStreamEndian *getResource(uint32 tag, uint16 id) override;
+ virtual Common::SeekableSubReadStreamEndian *getResource(uint32 tag, uint16 id, bool fileEndianness);
Resource getResourceDetail(uint32 tag, uint16 id) override;
+
+private:
+ bool readMemoryMap(Common::SeekableSubReadStreamEndian &stream, uint32 moreOffset);
+ void readCast(Common::SeekableSubReadStreamEndian &casStream);
+ void readKeyTable(Common::SeekableSubReadStreamEndian &keyStream);
+
+protected:
+ uint32 _rifxType;
+ Common::Array<Resource *> _resources;
};
} // End of namespace Director
Commit: 5fdc06e7e4280447a8b64312d5f3d86e78f29dbc
https://github.com/scummvm/scummvm/commit/5fdc06e7e4280447a8b64312d5f3d86e78f29dbc
Author: djsrv (dservilla at gmail.com)
Date: 2020-08-11T21:25:58-04:00
Commit Message:
DIRECTOR: Implement readVarInt
Changed paths:
engines/director/util.cpp
engines/director/util.h
diff --git a/engines/director/util.cpp b/engines/director/util.cpp
index 2a74a62c76..04a36235e8 100644
--- a/engines/director/util.cpp
+++ b/engines/director/util.cpp
@@ -658,4 +658,15 @@ int32 RandomState::perlin(int32 val) {
return res;
}
+uint32 readVarInt(Common::SeekableReadStream &stream) {
+ // Shockwave variable-length integer
+ uint32 val = 0;
+ byte b;
+ do {
+ b = stream.readByte();
+ val = (val << 7) | (b & 0x7f); // The 7 least significant bits are appended to the result
+ } while (b >> 7); // If the most significant bit is 1, there's another byte after
+ return val;
+}
+
} // End of namespace Director
diff --git a/engines/director/util.h b/engines/director/util.h
index 1a599a94a7..b80602517a 100644
--- a/engines/director/util.h
+++ b/engines/director/util.h
@@ -76,6 +76,8 @@ private:
int32 perlin(int32 val);
};
+uint32 readVarInt(Common::SeekableReadStream &stream);
+
} // End of namespace Director
#endif
Commit: 43fd94166db7a0bdcf4d1b7f8030437de2a9d09b
https://github.com/scummvm/scummvm/commit/43fd94166db7a0bdcf4d1b7f8030437de2a9d09b
Author: djsrv (dservilla at gmail.com)
Date: 2020-08-11T21:25:58-04:00
Commit Message:
DIRECTOR: Implement readZlibData
Changed paths:
engines/director/util.cpp
engines/director/util.h
diff --git a/engines/director/util.cpp b/engines/director/util.cpp
index 04a36235e8..57c0537b7f 100644
--- a/engines/director/util.cpp
+++ b/engines/director/util.cpp
@@ -22,6 +22,8 @@
#include "common/file.h"
#include "common/keyboard.h"
+#include "common/memstream.h"
+#include "common/zlib.h"
#include "director/director.h"
#include "director/util.h"
@@ -669,4 +671,23 @@ uint32 readVarInt(Common::SeekableReadStream &stream) {
return val;
}
+Common::SeekableReadStreamEndian *readZlibData(Common::SeekableReadStream &stream, unsigned long len, unsigned long outLen, bool bigEndian) {
+#ifdef USE_ZLIB
+ byte *in = (byte *)malloc(len);
+ byte *out = (byte *)malloc(outLen);
+ stream.read(in, len);
+
+ if (!Common::uncompress(out, &outLen, in, len)) {
+ free(in);
+ free(out);
+ return nullptr;
+ }
+
+ free(in);
+ return new Common::MemoryReadStreamEndian(out, outLen, bigEndian);
+# else
+ return nullptr;
+# endif
+}
+
} // End of namespace Director
diff --git a/engines/director/util.h b/engines/director/util.h
index b80602517a..7be84db5b3 100644
--- a/engines/director/util.h
+++ b/engines/director/util.h
@@ -78,6 +78,8 @@ private:
uint32 readVarInt(Common::SeekableReadStream &stream);
+Common::SeekableReadStreamEndian *readZlibData(Common::SeekableReadStream &stream, unsigned long len, unsigned long outLen, bool bigEndian);
+
} // End of namespace Director
#endif
Commit: decc738ff2ee3795714586bdaa2b402feec3d8d1
https://github.com/scummvm/scummvm/commit/decc738ff2ee3795714586bdaa2b402feec3d8d1
Author: djsrv (dservilla at gmail.com)
Date: 2020-08-11T21:25:58-04:00
Commit Message:
DIRECTOR: Read ABMP
Changed paths:
engines/director/archive.cpp
engines/director/archive.h
diff --git a/engines/director/archive.cpp b/engines/director/archive.cpp
index 771833e284..266bb549ac 100644
--- a/engines/director/archive.cpp
+++ b/engines/director/archive.cpp
@@ -468,13 +468,21 @@ bool RIFXArchive::openStream(Common::SeekableReadStream *stream, uint32 startOff
_rifxType = endianStream.readUint32();
warning("RIFX: type: %s", tag2str(_rifxType));
- if (_rifxType != MKTAG('M', 'V', '9', '3') &&
- _rifxType != MKTAG('A', 'P', 'P', 'L') &&
- _rifxType != MKTAG('M', 'C', '9', '5'))
- return false;
-
- if (!readMemoryMap(endianStream, moreOffset))
+ switch (_rifxType) {
+ case MKTAG('M', 'V', '9', '3'):
+ case MKTAG('M', 'C', '9', '5'):
+ case MKTAG('A', 'P', 'P', 'L'):
+ if (!readMemoryMap(endianStream, moreOffset))
+ return false;
+ break;
+ case MKTAG('F', 'G', 'D', 'M'):
+ case MKTAG('F', 'G', 'D', 'C'):
+ if (!readAfterburnerMap(endianStream, moreOffset))
+ return false;
+ break;
+ default:
return false;
+ }
if (ConfMan.getBool("dump_scripts")) {
debug("RIFXArchive::openStream(): Dumping %d resources", _resources.size());
@@ -595,6 +603,109 @@ bool RIFXArchive::readMemoryMap(Common::SeekableSubReadStreamEndian &stream, uin
return true;
}
+bool RIFXArchive::readAfterburnerMap(Common::SeekableSubReadStreamEndian &stream, uint32 moreOffset) {
+ uint32 start, end;
+
+ // File version
+ if (stream.readUint32() != MKTAG('F', 'v', 'e', 'r')) {
+ warning("RIFXArchive::readAfterburnerMap(): Fver expected but not found");
+ return false;
+ }
+
+ uint32 fverLength = readVarInt(stream);
+ start = stream.pos();
+ uint32 version = readVarInt(stream);
+ debug(3, "Fver: version: %x", version);
+ end = stream.pos();
+
+ if (end - start != fverLength) {
+ warning("RIFXArchive::readAfterburnerMap(): Expected Fver of length %d but read %d bytes", fverLength, end - start);
+ stream.seek(start + fverLength);
+ }
+
+ // Compression types
+ if (stream.readUint32() != MKTAG('F', 'c', 'd', 'r')) {
+ warning("RIFXArchive::readAfterburnerMap(): Fcdr expected but not found");
+ return false;
+ }
+
+ uint32 fcdrLength = readVarInt(stream);
+ stream.skip(fcdrLength);
+
+ // Afterburner map
+ if (stream.readUint32() != MKTAG('A', 'B', 'M', 'P')) {
+ warning("RIFXArchive::readAfterburnerMap(): ABMP expected but not found");
+ return false;
+ }
+ uint32 abmpLength = readVarInt(stream);
+ uint32 abmpCompressionType = readVarInt(stream);
+ uint32 abmpUncompLength = readVarInt(stream);
+ debug(3, "ABMP: length: %d compressionType: %d uncompressedLength: %d",
+ abmpLength, abmpCompressionType, abmpUncompLength);
+
+ Common::SeekableReadStreamEndian *abmpStream = readZlibData(stream, abmpLength, abmpUncompLength, _isBigEndian);
+ if (!abmpStream) {
+ warning("RIFXArchive::readAfterburnerMap(): Could not uncompress ABMP");
+ return false;
+ }
+
+ if (ConfMan.getBool("dump_scripts")) {
+ Common::DumpFile out;
+
+ char buf[256];
+ sprintf(buf, "./dumps/%s-%s", g_director->getEXEName().c_str(), "ABMP");
+
+ if (out.open(buf, true)) {
+ byte *data = (byte *)malloc(abmpStream->size());
+
+ abmpStream->read(data, abmpStream->size());
+ out.write(data, abmpStream->size());
+ out.flush();
+ out.close();
+
+ free(data);
+
+ abmpStream->seek(0);
+ } else {
+ warning("RIFXArchive::readAfterburnerMap(): Can not open dump file %s", buf);
+ }
+ }
+
+ uint32 abmpUnk1 = readVarInt(*abmpStream);
+ uint32 abmpUnk2 = readVarInt(*abmpStream);
+ uint32 resCount = readVarInt(*abmpStream);
+ debug(3, "ABMP: unk1: %d unk2: %d resCount: %d",
+ abmpUnk1, abmpUnk2, resCount);
+
+ for (uint32 i = 0; i < resCount; i++) {
+ uint32 resId = readVarInt(*abmpStream);
+ uint32 offset = readVarInt(*abmpStream);
+ uint32 compSize = readVarInt(*abmpStream);
+ uint32 uncompSize = readVarInt(*abmpStream);
+ uint32 compressionType = readVarInt(*abmpStream);
+ uint32 tag = abmpStream->readUint32();
+
+ debug(3, "Found RIFX resource index %d: '%s', %d bytes (%d uncompressed) @ pos 0x%08x (%d), compressionType: %d",
+ resId, tag2str(tag), compSize, uncompSize, offset, offset, compressionType);
+
+ Resource &res = _types[tag][resId];
+ res.index = resId;
+ res.offset = offset;
+ res.size = compSize;
+ res.uncompSize = uncompSize;
+ res.compressionType = compressionType;
+ res.tag = tag;
+ _resources.push_back(&res);
+ }
+
+ delete abmpStream;
+
+ // TODO: read ILS
+
+ // FIXME: return true when done
+ return false;
+}
+
void RIFXArchive::readCast(Common::SeekableSubReadStreamEndian &casStream) {
uint castTag = MKTAG('C', 'A', 'S', 't');
diff --git a/engines/director/archive.h b/engines/director/archive.h
index 2542b0c720..dd44a44e00 100644
--- a/engines/director/archive.h
+++ b/engines/director/archive.h
@@ -37,6 +37,8 @@ struct Resource {
uint32 index;
uint32 offset;
uint32 size;
+ uint32 uncompSize;
+ uint32 compressionType;
uint32 castId;
uint32 tag;
Common::String name;
@@ -123,6 +125,7 @@ public:
private:
bool readMemoryMap(Common::SeekableSubReadStreamEndian &stream, uint32 moreOffset);
+ bool readAfterburnerMap(Common::SeekableSubReadStreamEndian &stream, uint32 moreOffset);
void readCast(Common::SeekableSubReadStreamEndian &casStream);
void readKeyTable(Common::SeekableSubReadStreamEndian &keyStream);
More information about the Scummvm-git-logs
mailing list