[Scummvm-cvs-logs] scummvm master -> 5ce622c1b65917b194e6118c9fa247c2a8d4b54e

dreammaster dreammaster at scummvm.org
Sat Feb 11 11:46:18 CET 2012


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:
5ce622c1b6 TINSEL: Added extra fields to the savegame header for SCN/GRA usage and language


Commit: 5ce622c1b65917b194e6118c9fa247c2a8d4b54e
    https://github.com/scummvm/scummvm/commit/5ce622c1b65917b194e6118c9fa247c2a8d4b54e
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2012-02-11T02:45:16-08:00

Commit Message:
TINSEL: Added extra fields to the savegame header for SCN/GRA usage and language

New savegames that are created will no longer appear in the savegame list for different data versions or languages.

Changed paths:
    engines/tinsel/saveload.cpp



diff --git a/engines/tinsel/saveload.cpp b/engines/tinsel/saveload.cpp
index 8664cd5..f8598c0 100644
--- a/engines/tinsel/saveload.cpp
+++ b/engines/tinsel/saveload.cpp
@@ -22,6 +22,7 @@
  */
 
 #include "tinsel/actors.h"
+#include "tinsel/config.h"
 #include "tinsel/dialogs.h"
 #include "tinsel/drives.h"
 #include "tinsel/dw.h"
@@ -94,12 +95,14 @@ struct SaveGameHeader {
 	uint32 ver;
 	char desc[SG_DESC_LEN];
 	TimeDate dateTime;
+	bool scnFlag;
+	byte language;
 };
 
 enum {
 	DW1_SAVEGAME_ID = 0x44575399,	// = 'DWSc' = "DiscWorld 1 ScummVM"
 	DW2_SAVEGAME_ID = 0x44573253,	// = 'DW2S' = "DiscWorld 2 ScummVM"
-	SAVEGAME_HEADER_SIZE = 4 + 4 + 4 + SG_DESC_LEN + 7
+	SAVEGAME_HEADER_SIZE = 4 + 4 + 4 + SG_DESC_LEN + 7 + 1 + 1
 };
 
 #define SAVEGAME_ID (TinselV2 ? (uint32)DW2_SAVEGAME_ID : (uint32)DW1_SAVEGAME_ID)
@@ -166,6 +169,21 @@ static bool syncSaveGameHeader(Common::Serializer &s, SaveGameHeader &hdr) {
 	// Perform sanity check
 	if (tmp < 0 || !correctID || hdr.ver > CURRENT_VER || hdr.size > 1024)
 		return false;
+
+	if (tmp > 0) {
+		// If there's header space left, handling syncing the Scn flag and game language
+		s.syncAsByte(hdr.scnFlag);
+		s.syncAsByte(hdr.language);
+		tmp -= 2;
+
+		if (_vm && s.isLoading()) {
+			// If the engine is loaded, ensure the Scn/Gra usage is correct, and it's the correct language
+			if ((hdr.scnFlag != ((_vm->getFeatures() & GF_SCNFILES) != 0)) ||
+					(hdr.language != _vm->_config->_language))
+				return false;
+		}
+	}
+
 	// Skip over any extra bytes
 	s.skip(tmp);
 	return true;
@@ -547,6 +565,9 @@ static void DoSave() {
 	memcpy(hdr.desc, SaveSceneDesc, SG_DESC_LEN);
 	hdr.desc[SG_DESC_LEN - 1] = 0;
 	g_system->getTimeAndDate(hdr.dateTime);
+	hdr.scnFlag = _vm->getFeatures() & GF_SCNFILES;
+	hdr.language = _vm->_config->_language;
+
 	if (!syncSaveGameHeader(s, hdr) || f->err()) {
 		SaveFailure(f);
 		return;






More information about the Scummvm-git-logs mailing list