mirror of
https://github.com/libretro/scummvm.git
synced 2024-12-16 06:39:17 +00:00
TINSEL: Turn TinselFile into a SeekableReadStream
svn-id: r54439
This commit is contained in:
parent
382982d6e3
commit
b485d0ee49
@ -153,7 +153,7 @@ bool GotoCD() {
|
||||
|
||||
bool TinselFile::_warningShown = false;
|
||||
|
||||
TinselFile::TinselFile() {
|
||||
TinselFile::TinselFile() : ReadStreamEndian((_vm->getFeatures() & GF_BIG_ENDIAN) != 0) {
|
||||
_stream = NULL;
|
||||
}
|
||||
|
||||
@ -168,8 +168,7 @@ bool TinselFile::openInternal(const Common::String &filename) {
|
||||
if (!stream)
|
||||
return false;
|
||||
|
||||
_stream = new Common::SeekableSubReadStreamEndian(stream, 0, stream->size(),
|
||||
(_vm->getFeatures() & GF_BIG_ENDIAN) != 0, DisposeAfterUse::YES);
|
||||
_stream = new Common::SeekableSubReadStream(stream, 0, stream->size(), DisposeAfterUse::YES);
|
||||
return true;
|
||||
}
|
||||
|
||||
@ -226,24 +225,9 @@ bool TinselFile::err() const {
|
||||
return _stream->err();
|
||||
}
|
||||
|
||||
uint32 TinselFile::readUint32() {
|
||||
void TinselFile::clearErr() {
|
||||
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);
|
||||
_stream->clearErr();
|
||||
}
|
||||
|
||||
uint32 TinselFile::read(void *dataPtr, uint32 dataSize) {
|
||||
@ -251,9 +235,6 @@ uint32 TinselFile::read(void *dataPtr, uint32 dataSize) {
|
||||
return _stream->read(dataPtr, dataSize);
|
||||
}
|
||||
|
||||
bool TinselFile::skip(uint32 offset) {
|
||||
return seek(offset, SEEK_CUR);
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
@ -27,14 +27,10 @@
|
||||
#ifndef TINSEL_DRIVES_H
|
||||
#define TINSEL_DRIVES_H
|
||||
|
||||
#include "common/file.h"
|
||||
#include "common/stream.h"
|
||||
#include "tinsel/dw.h"
|
||||
#include "tinsel/coroutine.h"
|
||||
|
||||
namespace Common {
|
||||
class SeekableSubReadStreamEndian;
|
||||
}
|
||||
|
||||
namespace Tinsel {
|
||||
|
||||
// flags2
|
||||
@ -63,11 +59,10 @@ void SetNextCD(int cdNumber);
|
||||
|
||||
bool GotoCD();
|
||||
|
||||
// TODO: Make TinselFile a SeekableReadStream subclass??
|
||||
class TinselFile {
|
||||
class TinselFile : public Common::SeekableReadStream, public Common::ReadStreamEndian {
|
||||
private:
|
||||
static bool _warningShown;
|
||||
Common::SeekableSubReadStreamEndian *_stream;
|
||||
Common::SeekableReadStream *_stream;
|
||||
bool openInternal(const Common::String &filename);
|
||||
public:
|
||||
TinselFile();
|
||||
@ -76,17 +71,15 @@ public:
|
||||
void close();
|
||||
char getCdNumber();
|
||||
|
||||
bool err() const;
|
||||
void clearErr();
|
||||
|
||||
bool eos() const;
|
||||
uint32 read(void *dataPtr, uint32 dataSize);
|
||||
|
||||
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);
|
||||
};
|
||||
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user