diff options
author | Max Horn | 2008-09-13 16:51:46 +0000 |
---|---|---|
committer | Max Horn | 2008-09-13 16:51:46 +0000 |
commit | 655ce26b3f09628d9408a4d82efe3a26116999fe (patch) | |
tree | 779a25dbe25c8f916fb385b3dd2d48e0e379d9ec /engines/scumm | |
parent | b86a047164b54c20366fcbe21b55bf63f2ced5f4 (diff) | |
download | scummvm-rg350-655ce26b3f09628d9408a4d82efe3a26116999fe.tar.gz scummvm-rg350-655ce26b3f09628d9408a4d82efe3a26116999fe.tar.bz2 scummvm-rg350-655ce26b3f09628d9408a4d82efe3a26116999fe.zip |
Big patch changing the signature of various Stream methods (some ports may need to be slightly tweaked to fix overloading errors/warnings)
svn-id: r34514
Diffstat (limited to 'engines/scumm')
-rw-r--r-- | engines/scumm/file.cpp | 16 | ||||
-rw-r--r-- | engines/scumm/file.h | 29 | ||||
-rw-r--r-- | engines/scumm/file_nes.cpp | 6 | ||||
-rw-r--r-- | engines/scumm/file_nes.h | 6 | ||||
-rw-r--r-- | engines/scumm/smush/chunk.cpp | 8 | ||||
-rw-r--r-- | engines/scumm/smush/chunk.h | 6 | ||||
-rw-r--r-- | engines/scumm/smush/smush_player.cpp | 2 | ||||
-rw-r--r-- | engines/scumm/smush/smush_player.h | 2 |
8 files changed, 38 insertions, 37 deletions
diff --git a/engines/scumm/file.cpp b/engines/scumm/file.cpp index 075b44d24d..22079332e4 100644 --- a/engines/scumm/file.cpp +++ b/engines/scumm/file.cpp @@ -42,9 +42,9 @@ void ScummFile::setEnc(byte value) { _encbyte = value; } -void ScummFile::setSubfileRange(uint32 start, uint32 len) { +void ScummFile::setSubfileRange(int32 start, int32 len) { // TODO: Add sanity checks - const uint32 fileSize = File::size(); + const int32 fileSize = File::size(); assert(start <= fileSize); assert(start + len <= fileSize); _subFileStart = start; @@ -129,15 +129,15 @@ bool ScummFile::eos() { return _subFileLen ? (pos() >= _subFileLen) : File::eos(); } -uint32 ScummFile::pos() { +int32 ScummFile::pos() { return File::pos() - _subFileStart; } -uint32 ScummFile::size() { +int32 ScummFile::size() { return _subFileLen ? _subFileLen : File::size(); } -void ScummFile::seek(int32 offs, int whence) { +bool ScummFile::seek(int32 offs, int whence) { if (_subFileLen) { // Constrain the seek to the subfile switch (whence) { @@ -154,7 +154,7 @@ void ScummFile::seek(int32 offs, int whence) { assert((int32)_subFileStart <= offs && offs <= (int32)(_subFileStart + _subFileLen)); whence = SEEK_SET; } - File::seek(offs, whence); + return File::seek(offs, whence); } uint32 ScummFile::read(void *dataPtr, uint32 dataSize) { @@ -162,9 +162,9 @@ uint32 ScummFile::read(void *dataPtr, uint32 dataSize) { if (_subFileLen) { // Limit the amount we read by the subfile boundaries. - const uint32 curPos = pos(); + const int32 curPos = pos(); assert(_subFileLen >= curPos); - uint32 newPos = curPos + dataSize; + int32 newPos = curPos + dataSize; if (newPos > _subFileLen) { dataSize = _subFileLen - curPos; _myIoFailed = true; diff --git a/engines/scumm/file.h b/engines/scumm/file.h index 3a044935a1..336f3cde12 100644 --- a/engines/scumm/file.h +++ b/engines/scumm/file.h @@ -40,25 +40,26 @@ public: virtual bool openSubFile(const Common::String &filename) = 0; virtual bool eos() = 0; - virtual uint32 pos() = 0; - virtual uint32 size() = 0; - virtual void seek(int32 offs, int whence = SEEK_SET) = 0; + virtual int32 pos() = 0; + virtual int32 size() = 0; + virtual bool seek(int32 offs, int whence = SEEK_SET) = 0; virtual uint32 read(void *dataPtr, uint32 dataSize) = 0; }; class ScummFile : public BaseScummFile { private: byte _encbyte; - uint32 _subFileStart; - uint32 _subFileLen; + int32 _subFileStart; + int32 _subFileLen; bool _myIoFailed; + + void setSubfileRange(int32 start, int32 len); + void resetSubfile(); + public: ScummFile(); void setEnc(byte value); - void setSubfileRange(uint32 start, uint32 len); - void resetSubfile(); - bool open(const Common::String &filename); bool openSubFile(const Common::String &filename); @@ -66,9 +67,9 @@ public: void clearIOFailed() { _myIoFailed = false; BaseScummFile::clearIOFailed(); } bool eos(); - uint32 pos(); - uint32 size(); - void seek(int32 offs, int whence = SEEK_SET); + int32 pos(); + int32 size(); + bool seek(int32 offs, int whence = SEEK_SET); uint32 read(void *dataPtr, uint32 dataSize); }; @@ -111,9 +112,9 @@ public: void close(); bool eos() { return _stream->eos(); } - uint32 pos() { return _stream->pos(); } - uint32 size() { return _stream->size(); } - void seek(int32 offs, int whence = SEEK_SET) { _stream->seek(offs, whence); } + int32 pos() { return _stream->pos(); } + int32 size() { return _stream->size(); } + bool seek(int32 offs, int whence = SEEK_SET) { return _stream->seek(offs, whence); } uint32 read(void *dataPtr, uint32 dataSize) { return _stream->read(dataPtr, dataSize); } }; diff --git a/engines/scumm/file_nes.cpp b/engines/scumm/file_nes.cpp index 8325436f87..0ddbd0b3ee 100644 --- a/engines/scumm/file_nes.cpp +++ b/engines/scumm/file_nes.cpp @@ -1124,8 +1124,7 @@ bool ScummNESFile::generateResource(int res) { write_byte(&out, 0xD1); write_byte(&out, 0xF5); - if (_stream) - delete _stream; + delete _stream; _stream = new Common::MemoryReadStream(_buf, bufsize); @@ -1221,8 +1220,7 @@ bool ScummNESFile::generateIndex() { for (i = 0; i < (int)sizeof(lfl_index); i++) write_byte(&out, ((byte *)&lfl_index)[i]); - if (_stream) - delete _stream; + delete _stream; _stream = new Common::MemoryReadStream(_buf, bufsize); diff --git a/engines/scumm/file_nes.h b/engines/scumm/file_nes.h index 3d7fd64ebe..f1a07f8085 100644 --- a/engines/scumm/file_nes.h +++ b/engines/scumm/file_nes.h @@ -69,9 +69,9 @@ public: void close(); bool eos() { return _stream->eos(); } - uint32 pos() { return _stream->pos(); } - uint32 size() { return _stream->size(); } - void seek(int32 offs, int whence = SEEK_SET) { _stream->seek(offs, whence); } + int32 pos() { return _stream->pos(); } + int32 size() { return _stream->size(); } + bool seek(int32 offs, int whence = SEEK_SET) { return _stream->seek(offs, whence); } uint32 read(void *dataPtr, uint32 dataSize) { return _stream->read(dataPtr, dataSize); } }; diff --git a/engines/scumm/smush/chunk.cpp b/engines/scumm/smush/chunk.cpp index 5e6f05b3e4..855f0a3985 100644 --- a/engines/scumm/smush/chunk.cpp +++ b/engines/scumm/smush/chunk.cpp @@ -45,7 +45,7 @@ bool BaseChunk::eos() const { return _curPos >= _size; } -uint32 BaseChunk::pos() const { +int32 BaseChunk::pos() const { return _curPos; } @@ -53,11 +53,11 @@ Chunk::type BaseChunk::getType() const { return _type; } -uint32 BaseChunk::size() const { +int32 BaseChunk::size() const { return _size; } -void BaseChunk::seek(int32 delta, int dir) { +bool BaseChunk::seek(int32 delta, int dir) { switch (dir) { case SEEK_CUR: _curPos += delta; @@ -85,6 +85,8 @@ void BaseChunk::seek(int32 delta, int dir) { warning("Looks like you compressed file %s in wrong way. It has FLU index which was not updated", _name.c_str()); error("invalid seek request : %d > %d (delta == %d)", _curPos, _size, delta); } + + return true; } FileChunk::FileChunk(BaseScummFile *data, int offset) { diff --git a/engines/scumm/smush/chunk.h b/engines/scumm/smush/chunk.h index ca4a3cdd99..08d7037d1c 100644 --- a/engines/scumm/smush/chunk.h +++ b/engines/scumm/smush/chunk.h @@ -55,10 +55,10 @@ protected: public: Chunk::type getType() const; - uint32 size() const; + int32 size() const; bool eos() const; - uint32 pos() const; - void seek(int32 delta, int dir); + int32 pos() const; + bool seek(int32 delta, int dir); }; class FileChunk : public BaseChunk { diff --git a/engines/scumm/smush/smush_player.cpp b/engines/scumm/smush/smush_player.cpp index e4d8393dbe..9100d95e5d 100644 --- a/engines/scumm/smush/smush_player.cpp +++ b/engines/scumm/smush/smush_player.cpp @@ -315,7 +315,7 @@ void SmushPlayer::release() { _codec47 = 0; } -void SmushPlayer::checkBlock(const Chunk &b, Chunk::type type_expected, uint32 min_size) { +void SmushPlayer::checkBlock(const Chunk &b, Chunk::type type_expected, int32 min_size) { if (type_expected != b.getType()) { error("Chunk type is different from expected : %x != %x", b.getType(), type_expected); } diff --git a/engines/scumm/smush/smush_player.h b/engines/scumm/smush/smush_player.h index 64ae167349..29a2397d58 100644 --- a/engines/scumm/smush/smush_player.h +++ b/engines/scumm/smush/smush_player.h @@ -121,7 +121,7 @@ private: bool readString(const char *file); void decodeFrameObject(int codec, const uint8 *src, int left, int top, int width, int height); - void checkBlock(const Chunk &, Chunk::type, uint32 = 0); + void checkBlock(const Chunk &, Chunk::type, int32 = 0); void handleAnimHeader(Chunk &); void handleFrame(Chunk &); void handleNewPalette(Chunk &); |