COMMON: Increase Stream pos, seek, size from int32 to int64
This commit is contained in:
parent
956f53fd22
commit
005561d305
104 changed files with 291 additions and 276 deletions
|
@ -375,7 +375,7 @@ ASFStream::Packet *ASFStream::readPacket() {
|
|||
_curPacket++;
|
||||
|
||||
if ((uint32)_stream->pos() != packetStartPos + _maxPacketSize)
|
||||
error("ASFStream::readPacket(): Mismatching packet pos: %d (should be %d)", _stream->pos(), _maxPacketSize + packetStartPos);
|
||||
error("ASFStream::readPacket(): Mismatching packet pos: %d (should be %d)", (int)_stream->pos(), _maxPacketSize + packetStartPos);
|
||||
|
||||
return packet;
|
||||
}
|
||||
|
|
|
@ -50,9 +50,9 @@ public:
|
|||
virtual uint32 write(const void *dataPtr, uint32 dataSize);
|
||||
virtual bool flush();
|
||||
|
||||
virtual int32 pos() const;
|
||||
virtual int32 size() const;
|
||||
virtual bool seek(int32 offs, int whence = SEEK_SET);
|
||||
virtual int64 pos() const;
|
||||
virtual int64 size() const;
|
||||
virtual bool seek(int64 offs, int whence = SEEK_SET);
|
||||
virtual uint32 read(void *dataPtr, uint32 dataSize);
|
||||
};
|
||||
|
||||
|
|
|
@ -106,7 +106,7 @@ PosixIoStream::PosixIoStream(void *handle) :
|
|||
#endif // ANDROID_PLAIN_PORT
|
||||
}
|
||||
|
||||
int32 PosixIoStream::size() const {
|
||||
int64 PosixIoStream::size() const {
|
||||
int fd = fileno((FILE *)_handle);
|
||||
if (fd == -1) {
|
||||
return StdioStream::size();
|
||||
|
|
|
@ -42,7 +42,7 @@ public:
|
|||
~PosixIoStream();
|
||||
#endif
|
||||
|
||||
int32 size() const override;
|
||||
int64 size() const override;
|
||||
};
|
||||
|
||||
#endif
|
||||
|
|
|
@ -78,9 +78,9 @@ public:
|
|||
virtual uint32 write(const void *dataPtr, uint32 dataSize);
|
||||
virtual bool flush();
|
||||
|
||||
virtual int32 pos() const;
|
||||
virtual int32 size() const;
|
||||
virtual bool seek(int32 offs, int whence = SEEK_SET);
|
||||
virtual int64 pos() const;
|
||||
virtual int64 size() const;
|
||||
virtual bool seek(int64 offs, int whence = SEEK_SET);
|
||||
virtual uint32 read(void *dataPtr, uint32 dataSize);
|
||||
|
||||
// for suspending
|
||||
|
|
|
@ -54,21 +54,36 @@ bool StdioStream::eos() const {
|
|||
return feof((FILE *)_handle) != 0;
|
||||
}
|
||||
|
||||
int32 StdioStream::pos() const {
|
||||
int64 StdioStream::pos() const {
|
||||
#if defined(WIN32)
|
||||
return _ftelli64((FILE *)_handle);
|
||||
#else
|
||||
return ftell((FILE *)_handle);
|
||||
#endif
|
||||
}
|
||||
|
||||
int32 StdioStream::size() const {
|
||||
int32 oldPos = ftell((FILE *)_handle);
|
||||
int64 StdioStream::size() const {
|
||||
#if defined(WIN32)
|
||||
int64 oldPos = _ftelli64((FILE *)_handle);
|
||||
_fseeki64((FILE *)_handle, 0, SEEK_END);
|
||||
int64 length = _ftelli64((FILE *)_handle);
|
||||
_fseeki64((FILE *)_handle, oldPos, SEEK_SET);
|
||||
#else
|
||||
int64 oldPos = ftell((FILE *)_handle);
|
||||
fseek((FILE *)_handle, 0, SEEK_END);
|
||||
int32 length = ftell((FILE *)_handle);
|
||||
int64 length = ftell((FILE *)_handle);
|
||||
fseek((FILE *)_handle, oldPos, SEEK_SET);
|
||||
#endif
|
||||
|
||||
return length;
|
||||
}
|
||||
|
||||
bool StdioStream::seek(int32 offs, int whence) {
|
||||
bool StdioStream::seek(int64 offs, int whence) {
|
||||
#if defined(WIN32)
|
||||
return _fseeki64((FILE *)_handle, offs, whence) == 0;
|
||||
#else
|
||||
return fseek((FILE *)_handle, offs, whence) == 0;
|
||||
#endif
|
||||
}
|
||||
|
||||
uint32 StdioStream::read(void *ptr, uint32 len) {
|
||||
|
|
|
@ -50,9 +50,9 @@ public:
|
|||
uint32 write(const void *dataPtr, uint32 dataSize) override;
|
||||
bool flush() override;
|
||||
|
||||
int32 pos() const override;
|
||||
int32 size() const override;
|
||||
bool seek(int32 offs, int whence = SEEK_SET) override;
|
||||
int64 pos() const override;
|
||||
int64 size() const override;
|
||||
bool seek(int64 offs, int whence = SEEK_SET) override;
|
||||
uint32 read(void *dataPtr, uint32 dataSize) override;
|
||||
|
||||
/**
|
||||
|
|
|
@ -50,9 +50,9 @@ public:
|
|||
virtual uint32 write(const void *dataPtr, uint32 dataSize);
|
||||
virtual bool flush();
|
||||
|
||||
virtual int32 pos() const;
|
||||
virtual int32 size() const;
|
||||
bool seek(int32 offs, int whence = SEEK_SET);
|
||||
virtual int64 pos() const;
|
||||
virtual int64 size() const;
|
||||
bool seek(int64 offs, int whence = SEEK_SET);
|
||||
uint32 read(void *dataPtr, uint32 dataSize);
|
||||
};
|
||||
|
||||
|
|
|
@ -49,11 +49,11 @@ public:
|
|||
|
||||
virtual uint32 read(void *dataPtr, uint32 dataSize);
|
||||
|
||||
virtual int32 pos() const { return _pos; }
|
||||
virtual int64 pos() const { return _pos; }
|
||||
|
||||
virtual int32 size() const { return _len; }
|
||||
virtual int64 size() const { return _len; }
|
||||
|
||||
virtual bool seek(int32 offset, int whence = SEEK_SET);
|
||||
virtual bool seek(int64 offset, int whence = SEEK_SET);
|
||||
|
||||
private:
|
||||
void close();
|
||||
|
|
|
@ -245,7 +245,7 @@ private:
|
|||
|
||||
uint32 read(void *buf, uint32 cnt) override;
|
||||
bool skip(uint32 offset) override;
|
||||
bool seek(int32 offs, int whence) override;
|
||||
bool seek(int64 offs, int whence) override;
|
||||
|
||||
public:
|
||||
InVMSave()
|
||||
|
@ -259,8 +259,8 @@ public:
|
|||
|
||||
bool eos() const override { return _eos; }
|
||||
void clearErr() override { _eos = false; }
|
||||
int32 pos() const override { return _pos; }
|
||||
int32 size() const override { return _size; }
|
||||
int64 pos() const override { return _pos; }
|
||||
int64 size() const override { return _size; }
|
||||
|
||||
bool readSaveGame(const char *filename)
|
||||
{ return ::readSaveGame(buffer, _size, filename); }
|
||||
|
@ -275,7 +275,7 @@ private:
|
|||
|
||||
public:
|
||||
uint32 write(const void *buf, uint32 cnt);
|
||||
virtual int32 pos() const { return _pos; }
|
||||
virtual int64 pos() const { return _pos; }
|
||||
|
||||
OutVMSave(const char *_filename)
|
||||
: _pos(0), committed(-1), iofailed(false)
|
||||
|
|
|
@ -36,7 +36,7 @@ private:
|
|||
|
||||
uint32 read(void *buf, uint32 cnt) override;
|
||||
bool skip(uint32 offset) override;
|
||||
bool seek(int32 offs, int whence) override;
|
||||
bool seek(int64 offs, int whence) override;
|
||||
|
||||
public:
|
||||
InFRAMSave() : fd(NULL) { }
|
||||
|
@ -52,10 +52,10 @@ public:
|
|||
void clearErr() override {
|
||||
framfs_clearerr(fd);
|
||||
}
|
||||
int32 pos() const override {
|
||||
int64 pos() const override {
|
||||
return framfs_tell(fd);
|
||||
}
|
||||
int32 size() const override {
|
||||
int64 size() const override {
|
||||
return fd->size;
|
||||
}
|
||||
|
||||
|
@ -71,7 +71,7 @@ private:
|
|||
|
||||
public:
|
||||
uint32 write(const void *buf, uint32 cnt);
|
||||
virtual int32 pos() const {
|
||||
virtual int64 pos() const {
|
||||
return framfs_tell(fd);
|
||||
}
|
||||
|
||||
|
|
|
@ -36,7 +36,7 @@ private:
|
|||
|
||||
uint32 read(void *buf, uint32 cnt) override;
|
||||
bool skip(uint32 offset) override;
|
||||
bool seek(int32 offs, int whence) override;
|
||||
bool seek(int64 offs, int whence) override;
|
||||
|
||||
public:
|
||||
InPAKSave() : fd(NULL) { }
|
||||
|
@ -52,10 +52,10 @@ public:
|
|||
void clearErr() override {
|
||||
pakfs_clearerr(fd);
|
||||
}
|
||||
int32 pos() const override {
|
||||
int64 pos() const override {
|
||||
return pakfs_tell(fd);
|
||||
}
|
||||
int32 size() const override {
|
||||
int64 size() const override {
|
||||
return fd->size;
|
||||
}
|
||||
|
||||
|
@ -72,7 +72,7 @@ private:
|
|||
public:
|
||||
uint32 write(const void *buf, uint32 cnt);
|
||||
|
||||
virtual int32 pos() const {
|
||||
virtual int64 pos() const {
|
||||
return pakfs_tell(fd);
|
||||
}
|
||||
|
||||
|
|
|
@ -52,7 +52,7 @@ uint32 OutSaveFile::write(const void *dataPtr, uint32 dataSize) {
|
|||
return _wrapped->write(dataPtr, dataSize);
|
||||
}
|
||||
|
||||
int32 OutSaveFile::pos() const {
|
||||
int64 OutSaveFile::pos() const {
|
||||
return _wrapped->pos();
|
||||
}
|
||||
|
||||
|
|
|
@ -265,12 +265,12 @@ public:
|
|||
}
|
||||
|
||||
/** Return the stream position in bits. */
|
||||
uint32 pos() const {
|
||||
uint64 pos() const {
|
||||
return _pos;
|
||||
}
|
||||
|
||||
/** Return the stream size in bits. */
|
||||
uint32 size() const {
|
||||
uint64 size() const {
|
||||
return _size;
|
||||
}
|
||||
|
||||
|
@ -325,11 +325,11 @@ public:
|
|||
return false;
|
||||
}
|
||||
|
||||
int32 pos() const {
|
||||
int64 pos() const {
|
||||
return _pos;
|
||||
}
|
||||
|
||||
int32 size() const {
|
||||
int64 size() const {
|
||||
return _size;
|
||||
}
|
||||
|
||||
|
|
|
@ -123,17 +123,17 @@ bool File::eos() const {
|
|||
return _handle->eos();
|
||||
}
|
||||
|
||||
int32 File::pos() const {
|
||||
int64 File::pos() const {
|
||||
assert(_handle);
|
||||
return _handle->pos();
|
||||
}
|
||||
|
||||
int32 File::size() const {
|
||||
int64 File::size() const {
|
||||
assert(_handle);
|
||||
return _handle->size();
|
||||
}
|
||||
|
||||
bool File::seek(int32 offs, int whence) {
|
||||
bool File::seek(int64 offs, int whence) {
|
||||
assert(_handle);
|
||||
return _handle->seek(offs, whence);
|
||||
}
|
||||
|
@ -221,14 +221,14 @@ bool DumpFile::flush() {
|
|||
return _handle->flush();
|
||||
}
|
||||
|
||||
int32 DumpFile::pos() const { return _handle->pos(); }
|
||||
int64 DumpFile::pos() const { return _handle->pos(); }
|
||||
|
||||
bool DumpFile::seek(int32 offset, int whence) {
|
||||
bool DumpFile::seek(int64 offset, int whence) {
|
||||
SeekableWriteStream *ws = dynamic_cast<SeekableWriteStream *>(_handle);
|
||||
return ws ? ws->seek(offset, whence) : false;
|
||||
}
|
||||
|
||||
int32 DumpFile::size() const {
|
||||
int64 DumpFile::size() const {
|
||||
SeekableWriteStream *ws = dynamic_cast<SeekableWriteStream *>(_handle);
|
||||
return ws ? ws->size() : -1;
|
||||
}
|
||||
|
|
|
@ -130,9 +130,9 @@ public:
|
|||
void clearErr() override; /*!< Implement abstract Stream method. */
|
||||
bool eos() const override; /*!< Implement abstract SeekableReadStream method. */
|
||||
|
||||
int32 pos() const override; /*!< Implement abstract SeekableReadStream method. */
|
||||
int32 size() const override; /*!< Implement abstract SeekableReadStream method. */
|
||||
bool seek(int32 offs, int whence = SEEK_SET) override; /*!< Implement abstract SeekableReadStream method. */
|
||||
int64 pos() const override; /*!< Implement abstract SeekableReadStream method. */
|
||||
int64 size() const override; /*!< Implement abstract SeekableReadStream method. */
|
||||
bool seek(int64 offs, int whence = SEEK_SET) override; /*!< Implement abstract SeekableReadStream method. */
|
||||
uint32 read(void *dataPtr, uint32 dataSize) override; /*!< Implement abstract SeekableReadStream method. */
|
||||
};
|
||||
|
||||
|
@ -171,10 +171,10 @@ public:
|
|||
|
||||
virtual bool flush() override;
|
||||
|
||||
virtual int32 pos() const override;
|
||||
virtual int64 pos() const override;
|
||||
|
||||
virtual bool seek(int32 offset, int whence = SEEK_SET) override;
|
||||
virtual int32 size() const override;
|
||||
virtual bool seek(int64 offset, int whence = SEEK_SET) override;
|
||||
virtual int64 size() const override;
|
||||
};
|
||||
|
||||
/** @} */
|
||||
|
|
|
@ -75,10 +75,10 @@ public:
|
|||
bool eos() const { return _eos; }
|
||||
void clearErr() { _eos = false; }
|
||||
|
||||
int32 pos() const { return _pos; }
|
||||
int32 size() const { return _size; }
|
||||
int64 pos() const { return _pos; }
|
||||
int64 size() const { return _size; }
|
||||
|
||||
bool seek(int32 offs, int whence = SEEK_SET);
|
||||
bool seek(int64 offs, int whence = SEEK_SET);
|
||||
};
|
||||
|
||||
|
||||
|
@ -91,10 +91,10 @@ public:
|
|||
MemoryReadStreamEndian(const byte *buf, uint32 len, bool bigEndian, DisposeAfterUse::Flag disposeMemory = DisposeAfterUse::NO)
|
||||
: MemoryReadStream(buf, len, disposeMemory), SeekableReadStreamEndian(bigEndian), ReadStreamEndian(bigEndian) {}
|
||||
|
||||
int32 pos() const override { return MemoryReadStream::pos(); }
|
||||
int32 size() const override { return MemoryReadStream::size(); }
|
||||
int64 pos() const override { return MemoryReadStream::pos(); }
|
||||
int64 size() const override { return MemoryReadStream::size(); }
|
||||
|
||||
bool seek(int32 offs, int whence = SEEK_SET) override { return MemoryReadStream::seek(offs, whence); }
|
||||
bool seek(int64 offs, int whence = SEEK_SET) override { return MemoryReadStream::seek(offs, whence); }
|
||||
|
||||
bool skip(uint32 offset) override { return MemoryReadStream::seek(offset, SEEK_CUR); }
|
||||
};
|
||||
|
@ -126,13 +126,13 @@ public:
|
|||
return dataSize;
|
||||
}
|
||||
|
||||
virtual int32 pos() const override { return _pos; }
|
||||
virtual int32 size() const override { return _bufSize; }
|
||||
virtual int64 pos() const override { return _pos; }
|
||||
virtual int64 size() const override { return _bufSize; }
|
||||
|
||||
virtual bool err() const override { return _err; }
|
||||
virtual void clearErr() override { _err = false; }
|
||||
|
||||
virtual bool seek(int32 offset, int whence = SEEK_SET) override { return false; }
|
||||
virtual bool seek(int64 offset, int whence = SEEK_SET) override { return false; }
|
||||
};
|
||||
|
||||
/**
|
||||
|
@ -144,7 +144,7 @@ private:
|
|||
public:
|
||||
SeekableMemoryWriteStream(byte *buf, uint32 len) : MemoryWriteStream(buf, len), _ptrOrig(buf) {}
|
||||
|
||||
virtual bool seek(int32 offset, int whence = SEEK_SET) override {
|
||||
virtual bool seek(int64 offset, int whence = SEEK_SET) override {
|
||||
switch (whence) {
|
||||
case SEEK_END:
|
||||
// SEEK_END works just like SEEK_SET, only 'reversed',
|
||||
|
@ -222,12 +222,12 @@ public:
|
|||
return dataSize;
|
||||
}
|
||||
|
||||
virtual int32 pos() const override { return _pos; }
|
||||
virtual int32 size() const override { return _size; }
|
||||
virtual int64 pos() const override { return _pos; }
|
||||
virtual int64 size() const override { return _size; }
|
||||
|
||||
byte *getData() { return _data; }
|
||||
|
||||
virtual bool seek(int32 offs, int whence = SEEK_SET) override {
|
||||
virtual bool seek(int64 offs, int whence = SEEK_SET) override {
|
||||
// Pre-Condition
|
||||
assert(_pos <= _size);
|
||||
switch (whence) {
|
||||
|
@ -333,9 +333,9 @@ public:
|
|||
return dataSize;
|
||||
}
|
||||
|
||||
virtual int32 pos() const override { return _pos - _length; }
|
||||
virtual int32 size() const override { return _size; }
|
||||
virtual bool seek(int32, int) override { return false; }
|
||||
virtual int64 pos() const override { return _pos - _length; }
|
||||
virtual int64 size() const override { return _size; }
|
||||
virtual bool seek(int64, int) override { return false; }
|
||||
virtual bool eos() const override { return _eos; }
|
||||
virtual void clearErr() override { _eos = false; }
|
||||
|
||||
|
@ -378,8 +378,8 @@ public:
|
|||
return dataSize;
|
||||
}
|
||||
|
||||
int32 pos() const override { return _pos; }
|
||||
int32 size() const override { return _bufSize; }
|
||||
int64 pos() const override { return _pos; }
|
||||
int64 size() const override { return _bufSize; }
|
||||
|
||||
bool eos() const override { return _eos; }
|
||||
|
||||
|
@ -412,7 +412,7 @@ public:
|
|||
return dataSize;
|
||||
}
|
||||
|
||||
bool seek(int32 offset, int whence = SEEK_SET) override {
|
||||
bool seek(int64 offset, int whence = SEEK_SET) override {
|
||||
switch (whence) {
|
||||
case SEEK_END:
|
||||
// SEEK_END works just like SEEK_SET, only 'reversed',
|
||||
|
|
|
@ -106,7 +106,7 @@ public:
|
|||
*
|
||||
* @return The current position indicator, or -1 if an error occurred.
|
||||
*/
|
||||
virtual int32 pos() const;
|
||||
virtual int64 pos() const;
|
||||
};
|
||||
|
||||
/**
|
||||
|
|
|
@ -108,7 +108,7 @@ uint32 MemoryReadStream::read(void *dataPtr, uint32 dataSize) {
|
|||
return dataSize;
|
||||
}
|
||||
|
||||
bool MemoryReadStream::seek(int32 offs, int whence) {
|
||||
bool MemoryReadStream::seek(int64 offs, int whence) {
|
||||
// Pre-Condition
|
||||
assert(_pos <= _size);
|
||||
switch (whence) {
|
||||
|
@ -245,7 +245,7 @@ SeekableSubReadStream::SeekableSubReadStream(SeekableReadStream *parentStream, u
|
|||
_eos = false;
|
||||
}
|
||||
|
||||
bool SeekableSubReadStream::seek(int32 offset, int whence) {
|
||||
bool SeekableSubReadStream::seek(int64 offset, int whence) {
|
||||
assert(_pos >= _begin);
|
||||
assert(_pos <= _end);
|
||||
|
||||
|
@ -416,10 +416,10 @@ protected:
|
|||
public:
|
||||
BufferedSeekableReadStream(SeekableReadStream *parentStream, uint32 bufSize, DisposeAfterUse::Flag disposeParentStream = DisposeAfterUse::NO);
|
||||
|
||||
virtual int32 pos() const { return _parentStream->pos() - (_bufSize - _pos); }
|
||||
virtual int32 size() const { return _parentStream->size(); }
|
||||
virtual int64 pos() const { return _parentStream->pos() - (_bufSize - _pos); }
|
||||
virtual int64 size() const { return _parentStream->size(); }
|
||||
|
||||
virtual bool seek(int32 offset, int whence = SEEK_SET);
|
||||
virtual bool seek(int64 offset, int whence = SEEK_SET);
|
||||
};
|
||||
|
||||
BufferedSeekableReadStream::BufferedSeekableReadStream(SeekableReadStream *parentStream, uint32 bufSize, DisposeAfterUse::Flag disposeParentStream)
|
||||
|
@ -427,7 +427,7 @@ BufferedSeekableReadStream::BufferedSeekableReadStream(SeekableReadStream *paren
|
|||
_parentStream(parentStream) {
|
||||
}
|
||||
|
||||
bool BufferedSeekableReadStream::seek(int32 offset, int whence) {
|
||||
bool BufferedSeekableReadStream::seek(int64 offset, int whence) {
|
||||
// If it is a "local" seek, we may get away with "seeking" around
|
||||
// in the buffer only.
|
||||
_eos = false; // seeking always cancels EOS
|
||||
|
@ -551,7 +551,7 @@ public:
|
|||
|
||||
virtual bool flush() { return flushBuffer(); }
|
||||
|
||||
virtual int32 pos() const { return _pos; }
|
||||
virtual int64 pos() const { return _pos; }
|
||||
|
||||
};
|
||||
|
||||
|
|
|
@ -123,7 +123,7 @@ public:
|
|||
*
|
||||
* @return The current position indicator, or -1 if an error occurred.
|
||||
*/
|
||||
virtual int32 pos() const = 0;
|
||||
virtual int64 pos() const = 0;
|
||||
|
||||
/**
|
||||
* @name Functions for writing data
|
||||
|
@ -320,7 +320,7 @@ public:
|
|||
*
|
||||
* @return True on success, false in case of a failure.
|
||||
*/
|
||||
virtual bool seek(int32 offset, int whence = SEEK_SET) = 0;
|
||||
virtual bool seek(int64 offset, int whence = SEEK_SET) = 0;
|
||||
|
||||
/**
|
||||
* Obtain the current size of the stream, measured in bytes.
|
||||
|
@ -329,7 +329,7 @@ public:
|
|||
*
|
||||
* @return The size of the stream, or -1 if an error occurred.
|
||||
*/
|
||||
virtual int32 size() const = 0;
|
||||
virtual int64 size() const = 0;
|
||||
};
|
||||
|
||||
/**
|
||||
|
@ -670,7 +670,7 @@ public:
|
|||
*
|
||||
* @return The current position indicator, or -1 if an error occurred.
|
||||
*/
|
||||
virtual int32 pos() const = 0;
|
||||
virtual int64 pos() const = 0;
|
||||
|
||||
/**
|
||||
* Obtain the total size of the stream, measured in bytes.
|
||||
|
@ -678,7 +678,7 @@ public:
|
|||
*
|
||||
* @return The size of the stream, or -1 if an error occurred.
|
||||
*/
|
||||
virtual int32 size() const = 0;
|
||||
virtual int64 size() const = 0;
|
||||
|
||||
/**
|
||||
* Set the stream position indicator for the stream.
|
||||
|
@ -697,7 +697,7 @@ public:
|
|||
*
|
||||
* @return True on success, false in case of a failure.
|
||||
*/
|
||||
virtual bool seek(int32 offset, int whence = SEEK_SET) = 0;
|
||||
virtual bool seek(int64 offset, int whence = SEEK_SET) = 0;
|
||||
|
||||
/**
|
||||
* Skip the given number of bytes in the stream.
|
||||
|
|
|
@ -82,10 +82,10 @@ protected:
|
|||
public:
|
||||
SeekableSubReadStream(SeekableReadStream *parentStream, uint32 begin, uint32 end, DisposeAfterUse::Flag disposeParentStream = DisposeAfterUse::NO);
|
||||
|
||||
virtual int32 pos() const { return _pos - _begin; }
|
||||
virtual int32 size() const { return _end - _begin; }
|
||||
virtual int64 pos() const { return _pos - _begin; }
|
||||
virtual int64 size() const { return _end - _begin; }
|
||||
|
||||
virtual bool seek(int32 offset, int whence = SEEK_SET);
|
||||
virtual bool seek(int64 offset, int whence = SEEK_SET);
|
||||
};
|
||||
|
||||
/**
|
||||
|
@ -103,10 +103,10 @@ public:
|
|||
ReadStreamEndian(bigEndian) {
|
||||
}
|
||||
|
||||
virtual int32 pos() const override { return SeekableSubReadStream::pos(); }
|
||||
virtual int32 size() const override { return SeekableSubReadStream::size(); }
|
||||
virtual int64 pos() const override { return SeekableSubReadStream::pos(); }
|
||||
virtual int64 size() const override { return SeekableSubReadStream::size(); }
|
||||
|
||||
virtual bool seek(int32 offset, int whence = SEEK_SET) override { return SeekableSubReadStream::seek(offset, whence); }
|
||||
virtual bool seek(int64 offset, int whence = SEEK_SET) override { return SeekableSubReadStream::seek(offset, whence); }
|
||||
void hexdump(int len, int bytesPerLine = 16, int startOffset = 0) { SeekableSubReadStream::hexdump(len, bytesPerLine, startOffset); }
|
||||
bool skip(uint32 offset) override { return SeekableSubReadStream::seek(offset, SEEK_CUR); }
|
||||
};
|
||||
|
|
|
@ -316,13 +316,13 @@ public:
|
|||
bool eos() const {
|
||||
return _eos;
|
||||
}
|
||||
int32 pos() const {
|
||||
int64 pos() const {
|
||||
return _pos;
|
||||
}
|
||||
int32 size() const {
|
||||
int64 size() const {
|
||||
return _origSize;
|
||||
}
|
||||
bool seek(int32 offset, int whence = SEEK_SET) {
|
||||
bool seek(int64 offset, int whence = SEEK_SET) {
|
||||
int32 newPos = 0;
|
||||
switch (whence) {
|
||||
default:
|
||||
|
@ -372,7 +372,7 @@ public:
|
|||
// bytes, so this should be fine.
|
||||
byte tmpBuf[1024];
|
||||
while (!err() && offset > 0) {
|
||||
offset -= read(tmpBuf, MIN((int32)sizeof(tmpBuf), offset));
|
||||
offset -= read(tmpBuf, MIN((int64)sizeof(tmpBuf), offset));
|
||||
}
|
||||
|
||||
_eos = false;
|
||||
|
@ -487,7 +487,7 @@ public:
|
|||
return dataSize - _stream.avail_in;
|
||||
}
|
||||
|
||||
virtual int32 pos() const { return _pos; }
|
||||
virtual int64 pos() const { return _pos; }
|
||||
};
|
||||
|
||||
#endif // USE_ZLIB
|
||||
|
|
|
@ -251,13 +251,13 @@ public:
|
|||
bool eos() const {
|
||||
return _eos;
|
||||
}
|
||||
int32 pos() const {
|
||||
int64 pos() const {
|
||||
return _pos;
|
||||
}
|
||||
int32 size() const {
|
||||
int64 size() const {
|
||||
return _origSize;
|
||||
}
|
||||
bool seek(int32 offset, int whence = SEEK_SET) {
|
||||
bool seek(int64 offset, int whence = SEEK_SET) {
|
||||
int32 newPos = 0;
|
||||
switch (whence) {
|
||||
default:
|
||||
|
@ -422,7 +422,7 @@ public:
|
|||
return dataSize - _stream.avail_in;
|
||||
}
|
||||
|
||||
virtual int32 pos() const { return _pos; }
|
||||
virtual int64 pos() const { return _pos; }
|
||||
};
|
||||
|
||||
#endif // USE_ZLIB
|
||||
|
|
|
@ -307,7 +307,7 @@ static void printGoodSectors(Common::Array<bool> &goodSectors, uint sectorsPerTr
|
|||
|
||||
static Common::SeekableReadStream *readImage_NIB(Common::File &f, bool dos33, uint tracks = 35) {
|
||||
if (f.size() != 35 * kNibTrackLen) {
|
||||
warning("NIB: image '%s' has invalid size of %d bytes", f.getName(), f.size());
|
||||
warning("NIB: image '%s' has invalid size of %d bytes", f.getName(), (int)f.size());
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
|
@ -543,7 +543,7 @@ bool DiskImage::open(const Common::String &filename) {
|
|||
return false;
|
||||
|
||||
if (_stream->size() != expectedSize)
|
||||
error("Unrecognized disk image '%s' of size %d bytes (expected %d bytes)", filename.c_str(), _stream->size(), expectedSize);
|
||||
error("Unrecognized disk image '%s' of size %d bytes (expected %d bytes)", filename.c_str(), (int)_stream->size(), expectedSize);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
|
|
@ -750,7 +750,7 @@ bool SoundGen2GS::loadInstrumentHeaders(Common::String &exePath, const IIgsExeIn
|
|||
file.open(exePath);
|
||||
if (file.size() != (int32)exeInfo.exeSize) {
|
||||
debugC(3, kDebugLevelSound, "Apple IIGS executable (%s) has wrong size (Is %d, should be %d)",
|
||||
exePath.c_str(), file.size(), exeInfo.exeSize);
|
||||
exePath.c_str(), (int)file.size(), exeInfo.exeSize);
|
||||
}
|
||||
|
||||
// Read the whole executable file into memory
|
||||
|
|
|
@ -114,15 +114,15 @@ public:
|
|||
return _stream->Read(dataPtr, dataSize);
|
||||
}
|
||||
|
||||
int32 pos() const override {
|
||||
int64 pos() const override {
|
||||
return _stream->GetPosition();
|
||||
}
|
||||
|
||||
int32 size() const override {
|
||||
int64 size() const override {
|
||||
return _stream->GetLength();
|
||||
}
|
||||
|
||||
bool seek(int32 offset, int whence = SEEK_SET) override {
|
||||
bool seek(int64 offset, int whence = SEEK_SET) override {
|
||||
StreamSeek origin = kSeekBegin;
|
||||
if (whence == SEEK_CUR)
|
||||
origin = kSeekCurrent;
|
||||
|
|
|
@ -83,7 +83,7 @@ bool AudioSpeech::playSpeech(const Common::String &name, int pan) {
|
|||
}
|
||||
|
||||
if (r->size() > kBufferSize) {
|
||||
warning("AudioSpeech::playSpeech: AUD larger than buffer size (%d > %d)", r->size(), kBufferSize);
|
||||
warning("AudioSpeech::playSpeech: AUD larger than buffer size (%d > %d)", (int)r->size(), kBufferSize);
|
||||
return false;
|
||||
}
|
||||
|
||||
|
|
|
@ -95,7 +95,7 @@ public:
|
|||
|
||||
uint32 write(const void *dataPtr, uint32 dataSize) override { return _s.write(dataPtr, dataSize); }
|
||||
bool flush() override { return _s.flush(); }
|
||||
int32 pos() const override { return _s.pos(); }
|
||||
int64 pos() const override { return _s.pos(); }
|
||||
|
||||
void debug(char *p);
|
||||
|
||||
|
@ -120,9 +120,9 @@ public:
|
|||
|
||||
bool eos() const override { return _s.eos(); }
|
||||
uint32 read(void *dataPtr, uint32 dataSize) override { return _s.read(dataPtr, dataSize); }
|
||||
int32 pos() const override { return _s.pos(); }
|
||||
int32 size() const override { return _s.size(); }
|
||||
bool seek(int32 offset, int whence = SEEK_SET) override { return _s.seek(offset, whence); }
|
||||
int64 pos() const override { return _s.pos(); }
|
||||
int64 size() const override { return _s.size(); }
|
||||
bool seek(int64 offset, int whence = SEEK_SET) override { return _s.seek(offset, whence); }
|
||||
|
||||
int32 readInt();
|
||||
float readFloat();
|
||||
|
|
|
@ -61,7 +61,7 @@ void loadTextData(const char *filename) {
|
|||
static const uint bytesPerRow = FONT_WIDTH / 2; // The input font data is 4-bit so it takes only half the space
|
||||
|
||||
if (headerSize + fontDataSize != (uint)fileHandle.size()) {
|
||||
warning("loadTextData: file '%s' (entrySize = %d, entryCount = %d) is of incorrect size %d", filename, entrySize, entryCount, fileHandle.size());
|
||||
warning("loadTextData: file '%s' (entrySize = %d, entryCount = %d) is of incorrect size %d", filename, entrySize, entryCount, (int)fileHandle.size());
|
||||
}
|
||||
|
||||
Common::Array<byte> source;
|
||||
|
|
|
@ -576,7 +576,7 @@ void ComposerEngine::loadCTBL(uint16 id, uint fadePercent) {
|
|||
debug(1, "CTBL: %d entries", numEntries);
|
||||
|
||||
if ((numEntries > 256) || (stream->size() < 2 + (numEntries * 3)))
|
||||
error("CTBL %d was invalid (%d entries, size %d)", id, numEntries, stream->size());
|
||||
error("CTBL %d was invalid (%d entries, size %d)", id, numEntries, (int)stream->size());
|
||||
|
||||
byte buffer[256 * 3];
|
||||
stream->read(buffer, numEntries * 3);
|
||||
|
@ -680,7 +680,7 @@ void ComposerEngine::decompressBitmap(uint16 type, Common::SeekableReadStream *s
|
|||
case kBitmapUncompressed:
|
||||
if (stream->size() - (uint)stream->pos() != size)
|
||||
error("kBitmapUncompressed stream had %d bytes left, supposed to be %d",
|
||||
stream->size() - (uint)stream->pos(), size);
|
||||
(int)(stream->size() - stream->pos()), size);
|
||||
if (size != outSize)
|
||||
error("kBitmapUncompressed size %d doesn't match required size %d",
|
||||
size, outSize);
|
||||
|
|
|
@ -109,7 +109,7 @@ void ComposerEngine::runEvent(uint16 id, int16 param1, int16 param2, int16 param
|
|||
|
||||
Common::SeekableReadStream *stream = getResource(ID_EVNT, id);
|
||||
if (stream->size() != 2)
|
||||
error("bad EVNT size %d", stream->size());
|
||||
error("bad EVNT size %d", (int)stream->size());
|
||||
uint16 scriptId = stream->readUint16LE();
|
||||
delete stream;
|
||||
|
||||
|
@ -178,10 +178,10 @@ void ComposerEngine::runScript(uint16 id) {
|
|||
|
||||
Common::SeekableReadStream *stream = getResource(ID_SCRP, id);
|
||||
if (stream->size() < 2)
|
||||
error("SCRP was too small (%d)", stream->size());
|
||||
error("SCRP was too small (%d)", (int)stream->size());
|
||||
uint16 size = stream->readUint16LE();
|
||||
if (stream->size() < 2 + 2*size)
|
||||
error("SCRP was too small (%d, but claimed %d entries)", stream->size(), size);
|
||||
if ((int)stream->size() < 2 + 2*size)
|
||||
error("SCRP was too small (%d, but claimed %d entries)", (int)stream->size(), size);
|
||||
uint16 *script = new uint16[size];
|
||||
for (uint i = 0; i < size; i++)
|
||||
script[i] = stream->readUint16LE();
|
||||
|
|
|
@ -564,12 +564,12 @@ void Cast::loadCastChildren() {
|
|||
|
||||
switch (tag) {
|
||||
case MKTAG('D', 'I', 'B', ' '):
|
||||
debugC(2, kDebugLoading, "****** Loading 'DIB ' id: %d (%d), %d bytes", imgId, realId, pic->size());
|
||||
debugC(2, kDebugLoading, "****** Loading 'DIB ' id: %d (%d), %d bytes", imgId, realId, (int)pic->size());
|
||||
img = new DIBDecoder();
|
||||
break;
|
||||
|
||||
case MKTAG('B', 'I', 'T', 'D'):
|
||||
debugC(2, kDebugLoading, "****** Loading 'BITD' id: %d (%d), %d bytes", imgId, realId, pic->size());
|
||||
debugC(2, kDebugLoading, "****** Loading 'BITD' id: %d (%d), %d bytes", imgId, realId, (int)pic->size());
|
||||
|
||||
if (w > 0 && h > 0) {
|
||||
if (_version < kFileVer600) {
|
||||
|
@ -698,7 +698,7 @@ PaletteV4 Cast::loadPalette(Common::SeekableReadStreamEndian &stream) {
|
|||
uint16 index = (steps * 3) - 1;
|
||||
byte *_palette = new byte[index + 1];
|
||||
|
||||
debugC(3, kDebugLoading, "Cast::loadPalette(): %d steps, %d bytes", steps, stream.size());
|
||||
debugC(3, kDebugLoading, "Cast::loadPalette(): %d steps, %d bytes", steps, (int)stream.size());
|
||||
|
||||
if (steps > 256) {
|
||||
warning("Cast::loadPalette(): steps > 256: %d", steps);
|
||||
|
|
|
@ -314,7 +314,7 @@ bool SNDDecoder::processBufferCommand(Common::SeekableReadStreamEndian &stream)
|
|||
/*uint16 unk1 =*/stream.readUint16();
|
||||
int32 offset = stream.readUint32();
|
||||
if (offset != stream.pos()) {
|
||||
warning("SNDDecoder: Bad sound header offset. Expected: %d, read: %d", stream.pos(), offset);
|
||||
warning("SNDDecoder: Bad sound header offset. Expected: %d, read: %d", (int)stream.pos(), offset);
|
||||
return false;
|
||||
}
|
||||
/*uint32 dataPtr =*/stream.readUint32();
|
||||
|
|
|
@ -1139,7 +1139,7 @@ void Script::run(const GPL2Program &program, uint16 offset) {
|
|||
if (_jump != 0) {
|
||||
debugC(3, kDraciBytecodeDebugLevel,
|
||||
"Jumping from offset %d to %d (%d bytes)",
|
||||
reader.pos(), reader.pos() + _jump, _jump);
|
||||
(int)reader.pos(), (int)reader.pos() + _jump, _jump);
|
||||
reader.seek(_jump, SEEK_CUR);
|
||||
}
|
||||
|
||||
|
|
|
@ -55,7 +55,7 @@ void FileBuffer::close() {
|
|||
_pos = 0;
|
||||
}
|
||||
|
||||
bool FileBuffer::seek(int32 offset, int whence) {
|
||||
bool FileBuffer::seek(int64 offset, int whence) {
|
||||
switch (whence) {
|
||||
case SEEK_SET:
|
||||
_pos = offset;
|
||||
|
|
|
@ -43,13 +43,13 @@ public:
|
|||
static bool exists(const Common::String &filename);
|
||||
void close();
|
||||
|
||||
int32 pos() const override {
|
||||
int64 pos() const override {
|
||||
return _pos;
|
||||
}
|
||||
int32 size() const override {
|
||||
int64 size() const override {
|
||||
return _data.size();
|
||||
}
|
||||
bool seek(int32 offset, int whence = SEEK_SET) override;
|
||||
bool seek(int64 offset, int whence = SEEK_SET) override;
|
||||
|
||||
bool eos() const override {
|
||||
return _pos >= (int)_data.size();
|
||||
|
|
|
@ -216,7 +216,7 @@ void GameData::parse_function(FileBuffer *fb, Function *func) {
|
|||
|
||||
p = (const uint8 *)memchr(fb->dataPtr(), 0x00, fb->size() - fb->pos());
|
||||
if (!p)
|
||||
error("bad function @ %.4x", fb->pos());
|
||||
error("bad function @ %.4x", (int)fb->pos());
|
||||
|
||||
for (;;) {
|
||||
Instruction instruction;
|
||||
|
|
|
@ -149,7 +149,7 @@ bool Pics::ImageFile::doImageOp(Pics::ImageContext *ctx) const {
|
|||
uint16 a, b;
|
||||
|
||||
opcode = ctx->_file.readByte();
|
||||
debugCN(kDebugGraphics, " %.4x [%.2x]: ", ctx->_file.pos() - 1, opcode);
|
||||
debugCN(kDebugGraphics, " %.4x [%.2x]: ", (int)ctx->_file.pos() - 1, opcode);
|
||||
|
||||
byte param = opcode & 0xf;
|
||||
opcode >>= 4;
|
||||
|
|
|
@ -83,7 +83,7 @@ public:
|
|||
private:
|
||||
class Nullstreambuf : public Common::WriteStream {
|
||||
uint32 write(const void *dataPtr, uint32 dataSize) override { return dataSize; }
|
||||
int32 pos() const override { return 0; }
|
||||
int64 pos() const override { return 0; }
|
||||
};
|
||||
|
||||
// Common::WriteStream *logfilestr_;
|
||||
|
|
|
@ -36,7 +36,7 @@ namespace Quest {
|
|||
class ConsoleStream : public Common::WriteStream {
|
||||
public:
|
||||
uint32 write(const void *dataPtr, uint32 dataSize) override;
|
||||
int32 pos() const override { return 0; }
|
||||
int64 pos() const override { return 0; }
|
||||
};
|
||||
|
||||
class ostringstream : public Common::MemoryWriteStreamDynamic {
|
||||
|
|
|
@ -91,7 +91,7 @@ bool SCNPlayer::readLabels(Common::SeekableReadStream &scn, LabelMap &labels) {
|
|||
if (lineStartsWith(line, "LABEL ")) {
|
||||
// Label => Add to the hashmap
|
||||
labels.setVal(line.c_str() + 6, scn.pos());
|
||||
debugC(2, kDebugDemo, "Found label \"%s\" (%d)", line.c_str() + 6, scn.pos());
|
||||
debugC(2, kDebugDemo, "Found label \"%s\" (%d)", line.c_str() + 6, (int)scn.pos());
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -289,7 +289,7 @@ void Inter_Playtoons::oPlaytoons_readData(OpFuncParams ¶ms) {
|
|||
_vm->_draw->animateCursor(4);
|
||||
if (offset > stream->size()) {
|
||||
warning("oPlaytoons_readData: File \"%s\", Offset (%d) > file size (%d)",
|
||||
file.c_str(), offset, stream->size());
|
||||
file.c_str(), offset, (int)stream->size());
|
||||
delete stream;
|
||||
return;
|
||||
}
|
||||
|
|
|
@ -332,21 +332,21 @@ uint32 SaveConverter::read(void *dataPtr, uint32 dataSize) {
|
|||
return _stream->read(dataPtr, dataSize);
|
||||
}
|
||||
|
||||
int32 SaveConverter::pos() const {
|
||||
int64 SaveConverter::pos() const {
|
||||
if (!_data || !_stream)
|
||||
return -1;
|
||||
|
||||
return _stream->pos();
|
||||
}
|
||||
|
||||
int32 SaveConverter::size() const {
|
||||
int64 SaveConverter::size() const {
|
||||
if (!_data || !_stream)
|
||||
return -1;
|
||||
|
||||
return _stream->size();
|
||||
}
|
||||
|
||||
bool SaveConverter::seek(int32 offset, int whence) {
|
||||
bool SaveConverter::seek(int64 offset, int whence) {
|
||||
if (!_data || !_stream)
|
||||
return false;
|
||||
|
||||
|
|
|
@ -64,9 +64,9 @@ public:
|
|||
bool eos() const override;
|
||||
uint32 read(void *dataPtr, uint32 dataSize) override;
|
||||
// SeekableReadStream
|
||||
int32 pos() const override;
|
||||
int32 size() const override;
|
||||
bool seek(int32 offset, int whence = SEEK_SET) override;
|
||||
int64 pos() const override;
|
||||
int64 size() const override;
|
||||
bool seek(int64 offset, int whence = SEEK_SET) override;
|
||||
|
||||
protected:
|
||||
GobEngine *_vm;
|
||||
|
|
|
@ -184,7 +184,7 @@ bool ADLPlayer::load(Common::SeekableReadStream &adl) {
|
|||
bool ADLPlayer::readHeader(Common::SeekableReadStream &adl, int &timbreCount) {
|
||||
// Sanity check
|
||||
if (adl.size() < 60) {
|
||||
warning("ADLPlayer::readHeader(): File too small (%d)", adl.size());
|
||||
warning("ADLPlayer::readHeader(): File too small (%d)", (int)adl.size());
|
||||
return false;
|
||||
}
|
||||
|
||||
|
|
|
@ -220,7 +220,7 @@ bool MUSPlayer::readString(Common::SeekableReadStream &stream, Common::String &s
|
|||
bool MUSPlayer::readSNDHeader(Common::SeekableReadStream &snd, int &timbreCount, int &timbrePos) {
|
||||
// Sanity check
|
||||
if (snd.size() <= 6) {
|
||||
warning("MUSPlayer::readSNDHeader(): File too small (%d)", snd.size());
|
||||
warning("MUSPlayer::readSNDHeader(): File too small (%d)", (int)snd.size());
|
||||
return false;
|
||||
}
|
||||
|
||||
|
|
|
@ -43,9 +43,9 @@ public:
|
|||
virtual uint32 read(void *dataPtr, uint32 dataSize) override;
|
||||
|
||||
// Common::SeekableReadStream implementation
|
||||
virtual int32 pos() const override;
|
||||
virtual int32 size() const override;
|
||||
virtual bool seek(int32 offset, int whence = SEEK_SET) override;
|
||||
virtual int64 pos() const override;
|
||||
virtual int64 size() const override;
|
||||
virtual bool seek(int64 offset, int whence = SEEK_SET) override;
|
||||
|
||||
private:
|
||||
// Consts
|
||||
|
@ -286,15 +286,15 @@ bool PatchedFile::eos() const {
|
|||
return false;
|
||||
}
|
||||
|
||||
int32 PatchedFile::pos() const {
|
||||
int64 PatchedFile::pos() const {
|
||||
return _pos;
|
||||
}
|
||||
|
||||
int32 PatchedFile::size() const {
|
||||
int64 PatchedFile::size() const {
|
||||
return _newSize;
|
||||
}
|
||||
|
||||
bool PatchedFile::seek(int32 offset, int whence) {
|
||||
bool PatchedFile::seek(int64 offset, int whence) {
|
||||
int32 totJump, relOffset;
|
||||
uint32 skipDiff, skipExtra, skipSize;
|
||||
relOffset = 0;
|
||||
|
|
|
@ -119,15 +119,15 @@ bool PackFile::eos() const {
|
|||
return _orgStream->eos();
|
||||
}
|
||||
|
||||
int32 PackFile::pos() const {
|
||||
int64 PackFile::pos() const {
|
||||
return _orgStream->pos() - _offset;
|
||||
}
|
||||
|
||||
int32 PackFile::size() const {
|
||||
int64 PackFile::size() const {
|
||||
return _size;
|
||||
}
|
||||
|
||||
bool PackFile::seek(int32 offset, int whence) {
|
||||
bool PackFile::seek(int64 offset, int whence) {
|
||||
if (_codeTable && whence == SEEK_SET)
|
||||
offset += _offset;
|
||||
return _orgStream->seek(offset, whence);
|
||||
|
|
|
@ -38,9 +38,9 @@ public:
|
|||
void clearErr();
|
||||
uint32 read(void *dataPtr, uint32 dataSize);
|
||||
bool eos() const;
|
||||
int32 pos() const;
|
||||
int32 size() const;
|
||||
bool seek(int32 offset, int whence = SEEK_SET);
|
||||
int64 pos() const;
|
||||
int64 size() const;
|
||||
bool seek(int64 offset, int whence = SEEK_SET);
|
||||
|
||||
private:
|
||||
Common::SeekableReadStream *_orgStream;
|
||||
|
|
|
@ -75,7 +75,7 @@ bool T7GFont::load(Common::SeekableReadStream &stream) {
|
|||
uint16 offset = glyphOffsets[i];
|
||||
delete[] glyphOffsets;
|
||||
error("Groovie::T7GFont: Glyph %d starts at %d but the current "
|
||||
"offset is %d", i, offset, stream.pos());
|
||||
"offset is %d", i, offset, (int)stream.pos());
|
||||
return false;
|
||||
}
|
||||
|
||||
|
|
|
@ -268,7 +268,7 @@ bool ROQPlayer::processBlock() {
|
|||
}
|
||||
|
||||
if (endpos != _file->pos())
|
||||
warning("Groovie::ROQ: BLOCK %04x Should have ended at %d, and has ended at %d", blockHeader.type, endpos, _file->pos());
|
||||
warning("Groovie::ROQ: BLOCK %04x Should have ended at %d, and has ended at %d", blockHeader.type, endpos, (int)_file->pos());
|
||||
|
||||
// End the frame when the graphics have been modified or when there's an error
|
||||
return endframe || !ok;
|
||||
|
|
|
@ -131,41 +131,41 @@ Common::Error HDBGame::loadGameState(int slot) {
|
|||
}
|
||||
|
||||
void HDBGame::saveGame(Common::OutSaveFile *out) {
|
||||
debug(1, "HDBGame::saveGame: start at %u", out->pos());
|
||||
debug(1, "HDBGame::saveGame: start at %u", (uint32)out->pos());
|
||||
|
||||
// Save Map Name and Time
|
||||
out->writeUint32LE(_saveHeader.seconds);
|
||||
out->write(_inMapName, 32);
|
||||
|
||||
debug(1, "HDBGame::saveGame: map at %u", out->pos());
|
||||
debug(1, "HDBGame::saveGame: map at %u", (uint32)out->pos());
|
||||
// Save Map Object Data
|
||||
_map->save(out);
|
||||
|
||||
// Save Window Object Data
|
||||
debug(1, "HDBGame::saveGame: window at %u", out->pos());
|
||||
debug(1, "HDBGame::saveGame: window at %u", (uint32)out->pos());
|
||||
_window->save(out);
|
||||
|
||||
// Save Gfx Object Data
|
||||
debug(1, "HDBGame::saveGame: gfx at %u", out->pos());
|
||||
debug(1, "HDBGame::saveGame: gfx at %u", (uint32)out->pos());
|
||||
_gfx->save(out);
|
||||
|
||||
// Save Sound Object Data
|
||||
debug(1, "HDBGame::saveGame: sound at %u", out->pos());
|
||||
debug(1, "HDBGame::saveGame: sound at %u", (uint32)out->pos());
|
||||
_sound->save(out);
|
||||
|
||||
// Save Game Object Data
|
||||
debug(1, "HDBGame::saveGame: game object at %u", out->pos());
|
||||
debug(1, "HDBGame::saveGame: game object at %u", (uint32)out->pos());
|
||||
save(out);
|
||||
|
||||
// Save AI Object Data
|
||||
debug(1, "HDBGame::saveGame: ai at %u", out->pos());
|
||||
debug(1, "HDBGame::saveGame: ai at %u", (uint32)out->pos());
|
||||
_ai->save(out);
|
||||
|
||||
debug(1, "HDBGame::saveGame: end at %u", out->pos());
|
||||
debug(1, "HDBGame::saveGame: end at %u", (uint32)out->pos());
|
||||
}
|
||||
|
||||
void HDBGame::loadGame(Common::InSaveFile *in) {
|
||||
debug(1, "HDBGame::loadGame: start at %u", in->pos());
|
||||
debug(1, "HDBGame::loadGame: start at %u", (uint32)in->pos());
|
||||
|
||||
// Load Map Name and Time
|
||||
_timeSeconds = in->readUint32LE();
|
||||
|
@ -177,30 +177,30 @@ void HDBGame::loadGame(Common::InSaveFile *in) {
|
|||
Common::strlcpy(_saveHeader.mapName, _inMapName, sizeof(_saveHeader.mapName));
|
||||
|
||||
// Load Map Object Data
|
||||
debug(1, "HDBGame::loadGame: map at %u", in->pos());
|
||||
debug(1, "HDBGame::loadGame: map at %u", (uint32)in->pos());
|
||||
_map->loadSaveFile(in);
|
||||
|
||||
// Load Window Object Data
|
||||
debug(1, "HDBGame::loadGame: window at %u", in->pos());
|
||||
debug(1, "HDBGame::loadGame: window at %u", (uint32)in->pos());
|
||||
_window->loadSaveFile(in);
|
||||
|
||||
// Load Gfx Object Data
|
||||
debug(1, "HDBGame::loadGame: gfx at %u", in->pos());
|
||||
debug(1, "HDBGame::loadGame: gfx at %u", (uint32)in->pos());
|
||||
_gfx->loadSaveFile(in);
|
||||
|
||||
// Load Sound Object Data
|
||||
debug(1, "HDBGame::loadGame: sound at %u", in->pos());
|
||||
debug(1, "HDBGame::loadGame: sound at %u", (uint32)in->pos());
|
||||
_sound->loadSaveFile(in);
|
||||
|
||||
// Load Game Object Data
|
||||
debug(1, "HDBGame::loadGame: game object at %u", in->pos());
|
||||
debug(1, "HDBGame::loadGame: game object at %u", (uint32)in->pos());
|
||||
loadSaveFile(in);
|
||||
|
||||
// Load AI Object Data
|
||||
debug(1, "HDBGame::loadGame: ai at %u", in->pos());
|
||||
debug(1, "HDBGame::loadGame: ai at %u", (uint32)in->pos());
|
||||
_ai->loadSaveFile(in);
|
||||
|
||||
debug(1, "HDBGame::loadGame: end at %u", in->pos());
|
||||
debug(1, "HDBGame::loadGame: end at %u", (uint32)in->pos());
|
||||
|
||||
_gfx->turnOffFade();
|
||||
}
|
||||
|
|
|
@ -3336,7 +3336,7 @@ bool Screen::loadPalette(const char *filename, Palette &pal) {
|
|||
numCols = stream->size() / Palette::kVGABytesPerColor;
|
||||
pal.loadVGAPalette(*stream, 0, MIN(maxCols, numCols));
|
||||
} else {
|
||||
error("Screen::loadPalette(): Failed to load file '%s' with invalid size %d in HiColor mode", filename, stream->size());
|
||||
error("Screen::loadPalette(): Failed to load file '%s' with invalid size %d in HiColor mode", filename, (int)stream->size());
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -155,9 +155,9 @@ public:
|
|||
uint32 read(void *dataPtr, uint32 dataSize) override { return _stream->read(dataPtr, dataSize); }
|
||||
|
||||
// Common::SeekableReadStream interface
|
||||
int32 pos() const override { return _stream->pos(); }
|
||||
int32 size() const override { return _stream->size(); }
|
||||
bool seek(int32 offset, int whence = SEEK_SET) override { return _stream->seek(offset, whence); }
|
||||
int64 pos() const override { return _stream->pos(); }
|
||||
int64 size() const override { return _stream->size(); }
|
||||
bool seek(int64 offset, int whence = SEEK_SET) override { return _stream->seek(offset, whence); }
|
||||
|
||||
private:
|
||||
Common::SeekableReadStream *_stream;
|
||||
|
|
|
@ -290,7 +290,7 @@ bool Debugger::cmdDumpFiles(int argc, const char **) {
|
|||
return true; \
|
||||
} \
|
||||
Common::String md5str = Common::computeStreamMD5AsString(*stream); \
|
||||
debugC(1, kLastExpressDebugResource, "%s, %d, %s", (*it)->getName().c_str(), stream->size(), md5str.c_str()); \
|
||||
debugC(1, kLastExpressDebugResource, "%s, %d, %s", (*it)->getName().c_str(), (int)stream->size(), md5str.c_str()); \
|
||||
delete stream; \
|
||||
} \
|
||||
}
|
||||
|
|
|
@ -439,7 +439,7 @@ uint32 SaveLoad::init(GameId id, bool resetHeaders) {
|
|||
void SaveLoad::loadStream(GameId id) {
|
||||
Common::InSaveFile *save = openForLoading(id);
|
||||
if (save->size() < 32)
|
||||
error("[SaveLoad::loadStream] Savegame seems to be corrupted (not enough data: %i bytes)", save->size());
|
||||
error("[SaveLoad::loadStream] Savegame seems to be corrupted (not enough data: %i bytes)", (int)save->size());
|
||||
|
||||
if (!_savegame)
|
||||
error("[SaveLoad::loadStream] Savegame stream is invalid");
|
||||
|
@ -629,7 +629,7 @@ bool SaveLoad::loadMainHeader(Common::InSaveFile *stream, SavegameMainHeader *he
|
|||
|
||||
// Check there is enough data (32 bytes)
|
||||
if (stream->size() < 32) {
|
||||
debugC(2, kLastExpressDebugSavegame, "Savegame seems to be corrupted (not enough data: %i bytes)", stream->size());
|
||||
debugC(2, kLastExpressDebugSavegame, "Savegame seems to be corrupted (not enough data: %i bytes)", (int)stream->size());
|
||||
return false;
|
||||
}
|
||||
|
||||
|
|
|
@ -105,9 +105,9 @@ public:
|
|||
memset(_buffer, 0, 256);
|
||||
}
|
||||
|
||||
int32 pos() const override { return MemoryWriteStreamDynamic::pos(); }
|
||||
int32 size() const override { return MemoryWriteStreamDynamic::size(); }
|
||||
bool seek(int32 offset, int whence = SEEK_SET) override { return MemoryWriteStreamDynamic::seek(offset, whence); }
|
||||
int64 pos() const override { return MemoryWriteStreamDynamic::pos(); }
|
||||
int64 size() const override { return MemoryWriteStreamDynamic::size(); }
|
||||
bool seek(int64 offset, int whence = SEEK_SET) override { return MemoryWriteStreamDynamic::seek(offset, whence); }
|
||||
bool eos() const override { return _eos; }
|
||||
uint32 read(void *dataPtr, uint32 dataSize) override;
|
||||
uint32 write(const void *dataPtr, uint32 dataSize) override;
|
||||
|
|
|
@ -681,7 +681,7 @@ bool GameDatabaseV3::getSavegameDescription(const char *filename, Common::String
|
|||
}
|
||||
|
||||
if (size != in->size() - 64) {
|
||||
warning("Unexpected save game size. Expected %d, size is %d (file size - 64)", size, in->size() - 64);
|
||||
warning("Unexpected save game size. Expected %d, size is %d (file size - 64)", size, (int)in->size() - 64);
|
||||
delete in;
|
||||
return false;
|
||||
}
|
||||
|
|
|
@ -238,7 +238,7 @@ void PmvPlayer::readChunk(uint32 &chunkType, uint32 &chunkSize) {
|
|||
chunkSize = _fd->readUint32LE();
|
||||
|
||||
debug(2, "ofs = %08X; chunkType = %c%c%c%c; chunkSize = %d\n",
|
||||
_fd->pos(),
|
||||
(int)_fd->pos(),
|
||||
(chunkType >> 24) & 0xFF, (chunkType >> 16) & 0xFF, (chunkType >> 8) & 0xFF, chunkType & 0xFF,
|
||||
chunkSize);
|
||||
|
||||
|
|
|
@ -162,7 +162,7 @@ void PictureResource::loadChunked(byte *source, int size) {
|
|||
_picturePalette = new byte[_paletteColorCount * 3];
|
||||
sourceS->read(_picturePalette, _paletteColorCount * 3);
|
||||
} else {
|
||||
error("PictureResource::loadChunked() Invalid chunk %08X at %08X", chunkType, sourceS->pos());
|
||||
error("PictureResource::loadChunked() Invalid chunk %08X at %08X", chunkType, (int)sourceS->pos());
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -704,7 +704,7 @@ MohawkSurface *LivingBooksBitmap_v1::decodeImageLB(Common::SeekableReadStreamEnd
|
|||
uint16 lengthBits = endianStream->readUint16();
|
||||
|
||||
if (compressedSize != (uint32)endianStream->size() - 24)
|
||||
error("More bytes (%d) remaining in stream than header says there should be (%d)", endianStream->size() - 24, compressedSize);
|
||||
error("More bytes (%d) remaining in stream than header says there should be (%d)", (int)endianStream->size() - 24, compressedSize);
|
||||
|
||||
// These two errors are really just sanity checks and should never go off
|
||||
if (posBits != POS_BITS)
|
||||
|
|
|
@ -1749,7 +1749,7 @@ LBAnimation::LBAnimation(MohawkEngine_LivingBooks *vm, LBAnimationItem *parent,
|
|||
debug(5, "ANI SPRResourceId: %d, offset %d", sprResourceId, sprResourceOffset);
|
||||
|
||||
if (aniStream->pos() != aniStream->size())
|
||||
error("Still %d bytes at the end of anim stream", aniStream->size() - aniStream->pos());
|
||||
error("Still %d bytes at the end of anim stream", (int)(aniStream->size() - aniStream->pos()));
|
||||
|
||||
delete aniStream;
|
||||
|
||||
|
@ -1788,7 +1788,7 @@ LBAnimation::LBAnimation(MohawkEngine_LivingBooks *vm, LBAnimationItem *parent,
|
|||
error("Ignoring %d back nodes", numBackNodes);
|
||||
|
||||
if (sprStream->pos() != sprStream->size())
|
||||
error("Still %d bytes at the end of sprite stream", sprStream->size() - sprStream->pos());
|
||||
error("Still %d bytes at the end of sprite stream", (int)(sprStream->size() - sprStream->pos()));
|
||||
|
||||
delete sprStream;
|
||||
|
||||
|
@ -1819,7 +1819,7 @@ void LBAnimation::loadShape(uint16 resourceId) {
|
|||
|
||||
if (_vm->isPreMohawk()) {
|
||||
if (shapeStream->size() < 6)
|
||||
error("V1 SHP Record size too short (%d)", shapeStream->size());
|
||||
error("V1 SHP Record size too short (%d)", (int)shapeStream->size());
|
||||
|
||||
uint16 u0 = shapeStream->readUint16();
|
||||
if (u0 != 3)
|
||||
|
@ -1833,7 +1833,7 @@ void LBAnimation::loadShape(uint16 resourceId) {
|
|||
debug(8, "V1 SHP: idCount: %d", idCount);
|
||||
|
||||
if (shapeStream->size() != (idCount * 2) + 6)
|
||||
error("V1 SHP Record size mismatch (%d)", shapeStream->size());
|
||||
error("V1 SHP Record size mismatch (%d)", (int)shapeStream->size());
|
||||
|
||||
for (uint16 i = 0; i < idCount; i++) {
|
||||
_shapeResources.push_back(shapeStream->readUint16());
|
||||
|
@ -1844,7 +1844,7 @@ void LBAnimation::loadShape(uint16 resourceId) {
|
|||
debug(8, "SHP: idCount: %d", idCount);
|
||||
|
||||
if (shapeStream->size() != (idCount * 6) + 2)
|
||||
error("SHP Record size mismatch (%d)", shapeStream->size());
|
||||
error("SHP Record size mismatch (%d)", (int)shapeStream->size());
|
||||
|
||||
for (uint16 i = 0; i < idCount; i++) {
|
||||
_shapeResources.push_back(shapeStream->readUint16());
|
||||
|
@ -2083,7 +2083,7 @@ void LBItem::readFrom(Common::SeekableSubReadStreamEndian *stream) {
|
|||
|
||||
int endPos = stream->pos() + size;
|
||||
if (endPos > stream->size())
|
||||
error("Item is larger (should end at %d) than stream (size %d)", endPos, stream->size());
|
||||
error("Item is larger (should end at %d) than stream (size %d)", endPos, (int)stream->size());
|
||||
|
||||
while (true) {
|
||||
if (stream->pos() == endPos)
|
||||
|
@ -2105,7 +2105,7 @@ void LBItem::readFrom(Common::SeekableSubReadStreamEndian *stream) {
|
|||
(int)stream->pos() - (int)(oldPos + 4 + (uint)dataSize), dataType, dataSize);
|
||||
|
||||
if (stream->pos() > endPos)
|
||||
error("Read off the end (at %d) of data (ends at %d)", stream->pos(), endPos);
|
||||
error("Read off the end (at %d) of data (ends at %d)", (int)stream->pos(), endPos);
|
||||
|
||||
assert(!stream->eos());
|
||||
}
|
||||
|
|
|
@ -185,7 +185,7 @@ LBCode::LBCode(MohawkEngine_LivingBooks *vm, uint16 baseId) : _vm(vm) {
|
|||
|
||||
uint32 totalSize = bcodStream->readUint32();
|
||||
if (totalSize != (uint32)bcodStream->size())
|
||||
error("BCOD had size %d, but claimed to be of size %d", bcodStream->size(), totalSize);
|
||||
error("BCOD had size %d, but claimed to be of size %d", (int)bcodStream->size(), totalSize);
|
||||
_size = bcodStream->readUint32();
|
||||
if (_size + 8 > totalSize)
|
||||
error("BCOD code was of size %d, beyond size %d", _size, totalSize);
|
||||
|
|
|
@ -665,7 +665,7 @@ bool ShieldEffect::loadPattern() {
|
|||
|
||||
Common::SeekableReadStream *stream = desc.getData();
|
||||
if (stream->size() != 4096) {
|
||||
error("Incorrect shield effect support file size %d", stream->size());
|
||||
error("Incorrect shield effect support file size %d", (int)stream->size());
|
||||
}
|
||||
|
||||
stream->read(_pattern, 4096);
|
||||
|
|
|
@ -622,7 +622,7 @@ bool Sc2::load(MfcArchive &file) {
|
|||
}
|
||||
|
||||
if (file.size() - file.pos() > 0)
|
||||
error("Sc2::load(): (%d bytes left)", file.size() - file.pos());
|
||||
error("Sc2::load(): (%d bytes left)", (int)(file.size() - file.pos()));
|
||||
|
||||
return true;
|
||||
}
|
||||
|
|
|
@ -237,7 +237,7 @@ bool Scene::load(MfcArchive &file) {
|
|||
initStaticANIObjects();
|
||||
|
||||
if (file.size() - file.pos() > 0)
|
||||
error("Scene::load (%d bytes left)", file.size() - file.pos());
|
||||
error("Scene::load (%d bytes left)", (int)(file.size() - file.pos()));
|
||||
|
||||
return true;
|
||||
}
|
||||
|
|
|
@ -55,7 +55,7 @@ bool GameLoader::readSavegame(const char *fname) {
|
|||
header.encSize = saveFile->readUint32LE();
|
||||
|
||||
debugC(3, kDebugLoading, "version: %d magic: %s updateCounter: %d unkField: %d encSize: %d, pos: %d",
|
||||
header.version, header.magic, header.updateCounter, header.unkField, header.encSize, saveFile->pos());
|
||||
header.version, header.magic, header.updateCounter, header.unkField, header.encSize, (int)saveFile->pos());
|
||||
|
||||
if (header.version != 48)
|
||||
return false;
|
||||
|
|
|
@ -122,7 +122,7 @@ bool GameLoader::writeSavegame(Scene *sc, const char *fname, const Common::Strin
|
|||
saveFile->writeUint32LE(header.encSize);
|
||||
|
||||
debugC(3, kDebugLoading, "version: %d magic: %s updateCounter: %d unkField: %d encSize: %d, pos: %d",
|
||||
header.version, header.magic, header.updateCounter, header.unkField, header.encSize, saveFile->pos());
|
||||
header.version, header.magic, header.updateCounter, header.unkField, header.encSize, (int)saveFile->pos());
|
||||
|
||||
saveFile->write(stream.getData(), stream.size());
|
||||
|
||||
|
|
|
@ -364,7 +364,7 @@ CObject *MfcArchive::parseClass(bool *isCopyReturned) {
|
|||
|
||||
uint obTag = readUint16LE();
|
||||
|
||||
debugC(7, kDebugLoading, "parseClass::obTag = %d (%04x) at 0x%08x", obTag, obTag, pos() - 2);
|
||||
debugC(7, kDebugLoading, "parseClass::obTag = %d (%04x) at 0x%08x", obTag, obTag, (int)pos() - 2);
|
||||
|
||||
if (obTag == 0x0000) {
|
||||
return NULL;
|
||||
|
@ -394,7 +394,7 @@ CObject *MfcArchive::parseClass(bool *isCopyReturned) {
|
|||
*isCopyReturned = false;
|
||||
} else if ((obTag & 0x8000) == 0) {
|
||||
if (_objectMap.size() < obTag) {
|
||||
error("Object index too big: %d at 0x%08x", obTag, pos() - 2);
|
||||
error("Object index too big: %d at 0x%08x", obTag, (int)pos() - 2);
|
||||
}
|
||||
debugC(7, kDebugLoading, "parseClass::obTag <%s>", lookupObjectId(_objectIdMap[obTag]));
|
||||
|
||||
|
@ -406,7 +406,7 @@ CObject *MfcArchive::parseClass(bool *isCopyReturned) {
|
|||
obTag &= ~0x8000;
|
||||
|
||||
if (_objectMap.size() < obTag) {
|
||||
error("Object index too big: %d at 0x%08x", obTag, pos() - 2);
|
||||
error("Object index too big: %d at 0x%08x", obTag, (int)pos() - 2);
|
||||
}
|
||||
|
||||
debugC(7, kDebugLoading, "parseClass::obTag <%s>", lookupObjectId(_objectIdMap[obTag]));
|
||||
|
|
|
@ -78,9 +78,9 @@ public:
|
|||
|
||||
bool eos() const override { return _stream->eos(); }
|
||||
uint32 read(void *dataPtr, uint32 dataSize) override { return _stream->read(dataPtr, dataSize); }
|
||||
int32 pos() const override { return _stream ? _stream->pos() : _wstream->pos(); }
|
||||
int32 size() const override { return _stream->size(); }
|
||||
bool seek(int32 offset, int whence = SEEK_SET) override { return _stream->seek(offset, whence); }
|
||||
int64 pos() const override { return _stream ? _stream->pos() : _wstream->pos(); }
|
||||
int64 size() const override { return _stream->size(); }
|
||||
bool seek(int64 offset, int whence = SEEK_SET) override { return _stream->seek(offset, whence); }
|
||||
|
||||
uint32 write(const void *dataPtr, uint32 dataSize) override { return _wstream->write(dataPtr, dataSize); }
|
||||
|
||||
|
|
|
@ -688,11 +688,11 @@ public:
|
|||
if (_dispose) delete _stream;
|
||||
}
|
||||
|
||||
int32 size() const override {
|
||||
int64 size() const override {
|
||||
return _stream->size();
|
||||
}
|
||||
|
||||
int32 pos() const override {
|
||||
int64 pos() const override {
|
||||
return _stream->pos();
|
||||
}
|
||||
|
||||
|
@ -700,7 +700,7 @@ public:
|
|||
return _stream->eos();
|
||||
}
|
||||
|
||||
bool seek(int32 offs, int whence = SEEK_SET) override {
|
||||
bool seek(int64 offs, int whence = SEEK_SET) override {
|
||||
return _stream->seek(offs, whence);
|
||||
}
|
||||
|
||||
|
|
|
@ -52,7 +52,7 @@ Common::SeekableReadStream *Resource::getDecompressedStream(Common::SeekableRead
|
|||
dec.decompress(buffer + 18, decompData, decompLen);
|
||||
free(buffer);
|
||||
|
||||
debug(8, "Resource::getDecompressedStream: decompressed %d to %d bytes", stream->size(), decompLen);
|
||||
debug(8, "Resource::getDecompressedStream: decompressed %d to %d bytes", (int)stream->size(), decompLen);
|
||||
|
||||
return new Common::MemoryReadStream(decompData, decompLen, DisposeAfterUse::YES);
|
||||
} else {
|
||||
|
|
|
@ -128,10 +128,10 @@ public:
|
|||
uint32 read(void *dataPtr, uint32 dataSize) override;
|
||||
|
||||
bool eos() const override { return _eos; }
|
||||
int32 pos() const override { return _pos; }
|
||||
int32 size() const override { return _size; }
|
||||
int64 pos() const override { return _pos; }
|
||||
int64 size() const override { return _size; }
|
||||
void clearErr() override { _eos = false; Common::MemoryWriteStreamDynamic::clearErr(); }
|
||||
bool seek(int32 offs, int whence = SEEK_SET) override { return Common::MemoryWriteStreamDynamic::seek(offs, whence); }
|
||||
bool seek(int64 offs, int whence = SEEK_SET) override { return Common::MemoryWriteStreamDynamic::seek(offs, whence); }
|
||||
|
||||
protected:
|
||||
bool _eos;
|
||||
|
|
|
@ -930,7 +930,7 @@ bool MidiPlayer_Midi::readD110DrvData() {
|
|||
}
|
||||
|
||||
if (f.size() != 3500)
|
||||
error("Unknown '%s' size (%d)", fileName, f.size());
|
||||
error("Unknown '%s' size (%d)", fileName, (int)f.size());
|
||||
|
||||
f.seek(42);
|
||||
|
||||
|
|
|
@ -121,15 +121,15 @@ bool ScummFile::eos() const {
|
|||
return _subFileLen ? _myEos : File::eos();
|
||||
}
|
||||
|
||||
int32 ScummFile::pos() const {
|
||||
int64 ScummFile::pos() const {
|
||||
return File::pos() - _subFileStart;
|
||||
}
|
||||
|
||||
int32 ScummFile::size() const {
|
||||
int64 ScummFile::size() const {
|
||||
return _subFileLen ? _subFileLen : File::size();
|
||||
}
|
||||
|
||||
bool ScummFile::seek(int32 offs, int whence) {
|
||||
bool ScummFile::seek(int64 offs, int whence) {
|
||||
if (_subFileLen) {
|
||||
// Constrain the seek to the subfile
|
||||
switch (whence) {
|
||||
|
|
|
@ -41,9 +41,9 @@ public:
|
|||
bool open(const Common::String &filename) override = 0;
|
||||
virtual bool openSubFile(const Common::String &filename) = 0;
|
||||
|
||||
int32 pos() const override = 0;
|
||||
int32 size() const override = 0;
|
||||
bool seek(int32 offs, int whence = SEEK_SET) override = 0;
|
||||
int64 pos() const override = 0;
|
||||
int64 size() const override = 0;
|
||||
bool seek(int64 offs, int whence = SEEK_SET) override = 0;
|
||||
|
||||
// Unused
|
||||
#if 0
|
||||
|
@ -70,9 +70,9 @@ public:
|
|||
void clearErr() override { _myEos = false; BaseScummFile::clearErr(); }
|
||||
|
||||
bool eos() const override;
|
||||
int32 pos() const override;
|
||||
int32 size() const override;
|
||||
bool seek(int32 offs, int whence = SEEK_SET) override;
|
||||
int64 pos() const override;
|
||||
int64 size() const override;
|
||||
bool seek(int64 offs, int whence = SEEK_SET) override;
|
||||
uint32 read(void *dataPtr, uint32 dataSize) override;
|
||||
};
|
||||
|
||||
|
@ -114,9 +114,9 @@ public:
|
|||
|
||||
void close() override;
|
||||
bool eos() const override { return _stream->eos(); }
|
||||
int32 pos() const override { return _stream->pos(); }
|
||||
int32 size() const override { return _stream->size(); }
|
||||
bool seek(int32 offs, int whence = SEEK_SET) override { return _stream->seek(offs, whence); }
|
||||
int64 pos() const override { return _stream->pos(); }
|
||||
int64 size() const override { return _stream->size(); }
|
||||
bool seek(int64 offs, int whence = SEEK_SET) override { return _stream->seek(offs, whence); }
|
||||
uint32 read(void *dataPtr, uint32 dataSize) override;
|
||||
};
|
||||
|
||||
|
|
|
@ -986,7 +986,7 @@ uint16 ScummNESFile::extractResource(Common::WriteStream *output, const Resource
|
|||
}
|
||||
|
||||
if (File::pos() - res->offset != res->length)
|
||||
error("extract_resource - length mismatch while extracting graphics resource (was %04X, should be %04X)", File::pos() - res->offset, res->length);
|
||||
error("extract_resource - length mismatch while extracting graphics resource (was %04X, should be %04X)", (int32)File::pos() - res->offset, res->length);
|
||||
|
||||
break;
|
||||
|
||||
|
@ -1049,7 +1049,7 @@ uint16 ScummNESFile::extractResource(Common::WriteStream *output, const Resource
|
|||
error("extract_resource - unknown sound type %d/%d detected",val,cnt);
|
||||
|
||||
if (File::pos() - res->offset != res->length)
|
||||
error("extract_resource - length mismatch while extracting sound resource (was %04X, should be %04X)", File::pos() - res->offset, res->length);
|
||||
error("extract_resource - length mismatch while extracting sound resource (was %04X, should be %04X)", (int32)File::pos() - res->offset, res->length);
|
||||
|
||||
break;
|
||||
|
||||
|
|
|
@ -84,9 +84,9 @@ public:
|
|||
|
||||
void close() override;
|
||||
bool eos() const override { return _stream->eos(); }
|
||||
int32 pos() const override { return _stream->pos(); }
|
||||
int32 size() const override { return _stream->size(); }
|
||||
bool seek(int32 offs, int whence = SEEK_SET) override { return _stream->seek(offs, whence); }
|
||||
int64 pos() const override { return _stream->pos(); }
|
||||
int64 size() const override { return _stream->size(); }
|
||||
bool seek(int64 offs, int whence = SEEK_SET) override { return _stream->seek(offs, whence); }
|
||||
uint32 read(void *dataPtr, uint32 dataSize) override;
|
||||
};
|
||||
|
||||
|
|
|
@ -1296,7 +1296,7 @@ int ScummEngine::readSoundResource(ResId idx) {
|
|||
Common::File dmuFile;
|
||||
char buffer[128];
|
||||
debugC(DEBUG_SOUND, "Found base tag FMUS in sound %d, size %d", idx, total_size);
|
||||
debugC(DEBUG_SOUND, "It was at position %d", _fileHandle->pos());
|
||||
debugC(DEBUG_SOUND, "It was at position %d", (int)_fileHandle->pos());
|
||||
|
||||
_fileHandle->seek(4, SEEK_CUR);
|
||||
// HSHD size
|
||||
|
|
|
@ -1121,7 +1121,7 @@ void Object::load3DO(Common::SeekableReadStream &s) {
|
|||
_goto.y = _goto.y * FIXED_INT_MULTIPLIER / 100;
|
||||
|
||||
// Offset 42
|
||||
warning("pos %d", s.pos());
|
||||
warning("pos %d", (int)s.pos());
|
||||
|
||||
// Unverified
|
||||
_lookFlag = s.readSint16BE();
|
||||
|
|
|
@ -141,7 +141,7 @@ SkyCompact::SkyCompact() {
|
|||
if (SKY_CPT_SIZE != _cptFile->size()) {
|
||||
GUI::MessageDialog dialog(_("The \"sky.cpt\" engine data file has an incorrect size."), _("OK"));
|
||||
dialog.runModal();
|
||||
error("Incorrect sky.cpt size (%d, expected: %d)", _cptFile->size(), SKY_CPT_SIZE);
|
||||
error("Incorrect sky.cpt size (%d, expected: %d)", (int)_cptFile->size(), SKY_CPT_SIZE);
|
||||
}
|
||||
|
||||
// set the necessary data structs up...
|
||||
|
|
|
@ -33,7 +33,7 @@
|
|||
namespace Sludge {
|
||||
|
||||
bool ImgLoader::loadImage(int num, const char *fname, Common::SeekableReadStream *stream, Graphics::Surface *dest, int reserve) {
|
||||
debugC(3, kSludgeDebugGraphics, "Loading image at position: %i", stream->pos());
|
||||
debugC(3, kSludgeDebugGraphics, "Loading image at position: %d", (int)stream->pos());
|
||||
|
||||
bool dumpPng = false;
|
||||
|
||||
|
|
|
@ -225,7 +225,7 @@ void CLUInputStream::refill() {
|
|||
|
||||
_file->seek(_file_pos, SEEK_SET);
|
||||
|
||||
uint len_left = _file->read(in, MIN((uint32)BUFFER_SIZE, _end_pos - _file->pos()));
|
||||
uint len_left = _file->read(in, MIN((uint32)BUFFER_SIZE, _end_pos - (uint32)_file->pos()));
|
||||
|
||||
_file_pos = _file->pos();
|
||||
|
||||
|
|
|
@ -51,7 +51,7 @@ void Font::load(const Pack &pack, int id, byte height, byte widthPack) {
|
|||
|
||||
_data = new byte[s->size()];
|
||||
s->read(_data, s->size());
|
||||
debugC(0, kDebugFont, "font size: %d", s->size());
|
||||
debugC(0, kDebugFont, "font size: %d", (int)s->size());
|
||||
|
||||
_height = height;
|
||||
_widthPack = widthPack;
|
||||
|
|
|
@ -200,17 +200,17 @@ void TinselFile::close() {
|
|||
_stream = nullptr;
|
||||
}
|
||||
|
||||
int32 TinselFile::pos() const {
|
||||
int64 TinselFile::pos() const {
|
||||
assert(_stream);
|
||||
return _stream->pos();
|
||||
}
|
||||
|
||||
int32 TinselFile::size() const {
|
||||
int64 TinselFile::size() const {
|
||||
assert(_stream);
|
||||
return _stream->size();
|
||||
}
|
||||
|
||||
bool TinselFile::seek(int32 offset, int whence) {
|
||||
bool TinselFile::seek(int64 offset, int whence) {
|
||||
assert(_stream);
|
||||
return _stream->seek(offset, whence);
|
||||
}
|
||||
|
|
|
@ -74,9 +74,9 @@ public:
|
|||
bool eos() const override;
|
||||
uint32 read(void *dataPtr, uint32 dataSize) override;
|
||||
|
||||
int32 pos() const override;
|
||||
int32 size() const override;
|
||||
bool seek(int32 offset, int whence = SEEK_SET) override;
|
||||
int64 pos() const override;
|
||||
int64 size() const override;
|
||||
bool seek(int64 offset, int whence = SEEK_SET) override;
|
||||
};
|
||||
|
||||
|
||||
|
|
|
@ -301,7 +301,7 @@ bool SoundManager::playSample(int id, int sub, bool bLooped, int x, int y, int p
|
|||
}
|
||||
|
||||
debugC(DEBUG_DETAILED, kTinselDebugSound, "Playing sound %d.%d, %d bytes at %d (pan %d)", id, sub, sampleLen,
|
||||
_sampleStream.pos(), getPan(x));
|
||||
(int)_sampleStream.pos(), getPan(x));
|
||||
|
||||
// allocate a buffer
|
||||
byte *sampleBuf = (byte *) malloc(sampleLen);
|
||||
|
|
|
@ -56,9 +56,9 @@ public:
|
|||
|
||||
uint32 read(void *dataPtr, uint32 dataSize) override;
|
||||
bool eos() const override { return _innerStream->eos(); }
|
||||
int32 pos() const override { return _innerStream->pos(); }
|
||||
int32 size() const override { return _innerStream->size(); }
|
||||
bool seek(int32 offset, int whence = SEEK_SET) override {
|
||||
int64 pos() const override { return _innerStream->pos(); }
|
||||
int64 size() const override { return _innerStream->size(); }
|
||||
bool seek(int64 offset, int whence = SEEK_SET) override {
|
||||
return _innerStream->seek(offset, whence);
|
||||
}
|
||||
bool skip(uint32 offset) override {
|
||||
|
|
|
@ -179,7 +179,7 @@ void MoviePlayer::playMovie(uint resIndex) {
|
|||
_vm->_screen->finishTalkTextItems();
|
||||
break;
|
||||
default:
|
||||
error("MoviePlayer::playMovie(%04X) Unknown chunk type %d at %08X", resIndex, chunkType, _vm->_arc->pos() - 5 - chunkSize);
|
||||
error("MoviePlayer::playMovie(%04X) Unknown chunk type %d at %08X", resIndex, chunkType, (int)_vm->_arc->pos() - 5 - chunkSize);
|
||||
}
|
||||
|
||||
if (!handleInput())
|
||||
|
|
|
@ -100,7 +100,7 @@ uint32 LzssReadStream::read(void *buf, uint32 dataSize) {
|
|||
return dataSize;
|
||||
}
|
||||
|
||||
bool LzssReadStream::seek(int32 offset, int whence) {
|
||||
bool LzssReadStream::seek(int64 offset, int whence) {
|
||||
if (whence == SEEK_SET) {
|
||||
_pos = offset;
|
||||
} else if (whence == SEEK_CUR) {
|
||||
|
|
|
@ -42,9 +42,9 @@ public:
|
|||
|
||||
void clearErr() override { _err = false; }
|
||||
bool err() const override { return _err; }
|
||||
int32 pos() const override { return _pos; }
|
||||
int32 size() const override { return _size; }
|
||||
bool seek(int32 offset, int whence = SEEK_SET) override;
|
||||
int64 pos() const override { return _pos; }
|
||||
int64 size() const override { return _size; }
|
||||
bool seek(int64 offset, int whence = SEEK_SET) override;
|
||||
|
||||
bool eos() const override;
|
||||
uint32 read(void *buf, uint32 size) override;
|
||||
|
|
|
@ -1876,7 +1876,7 @@ void ScriptLife::processLifeScript(int32 actorIdx) {
|
|||
if (scriptOpcode < ARRAYSIZE(function_map)) {
|
||||
end = function_map[scriptOpcode].function(_engine, ctx);
|
||||
} else {
|
||||
error("Actor %d with wrong offset/opcode - Offset: %d (opcode: %i)", actorIdx, ctx.stream.pos() - 1, scriptOpcode);
|
||||
error("Actor %d with wrong offset/opcode - Offset: %d (opcode: %i)", actorIdx, (int)ctx.stream.pos() - 1, scriptOpcode);
|
||||
}
|
||||
|
||||
if (end < 0) {
|
||||
|
|
|
@ -723,7 +723,7 @@ void ScriptMove::processMoveScript(int32 actorIdx) {
|
|||
if (scriptOpcode < ARRAYSIZE(function_map)) {
|
||||
end = function_map[scriptOpcode].function(_engine, ctx);
|
||||
} else {
|
||||
error("Actor %d with wrong offset/opcode - Offset: %d (opcode: %u)", actorIdx, ctx.stream.pos() - 1, scriptOpcode);
|
||||
error("Actor %d with wrong offset/opcode - Offset: %d (opcode: %u)", actorIdx, (int)ctx.stream.pos() - 1, scriptOpcode);
|
||||
}
|
||||
|
||||
if (end < 0) {
|
||||
|
|
|
@ -127,7 +127,7 @@ void RawShapeFrame::loadGenericFormat(const uint8 *data, uint32 size, const Conv
|
|||
} else {
|
||||
if (ds.size() - ds.pos() < (int32)format->_bytes_line_offset) {
|
||||
warning("going off end of %d buffer at %d reading %d",
|
||||
ds.size(), ds.pos(), format->_bytes_line_offset);
|
||||
(int)ds.size(), (int)ds.pos(), format->_bytes_line_offset);
|
||||
}
|
||||
_line_offsets[i] = readX(ds, format->_bytes_line_offset) - ((_height - i) * format->_bytes_line_offset);
|
||||
}
|
||||
|
|
|
@ -41,7 +41,7 @@ public:
|
|||
ConsoleStream() : Common::WriteStream(), _precision(dec) {
|
||||
}
|
||||
|
||||
int32 pos() const override {
|
||||
int64 pos() const override {
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
|
|
@ -216,7 +216,7 @@ bool Script::execute(World *world, int loopCount, Common::String *inputText, Des
|
|||
processIf();
|
||||
break;
|
||||
case 0x87: // EXIT
|
||||
debug(6, "exit at offset %d", _data->pos() - 1);
|
||||
debug(6, "exit at offset %d", (int)_data->pos() - 1);
|
||||
|
||||
return true;
|
||||
case 0x89: // MOVE
|
||||
|
@ -267,7 +267,7 @@ bool Script::execute(World *world, int loopCount, Common::String *inputText, Des
|
|||
case 0x88: // END
|
||||
break;
|
||||
default:
|
||||
debug(0, "Unknown opcode: %d", _data->pos());
|
||||
debug(0, "Unknown opcode: %d", (int)_data->pos());
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -335,7 +335,7 @@ bool Script::execute(World *world, int loopCount, Common::String *inputText, Des
|
|||
Script::Operand *Script::readOperand() {
|
||||
byte operandType = _data->readByte();
|
||||
|
||||
debug(7, "%x: readOperand: 0x%x", _data->pos(), operandType);
|
||||
debug(7, "%x: readOperand: 0x%x", (int)_data->pos(), operandType);
|
||||
|
||||
Context *cont = &_world->_player->_context;
|
||||
switch (operandType) {
|
||||
|
@ -418,7 +418,7 @@ Script::Operand *Script::readOperand() {
|
|||
_data->seek(-1, SEEK_CUR);
|
||||
return readStringOperand();
|
||||
} else {
|
||||
debug("Dunno what %x is (index=%d)!\n", operandType, _data->pos()-1);
|
||||
debug("Dunno what %x is (index=%d)!\n", operandType, (int)_data->pos() - 1);
|
||||
}
|
||||
return NULL;
|
||||
}
|
||||
|
@ -486,7 +486,7 @@ void Script::assign(byte operandType, int uservar, uint16 value) {
|
|||
cont->_statVariables[PHYS_SPE_CUR] = value;
|
||||
break;
|
||||
default:
|
||||
debug("No idea what I'm supposed to assign! (%x at %d)!\n", operandType, _data->pos()-1);
|
||||
debug("No idea what I'm supposed to assign! (%x at %d)!\n", operandType, (int)_data->pos() - 1);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1207,7 +1207,7 @@ void Script::convertToText() {
|
|||
|
||||
if (c < 0x80) {
|
||||
if (c < 0x20) {
|
||||
warning("convertToText: Unknown code 0x%02x at %d", c, _data->pos());
|
||||
warning("convertToText: Unknown code 0x%02x at %d", c, (int)_data->pos());
|
||||
c = ' ';
|
||||
}
|
||||
|
||||
|
@ -1216,7 +1216,7 @@ void Script::convertToText() {
|
|||
c = _data->readByte();
|
||||
|
||||
if (c < 0x20) {
|
||||
warning("convertToText: Unknown code 0x%02x at %d", c, _data->pos());
|
||||
warning("convertToText: Unknown code 0x%02x at %d", c, (int)_data->pos());
|
||||
c = ' ';
|
||||
}
|
||||
} while (c < 0x80);
|
||||
|
|
|
@ -105,7 +105,7 @@ byte *BaseFileManager::readWholeFile(const Common::String &filename, uint32 *siz
|
|||
|
||||
buffer = new byte[file->size() + 1];
|
||||
if (buffer == nullptr) {
|
||||
debugC(kWintermuteDebugFileAccess | kWintermuteDebugLog, "Error allocating buffer for file '%s' (%d bytes)", filename.c_str(), file->size() + 1);
|
||||
debugC(kWintermuteDebugFileAccess | kWintermuteDebugLog, "Error allocating buffer for file '%s' (%d bytes)", filename.c_str(), (int)file->size() + 1);
|
||||
closeFile(file);
|
||||
return nullptr;
|
||||
}
|
||||
|
|
|
@ -638,7 +638,7 @@ uint32 OutFile::write(const void *dataPtr, uint32 dataSize) {
|
|||
return _backingStream.write(dataPtr, dataSize);
|
||||
}
|
||||
|
||||
int32 OutFile::pos() const {
|
||||
int64 OutFile::pos() const {
|
||||
return _backingStream.pos();
|
||||
}
|
||||
|
||||
|
|
|
@ -222,7 +222,7 @@ public:
|
|||
}
|
||||
bool flush() override { return _parentStream->flush(); }
|
||||
void finalize() override {}
|
||||
int32 pos() const override { return _parentStream->pos() - _begin; }
|
||||
int64 pos() const override { return _parentStream->pos() - _begin; }
|
||||
};
|
||||
|
||||
class StringArray : public Common::StringArray {
|
||||
|
@ -392,7 +392,7 @@ public:
|
|||
/**
|
||||
* Returns the current position
|
||||
*/
|
||||
int32 pos() const override;
|
||||
int64 pos() const override;
|
||||
};
|
||||
|
||||
} // End of namespace Xeen
|
||||
|
|
|
@ -653,7 +653,7 @@ bool Debugger::cmdMd5(int argc, const char **argv) {
|
|||
for (Common::ArchiveMemberList::iterator iter = list.begin(); iter != list.end(); ++iter) {
|
||||
Common::SeekableReadStream *stream = (*iter)->createReadStream();
|
||||
Common::String md5 = Common::computeStreamMD5AsString(*stream, length);
|
||||
debugPrintf("%s %s %d\n", md5.c_str(), (*iter)->getDisplayName().c_str(), stream->size());
|
||||
debugPrintf("%s %s %d\n", md5.c_str(), (*iter)->getDisplayName().c_str(), (int32)stream->size());
|
||||
delete stream;
|
||||
}
|
||||
}
|
||||
|
@ -703,7 +703,7 @@ bool Debugger::cmdMd5Mac(int argc, const char **argv) {
|
|||
if (macResMan.hasDataFork()) {
|
||||
Common::SeekableReadStream *stream = macResMan.getDataFork();
|
||||
Common::String md5 = Common::computeStreamMD5AsString(*stream, length);
|
||||
debugPrintf("%s %s (data) %d\n", md5.c_str(), macResMan.getBaseFileName().c_str(), stream->size());
|
||||
debugPrintf("%s %s (data) %d\n", md5.c_str(), macResMan.getBaseFileName().c_str(), (int32)stream->size());
|
||||
}
|
||||
}
|
||||
macResMan.close();
|
||||
|
|
Some files were not shown because too many files have changed in this diff Show more
Loading…
Add table
Add a link
Reference in a new issue