aboutsummaryrefslogtreecommitdiff
path: root/backends/platform
diff options
context:
space:
mode:
authorPaul Gilbert2016-08-27 13:59:08 -0400
committerPaul Gilbert2016-08-27 13:59:08 -0400
commitf5ab3d1cd9eb3a884b0ab5d0b154a4f9cccc74b7 (patch)
tree771a8d2b3fddf96c17a1d81d42cb08dfba09d110 /backends/platform
parent873d555add9aaf5eb0d021518f5134142e2c2ff6 (diff)
parent5ea32efbb0ecb3e6b8336ad3c2edd3905ea5b89a (diff)
downloadscummvm-rg350-f5ab3d1cd9eb3a884b0ab5d0b154a4f9cccc74b7.tar.gz
scummvm-rg350-f5ab3d1cd9eb3a884b0ab5d0b154a4f9cccc74b7.tar.bz2
scummvm-rg350-f5ab3d1cd9eb3a884b0ab5d0b154a4f9cccc74b7.zip
Merge branch 'master' into xeen
Diffstat (limited to 'backends/platform')
-rw-r--r--backends/platform/dc/vmsave.cpp19
-rw-r--r--backends/platform/n64/framfs_save_manager.h3
-rw-r--r--backends/platform/n64/pakfs_save_manager.h4
-rw-r--r--backends/platform/sdl/posix/posix.cpp18
-rw-r--r--backends/platform/sdl/posix/posix.h2
-rw-r--r--backends/platform/sdl/sdl.cpp8
-rw-r--r--backends/platform/sdl/sdl.h1
7 files changed, 46 insertions, 9 deletions
diff --git a/backends/platform/dc/vmsave.cpp b/backends/platform/dc/vmsave.cpp
index 75fc1ed0df..d896ba1299 100644
--- a/backends/platform/dc/vmsave.cpp
+++ b/backends/platform/dc/vmsave.cpp
@@ -269,15 +269,16 @@ public:
class OutVMSave : public Common::OutSaveFile {
private:
char *buffer;
- int pos, size, committed;
+ int _pos, size, committed;
char filename[16];
bool iofailed;
public:
uint32 write(const void *buf, uint32 cnt);
+ virtual int32 pos() const { return _pos; }
OutVMSave(const char *_filename)
- : pos(0), committed(-1), iofailed(false)
+ : _pos(0), committed(-1), iofailed(false)
{
strncpy(filename, _filename, 16);
buffer = new char[size = MAX_SAVE_SIZE];
@@ -320,14 +321,14 @@ void OutVMSave::finalize()
extern const char *gGameName;
extern Icon icon;
- if (committed >= pos)
+ if (committed >= _pos)
return;
char *data = buffer;
- int len = pos;
+ int len = _pos;
vmsaveResult r = writeSaveGame(gGameName, data, len, filename, icon);
- committed = pos;
+ committed = _pos;
if (r != VMSAVE_OK)
iofailed = true;
displaySaveResult(r);
@@ -386,13 +387,13 @@ bool InVMSave::seek(int32 offs, int whence)
uint32 OutVMSave::write(const void *buf, uint32 cnt)
{
int nbyt = cnt;
- if (pos + nbyt > size) {
- cnt = (size - pos);
+ if (_pos + nbyt > size) {
+ cnt = (size - _pos);
nbyt = cnt;
}
if (nbyt)
- memcpy(buffer + pos, buf, nbyt);
- pos += nbyt;
+ memcpy(buffer + _pos, buf, nbyt);
+ _pos += nbyt;
return cnt;
}
diff --git a/backends/platform/n64/framfs_save_manager.h b/backends/platform/n64/framfs_save_manager.h
index a066854aab..9bd4ee579e 100644
--- a/backends/platform/n64/framfs_save_manager.h
+++ b/backends/platform/n64/framfs_save_manager.h
@@ -71,6 +71,9 @@ private:
public:
uint32 write(const void *buf, uint32 cnt);
+ virtual int32 pos() const {
+ return framfs_tell(fd);
+ }
OutFRAMSave(const char *_filename) : fd(NULL) {
fd = framfs_open(_filename, "w");
diff --git a/backends/platform/n64/pakfs_save_manager.h b/backends/platform/n64/pakfs_save_manager.h
index ec66c80b73..0c08f0c506 100644
--- a/backends/platform/n64/pakfs_save_manager.h
+++ b/backends/platform/n64/pakfs_save_manager.h
@@ -72,6 +72,10 @@ private:
public:
uint32 write(const void *buf, uint32 cnt);
+ virtual int32 pos() const {
+ return pakfs_tell(fd);
+ }
+
OutPAKSave(const char *_filename) : fd(NULL) {
fd = pakfs_open(_filename, "w");
}
diff --git a/backends/platform/sdl/posix/posix.cpp b/backends/platform/sdl/posix/posix.cpp
index e2a642b288..0d5f39736a 100644
--- a/backends/platform/sdl/posix/posix.cpp
+++ b/backends/platform/sdl/posix/posix.cpp
@@ -141,6 +141,24 @@ Common::String OSystem_POSIX::getDefaultConfigFileName() {
return configFile;
}
+void OSystem_POSIX::addSysArchivesToSearchSet(Common::SearchSet &s, int priority) {
+#ifdef DATA_PATH
+ const char *snap = getenv("SNAP");
+ if (snap) {
+ Common::String dataPath = Common::String(snap) + DATA_PATH;
+ Common::FSNode dataNode(dataPath);
+ if (dataNode.exists() && dataNode.isDirectory()) {
+ // This is the same priority which is used for the data path (below),
+ // but we insert this one first, so it will be searched first.
+ s.add(dataPath, new Common::FSDirectory(dataNode, 4), priority);
+ }
+ }
+#endif
+
+ // For now, we always add the data path, just in case SNAP doesn't make sense.
+ OSystem_SDL::addSysArchivesToSearchSet(s, priority);
+}
+
Common::WriteStream *OSystem_POSIX::createLogFile() {
// Start out by resetting _logFilePath, so that in case
// of a failure, we know that no log file is open.
diff --git a/backends/platform/sdl/posix/posix.h b/backends/platform/sdl/posix/posix.h
index 0514d30191..050463c273 100644
--- a/backends/platform/sdl/posix/posix.h
+++ b/backends/platform/sdl/posix/posix.h
@@ -38,6 +38,8 @@ public:
virtual void init();
virtual void initBackend();
+ virtual void addSysArchivesToSearchSet(Common::SearchSet &s, int priority = 0);
+
protected:
/**
* Base string for creating the default path and filename for the
diff --git a/backends/platform/sdl/sdl.cpp b/backends/platform/sdl/sdl.cpp
index c55753194b..dca6891fef 100644
--- a/backends/platform/sdl/sdl.cpp
+++ b/backends/platform/sdl/sdl.cpp
@@ -492,6 +492,14 @@ AudioCDManager *OSystem_SDL::createAudioCDManager() {
#endif
}
+Common::SaveFileManager *OSystem_SDL::getSavefileManager() {
+#ifdef ENABLE_EVENTRECORDER
+ return g_eventRec.getSaveManager(_savefileManager);
+#else
+ return _savefileManager;
+#endif
+}
+
#ifdef USE_OPENGL
const OSystem::GraphicsMode *OSystem_SDL::getSupportedGraphicsModes() const {
diff --git a/backends/platform/sdl/sdl.h b/backends/platform/sdl/sdl.h
index c93c8308a7..1fe670c5c3 100644
--- a/backends/platform/sdl/sdl.h
+++ b/backends/platform/sdl/sdl.h
@@ -76,6 +76,7 @@ public:
virtual void getTimeAndDate(TimeDate &td) const;
virtual Audio::Mixer *getMixer();
virtual Common::TimerManager *getTimerManager();
+ virtual Common::SaveFileManager *getSavefileManager();
protected:
bool _inited;