mirror of
https://github.com/libretro/scummvm.git
synced 2025-03-06 10:17:14 +00:00
CLOUD: Fix DefaultSaveFileManager again
Now openForLoading() and openForSaving() check whether file is locked, so AGOS and SCUMM engines Ctrl+number and Alt+number hot keys shouldn't be able to save/load in these slots during saves sync.
This commit is contained in:
parent
62a640ff44
commit
f6e69b6276
@ -27,6 +27,10 @@
|
||||
|
||||
#include "common/scummsys.h"
|
||||
|
||||
#ifdef USE_CLOUD
|
||||
#include "backends/cloud/cloudmanager.h"
|
||||
#endif
|
||||
|
||||
#if !defined(DISABLE_DEFAULT_SAVEFILEMANAGER)
|
||||
|
||||
#include "backends/saves/default/default-saves.h"
|
||||
@ -109,6 +113,12 @@ Common::InSaveFile *DefaultSaveFileManager::openForLoading(const Common::String
|
||||
if (getError().getCode() != Common::kNoError)
|
||||
return nullptr;
|
||||
|
||||
for (Common::StringArray::const_iterator i = _lockedFiles.begin(), end = _lockedFiles.end(); i != end; ++i) {
|
||||
if (filename == *i) {
|
||||
return nullptr; //file is locked, no loading available
|
||||
}
|
||||
}
|
||||
|
||||
SaveFileCache::const_iterator file = _saveFileCache.find(filename);
|
||||
if (file == _saveFileCache.end()) {
|
||||
return nullptr;
|
||||
@ -126,6 +136,12 @@ Common::OutSaveFile *DefaultSaveFileManager::openForSaving(const Common::String
|
||||
if (getError().getCode() != Common::kNoError)
|
||||
return nullptr;
|
||||
|
||||
for (Common::StringArray::const_iterator i = _lockedFiles.begin(), end = _lockedFiles.end(); i != end; ++i) {
|
||||
if (filename == *i) {
|
||||
return nullptr; //file is locked, no saving available
|
||||
}
|
||||
}
|
||||
|
||||
// Obtain node.
|
||||
SaveFileCache::const_iterator file = _saveFileCache.find(filename);
|
||||
Common::FSNode fileNode;
|
||||
@ -209,6 +225,12 @@ void DefaultSaveFileManager::assureCached(const Common::String &savePathName) {
|
||||
// Check that path exists and is usable.
|
||||
checkPath(Common::FSNode(savePathName));
|
||||
|
||||
#ifdef USE_CLOUD
|
||||
Common::Array<Common::String> files = CloudMan.getSyncingFiles(); //returns empty array if not syncing
|
||||
if (!files.empty()) updateSavefilesList(files); //makes this cache invalid
|
||||
else _lockedFiles = files;
|
||||
#endif
|
||||
|
||||
if (_cachedDirectory == savePathName) {
|
||||
return;
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user