aboutsummaryrefslogtreecommitdiff
path: root/engines
diff options
context:
space:
mode:
authorAlexander Tkachev2016-06-06 12:22:22 +0600
committerAlexander Tkachev2016-08-24 16:07:55 +0600
commitf1a56eaf3666a6535ff0d1654e4e014249933452 (patch)
treee48d1598f023d0915fb3d559fb6648b0f6d3e1a0 /engines
parent6c5a8f34eaf5fe6af0d885cb162b5ebf193030f8 (diff)
downloadscummvm-rg350-f1a56eaf3666a6535ff0d1654e4e014249933452.tar.gz
scummvm-rg350-f1a56eaf3666a6535ff0d1654e4e014249933452.tar.bz2
scummvm-rg350-f1a56eaf3666a6535ff0d1654e4e014249933452.zip
GUI: Show "locked" saves during sync
Diffstat (limited to 'engines')
-rw-r--r--engines/cge/detection.cpp5
-rw-r--r--engines/metaengine.h10
-rw-r--r--engines/savestate.cpp4
-rw-r--r--engines/savestate.h23
4 files changed, 40 insertions, 2 deletions
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
@@ -116,6 +116,16 @@ public:
}
/**
+ * 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
* Returned for the plugin (used to set default values).
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
@@ -90,6 +90,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
* should be either 160x100 or 160x120 pixels, depending on the aspect
@@ -180,6 +198,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.
*/
Common::String _saveDate;