aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--engines/composer/composer.cpp14
1 files changed, 10 insertions, 4 deletions
diff --git a/engines/composer/composer.cpp b/engines/composer/composer.cpp
index cde2e0bb0a..936f1ff595 100644
--- a/engines/composer/composer.cpp
+++ b/engines/composer/composer.cpp
@@ -226,11 +226,16 @@ Common::SeekableReadStream *Pipe::getResource(uint32 tag, uint16 id, bool buffer
const PipeResource &res = resMap[id];
- if (!buffering) {
- assert(res.entries.size() == 1);
- return new Common::SeekableSubReadStream(_stream, res.entries[0].offset, res.entries[0].offset + res.entries[0].size);
+ if (res.entries.size() == 1) {
+ Common::SeekableReadStream *stream = new Common::SeekableSubReadStream(_stream,
+ res.entries[0].offset, res.entries[0].offset + res.entries[0].size);
+ if (buffering)
+ _types[tag].erase(id);
+ return stream;
}
+ // If there are multiple entries in the pipe, we have to concaternate them together.
+
uint32 size = 0;
for (uint i = 0; i < res.entries.size(); i++)
size += res.entries[i].size;
@@ -242,7 +247,8 @@ Common::SeekableReadStream *Pipe::getResource(uint32 tag, uint16 id, bool buffer
_stream->read(buffer + offset, res.entries[i].size);
offset += res.entries[i].size;
}
- _types[tag].erase(id);
+ if (buffering)
+ _types[tag].erase(id);
return new Common::MemoryReadStream(buffer, size, DisposeAfterUse::YES);
}