diff options
author | Sven Hesse | 2008-12-27 19:53:54 +0000 |
---|---|---|
committer | Sven Hesse | 2008-12-27 19:53:54 +0000 |
commit | 213c09c211d993a6db3dfc158a091484418563db (patch) | |
tree | 2946bc21269a8f75437d9b6c5e7bea133e68ee8e | |
parent | a4a209a2f60a709051b0a6a4b20288569e6f4c97 (diff) | |
download | scummvm-rg350-213c09c211d993a6db3dfc158a091484418563db.tar.gz scummvm-rg350-213c09c211d993a6db3dfc158a091484418563db.tar.bz2 scummvm-rg350-213c09c211d993a6db3dfc158a091484418563db.zip |
Adding a magic id and a version number to the PaletteLUT cache
svn-id: r35582
-rw-r--r-- | graphics/dither.cpp | 15 |
1 files changed, 13 insertions, 2 deletions
diff --git a/graphics/dither.cpp b/graphics/dither.cpp index baeadb72cb..ff58961a17 100644 --- a/graphics/dither.cpp +++ b/graphics/dither.cpp @@ -22,6 +22,7 @@ * $Id$ */ +#include "common/endian.h" #include "graphics/dither.h" namespace Graphics { @@ -163,6 +164,8 @@ bool PaletteLUT::save(Common::WriteStream &stream) { while (_got < _dim1) buildNext(); + stream.writeUint32BE(MKID_BE('PLUT')); // Magic + stream.writeUint32BE(0); // Version stream.writeByte(_depth1); if (stream.write(_realPal, 768) != 768) return false; @@ -180,12 +183,20 @@ bool PaletteLUT::save(Common::WriteStream &stream) { } bool PaletteLUT::load(Common::SeekableReadStream &stream) { - // _realPal + _lutPal + _lut + _depth1 - int32 needSize = 768 + 768 + _dim3 + 1; + // _realPal + _lutPal + _lut + _depth1 + magic + version + int32 needSize = 768 + 768 + _dim3 + 1 + 4 + 4; if ((stream.size() - stream.pos()) < needSize) return false; + // Magic + if (stream.readUint32BE() != MKID_BE('PLUT')) + return false; + + // Version + if (stream.readUint32BE() != 0) + return false; + byte depth1 = stream.readByte(); if (depth1 != _depth1) |