DC: Fix VMSaveManager

* updateSavefilesList() stub;
* openRawFile();
* Common::OutSaveFile in openForSaving();
* OutVMSave derived from WriteStream.
This commit is contained in:
Alexander Tkachev 2016-08-31 13:39:09 +06:00
parent 7f913c831d
commit a6bcd207fc

View file

@ -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,10 +293,23 @@ 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::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 compress ? Common::wrapCompressedWriteStream(s) : s;
return new Common::OutSaveFile(compress ? Common::wrapCompressedWriteStream(s) : s);
}
virtual Common::InSaveFile *openForLoading(const Common::String &filename) {