diff options
Diffstat (limited to 'engines/xeen/files.h')
-rw-r--r-- | engines/xeen/files.h | 39 |
1 files changed, 37 insertions, 2 deletions
diff --git a/engines/xeen/files.h b/engines/xeen/files.h index b528658566..086bb00f27 100644 --- a/engines/xeen/files.h +++ b/engines/xeen/files.h @@ -62,10 +62,11 @@ class SavesManager; */ struct CCEntry { uint16 _id; - uint32 _offset; + int _offset; uint16 _size; + int _writeOffset; - CCEntry() : _id(0), _offset(0), _size(0) {} + CCEntry() : _id(0), _offset(0), _size(0), _writeOffset(0) {} CCEntry(uint16 id, uint32 offset, uint32 size) : _id(id), _offset(offset), _size(size) { } @@ -93,6 +94,16 @@ public: * @param ccMode 0=Clouds, 1=Dark Side */ void setGameCc(int ccMode); + + /** + * Loads a save archive from a stream + */ + void load(Common::SeekableReadStream &stream); + + /** + * Saves a save archive to a savegame + */ + void save(Common::WriteStream &s); }; /** @@ -175,6 +186,30 @@ public: static bool exists(const Common::String &filename, int ccMode); }; +/** + * SubWriteStream provides a way of compartmentalizing writing to a subsection of + * a file. This is primarily useful for the pos() function which can, for example, + * be used in asserts to ensure writing is being done at the correct offset within + * the bounds of the structure being written. +*/ +class SubWriteStream : virtual public Common::WriteStream { +protected: + Common::WriteStream *_parentStream; + uint32 _begin; + DisposeAfterUse::Flag _disposeAfterUse; +public: + SubWriteStream(Common::WriteStream *parentStream) : + _parentStream(parentStream), _begin(parentStream->pos()) { + } + + virtual uint32 write(const void *dataPtr, uint32 dataSize) { + return _parentStream->write(dataPtr, dataSize); + } + virtual bool flush() { return _parentStream->flush(); } + virtual void finalize() {} + virtual int32 pos() const { return _parentStream->pos() - _begin; } +}; + class StringArray : public Common::StringArray { public: StringArray() {} |