[Scummvm-cvs-logs] SF.net SVN: scummvm:[54385] scummvm/trunk

fingolfin at users.sourceforge.net fingolfin at users.sourceforge.net
Fri Nov 19 18:03:08 CET 2010


Revision: 54385
          http://scummvm.svn.sourceforge.net/scummvm/?rev=54385&view=rev
Author:   fingolfin
Date:     2010-11-19 17:03:07 +0000 (Fri, 19 Nov 2010)

Log Message:
-----------
COMMON: Split common/stream.h into several headers

Modified Paths:
--------------
    scummvm/trunk/backends/fs/ds/ds-fs.cpp
    scummvm/trunk/backends/fs/psp/psp-fs.cpp
    scummvm/trunk/backends/platform/dc/dcmain.cpp
    scummvm/trunk/backends/platform/ds/arm9/source/gbampsave.cpp
    scummvm/trunk/common/iff_container.h
    scummvm/trunk/common/macresman.cpp
    scummvm/trunk/common/module.mk
    scummvm/trunk/common/stream.cpp
    scummvm/trunk/common/stream.h
    scummvm/trunk/common/unarj.cpp
    scummvm/trunk/common/unzip.cpp
    scummvm/trunk/common/xmlparser.cpp
    scummvm/trunk/engines/agi/agi.cpp
    scummvm/trunk/engines/agi/preagi_winnie.cpp
    scummvm/trunk/engines/agi/sound_2gs.cpp
    scummvm/trunk/engines/agi/sound_midi.cpp
    scummvm/trunk/engines/agos/res.cpp
    scummvm/trunk/engines/agos/res_snd.cpp
    scummvm/trunk/engines/agos/sound.cpp
    scummvm/trunk/engines/cine/anim.cpp
    scummvm/trunk/engines/cine/bg.cpp
    scummvm/trunk/engines/cine/object.cpp
    scummvm/trunk/engines/cine/saveload.cpp
    scummvm/trunk/engines/cine/sound.cpp
    scummvm/trunk/engines/cruise/dataLoader.cpp
    scummvm/trunk/engines/cruise/overlay.cpp
    scummvm/trunk/engines/draci/animation.cpp
    scummvm/trunk/engines/draci/barchive.cpp
    scummvm/trunk/engines/draci/game.cpp
    scummvm/trunk/engines/draci/screen.cpp
    scummvm/trunk/engines/draci/script.cpp
    scummvm/trunk/engines/draci/sound.cpp
    scummvm/trunk/engines/draci/sprite.cpp
    scummvm/trunk/engines/draci/walking.cpp
    scummvm/trunk/engines/gob/dataio.cpp
    scummvm/trunk/engines/gob/demos/demoplayer.cpp
    scummvm/trunk/engines/gob/map_v1.cpp
    scummvm/trunk/engines/gob/resources.cpp
    scummvm/trunk/engines/gob/save/saveconverter.cpp
    scummvm/trunk/engines/gob/save/saveconverter.h
    scummvm/trunk/engines/gob/save/savefile.cpp
    scummvm/trunk/engines/gob/sound/sounddesc.cpp
    scummvm/trunk/engines/groovie/music.cpp
    scummvm/trunk/engines/groovie/resource.cpp
    scummvm/trunk/engines/groovie/saveload.cpp
    scummvm/trunk/engines/kyra/resource_intern.cpp
    scummvm/trunk/engines/kyra/saveload_hof.cpp
    scummvm/trunk/engines/kyra/saveload_lol.cpp
    scummvm/trunk/engines/kyra/saveload_mr.cpp
    scummvm/trunk/engines/kyra/screen.cpp
    scummvm/trunk/engines/lastexpress/data/animation.cpp
    scummvm/trunk/engines/lastexpress/data/archive.cpp
    scummvm/trunk/engines/lastexpress/data/cursor.cpp
    scummvm/trunk/engines/lastexpress/data/snd.cpp
    scummvm/trunk/engines/lastexpress/game/savegame.h
    scummvm/trunk/engines/m4/assets.cpp
    scummvm/trunk/engines/m4/compression.cpp
    scummvm/trunk/engines/m4/compression.h
    scummvm/trunk/engines/m4/converse.cpp
    scummvm/trunk/engines/m4/graphics.cpp
    scummvm/trunk/engines/m4/m4.cpp
    scummvm/trunk/engines/m4/midi.cpp
    scummvm/trunk/engines/m4/resource.cpp
    scummvm/trunk/engines/m4/script.h
    scummvm/trunk/engines/m4/woodscript.cpp
    scummvm/trunk/engines/m4/woodscript.h
    scummvm/trunk/engines/made/database.cpp
    scummvm/trunk/engines/made/redreader.cpp
    scummvm/trunk/engines/made/redreader.h
    scummvm/trunk/engines/made/resource.cpp
    scummvm/trunk/engines/mohawk/bitmap.cpp
    scummvm/trunk/engines/mohawk/livingbooks.h
    scummvm/trunk/engines/mohawk/resource.cpp
    scummvm/trunk/engines/mohawk/riven_saveload.h
    scummvm/trunk/engines/parallaction/disk_ns.cpp
    scummvm/trunk/engines/parallaction/font.cpp
    scummvm/trunk/engines/parallaction/parallaction.cpp
    scummvm/trunk/engines/parallaction/parallaction.h
    scummvm/trunk/engines/parallaction/parser.cpp
    scummvm/trunk/engines/parallaction/parser.h
    scummvm/trunk/engines/queen/resource.cpp
    scummvm/trunk/engines/queen/sound.cpp
    scummvm/trunk/engines/saga/music.cpp
    scummvm/trunk/engines/saga/saga.h
    scummvm/trunk/engines/sci/graphics/maciconbar.cpp
    scummvm/trunk/engines/sci/sound/audio.cpp
    scummvm/trunk/engines/sci/sound/drivers/amigamac.cpp
    scummvm/trunk/engines/sci/sound/drivers/midi.cpp
    scummvm/trunk/engines/scumm/file.cpp
    scummvm/trunk/engines/scumm/file.h
    scummvm/trunk/engines/scumm/file_nes.h
    scummvm/trunk/engines/scumm/he/cup_player_he.cpp
    scummvm/trunk/engines/scumm/he/resource_he.cpp
    scummvm/trunk/engines/scumm/he/resource_he.h
    scummvm/trunk/engines/scumm/imuse_digi/dimuse_sndmgr.cpp
    scummvm/trunk/engines/scumm/saveload.cpp
    scummvm/trunk/engines/scumm/sound.cpp
    scummvm/trunk/engines/sword1/sound.cpp
    scummvm/trunk/engines/sword2/console.cpp
    scummvm/trunk/engines/sword2/header.h
    scummvm/trunk/engines/sword2/icons.cpp
    scummvm/trunk/engines/sword2/module.mk
    scummvm/trunk/engines/sword2/music.cpp
    scummvm/trunk/engines/sword2/object.h
    scummvm/trunk/engines/sword2/screen.h
    scummvm/trunk/engines/sword2/sound.cpp
    scummvm/trunk/engines/sword25/gfx/graphicengine.h
    scummvm/trunk/engines/sword25/gfx/image/pngloader.cpp
    scummvm/trunk/engines/sword25/gfx/screenshot.cpp
    scummvm/trunk/engines/sword25/gfx/screenshot.h
    scummvm/trunk/engines/sword25/kernel/persistenceservice.cpp
    scummvm/trunk/engines/teenagent/inventory.cpp
    scummvm/trunk/engines/teenagent/objects.cpp
    scummvm/trunk/engines/teenagent/pack.cpp
    scummvm/trunk/engines/testbed/midi.cpp
    scummvm/trunk/engines/testbed/midi.h
    scummvm/trunk/engines/tinsel/music.cpp
    scummvm/trunk/engines/tinsel/sound.cpp
    scummvm/trunk/engines/toon/audio.cpp
    scummvm/trunk/engines/toon/resource.cpp
    scummvm/trunk/engines/toon/toon.cpp
    scummvm/trunk/engines/toon/toon.h
    scummvm/trunk/engines/touche/resource.cpp
    scummvm/trunk/engines/tucker/resource.cpp
    scummvm/trunk/graphics/pict.cpp
    scummvm/trunk/graphics/video/coktel_decoder.cpp
    scummvm/trunk/graphics/video/qt_decoder.cpp
    scummvm/trunk/sound/decoders/raw.cpp
    scummvm/trunk/sound/mods/infogrames.cpp
    scummvm/trunk/test/common/bufferedreadstream.h
    scummvm/trunk/test/common/bufferedseekablereadstream.h
    scummvm/trunk/test/common/memoryreadstream.h
    scummvm/trunk/test/common/seekablesubreadstream.h
    scummvm/trunk/test/common/stream.h
    scummvm/trunk/test/common/subreadstream.h

Added Paths:
-----------
    scummvm/trunk/common/bufferedstream.h
    scummvm/trunk/common/iff_container.cpp
    scummvm/trunk/common/memstream.h
    scummvm/trunk/common/substream.h
    scummvm/trunk/engines/sword2/header.cpp

Modified: scummvm/trunk/backends/fs/ds/ds-fs.cpp
===================================================================
--- scummvm/trunk/backends/fs/ds/ds-fs.cpp	2010-11-19 16:52:09 UTC (rev 54384)
+++ scummvm/trunk/backends/fs/ds/ds-fs.cpp	2010-11-19 17:03:07 UTC (rev 54385)
@@ -33,6 +33,7 @@
 #include "backends/fs/stdiostream.h"
 #include "dsmain.h"
 #include "fat/gba_nds_fat.h"
+#include "common/bufferedstream.h"
 
 namespace DS {
 

Modified: scummvm/trunk/backends/fs/psp/psp-fs.cpp
===================================================================
--- scummvm/trunk/backends/fs/psp/psp-fs.cpp	2010-11-19 16:52:09 UTC (rev 54384)
+++ scummvm/trunk/backends/fs/psp/psp-fs.cpp	2010-11-19 17:03:07 UTC (rev 54385)
@@ -27,6 +27,7 @@
 #include "engines/engine.h"
 #include "backends/fs/abstract-fs.h"
 #include "backends/fs/psp/psp-stream.h"
+#include "common/bufferedstream.h"
 
 #include <sys/stat.h>
 #include <unistd.h>

Modified: scummvm/trunk/backends/platform/dc/dcmain.cpp
===================================================================
--- scummvm/trunk/backends/platform/dc/dcmain.cpp	2010-11-19 16:52:09 UTC (rev 54384)
+++ scummvm/trunk/backends/platform/dc/dcmain.cpp	2010-11-19 17:03:07 UTC (rev 54385)
@@ -31,7 +31,7 @@
 #include "icon.h"
 #include "DCLauncherDialog.h"
 #include <common/config-manager.h>
-#include <common/stream.h>
+#include <common/memstream.h>
 
 #include "backends/plugins/dc/dc-provider.h"
 #include "sound/mixer_intern.h"

Modified: scummvm/trunk/backends/platform/ds/arm9/source/gbampsave.cpp
===================================================================
--- scummvm/trunk/backends/platform/ds/arm9/source/gbampsave.cpp	2010-11-19 16:52:09 UTC (rev 54384)
+++ scummvm/trunk/backends/platform/ds/arm9/source/gbampsave.cpp	2010-11-19 17:03:07 UTC (rev 54385)
@@ -30,8 +30,8 @@
 #include "fat/gba_nds_fat.h"
 #include "backends/fs/ds/ds-fs.h"
 #include "common/config-manager.h"
+#include "common/bufferedstream.h"
 
-
 #define SAVE_BUFFER_SIZE 100000
 
 // This method copied from an old version of the savefile.cpp, since it's been removed from there and

Added: scummvm/trunk/common/bufferedstream.h
===================================================================
--- scummvm/trunk/common/bufferedstream.h	                        (rev 0)
+++ scummvm/trunk/common/bufferedstream.h	2010-11-19 17:03:07 UTC (rev 54385)
@@ -0,0 +1,68 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ *
+ * $URL$
+ * $Id$
+ *
+ */
+
+#ifndef COMMON_BUFFEREDSTREAM_H
+#define COMMON_BUFFEREDSTREAM_H
+
+#include "common/stream.h"
+
+namespace Common {
+
+/**
+ * Take an arbitrary ReadStream and wrap it in a custom stream which
+ * transparently provides buffering.
+ * Users can specify how big the buffer should be, and whether the wrapped
+ * stream should be disposed when the wrapper is disposed.
+ *
+ * It is safe to call this with a NULL parameter (in this case, NULL is
+ * returned).
+ */
+ReadStream *wrapBufferedReadStream(ReadStream *parentStream, uint32 bufSize, DisposeAfterUse::Flag disposeParentStream);
+
+/**
+ * Take an arbitrary SeekableReadStream and wrap it in a custom stream which
+ * transparently provides buffering.
+ * Users can specify how big the buffer should be, and whether the wrapped
+ * stream should be disposed when the wrapper is disposed.
+ *
+ * It is safe to call this with a NULL parameter (in this case, NULL is
+ * returned).
+ */
+SeekableReadStream *wrapBufferedSeekableReadStream(SeekableReadStream *parentStream, uint32 bufSize, DisposeAfterUse::Flag disposeParentStream);
+
+/**
+ * Take an arbitrary WriteStream and wrap it in a custom stream which
+ * transparently provides buffering.
+ * Users can specify how big the buffer should be. Currently, the
+ * parent stream is \em always disposed when the wrapper is disposed.
+ *
+ * It is safe to call this with a NULL parameter (in this case, NULL is
+ * returned).
+ */
+WriteStream *wrapBufferedWriteStream(WriteStream *parentStream, uint32 bufSize);
+
+}	// End of namespace Common
+
+#endif


Property changes on: scummvm/trunk/common/bufferedstream.h
___________________________________________________________________
Added: svn:mime-type
   + text/plain
Added: svn:keywords
   + Date Rev Author URL Id
Added: svn:eol-style
   + native

Added: scummvm/trunk/common/iff_container.cpp
===================================================================
--- scummvm/trunk/common/iff_container.cpp	                        (rev 0)
+++ scummvm/trunk/common/iff_container.cpp	2010-11-19 17:03:07 UTC (rev 54385)
@@ -0,0 +1,81 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ *
+ * $URL$
+ * $Id$
+ *
+ */
+
+#include "common/iff_container.h"
+#include "common/substream.h"
+
+namespace Common {
+
+IFFParser::IFFParser(Common::ReadStream *stream, bool disposeStream) : _stream(stream), _disposeStream(disposeStream) {
+	setInputStream(stream);
+}
+
+IFFParser::~IFFParser() {
+	if (_disposeStream) {
+		delete _stream;
+	}
+	_stream = 0;
+}
+
+void IFFParser::setInputStream(Common::ReadStream *stream) {
+	assert(stream);
+	_formChunk.setInputStream(stream);
+	_chunk.setInputStream(stream);
+
+	_formChunk.readHeader();
+	if (_formChunk.id != ID_FORM) {
+		error("IFFParser input is not a FORM type IFF file");
+	}
+	_formSize = _formChunk.size;
+	_formType = _formChunk.readUint32BE();
+}
+
+void IFFParser::parse(IFFCallback &callback) {
+	bool stop;
+	do {
+		_chunk.feed();
+		_formChunk.incBytesRead(_chunk.size);
+
+		if (_formChunk.hasReadAll()) {
+			break;
+		}
+
+		_formChunk.incBytesRead(8);
+		_chunk.readHeader();
+
+		// invoke the callback
+		Common::SubReadStream stream(&_chunk, _chunk.size);
+		IFFChunk chunk(_chunk.id, _chunk.size, &stream);
+		stop = callback(chunk);
+
+		// eats up all the remaining data in the chunk
+		while (!stream.eos()) {
+			stream.readByte();
+		}
+
+	} while (!stop);
+}
+
+}	// End of namespace Common


Property changes on: scummvm/trunk/common/iff_container.cpp
___________________________________________________________________
Added: svn:mime-type
   + text/plain
Added: svn:keywords
   + Date Rev Author URL Id
Added: svn:eol-style
   + native

Modified: scummvm/trunk/common/iff_container.h
===================================================================
--- scummvm/trunk/common/iff_container.h	2010-11-19 16:52:09 UTC (rev 54384)
+++ scummvm/trunk/common/iff_container.h	2010-11-19 17:03:07 UTC (rev 54385)
@@ -223,43 +223,13 @@
 	Common::ReadStream *_stream;
 	bool _disposeStream;
 
-	void setInputStream(Common::ReadStream *stream) {
-		assert(stream);
-		_formChunk.setInputStream(stream);
-		_chunk.setInputStream(stream);
+	void setInputStream(Common::ReadStream *stream);
 
-		_formChunk.readHeader();
-		if (_formChunk.id != ID_FORM) {
-			error("IFFParser input is not a FORM type IFF file");
-		}
-		_formSize = _formChunk.size;
-		_formType = _formChunk.readUint32BE();
-	}
-
 public:
-	IFFParser(Common::ReadStream *stream, bool disposeStream = false) : _stream(stream), _disposeStream(disposeStream) {
-		setInputStream(stream);
-	}
-	~IFFParser() {
-		if (_disposeStream) {
-			delete _stream;
-		}
-		_stream = 0;
-	}
+	IFFParser(Common::ReadStream *stream, bool disposeStream = false);
+	~IFFParser();
 
 	/**
-	 * Returns the IFF FORM type.
-	 * @return the IFF FORM type of the stream, or 0 if FORM header is not found.
-	 */
-	Common::IFF_ID getFORMType() const;
-
-	/**
-	 * Returns the size of the data.
-	 * @return the size of the data in file, or -1 if FORM header is not found.
-	 */
-	uint32 getFORMSize() const;
-
-	/**
 	 * Callback type for the parser.
 	 */
 	typedef Common::Functor1< IFFChunk&, bool > IFFCallback;
@@ -268,31 +238,7 @@
 	 * Parse the IFF container, invoking the callback on each chunk encountered.
 	 * The callback can interrupt the parsing by returning 'true'.
 	 */
-	void parse(IFFCallback &callback) {
-		bool stop;
-		do {
-			_chunk.feed();
-			_formChunk.incBytesRead(_chunk.size);
-
-			if (_formChunk.hasReadAll()) {
-				break;
-			}
-
-			_formChunk.incBytesRead(8);
-			_chunk.readHeader();
-
-			// invoke the callback
-			Common::SubReadStream stream(&_chunk, _chunk.size);
-			IFFChunk chunk(_chunk.id, _chunk.size, &stream);
-			stop = callback(chunk);
-
-			// eats up all the remaining data in the chunk
-			while (!stream.eos()) {
-				stream.readByte();
-			}
-
-		} while (!stop);
-	}
+	void parse(IFFCallback &callback);
 };
 
 

