[Scummvm-cvs-logs] SF.net SVN: scummvm:[41245] scummvm/trunk/engines/agi
sev at users.sourceforge.net
sev at users.sourceforge.net
Sat Jun 6 19:41:50 CEST 2009
Revision: 41245
http://scummvm.svn.sourceforge.net/scummvm/?rev=41245&view=rev
Author: sev
Date: 2009-06-06 17:41:50 +0000 (Sat, 06 Jun 2009)
Log Message:
-----------
Store and compare MD5s in the saves
Modified Paths:
--------------
scummvm/trunk/engines/agi/agi.h
scummvm/trunk/engines/agi/detection.cpp
scummvm/trunk/engines/agi/saveload.cpp
Modified: scummvm/trunk/engines/agi/agi.h
===================================================================
--- scummvm/trunk/engines/agi/agi.h 2009-06-06 17:41:29 UTC (rev 41244)
+++ scummvm/trunk/engines/agi/agi.h 2009-06-06 17:41:50 UTC (rev 41245)
@@ -754,6 +754,8 @@
uint16 getGameType() const;
Common::Language getLanguage() const;
Common::Platform getPlatform() const;
+ const char *getGameMD5() const;
+
Common::Error loadGameState(int slot);
Common::Error saveGameState(int slot, const char *desc);
bool canLoadGameStateCurrently();
Modified: scummvm/trunk/engines/agi/detection.cpp
===================================================================
--- scummvm/trunk/engines/agi/detection.cpp 2009-06-06 17:41:29 UTC (rev 41244)
+++ scummvm/trunk/engines/agi/detection.cpp 2009-06-06 17:41:50 UTC (rev 41245)
@@ -70,8 +70,12 @@
return _gameDescription->gameType;
}
+const char *AgiBase::getGameMD5() const {
+ return _gameDescription->desc.filesDescriptions[0].md5;
}
+}
+
static const PlainGameDescriptor agiGames[] = {
{"agi", "Sierra AGI game"},
{"agi-fanmade", "Fanmade AGI game"},
Modified: scummvm/trunk/engines/agi/saveload.cpp
===================================================================
--- scummvm/trunk/engines/agi/saveload.cpp 2009-06-06 17:41:29 UTC (rev 41244)
+++ scummvm/trunk/engines/agi/saveload.cpp 2009-06-06 17:41:50 UTC (rev 41245)
@@ -39,7 +39,7 @@
#include "agi/keyboard.h"
#include "agi/menu.h"
-#define SAVEGAME_VERSION 4
+#define SAVEGAME_VERSION 5
//
// Version 0 (Sarien): view table has 64 entries
@@ -47,6 +47,7 @@
// Version 2 (ScummVM): first ScummVM version
// Version 3 (ScummVM): added AGIPAL save/load support
// Version 4 (ScummVM): added thumbnails and save creation date/time
+// Version 5 (ScummVM): Added game md5
//
namespace Agi {
@@ -96,6 +97,10 @@
out->write(gameIDstring, 8);
debugC(5, kDebugLevelMain | kDebugLevelSavegame, "Writing game id (%s, %s)", gameIDstring, _game.id);
+ const char *tmp = getGameMD5();
+ for (i = 0; i < 32; i++)
+ out->writeByte(tmp[i]);
+
for (i = 0; i < MAX_FLAGS; i++)
out->writeByte(_game.flags[i]);
for (i = 0; i < MAX_VARS; i++)
@@ -299,6 +304,24 @@
strncpy(_game.id, loadId, 8);
+ if (saveVersion >= 5) {
+ char md5[32 + 1];
+
+ for (i = 0; i < 32; i++) {
+ md5[i] = in->readByte();
+
+ }
+ md5[i] = 0; // terminate
+
+ debug(0, "Saved game MD5: %s", md5);
+
+ if (strcmp(md5, getGameMD5())) {
+ warning("Game was saved with different gamedata - you may encounter problems");
+
+ debug(0, "You have %s and save is %s.", getGameMD5(), md5);
+ }
+ }
+
for (i = 0; i < MAX_FLAGS; i++)
_game.flags[i] = in->readByte();
for (i = 0; i < MAX_VARS; i++)
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