diff options
author | David Fioramonti | 2018-08-17 19:51:08 -0700 |
---|---|---|
committer | Eugene Sandulenko | 2018-08-18 14:21:28 +0200 |
commit | e2e0f9f5289a56031f9427040a4615264eeb9851 (patch) | |
tree | 9d89c7b3c9c7519a34428c66c5d75222b0c8668b /engines/toon/detection.cpp | |
parent | 16ee8aa69f48ad3dd9183b4a525ee600ddaa7294 (diff) | |
download | scummvm-rg350-e2e0f9f5289a56031f9427040a4615264eeb9851.tar.gz scummvm-rg350-e2e0f9f5289a56031f9427040a4615264eeb9851.tar.bz2 scummvm-rg350-e2e0f9f5289a56031f9427040a4615264eeb9851.zip |
TOON: Add playtime to saved game
Supports saved games made in the current version or the the last saved game version.
Diffstat (limited to 'engines/toon/detection.cpp')
-rw-r--r-- | engines/toon/detection.cpp | 18 |
1 files changed, 12 insertions, 6 deletions
diff --git a/engines/toon/detection.cpp b/engines/toon/detection.cpp index 634d286c7c..f3b510b6f4 100644 --- a/engines/toon/detection.cpp +++ b/engines/toon/detection.cpp @@ -160,6 +160,7 @@ bool ToonMetaEngine::hasFeature(MetaEngineFeature f) const { (f == kSavesSupportMetaInfo) || (f == kSavesSupportThumbnail) || (f == kSavesSupportCreationDate) || + (f == kSavesSupportPlayTime) || (f == kSimpleSavesNames); } @@ -168,7 +169,7 @@ void ToonMetaEngine::removeSaveState(const char *target, int slot) const { g_system->getSavefileManager()->removeSavefile(fileName); } -int ToonMetaEngine::getMaximumSaveSlot() const { return 99; } +int ToonMetaEngine::getMaximumSaveSlot() const { return MAX_SAVE_SLOT; } SaveStateList ToonMetaEngine::listSaves(const char *target) const { Common::SaveFileManager *saveFileMan = g_system->getSavefileManager(); @@ -183,11 +184,11 @@ SaveStateList ToonMetaEngine::listSaves(const char *target) const { // Obtain the last 3 digits of the filename, since they correspond to the save slot int slotNum = atoi(filename->c_str() + filename->size() - 3); - if (slotNum >= 0 && slotNum <= 99) { + if (slotNum >= 0 && slotNum <= MAX_SAVE_SLOT) { Common::InSaveFile *file = saveFileMan->openForLoading(*filename); if (file) { int32 version = file->readSint32BE(); - if (version != TOON_SAVEGAME_VERSION) { + if ( (version < 4) || (version > TOON_SAVEGAME_VERSION) ) { delete file; continue; } @@ -220,7 +221,7 @@ SaveStateDescriptor ToonMetaEngine::querySaveMetaInfos(const char *target, int s if (file) { int32 version = file->readSint32BE(); - if (version != TOON_SAVEGAME_VERSION) { + if ( (version < 4) || (version > TOON_SAVEGAME_VERSION) ) { delete file; return SaveStateDescriptor(); } @@ -232,8 +233,8 @@ SaveStateDescriptor ToonMetaEngine::querySaveMetaInfos(const char *target, int s SaveStateDescriptor desc(slot, saveName); - Graphics::Surface *thumbnail; - if (!Graphics::loadThumbnail(*file, thumbnail)) { + Graphics::Surface *thumbnail = nullptr; + if (!Graphics::loadThumbnail(*file, thumbnail, false)) { delete file; return SaveStateDescriptor(); } @@ -253,6 +254,11 @@ SaveStateDescriptor ToonMetaEngine::querySaveMetaInfos(const char *target, int s desc.setSaveTime(hour, minutes); + if (version >= 5) { + uint32 playTimeMsec = file->readUint32BE(); + desc.setPlayTime(playTimeMsec); + } + delete file; return desc; } |