aboutsummaryrefslogtreecommitdiff
path: root/engines/tinsel
diff options
context:
space:
mode:
authorDavid Fioramonti2018-07-05 19:07:58 -0700
committerPaul Gilbert2018-07-06 20:38:14 -0700
commitc47dc11c9ad4a9ada43a09b7570cc4f499b8b51e (patch)
tree42fe9e9ecbfa2c7bef04fd62611c1aea352964e5 /engines/tinsel
parent69f96a311f022143be750c83552b014691be7cb1 (diff)
downloadscummvm-rg350-c47dc11c9ad4a9ada43a09b7570cc4f499b8b51e.tar.gz
scummvm-rg350-c47dc11c9ad4a9ada43a09b7570cc4f499b8b51e.tar.bz2
scummvm-rg350-c47dc11c9ad4a9ada43a09b7570cc4f499b8b51e.zip
TINSEL: Show saved game creation time in load/save gui
Saved games inspected via the ScummVM load or save gui will now show the year, month, day, hour, and minute of its creation. This was already being saved in the saved game header so no version bump is necessary. This required adding kSavesSupportMetaInfo and kSavesSupportCreationDate features. I also had to add kSavesSupportThumbnail or the saved date is not shown. It was necessary to write querySaveMetaInfos.
Diffstat (limited to 'engines/tinsel')
-rw-r--r--engines/tinsel/detection.cpp46
1 files changed, 45 insertions, 1 deletions
diff --git a/engines/tinsel/detection.cpp b/engines/tinsel/detection.cpp
index 1c60c5eb8a..f8477505ac 100644
--- a/engines/tinsel/detection.cpp
+++ b/engines/tinsel/detection.cpp
@@ -102,6 +102,7 @@ public:
virtual bool hasFeature(MetaEngineFeature f) const;
virtual SaveStateList listSaves(const char *target) const;
virtual int getMaximumSaveSlot() const;
+ virtual SaveStateDescriptor querySaveMetaInfos(const char *target, int slot) const;
virtual void removeSaveState(const char *target, int slot) const;
};
@@ -110,7 +111,10 @@ bool TinselMetaEngine::hasFeature(MetaEngineFeature f) const {
(f == kSupportsListSaves) ||
(f == kSupportsLoadingDuringStartup) ||
(f == kSupportsDeleteSave) ||
- (f == kSimpleSavesNames);
+ (f == kSimpleSavesNames) ||
+ (f == kSavesSupportMetaInfo) ||
+ (f == kSavesSupportThumbnail) ||
+ (f == kSavesSupportCreationDate);
}
bool Tinsel::TinselEngine::hasFeature(EngineFeature f) const {
@@ -129,6 +133,46 @@ bool Tinsel::TinselEngine::hasFeature(EngineFeature f) const {
(f == kSupportsLoadingDuringRuntime);
}
+SaveStateDescriptor TinselMetaEngine::querySaveMetaInfos(const char *target, int slot) const {
+ Common::String fileName;
+ if (slot < 0)
+ return SaveStateDescriptor();
+ else if (slot < 10)
+ fileName = Common::String::format("%s.00%d", target, slot);
+ else if (slot < 100)
+ fileName = Common::String::format("%s.0%d", target, slot);
+ else if (slot < 1000)
+ fileName = Common::String::format("%s.%d", target, slot);
+ else
+ warning("Too many slots!");
+
+ Common::InSaveFile *file = g_system->getSavefileManager()->openForLoading(fileName);
+
+ if (!file) {
+ return SaveStateDescriptor();
+ }
+
+ file->readUint32LE(); // skip id
+ file->readUint32LE(); // skip size
+ file->readUint32LE(); // skip version
+ char saveDesc[Tinsel::SG_DESC_LEN];
+ file->read(saveDesc, sizeof(saveDesc));
+
+ saveDesc[Tinsel::SG_DESC_LEN - 1] = 0;
+ SaveStateDescriptor desc(slot, saveDesc);
+
+ int8 tm_year = file->readUint16LE();
+ int8 tm_mon = file->readSByte();
+ int8 tm_mday = file->readSByte();
+ int8 tm_hour = file->readSByte();
+ int8 tm_min = file->readSByte();
+
+ desc.setSaveDate(1900+tm_year, tm_mon, tm_mday);
+ desc.setSaveTime(tm_hour, tm_min);
+ delete file;
+ return desc;
+}
+
namespace Tinsel {
extern int getList(Common::SaveFileManager *saveFileMan, const Common::String &target);
}