diff options
author | Alexander Tkachev | 2016-05-30 20:28:09 +0600 |
---|---|---|
committer | Alexander Tkachev | 2016-08-24 16:07:55 +0600 |
commit | cc4512e50b5489ec57adc05b3c2277c132bed767 (patch) | |
tree | 10484758cf862dab94377e95fc4a9a8f8685b094 /backends/saves | |
parent | aa987e5c52899bfafff4f1f84479a67761569109 (diff) | |
download | scummvm-rg350-cc4512e50b5489ec57adc05b3c2277c132bed767.tar.gz scummvm-rg350-cc4512e50b5489ec57adc05b3c2277c132bed767.tar.bz2 scummvm-rg350-cc4512e50b5489ec57adc05b3c2277c132bed767.zip |
COMMON: Add SaveFileManager::openRawFile()
It's needed for the cloud saves upload/sync feature.
Diffstat (limited to 'backends/saves')
-rw-r--r-- | backends/saves/default/default-saves.cpp | 16 | ||||
-rw-r--r-- | backends/saves/default/default-saves.h | 1 |
2 files changed, 17 insertions, 0 deletions
diff --git a/backends/saves/default/default-saves.cpp b/backends/saves/default/default-saves.cpp index daec36ae72..75ba50a081 100644 --- a/backends/saves/default/default-saves.cpp +++ b/backends/saves/default/default-saves.cpp @@ -75,6 +75,22 @@ Common::StringArray DefaultSaveFileManager::listSavefiles(const Common::String & return results; } +Common::InSaveFile *DefaultSaveFileManager::openRawFile(const Common::String &filename) { + // Assure the savefile name cache is up-to-date. + assureCached(getSavePath()); + if (getError().getCode() != Common::kNoError) + return nullptr; + + SaveFileCache::const_iterator file = _saveFileCache.find(filename); + if (file == _saveFileCache.end()) { + return nullptr; + } else { + // Open the file for loading. + Common::SeekableReadStream *sf = file->_value.createReadStream(); + return sf; + } +} + Common::InSaveFile *DefaultSaveFileManager::openForLoading(const Common::String &filename) { // Assure the savefile name cache is up-to-date. assureCached(getSavePath()); diff --git a/backends/saves/default/default-saves.h b/backends/saves/default/default-saves.h index bf4ca0229d..166e7004ed 100644 --- a/backends/saves/default/default-saves.h +++ b/backends/saves/default/default-saves.h @@ -38,6 +38,7 @@ public: DefaultSaveFileManager(const Common::String &defaultSavepath); virtual Common::StringArray listSavefiles(const Common::String &pattern); + virtual Common::InSaveFile *openRawFile(const Common::String &filename); virtual Common::InSaveFile *openForLoading(const Common::String &filename); virtual Common::OutSaveFile *openForSaving(const Common::String &filename, bool compress = true); virtual bool removeSavefile(const Common::String &filename); |