Modified: scummvm/trunk/common/macresman.cpp
===================================================================
--- scummvm/trunk/common/macresman.cpp	2010-11-19 16:52:09 UTC (rev 54384)
+++ scummvm/trunk/common/macresman.cpp	2010-11-19 17:03:07 UTC (rev 54385)
@@ -30,6 +30,8 @@
 #include "common/fs.h"
 #include "common/macresman.h"
 #include "common/md5.h"
+#include "common/substream.h"
+#include "common/memstream.h"
 
 #ifdef MACOSX
 #include "common/config-manager.h"

Added: scummvm/trunk/common/memstream.h
===================================================================
--- scummvm/trunk/common/memstream.h	                        (rev 0)
+++ scummvm/trunk/common/memstream.h	2010-11-19 17:03:07 UTC (rev 54385)
@@ -0,0 +1,199 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ *
+ * $URL$
+ * $Id$
+ *
+ */
+
+#ifndef COMMON_MEMSTREAM_H
+#define COMMON_MEMSTREAM_H
+
+#include "common/stream.h"
+
+namespace Common {
+
+/**
+ * Simple memory based 'stream', which implements the ReadStream interface for
+ * a plain memory block.
+ */
+class MemoryReadStream : public SeekableReadStream {
+private:
+	const byte * const _ptrOrig;
+	const byte *_ptr;
+	const uint32 _size;
+	uint32 _pos;
+	byte _encbyte;
+	DisposeAfterUse::Flag _disposeMemory;
+	bool _eos;
+
+public:
+
+	/**
+	 * This constructor takes a pointer to a memory buffer and a length, and
+	 * wraps it. If disposeMemory is true, the MemoryReadStream takes ownership
+	 * of the buffer and hence free's it when destructed.
+	 */
+	MemoryReadStream(const byte *dataPtr, uint32 dataSize, DisposeAfterUse::Flag disposeMemory = DisposeAfterUse::NO) :
+		_ptrOrig(dataPtr),
+		_ptr(dataPtr),
+		_size(dataSize),
+		_pos(0),
+		_encbyte(0),
+		_disposeMemory(disposeMemory),
+		_eos(false) {}
+
+	~MemoryReadStream() {
+		if (_disposeMemory)
+			free(const_cast<byte *>(_ptrOrig));
+	}
+
+	void setEnc(byte value) { _encbyte = value; }
+
+	uint32 read(void *dataPtr, uint32 dataSize);
+
+	bool eos() const { return _eos; }
+	void clearErr() { _eos = false; }
+
+	int32 pos() const { return _pos; }
+	int32 size() const { return _size; }
+
+	bool seek(int32 offs, int whence = SEEK_SET);
+};
+
+
+/**
+ * This is a wrapper around MemoryReadStream, but it adds non-endian
+ * read methods whose endianness is set on the stream creation.
+ */
+class MemoryReadStreamEndian : public MemoryReadStream {
+private:
+	const bool _bigEndian;
+
+public:
+	MemoryReadStreamEndian(const byte *buf, uint32 len, bool bigEndian = false) : MemoryReadStream(buf, len), _bigEndian(bigEndian) {}
+
+	uint16 readUint16() {
+		uint16 val;
+		read(&val, 2);
+		return (_bigEndian) ? TO_BE_16(val) : TO_LE_16(val);
+	}
+
+	uint32 readUint32() {
+		uint32 val;
+		read(&val, 4);
+		return (_bigEndian) ? TO_BE_32(val) : TO_LE_32(val);
+	}
+
+	FORCEINLINE int16 readSint16() {
+		return (int16)readUint16();
+	}
+
+	FORCEINLINE int32 readSint32() {
+		return (int32)readUint32();
+	}
+};
+
+/**
+ * Simple memory based 'stream', which implements the WriteStream interface for
+ * a plain memory block.
+ */
+class MemoryWriteStream : public WriteStream {
+private:
+	byte *_ptr;
+	const uint32 _bufSize;
+	uint32 _pos;
+public:
+	MemoryWriteStream(byte *buf, uint32 len) : _ptr(buf), _bufSize(len), _pos(0) {}
+
+	uint32 write(const void *dataPtr, uint32 dataSize) {
+		// Write at most as many bytes as are still available...
+		if (dataSize > _bufSize - _pos)
+			dataSize = _bufSize - _pos;
+		memcpy(_ptr, dataPtr, dataSize);
+		_ptr += dataSize;
+		_pos += dataSize;
+		return dataSize;
+	}
+
+	uint32 pos() const { return _pos; }
+	uint32 size() const { return _bufSize; }
+};
+
+/**
+ * A sort of hybrid between MemoryWriteStream and Array classes. A stream
+ * that grows as it's written to.
+ */
+class MemoryWriteStreamDynamic : public WriteStream {
+private:
+	uint32 _capacity;
+	uint32 _size;
+	byte *_ptr;
+	byte *_data;
+	uint32 _pos;
+	DisposeAfterUse::Flag _disposeMemory;
+
+	void ensureCapacity(uint32 new_len) {
+		if (new_len <= _capacity)
+			return;
+
+		byte *old_data = _data;
+
+		_capacity = new_len + 32;
+		_data = (byte *)malloc(_capacity);
+		_ptr = _data + _pos;
+
+		if (old_data) {
+			// Copy old data
+			memcpy(_data, old_data, _size);
+			free(old_data);
+		}
+
+		_size = new_len;
+	}
+public:
+	MemoryWriteStreamDynamic(DisposeAfterUse::Flag disposeMemory = DisposeAfterUse::NO) : _capacity(0), _size(0), _ptr(0), _data(0), _pos(0), _disposeMemory(disposeMemory) {}
+
+	~MemoryWriteStreamDynamic() {
+		if (_disposeMemory)
+			free(_data);
+	}
+
+	uint32 write(const void *dataPtr, uint32 dataSize) {
+		ensureCapacity(_pos + dataSize);
+		memcpy(_ptr, dataPtr, dataSize);
+		_ptr += dataSize;
+		_pos += dataSize;
+		if (_pos > _size)
+			_size = _pos;
+		return dataSize;
+	}
+
+	uint32 pos() const { return _pos; }
+	uint32 size() const { return _size; }
+
+	byte *getData() { return _data; }
+
+	bool seek(int32 offset, int whence = SEEK_SET);
+};
+
+}	// End of namespace Common
+
+#endif


Property changes on: scummvm/trunk/common/memstream.h
___________________________________________________________________
Added: svn:mime-type
   + text/plain
Added: svn:keywords
   + Date Rev Author URL Id
Added: svn:eol-style
   + native

Modified: scummvm/trunk/common/module.mk
===================================================================
--- scummvm/trunk/common/module.mk	2010-11-19 16:52:09 UTC (rev 54384)
+++ scummvm/trunk/common/module.mk	2010-11-19 17:03:07 UTC (rev 54385)
@@ -11,6 +11,7 @@
 	file.o \
 	fs.o \
 	hashmap.o \
+	iff_container.o \
 	macresman.o \
 	memorypool.o \
 	md5.o \

Modified: scummvm/trunk/common/stream.cpp
===================================================================
--- scummvm/trunk/common/stream.cpp	2010-11-19 16:52:09 UTC (rev 54384)
+++ scummvm/trunk/common/stream.cpp	2010-11-19 17:03:07 UTC (rev 54385)
@@ -24,6 +24,9 @@
  */
 
 #include "common/stream.h"
+#include "common/memstream.h"
+#include "common/substream.h"
+#include "common/bufferedstream.h"
 #include "common/str.h"
 #include "common/util.h"
 
@@ -33,7 +36,7 @@
 	write(str.c_str(), str.size());
 }
 
-MemoryReadStream *ReadStream::readStream(uint32 dataSize) {
+SeekableReadStream *ReadStream::readStream(uint32 dataSize) {
 	void *buf = malloc(dataSize);
 	dataSize = read(buf, dataSize);
 	assert(dataSize > 0);

Modified: scummvm/trunk/common/stream.h
===================================================================
--- scummvm/trunk/common/stream.h	2010-11-19 16:52:09 UTC (rev 54384)
+++ scummvm/trunk/common/stream.h	2010-11-19 17:03:07 UTC (rev 54385)
@@ -32,7 +32,7 @@
 namespace Common {
 
 class String;
-class MemoryReadStream;
+class SeekableReadStream;
 
 /**
  * Virtual base class for both ReadStream and WriteStream.
@@ -301,7 +301,7 @@
 	 * the end of the stream was reached. Which can be determined by
 	 * calling err() and eos().
 	 */
-	MemoryReadStream *readStream(uint32 dataSize);
+	SeekableReadStream *readStream(uint32 dataSize);
 
 };
 
@@ -389,297 +389,6 @@
 	virtual String readLine();
 };
 
-
-/**
- * SubReadStream provides access to a ReadStream restricted to the range
- * [currentPosition, currentPosition+end).
- *
- * Manipulating the parent stream directly /will/ mess up a substream.
- * Likewise, manipulating two substreams of a parent stream will cause them to
- * step on each others toes.
- */
-class SubReadStream : virtual public ReadStream {
-protected:
-	ReadStream *_parentStream;
-	DisposeAfterUse::Flag _disposeParentStream;
-	uint32 _pos;
-	uint32 _end;
-	bool _eos;
-public:
-	SubReadStream(ReadStream *parentStream, uint32 end, DisposeAfterUse::Flag disposeParentStream = DisposeAfterUse::NO)
-		: _parentStream(parentStream),
-		  _disposeParentStream(disposeParentStream),
-		  _pos(0),
-		  _end(end),
-		  _eos(false) {
-		assert(parentStream);
-	}
-	~SubReadStream() {
-		if (_disposeParentStream)
-			delete _parentStream;
-	}
-
-	virtual bool eos() const { return _eos; }
-	virtual bool err() const { return _parentStream->err(); }
-	virtual void clearErr() { _eos = false; _parentStream->clearErr(); }
-	virtual uint32 read(void *dataPtr, uint32 dataSize);
-};
-
-/*
- * SeekableSubReadStream provides access to a SeekableReadStream restricted to
- * the range [begin, end).
- * The same caveats apply to SeekableSubReadStream as do to SeekableReadStream.
- *
- * Manipulating the parent stream directly /will/ mess up a substream.
- * @see SubReadStream
- */
-class SeekableSubReadStream : public SubReadStream, public SeekableReadStream {
-protected:
-	SeekableReadStream *_parentStream;
-	uint32 _begin;
-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 bool seek(int32 offset, int whence = SEEK_SET);
-};
-
-/**
- * This is a wrapper around SeekableSubReadStream, but it adds non-endian
- * read methods whose endianness is set on the stream creation.
- *
- * Manipulating the parent stream directly /will/ mess up a substream.
- * @see SubReadStream
- */
-class SeekableSubReadStreamEndian : public SeekableSubReadStream {
-private:
-	const bool _bigEndian;
-
-public:
-	SeekableSubReadStreamEndian(SeekableReadStream *parentStream, uint32 begin, uint32 end, bool bigEndian = false, DisposeAfterUse::Flag disposeParentStream = DisposeAfterUse::NO)
-		: SeekableSubReadStream(parentStream, begin, end, disposeParentStream), _bigEndian(bigEndian) {
-	}
-
-	uint16 readUint16() {
-		uint16 val;
-		read(&val, 2);
-		return (_bigEndian) ? TO_BE_16(val) : TO_LE_16(val);
-	}
-
-	uint32 readUint32() {
-		uint32 val;
-		read(&val, 4);
-		return (_bigEndian) ? TO_BE_32(val) : TO_LE_32(val);
-	}
-
-	FORCEINLINE int16 readSint16() {
-		return (int16)readUint16();
-	}
-
-	FORCEINLINE int32 readSint32() {
-		return (int32)readUint32();
-	}
-};
-
-/**
- * Take an arbitrary ReadStream and wrap it in a custom stream which
- * transparently provides buffering.
- * Users can specify how big the buffer should be, and whether the wrapped
- * stream should be disposed when the wrapper is disposed.
- *
- * It is safe to call this with a NULL parameter (in this case, NULL is
- * returned).
- */
-ReadStream *wrapBufferedReadStream(ReadStream *parentStream, uint32 bufSize, DisposeAfterUse::Flag disposeParentStream);
-
-/**
- * Take an arbitrary SeekableReadStream and wrap it in a custom stream which
- * transparently provides buffering.
- * Users can specify how big the buffer should be, and whether the wrapped
- * stream should be disposed when the wrapper is disposed.
- *
- * It is safe to call this with a NULL parameter (in this case, NULL is
- * returned).
- */
-SeekableReadStream *wrapBufferedSeekableReadStream(SeekableReadStream *parentStream, uint32 bufSize, DisposeAfterUse::Flag disposeParentStream);
-
-/**
- * Take an arbitrary WriteStream and wrap it in a custom stream which
- * transparently provides buffering.
- * Users can specify how big the buffer should be. Currently, the
- * parent stream is \em always disposed when the wrapper is disposed.
- *
- * It is safe to call this with a NULL parameter (in this case, NULL is
- * returned).
- */
-WriteStream *wrapBufferedWriteStream(WriteStream *parentStream, uint32 bufSize);
-
-/**
- * Simple memory based 'stream', which implements the ReadStream interface for
- * a plain memory block.
- */
-class MemoryReadStream : public SeekableReadStream {
-private:
-	const byte * const _ptrOrig;
-	const byte *_ptr;
-	const uint32 _size;
-	uint32 _pos;
-	byte _encbyte;
-	DisposeAfterUse::Flag _disposeMemory;
-	bool _eos;
-
-public:
-
-	/**
-	 * This constructor takes a pointer to a memory buffer and a length, and
-	 * wraps it. If disposeMemory is true, the MemoryReadStream takes ownership
-	 * of the buffer and hence free's it when destructed.
-	 */
-	MemoryReadStream(const byte *dataPtr, uint32 dataSize, DisposeAfterUse::Flag disposeMemory = DisposeAfterUse::NO) :
-		_ptrOrig(dataPtr),
-		_ptr(dataPtr),
-		_size(dataSize),
-		_pos(0),
-		_encbyte(0),
-		_disposeMemory(disposeMemory),
-		_eos(false) {}
-
-	~MemoryReadStream() {
-		if (_disposeMemory)
-			free(const_cast<byte *>(_ptrOrig));
-	}
-
-	void setEnc(byte value) { _encbyte = value; }
-
-	uint32 read(void *dataPtr, uint32 dataSize);
-
-	bool eos() const { return _eos; }
-	void clearErr() { _eos = false; }
-
-	int32 pos() const { return _pos; }
-	int32 size() const { return _size; }
-
-	bool seek(int32 offs, int whence = SEEK_SET);
-};
-
-
-/**
- * This is a wrapper around MemoryReadStream, but it adds non-endian
- * read methods whose endianness is set on the stream creation.
- */
-class MemoryReadStreamEndian : public MemoryReadStream {
-private:
-	const bool _bigEndian;
-
-public:
-	MemoryReadStreamEndian(const byte *buf, uint32 len, bool bigEndian = false) : MemoryReadStream(buf, len), _bigEndian(bigEndian) {}
-
-	uint16 readUint16() {
-		uint16 val;
-		read(&val, 2);
-		return (_bigEndian) ? TO_BE_16(val) : TO_LE_16(val);
-	}
-
-	uint32 readUint32() {
-		uint32 val;
-		read(&val, 4);
-		return (_bigEndian) ? TO_BE_32(val) : TO_LE_32(val);
-	}
-
-	FORCEINLINE int16 readSint16() {
-		return (int16)readUint16();
-	}
-
-	FORCEINLINE int32 readSint32() {
-		return (int32)readUint32();
-	}
-};
-
-/**
- * Simple memory based 'stream', which implements the WriteStream interface for
- * a plain memory block.
- */
-class MemoryWriteStream : public WriteStream {
-private:
-	byte *_ptr;
-	const uint32 _bufSize;
-	uint32 _pos;
-public:
-	MemoryWriteStream(byte *buf, uint32 len) : _ptr(buf), _bufSize(len), _pos(0) {}
-
-	uint32 write(const void *dataPtr, uint32 dataSize) {
-		// Write at most as many bytes as are still available...
-		if (dataSize > _bufSize - _pos)
-			dataSize = _bufSize - _pos;
-		memcpy(_ptr, dataPtr, dataSize);
-		_ptr += dataSize;
-		_pos += dataSize;
-		return dataSize;
-	}
-
-	uint32 pos() const { return _pos; }
-	uint32 size() const { return _bufSize; }
-};
-
-/**
- * A sort of hybrid between MemoryWriteStream and Array classes. A stream
- * that grows as it's written to.
- */
-class MemoryWriteStreamDynamic : public WriteStream {
-private:
-	uint32 _capacity;
-	uint32 _size;
-	byte *_ptr;
-	byte *_data;
-	uint32 _pos;
-	DisposeAfterUse::Flag _disposeMemory;
-
-	void ensureCapacity(uint32 new_len) {
-		if (new_len <= _capacity)
-			return;
-
-		byte *old_data = _data;
-
-		_capacity = new_len + 32;
-		_data = (byte *)malloc(_capacity);
-		_ptr = _data + _pos;
-
-		if (old_data) {
-			// Copy old data
-			memcpy(_data, old_data, _size);
-			free(old_data);
-		}
-
-		_size = new_len;
-	}
-public:
-	MemoryWriteStreamDynamic(DisposeAfterUse::Flag disposeMemory = DisposeAfterUse::NO) : _capacity(0), _size(0), _ptr(0), _data(0), _pos(0), _disposeMemory(disposeMemory) {}
-
-	~MemoryWriteStreamDynamic() {
-		if (_disposeMemory)
-			free(_data);
-	}
-
-	uint32 write(const void *dataPtr, uint32 dataSize) {
-		ensureCapacity(_pos + dataSize);
-		memcpy(_ptr, dataPtr, dataSize);
-		_ptr += dataSize;
-		_pos += dataSize;
-		if (_pos > _size)
-			_size = _pos;
-		return dataSize;
-	}
-
-	uint32 pos() const { return _pos; }
-	uint32 size() const { return _size; }
-
-	byte *getData() { return _data; }
-
-	bool seek(int32 offset, int whence = SEEK_SET);
-};
-
 }	// End of namespace Common
 
 #endif

