aboutsummaryrefslogtreecommitdiff
path: root/backends/saves
diff options
context:
space:
mode:
authorAlexander Tkachev2016-06-18 18:49:46 +0600
committerAlexander Tkachev2016-08-24 16:07:55 +0600
commitaee713141b3a401f08e63cd9ccf5ce3dfe1cb06e (patch)
tree20fb764d74405090278d2b498076c05fe22e266c /backends/saves
parent81106b04440d76238da0fa0166eb3032b6db591e (diff)
downloadscummvm-rg350-aee713141b3a401f08e63cd9ccf5ce3dfe1cb06e.tar.gz
scummvm-rg350-aee713141b3a401f08e63cd9ccf5ce3dfe1cb06e.tar.bz2
scummvm-rg350-aee713141b3a401f08e63cd9ccf5ce3dfe1cb06e.zip
CLOUD: Make OutSaveFile start saves sync
It had to become a proxy class in order to do that. finalize() starts the saves sync.
Diffstat (limited to 'backends/saves')
-rw-r--r--backends/saves/default/default-saves.cpp2
-rw-r--r--backends/saves/savefile.cpp24
2 files changed, 25 insertions, 1 deletions
diff --git a/backends/saves/default/default-saves.cpp b/backends/saves/default/default-saves.cpp
index 3fcb3cb3b3..e20ce31d18 100644
--- a/backends/saves/default/default-saves.cpp
+++ b/backends/saves/default/default-saves.cpp
@@ -156,7 +156,7 @@ Common::OutSaveFile *DefaultSaveFileManager::openForSaving(const Common::String
// Open the file for saving.
Common::WriteStream *const sf = fileNode.createWriteStream();
- Common::OutSaveFile *const result = compress ? Common::wrapCompressedWriteStream(sf) : sf;
+ Common::OutSaveFile *const result = new Common::OutSaveFile(compress ? Common::wrapCompressedWriteStream(sf) : sf);
// Add file to cache now that it exists.
_saveFileCache[filename] = Common::FSNode(fileNode.getPath());
diff --git a/backends/saves/savefile.cpp b/backends/saves/savefile.cpp
index b04c53d832..1f007ca713 100644
--- a/backends/saves/savefile.cpp
+++ b/backends/saves/savefile.cpp
@@ -23,9 +23,33 @@
#include "common/util.h"
#include "common/savefile.h"
#include "common/str.h"
+#ifdef USE_CLOUD
+#include "backends/cloud/cloudmanager.h"
+#endif
namespace Common {
+OutSaveFile::OutSaveFile(WriteStream *w): _wrapped(w) {}
+
+OutSaveFile::~OutSaveFile() {}
+
+bool OutSaveFile::err() const { return _wrapped->err(); }
+
+void OutSaveFile::clearErr() { _wrapped->clearErr(); }
+
+void OutSaveFile::finalize() {
+ _wrapped->finalize();
+#ifdef USE_CLOUD
+ CloudMan.syncSaves();
+#endif
+}
+
+bool OutSaveFile::flush() { return _wrapped->flush(); }
+
+uint32 OutSaveFile::write(const void *dataPtr, uint32 dataSize) {
+ return _wrapped->write(dataPtr, dataSize);
+}
+
bool SaveFileManager::copySavefile(const String &oldFilename, const String &newFilename) {
InSaveFile *inFile = 0;
OutSaveFile *outFile = 0;