diff options
Diffstat (limited to 'engines')
-rw-r--r-- | engines/metaengine.h | 22 | ||||
-rw-r--r-- | engines/scumm/detection.cpp | 25 | ||||
-rw-r--r-- | engines/scumm/saveload.cpp | 9 | ||||
-rw-r--r-- | engines/scumm/scumm.h | 7 |
4 files changed, 52 insertions, 11 deletions
diff --git a/engines/metaengine.h b/engines/metaengine.h index 525afe5fa3..e57419a84c 100644 --- a/engines/metaengine.h +++ b/engines/metaengine.h @@ -151,10 +151,26 @@ public: /** * Features a thumbnail in savegames (i.e. includes a thumbnail - * in savestates returned via querySaveMetaInfo). This flag may - * only be set when 'kSupportsMetaInfos' is set. + * in savestates returned via querySaveMetaInfo). + * This flag may only be set when 'kSupportsMetaInfos' is set. */ - kSupportsThumbnails = 5 + kSupportsThumbnails = 5, + + /** + * Features 'save_date' and 'save_time' entries in the + * savestate returned by querySaveMetaInfo. Those values + * indicate the date/time the savegame was created. + * This flag may only be set when 'kSupportsMetaInfos' is set. + */ + kSupportsSaveDate = 6, + + /** + * Features 'play_time' entry in the savestate returned by + * querySaveMetaInfo. It indicates how long the user played + * the game till the save. + * This flag may only be set when 'kSupportsMetaInfos' is set. + */ + kSupportsSavePlayTime = 7 }; /** diff --git a/engines/scumm/detection.cpp b/engines/scumm/detection.cpp index 34775ab575..d3397fe208 100644 --- a/engines/scumm/detection.cpp +++ b/engines/scumm/detection.cpp @@ -693,7 +693,9 @@ bool ScummMetaEngine::hasFeature(MetaEngineFeature f) const { (f == kSupportsDirectLoad) || (f == kSupportsDeleteSave) || (f == kSupportsMetaInfos) || - (f == kSupportsThumbnails); + (f == kSupportsThumbnails) || + (f == kSupportsSaveDate) || + (f == kSupportsSavePlayTime); } GameList ScummMetaEngine::getSupportedGames() const { @@ -1002,6 +1004,27 @@ SaveStateDescriptor ScummMetaEngine::querySaveMetaInfos(const char *target, int desc.setDeletableFlag(true); desc.setThumbnail(thumbnail); + InfoStuff infos; + memset(&infos, 0, sizeof(infos)); + if (ScummEngine::loadInfosFromSlot(target, slot, &infos)) { + int day = (infos.date >> 24) & 0xFF; + int month = (infos.date >> 16) & 0xFF; + int year = infos.date & 0xFFFF; + + desc.setSaveDate(year, month, day); + + int hour = (infos.time >> 8) & 0xFF; + int minutes = infos.time & 0xFF; + + desc.setSaveTime(hour, minutes); + + minutes = infos.playtime / 60; + hour = minutes / 60; + minutes %= 60; + + desc.setPlayTime(hour, minutes); + } + return desc; } diff --git a/engines/scumm/saveload.cpp b/engines/scumm/saveload.cpp index d16da2c42e..267e06dafd 100644 --- a/engines/scumm/saveload.cpp +++ b/engines/scumm/saveload.cpp @@ -518,15 +518,15 @@ Graphics::Surface *ScummEngine::loadThumbnailFromSlot(const char *target, int sl return thumb; } -bool ScummEngine::loadInfosFromSlot(int slot, InfoStuff *stuff) { +bool ScummEngine::loadInfosFromSlot(const char *target, int slot, InfoStuff *stuff) { Common::SeekableReadStream *in; SaveGameHeader hdr; if (slot < 0) return 0; - Common::String filename = makeSavegameName(slot, false); - if (!(in = _saveFileMan->openForLoading(filename.c_str()))) { + Common::String filename = makeSavegameName(target, slot, false); + if (!(in = g_system->getSavefileManager()->openForLoading(filename.c_str()))) { return false; } @@ -598,9 +598,8 @@ bool ScummEngine::loadInfos(Common::SeekableReadStream *file, InfoStuff *stuff) stuff->playtime = section.playtime; // Skip over the remaining (unsupported) data - if (section.size > SaveInfoSectionSize) { + if (section.size > SaveInfoSectionSize) file->skip(section.size - SaveInfoSectionSize); - } return true; } diff --git a/engines/scumm/scumm.h b/engines/scumm/scumm.h index 2560dfe502..96cc5bb31c 100644 --- a/engines/scumm/scumm.h +++ b/engines/scumm/scumm.h @@ -637,11 +637,14 @@ public: } static Graphics::Surface *loadThumbnailFromSlot(const char *target, int slot); - bool loadInfosFromSlot(int slot, InfoStuff *stuff); + bool loadInfosFromSlot(int slot, InfoStuff *stuff) { + return loadInfosFromSlot(_targetName.c_str(), slot, stuff); + } + static bool loadInfosFromSlot(const char *target, int slot, InfoStuff *stuff); protected: void saveInfos(Common::WriteStream* file); - bool loadInfos(Common::SeekableReadStream *file, InfoStuff *stuff); + static bool loadInfos(Common::SeekableReadStream *file, InfoStuff *stuff); int32 _engineStartTime; int32 _pauseStartTime; |