DIRECTOR: Fix RIFX resource loading

This commit is contained in:
Eugene Sandulenko
2016-10-27 16:48:21 +02:00
parent ba9eeded27
commit 09d41af771
3 changed files with 19 additions and 5 deletions
+18
View File
@@ -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
+1
View File
@@ -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
-5
View File
@@ -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;