aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorlolbot-iichan2019-07-14 21:49:17 +0300
committerFilippos Karapetis2019-07-16 20:24:42 +0300
commit614dfdfbe353f07dcfe0b21a21e4f4bae702d83d (patch)
tree73ed4455af777d192e267317358c042a27ec96a8
parent9eca2b4c549a6e20c351b6ced4442d36f7601964 (diff)
downloadscummvm-rg350-614dfdfbe353f07dcfe0b21a21e4f4bae702d83d.tar.gz
scummvm-rg350-614dfdfbe353f07dcfe0b21a21e4f4bae702d83d.tar.bz2
scummvm-rg350-614dfdfbe353f07dcfe0b21a21e4f4bae702d83d.zip
WINTERMUTE: Implement loading files using SavefileManager
-rw-r--r--engines/wintermute/base/base_file_manager.cpp8
-rw-r--r--engines/wintermute/base/file/base_savefile_manager_file.cpp10
-rw-r--r--engines/wintermute/base/file/base_savefile_manager_file.h2
3 files changed, 20 insertions, 0 deletions
diff --git a/engines/wintermute/base/base_file_manager.cpp b/engines/wintermute/base/base_file_manager.cpp
index 7ae499e368..cc74454f22 100644
--- a/engines/wintermute/base/base_file_manager.cpp
+++ b/engines/wintermute/base/base_file_manager.cpp
@@ -324,6 +324,9 @@ bool BaseFileManager::hasFile(const Common::String &filename) {
int slot = atoi(filename.c_str() + 9);
return pm.getSaveExists(slot);
}
+ if (sfmFileExists(filename)) {
+ return true;
+ }
if (diskFileExists(filename)) {
return true;
}
@@ -395,6 +398,11 @@ Common::SeekableReadStream *BaseFileManager::openFileRaw(const Common::String &f
return ret;
}
+ ret = openSfmFile(filename);
+ if (ret) {
+ return ret;
+ }
+
ret = openDiskFile(filename);
if (ret) {
return ret;
diff --git a/engines/wintermute/base/file/base_savefile_manager_file.cpp b/engines/wintermute/base/file/base_savefile_manager_file.cpp
index 8bf684192a..d76053f58f 100644
--- a/engines/wintermute/base/file/base_savefile_manager_file.cpp
+++ b/engines/wintermute/base/file/base_savefile_manager_file.cpp
@@ -45,9 +45,19 @@ Common::String makeSfmFilename(const Common::String &filename) {
return BaseEngine::instance().getGameTargetName() + "." + smFilename;
}
+bool sfmFileExists(const Common::String &filename) {
+ Common::String smFilename = makeSfmFilename(filename);
+ return g_system->getSavefileManager()->listSavefiles(smFilename).size() > 0;
+}
+
Common::SeekableReadStream *openSfmFile(const Common::String &filename) {
Common::String smFilename = makeSfmFilename(filename);
return g_system->getSavefileManager()->openRawFile(smFilename);
}
+Common::WriteStream *openSfmFileForWrite(const Common::String &filename) {
+ Common::String smFilename = makeSfmFilename(filename);
+ return g_system->getSavefileManager()->openForSaving(smFilename, false);
+}
+
} // End of namespace Wintermute
diff --git a/engines/wintermute/base/file/base_savefile_manager_file.h b/engines/wintermute/base/file/base_savefile_manager_file.h
index fb9e150503..2b129cf39a 100644
--- a/engines/wintermute/base/file/base_savefile_manager_file.h
+++ b/engines/wintermute/base/file/base_savefile_manager_file.h
@@ -33,7 +33,9 @@
namespace Wintermute {
+Common::SeekableReadStream *openSfmFile(const Common::String &filename);
Common::WriteStream *openSfmFileForWrite(const Common::String &filename);
+bool sfmFileExists(const Common::String &filename);
} // End of namespace Wintermute