[Scummvm-cvs-logs] SF.net SVN: scummvm: [28044] scummex/branches/gsoc2007-gameresbrowser/src/ plugins/scumm

zbychs at users.sourceforge.net zbychs at users.sourceforge.net
Thu Jul 12 19:06:34 CEST 2007


Revision: 28044
          http://scummvm.svn.sourceforge.net/scummvm/?rev=28044&view=rev
Author:   zbychs
Date:     2007-07-12 10:06:33 -0700 (Thu, 12 Jul 2007)

Log Message:
-----------
Refactored the Scumm plugin a bit, added some comments.

Modified Paths:
--------------
    scummex/branches/gsoc2007-gameresbrowser/src/plugins/scumm/BlockyBlockPresenter.cpp
    scummex/branches/gsoc2007-gameresbrowser/src/plugins/scumm/BlockyBlockPresenter.h
    scummex/branches/gsoc2007-gameresbrowser/src/plugins/scumm/ScummBlockInfoPresenter.cpp
    scummex/branches/gsoc2007-gameresbrowser/src/plugins/scumm/ScummBlockInfoPresenter.h
    scummex/branches/gsoc2007-gameresbrowser/src/plugins/scumm/ScummBlockPresenter.h
    scummex/branches/gsoc2007-gameresbrowser/src/plugins/scumm/ScummParser.h
    scummex/branches/gsoc2007-gameresbrowser/src/plugins/scumm/ScummRecognizer.cpp

Added Paths:
-----------
    scummex/branches/gsoc2007-gameresbrowser/src/plugins/scumm/CustomScummBlocks.h
    scummex/branches/gsoc2007-gameresbrowser/src/plugins/scumm/ScummBlock.cpp
    scummex/branches/gsoc2007-gameresbrowser/src/plugins/scumm/ScummBlock.h
    scummex/branches/gsoc2007-gameresbrowser/src/plugins/scumm/ScummBlockFactory.cpp
    scummex/branches/gsoc2007-gameresbrowser/src/plugins/scumm/ScummBlockFactory.h
    scummex/branches/gsoc2007-gameresbrowser/src/plugins/scumm/ScummResource.cpp
    scummex/branches/gsoc2007-gameresbrowser/src/plugins/scumm/ScummResource.h
    scummex/branches/gsoc2007-gameresbrowser/src/plugins/scumm/ScummTag.cpp
    scummex/branches/gsoc2007-gameresbrowser/src/plugins/scumm/ScummTag.h

Removed Paths:
-------------
    scummex/branches/gsoc2007-gameresbrowser/src/plugins/scumm/resource.cpp
    scummex/branches/gsoc2007-gameresbrowser/src/plugins/scumm/resource.h

Modified: scummex/branches/gsoc2007-gameresbrowser/src/plugins/scumm/BlockyBlockPresenter.cpp
===================================================================
--- scummex/branches/gsoc2007-gameresbrowser/src/plugins/scumm/BlockyBlockPresenter.cpp	2007-07-12 15:39:17 UTC (rev 28043)
+++ scummex/branches/gsoc2007-gameresbrowser/src/plugins/scumm/BlockyBlockPresenter.cpp	2007-07-12 17:06:33 UTC (rev 28044)
@@ -4,7 +4,7 @@
 #include "scumm_stdafx.h"
 
 #include "scumm/BlockyBlockPresenter.h"
-#include "scumm/resource.h"
+#include "scumm/ScummBlock.h"
 #include "scumm/ScummParser.h"
 
 #include <iostream>

Modified: scummex/branches/gsoc2007-gameresbrowser/src/plugins/scumm/BlockyBlockPresenter.h
===================================================================
--- scummex/branches/gsoc2007-gameresbrowser/src/plugins/scumm/BlockyBlockPresenter.h	2007-07-12 15:39:17 UTC (rev 28043)
+++ scummex/branches/gsoc2007-gameresbrowser/src/plugins/scumm/BlockyBlockPresenter.h	2007-07-12 17:06:33 UTC (rev 28044)
@@ -7,7 +7,7 @@
 #include "CoreInterfaces.h"
 #include "scumm/ScummBlockPresenter.h"
 
