aboutsummaryrefslogtreecommitdiff
path: root/engines/sword25/kernel/filesystemutil.cpp
diff options
context:
space:
mode:
authorPaul Gilbert2010-09-19 05:00:45 +0000
committerEugene Sandulenko2010-10-12 23:59:23 +0000
commit80521ed5dd279316d0534fc3cc4b61c27d19ef4e (patch)
treed941a865c999150be0a2028fc5f1b73c4c21395b /engines/sword25/kernel/filesystemutil.cpp
parent1e07d9561fc43e1b1c0763d54c3eea4154fff070 (diff)
downloadscummvm-rg350-80521ed5dd279316d0534fc3cc4b61c27d19ef4e.tar.gz
scummvm-rg350-80521ed5dd279316d0534fc3cc4b61c27d19ef4e.tar.bz2
scummvm-rg350-80521ed5dd279316d0534fc3cc4b61c27d19ef4e.zip
SWORD25: Further savegame work, including savegame screenshots
This handles saving (but not yet re-loaded display) of screenshots into savegame files. It also changes the original engine behaviour of temporarily saving the screenshots in a file 'tmp.png' to keeping the raw PNG file data in a memory block. svn-id: r53373
Diffstat (limited to 'engines/sword25/kernel/filesystemutil.cpp')
-rw-r--r--engines/sword25/kernel/filesystemutil.cpp19
1 files changed, 18 insertions, 1 deletions
diff --git a/engines/sword25/kernel/filesystemutil.cpp b/engines/sword25/kernel/filesystemutil.cpp
index 71b3dc9aa8..b6fcce5467 100644
--- a/engines/sword25/kernel/filesystemutil.cpp
+++ b/engines/sword25/kernel/filesystemutil.cpp
@@ -41,6 +41,7 @@
#include "common/savefile.h"
#include "common/system.h"
#include "sword25/kernel/filesystemutil.h"
+#include "sword25/kernel/persistenceservice.h"
namespace Sword25 {
@@ -113,7 +114,13 @@ public:
virtual bool FileExists(const Common::String &Filename) {
Common::File f;
- return f.exists(Filename);
+ if (f.exists(Filename))
+ return true;
+
+ // Check if the file exists in the save folder
+ Common::FSNode folder(PersistenceService::GetSavegameDirectory());
+ Common::FSNode fileNode = folder.getChild(FileSystemUtil::GetInstance().GetPathFilename(Filename));
+ return fileNode.exists();
}
virtual bool CreateDirectory(const Common::String &DirectoryName) {
@@ -128,6 +135,16 @@ public:
sort(filenames.begin(), filenames.end());
return filenames;
}
+
+ virtual Common::String GetPathFilename(const Common::String &Path) {
+ for (int i = Path.size() - 1; i >= 0; --i) {
+ if ((Path[i] == '/') || (Path[i] == '\\')) {
+ return Common::String(&Path.c_str()[i + 1]);
+ }
+ }
+
+ return Path;
+ }
};
// -----------------------------------------------------------------------------