From f1a56eaf3666a6535ff0d1654e4e014249933452 Mon Sep 17 00:00:00 2001 From: Alexander Tkachev Date: Mon, 6 Jun 2016 12:22:22 +0600 Subject: GUI: Show "locked" saves during sync --- engines/cge/detection.cpp | 5 +++++ engines/metaengine.h | 10 ++++++++++ engines/savestate.cpp | 4 ++-- engines/savestate.h | 23 +++++++++++++++++++++++ 4 files changed, 40 insertions(+), 2 deletions(-) (limited to 'engines') diff --git a/engines/cge/detection.cpp b/engines/cge/detection.cpp index 82d27f8d54..0c79be51d9 100644 --- a/engines/cge/detection.cpp +++ b/engines/cge/detection.cpp @@ -131,6 +131,7 @@ public: virtual bool createInstance(OSystem *syst, Engine **engine, const ADGameDescription *desc) const; virtual int getMaximumSaveSlot() const; virtual SaveStateList listSaves(const char *target) const; + virtual Common::String getSavefilesPattern(Common::String &target) const; SaveStateDescriptor querySaveMetaInfos(const char *target, int slot) const; virtual void removeSaveState(const char *target, int slot) const; }; @@ -239,6 +240,10 @@ SaveStateList CGEMetaEngine::listSaves(const char *target) const { return saveList; } +Common::String CGEMetaEngine::getSavefilesPattern(Common::String &target) const { + return target + ".###"; +} + SaveStateDescriptor CGEMetaEngine::querySaveMetaInfos(const char *target, int slot) const { Common::String fileName = Common::String::format("%s.%03d", target, slot); Common::InSaveFile *f = g_system->getSavefileManager()->openForLoading(fileName); diff --git a/engines/metaengine.h b/engines/metaengine.h index e7bfebab71..913f61d280 100644 --- a/engines/metaengine.h +++ b/engines/metaengine.h @@ -115,6 +115,16 @@ public: return SaveStateList(); } + /** + * Return a common pattern which all engine's save filenames should match. + * + * @param target name of a config manager target + * @return a pattern for filenames + */ + virtual Common::String getSavefilesPattern(Common::String &target) const { + return target + ".s##"; + } + /** * Return a list of extra GUI options for the specified target. * If no target is specified, all of the available custom GUI options are diff --git a/engines/savestate.cpp b/engines/savestate.cpp index 186d7bc5f2..7366aa6a61 100644 --- a/engines/savestate.cpp +++ b/engines/savestate.cpp @@ -27,12 +27,12 @@ SaveStateDescriptor::SaveStateDescriptor() // FIXME: default to 0 (first slot) or to -1 (invalid slot) ? : _slot(-1), _description(), _isDeletable(true), _isWriteProtected(false), - _saveDate(), _saveTime(), _playTime(), _thumbnail() { + _isLocked(false), _saveDate(), _saveTime(), _playTime(), _thumbnail() { } SaveStateDescriptor::SaveStateDescriptor(int s, const Common::String &d) : _slot(s), _description(d), _isDeletable(true), _isWriteProtected(false), - _saveDate(), _saveTime(), _playTime(), _thumbnail() { + _isLocked(false), _saveDate(), _saveTime(), _playTime(), _thumbnail() { } void SaveStateDescriptor::setThumbnail(Graphics::Surface *t) { diff --git a/engines/savestate.h b/engines/savestate.h index 21ade602fa..3244d61fdb 100644 --- a/engines/savestate.h +++ b/engines/savestate.h @@ -89,6 +89,24 @@ public: */ bool getWriteProtectedFlag() const { return _isWriteProtected; } + /** + * Defines whether the save state is "locked" because is being synced. + */ + void setLocked(bool state) { + _isLocked = state; + + //just in case: + if (state) { + setDeletableFlag(false); + setWriteProtectedFlag(true); + } + } + + /** + * Queries whether the save state is "locked" because is being synced. + */ + bool getLocked() const { return _isLocked; } + /** * Return a thumbnail graphics surface representing the savestate visually. * This is usually a scaled down version of the game graphics. The size @@ -179,6 +197,11 @@ private: */ bool _isWriteProtected; + /** + * Whether the save state is "locked" because is being synced. + */ + bool _isLocked; + /** * Human readable description of the date the save state was created. */ -- cgit v1.2.3