[Scummvm-git-logs] scummvm master -> c47dc11c9ad4a9ada43a09b7570cc4f499b8b51e
dreammaster
dreammaster at scummvm.org
Sat Jul 7 05:38:17 CEST 2018
This automated email contains information about 1 new commit which have been
pushed to the 'scummvm' repo located at https://github.com/scummvm/scummvm .
Summary:
c47dc11c9a TINSEL: Show saved game creation time in load/save gui
Commit: c47dc11c9ad4a9ada43a09b7570cc4f499b8b51e
https://github.com/scummvm/scummvm/commit/c47dc11c9ad4a9ada43a09b7570cc4f499b8b51e
Author: David Fioramonti (dafioram at gmail.com)
Date: 2018-07-06T20:38:14-07:00
Commit Message:
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.
Changed paths:
engines/tinsel/detection.cpp
diff --git a/engines/tinsel/detection.cpp b/engines/tinsel/detection.cpp
index 1c60c5e..f847750 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);
}
More information about the Scummvm-git-logs
mailing list