diff options
author | Eugene Sandulenko | 2016-10-27 16:47:20 +0200 |
---|---|---|
committer | Eugene Sandulenko | 2016-10-27 16:48:21 +0200 |
commit | 09d41af771edbb942eea78dcc89ab86c3d05abca (patch) | |
tree | 869acfadf4cd535a5e8acba0fcea25aa4e83f25e /engines/director | |
parent | ba9eeded271cba1ae68d39e6bb7d81a32c51f73c (diff) | |
download | scummvm-rg350-09d41af771edbb942eea78dcc89ab86c3d05abca.tar.gz scummvm-rg350-09d41af771edbb942eea78dcc89ab86c3d05abca.tar.bz2 scummvm-rg350-09d41af771edbb942eea78dcc89ab86c3d05abca.zip |
DIRECTOR: Fix RIFX resource loading
Diffstat (limited to 'engines/director')
-rw-r--r-- | engines/director/archive.cpp | 18 | ||||
-rw-r--r-- | engines/director/archive.h | 1 | ||||
-rw-r--r-- | engines/director/score.cpp | 5 |
3 files changed, 19 insertions, 5 deletions
diff --git a/engines/director/archive.cpp b/engines/director/archive.cpp index a96ffa908c..9122572a95 100644 --- a/engines/director/archive.cpp +++ b/engines/director/archive.cpp @@ -447,4 +447,22 @@ bool RIFXArchive::openStream(Common::SeekableReadStream *stream, uint32 startOff return true; } +Common::SeekableSubReadStreamEndian *RIFXArchive::getResource(uint32 tag, uint16 id) { + if (!_types.contains(tag)) + error("Archive does not contain '%s' %04x", tag2str(tag), id); + + const ResourceMap &resMap = _types[tag]; + + if (!resMap.contains(id)) + error("Archive does not contain '%s' %04x", tag2str(tag), id); + + const Resource &res = resMap[id]; + + uint32 offset = res.offset + 8; + uint32 size = res.size; + + return new Common::SeekableSubReadStreamEndian(_stream, offset, offset + size, true, DisposeAfterUse::NO); +} + + } // End of namespace Director diff --git a/engines/director/archive.h b/engines/director/archive.h index 54d7086326..93f4ce7ee9 100644 --- a/engines/director/archive.h +++ b/engines/director/archive.h @@ -102,6 +102,7 @@ public: ~RIFXArchive() {} bool openStream(Common::SeekableReadStream *stream, uint32 startOffset = 0); + Common::SeekableSubReadStreamEndian *getResource(uint32 tag, uint16 id); }; } // End of namespace Director diff --git a/engines/director/score.cpp b/engines/director/score.cpp index 1345f4b912..7b03ca1a7d 100644 --- a/engines/director/score.cpp +++ b/engines/director/score.cpp @@ -365,11 +365,6 @@ void Score::loadCastData(Common::SeekableSubReadStreamEndian &stream) { } void Score::loadLabels(Common::SeekableSubReadStreamEndian &stream) { - if (_vm->getVersion() >= 4) { // HACK: Skip the header. Why it is there? - stream.readUint32LE(); - stream.readUint32LE(); - } - _labels = new Common::SortedArray<Label *>(compareLabels); uint16 count = stream.readUint16() + 1; uint16 offset = count * 4 + 2; |