[Scummvm-cvs-logs] scummvm master -> 5974fcd0c1cac3f57700a9efcd7899e8f89ef3e5

bluegr md5 at scummvm.org
Sun Aug 7 14:14:02 CEST 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:
5974fcd0c1 TINSEL: Use SAVEGAME_ID when getting savegame info, if a VM is instantiated


Commit: 5974fcd0c1cac3f57700a9efcd7899e8f89ef3e5
    https://github.com/scummvm/scummvm/commit/5974fcd0c1cac3f57700a9efcd7899e8f89ef3e5
Author: Filippos Karapetis (md5 at scummvm.org)
Date: 2011-08-07T05:10:17-07:00

Commit Message:
TINSEL: Use SAVEGAME_ID when getting savegame info, if a VM is instantiated

Changed paths:
    engines/tinsel/saveload.cpp



diff --git a/engines/tinsel/saveload.cpp b/engines/tinsel/saveload.cpp
index 983259d..4ac172b 100644
--- a/engines/tinsel/saveload.cpp
+++ b/engines/tinsel/saveload.cpp
@@ -154,16 +154,15 @@ static bool syncSaveGameHeader(Common::Serializer &s, SaveGameHeader &hdr) {
 	syncTime(s, hdr.dateTime);
 
 	int tmp = hdr.size - s.bytesSynced();
+
+	// NOTE: We can't use SAVEGAME_ID here when attempting to remove a saved game from the launcher,
+	// as there is no TinselEngine initialized then. This means that we can't check if this is a DW1
+	// or DW2 savegame in this case, but it doesn't really matter, as the saved game is about to be
+	// deleted anyway. Refer to bug #3387551.
+	bool correctID = _vm ? (hdr.id == SAVEGAME_ID) : (hdr.id == DW1_SAVEGAME_ID || hdr.id == DW2_SAVEGAME_ID);
+
 	// Perform sanity check
-	if (tmp < 0 ||
-		// NOTE: We can't use SAVEGAME_ID here, as this function is called by the launcher
-		// when deleting saved games. SAVEGAME_ID calls TinselEngine::getVersion(), and
-		// TinselEngine isn't initialized then. Therefore, we use the two DW savegame
-		// IDs instead, which means that this sanity check won't detect badly named DW1/DW2
-		// saved games (i.e. a DW2 saved game named "dw.xxx"). Refer to bug #3387551.
-		/*hdr.id != SAVEGAME_ID ||*/ 
-		(hdr.id != DW1_SAVEGAME_ID && hdr.id != DW2_SAVEGAME_ID) ||
-		hdr.ver > CURRENT_VER || hdr.size > 1024)
+	if (tmp < 0 || !correctID || hdr.ver > CURRENT_VER || hdr.size > 1024)
 		return false;
 	// Skip over any extra bytes
 	s.skip(tmp);






More information about the Scummvm-git-logs mailing list