From a6bcd207fcaaba50a1e76200b33cf9608756cc33 Mon Sep 17 00:00:00 2001 From: Alexander Tkachev Date: Wed, 31 Aug 2016 13:39:09 +0600 Subject: [PATCH] DC: Fix VMSaveManager * updateSavefilesList() stub; * openRawFile(); * Common::OutSaveFile in openForSaving(); * OutVMSave derived from WriteStream. --- backends/platform/dc/vmsave.cpp | 23 ++++++++++++++++++----- 1 file changed, 18 insertions(+), 5 deletions(-) diff --git a/backends/platform/dc/vmsave.cpp b/backends/platform/dc/vmsave.cpp index d896ba12997..5e8f50ca897 100644 --- a/backends/platform/dc/vmsave.cpp +++ b/backends/platform/dc/vmsave.cpp @@ -266,7 +266,7 @@ public: { return ::readSaveGame(buffer, _size, filename); } }; -class OutVMSave : public Common::OutSaveFile { +class OutVMSave : public Common::WriteStream { private: char *buffer; int _pos, size, committed; @@ -293,11 +293,24 @@ public: class VMSaveManager : public Common::SaveFileManager { public: + virtual void updateSavefilesList(Common::StringArray &lockedFiles) { + // TODO: implement this (locks files, preventing them from being listed, saved or loaded) + } - virtual Common::OutSaveFile *openForSaving(const Common::String &filename, bool compress = true) { - OutVMSave *s = new OutVMSave(filename.c_str()); - return compress ? Common::wrapCompressedWriteStream(s) : s; - } + virtual Common::InSaveFile *openRawFile(const Common::String &filename) { + InVMSave *s = new InVMSave(); + if (s->readSaveGame(filename.c_str())) { + return s; + } else { + delete s; + return NULL; + } + } + + virtual Common::OutSaveFile *openForSaving(const Common::String &filename, bool compress = true) { + OutVMSave *s = new OutVMSave(filename.c_str()); + return new Common::OutSaveFile(compress ? Common::wrapCompressedWriteStream(s) : s); + } virtual Common::InSaveFile *openForLoading(const Common::String &filename) { InVMSave *s = new InVMSave();