diff options
author | Paul Gilbert | 2018-11-03 18:46:44 -0700 |
---|---|---|
committer | Paul Gilbert | 2018-12-08 19:05:59 -0800 |
commit | db112fc9f02e2a49b47a62d85f4920332b285728 (patch) | |
tree | 5ef02362dbfbc26d73dd93b728131d875e02734f /engines/gargoyle/streams.h | |
parent | 60146c383d4b69920c6ba326611f9de66a513529 (diff) | |
download | scummvm-rg350-db112fc9f02e2a49b47a62d85f4920332b285728.tar.gz scummvm-rg350-db112fc9f02e2a49b47a62d85f4920332b285728.tar.bz2 scummvm-rg350-db112fc9f02e2a49b47a62d85f4920332b285728.zip |
GLK: Adding file stream opening and closing
Diffstat (limited to 'engines/gargoyle/streams.h')
-rw-r--r-- | engines/gargoyle/streams.h | 50 |
1 files changed, 44 insertions, 6 deletions
diff --git a/engines/gargoyle/streams.h b/engines/gargoyle/streams.h index 264190cc76..517192af3f 100644 --- a/engines/gargoyle/streams.h +++ b/engines/gargoyle/streams.h @@ -24,12 +24,15 @@ #define GARGOYLE_STREAMS_H #include "common/scummsys.h" +#include "common/file.h" #include "common/savefile.h" -#include "gargoyle/files.h" +#include "common/str.h" #include "gargoyle/glk_types.h" namespace Gargoyle { +#define SAVEGAME_VERSION 1 + class Window; class Streams; @@ -63,6 +66,19 @@ struct StreamResult { }; typedef StreamResult stream_result_t; +struct SavegameHeader { + uint8 _version; + Common::String _saveName; + int _year, _month, _day; + int _hour, _minute; + int _totalFrames; + + /** + * Constructor + */ + SavegameHeader() : _version(0), _year(0), _month(0), _day(0), _hour(0), + _minute(0), _totalFrames(0) {} +}; /** * File details @@ -326,8 +342,10 @@ public: */ class FileStream : public Stream { private: + Common::File _file; Common::OutSaveFile *_outFile; Common::InSaveFile *_inFile; + Common::SeekableReadStream *_inStream; uint32 _lastOp; ///< 0, filemode_Write, or filemode_Read bool _textFile; private: @@ -347,9 +365,24 @@ private: glsi32 getCharUtf8(); public: /** + * Read a savegame header from a stream + */ + static bool readSavegameHeader(Common::SeekableReadStream *stream, SavegameHeader &header); + + /** + * Write out a savegame header + */ + static void writeSavegameHeader(Common::WriteStream *stream, const Common::String &saveName); +public: + /** * Constructor */ - FileStream(Streams *streams, uint32 rock = 0, bool unicode = true); + FileStream(Streams *streams, frefid_t fref, glui32 fmode, glui32 rock, bool unicode); + + /** + * Destructor + */ + virtual ~FileStream(); /** * Write a character @@ -427,14 +460,19 @@ public: ~Streams(); /** - * Add a window stream + * Open a file stream + */ + FileStream *openFileStream(frefid_t fref, glui32 fmode, glui32 rock, bool unicode); + + /** + * Open a window stream */ - WindowStream *addWindowStream(Window *window); + WindowStream *openWindowStream(Window *window); /** - * Add a memory stream + * Open a memory stream */ - MemoryStream *addMemoryStream(void *buf, size_t buflen, FileMode mode, uint32 rock = 0, bool unicode = true); + MemoryStream *openMemoryStream(void *buf, size_t buflen, FileMode mode, uint32 rock = 0, bool unicode = true); /** * Delete a stream |