diff options
author | Johannes Schickel | 2008-09-16 14:56:02 +0000 |
---|---|---|
committer | Johannes Schickel | 2008-09-16 14:56:02 +0000 |
commit | 3739662b75dbd04715731071e3b89d1d06a50a8e (patch) | |
tree | e956544a64820b95556cd2e58c230f4f7751b986 /engines/scumm | |
parent | 2e9e661d5feaec6d1cb1b61d40cbce4165122edd (diff) | |
download | scummvm-rg350-3739662b75dbd04715731071e3b89d1d06a50a8e.tar.gz scummvm-rg350-3739662b75dbd04715731071e3b89d1d06a50a8e.tar.bz2 scummvm-rg350-3739662b75dbd04715731071e3b89d1d06a50a8e.zip |
Added support for SCUMM savestates date/time and playtime info in the launcher load dialog.
svn-id: r34583
Diffstat (limited to 'engines/scumm')
-rw-r--r-- | engines/scumm/detection.cpp | 25 | ||||
-rw-r--r-- | engines/scumm/saveload.cpp | 9 | ||||
-rw-r--r-- | engines/scumm/scumm.h | 7 |
3 files changed, 33 insertions, 8 deletions
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; |