aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTorbjörn Andersson2006-05-21 20:08:14 +0000
committerTorbjörn Andersson2006-05-21 20:08:14 +0000
commit71ba5c0f584c80f6018c4f1696cd3dfe505fbc30 (patch)
tree4eaf7973849cdd2af2d2ae0b1c206ed36f74ed1d
parentbda33949e4881cb7a4733dcb7b4c629918bb3382 (diff)
downloadscummvm-rg350-71ba5c0f584c80f6018c4f1696cd3dfe505fbc30.tar.gz
scummvm-rg350-71ba5c0f584c80f6018c4f1696cd3dfe505fbc30.tar.bz2
scummvm-rg350-71ba5c0f584c80f6018c4f1696cd3dfe505fbc30.zip
Grotesque hack to support the jung2.vqa movie. Either the VQA is less well
understood than I hoped, or the offset to the first frame of the movie is completely out to lunch. Scan the file for the first VQFR chunk and use that offset instead. svn-id: r22565
-rw-r--r--engines/kyra/vqa.cpp36
1 files changed, 34 insertions, 2 deletions
diff --git a/engines/kyra/vqa.cpp b/engines/kyra/vqa.cpp
index f1f9989330..c10a28f930 100644
--- a/engines/kyra/vqa.cpp
+++ b/engines/kyra/vqa.cpp
@@ -26,8 +26,7 @@
// The benchl.vqa movie (or whatever it is) is not supported. It does not have
// a FINF chunk.
//
-// The jung2.vqa movie does not work. The offset to the first frame is strange,
-// so we don't find the palette.
+// The jung2.vqa movie does work, but only thanks to a grotesque hack.
#include "common/stdafx.h"
#include "common/system.h"
@@ -367,6 +366,39 @@ void VQAMovie::open(const char *filename) {
for (int i = 0; i < _header.numFrames; i++) {
_frameInfo[i] = 2 * _file.readUint32LE();
}
+
+ // HACK: This flag is set in jung2.vqa, and its
+ // purpose, if it has one, is unknown. It can't be a
+ // general purpose flag, because in large movies the
+ // frame offsets can be large enough to set this flag.
+ //
+ // At least in my copy of Kyrandia 3, _frameInfo[0] is
+ // 0x81000098, and the desired index is 0x4716. So the
+ // value should be 0x80004716, but I don't want to
+ // hard-code it. Instead, scan the file for the offset
+ // to the first VQFR chunk.
+
+ if (_frameInfo[0] & 0x01000000) {
+ uint32 oldPos = _file.pos();
+
+ while (1) {
+ uint32 scanTag = readTag();
+ uint32 scanSize = _file.readUint32BE();
+
+ if (_file.eof())
+ break;
+
+ if (scanTag == MKID_BE('VQFR')) {
+ _frameInfo[0] = (_file.pos() - 8) | 0x80000000;
+ break;
+ }
+
+ _file.seek(scanSize, SEEK_CUR);
+ }
+
+ _file.seek(oldPos);
+ }
+
break;
default: