[Scummvm-cvs-logs] SF.net SVN: scummvm: [23565] scummvm/trunk/engines/scumm

lordhoto at users.sourceforge.net lordhoto at users.sourceforge.net
Sat Jul 22 18:19:05 CEST 2006


Revision: 23565
Author:   lordhoto
Date:     2006-07-22 09:19:00 -0700 (Sat, 22 Jul 2006)
ViewCVS:  http://svn.sourceforge.net/scummvm/?rev=23565&view=rev

Log Message:
-----------
Hardcoding header size of the Thumbnail and of the Info section of scumm games.
(because packed struct handling changed and gcc seems not to be happy with it)
This should unbreak new save games made after this commit.

Modified Paths:
--------------
    scummvm/trunk/engines/scumm/saveload.cpp
    scummvm/trunk/engines/scumm/thumbnail.cpp
Modified: scummvm/trunk/engines/scumm/saveload.cpp
===================================================================
--- scummvm/trunk/engines/scumm/saveload.cpp	2006-07-22 16:09:34 UTC (rev 23564)
+++ scummvm/trunk/engines/scumm/saveload.cpp	2006-07-22 16:19:00 UTC (rev 23565)
@@ -69,6 +69,8 @@
 	uint16 time;
 };
 
+#define SaveInfoSectionSize (4+4+4 + 4+4 + 4+2)
+
 #if defined(END_PACK_STRUCTS)
 #pragma END_PACK_STRUCTS
 #endif
@@ -519,7 +521,7 @@
 	section.size = file->readUint32BE();
 
 	// if we extend this we should add a table for the special sizes at the versions to check it
-	if (section.version == INFOSECTION_VERSION && section.size != sizeof(SaveInfoSection)) {
+	if (section.version == INFOSECTION_VERSION && section.size != SaveInfoSectionSize) {
 		warning("Info section is corrupt");
 		file->skip(section.size);
 		return false;
@@ -549,8 +551,8 @@
 
 	// skip all newer features, this could make problems if some older version uses more space for
 	// saving informations, but this should NOT happen
-	if (section.size > sizeof(SaveInfoSection)) {
-		file->skip(section.size - sizeof(SaveInfoSection));
+	if (section.size > SaveInfoSectionSize) {
+		file->skip(section.size - SaveInfoSectionSize);
 	}
 
 	return true;
@@ -560,7 +562,7 @@
 	SaveInfoSection section;
 	section.type = MKID_BE('INFO');
 	section.version = INFOSECTION_VERSION;
-	section.size = sizeof(SaveInfoSection);
+	section.size = SaveInfoSectionSize;
 
 	// still save old format for older versions
 	section.timeTValue = time(0);

Modified: scummvm/trunk/engines/scumm/thumbnail.cpp
===================================================================
--- scummvm/trunk/engines/scumm/thumbnail.cpp	2006-07-22 16:09:34 UTC (rev 23564)
+++ scummvm/trunk/engines/scumm/thumbnail.cpp	2006-07-22 16:19:00 UTC (rev 23565)
@@ -43,6 +43,8 @@
 	byte bpp;
 };
 
+#define ThumbnailHeaderSize (4+4+1+2+2+1)
+
 #if defined(END_PACK_STRUCTS)
 #pragma END_PACK_STRUCTS
 #endif
@@ -111,13 +113,7 @@
 
 	ThumbnailHeader header;
 	header.type = MKID_BE('THMB');
-#if defined(PALMOS_ARM) || defined(__GP32__)
-	// sizeof(header) is hardcoded here, because the compiler add padding to
-	// have a 4byte aligned struct and there is no easy way to pack it.
-	header.size = 14 + thumb.w*thumb.h*thumb.bytesPerPixel;
-#else
-	header.size = sizeof(header) + thumb.w*thumb.h*thumb.bytesPerPixel;
-#endif
+	header.size = ThumbnailHeaderSize + thumb.w*thumb.h*thumb.bytesPerPixel;
 	header.version = THMB_VERSION;
 	header.width = thumb.w;
 	header.height = thumb.h;


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