[Scummvm-cvs-logs] SF.net SVN: scummvm: [32515] tools/trunk

lordhoto at users.sourceforge.net lordhoto at users.sourceforge.net
Tue Jun 3 19:36:45 CEST 2008


Revision: 32515
          http://scummvm.svn.sourceforge.net/scummvm/?rev=32515&view=rev
Author:   lordhoto
Date:     2008-06-03 10:36:45 -0700 (Tue, 03 Jun 2008)

Log Message:
-----------
Added magic number to the PAK file link extension file.

Modified Paths:
--------------
    tools/trunk/kyra_pak.cpp
    tools/trunk/util.h

Modified: tools/trunk/kyra_pak.cpp
===================================================================
--- tools/trunk/kyra_pak.cpp	2008-06-03 17:14:14 UTC (rev 32514)
+++ tools/trunk/kyra_pak.cpp	2008-06-03 17:36:45 UTC (rev 32515)
@@ -235,6 +235,7 @@
 		linkList[usedLinks++] = entry->linksTo;
 	}
 
+	writeUint32BE(output, MKID_BE('SCVM'));
 	writeUint32BE(output, usedLinks);
 	for (int i = 0; i < usedLinks; ++i) {
 		int count = 0;
@@ -277,6 +278,9 @@
 		const FileList *entry = _fileList->findEntry("LINKLIST");
 		const uint8 *src = entry->data;
 
+		uint32 magic = READ_BE_UINT32(src); src += 4;
+		if (magic != MKID_BE('SCVM'))
+			error("LINKLIST file does not contain 'SCVM' header");
 		uint32 links = READ_BE_UINT32(src); src += 4;
 		for (uint i = 0; i < links; ++i) {
 			const char *linksTo = (const char *)src;

Modified: tools/trunk/util.h
===================================================================
--- tools/trunk/util.h	2008-06-03 17:14:14 UTC (rev 32514)
+++ tools/trunk/util.h	2008-06-03 17:36:45 UTC (rev 32515)
@@ -106,6 +106,17 @@
 
 #define ARRAYSIZE(x) ((int)(sizeof(x) / sizeof(x[0])))
 
+#if defined(INVERSE_MKID)
+#define MKID_BE(a) ((uint32) \
+		(((a) >> 24) & 0x000000FF) | \
+		(((a) >>  8) & 0x0000FF00) | \
+		(((a) <<  8) & 0x00FF0000) | \
+		(((a) << 24) & 0xFF000000))
+
+#else
+#  define MKID_BE(a) ((uint32)(a))
+#endif
+
 static inline uint32 SWAP_32(uint32 a) {
 	return ((a >> 24) & 0xFF) | ((a >> 8) & 0xFF00) | ((a << 8) & 0xFF0000) |
 		((a << 24) & 0xFF000000);


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