aboutsummaryrefslogtreecommitdiff
path: root/engines/cine/unpack.cpp
diff options
context:
space:
mode:
authorKari Salminen2008-08-19 11:55:20 +0000
committerKari Salminen2008-08-19 11:55:20 +0000
commit97463309ba623606850b5d3b0baf7c9bdf9b6fba (patch)
tree1ed7e92ec9cbce2488cd5a843e8b8bf1653b0ac3 /engines/cine/unpack.cpp
parente61aec4ca75e28af1c60fe1548b1669b5d7b8d76 (diff)
downloadscummvm-rg350-97463309ba623606850b5d3b0baf7c9bdf9b6fba.tar.gz
scummvm-rg350-97463309ba623606850b5d3b0baf7c9bdf9b6fba.tar.bz2
scummvm-rg350-97463309ba623606850b5d3b0baf7c9bdf9b6fba.zip
Fix for bug #2057637: FW: Spaceship glitches in demo (regression).
This was caused by assuming in-place decompression is ok, it wasn't, although AFAIK the original did decompression in-place too. Changed unpacking to be done not in-place and the glitch vanished. Also changed the unpacker to also handle uncompressed input data. svn-id: r34034
Diffstat (limited to 'engines/cine/unpack.cpp')
-rw-r--r--engines/cine/unpack.cpp8
1 files changed, 8 insertions, 0 deletions
diff --git a/engines/cine/unpack.cpp b/engines/cine/unpack.cpp
index 5d85ff6cab..7915fd1cf8 100644
--- a/engines/cine/unpack.cpp
+++ b/engines/cine/unpack.cpp
@@ -100,6 +100,14 @@ bool CineUnpacker::unpack(const byte *src, uint srcLen, byte *dst, uint dstLen)
_dstBegin = dst;
_dstEnd = dst + dstLen;
+ // Handle already unpacked data here
+ if (srcLen == dstLen) {
+ // Source length is same as destination length so the source
+ // data is already unpacked. Let's just copy it then.
+ memcpy(dst, src, srcLen);
+ return true;
+ }
+
// Initialize other variables
_src = _srcBegin + srcLen - 4;
uint32 unpackedLength = readSource(); // Unpacked length in bytes