-#include "scumm/resource.h"
+#include "scumm/ScummBlock.h"
 
 namespace Browser {
 

Added: scummex/branches/gsoc2007-gameresbrowser/src/plugins/scumm/CustomScummBlocks.h
===================================================================
--- scummex/branches/gsoc2007-gameresbrowser/src/plugins/scumm/CustomScummBlocks.h	                        (rev 0)
+++ scummex/branches/gsoc2007-gameresbrowser/src/plugins/scumm/CustomScummBlocks.h	2007-07-12 17:06:33 UTC (rev 28044)
@@ -0,0 +1,265 @@
+/////////////////////////////////////////////////////////////////////////////
+// CustomScummBlocks.h
+
+// This file holds implementations of ScummBlocks that can parse particular
+// scumm chunks. (Normally a ScummBlock is enough to parse a scumm chunk, but
+// some chunks have a weird format - so the customized ScummBlocks for them
+// are here.)
+
+// To be included in ScummBlockFactory.cpp
+
+/////////////////////////////////////////////////////////////////////////////
+/////////////////////////////////////////////////////////////////////////////
+// A ScummBlock that doesn't have a normal scumm chunk header.
+// It has only a block tag + data, no size field.
+
+class RawScummBlock : public ScummBlock {
+public:
+	RawScummBlock(ScummTag* tag, uint32 size, Common::SeekableReadStream* stream)
+		: ScummBlock(tag, size, stream) {}
+
+	virtual bool parse() {
+		_parsed = true;
+		ASSERT(_sizeMode == TILL_END);
+		ASSERT(!_readData);
+		ASSERT(!_parseSubBlocks);
+		return true;
+	}
+
+protected:
+
+	virtual bool readHeader() {
+		ASSERT(false); //we don't have a standard header
+		return false;
+	}
+
+	virtual bool determineHeaderSize(uint32& outSize) {
+		outSize = (_tag->isNewTag() ? 4 : 2);
+		return true;
+	}
+};
+
+/////////////////////////////////////////////////////////////////////////////
+/////////////////////////////////////////////////////////////////////////////
+// A dummy ScummBlock that represents a root of a Scumm file - not a real block
+
+class RootScummBlock : public ScummBlock {
+	scumm_blocks _rootBlocks;
+public:
+	RootScummBlock(ScummTag* tag, uint32 size, Common::SeekableReadStream* stream)
+		: ScummBlock(tag, size, stream) {
+			_rootBlocks.push_back(this);
+			_myId = _rootBlocks.begin();
+			_rootScummBlock = this;
+			_rootOffs = 0;
+	}
+
+	virtual scumm_blocks& rootBlocks() {
+		return _rootBlocks;
+	}
+	virtual bool parse() {
+		ASSERT(_sizeMode == TILL_END);
+		ASSERT(!_readData);
+		ASSERT(_parseSubBlocks);
+		return ScummBlock::parse();
+	}
+
+protected:
+
+	virtual bool readHeader() {
+		uint32 outSize = _mineStream->size();
+		ASSERT( _size == -1 || _size == outSize );
+		_size = outSize;
+		ASSERT( (_tag->isNewTag() && _tag->toString() == wxT("****")) ||
+				(!_tag->isNewTag() && _tag->toString() == wxT("**")) );
+		return true;
+	}
+
+	virtual bool determineHeaderSize(uint32& outSize) {
+		outSize = 0;
+		return true;
+	}
+};
+
+/////////////////////////////////////////////////////////////////////////////
+/////////////////////////////////////////////////////////////////////////////
+// A generic ScummBlocks that exposes width and height (for whatever purpose).
+
+ScummWidthHeightBlock::ScummWidthHeightBlock(ScummTag* tag, uint32 size, Common::SeekableReadStream* stream)
+	: ScummBlock(tag, size, stream) {}
+
+uint32 ScummWidthHeightBlock::getWidth() {
+	parse();
+	return _width;
+}
+
+uint32 ScummWidthHeightBlock::getHeight() {
+	parse();
+	return _height;
+}
+
+/////////////////////////////////////////////////////////////////////////////
+/////////////////////////////////////////////////////////////////////////////
+// A ScummBlock that is able to parse RMHD chunk.
+// It exposes the determined width and height of the room's image.
+
+class ScummRMHDBlock : public ScummWidthHeightBlock {
+	uint32 _objs;
+public:
+	ScummRMHDBlock(ScummTag* tag, uint32 size, Common::SeekableReadStream* stream)
+		: ScummWidthHeightBlock(tag, size, stream) {}
+
+	virtual uint32 getNumObjs() {
+		parse();
+		return _objs;
+	}
+
+	virtual bool readData() {
+		Common::SeekableReadStream& _input = *_mineStream;
+		_width = _input.readUint16LE();
+		_height = _input.readUint16LE();
+		_objs = _input.readUint16LE();
+		return true;
+	}
+};
+
+/////////////////////////////////////////////////////////////////////////////
+/////////////////////////////////////////////////////////////////////////////
+// A ScummBlock that is able to parse IMHD chunk.
+// It exposes the determined width and height of the image.
+
+class ScummIMHDBlock : public ScummWidthHeightBlock {
+	uint32 _numFiles;
+public:
+	ScummIMHDBlock(ScummTag* tag, uint32 size, Common::SeekableReadStream* stream)
+		: ScummWidthHeightBlock(tag, size, stream) {}
+
+	virtual uint32 getNumFiles() {
+		parse();
+		return _numFiles;
+	}
+
+	virtual bool readData() {
+		Common::SeekableReadStream& _input = *_mineStream;
+
+		uint32 mark = _input.readUint32LE();
+
+		if (mark == 730) {
+			_input.readUint16LE();
+			_numFiles = _input.readUint16LE(); // Number of images
+			_input.readUint16LE(); // X Position
+			_input.readUint16LE(); // Y Position
+			_width = _input.readUint16LE();
+			_height = _input.readUint16LE();
+		} else {
+			bool read = false;
+
+			ScummBlock* im00 = this->getNext();
+			ScummBlock* bomp = im00 ? im00->getNext() : NULL;
+			if (bomp && bomp->getTag()->equals("BOMP")) { //FIXME: it shouldn't be a BOMP test, almost 100%
+				Common::SeekableReadStream& _bompinput = *bomp->_mineStream;
+				_bompinput.seek(0, SEEK_SET);
+				_bompinput.seek(8 + 2, SEEK_SET);
+				uint32 mark = _bompinput.readUint32LE();
+				if (mark == 801) {
+					_numFiles = _bompinput.readUint32LE(); // Number of images
+					_bompinput.readUint32LE(); // X Position
+					_bompinput.readUint32LE(); // Y Position
+					_width = _bompinput.readUint32LE();
+					_height = _bompinput.readUint32LE();
+					read = true;
+				} 
+			}
+			
+			if (!read) {
+				_input.seek(10, SEEK_SET);
+				_numFiles = _input.readUint16LE();
+				_input.readUint32BE(); // Number of Z-Buffers per Image
+				_input.readUint16LE(); // X Position
+				_input.readUint16LE(); // Y Position
+				_width = _input.readUint16LE();
+				_height = _input.readUint16LE();
+			}
+		}
+		return true;
+	}
+};
+
+/////////////////////////////////////////////////////////////////////////////
+/////////////////////////////////////////////////////////////////////////////
+// A generic ScummBlocks that is able to parse palette chunks.
+
+ScummPALBlock::ScummPALBlock(ScummTag* tag, uint32 size, Common::SeekableReadStream* stream)
+: ScummBlock(tag, size, stream), _count(256), _palData(NULL) {}
+
+int ScummPALBlock::getColCount() {
+	parse();
+	return _count;
+}
+
+byte* ScummPALBlock::getPAL() {
+	parse();
+	ASSERT(_palData);
+	return _palData;
+}
+
+bool ScummPALBlock::parse() {
+	ASSERT(_readData);
+	ASSERT(!_parseSubBlocks);
+	bool res = ScummBlock::parse();
+	if (!res)
+		return false;
+	_palData = _data;
+	return true;
+}
+
+/////////////////////////////////////////////////////////////////////////////
+/////////////////////////////////////////////////////////////////////////////
+// Custom ScummBlocks that are able to parse AHDR and RGBS palettes.
+
+class ScummAHDRBlock : public ScummPALBlock {
+public:
+	ScummAHDRBlock(ScummTag* tag, uint32 size, Common::SeekableReadStream* stream)
+		: ScummPALBlock(tag, size, stream) {}
+
+	virtual byte* getPAL() {
+		parse();
+		ASSERT(_palData);
+		return _palData + 6;
+	}
+};
+
+class ScummRGBSBlock : public ScummPALBlock {
+public:
+	ScummRGBSBlock(ScummTag* tag, uint32 size, Common::SeekableReadStream* stream)
+		: ScummPALBlock(tag, size, stream) {}
+
+	virtual int getColCount() {
+		parse();
+		return _dsize / 3;
+	}
+};
+
+/////////////////////////////////////////////////////////////////////////////
+/////////////////////////////////////////////////////////////////////////////
+// Dummy ScummBlock that holds an EGA palette
+
+class ScummEGABlock : public ScummPALBlock {
+public:
+	ScummEGABlock(ScummTag* tag, uint32 size, Common::SeekableReadStream* stream)
+		: ScummPALBlock(tag, size, stream) {
+			_count = 16;
+			_palData = egaPal;
+			_parsed = true;
+	}
+};
+
+ScummPALBlock* getEGAPalette() {
+	ASSERT_STATICS_ALLOWED();
+	static ScummEGABlock ega(NULL, 0, NULL);
+	return &ega;
+}
+
+/////////////////////////////////////////////////////////////////////////////
+/////////////////////////////////////////////////////////////////////////////
+


Property changes on: scummex/branches/gsoc2007-gameresbrowser/src/plugins/scumm/CustomScummBlocks.h
___________________________________________________________________
Name: svn:mime-type
   + text/plain
Name: svn:eol-style
   + native

Copied: scummex/branches/gsoc2007-gameresbrowser/src/plugins/scumm/ScummBlock.cpp (from rev 28041, scummex/branches/gsoc2007-gameresbrowser/src/plugins/scumm/resource.cpp)
===================================================================
--- scummex/branches/gsoc2007-gameresbrowser/src/plugins/scumm/ScummBlock.cpp	                        (rev 0)
+++ scummex/branches/gsoc2007-gameresbrowser/src/plugins/scumm/ScummBlock.cpp	2007-07-12 17:06:33 UTC (rev 28044)
@@ -0,0 +1,355 @@
+/////////////////////////////////////////////////////////////////////////////
+// ScummBlock.cpp
+
+#include "scumm_stdafx.h"
+
+#include "scumm/ScummBlock.h"
+
+#include <algorithm>
+
+#include "debugmem.h"
+
+namespace Browser {
+
+using namespace Core;
+
+namespace Scumm {
+
+/////////////////////////////////////////////////////////////////////////////
+/////////////////////////////////////////////////////////////////////////////
+// A generic ScummBlock, heavily parametrized, that can parse almost any scumm
+// chunk. It can be subclassed to parse even most weird chunks.
+
+ScummBlock::ScummBlock(ScummTag* tag, uint32 size, Common::SeekableReadStream* stream)
+	: _tag(tag), _sizeMode(INVALID_SIZE_MODE),
+	  _ownStream(true), _mineStream(stream),
+	  _parsed(false), _size(size), _dsize(-1), _data(NULL),
+	  _readData(false), _parseSubBlocks(false),
+	  _parent(NULL), _rootScummBlock(NULL), _myId(), _rootOffs(-1),
+	  _level(0), _isStopper(false) {}
+
+ScummBlock::~ScummBlock() {
+	if(_tag)
+		delete _tag;
+	scumm_blocks::iterator i;
+	for (i = _subblocks.begin(); i != _subblocks.end(); ++i)
+		delete *i;
+	if (_ownStream)
+		delete _mineStream;
+	if (_data)
+		delete [] _data;
+}
+
+ScummTag* ScummBlock::getTag() {
+	return _tag;
+}
+
+const ScummBlock::scumm_blocks& ScummBlock::getSubBlocks() {
+	return _subblocks;
+}
+
+Common::SeekableReadStream* ScummBlock::getStream() {
+	return _mineStream;
+}
+
+uint32 ScummBlock::blockSize() {
+	ASSERT(_mineStream);
+	return _mineStream->size();
+}
+
+RecognizedFileType ScummBlock::getFileType() {
+	return RecognizedFileType(IDEAL_MATCH, _tag->getFileTypeGUID());
+}
+
+ScummBlock* ScummBlock::getParent() {
+	return _parent;
+}
+
+ScummBlock* ScummBlock::getNext() {
+	parse();
+	scumm_blocks::iterator i = _myId;
+	++i;
+	if (i == rootBlocks().end())
+		return NULL;
+
+	if ((*i)->_isStopper)
+		return NULL;
+
+	return *i;
+}
+
+ScummBlock* ScummBlock::getPrev() {
+	scumm_blocks::iterator i = _myId;
+	if (i == rootBlocks().begin())
+		return NULL;
+
+	ScummBlock* prev = *(--i);
+	if (prev->_isStopper)
+		return NULL;
+	if (prev->_parsed)
+		return prev;
+	prev->parse();
+	return getPrev();
+}
+
+ScummBlock* ScummBlock::findBlock(const char* tag, int dir) {
+	ScummBlock* prev = this;
+	while (true) {
+		prev = (dir == -1) ? prev->getPrev() : prev->getNext();
+		if (!prev)
+			return NULL;
+		if (prev->getTag()->equals(tag))
+			return prev;
+	}
+	return NULL;
+}
+
+ScummBlock* ScummBlock::findChild(const char* tag) {
+	ScummBlock* prev = this;
+	while (true) {
+		prev = prev->getNext();
+		if (!prev || (prev->_level <= this->_level))
+			return NULL;
+		if (prev->getTag()->equals(tag))
+			return prev;
+	}
+	return NULL;
+}
+
+bool ScummBlock::parse() {
+	if(_parsed)
+		return true;
+	_parsed = true;
+
+	ASSERT(_mineStream);
+	_mineStream->seek(0, SEEK_SET);
+
+	if (!readHeader())
+		return false;
+
+	if (!determineSizeMode())
+		return false;
+
+	if (!determineDataSize())
+		return false;
+
+	if (_readData && !readData())
+		return false;
+
+	if (_parseSubBlocks && !parseSubBlocks())
+		return false;
+
+	return true;
+}
+
+/////////////////////////////////////////////////////////////////////////////
+/////////////////////////////////////////////////////////////////////////////
+//protected:
+
+ScummBlock* ScummBlock::newBlock(ScummTag* tag, uint32 size, Common::SeekableReadStream* stream) {
+	return ScummBlockFactory::create(tag, size, stream);
+}
+
+bool ScummBlock::readHeader(ScummTag*& outTag, uint32& outSize) {
+	if (_tag->isNewTag()) {
+		outTag = new FourTag();
+		if (!outTag->read(_mineStream)) {
+			delete outTag;
+			return false;
+		}
+
+		outSize = _mineStream->readUint32BE();
+		if (_mineStream->ioFailed()) {
+			delete outTag;
+			return false;
+		}
+	} else {
+		outSize = _mineStream->readUint32LE();
+		if (_mineStream->ioFailed()) return false;
+
+		outTag = new TwoTag();
+		if (!outTag->read(_mineStream)) {
+			delete outTag;
+			return false;
+		}
+	}
+	return true;
+}
+
+bool ScummBlock::determineHeaderSize(uint32& outSize) {
+	outSize = (_tag->isNewTag() ? 8 : 6);
+	return true;
+}
+
+bool ScummBlock::readHeader() {
+	ScummTag* outTag;
+	uint32 outSize;
+	if (!readHeader(outTag, outSize))
+		return false;
+	ASSERT( _size == -1 || _size == outSize );
+	_size = outSize;
+	ASSERT( _tag->equals(*outTag) );
+	delete outTag;
+	return true;
+}
+
+bool ScummBlock::determineSizeMode() {
+	if (_sizeMode != INVALID_SIZE_MODE)
+		return true;
+	//_sizeMode = (_tag->isNewTag() ? TILL_END : HEADER_INCLUDED);
+	_sizeMode = HEADER_INCLUDED; //a reasonable default
+	return true;
+}
+
+bool ScummBlock::determineDataSize() {
+	uint32 outSize;
+	if (!determineDataSize(outSize))
+		return false;
+	_dsize = outSize;
+	return true;
+}
+
+bool ScummBlock::determineDataSize(uint32& outSize) {
+	if (_dsize != -1) {
+		outSize = _dsize;
+		return true;
+	}
+
+	uint32 hsize;
+	if (!determineHeaderSize(hsize))
+		return false;
+	if (!determineSizeMode())
+		return false;
+
+	switch (_sizeMode) {
+		case HEADER_INCLUDED:
+			outSize = _size - hsize;
+			return true;
+
+		case HEADER_NOT_INCLUDED:
+			outSize = _size;
+			return true;
+
+		case HEADER_NOT_INCLUDED_MINUS_ONE:
+			outSize = _size + 1;
+			return true;
+
+		case TILL_END:
+			{
+			uint32 ssize = _mineStream->size();
+			if (_mineStream->ioFailed()) return false;
+
+			outSize = ssize - hsize;
+			}
+			return true;
+
+		case ENTRY_BASED:
+		default:
+			break;
+	}
+
+	ASSERT(false);
+	return false;
+}
+
+bool ScummBlock::readData() {
+	return doReadData();
+}
+
+bool ScummBlock::parseSubBlocks() {
+	return doParseSubBlocks();
+}
+
+//utility function
+bool ScummBlock::doReadData() {
+	ASSERT(_dsize >= 0);
+	ASSERT( !_data );
+	_data = new byte[_dsize];
+	uint32 read = _mineStream->read(_data, _dsize);
+	if (_mineStream->ioFailed() || read != _dsize) {
+		delete [] _data;
+		_data = NULL;
+		return false;
+	}
+	return true;
+}
+
+ScummBlock::scumm_blocks& ScummBlock::rootBlocks() {
+	ASSERT(_rootScummBlock);
+	return _rootScummBlock->rootBlocks();
+}
+
+//utility function
+bool ScummBlock::doParseSubBlocks() {
+	scumm_id cur_id = _myId;
+	cur_id++;
+	while (true) {
+		uint32 pos = _mineStream->pos();
+		if (_mineStream->ioFailed())
+			return false;
+
+		if (_mineStream->eos())
+			break;
+		if (_mineStream->ioFailed())
+			return false;
+
+		ScummTag* outTag;
+		uint32 outSize;
+		if (!readHeader(outTag, outSize))
+			return false;
+
+		uint32 end = _mineStream->size();
+		if (_mineStream->ioFailed()) {
+			delete outTag;
+			return false;
+		}
+
+		Common::SeekableSubReadStream* kidstream = 
+			new Common::SeekableSubReadStream(_mineStream, pos, end, false);
+
+		ScummBlock* kidblock = newBlock(outTag, outSize, kidstream);
+		cur_id = rootBlocks().insert(cur_id, kidblock);
+		kidblock->_myId = cur_id;
+		cur_id++;
+		kidblock->_rootOffs = _rootOffs + pos;
+		kidblock->_rootScummBlock = _rootScummBlock;
+		kidblock->_parent = this;
+		kidblock->_level = _level + 1;
+
+		if (!kidblock->determineDataSize()) {
+			rootBlocks().erase(kidblock->_myId);
+			delete kidblock;
+			return false;
+		}
+		uint32 kidSize = kidblock->_dsize;
+
+		uint32 hsize;
+		if (!kidblock->determineHeaderSize(hsize)) {
+			rootBlocks().erase(kidblock->_myId);
+			delete kidblock;
+			return false;
+		}
+
+		kidSize += hsize;
+		if (kidSize != end - pos) {
+			delete kidstream;
+			kidstream = 
+				new Common::SeekableSubReadStream(_mineStream, pos, pos + kidSize, false);
+			kidblock->_mineStream = kidstream;
+		}
+
+		_subblocks.push_back(kidblock);
+		_mineStream->seek(pos + kidSize);
+		if (_mineStream->ioFailed())
+			return false;
+	}
+
+	return true;
+}
+
+/////////////////////////////////////////////////////////////////////////////
+/////////////////////////////////////////////////////////////////////////////
+
+} // namespace Scumm
+
+} // namespace Browser

Copied: scummex/branches/gsoc2007-gameresbrowser/src/plugins/scumm/ScummBlock.h (from rev 28041, scummex/branches/gsoc2007-gameresbrowser/src/plugins/scumm/resource.h)
===================================================================
--- scummex/branches/gsoc2007-gameresbrowser/src/plugins/scumm/ScummBlock.h	                        (rev 0)
+++ scummex/branches/gsoc2007-gameresbrowser/src/plugins/scumm/ScummBlock.h	2007-07-12 17:06:33 UTC (rev 28044)
@@ -0,0 +1,167 @@
+/////////////////////////////////////////////////////////////////////////////
+// ScummBlock.h
+
+#ifndef _SCUMM_BLOCK_H_
+#define _SCUMM_BLOCK_H_
+
+#include "scumm/ScummTag.h"
+
+#include "ScummBlockFactory.h"
+
+#include "FileType.h"
+#include "streams/stream.h"
+
+#include <list>
+
+namespace Browser {
+
+using namespace Core;
+
+namespace Scumm {
+
+/////////////////////////////////////////////////////////////////////////////
+/////////////////////////////////////////////////////////////////////////////
+// An enum defining the way to treat the size field in the chunk header
+// The size modes are taken form ScummEX help file.
+
+enum ScummChunkSizeMode {
+	INVALID_SIZE_MODE = -1,				//try to guess, defaults to HEADER_INCLUDED
+	HEADER_INCLUDED,					//normal chunk
+	HEADER_NOT_INCLUDED,				//header size not included in the chunk size
+	HEADER_NOT_INCLUDED_MINUS_ONE,		//like above, but minus one byte
+	ENTRY_BASED,						//the size is number of entries
+	TILL_END,							//ignore the size, take everything up to the end of the stream
+};
+
+/////////////////////////////////////////////////////////////////////////////
+/////////////////////////////////////////////////////////////////////////////
+// A generic ScummBlock, heavily parametrized, that can parse almost any scumm
+// chunk. It can be subclassed to parse even most weird chunks.
+
+class ScummBlock {
+public: //HACK: <-- only temporary
+	ScummTag* _tag;
+	ScummChunkSizeMode _sizeMode;
+
+	bool _ownStream;
+	Common::SeekableReadStream* _mineStream;
+
+	bool _parsed;
+	uint32 _size;					//the chunk size read from the header
+	uint32 _dsize;					//the computed chunk data size (using _sizeMode)
+	byte* _data;					//the read data
+
+	typedef std::list<ScummBlock*> scumm_blocks;
+	typedef scumm_blocks::iterator scumm_id;
+
+	ScummBlock* _parent;			//parent scumm block
+	scumm_id _myId;					//my unique identifier (really an iterator into the global list of scumm blocks)
+	ScummBlock* _rootScummBlock;	//root scumm block of the file I'm in
+	uint32 _rootOffs;				//my offset in the scumm file
+	int _level;						//how many ancestors I have
+
+	bool _isStopper;				//if this is true, the getNext()/getPrev() functions
+									//don't go beyond this block - set for ROOMs, LFLFs etc.
+									//so that searching is constrained to the "logical" scope
+
+	scumm_blocks _subblocks;		//list of my subblocks
+
+	bool _readData;					//do we want the data to be read?
+	bool _parseSubBlocks;			//do we want the subblocks to be parsed?
+
+	friend struct sbCreator;		//allow sbCreators to change the properties above
+	template<typename T>
+	friend struct sbCreatorT;
+
+public:
+	//create a scumm block with a given tag, size and stream
+	ScummBlock(ScummTag* tag, uint32 size, Common::SeekableReadStream* stream);
+	~ScummBlock();
+
+	//accessors
+	ScummTag* getTag();
+	const scumm_blocks& getSubBlocks();
+	Common::SeekableReadStream* getStream();
+	ScummBlock* getParent();
+	uint32 blockSize(); 				//size of mine stream
+
+	RecognizedFileType getFileType();	//returns file type proper for this chunk, i.e. a ("NewScummBlock" "LFLF")
+
+
+	virtual scumm_blocks& rootBlocks(); //get the list of all the blocks in the scumm file
+	//scumm_id getBlockId();
+	//void setBlockId(scumm_id id);
+
+	ScummBlock* findBlock(const char* tag, int dir);	//find a block with a given tag
+	ScummBlock* findChild(const char* tag);				//find a child
+	//void setParent(ScummBlock* parent); 
+
+	//ScummBlock* getScummBlock(scumm_id id);
+	ScummBlock* getNext();	//get next block in the list of all scumm blocks in the scumm file
+	ScummBlock* getPrev();	//like above, but previous
+
+	virtual bool parse();	//parse the input stream: it is a "template method"
+
+//protected:
+
+	//create a new scumm block for a given tag (uses ScummBlockFactory)
+	virtual ScummBlock* newBlock(ScummTag* tag, uint32 size, Common::SeekableReadStream* stream);
+
+	//parts of the parse() method, for parsing particular parts of the chunk
+	virtual bool readHeader();								//read my header
+	bool readHeader(ScummTag*& outTag, uint32& outSize);	//read some header
+	virtual bool readData();
+	virtual bool parseSubBlocks();
+
+	virtual bool determineHeaderSize(uint32& outSize);
+	virtual bool determineSizeMode();
+	virtual bool determineDataSize();
+	virtual bool determineDataSize(uint32& outSize);
+
+	bool doReadData();			//default implementation of readData()
+	bool doParseSubBlocks();	//default implementation of parseSubBlocks()
+};
+
+/////////////////////////////////////////////////////////////////////////////
+/////////////////////////////////////////////////////////////////////////////
+
+// a convenience superclass for blocks that have some _width and _height semantics
+class ScummWidthHeightBlock : public ScummBlock {
+protected:
+	uint32 _width;
+	uint32 _height;
+
+public:
+	ScummWidthHeightBlock(ScummTag* tag, uint32 size, Common::SeekableReadStream* stream);
+	virtual uint32 getWidth();
+	virtual uint32 getHeight();
+};
+
+/////////////////////////////////////////////////////////////////////////////
+/////////////////////////////////////////////////////////////////////////////
+
+// a convenience superclass for palette blocks
+class ScummPALBlock : public ScummBlock {
+protected:
+	int _count;
+	byte* _palData;
+public:
+
+	ScummPALBlock(ScummTag* tag, uint32 size, Common::SeekableReadStream* stream);
+
+	virtual int getColCount();
+	virtual byte* getPAL();
+	virtual bool parse();
+};
+
+// returns a dummy ScummPALBlock filled with the EGA palette
+ScummPALBlock* getEGAPalette();
+
+/////////////////////////////////////////////////////////////////////////////
+/////////////////////////////////////////////////////////////////////////////
+
+} // namespace Scumm
+
+} // namespace Browser
+
+#endif // _SCUMM_BLOCK_H_

Added: scummex/branches/gsoc2007-gameresbrowser/src/plugins/scumm/ScummBlockFactory.cpp
===================================================================
--- scummex/branches/gsoc2007-gameresbrowser/src/plugins/scumm/ScummBlockFactory.cpp	                        (rev 0)
+++ scummex/branches/gsoc2007-gameresbrowser/src/plugins/scumm/ScummBlockFactory.cpp	2007-07-12 17:06:33 UTC (rev 28044)
@@ -0,0 +1,348 @@
+/////////////////////////////////////////////////////////////////////////////
+// ScummBlockFactory.cpp
+
+#include "scumm_stdafx.h"
+
+#include "scumm/ScummResource.h"
+#include "scumm/ScummBlock.h"
+#include "scumm/ScummFileTypes.h"
+#include "CoreFileTypes.h"
+
+#include <list>
+#include <algorithm>
+
+#include "safe_static.h"
+
+#include "debugmem.h"
+
+namespace Browser {
+
+using namespace Core;
+
+namespace Scumm {
+
+/////////////////////////////////////////////////////////////////////////////
+/////////////////////////////////////////////////////////////////////////////
+// Include specialized ScummBlocks for various scumm chunks.
+
+#include "scumm/CustomScummBlocks.h"
+
+/////////////////////////////////////////////////////////////////////////////
+/////////////////////////////////////////////////////////////////////////////
+
+// The sbCreator is a class that can create a ScummBlock,
+// and plug some characteristics into it after its creation.
+//
+// sbCreator also holds the preffered parsers for blocks it creates.
+//
+// The sbCreator is abstract, sbCreator<T> template provides implementation for
+// creating ScummBlocks of type T.
+
+struct sbCreator {
+	ScummTag* _tag;
+	guid_list_t _parsers;
+
+	ScummChunkSizeMode _sizeMode;
+
+	uint32 _size;  //read from the header
+	uint32 _dsize; //the computed data size
+
+	bool _readData;			//do we want the data to be read?
+	bool _parseSubBlocks;   //do we want the subblocks to be parsed?
+
+	bool _isStopper;   //do we want to be a stopper for getNext()/getPrev()?
+
+	sbCreator(ScummTag* tag,
+		ScummChunkSizeMode sizeMode,
+		uint32 size, uint32 dsize,
+		bool readData, bool parseSubBlocks, bool isStopper)
+		: _tag(tag), _sizeMode(sizeMode), _size(size), _dsize(dsize),
+		_readData(readData), _parseSubBlocks(parseSubBlocks), _isStopper(isStopper) {}
+
+	virtual ScummBlock* create(ScummTag* tag, uint32 size, Common::SeekableReadStream* stream) = 0;
+
+	int addParser(const BGUID& parserGUID) {
+		_parsers.push_back(&const_cast<BGUID&>(parserGUID));
+		return 1;
+	}
+};
+
+/////////////////////////////////////////////////////////////////////////////
+/////////////////////////////////////////////////////////////////////////////
+
+// The sbCreatorT<> template  is a class that can create a ScummBlock of a give type.
+// It implements the sbCreator interface.
+
+template<typename T>
+struct sbCreatorT : public sbCreator {
+	sbCreatorT(ScummTag* tag,
+		ScummChunkSizeMode sizeMode,
+		uint32 size, uint32 dsize,
+		bool readData, bool parseSubBlocks, bool isStopper)
+		:  sbCreator(tag, sizeMode, size, dsize, readData, parseSubBlocks, isStopper) {}
+
+	virtual ScummBlock* create(ScummTag* tag, uint32 size, Common::SeekableReadStream* stream) {
+		ASSERT(tag);
+		wxString t = _tag->toString();
+		ASSERT(tag->equals(*_tag) ||
+				t == wxT("****") ||
+				t == wxT("**") ||
+				t == wxT("????") ||
+				t == wxT("??") );
+		ASSERT(stream);
+		ASSERT(_size == -1 || _size == size);
+		T* block = new T(tag, size, stream);
+		block->_sizeMode = _sizeMode;
+		//block->_size = _size;
+		block->_dsize = _dsize;
+		block->_readData = _readData;
+		block->_parseSubBlocks = _parseSubBlocks;
+		block->_isStopper = _isStopper;
+		return block;
+	}
+};
+
+/////////////////////////////////////////////////////////////////////////////
+/////////////////////////////////////////////////////////////////////////////
+// An ugly macro for deteminig the right ScummTag subclass from a tag name
+
+template<int N>
+struct TagChoice {
+	typedef FourTag tag_type;
+};
+template<>
+struct TagChoice<3> {
+	typedef TwoTag tag_type;
+};
+
+#define TAG_TYPE(tag) TagChoice<sizeof(tag)>::tag_type
+
+/////////////////////////////////////////////////////////////////////////////
+/////////////////////////////////////////////////////////////////////////////
+// These are also macros that create sbCreatorT's for a given type,
+// with given characteristics.
+// i.e. a DATA_BLOCK creates a ScummBlock and sets its _parseData propery to true.
+//      a BLOCKY_BLOCK creates a ScummBlock and sets its _parseSubBlocks propery to true.
+//
+// Some of these macros also take a preffered presenterGUID for the block they describe,
+// and insert it into the sbCreator structure.
+//
+// These macros are used to define proper sbCreators for given tags in the sb_creators()
+// function.
+
+#include "plugin_detail.h"
+
+#define SCUMM_BLOCK(blocktype, tag, sizeMode, size, dsize, readData, parseSubBlocks, isStopper) \
+	static TAG_TYPE(tag) GENERATE_UNIQUE_IDENTIFIER_SUB(t)(tag); \
+	static sbCreatorT<blocktype> GENERATE_UNIQUE_IDENTIFIER_SUB(creator) \
+		(&GENERATE_UNIQUE_IDENTIFIER_SUB(t), sizeMode, size, dsize, readData, parseSubBlocks, isStopper); \
+	static ret_pair GENERATE_UNIQUE_IDENTIFIER_SUB(insert) = creators.insert( \
+		the_pair( wxString(wxT(tag)), &GENERATE_UNIQUE_IDENTIFIER_SUB(creator)) );
+
+#define DATA_BLOCK(blocktype, tag, presenterGUID) \
+	SCUMM_BLOCK(blocktype, tag, INVALID_SIZE_MODE, -1, -1, true, false, false) \
+		static int GENERATE_UNIQUE_IDENTIFIER_SUB(parser) = \
+		GENERATE_UNIQUE_IDENTIFIER_SUB(creator).addParser(presenterGUID);
+
+#define CUSTOM_BLOCK_EX(blocktype, tag, presenterGUID) \
+	SCUMM_BLOCK(blocktype, tag, INVALID_SIZE_MODE, -1, -1, false, false, false) \
+	static int GENERATE_UNIQUE_IDENTIFIER_SUB(parser) = \
+	GENERATE_UNIQUE_IDENTIFIER_SUB(creator).addParser(presenterGUID);
+
+#define BLOCKY_BLOCK_EX(blocktype, tag, presenterGUID) \
+	SCUMM_BLOCK(blocktype, tag, INVALID_SIZE_MODE, -1, -1, false, true, false) \
+	static int GENERATE_UNIQUE_IDENTIFIER_SUB(parser) = \
+	GENERATE_UNIQUE_IDENTIFIER_SUB(creator).addParser(blockyBlockPresenterGUID()); \
+	static int GENERATE_UNIQUE_IDENTIFIER_SUB(parser2) = \
+	GENERATE_UNIQUE_IDENTIFIER_SUB(creator).addParser(presenterGUID);
+
+#define CUSTOM_BLOCK(tag, presenterGUID) \
+	CUSTOM_BLOCK_EX(ScummBlock, tag, presenterGUID)
+
+#define BASIC_BLOCK(tag) \
+	SCUMM_BLOCK(ScummBlock, tag, INVALID_SIZE_MODE, -1, -1, false, false, false) \
+	static int GENERATE_UNIQUE_IDENTIFIER_SUB(parser) = \
+		GENERATE_UNIQUE_IDENTIFIER_SUB(creator).addParser(CoreFileTypes::binaryParserGUID());
+
+#define BLOCKY_BLOCK(tag) \
+	SCUMM_BLOCK(ScummBlock, tag, INVALID_SIZE_MODE, -1, -1, false, true, false) \
+	static int GENERATE_UNIQUE_IDENTIFIER_SUB(parser) = \
+		GENERATE_UNIQUE_IDENTIFIER_SUB(creator).addParser(blockyBlockPresenterGUID());
+
+#define BLOCKY_STOPPER(tag) \
+	SCUMM_BLOCK(ScummBlock, tag, INVALID_SIZE_MODE, -1, -1, false, true, true) \
+	static int GENERATE_UNIQUE_IDENTIFIER_SUB(parser) = \
+	GENERATE_UNIQUE_IDENTIFIER_SUB(creator).addParser(blockyBlockPresenterGUID());
+
+#define ROOT_BLOCK(tag) \
+	SCUMM_BLOCK(RootScummBlock, tag, TILL_END, -1, -1, false, true, false) \
+		static int GENERATE_UNIQUE_IDENTIFIER_SUB(parser) = \
+		GENERATE_UNIQUE_IDENTIFIER_SUB(creator).addParser(blockyBlockPresenterGUID());
+
+/////////////////////////////////////////////////////////////////////////////
+/////////////////////////////////////////////////////////////////////////////
+// sb_creators() function returns a map<tagName, sbCreator> of creators for
+// ScummBlocks.
+// This map is then used to get a proper creator for a given tag in method
+// ScummBlockFactory::create()
+
+typedef std::map<wxString, sbCreator*> creator_map_t;
+const creator_map_t& sb_creators() {
+	ASSERT_STATICS_ALLOWED();
+
+	typedef creator_map_t::value_type the_pair;
+	typedef std::pair<creator_map_t::iterator, bool> ret_pair;
+	static creator_map_t creators;
+
+	//static TwoTag tag("tag");
+	//static sbCreatorT<ScummBlock> creator(&tag, INVALID_SIZE_MODE, -1, -1, false, true);
+	//static ret_pair res = info_map.insert(wxT("tag"), &creator);
+
+	//Roots of a scumm file
+	ROOT_BLOCK("****")
+	ROOT_BLOCK("**")
+
+	//Unknown blocks
+	BASIC_BLOCK("????")
+	BASIC_BLOCK("??")
+
+	//Palettes
+	DATA_BLOCK(ScummPALBlock, "APAL", scummPALBlockPresenterGUID())
+	DATA_BLOCK(ScummPALBlock, "CLUT", scummPALBlockPresenterGUID())
+	DATA_BLOCK(ScummPALBlock, "NPAL", scummPALBlockPresenterGUID())
+	DATA_BLOCK(ScummPALBlock, "PA", scummPALBlockPresenterGUID())
+	DATA_BLOCK(ScummAHDRBlock, "AHDR", scummPALBlockPresenterGUID())
+	DATA_BLOCK(ScummRGBSBlock, "RGBS", scummPALBlockPresenterGUID())
+
+	//Images
+	BLOCKY_BLOCK("IM00")
+	BLOCKY_BLOCK_EX(ScummBlock, "IM01", scummIMGBlockPresenterGUID())
+	BLOCKY_BLOCK_EX(ScummBlock, "IM02", scummIMGBlockPresenterGUID())
+	BLOCKY_BLOCK_EX(ScummBlock, "IM03", scummIMGBlockPresenterGUID())
+	BLOCKY_BLOCK_EX(ScummBlock, "IM04", scummIMGBlockPresenterGUID())
+	BLOCKY_BLOCK_EX(ScummBlock, "IM05", scummIMGBlockPresenterGUID())
+	BLOCKY_BLOCK_EX(ScummBlock, "IM06", scummIMGBlockPresenterGUID())
+	BLOCKY_BLOCK_EX(ScummBlock, "IM07", scummIMGBlockPresenterGUID())
+	BLOCKY_BLOCK_EX(ScummBlock, "IM08", scummIMGBlockPresenterGUID())
+	BLOCKY_BLOCK_EX(ScummBlock, "IM09", scummIMGBlockPresenterGUID())
+	BLOCKY_BLOCK_EX(ScummBlock, "IM0A", scummIMGBlockPresenterGUID())
+	BLOCKY_BLOCK_EX(ScummBlock, "IM0B", scummIMGBlockPresenterGUID())
+	BLOCKY_BLOCK_EX(ScummBlock, "IM0C", scummIMGBlockPresenterGUID())
+	BLOCKY_BLOCK_EX(ScummBlock, "IM0D", scummIMGBlockPresenterGUID())
+	BLOCKY_BLOCK_EX(ScummBlock, "IM0E", scummIMGBlockPresenterGUID())
+	BLOCKY_BLOCK_EX(ScummBlock, "IM0F", scummIMGBlockPresenterGUID())
+
+	BLOCKY_BLOCK_EX(ScummBlock, "OI", scummIMGBlockPresenterGUID())
+	BLOCKY_BLOCK_EX(ScummBlock, "OBIM", scummIMGBlockPresenterGUID())
+
+	BLOCKY_BLOCK_EX(ScummBlock, "BM", scummIMGBlockPresenterGUID())
+	BLOCKY_BLOCK_EX(ScummBlock, "RMIM", scummIMGBlockPresenterGUID())
+	BLOCKY_BLOCK_EX(ScummBlock, "IMAG", scummIMGBlockPresenterGUID())
+
+	//Scripts
+	CUSTOM_BLOCK("LSCR", scummScriptBlockPresenterGUID())
+	CUSTOM_BLOCK("SCRP", scummScriptBlockPresenterGUID())
+	CUSTOM_BLOCK("ENCD", scummScriptBlockPresenterGUID())
+	CUSTOM_BLOCK("EXCD", scummScriptBlockPresenterGUID())
+	CUSTOM_BLOCK("VERB", scummScriptBlockPresenterGUID())
+	CUSTOM_BLOCK("LS", scummScriptBlockPresenterGUID())
+	CUSTOM_BLOCK("SC", scummScriptBlockPresenterGUID())
+	CUSTOM_BLOCK("EN", scummScriptBlockPresenterGUID())
+	CUSTOM_BLOCK("EX", scummScriptBlockPresenterGUID())
+	CUSTOM_BLOCK("OC", scummScriptBlockPresenterGUID())
+
+	//Other
+	BASIC_BLOCK("ADL ")
+	BASIC_BLOCK("AMI ")
+	SCUMM_BLOCK(ScummBlock, "DATA", TILL_END, -1, -1, false, false, false) //TODO: probably not correct
+
+	BASIC_BLOCK("FRMT")
+	BASIC_BLOCK("GMD ")
+	SCUMM_BLOCK(ScummBlock, "iMUS", TILL_END, -1, -1, false, true, false) //TODO: probably not correct
+	BASIC_BLOCK("JUMP")
+
+	SCUMM_BLOCK(RawScummBlock, "LABN", TILL_END, -1, -1, false, false, false) //TODO: parse it properly
+	SCUMM_BLOCK(RawScummBlock, "LB83", TILL_END, -1, -1, false, false, false) //TODO: parse it properly
+	BLOCKY_STOPPER("LECF")
+	BLOCKY_STOPPER("LFLF")
+	CUSTOM_BLOCK("LOFF", scummLOFFBlockPresenterGUID())
+	BASIC_BLOCK("MAP ")
+	SCUMM_BLOCK(RawScummBlock, "MCMP", TILL_END, -1, -1, false, false, false) //TODO: parse it properly
+	BASIC_BLOCK("MIDI")
+	CUSTOM_BLOCK("OFFS", scummOFFSBlockPresenterGUID())
+
+	BLOCKY_BLOCK("PALS")
+	SCUMM_BLOCK(RawScummBlock, "RIFF", TILL_END, -1, -1, false, false, false) //TODO: parse it properly
+	BASIC_BLOCK("ROL ")
+	BLOCKY_STOPPER("ROOM")
+	DATA_BLOCK(ScummIMHDBlock, "IMHD", CoreFileTypes::binaryParserGUID())
+	DATA_BLOCK(ScummRMHDBlock, "RMHD", scummRMHDBlockPresenterGUID())
+	BLOCKY_BLOCK("RMSC")
+	BASIC_BLOCK("SPK ")
+	BASIC_BLOCK("STOP")
+
+	CUSTOM_BLOCK("TRNS", scummTRNSBlockPresenterGUID())
+
+	BLOCKY_BLOCK("WRAP") //FIXME: Is this ok? Shouldn't the OFFS subblock be used here?
+
+	BLOCKY_BLOCK("PALS")
+	BLOCKY_BLOCK("OBCD")
+
+	//FIXME: files
+	//BLOCKY_BLOCK(".IMC")
+	//BLOCKY_BLOCK(".IMX")
+	//BASIC_BLOCK(".LUA")
+	//BASIC_BLOCK(".TXT")
+	//BLOCKY_BLOCK(".WAV")
+
+	return creators;
+}
+
+/////////////////////////////////////////////////////////////////////////////
+/////////////////////////////////////////////////////////////////////////////
+
+// This function uses sb_creators() map to get aproper creator for a given tag
+/*static*/ sbCreator* ScummBlockFactory::getCreatorForTag(wxString tagName) {
+	ASSERT(tagName.Len() == 2 || tagName.Len() == 4);
+	bool newTag = tagName.Len() == 4;
+
+	bool unknown = false;
+	creator_map_t::const_iterator i;
+	i = sb_creators().find(tagName);
+	if (i == sb_creators().end()) {
+		i = sb_creators().find(newTag ? wxT("????") : wxT("??"));
+		ASSERT(i != sb_creators().end());
+		unknown = true;
+	}
+
+	sbCreator* creator = i->second;
+	return creator;
+}
+
+// This function creates a proper ScummBlock for a given tag.
+/*static*/ ScummBlock* ScummBlockFactory::create(ScummTag* tag, uint32 size, Common::SeekableReadStream* stream) {
+	ASSERT(tag);
+	sbCreator* creator = ScummBlockFactory::getCreatorForTag(tag->toString());
+	ASSERT(creator);
+	ScummBlock* block = creator->create(tag, size, stream);
+
+	return block;
+}
+
+// This function returns preffered parsers for a given tag.
+// The list of preffered parsers is taken from an sbCreator for a give tag.
+/*static*/ guid_list_t ScummBlockFactory::getScummBlockParsers(const BGUID& tagGUID) {
+	wxString tagName = tagGUID.identifier;
+
+	sbCreator* creator = ScummBlockFactory::getCreatorForTag(tagName);
+
+	ASSERT(creator);
+	return creator->_parsers;
+}
+
+/////////////////////////////////////////////////////////////////////////////
+/////////////////////////////////////////////////////////////////////////////
+
+} // namespace Scumm
+
+} // namespace Browser


Property changes on: scummex/branches/gsoc2007-gameresbrowser/src/plugins/scumm/ScummBlockFactory.cpp
___________________________________________________________________
Name: svn:mime-type
   + text/plain
Name: svn:eol-style
   + native

Added: scummex/branches/gsoc2007-gameresbrowser/src/plugins/scumm/ScummBlockFactory.h
===================================================================
--- scummex/branches/gsoc2007-gameresbrowser/src/plugins/scumm/ScummBlockFactory.h	                        (rev 0)
+++ scummex/branches/gsoc2007-gameresbrowser/src/plugins/scumm/ScummBlockFactory.h	2007-07-12 17:06:33 UTC (rev 28044)
@@ -0,0 +1,43 @@
+/////////////////////////////////////////////////////////////////////////////
+// ScummBlockFactory.h
+
+#ifndef _SCUMM_BLOCK_FACTORY_H_
+#define _SCUMM_BLOCK_FACTORY_H_
+
+#include "streams/stream.h"
+
+#include "FileTypeRecognizer.h"
+
+#include <list>
+
+namespace Browser {
+
+using namespace Core;
+
+namespace Scumm {
+
+/////////////////////////////////////////////////////////////////////////////
+/////////////////////////////////////////////////////////////////////////////
+
+struct ScummTag;
+class ScummBlock;
+
+struct sbCreator;
+template<typename T>
+struct sbCreatorT;
+
+class ScummBlockFactory {
+public:
+	static sbCreator* getCreatorForTag(wxString tagName);
+	static ScummBlock* create(ScummTag* tag, uint32 size, Common::SeekableReadStream* stream);
+	static guid_list_t getScummBlockParsers(const BGUID& tagGUID);
+};
+
+/////////////////////////////////////////////////////////////////////////////
+/////////////////////////////////////////////////////////////////////////////
+
+} // namespace Scumm
+
+} // namespace Browser
+
+#endif // _SCUMM_BLOCK_FACTORY_H_


Property changes on: scummex/branches/gsoc2007-gameresbrowser/src/plugins/scumm/ScummBlockFactory.h
___________________________________________________________________
Name: svn:mime-type
   + text/plain
Name: svn:eol-style
   + native

Modified: scummex/branches/gsoc2007-gameresbrowser/src/plugins/scumm/ScummBlockInfoPresenter.cpp
===================================================================
--- scummex/branches/gsoc2007-gameresbrowser/src/plugins/scumm/ScummBlockInfoPresenter.cpp	2007-07-12 15:39:17 UTC (rev 28043)
+++ scummex/branches/gsoc2007-gameresbrowser/src/plugins/scumm/ScummBlockInfoPresenter.cpp	2007-07-12 17:06:33 UTC (rev 28044)
@@ -3,6 +3,7 @@
 
 #include "scumm_stdafx.h"
 
+#include "scumm/ScummResource.h"
 #include "scumm/ScummBlockInfoPresenter.h"
 #include "scumm/ScummBlockPresenter.h"
 #include "scumm/descumm.h"

Modified: scummex/branches/gsoc2007-gameresbrowser/src/plugins/scumm/ScummBlockInfoPresenter.h
===================================================================
--- scummex/branches/gsoc2007-gameresbrowser/src/plugins/scumm/ScummBlockInfoPresenter.h	2007-07-12 15:39:17 UTC (rev 28043)
+++ scummex/branches/gsoc2007-gameresbrowser/src/plugins/scumm/ScummBlockInfoPresenter.h	2007-07-12 17:06:33 UTC (rev 28044)
@@ -9,7 +9,7 @@
 #include "GUIInterfaces.h"
 #include "basic/AuxInterfaces.h"
 
-#include "scumm/resource.h"
+#include "scumm/ScummBlock.h"
 
 namespace Browser {
 

Modified: scummex/branches/gsoc2007-gameresbrowser/src/plugins/scumm/ScummBlockPresenter.h
===================================================================
--- scummex/branches/gsoc2007-gameresbrowser/src/plugins/scumm/ScummBlockPresenter.h	2007-07-12 15:39:17 UTC (rev 28043)
+++ scummex/branches/gsoc2007-gameresbrowser/src/plugins/scumm/ScummBlockPresenter.h	2007-07-12 17:06:33 UTC (rev 28044)
@@ -6,7 +6,7 @@
 
 #include "CoreInterfaces.h"
 
-#include "scumm/resource.h"
+#include "scumm/ScummBlock.h"
 
 namespace Browser {
 

Modified: scummex/branches/gsoc2007-gameresbrowser/src/plugins/scumm/ScummParser.h
===================================================================
--- scummex/branches/gsoc2007-gameresbrowser/src/plugins/scumm/ScummParser.h	2007-07-12 15:39:17 UTC (rev 28043)
+++ scummex/branches/gsoc2007-gameresbrowser/src/plugins/scumm/ScummParser.h	2007-07-12 17:06:33 UTC (rev 28044)
@@ -8,7 +8,7 @@
 
 #include "ScummBlockPresenter.h"
 
-#include "scumm/resource.h"
+#include "scumm/ScummBlock.h"
 
 namespace Browser {
 

Modified: scummex/branches/gsoc2007-gameresbrowser/src/plugins/scumm/ScummRecognizer.cpp
===================================================================
--- scummex/branches/gsoc2007-gameresbrowser/src/plugins/scumm/ScummRecognizer.cpp	2007-07-12 15:39:17 UTC (rev 28043)
+++ scummex/branches/gsoc2007-gameresbrowser/src/plugins/scumm/ScummRecognizer.cpp	2007-07-12 17:06:33 UTC (rev 28044)
@@ -3,9 +3,10 @@
 
 #include "scumm_stdafx.h"
 
+#include "scumm/ScummResource.h"
 #include "scumm/ScummRecognizer.h"
 #include "scumm/scummutil.h"
-#include "scumm/resource.h"
+#include "scumm/ScummBlock.h"
 #include "scumm/ScummFileTypes.h"
 
 #include "streams/xorstream.h"
@@ -23,11 +24,20 @@
 /////////////////////////////////////////////////////////////////////////////
 /////////////////////////////////////////////////////////////////////////////
 
+// This file provides a recognizer for scumm file types.
+// It is mostly taken from ScummEx.
+// The recognizer returns newScummFileType() or oldScummFileType().
+
+// There is also a presenterReslover for scumm chunks.
+
 // Sample object chain:
 // old/newScummFileType -> ScummParser -> IDirectory -> IFile -> BlockyBlockPresenter
 
 /////////////////////////////////////////////////////////////////////////////
 /////////////////////////////////////////////////////////////////////////////
+// Taken from ScummEX: checks wheather the given file is a scumm file.
+// It returns the first found ScummTag and an outStream, that is a xorstream
+// with a proper encbyte set.
 
 bool ScummFileTypeRecognizer::scummRecognize(Common::SeekableReadStream* stream,
 							Common::SeekableReadStream*& outStream, ScummTag*& outTag) {
@@ -63,6 +73,7 @@
 
 /////////////////////////////////////////////////////////////////////////////
 /////////////////////////////////////////////////////////////////////////////
+// Recognize which scumm format is this.
 
 RecognizedFileType ScummFileTypeRecognizer::doRecognize(VirtualFile* file, IFile* ifile) {
 	Common::SeekableReadStream* stream = ifile->getStream();
@@ -88,16 +99,18 @@
 	delete outStream;
 	delete outTag;
 
-	//HACK: temporary - we want LECF to be recognized as newScummFileType(), other blocks not
-	/*if (tag != wxT("LECF")) {
-		return RecognizedFileType(IDEAL_MATCH, tagGUID);
-	}*/
-
 	return RecognizedFileType(IDEAL_MATCH, newScumm ? newScummFileType() : oldScummFileType());
 }
 
 /////////////////////////////////////////////////////////////////////////////
 /////////////////////////////////////////////////////////////////////////////
+// Parser resolver: returns a proper set of parsers for a given scumm chunk.
+//
+// The newScummFileType() and oldScummFileType() file types represent a dummy
+// ScummChunk which contains all ScummChunks in the file, so they are given
+// only a BlockyBlockPresenter.
+//
+// Other summ chunks get parsers from the ScummBlockFactory (plus some generic ones).
 
 ResolvedFileTypeParsers ScummFileTypeParserResolver::resolve(const BGUID& fileType) {
 

Added: scummex/branches/gsoc2007-gameresbrowser/src/plugins/scumm/ScummResource.cpp
===================================================================
--- scummex/branches/gsoc2007-gameresbrowser/src/plugins/scumm/ScummResource.cpp	                        (rev 0)
+++ scummex/branches/gsoc2007-gameresbrowser/src/plugins/scumm/ScummResource.cpp	2007-07-12 17:06:33 UTC (rev 28044)
@@ -0,0 +1,306 @@
+/* ScummEX - Viewer for Scumm data files
+* Copyright (C) 2003 Adrien Mercier
+* Copyright (C) 2003 The ScummVM project
+*
+* 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., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
+*
+* $URL: https://scummvm.svn.sourceforge.net/svnroot/scummvm/scummex/trunk/resource.cpp $
+* $Id: resource.cpp 20579 2006-02-11 20:07:58Z fingolfin $
+*
+*/
+
+/////////////////////////////////////////////////////////////////////////////
+// ScummResource.cpp
+
+//
+// This file is taken from original ScummEx, and modified
+//
+
+#include "scumm_stdafx.h"
+
+#include "scumm/ScummResource.h"
+
+#include "debugmem.h"
+
+namespace Browser {
+
+using namespace Core;
+
+namespace Scumm {
+
+/////////////////////////////////////////////////////////////////////////////
+/////////////////////////////////////////////////////////////////////////////
+
+byte egaPal[] = {
+	   0,   0,   0,
+	   0,   0, 168,
+	   0, 168,   0,
+	   0, 168, 168,
+	 168,   0,   0,
+	 168,   0, 168, 
+	 168,  84,   0,
+	 168, 168, 168,
+	  84,  84,  84,
+	  84,  84, 252,
+	  84, 252,  84,
+	  84, 252, 252,
+	 252,  84,  84,
+	 252,  84, 252,
+	 252, 252,  84,
+	 252, 252, 252,
+};
+
+/////////////////////////////////////////////////////////////////////////////
+/////////////////////////////////////////////////////////////////////////////
+
+const blockInfo* getBlockInfo(const ScummTag& tag) {
+	if (tag.isNewTag())
+		return getNewBlockInfo(static_cast<const FourTag&>(tag));
+	else
+		return getOldBlockInfo(static_cast<const TwoTag&>(tag));
+}
+
+const blockInfo* getNewBlockInfo(const FourTag& tag) {
+	
+	for (int i = 0; blocksInfo[i].name != 0; i++)
+		if (tag.equals(blocksInfo[i].name))
+			return &blocksInfo[i];
+
+	return NULL;
+}
+
+const blockInfo* getOldBlockInfo(const TwoTag& tag) {
+	
+	for (int i = 0; oldBlocksInfo[i].name != 0; i++)
+		if (tag.equals(oldBlocksInfo[i].name))
+			return &oldBlocksInfo[i];
+
+	return NULL;
+}
+
+/////////////////////////////////////////////////////////////////////////////
+/////////////////////////////////////////////////////////////////////////////
+
+const byte encBytesTable[] = {
+	0x00, 0x69, 0xFF
+};
+const int encBytesTableSize = 3;
+
+const struct blockInfo blocksInfo[] = {
+	{"RNAM", wxT("Room Names"), 1, wxT("help/specRNAM.html"), 47},
+	{"MAXS", wxT("Maximum Values"), 0, wxT(""), 2},
+	{"LB83", wxT("Lucasarts Bundle 8.3"), 1, wxT("help/specLB83.html"), 6},
+	{"LABN", wxT("Lucasarts Bundle New"), 1, wxT("help/specLABN.html"), 6},
+	{"LECF", wxT("LucasArts Entertainment Company Files"), 1, wxT("help/specLECF.html"), 6},
+	{"LOFF", wxT("Room Offset Table"), 1, wxT("help/specLOFF.html"), 44},
+	{"LFLF", wxT("LucasArts File Format"), 1, wxT("help/specLFLF.html"), 58},
+	{"ROOM", wxT("Room Container"), 1, wxT("help/specROOM.html"), 38},
+	{"RMHD", wxT("Room Header"), 0, wxT(""), 35},
+	{"CYCL", wxT("Color Cycle"), 0, wxT(""), 12},
+	{"TRNS", wxT("Transparency"), 1, wxT("help/specTRNS.html"), 46},
+	{"EPAL", wxT("EGA Palette"), 0, wxT(""), 34},
+	{"BOXD", wxT("Box Description"), 0, wxT(""), 4},
+	{"BOXM", wxT("Box Matrix"), 0, wxT(""), 5},
+	{"OBCD", wxT("Object Code"), 1, wxT("help/specOBCD.html"), 57},
+	{"OBNA", wxT("Object Name"), 1, wxT("help/specOBNA.html"), 45},
+	{"CDHD", wxT("Code Header"), 0, wxT(""), 7},
+	{"VERB", wxT("Verbs"), 0, wxT(""), 50},
+	{"DROO", wxT("Directory of Rooms"), 0, wxT(""), 18},
+	{"DSCR", wxT("Directory of Scripts"), 0, wxT(""), 19},
+	{"DSOU", wxT("Directory of Sounds"), 0, wxT(""), 20},
+	{"DCOS", wxT("Directory of Costumes"), 0, wxT(""), 14},
+	{"DCHR", wxT("Directory of Charsets"), 0, wxT(""), 13},
+	{"DOBJ", wxT("Directory of Objects"), 0, wxT(""), 17},
+	{"DIRC", wxT("Directory of Costumes"), 0, wxT(""), 47},
+	{"DIRF", wxT("Directory of Charsets"), 0, wxT(""), 47},
+	{"DIRI", wxT("Directory of Room Images"), 0, wxT(""), 47},
+	{"DIRN", wxT("Directory of Sounds"), 0, wxT(""), 47},
+	{"DIRM", wxT("Directory of Images"), 0, wxT(""), 47},
+	{"DIRR", wxT("Directory of Rooms"), 0, wxT(""), 47},
+	{"DIRS", wxT("Directory of Scripts"), 0, wxT(""), 47},
+	{"DIRT", wxT("Directory of Talkies"), 0, wxT(""), 47},
+	{"cus1", wxT("bundled file")},
+	{"cus2", wxT("iMUSE Cue"), 0, wxT(""), 59},
+	{"COMP", wxT("Compression Table"), 0, wxT(""), 9},
+	{"CLUT", wxT("Color Lookup Table"), 1, wxT("help/specCLUT.html"), 34},
+	{"PALS", wxT("Wrapper for Palettes"), 1, wxT("help/specPALS.html"), 56},
+	{"WRAP", wxT("Wrapper for Palettes/Images"), 1, wxT("help/specWRAP.html"), 60},
+	{"OFFS", wxT("Offsets"), 1, wxT("help/specOFFS.html"), 44},
+	{"APAL", wxT("Palette"), 1, wxT("help/specAPAL.html"), 34},
+	{"RMIM", wxT("Room Image"), 0, wxT(""), 37},
+	{"RMIH", wxT("Room Image Header"), 0, wxT(""), 36},
+	{"IM00", wxT("Image"), 0, wxT(""), 25},
+	{"IM01", wxT("Image"), 0, wxT(""), 25},
+	{"IM02", wxT("Image"), 0, wxT(""), 25},
+	{"IM03", wxT("Image"), 0, wxT(""), 25},
+	{"IM04", wxT("Image"), 0, wxT(""), 25},
+	{"IM05", wxT("Image"), 0, wxT(""), 25},
+	{"IM06", wxT("Image"), 0, wxT(""), 25},
+	{"IM07", wxT("Image"), 0, wxT(""), 25},
+	{"IM08", wxT("Image"), 0, wxT(""), 25},
+	{"IM09", wxT("Image"), 0, wxT(""), 25},
+	{"IM0A", wxT("Image"), 0, wxT(""), 25},
+	{"IM0B", wxT("Image"), 0, wxT(""), 25},
+	{"IM0C", wxT("Image"), 0, wxT(""), 25},
+	{"IM0D", wxT("Image"), 0, wxT(""), 25},
+	{"IM0E", wxT("Image"), 0, wxT(""), 25},
+	{"IM0F", wxT("Image"), 0, wxT(""), 25},
+	{"IM10", wxT("Image"), 0, wxT(""), 25},
+	{"ZP01", wxT(""), 0, wxT(""), 52},
+	{"ZP02", wxT(""), 0, wxT(""), 52},
+	{"ZP03", wxT(""), 0, wxT(""), 52},
+	{"ZP04", wxT(""), 0, wxT(""), 52},
+	{"ZPLN", wxT(""), 0, wxT(""), 52},
+	{"SMAP", wxT("Pixelmap"), 0, wxT(""), 42},
+	{"SCAL", wxT("Scaling"), 0, wxT(""), 40},
+	{"AARY", wxT("Array?"), 0, wxT(""), 47},
+	{"ANAM", wxT(""), 0, wxT(""), 47},
+	{"SOUN", wxT("Sound"), 0, wxT(""), 59},
+	{"SCRP", wxT("Script"), 0, wxT(""), 41},
+	{"EXCD", wxT("Exit Code"), 0, wxT(""), 22},
+	{"ENCD", wxT("Entry Code"), 0, wxT(""), 21},
+	{"NLSC", wxT("Number of Local Scripts"), 0, wxT(""), 41},
+	{"OBIM", wxT("Object Image"), 0, wxT(""), 33},
+	{"IMHD", wxT("Image Header"), 0, wxT(""), 26},
+	{"SOU ", wxT("Sound"), 0, wxT(""), 59},
+	{"VCTL", wxT(""), 0, wxT(""), 15},
+	{"Crea", wxT("Voc Sample"), 0, wxT(""), 16},
+	{"VTLK", wxT(""), 0, wxT(""), 15},
+	{"MCMP", wxT(""), 1, wxT("help/specMCMP.html"), 9},
+	{"iMUS", wxT("iMUSE Digital Sound"), 1, wxT("help/speciMUS.html"), 59},
+	{"MAP ", wxT("iMUSE Digital MAP of Sound Data"), 1, wxT("help/specMAP.html"), 29},
+	{"FRMT", wxT("iMUSE Digital Sound Data Format"), 1, wxT("help/specFRMT.html"), 51},
+	{"TEXT", wxT("iMUSE Digital Trigger Marker"), 1, wxT("help/specTEXT.html"), 45},
+	{"REGN", wxT("iMUSE Digital Data Region"), 1, wxT("help/specREGN.html"), 27},
+	{"JUMP", wxT("iMUSE Digital Jump To Region"), 1, wxT("help/specJUMP.html"), 27},
+	{"DATA", wxT("iMUSE Digital Sound Data"), 1, wxT("help/specDATA.html"), 16},
+	{"STOP", wxT("iMUSE Digital End of Sound Data"), 1, wxT("help/specSTOP.html"), 27},
+	{"SYNC", wxT("iMUSE Digital Lip Sync Data"), 1, wxT("help/specSYNC.html"), 43},
+	{"IMC", wxT(""), 1, wxT("help/specIMC.html"), 59},
+	{"LSCR", wxT("Local Script"), 0, wxT(""), 41},
+	{"COST", wxT(""), 0, wxT(""), 11},
+	{"CHAR", wxT(""), 0, wxT(""), 8},
+	{"BOMP", wxT(""), 0, wxT(""), 47},
+	{"IMAG", wxT(""), 0, wxT(""), 25},
+	{"AKOS", wxT("Animated Costume"), 0, wxT(""), 47},
+	{"RMSC", wxT(""), 1, wxT("help/specRMSC.html"), 57},
+	{"BSTR", wxT(""), 0, wxT(""), 42},
+	{"AKHD", wxT("AKOS Header"), 0, wxT(""), 47},
+	{"AKPL", wxT("AKOS Palette"), 0, wxT(""), 47},
+	{"RGBS", wxT(""), 0, wxT(""), 47},
+	{"AKOF", wxT("AKOS Offset"), 0, wxT(""), 47},
+	{"AKCI", wxT("AKOS Costume Info"), 0, wxT(""), 47},
+	{"AKCD", wxT(""), 0, wxT(""), 47},
+	{"AKSQ", wxT("AKOS Script"), 0, wxT(""), 50},
+	{"AKCH", wxT(""), 0, wxT(""), 47},
+	{"ANIM", wxT("SMUSH Animation"), 0, wxT(""), 55},
+	{"AHDR", wxT("SMUSH Animation Header"), 0, wxT(""), 1},
+	{"FRME", wxT("SMUSH Frame"), 0, wxT(""), 55},
+	{"FOBJ", wxT("SMUSH Frame Object"), 0, wxT(""), 32},
+	{"IACT", wxT("iMUSE Digital Smush Audio Track"), 0, wxT(""), 24},
+	{"NPAL", wxT("SMUSH New Palette"), 0, wxT(""), 34},
+	{"TRES", wxT("SMUSH Text Resource"), 0, wxT(""), 47},
+	{"PSAD", wxT("SMUSH Primary Audio"), 0, wxT(""), 24},
+	{"SAUD", wxT("SMUSH Audio"), 0, wxT(""), 24},
+	{"STRK", wxT("SMUSH Audio Track"), 0, wxT(""), 24},
+	{"SDAT", wxT("SMUSH Audio Data"), 0, wxT(""), 24},
+	{"XPAL", wxT("SMUSH Difference Palette"), 0, wxT(""), 34},
+	{"ADL ", wxT("Adlib MIDI Data"), 1, wxT("help/specADL.html"), 31},
+	{"SPK ", wxT("Speaker Sound Data"), 1, wxT("help/specSPK.html"), 31},
+	{"ROL ", wxT("Roland MIDI Data"), 1, wxT("help/specROL.html"), 31},
+	{"FTCH", wxT("SMUSH Fetch Frame"), 0, wxT(""), 47},
+	{"STOR", wxT("SMUSH Store Frame"), 0, wxT(""), 47},
+	{"MIDI", wxT("MIDI Data"), 0, wxT(""), 31},
+	{"GMD ", wxT("General MIDI Data"), 0, wxT(""), 31},
+	{"SBL ", wxT(""), 0, wxT(""), 31},
+	{"ZSTR", wxT(""), 0, wxT(""), 47},
+	{"AUhd", wxT(""), 0, wxT(""), 31},
+	{"WVhd", wxT(""), 0, wxT(""), 31},
+	{"AUdt", wxT(""), 0, wxT(""), 31},
+	{"WVdt", wxT(""), 0, wxT(""), 31},
+	{"TLKB", wxT("Talkie ?"), 0, wxT(""), 47},
+	{"TALK", wxT("Talkie Sounds"), 0, wxT(""), 47},
+	{"HSHD", wxT("Humongous Sound HeaDer"), 0, wxT(""), 47},
+	{"DLFL", wxT("Directory of LFLs"), 0, wxT(""), 47},
+	{"SONG", wxT(""), 0, wxT(""), 47},
+	{"SGHD", wxT("Song Header"), 0, wxT(""), 47},
+	{"SGEN", wxT("Song ?"), 0, wxT(""), 47},
+	{"DIGI", wxT("Digital Sound"), 0, wxT(""), 47},
+	{"WSOU", wxT("Digital Sound"), 0, wxT(""), 47},
+	{"RMDA", wxT("Room Data"), 0, wxT(""), 38},
+	{"BMAP", wxT("Bitmap Image"), 0, wxT(""), 47},
+	{"WIZH", wxT(""), 0, wxT(""), 47},
+	{"AWIZ", wxT(""), 0, wxT(""), 47},
+	{"WIZD", wxT(""), 0, wxT(""), 47},
+	{"SPOT", wxT(""), 0, wxT(""), 47},
+	{"CNVS", wxT(""), 0, wxT(""), 47},
+	{"POLD", wxT(""), 0, wxT(""), 47},
+	{"LSC2", wxT("Local Script"), 0, wxT(""), 47},
+	{"FMUS", wxT("Music header?"), 0, wxT(""), 47},
+	{"SKIP", wxT("SMUSH Skip Frame"), 0, wxT(""), 47},
+	{"IaCt", wxT("INSANE Action"), 0, wxT(""), 24}, // small letters are intentional
+	{"REMP", wxT("Actor Palette?"), 0, wxT(""), 34},
+	{"SANM", wxT("SMUSH v2 file"), 0, wxT(""), 55},
+	{"Wave", wxT("SMUSH v2 VIMA audio codec"), 0, wxT(""), 55},
+	{"Bl16", wxT("SMUSH v2 Blocky16 video codec"), 0, wxT(""), 55},
+	{"FLHD", wxT("SMUSH v2 Frame Header"), 0, wxT(""), 55},
+	{"ANNO", wxT("SMUSH v2 Annotations"), 0, wxT(""), 55},
+	{"ZFOB", wxT("SMUSH Zlib Compressed Frame Object"), 0, wxT(""), 32},
+	{"SMRK", wxT("SMUSH Audio Marker"), 0, wxT(""), 24},
+	{"SHDR", wxT("SMUSH Audio Header/SMUSH v2 Header"), 0, wxT(""), 24},
+	{"ETRS", wxT("SMUSH External Text Resource"), 0, wxT(""), 24},
+	{0, 0, 0, 0, 0}
+};
+
+const struct blockInfo oldBlocksInfo[] = {
+	{"0R", wxT("Directory of Rooms"), 0, wxT(""), 18},
+	{"0S", wxT("Directory of Scripts"), 0, wxT(""), 19},
+	{"0N", wxT("Directory of Sounds"), 0, wxT(""), 47},
+	{"0C", wxT("Directory of Costumes"), 0, wxT(""), 14},
+	{"0O", wxT("Directory of Objects"), 0, wxT(""), 17},
+	{"RO", wxT("Room Container"), 0, wxT(""), 38},
+	{"HD", wxT("Room Header"), 0, wxT(""), 35},
+	{"BX", wxT("Box Description"), 0, wxT(""), 4},
+	{"PA", wxT("Color Lookup Table"), 0, wxT(""), 34},
+	{"BM", wxT("Image"), 0, wxT(""), 37},
+	{"OI", wxT("Object Image"), 0, wxT(""), 33},
+	{"OC", wxT("Object Code"), 0, wxT(""), 41},
+	{"NL", wxT(""), 0, wxT(""), 41},
+	{"SL", wxT(""), 0, wxT(""), 47},
+	{"EX", wxT("Exit Code"), 0, wxT(""), 22},
+	{"EN", wxT("Entry Code"), 0, wxT(""), 21},
+	{"LC", wxT("Number of Local Scripts"), 0, wxT(""), 47},
+	{"LS", wxT("Local Script"), 0, wxT(""), 41},
+	{"SC", wxT("Script"), 0, wxT(""), 41},
+	{"CO", wxT(""), 0, wxT(""), 11},
+	{"LE", wxT("LucasArts Entertainment Company Files"), 0, wxT(""), 6},
+	{"FO", wxT(""), 0, wxT(""), 44},
+	{"LF", wxT("LucasArts File Format"), 0, wxT(""), 58},
+	{"CC", wxT("Color Cycle"), 0, wxT(""), 12},
+	{"SP", wxT("EGA Palette"), 0, wxT(""), 47},
+	{"SA", wxT("Scaling"), 0, wxT(""), 40},
+	{"SO", wxT("Sound"), 0, wxT(""), 59},
+	{"RN", wxT("Room Names"), 0, wxT(""), 47},
+	{"WA", wxT(""), 0, wxT(""), 31},
+	{"AD", wxT(""), 0, wxT(""), 31},
+	{0, 0, 0, 0, 0}
+};
+
+/////////////////////////////////////////////////////////////////////////////
+/////////////////////////////////////////////////////////////////////////////
+
+} // namespace Scumm
+
+} // namespace Browser


Property changes on: scummex/branches/gsoc2007-gameresbrowser/src/plugins/scumm/ScummResource.cpp
___________________________________________________________________
Name: svn:mime-type
   + text/plain
Name: svn:eol-style
   + native

Added: scummex/branches/gsoc2007-gameresbrowser/src/plugins/scumm/ScummResource.h
===================================================================
--- scummex/branches/gsoc2007-gameresbrowser/src/plugins/scumm/ScummResource.h	                        (rev 0)
+++ scummex/branches/gsoc2007-gameresbrowser/src/plugins/scumm/ScummResource.h	2007-07-12 17:06:33 UTC (rev 28044)
@@ -0,0 +1,70 @@
+/* ScummEX - Viewer for Scumm data files
+* Copyright (C) 2003 Adrien Mercier
+* Copyright (C) 2003 The ScummVM project
+*
+* 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., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
+*
+* $URL: https://scummvm.svn.sourceforge.net/svnroot/scummvm/scummex/trunk/resource.cpp $
+* $Id: resource.cpp 20579 2006-02-11 20:07:58Z fingolfin $
+*
+*/
+
+/////////////////////////////////////////////////////////////////////////////
+// ScummResource.h
+
+//
+// This file is taken from original ScummEx, and modified
+//
+
+#ifndef _SCUMM_RESOURCE_H_
+#define _SCUMM_RESOURCE_H_
+
+#include "scumm/ScummTag.h"
+
+namespace Browser {
+
+using namespace Core;
+
+namespace Scumm {
+
+/////////////////////////////////////////////////////////////////////////////
+/////////////////////////////////////////////////////////////////////////////
+
+struct blockInfo {
+	const char* name;
+	const wxChar* description;
+	int html;
+	const wxChar* htmlfile;
+	int iconid;
+};
+
+extern byte egaPal[];
+extern const byte encBytesTable[];
+extern const int encBytesTableSize;
+extern const struct blockInfo blocksInfo[];
+extern const struct blockInfo oldBlocksInfo[];
+
+const blockInfo* getBlockInfo(const ScummTag& tag);
+const blockInfo* getNewBlockInfo(const FourTag& tag);
+const blockInfo* getOldBlockInfo(const TwoTag& tag);
+
+/////////////////////////////////////////////////////////////////////////////
+/////////////////////////////////////////////////////////////////////////////
+
+} // namespace Scumm
+
+} // namespace Browser
+
+#endif // _SCUMM_RESOURCE_H_


Property changes on: scummex/branches/gsoc2007-gameresbrowser/src/plugins/scumm/ScummResource.h
___________________________________________________________________
Name: svn:mime-type
   + text/plain
Name: svn:eol-style
   + native

Added: scummex/branches/gsoc2007-gameresbrowser/src/plugins/scumm/ScummTag.cpp
===================================================================
--- scummex/branches/gsoc2007-gameresbrowser/src/plugins/scumm/ScummTag.cpp	                        (rev 0)
+++ scummex/branches/gsoc2007-gameresbrowser/src/plugins/scumm/ScummTag.cpp	2007-07-12 17:06:33 UTC (rev 28044)
@@ -0,0 +1,152 @@
+/////////////////////////////////////////////////////////////////////////////
+// ScummTag.cpp
+
+#include "scumm_stdafx.h"
+
+#include "guid.h"
+
+#include "scumm/ScummBlock.h"
+#include "scumm/ScummFileTypes.h"
+#include "CoreFileTypes.h"
+
+#include <list>
+#include <algorithm>
+
+#include "safe_static.h"
+
+#include "debugmem.h"
+
+namespace Browser {
+
+using namespace Core;
+
+namespace Scumm {
+
+/////////////////////////////////////////////////////////////////////////////
+/////////////////////////////////////////////////////////////////////////////
+
+/*static*/ BGUID ScummTag::getFileTypeGUID(const char* tag) {
+	ASSERT(tag && tag[0] && tag[1]);
+	if (!tag[2])
+		return BGUID(wxT("OldScummBlock"), Browser::toString(tag), 1);
+	ASSERT(tag[2] && tag[3] && !tag[4]);
+	return BGUID(wxT("NewScummBlock"), Browser::toString(tag), 1);
+}
+
+bool operator==(const ScummTag& tag0, const ScummTag& tag1) {
+	return tag0.equals(tag1);
+}
+
+/////////////////////////////////////////////////////////////////////////////
+/////////////////////////////////////////////////////////////////////////////
+
+TwoTag::TwoTag() {}
+TwoTag::TwoTag(byte one, byte two)
+	: _one(one), _two(two) {}
+TwoTag::TwoTag(const char* chars)
+	: _one((byte)chars[0]), _two((byte)chars[1]) {}
+
+/*static*/ TwoTag create(const char* chars) {
+	return TwoTag(chars);
+}
+
+bool TwoTag::read(Common::ReadStream* stream) {
+	_one = stream->readByte();
+	if (stream->ioFailed()) return false;
+	_two = stream->readByte();
+	if (stream->ioFailed()) return false;
+	return true;
+}
+
+bool TwoTag::isNewTag() const {
+	return false;
+}
+
+bool TwoTag::equals(const ScummTag& other) const {
+	if (typeid(*this) != typeid(other))
+		return false;
+	const TwoTag& oth = static_cast<const TwoTag&>(other);
+	return (_one == oth._one) && (_two == oth._two);
+}
+
+bool TwoTag::equals(const char* chars) const {
+	return (_one == (byte)chars[0]) && (_two == (byte)chars[1]);
+}
+
+wxString TwoTag::toString() const {
+	char chars[3];
+	chars[0] = (char)_one;
+	chars[1] = (char)_two;
+	chars[2] = '\0';
+	return Browser::toString(chars);
+}
+
+BGUID TwoTag::getFileTypeGUID() {
+	return BGUID(wxT("OldScummBlock"), toString(), 1);
+}
+
+/////////////////////////////////////////////////////////////////////////////
+/////////////////////////////////////////////////////////////////////////////
+
+FourTag::FourTag() {}
+FourTag::FourTag(byte one, byte two, byte three, byte four)
+	: _one(one), _two(two), _three(three), _four(four) {}
+FourTag::FourTag(const char* chars)
+	: _one((byte)chars[0]), _two((byte)chars[1]),
+	_three((byte)chars[2]), _four((byte)chars[3]) {}
+
+/*static*/ FourTag FourTag::create(const char* chars) {
+	return FourTag(chars);
+}
+
+bool FourTag::read(Common::ReadStream* stream) {
+	_one = stream->readByte();
+	if (stream->ioFailed()) return false;
+	_two = stream->readByte();
+	if (stream->ioFailed()) return false;
+	_three = stream->readByte();
+	if (stream->ioFailed()) return false;
+	_four = stream->readByte();
+	if (stream->ioFailed()) return false;
+	return true;
+}
+
+bool FourTag::isNewTag() const {
+	return true;
+}
+
+bool FourTag::equals(const ScummTag& other) const {
+	if (typeid(*this) != typeid(other))
+		return false;
+	const FourTag& oth = static_cast<const FourTag&>(other);
+	return (_one == oth._one) && (_two == oth._two) &&
+		   (_three == oth._three) && (_four == oth._four);
+}
+
+bool FourTag::equals(const char* chars) const {
+	return (_one == (byte)chars[0]) && 
+		   (_two == (byte)chars[1]) &&
+		   (_three == (byte)chars[2]) &&
+		   (_four == (byte)chars[3]);
+}
+
+wxString FourTag::toString() const {
+	char chars[5];
+	chars[0] = (char)_one;
+	chars[1] = (char)_two;
+	chars[2] = (char)_three;
+	chars[3] = (char)_four;
+	chars[4] = '\0';
+	return Browser::toString(chars);
+}
+
+BGUID FourTag::getFileTypeGUID() {
+	return BGUID(wxT("NewScummBlock"), toString(), 1);
+}
+
+/////////////////////////////////////////////////////////////////////////////
+/////////////////////////////////////////////////////////////////////////////
+
+} // namespace Scumm
+
+} // namespace Browser


Property changes on: scummex/branches/gsoc2007-gameresbrowser/src/plugins/scumm/ScummTag.cpp
___________________________________________________________________
Name: svn:mime-type
   + text/plain
Name: svn:eol-style
   + native

Added: scummex/branches/gsoc2007-gameresbrowser/src/plugins/scumm/ScummTag.h
===================================================================
--- scummex/branches/gsoc2007-gameresbrowser/src/plugins/scumm/ScummTag.h	                        (rev 0)
+++ scummex/branches/gsoc2007-gameresbrowser/src/plugins/scumm/ScummTag.h	2007-07-12 17:06:33 UTC (rev 28044)
@@ -0,0 +1,76 @@
+/////////////////////////////////////////////////////////////////////////////
+// ScummTag.h
+
+#ifndef _SCUMM_TAG_H_
+#define _SCUMM_TAG_H_
+
+#include "streams/stream.h"
+
+namespace Browser {
+
+using namespace Core;
+
+namespace Scumm {
+
+/////////////////////////////////////////////////////////////////////////////
+/////////////////////////////////////////////////////////////////////////////
+
+struct ScummTag {
+	virtual bool isNewTag() const = 0;
+	virtual bool read(Common::ReadStream* stream) = 0;
+	virtual bool equals(const ScummTag& other) const = 0;
+	virtual bool equals(const char* chars) const = 0;
+	virtual wxString toString() const = 0;
+	virtual BGUID getFileTypeGUID() = 0;
+
+	static BGUID getFileTypeGUID(const char* tag);
+};
+
+bool operator==(const ScummTag& tag0, const ScummTag& tag1);
+
+struct TwoTag : ScummTag {
+	byte _one;
+	byte _two;
+
+	TwoTag();
+	TwoTag(byte one, byte two);
+	TwoTag(const char* chars);
+
+	static TwoTag create(const char* chars);
+
+	virtual bool isNewTag() const;
+	virtual bool read(Common::ReadStream* stream);
+	virtual bool equals(const ScummTag& other) const;
+	virtual bool equals(const char* chars) const;
+	virtual wxString toString() const;
+	virtual BGUID getFileTypeGUID();
+};
+
+struct FourTag : ScummTag {
+	byte _one;
+	byte _two;
+	byte _three;
+	byte _four;
+
+	FourTag();
+	FourTag(byte one, byte two, byte three, byte four);
+	FourTag(const char* chars);
+
+	static FourTag create(const char* chars);
+
+	virtual bool isNewTag() const;
+	virtual bool read(Common::ReadStream* stream);
+	virtual bool equals(const ScummTag& other) const;
+	virtual bool equals(const char* chars) const;
+	virtual wxString toString() const;
+	virtual BGUID getFileTypeGUID();
+};
+
+/////////////////////////////////////////////////////////////////////////////
+/////////////////////////////////////////////////////////////////////////////
+
+} // namespace Scumm
+
+} // namespace Browser
+
+#endif // _SCUMM_TAG_H_


Property changes on: scummex/branches/gsoc2007-gameresbrowser/src/plugins/scumm/ScummTag.h
___________________________________________________________________
Name: svn:mime-type
   + text/plain
Name: svn:eol-style
   + native

Deleted: scummex/branches/gsoc2007-gameresbrowser/src/plugins/scumm/resource.cpp
===================================================================
--- scummex/branches/gsoc2007-gameresbrowser/src/plugins/scumm/resource.cpp	2007-07-12 15:39:17 UTC (rev 28043)
+++ scummex/branches/gsoc2007-gameresbrowser/src/plugins/scumm/resource.cpp	2007-07-12 17:06:33 UTC (rev 28044)
@@ -1,1223 +0,0 @@
-/* ScummEX - Viewer for Scumm data files
-* Copyright (C) 2003 Adrien Mercier
-* Copyright (C) 2003 The ScummVM project
-*
-* 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., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
-*
-* $URL: https://scummvm.svn.sourceforge.net/svnroot/scummvm/scummex/trunk/resource.cpp $
-* $Id: resource.cpp 20579 2006-02-11 20:07:58Z fingolfin $
-*
-*/
-
-/////////////////////////////////////////////////////////////////////////////
-// resource.cpp
-
-//
-// This file is taken from original ScummEx, and modified
-//
-
-#include "scumm_stdafx.h"
-
-#include "guid.h"
-
-#include "scumm/resource.h"
-#include "scumm/ScummFileTypes.h"
-#include "CoreFileTypes.h"
-
-#include <list>
-#include <algorithm>
-
-#include "safe_static.h"
-
-#include "debugmem.h"
-
-namespace Browser {
-
-using namespace Core;
-
-namespace Scumm {
-
-/////////////////////////////////////////////////////////////////////////////
-/////////////////////////////////////////////////////////////////////////////
-
-/*static*/ BGUID ScummTag::getFileTypeGUID(const char* tag) {
-	ASSERT(tag && tag[0] && tag[1]);
-	if (!tag[2])
-		return BGUID(wxT("OldScummBlock"), Browser::toString(tag), 1);
-	ASSERT(tag[2] && tag[3] && !tag[4]);
-	return BGUID(wxT("NewScummBlock"), Browser::toString(tag), 1);
-}
-
-bool operator==(const ScummTag& tag0, const ScummTag& tag1) {
-	return tag0.equals(tag1);
-}
-
-/////////////////////////////////////////////////////////////////////////////
-/////////////////////////////////////////////////////////////////////////////
-
-TwoTag::TwoTag() {}
-TwoTag::TwoTag(byte one, byte two)
-	: _one(one), _two(two) {}
-TwoTag::TwoTag(const char* chars)
-	: _one((byte)chars[0]), _two((byte)chars[1]) {}
-
-/*static*/ TwoTag create(const char* chars) {
-	return TwoTag(chars);
-}
-
-bool TwoTag::read(Common::ReadStream* stream) {
-	_one = stream->readByte();
-	if (stream->ioFailed()) return false;
-	_two = stream->readByte();
-	if (stream->ioFailed()) return false;
-	return true;
-}
-
-bool TwoTag::isNewTag() const {
-	return false;
-}
-
-bool TwoTag::equals(const ScummTag& other) const {
-	if (typeid(*this) != typeid(other))
-		return false;
-	const TwoTag& oth = static_cast<const TwoTag&>(other);
-	return (_one == oth._one) && (_two == oth._two);
-}
-
-bool TwoTag::equals(const char* chars) const {
-	return (_one == (byte)chars[0]) && (_two == (byte)chars[1]);
-}
-
-wxString TwoTag::toString() const {
-	char chars[3];
-	chars[0] = (char)_one;
-	chars[1] = (char)_two;
-	chars[2] = '\0';
-	return Browser::toString(chars);
-}
-
-BGUID TwoTag::getFileTypeGUID() {
-	return BGUID(wxT("OldScummBlock"), toString(), 1);
-}
-
-/////////////////////////////////////////////////////////////////////////////
-/////////////////////////////////////////////////////////////////////////////
-
-FourTag::FourTag() {}
-FourTag::FourTag(byte one, byte two, byte three, byte four)
-	: _one(one), _two(two), _three(three), _four(four) {}
-FourTag::FourTag(const char* chars)
-	: _one((byte)chars[0]), _two((byte)chars[1]),
-	_three((byte)chars[2]), _four((byte)chars[3]) {}
-
-/*static*/ FourTag FourTag::create(const char* chars) {
-	return FourTag(chars);
-}
-
-bool FourTag::read(Common::ReadStream* stream) {
-	_one = stream->readByte();
-	if (stream->ioFailed()) return false;
-	_two = stream->readByte();
-	if (stream->ioFailed()) return false;
-	_three = stream->readByte();
-	if (stream->ioFailed()) return false;
-	_four = stream->readByte();
-	if (stream->ioFailed()) return false;
-	return true;
-}
-
-bool FourTag::isNewTag() const {
-	return true;
-}
-
-bool FourTag::equals(const ScummTag& other) const {
-	if (typeid(*this) != typeid(other))
-		return false;
-	const FourTag& oth = static_cast<const FourTag&>(other);
-	return (_one == oth._one) && (_two == oth._two) &&
-		   (_three == oth._three) && (_four == oth._four);
-}
-
-bool FourTag::equals(const char* chars) const {
-	return (_one == (byte)chars[0]) && 
-		   (_two == (byte)chars[1]) &&
-		   (_three == (byte)chars[2]) &&
-		   (_four == (byte)chars[3]);
-}
-
-wxString FourTag::toString() const {
-	char chars[5];
-	chars[0] = (char)_one;
-	chars[1] = (char)_two;
-	chars[2] = (char)_three;
-	chars[3] = (char)_four;
-	chars[4] = '\0';
-	return Browser::toString(chars);
-}
-
-BGUID FourTag::getFileTypeGUID() {
-	return BGUID(wxT("NewScummBlock"), toString(), 1);
-}
-
-/////////////////////////////////////////////////////////////////////////////
-/////////////////////////////////////////////////////////////////////////////
-
-ScummBlock::ScummBlock(ScummTag* tag, uint32 size, Common::SeekableReadStream* stream)
-	: _tag(tag), _sizeMode(INVALID_SIZE_MODE),
-	  _ownStream(true), _mineStream(stream),
-	  _parsed(false), _size(size), _dsize(-1), _data(NULL),
-	  _readData(false), _parseSubBlocks(false),
-	  _parent(NULL), _rootScummBlock(NULL), _myId(), _rootOffs(-1),
-	  _level(0), _isStopper(false) {}
-
-ScummBlock::~ScummBlock() {
-	if(_tag)
-		delete _tag;
-	scumm_blocks::iterator i;
-	for (i = _subblocks.begin(); i != _subblocks.end(); ++i)
-		delete *i;
-	if (_ownStream)
-		delete _mineStream;
-	if (_data)
-		delete [] _data;
-}
-
-ScummTag* ScummBlock::getTag() {
-	return _tag;
-}
-
-const ScummBlock::scumm_blocks& ScummBlock::getSubBlocks() {
-	return _subblocks;
-}
-
-Common::SeekableReadStream* ScummBlock::getStream() {
-	return _mineStream;
-}
-
-RecognizedFileType ScummBlock::getFileType() {
-	return RecognizedFileType(IDEAL_MATCH, _tag->getFileTypeGUID());
-}
-
-ScummBlock* ScummBlock::getParent() {
-	return _parent;
-}
-
-ScummBlock* ScummBlock::getNext() {
-	parse();
-	scumm_blocks::iterator i = _myId;
-	++i;
-	if (i == rootBlocks().end())
-		return NULL;
-
-	if ((*i)->_isStopper)
-		return NULL;
-
-	return *i;
-}
-
-ScummBlock* ScummBlock::getPrev() {
-	scumm_blocks::iterator i = _myId;
-	if (i == rootBlocks().begin())
-		return NULL;
-
-	ScummBlock* prev = *(--i);
-	if (prev->_isStopper)
-		return NULL;
-	if (prev->_parsed)
-		return prev;
-	prev->parse();
-	return getPrev();
-}
-
-ScummBlock* ScummBlock::findBlock(const char* tag, int dir) {
-	ScummBlock* prev = this;
-	while (true) {
-		prev = (dir == -1) ? prev->getPrev() : prev->getNext();
-		if (!prev)
-			return NULL;
-		if (prev->getTag()->equals(tag))
-			return prev;
-	}
-	return NULL;
-}
-
-ScummBlock* ScummBlock::findChild(const char* tag) {
-	ScummBlock* prev = this;
-	while (true) {
-		prev = prev->getNext();
-		if (!prev || (prev->_level <= this->_level))
-			return NULL;
-		if (prev->getTag()->equals(tag))
-			return prev;
-	}
-	return NULL;
-}
-
-bool ScummBlock::parse() {
-	if(_parsed)
-		return true;
-	_parsed = true;
-
-	ASSERT(_mineStream);
-	_mineStream->seek(0, SEEK_SET);
-
-	if (!readHeader())
-		return false;
-
-	if (!determineSizeMode())
-		return false;
-
-	if (!determineDataSize())
-		return false;
-
-	if (_readData && !readData())
-		return false;
-
-	if (_parseSubBlocks && !parseSubBlocks())
-		return false;
-
-	return true;
-}
-
-/////////////////////////////////////////////////////////////////////////////
-/////////////////////////////////////////////////////////////////////////////
-//protected:
-
-ScummBlock* ScummBlock::newBlock(ScummTag* tag, uint32 size, Common::SeekableReadStream* stream) {
-	return ScummBlockFactory::create(tag, size, stream);
-}
-
-bool ScummBlock::readHeader(ScummTag*& outTag, uint32& outSize) {
-	if (_tag->isNewTag()) {
-		outTag = new FourTag();
-		if (!outTag->read(_mineStream)) {
-			delete outTag;
-			return false;
-		}
-
-		outSize = _mineStream->readUint32BE();
-		if (_mineStream->ioFailed()) {
-			delete outTag;
-			return false;
-		}
-	} else {
-		outSize = _mineStream->readUint32LE();
-		if (_mineStream->ioFailed()) return false;
-
-		outTag = new TwoTag();
-		if (!outTag->read(_mineStream)) {
-			delete outTag;
-			return false;
-		}
-	}
-	return true;
-}
-
-bool ScummBlock::determineHeaderSize(uint32& outSize) {
-	outSize = (_tag->isNewTag() ? 8 : 6);
-	return true;
-}
-
-bool ScummBlock::readHeader() {
-	ScummTag* outTag;
-	uint32 outSize;
-	if (!readHeader(outTag, outSize))
-		return false;
-	ASSERT( _size == -1 || _size == outSize );
-	_size = outSize;
-	ASSERT( _tag->equals(*outTag) );
-	delete outTag;
-	return true;
-}
-
-bool ScummBlock::determineSizeMode() {
-	if (_sizeMode != INVALID_SIZE_MODE)
-		return true;
-	//_sizeMode = (_tag->isNewTag() ? TILL_END : HEADER_INCLUDED);
-	_sizeMode = HEADER_INCLUDED; //a reasonable default
-	return true;
-}
-
-bool ScummBlock::determineDataSize() {
-	uint32 outSize;
-	if (!determineDataSize(outSize))
-		return false;
-	_dsize = outSize;
-	return true;
-}
-
-bool ScummBlock::determineDataSize(uint32& outSize) {
-	if (_dsize != -1) {
-		outSize = _dsize;
-		return true;
-	}
-
-	uint32 hsize;
-	if (!determineHeaderSize(hsize))
-		return false;
-	if (!determineSizeMode())
-		return false;
-
-	switch (_sizeMode) {
-		case HEADER_INCLUDED:
-			outSize = _size - hsize;
-			return true;
-
-		case HEADER_NOT_INCLUDED:
-			outSize = _size;
-			return true;
-
-		case HEADER_NOT_INCLUDED_MINUS_ONE:
-			outSize = _size + 1;
-			return true;
-
-		case TILL_END:
-			{
-			uint32 ssize = _mineStream->size();
-			if (_mineStream->ioFailed()) return false;
-
-			outSize = ssize - hsize;
-			}
-			return true;
-
-		case ENTRY_BASED:
-		default:
-			break;
-	}
-
-	ASSERT(false);
-	return false;
-}
-
-bool ScummBlock::readData() {
-	return doReadData();
-}
-
-bool ScummBlock::parseSubBlocks() {
-	return doParseSubBlocks();
-}
-
-//utility function
-bool ScummBlock::doReadData() {
-	ASSERT(_dsize >= 0);
-	ASSERT( !_data );
-	_data = new byte[_dsize];
-	uint32 read = _mineStream->read(_data, _dsize);
-	if (_mineStream->ioFailed() || read != _dsize) {
-		delete [] _data;
-		_data = NULL;
-		return false;
-	}
-	return true;
-}
-
-ScummBlock::scumm_blocks& ScummBlock::rootBlocks() {
-	ASSERT(_rootScummBlock);
-	return _rootScummBlock->rootBlocks();
-}
-
-//utility function
-bool ScummBlock::doParseSubBlocks() {
-	scumm_id cur_id = _myId;
-	cur_id++;
-	while (true) {
-		uint32 pos = _mineStream->pos();
-		if (_mineStream->ioFailed())
-			return false;
-
-		if (_mineStream->eos())
-			break;
-		if (_mineStream->ioFailed())
-			return false;
-
-		ScummTag* outTag;
-		uint32 outSize;
-		if (!readHeader(outTag, outSize))
-			return false;
-
-		uint32 end = _mineStream->size();
-		if (_mineStream->ioFailed()) {
-			delete outTag;
-			return false;
-		}
-
-		Common::SeekableSubReadStream* kidstream = 
-			new Common::SeekableSubReadStream(_mineStream, pos, end, false);
-
-		ScummBlock* kidblock = newBlock(outTag, outSize, kidstream);
-		cur_id = rootBlocks().insert(cur_id, kidblock);
-		kidblock->_myId = cur_id;
-		cur_id++;
-		kidblock->_rootOffs = _rootOffs + pos;
-		kidblock->_rootScummBlock = _rootScummBlock;
-		kidblock->_parent = this;
-		kidblock->_level = _level + 1;
-
-		if (!kidblock->determineDataSize()) {
-			rootBlocks().erase(kidblock->_myId);
-			delete kidblock;
-			return false;
-		}
-		uint32 kidSize = kidblock->_dsize;
-
-		uint32 hsize;
-		if (!kidblock->determineHeaderSize(hsize)) {
-			rootBlocks().erase(kidblock->_myId);
-			delete kidblock;
-			return false;
-		}
-
-		kidSize += hsize;
-		if (kidSize != end - pos) {
-			delete kidstream;
-			kidstream = 
-				new Common::SeekableSubReadStream(_mineStream, pos, pos + kidSize, false);
-			kidblock->_mineStream = kidstream;
-		}
-
-		_subblocks.push_back(kidblock);
-		_mineStream->seek(pos + kidSize);
-		if (_mineStream->ioFailed())
-			return false;
-	}
-
-	return true;
-}
-
-/////////////////////////////////////////////////////////////////////////////
-/////////////////////////////////////////////////////////////////////////////
-
-//a ScummBlock that has only a block tag + some data
-class RawScummBlock : public ScummBlock {
-public:
-	RawScummBlock(ScummTag* tag, uint32 size, Common::SeekableReadStream* stream)
-		: ScummBlock(tag, size, stream) {}
-
-	virtual bool parse() {
-		_parsed = true;
-		ASSERT(_sizeMode == TILL_END);
-		ASSERT(!_readData);
-		ASSERT(!_parseSubBlocks);
-		return true;
-	}
-
-protected:
-
-	virtual bool readHeader() {
-		ASSERT(false); //we don't have a standard header
-		return false;
-	}
-
-	virtual bool determineHeaderSize(uint32& outSize) {
-		outSize = (_tag->isNewTag() ? 4 : 2);
-		return true;
-	}
-};
-
-/////////////////////////////////////////////////////////////////////////////
-/////////////////////////////////////////////////////////////////////////////
-
-//a ScummBlock that represents a root of a Scumm file - not a real block
-class RootScummBlock : public ScummBlock {
-	scumm_blocks _rootBlocks;
-public:
-	RootScummBlock(ScummTag* tag, uint32 size, Common::SeekableReadStream* stream)
-		: ScummBlock(tag, size, stream) {
-			_rootBlocks.push_back(this);
-			_myId = _rootBlocks.begin();
-			_rootScummBlock = this;
-			_rootOffs = 0;
-	}
-
-	virtual scumm_blocks& rootBlocks() {
-		return _rootBlocks;
-	}
-	virtual bool parse() {
-		ASSERT(_sizeMode == TILL_END);
-		ASSERT(!_readData);
-		ASSERT(_parseSubBlocks);
-		return ScummBlock::parse();
-	}
-
-protected:
-
-	virtual bool readHeader() {
-		uint32 outSize = _mineStream->size();
-		ASSERT( _size == -1 || _size == outSize );
-		_size = outSize;
-		ASSERT( (_tag->isNewTag() && _tag->toString() == wxT("****")) ||
-				(!_tag->isNewTag() && _tag->toString() == wxT("**")) );
-		return true;
-	}
-
-	virtual bool determineHeaderSize(uint32& outSize) {
-		outSize = 0;
-		return true;
-	}
-};
-
-/////////////////////////////////////////////////////////////////////////////
-/////////////////////////////////////////////////////////////////////////////
-
-class ScummRMHDBlock : public ScummWidthHeightBlock {
-	uint32 _objs;
-public:
-	ScummRMHDBlock(ScummTag* tag, uint32 size, Common::SeekableReadStream* stream)
-		: ScummWidthHeightBlock(tag, size, stream) {}
-
-	virtual uint32 getNumObjs() {
-		parse();
-		return _objs;
-	}
-
-	virtual bool readData() {
-		Common::SeekableReadStream& _input = *_mineStream;
-		_width = _input.readUint16LE();
-		_height = _input.readUint16LE();
-		_objs = _input.readUint16LE();
-		return true;
-	}
-};
-
-/////////////////////////////////////////////////////////////////////////////
-/////////////////////////////////////////////////////////////////////////////
-
-class ScummIMHDBlock : public ScummWidthHeightBlock {
-	uint32 _numFiles;
-public:
-	ScummIMHDBlock(ScummTag* tag, uint32 size, Common::SeekableReadStream* stream)
-		: ScummWidthHeightBlock(tag, size, stream) {}
-
-	virtual uint32 getNumFiles() {
-		parse();
-		return _numFiles;
-	}
-
-	virtual bool readData() {
-		Common::SeekableReadStream& _input = *_mineStream;
-
-		uint32 mark = _input.readUint32LE();
-
-		if (mark == 730) {
-			_input.readUint16LE();
-			_numFiles = _input.readUint16LE(); // Number of images
-			_input.readUint16LE(); // X Position
-			_input.readUint16LE(); // Y Position
-			_width = _input.readUint16LE();
-			_height = _input.readUint16LE();
-		} else {
-			bool read = false;
-
-			ScummBlock* im00 = this->getNext();
-			ScummBlock* bomp = im00 ? im00->getNext() : NULL;
-			if (bomp && bomp->getTag()->equals("BOMP")) {
-				Common::SeekableReadStream& _bompinput = *bomp->_mineStream;
-				_bompinput.seek(0, SEEK_SET);
-				_bompinput.seek(8 + 2, SEEK_SET);
-				uint32 mark = _bompinput.readUint32LE();
-				if (mark == 801) {
-					_numFiles = _bompinput.readUint32LE(); // Number of images
-					_bompinput.readUint32LE(); // X Position
-					_bompinput.readUint32LE(); // Y Position
-					_width = _bompinput.readUint32LE();
-					_height = _bompinput.readUint32LE();
-					read = true;
-				} 
-			}
-			
-			if (!read) {
-				_input.seek(10, SEEK_SET);
-				_numFiles = _input.readUint16LE();
-				_input.readUint32BE(); // Number of Z-Buffers per Image
-				_input.readUint16LE(); // X Position
-				_input.readUint16LE(); // Y Position
-				_width = _input.readUint16LE();
-				_height = _input.readUint16LE();
-			}
-		}
-		return true;
-	}
-};
-
-/////////////////////////////////////////////////////////////////////////////
-/////////////////////////////////////////////////////////////////////////////
-
-class ScummAHDRBlock : public ScummPALBlock {
-public:
-	ScummAHDRBlock(ScummTag* tag, uint32 size, Common::SeekableReadStream* stream)
-		: ScummPALBlock(tag, size, stream) {}
-
-	virtual byte* getPAL() {
-		parse();
-		ASSERT(_palData);
-		return _palData + 6;
-	}
-};
-
-class ScummRGBSBlock : public ScummPALBlock {
-public:
-	ScummRGBSBlock(ScummTag* tag, uint32 size, Common::SeekableReadStream* stream)
-		: ScummPALBlock(tag, size, stream) {}
-
-	virtual int getColCount() {
-		parse();
-		return _dsize / 3;
-	}
-};
-
-byte egaPal[] = {
-	   0,   0,   0,
-	   0,   0, 168,
-	   0, 168,   0,
-	   0, 168, 168,
-	 168,   0,   0,
-	 168,   0, 168, 
-	 168,  84,   0,
-	 168, 168, 168,
-	  84,  84,  84,
-	  84,  84, 252,
-	  84, 252,  84,
-	  84, 252, 252,
-	 252,  84,  84,
-	 252,  84, 252,
-	 252, 252,  84,
-	 252, 252, 252,
-};
-
-class ScummEGABlock : public ScummPALBlock {
-public:
-	ScummEGABlock(ScummTag* tag, uint32 size, Common::SeekableReadStream* stream)
-		: ScummPALBlock(tag, size, stream) {
-			_count = 16;
-			_palData = egaPal;
-			_parsed = true;
-	}
-};
-
-ScummPALBlock* getEGAPalette() {
-	ASSERT_STATICS_ALLOWED();
-	static ScummEGABlock ega(NULL, 0, NULL);
-	return &ega;
-}
-
-/////////////////////////////////////////////////////////////////////////////
-/////////////////////////////////////////////////////////////////////////////
-
-struct sbCreator {
-	ScummTag* _tag;
-	guid_list_t _parsers;
-
-	ScummChunkSizeMode _sizeMode;
-
-	uint32 _size;  //read from the header
-	uint32 _dsize; //the computed data size
-
-	bool _readData;			//do we want the data to be read?
-	bool _parseSubBlocks;   //do we want the subblocks to be parsed?
-
-	bool _isStopper;   //do we want to be a stopper for getNext()/getPrev()?
-
-	sbCreator(ScummTag* tag,
-		ScummChunkSizeMode sizeMode,
-		uint32 size, uint32 dsize,
-		bool readData, bool parseSubBlocks, bool isStopper)
-		: _tag(tag), _sizeMode(sizeMode), _size(size), _dsize(dsize),
-		_readData(readData), _parseSubBlocks(parseSubBlocks), _isStopper(isStopper) {}
-
-	virtual ScummBlock* create(ScummTag* tag, uint32 size, Common::SeekableReadStream* stream) = 0;
-	int addParser(const BGUID& parserGUID) {
-		_parsers.push_back(&const_cast<BGUID&>(parserGUID));
-		return 1;
-	}
-};
-
-template<typename T>
-struct sbCreatorT : public sbCreator {
-	sbCreatorT(ScummTag* tag,
-		ScummChunkSizeMode sizeMode,
-		uint32 size, uint32 dsize,
-		bool readData, bool parseSubBlocks, bool isStopper)
-		:  sbCreator(tag, sizeMode, size, dsize, readData, parseSubBlocks, isStopper) {}
-
-	virtual ScummBlock* create(ScummTag* tag, uint32 size, Common::SeekableReadStream* stream) {
-		ASSERT(tag);
-		wxString t = _tag->toString();
-		ASSERT(tag->equals(*_tag) ||
-				t == wxT("****") ||
-				t == wxT("**") ||
-				t == wxT("????") ||
-				t == wxT("??") );
-		ASSERT(stream);
-		ASSERT(_size == -1 || _size == size);
-		T* block = new T(tag, size, stream);
-		block->_sizeMode = _sizeMode;
-		//block->_size = _size;
-		block->_dsize = _dsize;
-		block->_readData = _readData;
-		block->_parseSubBlocks = _parseSubBlocks;
-		block->_isStopper = _isStopper;
-		return block;
-	}
-};
-
-template<int N>
-struct TagChoice {
-	typedef FourTag tag_type;
-};
-template<>
-struct TagChoice<3> {
-	typedef TwoTag tag_type;
-};
-
-#define TAG_TYPE(tag) TagChoice<sizeof(tag)>::tag_type
-
-#include "plugin_detail.h"
-
-#define SCUMM_BLOCK(blocktype, tag, sizeMode, size, dsize, readData, parseSubBlocks, isStopper) \
-	static TAG_TYPE(tag) GENERATE_UNIQUE_IDENTIFIER_SUB(t)(tag); \
-	static sbCreatorT<blocktype> GENERATE_UNIQUE_IDENTIFIER_SUB(creator) \
-		(&GENERATE_UNIQUE_IDENTIFIER_SUB(t), sizeMode, size, dsize, readData, parseSubBlocks, isStopper); \
-	static ret_pair GENERATE_UNIQUE_IDENTIFIER_SUB(insert) = creators.insert( \
-		the_pair( wxString(wxT(tag)), &GENERATE_UNIQUE_IDENTIFIER_SUB(creator)) );
-
-#define DATA_BLOCK(blocktype, tag, presenterGUID) \
-	SCUMM_BLOCK(blocktype, tag, INVALID_SIZE_MODE, -1, -1, true, false, false) \
-		static int GENERATE_UNIQUE_IDENTIFIER_SUB(parser) = \
-		GENERATE_UNIQUE_IDENTIFIER_SUB(creator).addParser(presenterGUID);
-
-#define CUSTOM_BLOCK_EX(blocktype, tag, presenterGUID) \
-	SCUMM_BLOCK(blocktype, tag, INVALID_SIZE_MODE, -1, -1, false, false, false) \
-	static int GENERATE_UNIQUE_IDENTIFIER_SUB(parser) = \
-	GENERATE_UNIQUE_IDENTIFIER_SUB(creator).addParser(presenterGUID);
-
-#define BLOCKY_BLOCK_EX(blocktype, tag, presenterGUID) \
-	SCUMM_BLOCK(blocktype, tag, INVALID_SIZE_MODE, -1, -1, false, true, false) \
-	static int GENERATE_UNIQUE_IDENTIFIER_SUB(parser) = \
-	GENERATE_UNIQUE_IDENTIFIER_SUB(creator).addParser(blockyBlockPresenterGUID()); \
-	static int GENERATE_UNIQUE_IDENTIFIER_SUB(parser2) = \
-	GENERATE_UNIQUE_IDENTIFIER_SUB(creator).addParser(presenterGUID);
-
-#define CUSTOM_BLOCK(tag, presenterGUID) \
-	CUSTOM_BLOCK_EX(ScummBlock, tag, presenterGUID)
-
-#define BASIC_BLOCK(tag) \
-	SCUMM_BLOCK(ScummBlock, tag, INVALID_SIZE_MODE, -1, -1, false, false, false) \
-	static int GENERATE_UNIQUE_IDENTIFIER_SUB(parser) = \
-		GENERATE_UNIQUE_IDENTIFIER_SUB(creator).addParser(CoreFileTypes::binaryParserGUID());
-
-#define BLOCKY_BLOCK(tag) \
-	SCUMM_BLOCK(ScummBlock, tag, INVALID_SIZE_MODE, -1, -1, false, true, false) \
-	static int GENERATE_UNIQUE_IDENTIFIER_SUB(parser) = \
-		GENERATE_UNIQUE_IDENTIFIER_SUB(creator).addParser(blockyBlockPresenterGUID());
-
-#define BLOCKY_STOPPER(tag) \
-	SCUMM_BLOCK(ScummBlock, tag, INVALID_SIZE_MODE, -1, -1, false, true, true) \
-	static int GENERATE_UNIQUE_IDENTIFIER_SUB(parser) = \
-	GENERATE_UNIQUE_IDENTIFIER_SUB(creator).addParser(blockyBlockPresenterGUID());
-
-#define ROOT_BLOCK(tag) \
-	SCUMM_BLOCK(RootScummBlock, tag, TILL_END, -1, -1, false, true, false) \
-		static int GENERATE_UNIQUE_IDENTIFIER_SUB(parser) = \
-		GENERATE_UNIQUE_IDENTIFIER_SUB(creator).addParser(blockyBlockPresenterGUID());
-
-typedef std::map<wxString, sbCreator*> creator_map_t;
-const creator_map_t& sb_creators() {
-	ASSERT_STATICS_ALLOWED();
-
-	typedef creator_map_t::value_type the_pair;
-	typedef std::pair<creator_map_t::iterator, bool> ret_pair;
-	static creator_map_t creators;
-
-	//static TwoTag tag("tag");
-	//static sbCreatorT<ScummBlock> creator(&tag, INVALID_SIZE_MODE, -1, -1, false, true);
-	//static ret_pair res = info_map.insert(wxT("tag"), &creator);
-
-	//Roots of a scumm file
-	ROOT_BLOCK("****")
-	ROOT_BLOCK("**")
-
-	//Unknown blocks
-	BASIC_BLOCK("????")
-	BASIC_BLOCK("??")
-
-	//Palettes
-	DATA_BLOCK(ScummPALBlock, "APAL", scummPALBlockPresenterGUID())
-	DATA_BLOCK(ScummPALBlock, "CLUT", scummPALBlockPresenterGUID())
-	DATA_BLOCK(ScummPALBlock, "NPAL", scummPALBlockPresenterGUID())
-	DATA_BLOCK(ScummPALBlock, "PA", scummPALBlockPresenterGUID())
-	DATA_BLOCK(ScummAHDRBlock, "AHDR", scummPALBlockPresenterGUID())
-	DATA_BLOCK(ScummRGBSBlock, "RGBS", scummPALBlockPresenterGUID())
-
-	//Images
-	BLOCKY_BLOCK("IM00")
-	BLOCKY_BLOCK_EX(ScummBlock, "IM01", scummIMGBlockPresenterGUID())
-	BLOCKY_BLOCK_EX(ScummBlock, "IM02", scummIMGBlockPresenterGUID())
-	BLOCKY_BLOCK_EX(ScummBlock, "IM03", scummIMGBlockPresenterGUID())
-	BLOCKY_BLOCK_EX(ScummBlock, "IM04", scummIMGBlockPresenterGUID())
-	BLOCKY_BLOCK_EX(ScummBlock, "IM05", scummIMGBlockPresenterGUID())
-	BLOCKY_BLOCK_EX(ScummBlock, "IM06", scummIMGBlockPresenterGUID())
-	BLOCKY_BLOCK_EX(ScummBlock, "IM07", scummIMGBlockPresenterGUID())
-	BLOCKY_BLOCK_EX(ScummBlock, "IM08", scummIMGBlockPresenterGUID())
-	BLOCKY_BLOCK_EX(ScummBlock, "IM09", scummIMGBlockPresenterGUID())
-	BLOCKY_BLOCK_EX(ScummBlock, "IM0A", scummIMGBlockPresenterGUID())
-	BLOCKY_BLOCK_EX(ScummBlock, "IM0B", scummIMGBlockPresenterGUID())
-	BLOCKY_BLOCK_EX(ScummBlock, "IM0C", scummIMGBlockPresenterGUID())
-	BLOCKY_BLOCK_EX(ScummBlock, "IM0D", scummIMGBlockPresenterGUID())
-	BLOCKY_BLOCK_EX(ScummBlock, "IM0E", scummIMGBlockPresenterGUID())
-	BLOCKY_BLOCK_EX(ScummBlock, "IM0F", scummIMGBlockPresenterGUID())
-
-	BLOCKY_BLOCK_EX(ScummBlock, "OI", scummIMGBlockPresenterGUID())
-	BLOCKY_BLOCK_EX(ScummBlock, "OBIM", scummIMGBlockPresenterGUID())
-
-	BLOCKY_BLOCK_EX(ScummBlock, "BM", scummIMGBlockPresenterGUID())
-	BLOCKY_BLOCK_EX(ScummBlock, "RMIM", scummIMGBlockPresenterGUID())
-	BLOCKY_BLOCK_EX(ScummBlock, "IMAG", scummIMGBlockPresenterGUID())
-
-	//Scripts
-	CUSTOM_BLOCK("LSCR", scummScriptBlockPresenterGUID())
-	CUSTOM_BLOCK("SCRP", scummScriptBlockPresenterGUID())
-	CUSTOM_BLOCK("ENCD", scummScriptBlockPresenterGUID())
-	CUSTOM_BLOCK("EXCD", scummScriptBlockPresenterGUID())
-	CUSTOM_BLOCK("VERB", scummScriptBlockPresenterGUID())
-	CUSTOM_BLOCK("LS", scummScriptBlockPresenterGUID())
-	CUSTOM_BLOCK("SC", scummScriptBlockPresenterGUID())
-	CUSTOM_BLOCK("EN", scummScriptBlockPresenterGUID())
-	CUSTOM_BLOCK("EX", scummScriptBlockPresenterGUID())
-	CUSTOM_BLOCK("OC", scummScriptBlockPresenterGUID())
-
-	//Other
-	BASIC_BLOCK("ADL ")
-	BASIC_BLOCK("AMI ")
-	SCUMM_BLOCK(ScummBlock, "DATA", TILL_END, -1, -1, false, false, false) //TODO: probably not correct
-
-	BASIC_BLOCK("FRMT")
-	BASIC_BLOCK("GMD ")
-	SCUMM_BLOCK(ScummBlock, "iMUS", TILL_END, -1, -1, false, true, false) //TODO: probably not correct
-	BASIC_BLOCK("JUMP")
-
-	SCUMM_BLOCK(RawScummBlock, "LABN", TILL_END, -1, -1, false, false, false) //TODO: parse it properly
-	SCUMM_BLOCK(RawScummBlock, "LB83", TILL_END, -1, -1, false, false, false) //TODO: parse it properly
-	BLOCKY_STOPPER("LECF")
-	BLOCKY_STOPPER("LFLF")
-	CUSTOM_BLOCK("LOFF", scummLOFFBlockPresenterGUID())
-	BASIC_BLOCK("MAP ")
-	SCUMM_BLOCK(RawScummBlock, "MCMP", TILL_END, -1, -1, false, false, false) //TODO: parse it properly
-	BASIC_BLOCK("MIDI")
-	CUSTOM_BLOCK("OFFS", scummOFFSBlockPresenterGUID())
-
-	BLOCKY_BLOCK("PALS")
-	SCUMM_BLOCK(RawScummBlock, "RIFF", TILL_END, -1, -1, false, false, false) //TODO: parse it properly
-	BASIC_BLOCK("ROL ")
-	BLOCKY_STOPPER("ROOM")
-	DATA_BLOCK(ScummIMHDBlock, "IMHD", CoreFileTypes::binaryParserGUID())
-	DATA_BLOCK(ScummRMHDBlock, "RMHD", scummRMHDBlockPresenterGUID())
-	BLOCKY_BLOCK("RMSC")
-	BASIC_BLOCK("SPK ")
-	BASIC_BLOCK("STOP")
-
-	CUSTOM_BLOCK("TRNS", scummTRNSBlockPresenterGUID())
-
-	BLOCKY_BLOCK("WRAP") //FIXME: Is this ok? Shouldn't the OFFS subblock be used here?
-
-	BLOCKY_BLOCK("PALS")
-	BLOCKY_BLOCK("OBCD")
-
-	//FIXME: files?
-	BLOCKY_BLOCK(".IMC")
-	BLOCKY_BLOCK(".IMX")
-	BASIC_BLOCK(".LUA")
-	BASIC_BLOCK(".TXT")
-	BLOCKY_BLOCK(".WAV")
-
-	return creators;
-}
-
-/*static*/ sbCreator* ScummBlockFactory::getCreatorForTag(wxString tagName) {
-	ASSERT(tagName.Len() == 2 || tagName.Len() == 4);
-	bool newTag = tagName.Len() == 4;
-
-	bool unknown = false;
-	creator_map_t::const_iterator i;
-	i = sb_creators().find(tagName);
-	if (i == sb_creators().end()) {
-		i = sb_creators().find(newTag ? wxT("????") : wxT("??"));
-		ASSERT(i != sb_creators().end());
-		unknown = true;
-	}
-
-	sbCreator* creator = i->second;
-	return creator;
-}
-
-/*static*/ ScummBlock* ScummBlockFactory::create(ScummTag* tag, uint32 size, Common::SeekableReadStream* stream) {
-	ASSERT(tag);
-	sbCreator* creator = ScummBlockFactory::getCreatorForTag(tag->toString());
-	ASSERT(creator);
-	ScummBlock* block = creator->create(tag, size, stream);
-
-	return block;
-}
-
-/*static*/ guid_list_t ScummBlockFactory::getScummBlockParsers(const BGUID& tagGUID) {
-	wxString tagName = tagGUID.identifier;
-
-	sbCreator* creator = ScummBlockFactory::getCreatorForTag(tagName);
-
-	ASSERT(creator);
-	return creator->_parsers;
-}
-
-/////////////////////////////////////////////////////////////////////////////
-/////////////////////////////////////////////////////////////////////////////
-
-const blockInfo* getBlockInfo(const ScummTag& tag) {
-	if (tag.isNewTag())
-		return getNewBlockInfo(static_cast<const FourTag&>(tag));
-	else
-		return getOldBlockInfo(static_cast<const TwoTag&>(tag));
-}
-
-const blockInfo* getNewBlockInfo(const FourTag& tag) {
-	
-	for (int i = 0; blocksInfo[i].name != 0; i++)
-		if (tag.equals(blocksInfo[i].name))
-			return &blocksInfo[i];
-
-	return NULL;
-}
-
-const blockInfo* getOldBlockInfo(const TwoTag& tag) {
-	
-	for (int i = 0; oldBlocksInfo[i].name != 0; i++)
-		if (tag.equals(oldBlocksInfo[i].name))
-			return &oldBlocksInfo[i];
-
-	return NULL;
-}
-
-/////////////////////////////////////////////////////////////////////////////
-/////////////////////////////////////////////////////////////////////////////
-
-const byte encBytesTable[] = {
-	0x00, 0x69, 0xFF
-};
-const int encBytesTableSize = 3;
-
-const struct blockInfo blocksInfo[] = {
-	{"RNAM", wxT("Room Names"), 1, wxT("help/specRNAM.html"), 47},
-	{"MAXS", wxT("Maximum Values"), 0, wxT(""), 2},
-	{"LB83", wxT("Lucasarts Bundle 8.3"), 1, wxT("help/specLB83.html"), 6},
-	{"LABN", wxT("Lucasarts Bundle New"), 1, wxT("help/specLABN.html"), 6},
-	{"LECF", wxT("LucasArts Entertainment Company Files"), 1, wxT("help/specLECF.html"), 6},
-	{"LOFF", wxT("Room Offset Table"), 1, wxT("help/specLOFF.html"), 44},
-	{"LFLF", wxT("LucasArts File Format"), 1, wxT("help/specLFLF.html"), 58},
-	{"ROOM", wxT("Room Container"), 1, wxT("help/specROOM.html"), 38},
-	{"RMHD", wxT("Room Header"), 0, wxT(""), 35},
-	{"CYCL", wxT("Color Cycle"), 0, wxT(""), 12},
-	{"TRNS", wxT("Transparency"), 1, wxT("help/specTRNS.html"), 46},
-	{"EPAL", wxT("EGA Palette"), 0, wxT(""), 34},
-	{"BOXD", wxT("Box Description"), 0, wxT(""), 4},
-	{"BOXM", wxT("Box Matrix"), 0, wxT(""), 5},
-	{"OBCD", wxT("Object Code"), 1, wxT("help/specOBCD.html"), 57},
-	{"OBNA", wxT("Object Name"), 1, wxT("help/specOBNA.html"), 45},
-	{"CDHD", wxT("Code Header"), 0, wxT(""), 7},
-	{"VERB", wxT("Verbs"), 0, wxT(""), 50},
-	{"DROO", wxT("Directory of Rooms"), 0, wxT(""), 18},
-	{"DSCR", wxT("Directory of Scripts"), 0, wxT(""), 19},
-	{"DSOU", wxT("Directory of Sounds"), 0, wxT(""), 20},
-	{"DCOS", wxT("Directory of Costumes"), 0, wxT(""), 14},
-	{"DCHR", wxT("Directory of Charsets"), 0, wxT(""), 13},
-	{"DOBJ", wxT("Directory of Objects"), 0, wxT(""), 17},
-	{"DIRC", wxT("Directory of Costumes"), 0, wxT(""), 47},
-	{"DIRF", wxT("Directory of Charsets"), 0, wxT(""), 47},
-	{"DIRI", wxT("Directory of Room Images"), 0, wxT(""), 47},
-	{"DIRN", wxT("Directory of Sounds"), 0, wxT(""), 47},
-	{"DIRM", wxT("Directory of Images"), 0, wxT(""), 47},
-	{"DIRR", wxT("Directory of Rooms"), 0, wxT(""), 47},
-	{"DIRS", wxT("Directory of Scripts"), 0, wxT(""), 47},
-	{"DIRT", wxT("Directory of Talkies"), 0, wxT(""), 47},
-	{"cus1", wxT("bundled file")},
-	{"cus2", wxT("iMUSE Cue"), 0, wxT(""), 59},
-	{"COMP", wxT("Compression Table"), 0, wxT(""), 9},
-	{"CLUT", wxT("Color Lookup Table"), 1, wxT("help/specCLUT.html"), 34},
-	{"PALS", wxT("Wrapper for Palettes"), 1, wxT("help/specPALS.html"), 56},
-	{"WRAP", wxT("Wrapper for Palettes/Images"), 1, wxT("help/specWRAP.html"), 60},
-	{"OFFS", wxT("Offsets"), 1, wxT("help/specOFFS.html"), 44},
-	{"APAL", wxT("Palette"), 1, wxT("help/specAPAL.html"), 34},
-	{"RMIM", wxT("Room Image"), 0, wxT(""), 37},
-	{"RMIH", wxT("Room Image Header"), 0, wxT(""), 36},
-	{"IM00", wxT("Image"), 0, wxT(""), 25},
-	{"IM01", wxT("Image"), 0, wxT(""), 25},
-	{"IM02", wxT("Image"), 0, wxT(""), 25},
-	{"IM03", wxT("Image"), 0, wxT(""), 25},
-	{"IM04", wxT("Image"), 0, wxT(""), 25},
-	{"IM05", wxT("Image"), 0, wxT(""), 25},
-	{"IM06", wxT("Image"), 0, wxT(""), 25},
-	{"IM07", wxT("Image"), 0, wxT(""), 25},
-	{"IM08", wxT("Image"), 0, wxT(""), 25},
-	{"IM09", wxT("Image"), 0, wxT(""), 25},
-	{"IM0A", wxT("Image"), 0, wxT(""), 25},
-	{"IM0B", wxT("Image"), 0, wxT(""), 25},
-	{"IM0C", wxT("Image"), 0, wxT(""), 25},
-	{"IM0D", wxT("Image"), 0, wxT(""), 25},
-	{"IM0E", wxT("Image"), 0, wxT(""), 25},
-	{"IM0F", wxT("Image"), 0, wxT(""), 25},
-	{"IM10", wxT("Image"), 0, wxT(""), 25},
-	{"ZP01", wxT(""), 0, wxT(""), 52},
-	{"ZP02", wxT(""), 0, wxT(""), 52},
-	{"ZP03", wxT(""), 0, wxT(""), 52},
-	{"ZP04", wxT(""), 0, wxT(""), 52},
-	{"ZPLN", wxT(""), 0, wxT(""), 52},
-	{"SMAP", wxT("Pixelmap"), 0, wxT(""), 42},
-	{"SCAL", wxT("Scaling"), 0, wxT(""), 40},
-	{"AARY", wxT("Array?"), 0, wxT(""), 47},
-	{"ANAM", wxT(""), 0, wxT(""), 47},
-	{"SOUN", wxT("Sound"), 0, wxT(""), 59},
-	{"SCRP", wxT("Script"), 0, wxT(""), 41},
-	{"EXCD", wxT("Exit Code"), 0, wxT(""), 22},
-	{"ENCD", wxT("Entry Code"), 0, wxT(""), 21},
-	{"NLSC", wxT("Number of Local Scripts"), 0, wxT(""), 41},
-	{"OBIM", wxT("Object Image"), 0, wxT(""), 33},
-	{"IMHD", wxT("Image Header"), 0, wxT(""), 26},
-	{"SOU ", wxT("Sound"), 0, wxT(""), 59},
-	{"VCTL", wxT(""), 0, wxT(""), 15},
-	{"Crea", wxT("Voc Sample"), 0, wxT(""), 16},

@@ 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