diff options
Diffstat (limited to 'engines')
-rw-r--r-- | engines/tinsel/drives.cpp | 57 | ||||
-rw-r--r-- | engines/tinsel/drives.h | 29 |
2 files changed, 73 insertions, 13 deletions
diff --git a/engines/tinsel/drives.cpp b/engines/tinsel/drives.cpp index 58d0978426..06b4968e8b 100644 --- a/engines/tinsel/drives.cpp +++ b/engines/tinsel/drives.cpp @@ -25,6 +25,7 @@ */ #include "common/config-manager.h" +#include "common/substream.h" #include "gui/message.h" #include "tinsel/drives.h" #include "tinsel/scene.h" @@ -200,4 +201,60 @@ void TinselFile::close() { _stream = NULL; } +int32 TinselFile::pos() const { + assert(_stream); + return _stream->pos(); +} + +int32 TinselFile::size() const { + assert(_stream); + return _stream->size(); +} + +bool TinselFile::seek(int32 offset, int whence) { + assert(_stream); + return _stream->seek(offset, whence); +} + +bool TinselFile::eos() const { + assert(_stream); + return _stream->eos(); +} + +bool TinselFile::err() const { + assert(_stream); + return _stream->err(); +} + +uint32 TinselFile::readUint32() { + assert(_stream); + return _stream->readUint32(); +} + +int16 TinselFile::readSint16() { + assert(_stream); + return _stream->readUint16(); +} + +int32 TinselFile::readSint32() { + assert(_stream); + return _stream->readUint32(); +} + +Common::SeekableReadStream *TinselFile::readStream(uint32 dataSize) { + assert(_stream); + return _stream->readStream(dataSize); +} + +uint32 TinselFile::read(void *dataPtr, uint32 dataSize) { + assert(_stream); + return _stream->read(dataPtr, dataSize); +} + +bool TinselFile::skip(uint32 offset) { + return seek(offset, SEEK_CUR); +} + + + } // End of namespace Tinsel diff --git a/engines/tinsel/drives.h b/engines/tinsel/drives.h index 061dae625f..de9d706091 100644 --- a/engines/tinsel/drives.h +++ b/engines/tinsel/drives.h @@ -27,12 +27,14 @@ #ifndef TINSEL_DRIVES_H #define TINSEL_DRIVES_H -#include "common/memstream.h" -#include "common/substream.h" #include "common/file.h" #include "tinsel/dw.h" #include "tinsel/coroutine.h" +namespace Common { +class SeekableSubReadStreamEndian; +} + namespace Tinsel { // flags2 @@ -61,6 +63,7 @@ void SetNextCD(int cdNumber); bool GotoCD(); +// TODO: Make TinselFile a SeekableReadStream subclass?? class TinselFile { private: static bool _warningShown; @@ -73,17 +76,17 @@ public: void close(); char getCdNumber(); - FORCEINLINE int32 pos() const { assert(_stream); return _stream->pos(); } - FORCEINLINE int32 size() const { assert(_stream); return _stream->size(); } - FORCEINLINE bool seek(int32 offset, int whence = SEEK_SET) { assert(_stream); return _stream->seek(offset, whence); } - FORCEINLINE bool eos() const { assert(_stream); return _stream->eos(); } - FORCEINLINE bool err() const { return _stream->err(); } - FORCEINLINE uint32 readUint32() { assert(_stream); return _stream->readUint32(); } - FORCEINLINE int16 readSint16() { assert(_stream); return _stream->readUint16(); } - FORCEINLINE int32 readSint32() { assert(_stream); return _stream->readUint32(); } - FORCEINLINE Common::SeekableReadStream *readStream(uint32 dataSize) { assert(_stream); return _stream->readStream(dataSize); } - FORCEINLINE uint32 read(void *dataPtr, uint32 dataSize) { assert(_stream); return _stream->read(dataPtr, dataSize); } - FORCEINLINE bool skip(uint32 offset) { return seek(offset, SEEK_CUR); } + int32 pos() const; + int32 size() const; + bool seek(int32 offset, int whence = SEEK_SET); + bool eos() const; + bool err() const; + uint32 readUint32(); + int16 readSint16(); + int32 readSint32(); + Common::SeekableReadStream *readStream(uint32 dataSize); + uint32 read(void *dataPtr, uint32 dataSize); + bool skip(uint32 offset); }; |