aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--engines/agi/agi.h2
-rw-r--r--engines/agi/detection.cpp3
-rw-r--r--engines/agi/saveload.cpp17
-rw-r--r--engines/agi/systemui.cpp6
4 files changed, 20 insertions, 8 deletions
diff --git a/engines/agi/agi.h b/engines/agi/agi.h
index bcd47c9f08..627b18e753 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 6fca86db63..7d5243e023 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 f59fbacc7d..e22b127021 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 72017a16bb..f618459823 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();