[Scummvm-cvs-logs] scummvm master -> ae5192c5d396b6ab3caf57adabeb03a832966dd3

athrxx athrxx at scummvm.org
Thu Nov 24 21:32:22 CET 2011


This automated email contains information about 1 new commit which have been
pushed to the 'scummvm' repo located at https://github.com/scummvm/scummvm .

Summary:
ae5192c5d3 SCUMM: make FM-Towns save files compatible between DS and other platforms


Commit: ae5192c5d396b6ab3caf57adabeb03a832966dd3
    https://github.com/scummvm/scummvm/commit/ae5192c5d396b6ab3caf57adabeb03a832966dd3
Author: athrxx (athrxx at scummvm.org)
Date: 2011-11-24T12:29:14-08:00

Commit Message:
SCUMM: make FM-Towns save files compatible between DS and other platforms

(only applies to new save files)

Changed paths:
    engines/scumm/saveload.cpp
    engines/scumm/saveload.h



diff --git a/engines/scumm/saveload.cpp b/engines/scumm/saveload.cpp
index 2f9f4c1..572e460 100644
--- a/engines/scumm/saveload.cpp
+++ b/engines/scumm/saveload.cpp
@@ -1286,17 +1286,35 @@ void ScummEngine::saveOrLoad(Serializer *s) {
 
 	//
 	// Save/load palette data
-	//
-	if (_16BitPalette && !(_game.platform == Common::kPlatformFMTowns && s->isLoading() && s->getVersion() < VER(82))) {
+	// Don't save 16 bit palette in FM-Towns and PCE games, since it gets regenerated afterwards anyway.
+	if (_16BitPalette && !(_game.platform == Common::kPlatformFMTowns && s->getVersion() < VER(82)) && !((_game.platform == Common::kPlatformFMTowns || _game.platform == Common::kPlatformPCEngine) && s->getVersion() > VER(87))) {
 		s->saveLoadArrayOf(_16BitPalette, 512, sizeof(_16BitPalette[0]), sleUint16);
 	}
 
-#ifndef DISABLE_TOWNS_DUAL_LAYER_MODE
+	
 	// FM-Towns specific (extra palette data, color cycle data, etc.)
 	// In earlier save game versions (below 87) the FM-Towns specific data would get saved (and loaded) even in non FM-Towns games.
 	// This would cause an unnecessary save file incompatibility between DS (which uses the DISABLE_TOWNS_DUAL_LAYER_MODE setting)
 	// and other ports.
-	if ((_game.platform == Common::kPlatformFMTowns && s->getVersion() >= VER(87)) || (s->getVersion() >= VER(82) && s->getVersion() < VER(87))) {
+	// In version 88 and later the save files from FM-Towns targets are compatible between DS and other platforms, too.
+
+#ifdef DISABLE_TOWNS_DUAL_LAYER_MODE
+	byte hasTownsData = 0;
+	if (_game.platform == Common::kPlatformFMTowns && s->getVersion() > VER(87))
+		s->saveLoadArrayOf(&hasTownsData, 1, sizeof(byte), sleByte);
+
+	if (hasTownsData) {
+		// Skip FM-Towns specific data
+		for (int i = 69 * sizeof(uint8) + 11 * sizeof(Common::Rect); i; i--)
+			s->loadByte();
+	}
+
+#else
+	byte hasTownsData = ((_game.platform == Common::kPlatformFMTowns && s->getVersion() >= VER(87)) || (s->getVersion() >= VER(82) && s->getVersion() < VER(87))) ? 1 : 0;
+	if (_game.platform == Common::kPlatformFMTowns && s->getVersion() > VER(87))
+		s->saveLoadArrayOf(&hasTownsData, 1, sizeof(byte), sleByte);
+
+	if (hasTownsData) {
 		const SaveLoadEntry townsFields[] = {
 			MKLINE(Common::Rect, left, sleInt16, VER(82)),
 			MKLINE(Common::Rect, top, sleInt16, VER(82)),
@@ -1319,6 +1337,8 @@ void ScummEngine::saveOrLoad(Serializer *s) {
 		s->saveLoadArrayOf(&_curStringRect, 1, sizeof(_curStringRect), townsFields);
 		s->saveLoadArrayOf(_townsCharsetColorMap, 16, sizeof(_townsCharsetColorMap[0]), sleUint8);
 		s->saveLoadEntries(this, townsExtraEntries);
+	} else if (_game.platform == Common::kPlatformFMTowns && s->getVersion() >= VER(82)) {
+		warning("Save file is missing FM-Towns specific graphic data (game was apparently saved on another platform)");
 	}
 #endif
 
diff --git a/engines/scumm/saveload.h b/engines/scumm/saveload.h
index d55ec2d..064bdf1 100644
--- a/engines/scumm/saveload.h
+++ b/engines/scumm/saveload.h
@@ -47,7 +47,7 @@ namespace Scumm {
  * only saves/loads those which are valid for the version of the savegame
  * which is being loaded/saved currently.
  */
-#define CURRENT_VER 87
+#define CURRENT_VER 88
 
 /**
  * An auxillary macro, used to specify savegame versions. We use this instead






More information about the Scummvm-git-logs mailing list