[Scummvm-cvs-logs] SF.net SVN: scummvm:[35582] scummvm/trunk/graphics/dither.cpp

drmccoy at users.sourceforge.net drmccoy at users.sourceforge.net
Sat Dec 27 20:53:54 CET 2008


Revision: 35582
          http://scummvm.svn.sourceforge.net/scummvm/?rev=35582&view=rev
Author:   drmccoy
Date:     2008-12-27 19:53:54 +0000 (Sat, 27 Dec 2008)

Log Message:
-----------
Adding a magic id and a version number to the PaletteLUT cache

Modified Paths:
--------------
    scummvm/trunk/graphics/dither.cpp

Modified: scummvm/trunk/graphics/dither.cpp
===================================================================
--- scummvm/trunk/graphics/dither.cpp	2008-12-27 19:37:49 UTC (rev 35581)
+++ scummvm/trunk/graphics/dither.cpp	2008-12-27 19:53:54 UTC (rev 35582)
@@ -22,6 +22,7 @@
  * $Id$
  */
 
+#include "common/endian.h"
 #include "graphics/dither.h"
 
 namespace Graphics {
@@ -163,6 +164,8 @@
 	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::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)


This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.




More information about the Scummvm-git-logs mailing list