diff options
-rw-r--r-- | engines/zvision/detection.cpp | 8 | ||||
-rw-r--r-- | engines/zvision/file/save_manager.cpp | 17 | ||||
-rw-r--r-- | engines/zvision/file/save_manager.h | 7 |
3 files changed, 22 insertions, 10 deletions
diff --git a/engines/zvision/detection.cpp b/engines/zvision/detection.cpp index 896ea52344..f14263f012 100644 --- a/engines/zvision/detection.cpp +++ b/engines/zvision/detection.cpp @@ -88,8 +88,8 @@ bool ZVisionMetaEngine::hasFeature(MetaEngineFeature f) const { (f == kSavesSupportMetaInfo) || (f == kSavesSupportThumbnail) || (f == kSavesSupportCreationDate) || + (f == kSavesSupportPlayTime) || (f == kSimpleSavesNames); - //(f == kSavesSupportPlayTime); } bool ZVision::ZVision::hasFeature(EngineFeature f) const { @@ -192,7 +192,7 @@ SaveStateDescriptor ZVisionMetaEngine::querySaveMetaInfos(const char *target, in desc.setThumbnail(header.thumbnail); - if (header.version > 0) { + if (header.version >= 1) { int day = header.saveDay; int month = header.saveMonth; int year = header.saveYear; @@ -203,8 +203,10 @@ SaveStateDescriptor ZVisionMetaEngine::querySaveMetaInfos(const char *target, in int minutes = header.saveMinutes; desc.setSaveTime(hour, minutes); + } - //desc.setPlayTime(header.playTime * 1000); + if (header.version >= 2) { + desc.setPlayTime(header.playTime * 1000); } return desc; diff --git a/engines/zvision/file/save_manager.cpp b/engines/zvision/file/save_manager.cpp index 4676272146..dd4425ae90 100644 --- a/engines/zvision/file/save_manager.cpp +++ b/engines/zvision/file/save_manager.cpp @@ -128,6 +128,8 @@ void SaveManager::writeSaveGameHeader(Common::OutSaveFile *file, const Common::S file->writeSint16LE(td.tm_mday); file->writeSint16LE(td.tm_hour); file->writeSint16LE(td.tm_min); + + file->writeUint32LE(g_engine->getTotalPlayTime() / 1000); } Common::Error SaveManager::loadGame(int slot) { @@ -184,6 +186,8 @@ Common::Error SaveManager::loadGame(int slot) { } } + g_engine->setTotalPlayTime(header.playTime * 1000); + return Common::kNoError; } @@ -193,6 +197,7 @@ bool SaveManager::readSaveGameHeader(Common::InSaveFile *in, SaveGameHeader &hea header.saveDay = 0; header.saveHour = 0; header.saveMinutes = 0; + header.playTime = 0; header.saveName.clear(); header.thumbnail = nullptr; header.version = 0; @@ -237,12 +242,16 @@ bool SaveManager::readSaveGameHeader(Common::InSaveFile *in, SaveGameHeader &hea } // Read in save date/time - header.saveYear = in->readSint16LE(); - header.saveMonth = in->readSint16LE(); - header.saveDay = in->readSint16LE(); - header.saveHour = in->readSint16LE(); + header.saveYear = in->readSint16LE(); + header.saveMonth = in->readSint16LE(); + header.saveDay = in->readSint16LE(); + header.saveHour = in->readSint16LE(); header.saveMinutes = in->readSint16LE(); + if (header.version >= 2) { + header.playTime = in->readUint32LE(); + } + return true; } diff --git a/engines/zvision/file/save_manager.h b/engines/zvision/file/save_manager.h index 94885b650b..e5bf47b47b 100644 --- a/engines/zvision/file/save_manager.h +++ b/engines/zvision/file/save_manager.h @@ -42,8 +42,9 @@ struct SaveGameHeader { byte version; Common::String saveName; Graphics::Surface *thumbnail; - int saveYear, saveMonth, saveDay; - int saveHour, saveMinutes; + int16 saveYear, saveMonth, saveDay; + int16 saveHour, saveMinutes; + uint32 playTime; }; class SaveManager { @@ -64,7 +65,7 @@ private: enum { SAVE_ORIGINAL = 0, - SAVE_VERSION = 1 + SAVE_VERSION = 2 }; Common::MemoryWriteStreamDynamic *_tempThumbnail; |