[Scummvm-cvs-logs] scummvm master -> 2c9fdf0df754176a375d5079c7e8578c6701630a

bluegr md5 at scummvm.org
Sun Aug 7 13:25:33 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:
2c9fdf0df7 TINSEL: Fixed deleting saved games from the launcher (bug #3387551)


Commit: 2c9fdf0df754176a375d5079c7e8578c6701630a
    https://github.com/scummvm/scummvm/commit/2c9fdf0df754176a375d5079c7e8578c6701630a
Author: Filippos Karapetis (md5 at scummvm.org)
Date: 2011-08-07T04:21:28-07:00

Commit Message:
TINSEL: Fixed deleting saved games from the launcher (bug #3387551)

Changed paths:
    NEWS
    engines/tinsel/detection.cpp
    engines/tinsel/saveload.cpp



diff --git a/NEWS b/NEWS
index db5fe6f..537a9cf 100644
--- a/NEWS
+++ b/NEWS
@@ -17,6 +17,10 @@ For a more comprehensive changelog of the latest experimental code, see:
  SDL ports:
    - Added support for OpenGL (GSoC Task).
 
+ TINSEL:
+   - Fixed deleting saved games from the list of saved games (from the launcher
+     and the in-game ScummVM menu)
+
 1.3.1 (2011-07-12)
  General:
    - Improved audio device detection and fallback.
diff --git a/engines/tinsel/detection.cpp b/engines/tinsel/detection.cpp
index 9c52305..1fce032 100644
--- a/engines/tinsel/detection.cpp
+++ b/engines/tinsel/detection.cpp
@@ -322,9 +322,21 @@ int TinselMetaEngine::getMaximumSaveSlot() const { return 99; }
 
 void TinselMetaEngine::removeSaveState(const char *target, int slot) const {
 	Tinsel::setNeedLoad();
-	Tinsel::getList(g_system->getSavefileManager(), target);
+	// Same issue here as with loadGameState(): we need the physical savegame
+	// slot. Refer to bug #3387551.
+	int listSlot = -1;
+	const int numStates = Tinsel::getList(g_system->getSavefileManager(), target);
+	for (int i = 0; i < numStates; ++i) {
+		const char *fileName = Tinsel::ListEntry(i, Tinsel::LE_NAME);
+		const int saveSlot = atoi(fileName + strlen(fileName) - 3);
+
+		if (saveSlot == slot) {
+			listSlot = i;
+			break;
+		}
+	}
 
-	g_system->getSavefileManager()->removeSavefile(Tinsel::ListEntry(slot, Tinsel::LE_NAME));
+	g_system->getSavefileManager()->removeSavefile(Tinsel::ListEntry(listSlot, Tinsel::LE_NAME));
 	Tinsel::setNeedLoad();
 	Tinsel::getList(g_system->getSavefileManager(), target);
 }
diff --git a/engines/tinsel/saveload.cpp b/engines/tinsel/saveload.cpp
index 7a973ba..983259d 100644
--- a/engines/tinsel/saveload.cpp
+++ b/engines/tinsel/saveload.cpp
@@ -155,7 +155,15 @@ static bool syncSaveGameHeader(Common::Serializer &s, SaveGameHeader &hdr) {
 
 	int tmp = hdr.size - s.bytesSynced();
 	// Perform sanity check
-	if (tmp < 0 || hdr.id != SAVEGAME_ID || hdr.ver > CURRENT_VER || hdr.size > 1024)
+	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)
 		return false;
 	// Skip over any extra bytes
 	s.skip(tmp);






More information about the Scummvm-git-logs mailing list