Added: scummvm/trunk/common/substream.h
===================================================================
--- scummvm/trunk/common/substream.h	                        (rev 0)
+++ scummvm/trunk/common/substream.h	2010-11-19 17:03:07 UTC (rev 54385)
@@ -0,0 +1,129 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ *
+ * $URL$
+ * $Id$
+ *
+ */
+
+#ifndef COMMON_SUBSTREAM_H
+#define COMMON_SUBSTREAM_H
+
+#include "common/stream.h"
+
+namespace Common {
+
+/**
+ * SubReadStream provides access to a ReadStream restricted to the range
+ * [currentPosition, currentPosition+end).
+ *
+ * Manipulating the parent stream directly /will/ mess up a substream.
+ * Likewise, manipulating two substreams of a parent stream will cause them to
+ * step on each others toes.
+ */
+class SubReadStream : virtual public ReadStream {
+protected:
+	ReadStream *_parentStream;
+	DisposeAfterUse::Flag _disposeParentStream;
+	uint32 _pos;
+	uint32 _end;
+	bool _eos;
+public:
+	SubReadStream(ReadStream *parentStream, uint32 end, DisposeAfterUse::Flag disposeParentStream = DisposeAfterUse::NO)
+		: _parentStream(parentStream),
+		  _disposeParentStream(disposeParentStream),
+		  _pos(0),
+		  _end(end),
+		  _eos(false) {
+		assert(parentStream);
+	}
+	~SubReadStream() {
+		if (_disposeParentStream)
+			delete _parentStream;
+	}
+
+	virtual bool eos() const { return _eos; }
+	virtual bool err() const { return _parentStream->err(); }
+	virtual void clearErr() { _eos = false; _parentStream->clearErr(); }
+	virtual uint32 read(void *dataPtr, uint32 dataSize);
+};
+
+/*
+ * SeekableSubReadStream provides access to a SeekableReadStream restricted to
+ * the range [begin, end).
+ * The same caveats apply to SeekableSubReadStream as do to SeekableReadStream.
+ *
+ * Manipulating the parent stream directly /will/ mess up a substream.
+ * @see SubReadStream
+ */
+class SeekableSubReadStream : public SubReadStream, public SeekableReadStream {
+protected:
+	SeekableReadStream *_parentStream;
+	uint32 _begin;
+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 bool seek(int32 offset, int whence = SEEK_SET);
+};
+
+/**
+ * This is a wrapper around SeekableSubReadStream, but it adds non-endian
+ * read methods whose endianness is set on the stream creation.
+ *
+ * Manipulating the parent stream directly /will/ mess up a substream.
+ * @see SubReadStream
+ */
+class SeekableSubReadStreamEndian : public SeekableSubReadStream {
+private:
+	const bool _bigEndian;
+
+public:
+	SeekableSubReadStreamEndian(SeekableReadStream *parentStream, uint32 begin, uint32 end, bool bigEndian = false, DisposeAfterUse::Flag disposeParentStream = DisposeAfterUse::NO)
+		: SeekableSubReadStream(parentStream, begin, end, disposeParentStream), _bigEndian(bigEndian) {
+	}
+
+	uint16 readUint16() {
+		uint16 val;
+		read(&val, 2);
+		return (_bigEndian) ? TO_BE_16(val) : TO_LE_16(val);
+	}
+
+	uint32 readUint32() {
+		uint32 val;
+		read(&val, 4);
+		return (_bigEndian) ? TO_BE_32(val) : TO_LE_32(val);
+	}
+
+	FORCEINLINE int16 readSint16() {
+		return (int16)readUint16();
+	}
+
+	FORCEINLINE int32 readSint32() {
+		return (int32)readUint32();
+	}
+};
+
+
+}	// End of namespace Common
+
+#endif


Property changes on: scummvm/trunk/common/substream.h
___________________________________________________________________
Added: svn:mime-type
   + text/plain
Added: svn:keywords
   + Date Rev Author URL Id
Added: svn:eol-style
   + native

Modified: scummvm/trunk/common/unarj.cpp
===================================================================
--- scummvm/trunk/common/unarj.cpp	2010-11-19 16:52:09 UTC (rev 54384)
+++ scummvm/trunk/common/unarj.cpp	2010-11-19 17:03:07 UTC (rev 54385)
@@ -34,6 +34,8 @@
 #include "common/unarj.h"
 #include "common/file.h"
 #include "common/hash-str.h"
