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

m-kiewitz m_kiewitz at users.sourceforge.net
Sat Feb 13 13:41:06 CET 2016


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:
e49658cf81 AGI: Adding seconds of current time to saved games


Commit: e49658cf819815286b4e386889ed55a8143dade6
    https://github.com/scummvm/scummvm/commit/e49658cf819815286b4e386889ed55a8143dade6
Author: Martin Kiewitz (m_kiewitz at users.sourceforge.net)
Date: 2016-02-13T13:40:47+01:00

Commit Message:
AGI: Adding seconds of current time to saved games

Useful to properly detect the most recent saved game
(that's done by the original save/restore dialogs)

Changed paths:
    engines/agi/agi.h
    engines/agi/detection.cpp
    engines/agi/saveload.cpp
    engines/agi/systemui.cpp



diff --git a/engines/agi/agi.h b/engines/agi/agi.h
index bcd47c9..627b18e 100644
--- a/engines/agi/agi.h
+++ b/engines/agi/agi.h
@@ -761,7 +761,7 @@ public:
 
 	SavedGameSlotIdArray getSavegameSlotIds();
 	Common::String getSavegameFilename(int16 slotId) const;
-	bool getSavegameInformation(int16 slotId, Common::String &saveDescription, uint32 &saveDate, uint16 &saveTime, bool &saveIsValid);
+	bool getSavegameInformation(int16 slotId, Common::String &saveDescription, uint32 &saveDate, uint32 &saveTime, bool &saveIsValid);
 
 	int saveGame(const Common::String &fileName, const Common::String &descriptionString);
 	int loadGame(const Common::String &fileName, bool checkId = true);
diff --git a/engines/agi/detection.cpp b/engines/agi/detection.cpp
index 6fca86d..7d5243e 100644
--- a/engines/agi/detection.cpp
+++ b/engines/agi/detection.cpp
@@ -359,6 +359,9 @@ SaveStateDescriptor AgiMetaEngine::querySaveMetaInfos(const char *target, int sl
 
 			uint32 saveDate = in->readUint32BE();
 			uint16 saveTime = in->readUint16BE();
+			if (saveVersion >= 9) {
+				in->readByte(); // skip over seconds of saveTime (not needed here)
+			}
 			if (saveVersion >= 6) {
 				uint32 playTime = in->readUint32BE();
 				descriptor.setPlayTime(playTime * 1000);
diff --git a/engines/agi/saveload.cpp b/engines/agi/saveload.cpp
index f59fbac..e22b127 100644
--- a/engines/agi/saveload.cpp
+++ b/engines/agi/saveload.cpp
@@ -45,7 +45,7 @@
 #include "agi/systemui.h"
 #include "agi/words.h"
 
-#define SAVEGAME_CURRENT_VERSION 8
+#define SAVEGAME_CURRENT_VERSION 9
 
 //
 // Version 0 (Sarien): view table has 64 entries
@@ -62,6 +62,7 @@
 // Version 8 (ScummVM): Added Hold-Key-Mode boolean
 //                       required for at least Mixed Up Mother Goose
 //                       gets set at the start of the game only
+// Version 9 (ScummVM): Added seconds to saved game time stamp
 
 namespace Agi {
 
@@ -109,6 +110,8 @@ int AgiEngine::saveGame(const Common::String &fileName, const Common::String &de
 	debugC(5, kDebugLevelMain | kDebugLevelSavegame, "Writing save date (%d)", saveDate);
 	out->writeUint16BE(saveTime);
 	debugC(5, kDebugLevelMain | kDebugLevelSavegame, "Writing save time (%d)", saveTime);
+	// Version 9+: save seconds of current time as well
+	out->writeByte(curTime.tm_sec & 0xFF);
 	out->writeUint32BE(playTime);
 	debugC(5, kDebugLevelMain | kDebugLevelSavegame, "Writing play time (%d)", playTime);
 
@@ -384,7 +387,10 @@ int AgiEngine::loadGame(const Common::String &fileName, bool checkId) {
 		Graphics::skipThumbnail(*in);
 
 		in->readUint32BE(); // save date
-		in->readUint16BE(); // save time
+		in->readUint16BE(); // save time (hour + minute)
+		if (saveVersion >= 9) {
+			in->readByte(); // save time seconds
+		}
 		if (saveVersion >= 6) {
 			uint32 playTime = in->readUint32BE();
 			inGameTimerReset(playTime * 1000);
@@ -813,7 +819,7 @@ Common::String AgiEngine::getSavegameFilename(int16 slotId) const {
 	return saveLoadSlot;
 }
 
-bool AgiEngine::getSavegameInformation(int16 slotId, Common::String &saveDescription, uint32 &saveDate, uint16 &saveTime, bool &saveIsValid) {
+bool AgiEngine::getSavegameInformation(int16 slotId, Common::String &saveDescription, uint32 &saveDate, uint32 &saveTime, bool &saveIsValid) {
 	Common::InSaveFile *in;
 	Common::String fileName = getSavegameFilename(slotId);
 	char saveGameDescription[31];
@@ -875,7 +881,10 @@ bool AgiEngine::getSavegameInformation(int16 slotId, Common::String &saveDescrip
 			Graphics::skipThumbnail(*in);
 
 			saveDate = in->readUint32BE();
-			saveTime = in->readUint16BE();
+			saveTime = in->readUint16BE() << 8;
+			if (saveVersion >= 9) {
+				saveTime |= in->readByte(); // add seconds (only available since saved game version 9+)
+			}
 
 			// save date is DDMMYYYY, we need a proper format
 			byte saveDateDay = saveDate >> 24;
diff --git a/engines/agi/systemui.cpp b/engines/agi/systemui.cpp
index 72017a1..f618459 100644
--- a/engines/agi/systemui.cpp
+++ b/engines/agi/systemui.cpp
@@ -329,7 +329,7 @@ int16 SystemUI::askForRestoreGameSlot() {
 	int16 restoreGameSlotNr = -1;
 
 	// Fill saved game slot cache
-	readSavedGameSlots(true, true); // filter empty/corrupt slots, but including auto-save slot
+	readSavedGameSlots(true, true); // filter empty/corrupt slots, but include auto-save slot
 
 	if (_savedGameArray.size() == 0) {
 		// no saved games
@@ -528,12 +528,12 @@ void SystemUI::readSavedGameSlots(bool filterNonexistant, bool withAutoSaveSlot)
 	SystemUISavedGameEntry savedGameEntry;
 	Common::String saveDescription;
 	uint32         saveDate = 0;
-	uint16         saveTime = 0;
+	uint32         saveTime = 0;
 	bool           saveIsValid = false;
 
 	int16  mostRecentSlotNr = -1;
 	uint32 mostRecentSlotSaveDate = 0;
-	uint16 mostRecentSlotSaveTime = 0;
+	uint32 mostRecentSlotSaveTime = 0;
 
 	clearSavedGameSlots();
 






More information about the Scummvm-git-logs mailing list