aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMatthew Hoops2011-10-03 18:47:25 -0400
committerMatthew Hoops2011-10-07 11:34:03 -0400
commita064b7bc0b38268b14d52755d8d3747db28240ae (patch)
tree7ac47603c3a95949db4b3fdf7a55ea9943203213
parent5fab8cb521856b74605ba4523a144e270126a6a9 (diff)
downloadscummvm-rg350-a064b7bc0b38268b14d52755d8d3747db28240ae.tar.gz
scummvm-rg350-a064b7bc0b38268b14d52755d8d3747db28240ae.tar.bz2
scummvm-rg350-a064b7bc0b38268b14d52755d8d3747db28240ae.zip
VIDEO: Fix Cinepak variant detection
-rw-r--r--video/codecs/cinepak.cpp8
1 files changed, 6 insertions, 2 deletions
diff --git a/video/codecs/cinepak.cpp b/video/codecs/cinepak.cpp
index c8b23dfc3f..c197e0cc35 100644
--- a/video/codecs/cinepak.cpp
+++ b/video/codecs/cinepak.cpp
@@ -73,7 +73,8 @@ CinepakDecoder::~CinepakDecoder() {
const Graphics::Surface *CinepakDecoder::decodeImage(Common::SeekableReadStream *stream) {
_curFrame.flags = stream->readByte();
- _curFrame.length = (stream->readByte() << 16) + stream->readUint16BE();
+ _curFrame.length = (stream->readByte() << 16);
+ _curFrame.length |= stream->readUint16BE();
_curFrame.width = stream->readUint16BE();
_curFrame.height = stream->readUint16BE();
_curFrame.stripCount = stream->readUint16BE();
@@ -86,8 +87,11 @@ const Graphics::Surface *CinepakDecoder::decodeImage(Common::SeekableReadStream
// Borrowed from FFMPEG. This should cut out the extra data Cinepak for Sega has (which is useless).
// The theory behind this is that this is here to confuse standard Cinepak decoders. But, we won't let that happen! ;)
if (_curFrame.length != (uint32)stream->size()) {
- if (stream->readUint16BE() == 0xFE00)
+ uint16 temp = stream->readUint16BE();
+ if (temp == 0xFE00)
stream->readUint32BE();
+ else if (temp != _curFrame.width)
+ stream->seek(-2, SEEK_CUR);
}
if (!_curFrame.surface) {