aboutsummaryrefslogtreecommitdiff
path: root/engines
diff options
context:
space:
mode:
authorEugene Sandulenko2016-11-07 19:53:07 +0100
committerEugene Sandulenko2016-11-07 19:53:07 +0100
commitf6f50e6ba0b607bf4c3108dd2feddefed0d8aa6a (patch)
treed693b274796b5d02c3fbc2425ee06047bcd23c67 /engines
parentf6593ce9c0db62d16af051f7ad98128cfe41bd2c (diff)
downloadscummvm-rg350-f6f50e6ba0b607bf4c3108dd2feddefed0d8aa6a.tar.gz
scummvm-rg350-f6f50e6ba0b607bf4c3108dd2feddefed0d8aa6a.tar.bz2
scummvm-rg350-f6f50e6ba0b607bf4c3108dd2feddefed0d8aa6a.zip
DIRECTOR: Fixed CASt resource loading in RIFX archives
Diffstat (limited to 'engines')
-rw-r--r--engines/director/archive.cpp25
1 files changed, 9 insertions, 16 deletions
diff --git a/engines/director/archive.cpp b/engines/director/archive.cpp
index b3e2426c0e..5102b7f71d 100644
--- a/engines/director/archive.cpp
+++ b/engines/director/archive.cpp
@@ -410,17 +410,20 @@ bool RIFXArchive::openStream(Common::SeekableReadStream *stream, uint32 startOff
}
// Parse the CAS*, if present
- Common::Array<uint32> casEntries;
if (casRes) {
Common::SeekableSubReadStreamEndian casStream(stream, casRes->offset + 8, casRes->offset + 8 + casRes->size, _isBigEndian, DisposeAfterUse::NO);
- casEntries.resize(casRes->size / 4);
- debugCN(2, kDebugLoading, "CAS*: %d [", casEntries.size());
+ uint casSize = casRes->size / 4;
- for (uint32 i = 0; i < casEntries.size(); i++) {
- casEntries[i] = casStream.readUint32();
+ debugCN(2, kDebugLoading, "CAS*: %d [", casSize);
- debugCN(2, kDebugLoading, "%d ", casEntries[i]);
+ for (uint i = 0; i < casSize; i++) {
+ uint32 index = casStream.readUint32();
+
+ const Resource &res = resources[index];
+ _types[MKTAG('C', 'A', 'S', 't')][index] = res;
+
+ debugCN(2, kDebugLoading, "%d ", index);
}
debugC(2, kDebugLoading, "]");
}
@@ -441,16 +444,6 @@ bool RIFXArchive::openStream(Common::SeekableReadStream *stream, uint32 startOff
debugC(2, kDebugLoading, "KEY*: index: %d id: %d resTag: %s", index, id, tag2str(resTag));
- // Handle CAS*/CASt nonsense
- if (resTag == MKTAG('C', 'A', 'S', 't')) {
- for (uint32 j = 0; j < casEntries.size(); j++) {
- if (casEntries[j] == index) {
- id += j + 1;
- break;
- }
- }
- }
-
const Resource &res = resources[index];
debug(3, "Found RIFX resource: '%s' 0x%04x, %d @ 0x%08x (%d)", tag2str(resTag), id, res.size, res.offset, res.offset);
_types[resTag][id] = res;