+#include "common/memstream.h"
+#include "common/bufferedstream.h"
 
 namespace Common {
 

Modified: scummvm/trunk/common/unzip.cpp
===================================================================
--- scummvm/trunk/common/unzip.cpp	2010-11-19 16:52:09 UTC (rev 54384)
+++ scummvm/trunk/common/unzip.cpp	2010-11-19 17:03:07 UTC (rev 54385)
@@ -106,6 +106,7 @@
 #include "common/fs.h"
 #include "common/unzip.h"
 #include "common/file.h"
+#include "common/memstream.h"
 
 #include "common/hashmap.h"
 #include "common/hash-str.h"

Modified: scummvm/trunk/common/xmlparser.cpp
===================================================================
--- scummvm/trunk/common/xmlparser.cpp	2010-11-19 16:52:09 UTC (rev 54384)
+++ scummvm/trunk/common/xmlparser.cpp	2010-11-19 17:03:07 UTC (rev 54385)
@@ -27,7 +27,7 @@
 #include "common/util.h"
 #include "common/archive.h"
 #include "common/fs.h"
-#include "common/stream.h"
+#include "common/memstream.h"
 
 namespace Common {
 

Modified: scummvm/trunk/engines/agi/agi.cpp
===================================================================
--- scummvm/trunk/engines/agi/agi.cpp	2010-11-19 16:52:09 UTC (rev 54384)
+++ scummvm/trunk/engines/agi/agi.cpp	2010-11-19 17:03:07 UTC (rev 54385)
@@ -27,6 +27,7 @@
 #include "common/events.h"
 #include "common/EventRecorder.h"
 #include "common/file.h"
+#include "common/memstream.h"
 #include "common/savefile.h"
 #include "common/config-manager.h"
 #include "common/debug-channels.h"

Modified: scummvm/trunk/engines/agi/preagi_winnie.cpp
===================================================================
--- scummvm/trunk/engines/agi/preagi_winnie.cpp	2010-11-19 16:52:09 UTC (rev 54384)
+++ scummvm/trunk/engines/agi/preagi_winnie.cpp	2010-11-19 17:03:07 UTC (rev 54385)
@@ -30,6 +30,7 @@
 #include "graphics/cursorman.h"
 
 #include "common/events.h"
+#include "common/memstream.h"
 #include "common/savefile.h"
 
 namespace Agi {

Modified: scummvm/trunk/engines/agi/sound_2gs.cpp
===================================================================
--- scummvm/trunk/engines/agi/sound_2gs.cpp	2010-11-19 16:52:09 UTC (rev 54384)
+++ scummvm/trunk/engines/agi/sound_2gs.cpp	2010-11-19 17:03:07 UTC (rev 54385)
@@ -26,6 +26,7 @@
 #include "common/config-manager.h"
 #include "common/fs.h"
 #include "common/md5.h"
+#include "common/memstream.h"
 #include "common/str-array.h"
 
 #include "agi/agi.h"
@@ -839,7 +840,7 @@
 	}
 
 	// Read the whole executable file into memory
-	Common::SharedPtr<Common::MemoryReadStream> data(file.readStream(file.size()));
+	Common::SharedPtr<Common::SeekableReadStream> data(file.readStream(file.size()));
 	file.close();
 
 	// Check that we got enough data to be able to parse the instruments
@@ -891,7 +892,7 @@
 
 	// Open the wave file and read it into memory
 	file.open(wavePath);
-	Common::SharedPtr<Common::MemoryReadStream> uint8Wave(file.readStream(file.size()));
+	Common::SharedPtr<Common::SeekableReadStream> uint8Wave(file.readStream(file.size()));
 	file.close();
 
 	// Check that we got the whole wave file

Modified: scummvm/trunk/engines/agi/sound_midi.cpp
===================================================================
--- scummvm/trunk/engines/agi/sound_midi.cpp	2010-11-19 16:52:09 UTC (rev 54384)
+++ scummvm/trunk/engines/agi/sound_midi.cpp	2010-11-19 17:03:07 UTC (rev 54385)
@@ -47,6 +47,7 @@
 #include "sound/midiparser.h"
 #include "common/config-manager.h"
 #include "common/file.h"
+#include "common/memstream.h"
 #include "common/stream.h"
 
 #include "agi/agi.h"

Modified: scummvm/trunk/engines/agos/res.cpp
===================================================================
--- scummvm/trunk/engines/agos/res.cpp	2010-11-19 16:52:09 UTC (rev 54384)
+++ scummvm/trunk/engines/agos/res.cpp	2010-11-19 17:03:07 UTC (rev 54385)
@@ -27,6 +27,7 @@
 
 
 #include "common/file.h"
+#include "common/memstream.h"
 #include "common/util.h"
 
 #include "agos/agos.h"

Modified: scummvm/trunk/engines/agos/res_snd.cpp
===================================================================
--- scummvm/trunk/engines/agos/res_snd.cpp	2010-11-19 16:52:09 UTC (rev 54384)
+++ scummvm/trunk/engines/agos/res_snd.cpp	2010-11-19 17:03:07 UTC (rev 54385)
@@ -25,6 +25,7 @@
 
 #include "common/config-manager.h"
 #include "common/file.h"
+#include "common/memstream.h"
 
 #include "agos/intern.h"
 #include "agos/agos.h"

Modified: scummvm/trunk/engines/agos/sound.cpp
===================================================================
--- scummvm/trunk/engines/agos/sound.cpp	2010-11-19 16:52:09 UTC (rev 54384)
+++ scummvm/trunk/engines/agos/sound.cpp	2010-11-19 17:03:07 UTC (rev 54385)
@@ -24,6 +24,7 @@
  */
 
 #include "common/file.h"
+#include "common/memstream.h"
 #include "common/util.h"
 
 #include "agos/agos.h"
@@ -305,7 +306,7 @@
 public:
 	CompressedSound(Audio::Mixer *mixer, Common::File *file, uint32 base) : BaseSound(mixer, file, base, false) {}
 
-	Common::MemoryReadStream *loadStream(uint sound) const {
+	Common::SeekableReadStream *loadStream(uint sound) const {
 		if (_offsets == NULL)
 			return NULL;
 
@@ -334,7 +335,7 @@
 public:
 	MP3Sound(Audio::Mixer *mixer, Common::File *file, uint32 base = 0) : CompressedSound(mixer, file, base) {}
 	Audio::AudioStream *makeAudioStream(uint sound) {
-		Common::MemoryReadStream *tmp = loadStream(sound);
+		Common::SeekableReadStream *tmp = loadStream(sound);
 		if (!tmp)
 			return NULL;
 		return Audio::makeMP3Stream(tmp, DisposeAfterUse::YES);
@@ -350,7 +351,7 @@
 public:
 	VorbisSound(Audio::Mixer *mixer, Common::File *file, uint32 base = 0) : CompressedSound(mixer, file, base) {}
 	Audio::AudioStream *makeAudioStream(uint sound) {
-		Common::MemoryReadStream *tmp = loadStream(sound);
+		Common::SeekableReadStream *tmp = loadStream(sound);
 		if (!tmp)
 			return NULL;
 		return Audio::makeVorbisStream(tmp, DisposeAfterUse::YES);
@@ -366,7 +367,7 @@
 public:
 	FLACSound(Audio::Mixer *mixer, Common::File *file, uint32 base = 0) : CompressedSound(mixer, file, base) {}
 	Audio::AudioStream *makeAudioStream(uint sound) {
-		Common::MemoryReadStream *tmp = loadStream(sound);
+		Common::SeekableReadStream *tmp = loadStream(sound);
 		if (!tmp)
 			return NULL;
 		return Audio::makeFLACStream(tmp, DisposeAfterUse::YES);
@@ -775,7 +776,7 @@
 
 void Sound::playSoundData(Audio::SoundHandle *handle, byte *soundData, uint sound, int pan, int vol, bool loop) {
 	int size = READ_LE_UINT32(soundData + 4) + 8;
-	Common::MemoryReadStream *stream = new Common::MemoryReadStream(soundData, size);
+	Common::SeekableReadStream *stream = new Common::MemoryReadStream(soundData, size);
 	Audio::RewindableAudioStream *sndStream = Audio::makeWAVStream(stream, DisposeAfterUse::YES);
 
 	convertVolume(vol);

Modified: scummvm/trunk/engines/cine/anim.cpp
===================================================================
--- scummvm/trunk/engines/cine/anim.cpp	2010-11-19 16:52:09 UTC (rev 54384)
+++ scummvm/trunk/engines/cine/anim.cpp	2010-11-19 17:03:07 UTC (rev 54385)
@@ -28,7 +28,7 @@
  */
 
 #include "common/endian.h"
-#include "common/stream.h"
+#include "common/memstream.h"
 
 #include "cine/cine.h"
 #include "cine/anim.h"
@@ -485,7 +485,7 @@
  * @param[out] animHeader Image header reference
  * @param readS Input stream open for reading
  */
-void loadAnimHeader(AnimHeaderStruct &animHeader, Common::MemoryReadStream readS) {
+void loadAnimHeader(AnimHeaderStruct &animHeader, Common::SeekableReadStream &readS) {
 	animHeader.field_0 = readS.readByte();
 	animHeader.field_1 = readS.readByte();
 	animHeader.field_2 = readS.readByte();

Modified: scummvm/trunk/engines/cine/bg.cpp
===================================================================
--- scummvm/trunk/engines/cine/bg.cpp	2010-11-19 16:52:09 UTC (rev 54384)
+++ scummvm/trunk/engines/cine/bg.cpp	2010-11-19 17:03:07 UTC (rev 54385)
@@ -25,7 +25,7 @@
 
 
 #include "common/endian.h"
-#include "common/stream.h"
+#include "common/memstream.h"
 
 #include "cine/cine.h"
 #include "cine/various.h"

Modified: scummvm/trunk/engines/cine/object.cpp
===================================================================
--- scummvm/trunk/engines/cine/object.cpp	2010-11-19 16:52:09 UTC (rev 54384)
+++ scummvm/trunk/engines/cine/object.cpp	2010-11-19 17:03:07 UTC (rev 54385)
@@ -25,7 +25,7 @@
 
 
 #include "common/endian.h"
-#include "common/scummsys.h"
+#include "common/memstream.h"
 #include "common/util.h"
 
 #include "cine/cine.h"

Modified: scummvm/trunk/engines/cine/saveload.cpp
===================================================================
--- scummvm/trunk/engines/cine/saveload.cpp	2010-11-19 16:52:09 UTC (rev 54384)
+++ scummvm/trunk/engines/cine/saveload.cpp	2010-11-19 17:03:07 UTC (rev 54385)
@@ -801,7 +801,7 @@
 		// Hopefully devices with more limited memory can also cope with this memory allocation.
 		saveSize = 256 * 1024;
 	}
-	Common::SharedPtr<Common::MemoryReadStream> in(saveFile->readStream(saveSize));
+	Common::SharedPtr<Common::SeekableReadStream> in(saveFile->readStream(saveSize));
 
 	// Try to detect the used savegame format
 	enum CineSaveGameFormat saveGameFormat = detectSaveGameFormat(*in);

Modified: scummvm/trunk/engines/cine/sound.cpp
===================================================================
--- scummvm/trunk/engines/cine/sound.cpp	2010-11-19 16:52:09 UTC (rev 54384)
+++ scummvm/trunk/engines/cine/sound.cpp	2010-11-19 17:03:07 UTC (rev 54385)
@@ -25,7 +25,7 @@
 
 #include "common/endian.h"
 #include "common/file.h"
-#include "common/system.h"
+#include "common/memstream.h"
 
 #include "cine/cine.h"
 #include "cine/sound.h"

Modified: scummvm/trunk/engines/cruise/dataLoader.cpp
===================================================================
--- scummvm/trunk/engines/cruise/dataLoader.cpp	2010-11-19 16:52:09 UTC (rev 54384)
+++ scummvm/trunk/engines/cruise/dataLoader.cpp	2010-11-19 17:03:07 UTC (rev 54385)
@@ -25,6 +25,7 @@
 
 #include "cruise/cruise_main.h"
 #include "common/endian.h"
+#include "common/memstream.h"
 
 namespace Cruise {
 

Modified: scummvm/trunk/engines/cruise/overlay.cpp
===================================================================
--- scummvm/trunk/engines/cruise/overlay.cpp	2010-11-19 16:52:09 UTC (rev 54384)
+++ scummvm/trunk/engines/cruise/overlay.cpp	2010-11-19 17:03:07 UTC (rev 54385)
@@ -23,7 +23,7 @@
  *
  */
 
-#include "common/stream.h"
+#include "common/memstream.h"
 
 #include "cruise/cruise.h"
 #include "cruise/cruise_main.h"

Modified: scummvm/trunk/engines/draci/animation.cpp
===================================================================
--- scummvm/trunk/engines/draci/animation.cpp	2010-11-19 16:52:09 UTC (rev 54384)
+++ scummvm/trunk/engines/draci/animation.cpp	2010-11-19 17:03:07 UTC (rev 54385)
@@ -31,6 +31,8 @@
 #include "draci/sound.h"
 #include "draci/surface.h"
 
+#include "common/memstream.h"
+
 namespace Draci {
 
 Animation::Animation(DraciEngine *vm, int id, uint z, bool playing) : _vm(vm) {

Modified: scummvm/trunk/engines/draci/barchive.cpp
===================================================================
--- scummvm/trunk/engines/draci/barchive.cpp	2010-11-19 16:52:09 UTC (rev 54384)
+++ scummvm/trunk/engines/draci/barchive.cpp	2010-11-19 17:03:07 UTC (rev 54385)
@@ -25,7 +25,7 @@
 
 #include "common/debug.h"
 #include "common/str.h"
-#include "common/stream.h"
+#include "common/memstream.h"
 
 #include "draci/barchive.h"
 #include "draci/draci.h"

Modified: scummvm/trunk/engines/draci/game.cpp
===================================================================
--- scummvm/trunk/engines/draci/game.cpp	2010-11-19 16:52:09 UTC (rev 54384)
+++ scummvm/trunk/engines/draci/game.cpp	2010-11-19 17:03:07 UTC (rev 54385)
@@ -25,7 +25,7 @@
 
 #include "common/keyboard.h"
 #include "common/serializer.h"
-#include "common/stream.h"
+#include "common/memstream.h"
 #include "common/system.h"
 #include "common/util.h"
 

Modified: scummvm/trunk/engines/draci/screen.cpp
===================================================================
--- scummvm/trunk/engines/draci/screen.cpp	2010-11-19 16:52:09 UTC (rev 54384)
+++ scummvm/trunk/engines/draci/screen.cpp	2010-11-19 17:03:07 UTC (rev 54385)
@@ -23,7 +23,7 @@
  *
  */
 
-#include "common/stream.h"
+#include "common/memstream.h"
 #include "common/system.h"
 
 #include "draci/draci.h"

Modified: scummvm/trunk/engines/draci/script.cpp
===================================================================
--- scummvm/trunk/engines/draci/script.cpp	2010-11-19 16:52:09 UTC (rev 54384)
+++ scummvm/trunk/engines/draci/script.cpp	2010-11-19 17:03:07 UTC (rev 54385)
@@ -25,7 +25,7 @@
 
 #include "common/array.h"
 #include "common/debug.h"
-#include "common/stream.h"
+#include "common/memstream.h"
 #include "common/stack.h"
 
 #include "draci/draci.h"

Modified: scummvm/trunk/engines/draci/sound.cpp
===================================================================
--- scummvm/trunk/engines/draci/sound.cpp	2010-11-19 16:52:09 UTC (rev 54384)
+++ scummvm/trunk/engines/draci/sound.cpp	2010-11-19 17:03:07 UTC (rev 54385)
@@ -28,7 +28,8 @@
 #include "common/debug.h"
 #include "common/file.h"
 #include "common/str.h"
-#include "common/stream.h"
+#include "common/substream.h"
+#include "common/memstream.h"
 #include "common/unzip.h"
 
 #include "draci/sound.h"
@@ -301,7 +302,7 @@
 	// only used for dubbing, which is only played from one place in
 	// script.cpp, which blocks until the dubbed sentence has finished
 	// playing.
-	Common::SeekableReadStream* stream;
+	Common::SeekableReadStream *stream;
 	const int skip = buffer._format == RAW80 ? 80 : 0;
 	if (buffer._stream) {
 		stream = new Common::SeekableSubReadStream(

Modified: scummvm/trunk/engines/draci/sprite.cpp
===================================================================
--- scummvm/trunk/engines/draci/sprite.cpp	2010-11-19 16:52:09 UTC (rev 54384)
+++ scummvm/trunk/engines/draci/sprite.cpp	2010-11-19 17:03:07 UTC (rev 54385)
@@ -23,7 +23,7 @@
  *
  */
 
-#include "common/stream.h"
+#include "common/memstream.h"
 
 #include "draci/draci.h"
 #include "draci/font.h"

Modified: scummvm/trunk/engines/draci/walking.cpp
===================================================================
--- scummvm/trunk/engines/draci/walking.cpp	2010-11-19 16:52:09 UTC (rev 54384)
+++ scummvm/trunk/engines/draci/walking.cpp	2010-11-19 17:03:07 UTC (rev 54385)
@@ -23,10 +23,8 @@
  *
  */
 
-#include <stdlib.h>
+#include "common/memstream.h"
 
-#include "common/stream.h"
-
 #include "draci/draci.h"
 #include "draci/animation.h"
 #include "draci/game.h"

Modified: scummvm/trunk/engines/gob/dataio.cpp
===================================================================
--- scummvm/trunk/engines/gob/dataio.cpp	2010-11-19 16:52:09 UTC (rev 54384)
+++ scummvm/trunk/engines/gob/dataio.cpp	2010-11-19 17:03:07 UTC (rev 54385)
@@ -25,7 +25,7 @@
 
 #include "common/endian.h"
 #include "common/types.h"
-#include "common/stream.h"
+#include "common/memstream.h"
 
 #include "gob/gob.h"
 #include "gob/dataio.h"

Modified: scummvm/trunk/engines/gob/demos/demoplayer.cpp
===================================================================
--- scummvm/trunk/engines/gob/demos/demoplayer.cpp	2010-11-19 16:52:09 UTC (rev 54384)
+++ scummvm/trunk/engines/gob/demos/demoplayer.cpp	2010-11-19 17:03:07 UTC (rev 54385)
@@ -25,6 +25,7 @@
 
 #include "common/endian.h"
 #include "common/file.h"
+#include "common/memstream.h"
 
 #include "gob/gob.h"
 #include "gob/demos/demoplayer.h"

Modified: scummvm/trunk/engines/gob/map_v1.cpp
===================================================================
--- scummvm/trunk/engines/gob/map_v1.cpp	2010-11-19 16:52:09 UTC (rev 54384)
+++ scummvm/trunk/engines/gob/map_v1.cpp	2010-11-19 17:03:07 UTC (rev 54385)
@@ -23,7 +23,7 @@
  *
  */
 
-#include "common/stream.h"
+#include "common/memstream.h"
 
 #include "gob/gob.h"
 #include "gob/map.h"

Modified: scummvm/trunk/engines/gob/resources.cpp
===================================================================
--- scummvm/trunk/engines/gob/resources.cpp	2010-11-19 16:52:09 UTC (rev 54384)
+++ scummvm/trunk/engines/gob/resources.cpp	2010-11-19 17:03:07 UTC (rev 54385)
@@ -25,7 +25,7 @@
 
 #include "common/util.h"
 #include "common/endian.h"
-#include "common/stream.h"
+#include "common/memstream.h"
 
 #include "gob/gob.h"
 #include "gob/resources.h"

Modified: scummvm/trunk/engines/gob/save/saveconverter.cpp
===================================================================
--- scummvm/trunk/engines/gob/save/saveconverter.cpp	2010-11-19 16:52:09 UTC (rev 54384)
+++ scummvm/trunk/engines/gob/save/saveconverter.cpp	2010-11-19 17:03:07 UTC (rev 54385)
@@ -24,6 +24,7 @@
  */
 
 #include "common/endian.h"
+#include "common/memstream.h"
 #include "common/savefile.h"
 
 #include "gob/gob.h"

Modified: scummvm/trunk/engines/gob/save/saveconverter.h
===================================================================
--- scummvm/trunk/engines/gob/save/saveconverter.h	2010-11-19 16:52:09 UTC (rev 54384)
+++ scummvm/trunk/engines/gob/save/saveconverter.h	2010-11-19 17:03:07 UTC (rev 54385)
@@ -77,7 +77,7 @@
 	Common::String _fileName;
 
 	byte *_data;
-	Common::MemoryReadStream *_stream;
+	Common::SeekableReadStream *_stream;
 
 	Common::InSaveFile *openSave() const;
 

Modified: scummvm/trunk/engines/gob/save/savefile.cpp
===================================================================
--- scummvm/trunk/engines/gob/save/savefile.cpp	2010-11-19 16:52:09 UTC (rev 54384)
+++ scummvm/trunk/engines/gob/save/savefile.cpp	2010-11-19 17:03:07 UTC (rev 54385)
@@ -25,6 +25,7 @@
 
 #include "common/util.h"
 #include "common/endian.h"
+#include "common/memstream.h"
 #include "common/system.h"
 #include "common/savefile.h"
 

Modified: scummvm/trunk/engines/gob/sound/sounddesc.cpp
===================================================================
--- scummvm/trunk/engines/gob/sound/sounddesc.cpp	2010-11-19 16:52:09 UTC (rev 54384)
+++ scummvm/trunk/engines/gob/sound/sounddesc.cpp	2010-11-19 17:03:07 UTC (rev 54385)
@@ -24,7 +24,7 @@
  */
 
 #include "common/util.h"
-#include "common/stream.h"
+#include "common/memstream.h"
 #include "sound/mixer.h"
 #include "sound/decoders/raw.h"
 #include "sound/decoders/wave.h"

Modified: scummvm/trunk/engines/groovie/music.cpp
===================================================================
--- scummvm/trunk/engines/groovie/music.cpp	2010-11-19 16:52:09 UTC (rev 54384)
+++ scummvm/trunk/engines/groovie/music.cpp	2010-11-19 17:03:07 UTC (rev 54385)
@@ -30,6 +30,7 @@
 #include "backends/audiocd/audiocd.h"
 #include "common/config-manager.h"
 #include "common/macresman.h"
+#include "common/memstream.h"
 #include "sound/midiparser.h"
 
 namespace Groovie {

Modified: scummvm/trunk/engines/groovie/resource.cpp
===================================================================
--- scummvm/trunk/engines/groovie/resource.cpp	2010-11-19 16:52:09 UTC (rev 54384)
+++ scummvm/trunk/engines/groovie/resource.cpp	2010-11-19 17:03:07 UTC (rev 54385)
@@ -25,6 +25,7 @@
 
 #include "common/archive.h"
 #include "common/macresman.h"
+#include "common/substream.h"
 
 #include "groovie/resource.h"
 #include "groovie/groovie.h"

Modified: scummvm/trunk/engines/groovie/saveload.cpp
===================================================================
--- scummvm/trunk/engines/groovie/saveload.cpp	2010-11-19 16:52:09 UTC (rev 54384)
+++ scummvm/trunk/engines/groovie/saveload.cpp	2010-11-19 17:03:07 UTC (rev 54385)
@@ -26,6 +26,7 @@
 #include "groovie/saveload.h"
 
 #include "common/system.h"
+#include "common/substream.h"
 
 #define SUPPORTED_SAVEFILE_VERSION 1
 // 0 - Just script variables, compatible with the original

Modified: scummvm/trunk/engines/kyra/resource_intern.cpp
===================================================================
--- scummvm/trunk/engines/kyra/resource_intern.cpp	2010-11-19 16:52:09 UTC (rev 54384)
+++ scummvm/trunk/engines/kyra/resource_intern.cpp	2010-11-19 17:03:07 UTC (rev 54385)
@@ -26,8 +26,9 @@
 #include "kyra/resource_intern.h"
 #include "kyra/resource.h"
 
-#include "common/stream.h"
 #include "common/endian.h"
+#include "common/memstream.h"
+#include "common/substream.h"
 
 namespace Kyra {
 

Modified: scummvm/trunk/engines/kyra/saveload_hof.cpp
===================================================================
--- scummvm/trunk/engines/kyra/saveload_hof.cpp	2010-11-19 16:52:09 UTC (rev 54384)
+++ scummvm/trunk/engines/kyra/saveload_hof.cpp	2010-11-19 17:03:07 UTC (rev 54385)
@@ -25,6 +25,7 @@
 
 #include "common/endian.h"
 #include "common/savefile.h"
+#include "common/substream.h"
 #include "common/system.h"
 
 #include "kyra/kyra_v2.h"

Modified: scummvm/trunk/engines/kyra/saveload_lol.cpp
===================================================================
--- scummvm/trunk/engines/kyra/saveload_lol.cpp	2010-11-19 16:52:09 UTC (rev 54384)
+++ scummvm/trunk/engines/kyra/saveload_lol.cpp	2010-11-19 17:03:07 UTC (rev 54385)
@@ -31,6 +31,7 @@
 
 #include "common/endian.h"
 #include "common/savefile.h"
+#include "common/substream.h"
 #include "common/system.h"
 
 #include "graphics/scaler.h"

Modified: scummvm/trunk/engines/kyra/saveload_mr.cpp
===================================================================
--- scummvm/trunk/engines/kyra/saveload_mr.cpp	2010-11-19 16:52:09 UTC (rev 54384)
+++ scummvm/trunk/engines/kyra/saveload_mr.cpp	2010-11-19 17:03:07 UTC (rev 54385)
@@ -25,6 +25,7 @@
 
 #include "common/endian.h"
 #include "common/savefile.h"
+#include "common/substream.h"
 #include "common/system.h"
 
 #include "kyra/kyra_mr.h"

Modified: scummvm/trunk/engines/kyra/screen.cpp
===================================================================
--- scummvm/trunk/engines/kyra/screen.cpp	2010-11-19 16:52:09 UTC (rev 54384)
+++ scummvm/trunk/engines/kyra/screen.cpp	2010-11-19 17:03:07 UTC (rev 54385)
@@ -25,6 +25,7 @@
 
 
 #include "common/endian.h"
+#include "common/memstream.h"
 #include "common/system.h"
 
 #include "engines/util.h"

Modified: scummvm/trunk/engines/lastexpress/data/animation.cpp
===================================================================
--- scummvm/trunk/engines/lastexpress/data/animation.cpp	2010-11-19 16:52:09 UTC (rev 54384)
+++ scummvm/trunk/engines/lastexpress/data/animation.cpp	2010-11-19 17:03:07 UTC (rev 54385)
@@ -225,7 +225,7 @@
 	assert (c.frame == 0);
 
 	// Create a temporary chunk buffer
-	Common::MemoryReadStream *str = in->readStream(c.size);
+	Common::SeekableReadStream *str = in->readStream(c.size);
 
 	// Read the frame information
 	FrameInfo i;

Modified: scummvm/trunk/engines/lastexpress/data/archive.cpp
===================================================================
--- scummvm/trunk/engines/lastexpress/data/archive.cpp	2010-11-19 16:52:09 UTC (rev 54384)
+++ scummvm/trunk/engines/lastexpress/data/archive.cpp	2010-11-19 17:03:07 UTC (rev 54385)
@@ -32,6 +32,7 @@
 
 #include "common/debug.h"
 #include "common/file.h"
+#include "common/substream.h"
 
 namespace LastExpress {
 

Modified: scummvm/trunk/engines/lastexpress/data/cursor.cpp
===================================================================
--- scummvm/trunk/engines/lastexpress/data/cursor.cpp	2010-11-19 16:52:09 UTC (rev 54384)
+++ scummvm/trunk/engines/lastexpress/data/cursor.cpp	2010-11-19 17:03:07 UTC (rev 54385)
@@ -42,7 +42,7 @@
 		return false;
 
 	// Load the whole file to memory
-	Common::MemoryReadStream *data = stream->readStream((uint32) stream->size());
+	Common::SeekableReadStream *data = stream->readStream((uint32) stream->size());
 	delete stream;
 	if (!data)
 		return false;

Modified: scummvm/trunk/engines/lastexpress/data/snd.cpp
===================================================================
--- scummvm/trunk/engines/lastexpress/data/snd.cpp	2010-11-19 16:52:09 UTC (rev 54384)
+++ scummvm/trunk/engines/lastexpress/data/snd.cpp	2010-11-19 17:03:07 UTC (rev 54385)
@@ -32,6 +32,7 @@
 
 #include "sound/decoders/adpcm.h"
 #include "sound/audiostream.h"
+#include "common/memstream.h"
 
 namespace LastExpress {
 

Modified: scummvm/trunk/engines/lastexpress/game/savegame.h
===================================================================
--- scummvm/trunk/engines/lastexpress/game/savegame.h	2010-11-19 16:52:09 UTC (rev 54384)
+++ scummvm/trunk/engines/lastexpress/game/savegame.h	2010-11-19 17:03:07 UTC (rev 54385)
@@ -78,6 +78,7 @@
 
 #include "common/savefile.h"
 #include "common/serializer.h"
+#include "common/memstream.h"
 
 namespace LastExpress {
 

Modified: scummvm/trunk/engines/m4/assets.cpp
===================================================================
--- scummvm/trunk/engines/m4/assets.cpp	2010-11-19 16:52:09 UTC (rev 54384)
+++ scummvm/trunk/engines/m4/assets.cpp	2010-11-19 17:03:07 UTC (rev 54385)
@@ -28,6 +28,8 @@
 #include "m4/compression.h"
 #include "m4/graphics.h"
 
+#include "common/memstream.h"
+
 namespace M4 {
 
 BaseAsset::BaseAsset(MadsM4Engine *vm) : _vm(vm) {
@@ -382,7 +384,7 @@
 	loadFrameHeader(frameHeader);
 
 	if (frameHeader.w > 0 && frameHeader.h > 0) {
-		Common::MemoryReadStream *frameData = _stream->readStream(getFrameSize(frameIndex));
+		Common::SeekableReadStream *frameData = _stream->readStream(getFrameSize(frameIndex));
 		if (frameHeader.stream) {
 			frame->loadDeltaRle(frameData, destX - frameHeader.x, destY - frameHeader.y);
 		} else {

Modified: scummvm/trunk/engines/m4/compression.cpp
===================================================================
--- scummvm/trunk/engines/m4/compression.cpp	2010-11-19 16:52:09 UTC (rev 54384)
+++ scummvm/trunk/engines/m4/compression.cpp	2010-11-19 17:03:07 UTC (rev 54385)
@@ -26,6 +26,8 @@
 #include "m4/compression.h"
 #include "m4/m4.h"
 
+#include "common/memstream.h"
+
 namespace M4 {
 
 const char *madsPackString = "MADSPACK";
@@ -90,6 +92,10 @@
 	_dataOffset = stream->pos();
 }
 
+Common::SeekableReadStream *MadsPack::getItemStream(int index) {
+	return new Common::MemoryReadStream(_items[index].data, _items[index].size, DisposeAfterUse::NO);
+}
+
 MadsPack::~MadsPack() {
 	for (int i = 0; i < _count; ++i)
 		delete[] _items[i].data;

Modified: scummvm/trunk/engines/m4/compression.h
===================================================================
--- scummvm/trunk/engines/m4/compression.h	2010-11-19 16:52:09 UTC (rev 54384)
+++ scummvm/trunk/engines/m4/compression.h	2010-11-19 17:03:07 UTC (rev 54385)
@@ -58,9 +58,7 @@
 	int getCount() const { return _count; }
 	MadsPackEntry &getItem(int index) const { return _items[index]; }
 	MadsPackEntry &operator[](int index) const { return _items[index]; }
-	Common::MemoryReadStream *getItemStream(int index) {
-		return new Common::MemoryReadStream(_items[index].data, _items[index].size, DisposeAfterUse::NO);
-	}
+	Common::SeekableReadStream *getItemStream(int index);
 	int getDataOffset() const { return _dataOffset; }
 };
 

Modified: scummvm/trunk/engines/m4/converse.cpp
===================================================================
--- scummvm/trunk/engines/m4/converse.cpp	2010-11-19 16:52:09 UTC (rev 54384)
+++ scummvm/trunk/engines/m4/converse.cpp	2010-11-19 17:03:07 UTC (rev 54385)
@@ -25,6 +25,7 @@
 
 #include "common/array.h"
 #include "common/hashmap.h"
+#include "common/substream.h"
 
 #include "m4/converse.h"
 #include "m4/resource.h"

Modified: scummvm/trunk/engines/m4/graphics.cpp
===================================================================
--- scummvm/trunk/engines/m4/graphics.cpp	2010-11-19 16:52:09 UTC (rev 54384)
+++ scummvm/trunk/engines/m4/graphics.cpp	2010-11-19 17:03:07 UTC (rev 54385)
@@ -740,7 +740,7 @@
 
 void M4Surface::rexLoadBackground(Common::SeekableReadStream *source, RGBList **palData) {
 	MadsPack packData(source);
-	Common::MemoryReadStream *sourceUnc = packData.getItemStream(0);
+	Common::SeekableReadStream *sourceUnc = packData.getItemStream(0);
 
 	int sceneWidth = sourceUnc->readUint16LE();
 	int sceneHeight = sourceUnc->readUint16LE();

Modified: scummvm/trunk/engines/m4/m4.cpp
===================================================================
--- scummvm/trunk/engines/m4/m4.cpp	2010-11-19 16:52:09 UTC (rev 54384)
+++ scummvm/trunk/engines/m4/m4.cpp	2010-11-19 17:03:07 UTC (rev 54385)
@@ -288,7 +288,7 @@
 		}
 	} else {
 		MadsPack packData(fileS);
-		Common::MemoryReadStream *sourceUnc;
+		Common::SeekableReadStream *sourceUnc;
 		for (int i = 0; i < packData.getCount(); i++) {
 			sourceUnc = packData.getItemStream(i);
 			debugCN(kDebugCore, "Dumping compressed chunk %i of %i, size is %i\n", i + 1, packData.getCount(), sourceUnc->size());

Modified: scummvm/trunk/engines/m4/midi.cpp
===================================================================
--- scummvm/trunk/engines/m4/midi.cpp	2010-11-19 16:52:09 UTC (rev 54384)
+++ scummvm/trunk/engines/m4/midi.cpp	2010-11-19 17:03:07 UTC (rev 54385)
@@ -28,7 +28,7 @@
 
 #include "m4/m4.h"
 #include "m4/midi.h"
-#include "common/stream.h"
+#include "common/memstream.h"
 
 namespace M4 {
 

Modified: scummvm/trunk/engines/m4/resource.cpp
===================================================================
--- scummvm/trunk/engines/m4/resource.cpp	2010-11-19 16:52:09 UTC (rev 54384)
+++ scummvm/trunk/engines/m4/resource.cpp	2010-11-19 17:03:07 UTC (rev 54385)
@@ -27,6 +27,8 @@
 #include "m4/resource.h"
 #include "m4/events.h"
 
+#include "common/substream.h"
+
 namespace M4 {
 
 FileSystem::FileSystem(const char *hashFilename) {

Modified: scummvm/trunk/engines/m4/script.h
===================================================================
--- scummvm/trunk/engines/m4/script.h	2010-11-19 16:52:09 UTC (rev 54384)
+++ scummvm/trunk/engines/m4/script.h	2010-11-19 17:03:07 UTC (rev 54385)
@@ -223,7 +223,7 @@
 	uint32 readUint32();
 protected:
 	ScriptInterpreter *_inter;
-	Common::MemoryReadStream *_code;
+	Common::SeekableReadStream *_code;
 };
 
 struct ScriptFunctionEntry {

Modified: scummvm/trunk/engines/m4/woodscript.cpp
===================================================================
--- scummvm/trunk/engines/m4/woodscript.cpp	2010-11-19 16:52:09 UTC (rev 54384)
+++ scummvm/trunk/engines/m4/woodscript.cpp	2010-11-19 17:03:07 UTC (rev 54385)
@@ -25,6 +25,8 @@
 
 #include "m4/woodscript.h"
 
+#include "common/memstream.h"
+
 namespace M4 {
 
 // FIXME: Put in Engine/WoodScript class

Modified: scummvm/trunk/engines/m4/woodscript.h
===================================================================
--- scummvm/trunk/engines/m4/woodscript.h	2010-11-19 16:52:09 UTC (rev 54384)
+++ scummvm/trunk/engines/m4/woodscript.h	2010-11-19 17:03:07 UTC (rev 54385)
@@ -77,7 +77,7 @@
 	uint32 pos() const { return _code->pos() / 4; }
 protected:
 	WoodScript *_ws;
-	Common::MemoryReadStream *_code;
+	Common::SeekableReadStream *_code;
 	Sequence *_sequence;
 	static int32 _dataFormats[];
 	bool decodeArgument(int32 format, int32 data, long *&arg, long &value);

Modified: scummvm/trunk/engines/made/database.cpp
===================================================================
--- scummvm/trunk/engines/made/database.cpp	2010-11-19 16:52:09 UTC (rev 54384)
+++ scummvm/trunk/engines/made/database.cpp	2010-11-19 17:03:07 UTC (rev 54385)
@@ -275,7 +275,7 @@
 	_isRedSource = true;
 	_filename = filename;
 	_redFilename = redFilename;
-	Common::MemoryReadStream *fileS = RedReader::loadFromRed(redFilename, filename);
+	Common::SeekableReadStream *fileS = RedReader::loadFromRed(redFilename, filename);
 	if (!fileS)
 		error("GameDatabase::openFromRed() Could not load %s from %s", filename, redFilename);
 	load(*fileS);
@@ -289,7 +289,7 @@
 			error("GameDatabase::reload() Could not open %s", _filename.c_str());
 		reloadFromStream(fd);
 	} else {
-		Common::MemoryReadStream *fileS = RedReader::loadFromRed(_redFilename.c_str(), _filename.c_str());
+		Common::SeekableReadStream *fileS = RedReader::loadFromRed(_redFilename.c_str(), _filename.c_str());
 		if (!fileS)
 			error("GameDatabase::openFromRed() Could not load %s from %s", _filename.c_str(), _redFilename.c_str());
 		reloadFromStream(*fileS);

Modified: scummvm/trunk/engines/made/redreader.cpp
===================================================================
--- scummvm/trunk/engines/made/redreader.cpp	2010-11-19 16:52:09 UTC (rev 54384)
+++ scummvm/trunk/engines/made/redreader.cpp	2010-11-19 17:03:07 UTC (rev 54385)
@@ -24,12 +24,12 @@
  */
 
 #include "made/redreader.h"
+#include "common/memstream.h"
 
 namespace Made {
 
+Common::SeekableReadStream *RedReader::load(const char *redFilename, const char *filename) {
 
-Common::MemoryReadStream *RedReader::load(const char *redFilename, const char *filename) {
-
 	Common::File fd;
 	FileEntry fileEntry;
 
@@ -49,9 +49,9 @@
 
 }
 
-Common::MemoryReadStream *RedReader::loadFromRed(const char *redFilename, const char *filename) {
+Common::SeekableReadStream *RedReader::loadFromRed(const char *redFilename, const char *filename) {
 	RedReader* red = new RedReader();
-	Common::MemoryReadStream* stream = red->load(redFilename, filename);
+	Common::SeekableReadStream *stream = red->load(redFilename, filename);
 	delete red;
 	return stream;
 }

Modified: scummvm/trunk/engines/made/redreader.h
===================================================================
--- scummvm/trunk/engines/made/redreader.h	2010-11-19 16:52:09 UTC (rev 54384)
+++ scummvm/trunk/engines/made/redreader.h	2010-11-19 17:03:07 UTC (rev 54385)
@@ -34,8 +34,8 @@
 
 class RedReader {
 public:
-	Common::MemoryReadStream *load(const char *redFilename, const char *filename);
-	static Common::MemoryReadStream *loadFromRed(const char *redFilename, const char *filename);
+	Common::SeekableReadStream *load(const char *redFilename, const char *filename);
+	static Common::SeekableReadStream *loadFromRed(const char *redFilename, const char *filename);
 private:
 	struct FileEntry {
 		uint32 compSize, origSize;

Modified: scummvm/trunk/engines/made/resource.cpp
===================================================================
--- scummvm/trunk/engines/made/resource.cpp	2010-11-19 16:52:09 UTC (rev 54384)
+++ scummvm/trunk/engines/made/resource.cpp	2010-11-19 17:03:07 UTC (rev 54385)
@@ -24,6 +24,7 @@
  */
 
 #include "common/endian.h"
+#include "common/memstream.h"
 #include "sound/mixer.h"
 #include "sound/decoders/raw.h"
 

Modified: scummvm/trunk/engines/mohawk/bitmap.cpp
===================================================================
--- scummvm/trunk/engines/mohawk/bitmap.cpp	2010-11-19 16:52:09 UTC (rev 54384)
+++ scummvm/trunk/engines/mohawk/bitmap.cpp	2010-11-19 17:03:07 UTC (rev 54385)
@@ -28,6 +28,7 @@
 #include "common/debug.h"
 #include "common/util.h"
 #include "common/endian.h"
+#include "common/memstream.h"
 #include "common/system.h"
 
 namespace Mohawk {

Modified: scummvm/trunk/engines/mohawk/livingbooks.h
===================================================================
--- scummvm/trunk/engines/mohawk/livingbooks.h	2010-11-19 16:52:09 UTC (rev 54384)
+++ scummvm/trunk/engines/mohawk/livingbooks.h	2010-11-19 17:03:07 UTC (rev 54385)
@@ -31,6 +31,7 @@
 #include "mohawk/graphics.h"
 
 #include "common/config-file.h"
+#include "common/substream.h"
 
 namespace Mohawk {
 

Modified: scummvm/trunk/engines/mohawk/resource.cpp
===================================================================
--- scummvm/trunk/engines/mohawk/resource.cpp	2010-11-19 16:52:09 UTC (rev 54384)
+++ scummvm/trunk/engines/mohawk/resource.cpp	2010-11-19 17:03:07 UTC (rev 54385)
@@ -25,6 +25,7 @@
 
 #include "mohawk/resource.h"
 
+#include "common/substream.h"
 #include "common/util.h"
 
 namespace Mohawk {

Modified: scummvm/trunk/engines/mohawk/riven_saveload.h
===================================================================
--- scummvm/trunk/engines/mohawk/riven_saveload.h	2010-11-19 16:52:09 UTC (rev 54384)
+++ scummvm/trunk/engines/mohawk/riven_saveload.h	2010-11-19 17:03:07 UTC (rev 54385)
@@ -28,6 +28,7 @@
 
 #include "common/savefile.h"
 #include "common/str.h"
+#include "common/memstream.h"
 
 namespace Mohawk {
 

Modified: scummvm/trunk/engines/parallaction/disk_ns.cpp
===================================================================
--- scummvm/trunk/engines/parallaction/disk_ns.cpp	2010-11-19 16:52:09 UTC (rev 54384)
+++ scummvm/trunk/engines/parallaction/disk_ns.cpp	2010-11-19 17:03:07 UTC (rev 54385)
@@ -25,6 +25,8 @@
 
 #include "common/config-manager.h"
 #include "common/fs.h"
+#include "common/memstream.h"
+#include "common/substream.h"
 #include "parallaction/parser.h"
 #include "parallaction/parallaction.h"
 
@@ -1087,4 +1089,4 @@
 	return tryOpenFile(path);
 }
 
-} // namespace Parallaction
+} // End of namespace Parallaction

Modified: scummvm/trunk/engines/parallaction/font.cpp
===================================================================
--- scummvm/trunk/engines/parallaction/font.cpp	2010-11-19 16:52:09 UTC (rev 54384)
+++ scummvm/trunk/engines/parallaction/font.cpp	2010-11-19 17:03:07 UTC (rev 54385)
@@ -24,7 +24,7 @@
  */
 
 #include "common/endian.h"
-#include "common/stream.h"
+#include "common/memstream.h"
 
 #include "parallaction/parallaction.h"
 
@@ -670,7 +670,6 @@
 
 
 void Parallaction_ns::initFonts() {
-
 	if (getPlatform() == Common::kPlatformPC) {
 		_dialogueFont = _disk->loadFont("comic");
 		_labelFont = _disk->loadFont("topaz");
@@ -683,7 +682,6 @@
 		_menuFont = _disk->loadFont("slide");
 		_introFont = _disk->loadFont("intro");
 	}
-
 }
 
 void Parallaction_br::initFonts() {
@@ -701,4 +699,4 @@
 	}
 }
 
-}
+} // End of namespace Parallaction

Modified: scummvm/trunk/engines/parallaction/parallaction.cpp
===================================================================
--- scummvm/trunk/engines/parallaction/parallaction.cpp	2010-11-19 16:52:09 UTC (rev 54384)
+++ scummvm/trunk/engines/parallaction/parallaction.cpp	2010-11-19 17:03:07 UTC (rev 54385)
@@ -1004,4 +1004,4 @@
 }
 
 
-} // namespace Parallaction
+} // End of namespace Parallaction

Modified: scummvm/trunk/engines/parallaction/parallaction.h
===================================================================
--- scummvm/trunk/engines/parallaction/parallaction.h	2010-11-19 16:52:09 UTC (rev 54384)
+++ scummvm/trunk/engines/parallaction/parallaction.h	2010-11-19 17:03:07 UTC (rev 54385)
@@ -606,7 +606,7 @@
 extern Parallaction *_vm;
 
 
-} // namespace Parallaction
+} // End of namespace Parallaction
 
 
 #endif

Modified: scummvm/trunk/engines/parallaction/parser.cpp
===================================================================
--- scummvm/trunk/engines/parallaction/parser.cpp	2010-11-19 16:52:09 UTC (rev 54384)
+++ scummvm/trunk/engines/parallaction/parser.cpp	2010-11-19 17:03:07 UTC (rev 54385)
@@ -257,5 +257,4 @@
 	(*(*_currentOpcodes)[_lookup])();
 }
 
-
-} // namespace Parallaction
+} // End of namespace Parallaction

Modified: scummvm/trunk/engines/parallaction/parser.h
===================================================================
--- scummvm/trunk/engines/parallaction/parser.h	2010-11-19 16:52:09 UTC (rev 54384)
+++ scummvm/trunk/engines/parallaction/parser.h	2010-11-19 17:03:07 UTC (rev 54385)
@@ -409,13 +409,6 @@
 	virtual void parse(Script *script, ProgramPtr program);
 };
 
+} // End of namespace Parallaction
 
-} // namespace Parallaction
-
 #endif
-
-
-
-
-
-

Modified: scummvm/trunk/engines/queen/resource.cpp
===================================================================
--- scummvm/trunk/engines/queen/resource.cpp	2010-11-19 16:52:09 UTC (rev 54384)
+++ scummvm/trunk/engines/queen/resource.cpp	2010-11-19 17:03:07 UTC (rev 54385)
@@ -26,6 +26,7 @@
 #include "common/debug.h"
 #include "common/endian.h"
 #include "common/config-manager.h"
+#include "common/substream.h"
 #include "queen/resource.h"
 
 namespace Queen {

Modified: scummvm/trunk/engines/queen/sound.cpp
===================================================================
--- scummvm/trunk/engines/queen/sound.cpp	2010-11-19 16:52:09 UTC (rev 54384)
+++ scummvm/trunk/engines/queen/sound.cpp	2010-11-19 17:03:07 UTC (rev 54385)
@@ -26,7 +26,7 @@
 
 #include "common/config-manager.h"
 #include "common/endian.h"
-#include "common/stream.h"
+#include "common/memstream.h"
 
 #include "queen/sound.h"
 #include "queen/input.h"
@@ -119,7 +119,7 @@
 	MP3Sound(Audio::Mixer *mixer, QueenEngine *vm) : PCSound(mixer, vm) {}
 protected:
 	void playSoundData(Common::File *f, uint32 size, Audio::SoundHandle *soundHandle) {
-		Common::MemoryReadStream *tmp = f->readStream(size);
+		Common::SeekableReadStream *tmp = f->readStream(size);
 		assert(tmp);
 		_mixer->playStream(Audio::Mixer::kSFXSoundType, soundHandle, new AudioStreamWrapper(Audio::makeMP3Stream(tmp, DisposeAfterUse::YES)));
 	}
@@ -132,7 +132,7 @@
 	OGGSound(Audio::Mixer *mixer, QueenEngine *vm) : PCSound(mixer, vm) {}
 protected:
 	void playSoundData(Common::File *f, uint32 size, Audio::SoundHandle *soundHandle) {
-		Common::MemoryReadStream *tmp = f->readStream(size);
+		Common::SeekableReadStream *tmp = f->readStream(size);
 		assert(tmp);
 		_mixer->playStream(Audio::Mixer::kSFXSoundType, soundHandle, new AudioStreamWrapper(Audio::makeVorbisStream(tmp, DisposeAfterUse::YES)));
 	}
@@ -145,7 +145,7 @@
 	FLACSound(Audio::Mixer *mixer, QueenEngine *vm) : PCSound(mixer, vm) {}
 protected:
 	void playSoundData(Common::File *f, uint32 size, Audio::SoundHandle *soundHandle) {
-		Common::MemoryReadStream *tmp = f->readStream(size);
+		Common::SeekableReadStream *tmp = f->readStream(size);
 		assert(tmp);
 		_mixer->playStream(Audio::Mixer::kSFXSoundType, soundHandle, new AudioStreamWrapper(Audio::makeFLACStream(tmp, DisposeAfterUse::YES)));
 	}

Modified: scummvm/trunk/engines/saga/music.cpp
===================================================================
--- scummvm/trunk/engines/saga/music.cpp	2010-11-19 16:52:09 UTC (rev 54384)
+++ scummvm/trunk/engines/saga/music.cpp	2010-11-19 17:03:07 UTC (rev 54385)
@@ -36,6 +36,7 @@
 #include "sound/decoders/raw.h"
 #include "common/config-manager.h"
 #include "common/file.h"
+#include "common/substream.h"
 
 namespace Saga {
 

Modified: scummvm/trunk/engines/saga/saga.h
===================================================================
--- scummvm/trunk/engines/saga/saga.h	2010-11-19 16:52:09 UTC (rev 54384)
+++ scummvm/trunk/engines/saga/saga.h	2010-11-19 17:03:07 UTC (rev 54385)
@@ -30,7 +30,7 @@
 
 #include "common/array.h"
 #include "common/random.h"
-#include "common/stream.h"
+#include "common/memstream.h"
 #include "sound/mididrv.h"
 
 #include "saga/gfx.h"

Modified: scummvm/trunk/engines/sci/graphics/maciconbar.cpp
===================================================================
--- scummvm/trunk/engines/sci/graphics/maciconbar.cpp	2010-11-19 16:52:09 UTC (rev 54384)
+++ scummvm/trunk/engines/sci/graphics/maciconbar.cpp	2010-11-19 17:03:07 UTC (rev 54385)
@@ -30,7 +30,7 @@
 #include "sci/graphics/maciconbar.h"
 #include "sci/graphics/palette.h"
 
-#include "common/stream.h"
+#include "common/memstream.h"
 #include "common/system.h"
 #include "graphics/pict.h"
 #include "graphics/surface.h"
@@ -54,7 +54,7 @@
 		if (!res)
 			continue;
 
-		Common::MemoryReadStream *stream = new Common::MemoryReadStream(res->data, res->size);
+		Common::SeekableReadStream *stream = new Common::MemoryReadStream(res->data, res->size);
 		Graphics::Surface *surf = pict->decodeImage(stream, pal);
 		remapColors(surf, pal);
 

Modified: scummvm/trunk/engines/sci/sound/audio.cpp
===================================================================
--- scummvm/trunk/engines/sci/sound/audio.cpp	2010-11-19 16:52:09 UTC (rev 54384)
+++ scummvm/trunk/engines/sci/sound/audio.cpp	2010-11-19 17:03:07 UTC (rev 54385)
@@ -32,6 +32,7 @@
 #include "backends/audiocd/audiocd.h"
 
 #include "common/file.h"
+#include "common/memstream.h"
 #include "common/system.h"
 
 #include "sound/audiostream.h"
@@ -281,7 +282,7 @@
 		// additional buffer here. MP3/OGG/FLAC decompression works on-the-fly
 		// instead.
 		memcpy(compressedData, audioRes->data, audioRes->size);
-		Common::MemoryReadStream *compressedStream = new Common::MemoryReadStream(compressedData, audioRes->size, DisposeAfterUse::YES);
+		Common::SeekableReadStream *compressedStream = new Common::MemoryReadStream(compressedData, audioRes->size, DisposeAfterUse::YES);
 		
 		switch (audioCompressionType) {
 		case MKID_BE('MP3 '):
@@ -315,7 +316,7 @@
 			}
 		} else if (audioRes->size > 4 && READ_BE_UINT32(audioRes->data) == MKID_BE('RIFF')) {
 			// WAVE detected
-			Common::MemoryReadStream *waveStream = new Common::MemoryReadStream(audioRes->data, audioRes->size, DisposeAfterUse::NO);
+			Common::SeekableReadStream *waveStream = new Common::MemoryReadStream(audioRes->data, audioRes->size, DisposeAfterUse::NO);
 
 			// Calculate samplelen from WAVE header
 			int waveSize = 0, waveRate = 0;
@@ -327,7 +328,7 @@
 			audioStream = Audio::makeWAVStream(waveStream, DisposeAfterUse::YES);
 		} else if (audioRes->size > 4 && READ_BE_UINT32(audioRes->data) == MKID_BE('FORM')) {
 			// AIFF detected
-			Common::MemoryReadStream *waveStream = new Common::MemoryReadStream(audioRes->data, audioRes->size, DisposeAfterUse::NO);
+			Common::SeekableReadStream *waveStream = new Common::MemoryReadStream(audioRes->data, audioRes->size, DisposeAfterUse::NO);
 
 			// Calculate samplelen from AIFF header
 			int waveSize = 0, waveRate = 0;
@@ -340,7 +341,7 @@
 		} else if (audioRes->size > 14 && READ_BE_UINT16(audioRes->data) == 1 && READ_BE_UINT16(audioRes->data + 2) == 1
 				&& READ_BE_UINT16(audioRes->data + 4) == 5 && READ_BE_UINT32(audioRes->data + 10) == 0x00018051) {
 			// Mac snd detected
-			Common::MemoryReadStream *sndStream = new Common::MemoryReadStream(audioRes->data, audioRes->size, DisposeAfterUse::NO);
+			Common::SeekableReadStream *sndStream = new Common::MemoryReadStream(audioRes->data, audioRes->size, DisposeAfterUse::NO);
 
 			audioSeekStream = Audio::makeMacSndStream(sndStream, DisposeAfterUse::YES);
 		} else {

Modified: scummvm/trunk/engines/sci/sound/drivers/amigamac.cpp
===================================================================
--- scummvm/trunk/engines/sci/sound/drivers/amigamac.cpp	2010-11-19 16:52:09 UTC (rev 54384)
+++ scummvm/trunk/engines/sci/sound/drivers/amigamac.cpp	2010-11-19 17:03:07 UTC (rev 54385)
@@ -29,6 +29,7 @@
 
 #include "common/file.h"
 #include "common/frac.h"
+#include "common/memstream.h"
 #include "common/util.h"
 
 namespace Sci {

Modified: scummvm/trunk/engines/sci/sound/drivers/midi.cpp
===================================================================
--- scummvm/trunk/engines/sci/sound/drivers/midi.cpp	2010-11-19 16:52:09 UTC (rev 54384)
+++ scummvm/trunk/engines/sci/sound/drivers/midi.cpp	2010-11-19 17:03:07 UTC (rev 54385)
@@ -27,6 +27,7 @@
 
 #include "common/config-manager.h"
 #include "common/file.h"
+#include "common/memstream.h"
 
 #include "sound/fmopl.h"
 #include "sound/softsynth/emumidi.h"

Modified: scummvm/trunk/engines/scumm/file.cpp
===================================================================
--- scummvm/trunk/engines/scumm/file.cpp	2010-11-19 16:52:09 UTC (rev 54384)
+++ scummvm/trunk/engines/scumm/file.cpp	2010-11-19 17:03:07 UTC (rev 54385)
@@ -27,6 +27,8 @@
 
 #include "scumm/scumm.h"
 
+#include "common/substream.h"
+
 namespace Scumm {
 
 #pragma mark -

Modified: scummvm/trunk/engines/scumm/file.h
===================================================================
--- scummvm/trunk/engines/scumm/file.h	2010-11-19 16:52:09 UTC (rev 54384)
+++ scummvm/trunk/engines/scumm/file.h	2010-11-19 17:03:07 UTC (rev 54385)
@@ -27,6 +27,7 @@
 #define SCUMM_FILE_H
 
 #include "common/file.h"
+#include "common/memstream.h"
 
 #include "scumm/detection.h"
 

Modified: scummvm/trunk/engines/scumm/file_nes.h
===================================================================
--- scummvm/trunk/engines/scumm/file_nes.h	2010-11-19 16:52:09 UTC (rev 54384)
+++ scummvm/trunk/engines/scumm/file_nes.h	2010-11-19 17:03:07 UTC (rev 54385)
@@ -27,6 +27,7 @@
 #define SCUMM_FILE_NES_H
 
 #include "common/file.h"
+#include "common/memstream.h"
 
 #include "scumm/file.h"
 

Modified: scummvm/trunk/engines/scumm/he/cup_player_he.cpp
===================================================================
--- scummvm/trunk/engines/scumm/he/cup_player_he.cpp	2010-11-19 16:52:09 UTC (rev 54384)
+++ scummvm/trunk/engines/scumm/he/cup_player_he.cpp	2010-11-19 17:03:07 UTC (rev 54385)
@@ -26,6 +26,7 @@
 #ifdef ENABLE_HE
 
 #include "common/system.h"
+#include "common/memstream.h"
 #include "sound/audiostream.h"
 #include "sound/mixer.h"
 #include "sound/decoders/raw.h"

Modified: scummvm/trunk/engines/scumm/he/resource_he.cpp
===================================================================
--- scummvm/trunk/engines/scumm/he/resource_he.cpp	2010-11-19 16:52:09 UTC (rev 54384)
+++ scummvm/trunk/engines/scumm/he/resource_he.cpp	2010-11-19 17:03:07 UTC (rev 54385)
@@ -832,7 +832,7 @@
 	uint32 c, d;
 	int completed;
 	int matched = 0;
-	MemoryReadStream *in = new MemoryReadStream(data, datasize);
+	Common::MemoryReadStream *in = new Common::MemoryReadStream(data, datasize);
 
 	if (!in->read(&dir, sizeof(Win32CursorIconFileDir)- sizeof(Win32CursorIconFileDirEntry)))
 		goto cleanup;

Modified: scummvm/trunk/engines/scumm/he/resource_he.h
===================================================================
--- scummvm/trunk/engines/scumm/he/resource_he.h	2010-11-19 16:52:09 UTC (rev 54384)
+++ scummvm/trunk/engines/scumm/he/resource_he.h	2010-11-19 17:03:07 UTC (rev 54385)
@@ -147,9 +147,6 @@
 	bool _arg_raw;
 	Common::String _fileName;
 	CachedCursor _cursorCache[MAX_CACHED_CURSORS];
-
-	typedef Common::MemoryReadStream MemoryReadStream;
-
 };
 
 class Win32ResExtractor : public ResExtractor {

Modified: scummvm/trunk/engines/scumm/imuse_digi/dimuse_sndmgr.cpp
===================================================================
--- scummvm/trunk/engines/scumm/imuse_digi/dimuse_sndmgr.cpp	2010-11-19 16:52:09 UTC (rev 54384)
+++ scummvm/trunk/engines/scumm/imuse_digi/dimuse_sndmgr.cpp	2010-11-19 17:03:07 UTC (rev 54385)
@@ -700,7 +700,7 @@
 			assert(len);
 
 			if (!soundDesc->compressedStream) {
-				Common::MemoryReadStream *tmp = cmpFile->readStream(len);
+				Common::SeekableReadStream *tmp = cmpFile->readStream(len);
 				assert(tmp);
 #ifdef USE_FLAC
 				if (soundMode == 3)

Modified: scummvm/trunk/engines/scumm/saveload.cpp
===================================================================
--- scummvm/trunk/engines/scumm/saveload.cpp	2010-11-19 16:52:09 UTC (rev 54384)
+++ scummvm/trunk/engines/scumm/saveload.cpp	2010-11-19 17:03:07 UTC (rev 54385)
@@ -24,6 +24,7 @@
  */
 
 #include "common/config-manager.h"
+#include "common/memstream.h"
 #include "common/savefile.h"
 #include "common/system.h"
 #include "common/zlib.h"

Modified: scummvm/trunk/engines/scumm/sound.cpp
===================================================================
--- scummvm/trunk/engines/scumm/sound.cpp	2010-11-19 16:52:09 UTC (rev 54384)
+++ scummvm/trunk/engines/scumm/sound.cpp	2010-11-19 17:03:07 UTC (rev 54385)
@@ -598,7 +598,7 @@
 #ifdef USE_MAD
 			{
 			assert(size > 0);
-			Common::MemoryReadStream *tmp = _sfxFile->readStream(size);
+			Common::SeekableReadStream *tmp = _sfxFile->readStream(size);
 			assert(tmp);
 			input = Audio::makeMP3Stream(tmp, DisposeAfterUse::YES);
 			}
@@ -608,7 +608,7 @@
 #ifdef USE_VORBIS
 			{
 			assert(size > 0);
-			Common::MemoryReadStream *tmp = _sfxFile->readStream(size);
+			Common::SeekableReadStream *tmp = _sfxFile->readStream(size);
 			assert(tmp);
 			input = Audio::makeVorbisStream(tmp, DisposeAfterUse::YES);
 			}
@@ -618,7 +618,7 @@
 #ifdef USE_FLAC
 			{
 			assert(size > 0);
-			Common::MemoryReadStream *tmp = _sfxFile->readStream(size);
+			Common::SeekableReadStream *tmp = _sfxFile->readStream(size);
 			assert(tmp);
 			input = Audio::makeFLACStream(tmp, DisposeAfterUse::YES);
 			}

Modified: scummvm/trunk/engines/sword1/sound.cpp
===================================================================
--- scummvm/trunk/engines/sword1/sound.cpp	2010-11-19 16:52:09 UTC (rev 54384)
+++ scummvm/trunk/engines/sword1/sound.cpp	2010-11-19 17:03:07 UTC (rev 54385)
@@ -29,6 +29,7 @@
 #include "common/util.h"
 #include "common/events.h"
 #include "common/EventRecorder.h"
+#include "common/memstream.h"
 #include "common/system.h"
 
 #include "sword1/sound.h"
@@ -366,7 +367,7 @@
 			}
 		} else if (_cowMode == CowPSX && sampleSize != 0xffffffff) {
 			_cowFile.seek(index * 2048);
-			Common::MemoryReadStream *tmp = _cowFile.readStream(sampleSize);
+			Common::SeekableReadStream *tmp = _cowFile.readStream(sampleSize);
 			assert(tmp);
 			stream = Audio::makeVagStream(tmp);
 			_mixer->playStream(Audio::Mixer::kSpeechSoundType, &_speechHandle, stream, SOUND_SPEECH_ID, speechVol, speechPan);
@@ -379,7 +380,7 @@
 #ifdef USE_FLAC
 		else if (_cowMode == CowFLAC) {
 			_cowFile.seek(index);
-			Common::MemoryReadStream *tmp = _cowFile.readStream(sampleSize);
+			Common::SeekableReadStream *tmp = _cowFile.readStream(sampleSize);
 			assert(tmp);
 			stream = Audio::makeFLACStream(tmp, DisposeAfterUse::YES);
 			_mixer->playStream(Audio::Mixer::kSpeechSoundType, &_speechHandle, stream, SOUND_SPEECH_ID, speechVol, speechPan);
@@ -393,7 +394,7 @@
 #ifdef USE_VORBIS
 		else if (_cowMode == CowVorbis) {
 			_cowFile.seek(index);
-			Common::MemoryReadStream *tmp = _cowFile.readStream(sampleSize);
+			Common::SeekableReadStream *tmp = _cowFile.readStream(sampleSize);
 			assert(tmp);
 			stream = Audio::makeVorbisStream(tmp, DisposeAfterUse::YES);
 			_mixer->playStream(Audio::Mixer::kSpeechSoundType, &_speechHandle, stream, SOUND_SPEECH_ID, speechVol, speechPan);
@@ -407,7 +408,7 @@
 #ifdef USE_MAD
 		else if (_cowMode == CowMP3) {
 			_cowFile.seek(index);
-			Common::MemoryReadStream *tmp = _cowFile.readStream(sampleSize);
+			Common::SeekableReadStream *tmp = _cowFile.readStream(sampleSize);
 			assert(tmp);
 			stream = Audio::makeMP3Stream(tmp, DisposeAfterUse::YES);
 			_mixer->playStream(Audio::Mixer::kSpeechSoundType, &_speechHandle, stream, SOUND_SPEECH_ID, speechVol, speechPan);

Modified: scummvm/trunk/engines/sword2/console.cpp
===================================================================
--- scummvm/trunk/engines/sword2/console.cpp	2010-11-19 16:52:09 UTC (rev 54384)
+++ scummvm/trunk/engines/sword2/console.cpp	2010-11-19 17:03:07 UTC (rev 54385)
@@ -26,6 +26,7 @@
  */
 
 
+#include "common/memstream.h"
 #include "common/rect.h"
 #include "common/system.h"
 

Added: scummvm/trunk/engines/sword2/header.cpp
===================================================================
--- scummvm/trunk/engines/sword2/header.cpp	                        (rev 0)
+++ scummvm/trunk/engines/sword2/header.cpp	2010-11-19 17:03:07 UTC (rev 54385)
@@ -0,0 +1,293 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ *
+ * $URL$
+ * $Id$
+ *
+ */
+
+#include "sword2/header.h"
+#include "sword2/screen.h"
+#include "sword2/sword2.h"
+
+#include "common/memstream.h"
+#include "common/endian.h"
+
+namespace Sword2 {
+
+void ResHeader::read(byte *addr) {
+	Common::MemoryReadStream readS(addr, size());
+
+	fileType = readS.readByte();
+	compType = readS.readByte();
+	compSize = readS.readUint32LE();
+	decompSize = readS.readUint32LE();
+	readS.read(name, NAME_LEN);
+}
+
+void ResHeader::write(byte *addr) {
+	Common::MemoryWriteStream writeS(addr, size());
+
+	writeS.writeByte(fileType);
+	writeS.writeByte(compType);
+	writeS.writeUint32LE(compSize);
+	writeS.writeUint32LE(decompSize);
+	writeS.write(name, NAME_LEN);
+}
+
+void AnimHeader::read(byte *addr) {
+	Common::MemoryReadStream readS(addr, size());
+
+	if (Sword2Engine::isPsx()) {
+		noAnimFrames = readS.readUint16LE();
+		feetStartX = readS.readUint16LE();
+		feetStartY = readS.readUint16LE();
+		feetEndX = readS.readUint16LE();
+		feetEndY = readS.readUint16LE();
+		blend = readS.readUint16LE();
+		runTimeComp = readS.readByte();
+		feetStartDir = readS.readByte();
+		feetEndDir = readS.readByte();
+	} else {
+		runTimeComp = readS.readByte();
+		noAnimFrames = readS.readUint16LE();
+		feetStartX = readS.readUint16LE();
+		feetStartY = readS.readUint16LE();
+		feetStartDir = readS.readByte();
+		feetEndX = readS.readUint16LE();
+		feetEndY = readS.readUint16LE();
+		feetEndDir = readS.readByte();
+		blend = readS.readUint16LE();
+	}
+}
+
+void AnimHeader::write(byte *addr) {
+	Common::MemoryWriteStream writeS(addr, size());
+
+	writeS.writeByte(runTimeComp);
+	writeS.writeUint16LE(noAnimFrames);
+	writeS.writeUint16LE(feetStartX);
+	writeS.writeUint16LE(feetStartY);
+	writeS.writeByte(feetStartDir);
+	writeS.writeUint16LE(feetEndX);
+	writeS.writeUint16LE(feetEndY);
+	writeS.writeByte(feetEndDir);
+	writeS.writeUint16LE(blend);
+}
+
+int CdtEntry::size() {
+	if (Sword2Engine::isPsx())
+		return 12;
+	else
+		return 9;
+}
+
+void CdtEntry::read(byte *addr) {
+	Common::MemoryReadStream readS(addr, size());
+
+	if (Sword2Engine::isPsx()) {
+		readS.readByte(); // Skip a byte in psx version
+		x = readS.readUint16LE();
+		y = readS.readUint16LE();
+		frameOffset = readS.readUint32LE();
+		frameType = readS.readByte();
+	} else {
+		x = readS.readUint16LE();
+		y = readS.readUint16LE();
+		frameOffset = readS.readUint32LE();
+		frameType = readS.readByte();
+	}
+}
+
+void CdtEntry::write(byte *addr) {
+	Common::MemoryWriteStream writeS(addr, size());
+
+	writeS.writeUint16LE(x);
+	writeS.writeUint16LE(y);
+	writeS.writeUint32LE(frameOffset);
+	writeS.writeByte(frameType);
+}
+
+void FrameHeader::read(byte *addr) {
+	Common::MemoryReadStream readS(addr, size());
+
+	compSize = readS.readUint32LE();
+	width = readS.readUint16LE();
+	height = readS.readUint16LE();
+
+	if (Sword2Engine::isPsx()) { // In PSX version, frames are half height
+		height *= 2;
+		width = (width % 2) ? width + 1 : width;
+	}
+}
+
+void FrameHeader::write(byte *addr) {
+	Common::MemoryWriteStream writeS(addr, size());
+
+	writeS.writeUint32LE(compSize);
+	writeS.writeUint16LE(width);
+	writeS.writeUint16LE(height);
+}
+
+void MultiScreenHeader::read(byte *addr) {
+	Common::MemoryReadStream readS(addr, size());
+
+	palette = readS.readUint32LE();
+	bg_parallax[0] = readS.readUint32LE();
+	bg_parallax[1] = readS.readUint32LE();
+	screen = readS.readUint32LE();
+	fg_parallax[0] = readS.readUint32LE();
+	fg_parallax[1] = readS.readUint32LE();
+	layers = readS.readUint32LE();
+	paletteTable = readS.readUint32LE();
+	maskOffset = readS.readUint32LE();
+}
+
+void MultiScreenHeader::write(byte *addr) {
+	Common::MemoryWriteStream writeS(addr, size());
+
+	writeS.writeUint32LE(palette);
+	writeS.writeUint32LE(bg_parallax[0]);
+	writeS.writeUint32LE(bg_parallax[1]);
+	writeS.writeUint32LE(screen);
+	writeS.writeUint32LE(fg_parallax[0]);
+	writeS.writeUint32LE(fg_parallax[1]);
+	writeS.writeUint32LE(layers);
+	writeS.writeUint32LE(paletteTable);
+	writeS.writeUint32LE(maskOffset);
+}
+
+void ScreenHeader::read(byte *addr) {
+	Common::MemoryReadStream readS(addr, size());
+
+	width = readS.readUint16LE();
+	height = readS.readUint16LE();
+	noLayers = readS.readUint16LE();
+}
+
+void ScreenHeader::write(byte *addr) {
+	Common::MemoryWriteStream writeS(addr, size());
+
+	writeS.writeUint16LE(width);
+	writeS.writeUint16LE(height);
+	writeS.writeUint16LE(noLayers);
+}
+
+void LayerHeader::read(byte *addr) {
+	Common::MemoryReadStream readS(addr, size());
+
+	x = readS.readUint16LE();
+	y = readS.readUint16LE();
+	width = readS.readUint16LE();
+	height = readS.readUint16LE();
+	maskSize = readS.readUint32LE();
+	offset = readS.readUint32LE();
+}
+
+void LayerHeader::write(byte *addr) {
+	Common::MemoryWriteStream writeS(addr, size());
+
+	writeS.writeUint16LE(x);
+	writeS.writeUint16LE(y);
+	writeS.writeUint16LE(width);
+	writeS.writeUint16LE(height);
+	writeS.writeUint32LE(maskSize);
+	writeS.writeUint32LE(offset);
+}
+
+void TextHeader::read(byte *addr) {
+	Common::MemoryReadStream readS(addr, size());
+
+	noOfLines = readS.readUint32LE();
+}
+
+void TextHeader::write(byte *addr) {
+	Common::MemoryWriteStream writeS(addr, size());
+
+	writeS.writeUint32LE(noOfLines);
+}
+
+void PSXScreensEntry::read(byte *addr) {
+	Common::MemoryReadStream readS(addr, size());
+
+	bgPlxXres = readS.readUint16LE();
+	bgPlxYres = readS.readUint16LE();
+	bgPlxOffset = readS.readUint32LE();
+	bgPlxSize = readS.readUint32LE();
+	bgXres = readS.readUint16LE();
+	bgYres = readS.readUint16LE();
+	bgOffset = readS.readUint32LE();
+	bgSize = readS.readUint32LE();
+	fgPlxXres = readS.readUint16LE();
+	fgPlxYres = readS.readUint16LE();
+	fgPlxOffset = readS.readUint32LE();
+	fgPlxSize = readS.readUint32LE();
+}
+
+void PSXScreensEntry::write(byte *addr) {
+	Common::MemoryWriteStream writeS(addr, size());
+
+	writeS.writeUint16LE(bgPlxXres);
+	writeS.writeUint16LE(bgPlxYres);
+	writeS.writeUint32LE(bgPlxOffset);
+	writeS.writeUint32LE(bgPlxSize);
+	writeS.writeUint16LE(bgXres);
+	writeS.writeUint16LE(bgYres);
+	writeS.writeUint32LE(bgOffset);
+	writeS.writeUint32LE(bgSize);
+	writeS.writeUint16LE(fgPlxXres);
+	writeS.writeUint16LE(fgPlxYres);
+	writeS.writeUint32LE(fgPlxOffset);
+	writeS.writeUint32LE(fgPlxSize);
+}
+
+void PSXFontEntry::read(byte *addr) {
+	Common::MemoryReadStream readS(addr, size());
+
+	offset = readS.readUint16LE() / 2;
+	skipLines = readS.readUint16LE();
+	charWidth = readS.readUint16LE() / 2;
+	charHeight = readS.readUint16LE();
+}
+
+void PSXFontEntry::write(byte *addr) {
+	Common::MemoryWriteStream writeS(addr, size());
+
+	writeS.writeUint16LE(offset);
+	writeS.writeUint16LE(skipLines);
+	writeS.writeUint16LE(charWidth);
+	writeS.writeUint16LE(charHeight);
+}
+
+void Parallax::read(byte *addr) {
+	Common::MemoryReadStream readS(addr, size());
+
+	w = readS.readUint16LE();
+	h = readS.readUint16LE();
+}
+
+void Parallax::write(byte *addr) {
+	Common::MemoryWriteStream writeS(addr, size());
+
+	writeS.writeUint16LE(w);
+	writeS.writeUint16LE(h);
+}
+
+} // End of namespace Sword2


Property changes on: scummvm/trunk/engines/sword2/header.cpp
___________________________________________________________________
Added: svn:mime-type
   + text/plain
Added: svn:keywords
   + Date Rev Author URL Id
Added: svn:eol-style
   + native

Modified: scummvm/trunk/engines/sword2/header.h
===================================================================
--- scummvm/trunk/engines/sword2/header.h	2010-11-19 16:52:09 UTC (rev 54384)
+++ scummvm/trunk/engines/sword2/header.h	2010-11-19 17:03:07 UTC (rev 54385)
@@ -28,7 +28,6 @@
 #ifndef	SWORD2_HEADER_H
 #define	SWORD2_HEADER_H
 
-#include "common/stream.h"
 #include "common/endian.h"
 
 namespace Sword2 {
@@ -60,25 +59,8 @@
 		return 44;
 	}
 
-	void read(byte *addr) {
-		Common::MemoryReadStream readS(addr, size());
-
-		fileType = readS.readByte();
-		compType = readS.readByte();
-		compSize = readS.readUint32LE();
-		decompSize = readS.readUint32LE();
-		readS.read(name, NAME_LEN);
-	}
-
-	void write(byte *addr) {
-		Common::MemoryWriteStream writeS(addr, size());
-
-		writeS.writeByte(fileType);
-		writeS.writeByte(compType);
-		writeS.writeUint32LE(compSize);
-		writeS.writeUint32LE(decompSize);
-		writeS.write(name, NAME_LEN);
-	}
+	void read(byte *addr);
+	void write(byte *addr);
 };
 
 // fileType
@@ -156,46 +138,9 @@
 		return 15;
 	}
 
-	void read(byte *addr) {
-		Common::MemoryReadStream readS(addr, size());
+	void read(byte *addr);
+	void write(byte *addr);
 
-		if (Sword2Engine::isPsx()) {
-			noAnimFrames = readS.readUint16LE();
-			feetStartX = readS.readUint16LE();
-			feetStartY = readS.readUint16LE();
-			feetEndX = readS.readUint16LE();
-			feetEndY = readS.readUint16LE();
-			blend = readS.readUint16LE();
-			runTimeComp = readS.readByte();
-			feetStartDir = readS.readByte();
-			feetEndDir = readS.readByte();
-		} else {
-			runTimeComp = readS.readByte();
-			noAnimFrames = readS.readUint16LE();
-			feetStartX = readS.readUint16LE();
-			feetStartY = readS.readUint16LE();
-			feetStartDir = readS.readByte();
-			feetEndX = readS.readUint16LE();
-			feetEndY = readS.readUint16LE();
-			feetEndDir = readS.readByte();
-			blend = readS.readUint16LE();
-		}
-	}
-
-	void write(byte *addr) {
-		Common::MemoryWriteStream writeS(addr, size());
-
-		writeS.writeByte(runTimeComp);
-		writeS.writeUint16LE(noAnimFrames);
-		writeS.writeUint16LE(feetStartX);
-		writeS.writeUint16LE(feetStartY);
-		writeS.writeByte(feetStartDir);
-		writeS.writeUint16LE(feetEndX);
-		writeS.writeUint16LE(feetEndY);
-		writeS.writeByte(feetEndDir);
-		writeS.writeUint16LE(blend);
-	}
-
 };
 
 // runtimeComp - compression used on each frame of the anim
@@ -221,38 +166,10 @@
 	uint8 frameType;	// 0 = print sprite normally with top-left
 				// corner at (x,y), otherwise see below...
 
-	static int size() {
-		if (Sword2Engine::isPsx())
-			return 12;
-		else
-			return 9;
-	}
+	static int size();
 
-	void read(byte *addr) {
-		Common::MemoryReadStream readS(addr, size());
-
-		if (Sword2Engine::isPsx()) {
-			readS.readByte(); // Skip a byte in psx version
-			x = readS.readUint16LE();
-			y = readS.readUint16LE();
-			frameOffset = readS.readUint32LE();
-			frameType = readS.readByte();
-		} else {
-			x = readS.readUint16LE();
-			y = readS.readUint16LE();
-			frameOffset = readS.readUint32LE();
-			frameType = readS.readByte();
-		}
-	}
-
-	void write(byte *addr) {
-		Common::MemoryWriteStream writeS(addr, size());
-
-		writeS.writeUint16LE(x);
-		writeS.writeUint16LE(y);
-		writeS.writeUint32LE(frameOffset);
-		writeS.writeByte(frameType);
-	}
+	void read(byte *addr);
+	void write(byte *addr);
 };
 
 // 'frameType' bit values
@@ -277,26 +194,8 @@
 		return 8;
 	}
 
-	void read(byte *addr) {
-		Common::MemoryReadStream readS(addr, size());
-
-		compSize = readS.readUint32LE();
-		width = readS.readUint16LE();
-		height = readS.readUint16LE();
-
-		if (Sword2Engine::isPsx()) { // In PSX version, frames are half height
-			height *= 2;
-			width = (width % 2) ? width + 1 : width;
-		}
-	}
-
-	void write(byte *addr) {
-		Common::MemoryWriteStream writeS(addr, size());
-
-		writeS.writeUint32LE(compSize);
-		writeS.writeUint16LE(width);
-		writeS.writeUint16LE(height);
-	}
+	void read(byte *addr);
+	void write(byte *addr);
 };
 
 //----------------------------------------------------------
@@ -331,33 +230,8 @@
 		return 36;
 	}
 
-	void read(byte *addr) {
-		Common::MemoryReadStream readS(addr, size());
-
-		palette = readS.readUint32LE();
-		bg_parallax[0] = readS.readUint32LE();
-		bg_parallax[1] = readS.readUint32LE();
-		screen = readS.readUint32LE();
-		fg_parallax[0] = readS.readUint32LE();
-		fg_parallax[1] = readS.readUint32LE();
-		layers = readS.readUint32LE();
-		paletteTable = readS.readUint32LE();
-		maskOffset = readS.readUint32LE();
-	}
-
-	void write(byte *addr) {
-		Common::MemoryWriteStream writeS(addr, size());
-
-		writeS.writeUint32LE(palette);
-		writeS.writeUint32LE(bg_parallax[0]);
-		writeS.writeUint32LE(bg_parallax[1]);
-		writeS.writeUint32LE(screen);
-		writeS.writeUint32LE(fg_parallax[0]);
-		writeS.writeUint32LE(fg_parallax[1]);
-		writeS.writeUint32LE(layers);
-		writeS.writeUint32LE(paletteTable);
-		writeS.writeUint32LE(maskOffset);
-	}
+	void read(byte *addr);
+	void write(byte *addr);
 };
 
 // Screen Header
@@ -371,21 +245,8 @@
 		return 6;
 	}
 
-	void read(byte *addr) {
-		Common::MemoryReadStream readS(addr, size());
-
-		width = readS.readUint16LE();
-		height = readS.readUint16LE();
-		noLayers = readS.readUint16LE();
-	}
-
-	void write(byte *addr) {
-		Common::MemoryWriteStream writeS(addr, size());
-
-		writeS.writeUint16LE(width);
-		writeS.writeUint16LE(height);
-		writeS.writeUint16LE(noLayers);
-	}
+	void read(byte *addr);
+	void write(byte *addr);
 };
 
 // Layer Header
@@ -406,27 +267,8 @@
 		return 16;
 	}
 
-	void read(byte *addr) {
-		Common::MemoryReadStream readS(addr, size());
-
-		x = readS.readUint16LE();
-		y = readS.readUint16LE();
-		width = readS.readUint16LE();
-		height = readS.readUint16LE();
-		maskSize = readS.readUint32LE();
-		offset = readS.readUint32LE();
-	}
-
-	void write(byte *addr) {
-		Common::MemoryWriteStream writeS(addr, size());
-
-		writeS.writeUint16LE(x);
-		writeS.writeUint16LE(y);
-		writeS.writeUint16LE(width);
-		writeS.writeUint16LE(height);
-		writeS.writeUint32LE(maskSize);
-		writeS.writeUint32LE(offset);
-	}
+	void read(byte *addr);
+	void write(byte *addr);
 };
 
 //----------------------------------------------------------
@@ -511,17 +353,8 @@
 		return 4;
 	}
 
-	void read(byte *addr) {
-		Common::MemoryReadStream readS(addr, size());
-
-		noOfLines = readS.readUint32LE();
-	}
-
-	void write(byte *addr) {
-		Common::MemoryWriteStream writeS(addr, size());
-
-		writeS.writeUint32LE(noOfLines);
-	}
+	void read(byte *addr);
+	void write(byte *addr);
 };
 
 // a text file has:
@@ -567,39 +400,8 @@
 		return 36;
 	}
 
-	void read(byte *addr) {
-		Common::MemoryReadStream readS(addr, size());
-
-		bgPlxXres = readS.readUint16LE();
-		bgPlxYres = readS.readUint16LE();
-		bgPlxOffset = readS.readUint32LE();
-		bgPlxSize = readS.readUint32LE();
-		bgXres = readS.readUint16LE();
-		bgYres = readS.readUint16LE();
-		bgOffset = readS.readUint32LE();
-		bgSize = readS.readUint32LE();
-		fgPlxXres = readS.readUint16LE();
-		fgPlxYres = readS.readUint16LE();
-		fgPlxOffset = readS.readUint32LE();
-		fgPlxSize = readS.readUint32LE();
-	}
-
-	void write(byte *addr) {
-		Common::MemoryWriteStream writeS(addr, size());
-
-		writeS.writeUint16LE(bgPlxXres);
-		writeS.writeUint16LE(bgPlxYres);
-		writeS.writeUint32LE(bgPlxOffset);
-		writeS.writeUint32LE(bgPlxSize);
-		writeS.writeUint16LE(bgXres);
-		writeS.writeUint16LE(bgYres);
-		writeS.writeUint32LE(bgOffset);
-		writeS.writeUint32LE(bgSize);
-		writeS.writeUint16LE(fgPlxXres);
-		writeS.writeUint16LE(fgPlxYres);
-		writeS.writeUint32LE(fgPlxOffset);
-		writeS.writeUint32LE(fgPlxSize);
-	}
+	void read(byte *addr);
+	void write(byte *addr);
 };
 
 // PSXFontEntry is present in font resource file, it is used
@@ -615,23 +417,8 @@
 		return 8;
 	}
 
-	void read(byte *addr) {
-		Common::MemoryReadStream readS(addr, size());
-
-		offset = readS.readUint16LE() / 2;
-		skipLines = readS.readUint16LE();
-		charWidth = readS.readUint16LE() / 2;
-		charHeight = readS.readUint16LE();
-	}
-
-	void write(byte *addr) {
-		Common::MemoryWriteStream writeS(addr, size());
-
-		writeS.writeUint16LE(offset);
-		writeS.writeUint16LE(skipLines);
-		writeS.writeUint16LE(charWidth);
-		writeS.writeUint16LE(charHeight);
-	}
+	void read(byte *addr);
+	void write(byte *addr);
 };
 
 } // End of namespace Sword2

Modified: scummvm/trunk/engines/sword2/icons.cpp
===================================================================
--- scummvm/trunk/engines/sword2/icons.cpp	2010-11-19 16:52:09 UTC (rev 54384)
+++ scummvm/trunk/engines/sword2/icons.cpp	2010-11-19 17:03:07 UTC (rev 54385)
@@ -26,7 +26,7 @@
  */
 
 
-#include "common/stream.h"
+#include "common/memstream.h"
 #include "common/rect.h"
 

@@ Diff output truncated at 100000 characters. @@

This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.




More information about the Scummvm-git-logs mailing list