diff options
Diffstat (limited to 'backends/platform/n64')
-rw-r--r-- | backends/platform/n64/framfs_save_manager.h | 22 | ||||
-rw-r--r-- | backends/platform/n64/pakfs_save_manager.h | 23 |
2 files changed, 41 insertions, 4 deletions
diff --git a/backends/platform/n64/framfs_save_manager.h b/backends/platform/n64/framfs_save_manager.h index a066854aab..24f9bf10ce 100644 --- a/backends/platform/n64/framfs_save_manager.h +++ b/backends/platform/n64/framfs_save_manager.h @@ -65,12 +65,15 @@ public: } }; -class OutFRAMSave : public Common::OutSaveFile { +class OutFRAMSave : public Common::WriteStream { private: FRAMFILE *fd; 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"); @@ -99,11 +102,26 @@ public: class FRAMSaveManager : public Common::SaveFileManager { public: + virtual void updateSavefilesList(Common::StringArray &lockedFiles) { + // this method is used to lock saves while cloud syncing + // as there is no network on N64, this method wouldn't be used + // thus it's not implemtented + } + + virtual Common::InSaveFile *openRawFile(const Common::String &filename) { + InFRAMSave *s = new InFRAMSave(); + if (s->readSaveGame(filename.c_str())) { + return s; + } else { + delete s; + return 0; + } + } virtual Common::OutSaveFile *openForSaving(const Common::String &filename, bool compress = true) { OutFRAMSave *s = new OutFRAMSave(filename.c_str()); if (!s->err()) { - return compress ? Common::wrapCompressedWriteStream(s) : s; + return new Common::OutSaveFile(compress ? Common::wrapCompressedWriteStream(s) : s); } else { delete s; return 0; diff --git a/backends/platform/n64/pakfs_save_manager.h b/backends/platform/n64/pakfs_save_manager.h index ec66c80b73..8e16d1fce4 100644 --- a/backends/platform/n64/pakfs_save_manager.h +++ b/backends/platform/n64/pakfs_save_manager.h @@ -65,13 +65,17 @@ public: } }; -class OutPAKSave : public Common::OutSaveFile { +class OutPAKSave : public Common::WriteStream { private: PAKFILE *fd; 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"); } @@ -100,11 +104,26 @@ public: class PAKSaveManager : public Common::SaveFileManager { public: + virtual void updateSavefilesList(Common::StringArray &lockedFiles) { + // this method is used to lock saves while cloud syncing + // as there is no network on N64, this method wouldn't be used + // thus it's not implemtented + } + + virtual Common::InSaveFile *openRawFile(const Common::String &filename) { + InPAKSave *s = new InPAKSave(); + if (s->readSaveGame(filename.c_str())) { + return s; + } else { + delete s; + return NULL; + } + } virtual Common::OutSaveFile *openForSaving(const Common::String &filename, bool compress = true) { OutPAKSave *s = new OutPAKSave(filename.c_str()); if (!s->err()) { - return compress ? Common::wrapCompressedWriteStream(s) : s; + return new Common::OutSaveFile(compress ? Common::wrapCompressedWriteStream(s) : s); } else { delete s; return NULL; |