aboutsummaryrefslogtreecommitdiff
path: root/engines
diff options
context:
space:
mode:
authorEugene Sandulenko2016-09-17 20:41:15 +0200
committerEugene Sandulenko2016-09-17 20:43:57 +0200
commit80419708d03811ac1605ccf1cafa34e64f389646 (patch)
tree2a96bef2127bf5310f564e61ac2c1d0b0873e452 /engines
parent210a57c4c07733edb31733a1c81a53b01fb6eb7a (diff)
downloadscummvm-rg350-80419708d03811ac1605ccf1cafa34e64f389646.tar.gz
scummvm-rg350-80419708d03811ac1605ccf1cafa34e64f389646.tar.bz2
scummvm-rg350-80419708d03811ac1605ccf1cafa34e64f389646.zip
FULLPIPE: Turned MfcArchive into read/write stream like in original
Diffstat (limited to 'engines')
-rw-r--r--engines/fullpipe/utils.cpp16
-rw-r--r--engines/fullpipe/utils.h13
2 files changed, 24 insertions, 5 deletions
diff --git a/engines/fullpipe/utils.cpp b/engines/fullpipe/utils.cpp
index de7cbbbaab..32503764d3 100644
--- a/engines/fullpipe/utils.cpp
+++ b/engines/fullpipe/utils.cpp
@@ -347,6 +347,20 @@ static CObject *createObject(int objectId) {
}
MfcArchive::MfcArchive(Common::SeekableReadStream *stream) {
+ _stream = stream;
+ _wstream = 0;
+
+ init();
+}
+
+MfcArchive::MfcArchive(Common::WriteStream *stream) {
+ _wstream = stream;
+ _stream = 0;
+
+ init();
+}
+
+void MfcArchive::init() {
for (int i = 0; classMap[i].name; i++) {
_classMap[classMap[i].name] = classMap[i].id;
}
@@ -354,8 +368,6 @@ MfcArchive::MfcArchive(Common::SeekableReadStream *stream) {
_lastIndex = 1;
_level = 0;
- _stream = stream;
-
_objectMap.push_back(0);
_objectIdMap.push_back(kNullObject);
}
diff --git a/engines/fullpipe/utils.h b/engines/fullpipe/utils.h
index da3ab7ee4f..3741b4ae0e 100644
--- a/engines/fullpipe/utils.h
+++ b/engines/fullpipe/utils.h
@@ -34,7 +34,7 @@ class NGIArchive;
typedef Common::HashMap<Common::String, int, Common::IgnoreCase_Hash, Common::IgnoreCase_EqualTo> ClassMap;
-class MfcArchive : public Common::SeekableReadStream {
+class MfcArchive : public Common::SeekableReadStream, Common::WriteStream {
ClassMap _classMap;
Common::Array<CObject *> _objectMap;
Common::Array<int> _objectIdMap;
@@ -43,9 +43,11 @@ class MfcArchive : public Common::SeekableReadStream {
int _level;
Common::SeekableReadStream *_stream;
+ Common::WriteStream *_wstream;
- public:
+public:
MfcArchive(Common::SeekableReadStream *file);
+ MfcArchive(Common::WriteStream *file);
char *readPascalString(bool twoByte = false);
int readCount();
@@ -59,9 +61,14 @@ class MfcArchive : public Common::SeekableReadStream {
virtual bool eos() const { return _stream->eos(); }
virtual uint32 read(void *dataPtr, uint32 dataSize) { return _stream->read(dataPtr, dataSize); }
- virtual int32 pos() const { return _stream->pos(); }
+ virtual int32 pos() const { return _stream ? _stream->pos() : _wstream->pos(); }
virtual int32 size() const { return _stream->size(); }
virtual bool seek(int32 offset, int whence = SEEK_SET) { return _stream->seek(offset, whence); }
+
+ virtual uint32 write(const void *dataPtr, uint32 dataSize) { return _wstream->write(dataPtr, dataSize); }
+
+private:
+ void init();
};
enum ObjType {