diff options
author | Alyssa Milburn | 2011-07-16 00:56:18 +0200 |
---|---|---|
committer | Alyssa Milburn | 2011-07-16 00:56:18 +0200 |
commit | acfd13633d97a121fe5581544feba692aa81b5a8 (patch) | |
tree | 3404ce286eec8cdc5a1c602953255bef274f1c59 | |
parent | 97d7767e895955673d4ad756f741e46c40e76b51 (diff) | |
download | scummvm-rg350-acfd13633d97a121fe5581544feba692aa81b5a8.tar.gz scummvm-rg350-acfd13633d97a121fe5581544feba692aa81b5a8.tar.bz2 scummvm-rg350-acfd13633d97a121fe5581544feba692aa81b5a8.zip |
COMPOSER: Always handle multiple resource entries in pipes.
-rw-r--r-- | engines/composer/composer.cpp | 14 |
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); } |