[Scummvm-cvs-logs] SF.net SVN: scummvm: [28057] scummex/branches/gsoc2007-gameresbrowser

zbychs at users.sourceforge.net zbychs at users.sourceforge.net
Fri Jul 13 18:30:04 CEST 2007


Revision: 28057
          http://scummvm.svn.sourceforge.net/scummvm/?rev=28057&view=rev
Author:   zbychs
Date:     2007-07-13 09:30:04 -0700 (Fri, 13 Jul 2007)

Log Message:
-----------
The source is now -Wall friendly.

Modified Paths:
--------------
    scummex/branches/gsoc2007-gameresbrowser/gcc/Makefile
    scummex/branches/gsoc2007-gameresbrowser/src/browser/CoreInterfaces.h
    scummex/branches/gsoc2007-gameresbrowser/src/browser/Directories.h
    scummex/branches/gsoc2007-gameresbrowser/src/browser/DirectoryController.h
    scummex/branches/gsoc2007-gameresbrowser/src/browser/ExplorationTree.cpp
    scummex/branches/gsoc2007-gameresbrowser/src/browser/FileTypeRecognizer.h
    scummex/branches/gsoc2007-gameresbrowser/src/browser/VirtualNode.h
    scummex/branches/gsoc2007-gameresbrowser/src/browser/streams/xorstream.h
    scummex/branches/gsoc2007-gameresbrowser/src/browserapp/MainFormCommands.cpp
    scummex/branches/gsoc2007-gameresbrowser/src/core/ObjectChain.cpp
    scummex/branches/gsoc2007-gameresbrowser/src/core/core.cpp
    scummex/branches/gsoc2007-gameresbrowser/src/core/pinslot_detail.h
    scummex/branches/gsoc2007-gameresbrowser/src/core/treealgos.h
    scummex/branches/gsoc2007-gameresbrowser/src/plugins/basic/BasicParsers.cpp
    scummex/branches/gsoc2007-gameresbrowser/src/plugins/basic/FileInfoPresenter.cpp
    scummex/branches/gsoc2007-gameresbrowser/src/plugins/scumm/BlockyBlockPresenter.h
    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/ScummBlockInfoPresenter.cpp
    scummex/branches/gsoc2007-gameresbrowser/src/plugins/scumm/ScummBlockPresenter.h

Modified: scummex/branches/gsoc2007-gameresbrowser/gcc/Makefile
===================================================================
--- scummex/branches/gsoc2007-gameresbrowser/gcc/Makefile	2007-07-13 16:20:32 UTC (rev 28056)
+++ scummex/branches/gsoc2007-gameresbrowser/gcc/Makefile	2007-07-13 16:30:04 UTC (rev 28057)
@@ -111,7 +111,7 @@
     GLOBAL_DEFINES = UNIX WXUSINGDLL $(UNICODE)
 endif
 
-BASE_FLAGS = -g $(patsubst %, -I%, $(ALL_DIRS) ) $(patsubst %, -D%, $(GLOBAL_DEFINES) ) \
+BASE_FLAGS = -g -Wall $(patsubst %, -I%, $(ALL_DIRS) ) $(patsubst %, -D%, $(GLOBAL_DEFINES) ) \
              $(patsubst %, -L%, $(ALL_OUTPUT) )
 CXXFLAGS = $(BASE_FLAGS) $(WX_FLAGS)
 

Modified: scummex/branches/gsoc2007-gameresbrowser/src/browser/CoreInterfaces.h
===================================================================
--- scummex/branches/gsoc2007-gameresbrowser/src/browser/CoreInterfaces.h	2007-07-13 16:20:32 UTC (rev 28056)
+++ scummex/branches/gsoc2007-gameresbrowser/src/browser/CoreInterfaces.h	2007-07-13 16:30:04 UTC (rev 28057)
@@ -30,8 +30,8 @@
 
 template<typename T>
 class IProviderImpl : public IProvider<T> {
+	T* _data;
 	bool _ownData;
-	T* _data;
 public:
 	IProviderImpl(T* data, bool ownData = false)
 		: _data(data), _ownData(ownData) {}
@@ -112,14 +112,15 @@
 class BROWSER_API IDirectoryImpl : public IDirectory {
 
 protected:
+	IDirectory* _parentDir;
 	coreString _name;
-	RecognizedFileType _fileType;
-	IDirectory* _parentDir;
 
-	bool _ownInterfaces;
 	ifile_list_t _ifiles;
 	idir_list_t _isubdirs;
+	bool _ownInterfaces;
 
+	RecognizedFileType _fileType;
+
 public:
 	//inherit guid - it's a concrete implementation of an abstract interface
 	IDirectoryImpl(IDirectory* parentDir, coreString name,
@@ -166,9 +167,9 @@
 // Instead of multiple inheritance - I use encapsulation: _streamImpl member.
 class BROWSER_API IFileImplBase : public IFile {
 protected:
+	IDirectory* _parentDir;
 	coreString _name;
 	RecognizedFileType _fileType;
-	IDirectory* _parentDir;
 public:
 	//inherit guid - it's a concrete implementation of an abstract interface
 	IFileImplBase(IDirectory* parentDir, coreString name);

Modified: scummex/branches/gsoc2007-gameresbrowser/src/browser/Directories.h
===================================================================
--- scummex/branches/gsoc2007-gameresbrowser/src/browser/Directories.h	2007-07-13 16:20:32 UTC (rev 28056)
+++ scummex/branches/gsoc2007-gameresbrowser/src/browser/Directories.h	2007-07-13 16:30:04 UTC (rev 28057)
@@ -86,7 +86,7 @@
 
 	//parentDir can be NULL
 	DiskDirectory(IDirectory* parentDir, wxTreeItemId mineTreeItem, coreString directoryPath)
-		: VirtualNode(mineTreeItem), _parentDir(parentDir), _directoryPath(directoryPath), _idirectory(NULL) {}
+		: VirtualNode(mineTreeItem), _directoryPath(directoryPath), _parentDir(parentDir), _idirectory(NULL) {}
 
 	IVirtualDirectoryImpl* getDirectoryImpl();
 	void releaseDirectoryImpl(IVirtualDirectoryImpl* iface);

Modified: scummex/branches/gsoc2007-gameresbrowser/src/browser/DirectoryController.h
===================================================================
--- scummex/branches/gsoc2007-gameresbrowser/src/browser/DirectoryController.h	2007-07-13 16:20:32 UTC (rev 28056)
+++ scummex/branches/gsoc2007-gameresbrowser/src/browser/DirectoryController.h	2007-07-13 16:30:04 UTC (rev 28057)
@@ -14,6 +14,7 @@
 class BROWSER_API DirectoryController {
 public:
 	virtual void expand() = 0;
+	virtual ~DirectoryController() {};
 };
 
 /////////////////////////////////////////////////////////////////////////////

Modified: scummex/branches/gsoc2007-gameresbrowser/src/browser/ExplorationTree.cpp
===================================================================
--- scummex/branches/gsoc2007-gameresbrowser/src/browser/ExplorationTree.cpp	2007-07-13 16:20:32 UTC (rev 28056)
+++ scummex/branches/gsoc2007-gameresbrowser/src/browser/ExplorationTree.cpp	2007-07-13 16:30:04 UTC (rev 28057)
@@ -27,10 +27,10 @@
 
 //information about registered panel
 struct PanelInfo {
+	PanelProvider* _panelProvider; //the panel provider it represents
 	bool _activated;		//wheather it's being displayed now
 	wxPanel* _page;			//it's panel
 	size_t _pageIdx;		//it's page index in the wxNotebook
-	PanelProvider* _panelProvider; //the panel provider it represents
 	PanelInfo(PanelProvider* panelProvider)
 		: _panelProvider(panelProvider), _activated(false), _page(NULL), _pageIdx(-1) {}
 };

Modified: scummex/branches/gsoc2007-gameresbrowser/src/browser/FileTypeRecognizer.h
===================================================================
--- scummex/branches/gsoc2007-gameresbrowser/src/browser/FileTypeRecognizer.h	2007-07-13 16:20:32 UTC (rev 28056)
+++ scummex/branches/gsoc2007-gameresbrowser/src/browser/FileTypeRecognizer.h	2007-07-13 16:30:04 UTC (rev 28057)
@@ -60,11 +60,13 @@
 class BROWSER_API FileTypeRecognizer {
 public:
 	virtual RecognizedFileType recognize(VirtualFile* file) = 0;
+	virtual ~FileTypeRecognizer() {};
 };
 
 class FileTypeParserResolver {
 public:
 	virtual ResolvedFileTypeParsers resolve(const BGUID& fileType) = 0;
+	virtual ~FileTypeParserResolver() {};
 };
 
 /////////////////////////////////////////////////////////////////////////////

Modified: scummex/branches/gsoc2007-gameresbrowser/src/browser/VirtualNode.h
===================================================================
--- scummex/branches/gsoc2007-gameresbrowser/src/browser/VirtualNode.h	2007-07-13 16:20:32 UTC (rev 28056)
+++ scummex/branches/gsoc2007-gameresbrowser/src/browser/VirtualNode.h	2007-07-13 16:30:04 UTC (rev 28057)
@@ -30,9 +30,9 @@
 // to get the VirtualNode from it's visual representation.
 class BROWSER_API VirtualNodeItemData : public wxTreeItemData {
 	VirtualNode* _node;		//the node we're tied to
+	ObjectChain* _ochain;	//_node's object chain
 	bool _realized;			//weather _node's object chain has been realized
 	bool _completed;		//weather it has been completed
-	ObjectChain* _ochain;	//_node's object chain
 
 	guid_list_t _parsersOrdering;	//order in which parsers should be displayed
 

Modified: scummex/branches/gsoc2007-gameresbrowser/src/browser/streams/xorstream.h
===================================================================
--- scummex/branches/gsoc2007-gameresbrowser/src/browser/streams/xorstream.h	2007-07-13 16:20:32 UTC (rev 28056)
+++ scummex/branches/gsoc2007-gameresbrowser/src/browser/streams/xorstream.h	2007-07-13 16:30:04 UTC (rev 28057)
@@ -31,8 +31,8 @@
 protected:
 
 	byte _encbyte;
+	SeekableReadStream* _streamImpl;
 	bool _ownStream;
-	SeekableReadStream* _streamImpl;
 
 private:
 	// Disallow copying XORStream objects.

Modified: scummex/branches/gsoc2007-gameresbrowser/src/browserapp/MainFormCommands.cpp
===================================================================
--- scummex/branches/gsoc2007-gameresbrowser/src/browserapp/MainFormCommands.cpp	2007-07-13 16:20:32 UTC (rev 28056)
+++ scummex/branches/gsoc2007-gameresbrowser/src/browserapp/MainFormCommands.cpp	2007-07-13 16:30:04 UTC (rev 28057)
@@ -45,7 +45,8 @@
 	ExplorationTree::initialize(browserTree, browserNotebook);
 	FileTypeRegistry::get()->registerPlugins();
 
-	OnTest2(wxCommandEvent());
+	wxCommandEvent event;
+	OnTest2(event);
 }
 
 void MainForm::CleanupObjects() {

Modified: scummex/branches/gsoc2007-gameresbrowser/src/core/ObjectChain.cpp
===================================================================
--- scummex/branches/gsoc2007-gameresbrowser/src/core/ObjectChain.cpp	2007-07-13 16:20:32 UTC (rev 28056)
+++ scummex/branches/gsoc2007-gameresbrowser/src/core/ObjectChain.cpp	2007-07-13 16:30:04 UTC (rev 28057)
@@ -612,7 +612,7 @@
 
 	ocVisitAncestorGUID visit(ancestorGUID);
 	ocExpand expand(this);
-	bool found = tree_algos::bfs(obj, visit, expand);
+	/*bool found =*/ tree_algos::bfs(obj, visit, expand);
 	return visit.getFoundObj();
 }
 
@@ -626,7 +626,7 @@
 
 	ocVisitAncestor visit;
 	ocExpand expand(this);
-	bool found = tree_algos::bfs(obj, visit, expand);
+	/*bool found =*/ tree_algos::bfs(obj, visit, expand);
 	return visit.getAncestors();
 }
 

Modified: scummex/branches/gsoc2007-gameresbrowser/src/core/core.cpp
===================================================================
--- scummex/branches/gsoc2007-gameresbrowser/src/core/core.cpp	2007-07-13 16:20:32 UTC (rev 28056)
+++ scummex/branches/gsoc2007-gameresbrowser/src/core/core.cpp	2007-07-13 16:30:04 UTC (rev 28057)
@@ -53,4 +53,4 @@
 {
 	return;
 }
-*/
\ No newline at end of file
+*/

Modified: scummex/branches/gsoc2007-gameresbrowser/src/core/pinslot_detail.h
===================================================================
--- scummex/branches/gsoc2007-gameresbrowser/src/core/pinslot_detail.h	2007-07-13 16:20:32 UTC (rev 28056)
+++ scummex/branches/gsoc2007-gameresbrowser/src/core/pinslot_detail.h	2007-07-13 16:30:04 UTC (rev 28057)
@@ -122,6 +122,7 @@
 #define END_DESCS \
 		); \
 		static bool dummy = descs.setShared(false); \
+		dummy = dummy; \
 		return descs; \
 	}
 
@@ -144,9 +145,9 @@
 
 template<int flags, typename I, typename T, typename GD, typename RD>
 struct PinMaker {
+	Pin<I>* T::*pin;
 	GD gd; // IDer* gd(T* that)
 	RD rd; // void rd(T* that, I* intf)
-	Pin<I>* T::*pin;
 	PinMaker(Pin<I>* T::*_pin, const GD& _gd, const RD& _rd)
 		: pin(_pin), gd(_gd), rd(_rd) {}
 	void operator()(BObject* that) const

Modified: scummex/branches/gsoc2007-gameresbrowser/src/core/treealgos.h
===================================================================
--- scummex/branches/gsoc2007-gameresbrowser/src/core/treealgos.h	2007-07-13 16:20:32 UTC (rev 28056)
+++ scummex/branches/gsoc2007-gameresbrowser/src/core/treealgos.h	2007-07-13 16:30:04 UTC (rev 28057)
@@ -25,6 +25,7 @@
 	virtual T& front() = 0;
 	virtual int level() = 0;
 	virtual bool empty() = 0;
+	virtual ~Fringe() {};
 };
 
 template<typename T>

Modified: scummex/branches/gsoc2007-gameresbrowser/src/plugins/basic/BasicParsers.cpp
===================================================================
--- scummex/branches/gsoc2007-gameresbrowser/src/plugins/basic/BasicParsers.cpp	2007-07-13 16:20:32 UTC (rev 28056)
+++ scummex/branches/gsoc2007-gameresbrowser/src/plugins/basic/BasicParsers.cpp	2007-07-13 16:30:04 UTC (rev 28057)
@@ -84,7 +84,7 @@
 	const int bytes_per_line = 8;
 	const int max_lines = 50;
 
-	uint32 orig_size = size;
+	//uint32 orig_size = size;
 	if (size > bytes_per_line * max_lines) {
 		truncated = true;
 		size = bytes_per_line * max_lines;

Modified: scummex/branches/gsoc2007-gameresbrowser/src/plugins/basic/FileInfoPresenter.cpp
===================================================================
--- scummex/branches/gsoc2007-gameresbrowser/src/plugins/basic/FileInfoPresenter.cpp	2007-07-13 16:20:32 UTC (rev 28056)
+++ scummex/branches/gsoc2007-gameresbrowser/src/plugins/basic/FileInfoPresenter.cpp	2007-07-13 16:30:04 UTC (rev 28057)
@@ -146,9 +146,9 @@
 	if (!stream) {
 		text << wxT("ERROR while getting Stream") << wxEndl();
 	} else {
-		uint32 p = stream->pos();
 		uint32 s = stream->size();
 		text << wxT("Size: ") << s << wxEndl();
+		//uint32 p = stream->pos();
 		//text << wxT("Current position in file: ") << p << wxEndl();
 	}
 

Modified: scummex/branches/gsoc2007-gameresbrowser/src/plugins/scumm/BlockyBlockPresenter.h
===================================================================
--- scummex/branches/gsoc2007-gameresbrowser/src/plugins/scumm/BlockyBlockPresenter.h	2007-07-13 16:20:32 UTC (rev 28056)
+++ scummex/branches/gsoc2007-gameresbrowser/src/plugins/scumm/BlockyBlockPresenter.h	2007-07-13 16:30:04 UTC (rev 28057)
@@ -65,8 +65,8 @@
 
 class IScummBlockFileImpl : public IFileImplBase {
 protected:
+	ScummBlock* _block;
 	bool _ownBlock;
-	ScummBlock* _block;
 	Common::SeekableReadStream* _stream;
 public:
 	//inherit guid - it's a concrete implementation of an abstract interface
@@ -111,8 +111,8 @@
 
 class IBlocksDirectoryImpl : public IVirtualBlocksDirectoryImpl {
 protected:
+	ScummBlock* _block;
 	bool _ownBlock;
-	ScummBlock* _block;
 public:
 	//inherit guid - it's a concrete implementation of an abstract interface
 	IBlocksDirectoryImpl(IDirectory* parentDir, coreString name, ScummBlock* block, bool ownBlock);

Modified: scummex/branches/gsoc2007-gameresbrowser/src/plugins/scumm/CustomScummBlocks.h
===================================================================
--- scummex/branches/gsoc2007-gameresbrowser/src/plugins/scumm/CustomScummBlocks.h	2007-07-13 16:20:32 UTC (rev 28056)
+++ scummex/branches/gsoc2007-gameresbrowser/src/plugins/scumm/CustomScummBlocks.h	2007-07-13 16:30:04 UTC (rev 28057)
@@ -21,8 +21,8 @@
 	virtual bool parse() {
 		_parsed = true;
 		ASSERT(_sizeMode == TILL_END);
-		ASSERT(!_readData);
-		ASSERT(!_parseSubBlocks);
+		ASSERT(!ifReadData());
+		ASSERT(!ifParseSubBlocks());
 		return true;
 	}
 
@@ -162,8 +162,8 @@
 }
 
 bool ScummPALBlock::parse() {
-	ASSERT(_readData);
-	ASSERT(!_parseSubBlocks);
+	ASSERT(ifReadData());
+	ASSERT(!ifParseSubBlocks());
 	bool res = ScummBlock::parse();
 	if (!res)
 		return false;

Modified: scummex/branches/gsoc2007-gameresbrowser/src/plugins/scumm/ScummBlock.cpp
===================================================================
--- scummex/branches/gsoc2007-gameresbrowser/src/plugins/scumm/ScummBlock.cpp	2007-07-13 16:20:32 UTC (rev 28056)
+++ scummex/branches/gsoc2007-gameresbrowser/src/plugins/scumm/ScummBlock.cpp	2007-07-13 16:30:04 UTC (rev 28057)
@@ -23,10 +23,10 @@
 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) {}
+	  _flags(0), _parsed(false), _size(size), _dsize(-1), _data(NULL),
+	  _subblocks(),
+	  _parent(NULL), _myId(), _rootOffs(-1),
+	  _level(0) {}
 
 ScummBlock::~ScummBlock() {
 	if(_tag)
@@ -66,7 +66,8 @@
 }
 
 RootScummBlock* ScummBlock::getRootScummBlock() {
-	return _rootScummBlock;
+	ASSERT(_parent);
+	return _parent->getRootScummBlock();
 }
 
 ScummBlock* ScummBlock::getNext() {
@@ -76,7 +77,7 @@
 	if (i == rootBlocks().end())
 		return NULL;
 
-	if ((*i)->_isStopper)
+	if ((*i)->ifIsStopper())
 		return NULL;
 
 	return *i;
@@ -88,7 +89,7 @@
 		return NULL;
 
 	ScummBlock* prev = *(--i);
-	if (prev->_isStopper)
+	if (prev->ifIsStopper())
 		return NULL;
 	if (prev->_parsed)
 		return prev;
@@ -137,10 +138,10 @@
 	if (!determineDataSize())
 		return false;
 
-	if (_readData && !readData())
+	if (ifReadData() && !readData())
 		return false;
 
-	if (_parseSubBlocks && !parseSubBlocks())
+	if (ifParseSubBlocks() && !parseSubBlocks())
 		return false;
 
 	return true;
@@ -190,7 +191,7 @@
 	uint32 outSize;
 	if (!readHeader(outTag, outSize))
 		return false;
-	ASSERT( _size == -1 || _size == outSize );
+	ASSERT( _size == (uint32)(-1) || _size == outSize );
 	_size = outSize;
 	ASSERT( _tag->equals(*outTag) );
 	delete outTag;
@@ -214,7 +215,7 @@
 }
 
 bool ScummBlock::determineDataSize(uint32& outSize) {
-	if (_dsize != -1) {
+	if (_dsize != (uint32)(-1)) {
 		outSize = _dsize;
 		return true;
 	}
@@ -279,8 +280,9 @@
 }
 
 ScummBlock::scumm_blocks& ScummBlock::rootBlocks() {
-	ASSERT(_rootScummBlock);
-	return _rootScummBlock->rootBlocks();
+	ScummBlock* rootScummBlock = getRootScummBlock();
+	ASSERT(rootScummBlock);
+	return rootScummBlock->rootBlocks();
 }
 
 //utility function
@@ -316,7 +318,6 @@
 		kidblock->_myId = cur_id;
 		cur_id++;
 		kidblock->_rootOffs = _rootOffs + pos;
-		kidblock->_rootScummBlock = _rootScummBlock;
 		kidblock->_parent = this;
 		kidblock->_level = _level + 1;
 
@@ -359,11 +360,14 @@
 	: ScummBlock(tag, size, stream) {
 		_rootBlocks.push_back(this);
 		_myId = _rootBlocks.begin();
-		_rootScummBlock = this;
 		_rootOffs = 0;
 		_scummVersion = -1; //unknown
 }
 
+RootScummBlock* RootScummBlock::getRootScummBlock() {
+	return this;
+}
+
 int RootScummBlock::getScummVersion() {
 	return _scummVersion;
 }
@@ -378,14 +382,14 @@
 
 bool RootScummBlock::parse() {
 	ASSERT(_sizeMode == TILL_END);
-	ASSERT(!_readData);
-	ASSERT(_parseSubBlocks);
+	ASSERT(!ifReadData());
+	ASSERT(ifParseSubBlocks());
 	return ScummBlock::parse();
 }
 
 bool RootScummBlock::readHeader() {
 	uint32 outSize = _mineStream->size();
-	ASSERT( _size == -1 || _size == outSize );
+	ASSERT( _size == (uint32)(-1) || _size == outSize );
 	_size = outSize;
 	ASSERT( (_tag->isNewTag() && _tag->toString() == wxT("****")) ||
 		(!_tag->isNewTag() && _tag->toString() == wxT("**")) );

Modified: scummex/branches/gsoc2007-gameresbrowser/src/plugins/scumm/ScummBlock.h
===================================================================
--- scummex/branches/gsoc2007-gameresbrowser/src/plugins/scumm/ScummBlock.h	2007-07-13 16:20:32 UTC (rev 28056)
+++ scummex/branches/gsoc2007-gameresbrowser/src/plugins/scumm/ScummBlock.h	2007-07-13 16:30:04 UTC (rev 28057)
@@ -38,39 +38,40 @@
 // A generic ScummBlock, heavily parametrized, that can parse almost any scumm
 // chunk. It can be subclassed to parse even most weird chunks.
 
+enum ScummBlockFlags {
+	READ_DATA = 1,			//if we want the raw data to be read from the chunk (and stored in _data)
+	PARSE_SUB_BLOCKS = 2,	//if we want the sub blocks to be parsed (and stored in _subblocks)
+	IS_STOPPER = 4,			//if this is set, the getNext()/getPrev() functions
+							//don't go beyond this block - use this for ROOMs, LFLFs etc.
+							//so that searching is constrained to the ROOM/LFLF scope
+};
+
 class RootScummBlock;
 
 class ScummBlock {
 public: //HACK: <-- only temporary
+	typedef std::list<ScummBlock*> scumm_blocks;
+	typedef scumm_blocks::iterator scumm_id;
+
 	ScummTag* _tag;
 	ScummChunkSizeMode _sizeMode;
 
 	bool _ownStream;
 	Common::SeekableReadStream* _mineStream;
 
-	bool _parsed;
+	int _flags;						//see ScummBlockFlags
+	bool _parsed;					//wheather the block has been parsed already
 	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;
+	scumm_blocks _subblocks;		//list of my subblocks
 
 	ScummBlock* _parent;			//parent scumm block
 	scumm_id _myId;					//my unique identifier (really an iterator into the global list of scumm blocks)
-	RootScummBlock* _rootScummBlock;//root scumm block of the file I'm in (see getRootScummBlock())
 	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;
@@ -85,9 +86,9 @@
 	const scumm_blocks& getSubBlocks();
 	Common::SeekableReadStream* getStream();
 	ScummBlock* getParent();
-	RootScummBlock* getRootScummBlock();//gets the root block of the file I'm in (CAUTION:
-										//it's not like LECF chunk, it's a **** chunk that
-										//can contain a LECF chunk)
+	virtual RootScummBlock* getRootScummBlock();//gets the root block of the file I'm in (CAUTION:
+												//it's not like LECF chunk, it's a dummy **** chunk that
+												//contains all top-level chunks in the file)
 	uint32 blockSize(); 				//size of mine stream
 
 	RecognizedFileType getFileType();	//returns file type proper for this chunk, i.e. a ("NewScummBlock" "LFLF")
@@ -125,6 +126,17 @@
 
 	bool doReadData();			//default implementation of readData()
 	bool doParseSubBlocks();	//default implementation of parseSubBlocks()
+
+	//flags accessors:
+	bool ifReadData() {
+		return _flags & READ_DATA;
+	}
+	bool ifParseSubBlocks() {
+		return _flags & PARSE_SUB_BLOCKS;
+	}
+	bool ifIsStopper() {
+		return _flags & IS_STOPPER;
+	}
 };
 
 /////////////////////////////////////////////////////////////////////////////
@@ -140,6 +152,7 @@
 	virtual scumm_blocks& rootBlocks();
 	virtual bool parse();
 
+	virtual RootScummBlock* getRootScummBlock(); //return this
 	int getScummVersion();
 	void setScummVersion(int scummVersion);
 

Modified: scummex/branches/gsoc2007-gameresbrowser/src/plugins/scumm/ScummBlockFactory.cpp
===================================================================
--- scummex/branches/gsoc2007-gameresbrowser/src/plugins/scumm/ScummBlockFactory.cpp	2007-07-13 16:20:32 UTC (rev 28056)
+++ scummex/branches/gsoc2007-gameresbrowser/src/plugins/scumm/ScummBlockFactory.cpp	2007-07-13 16:30:04 UTC (rev 28057)
@@ -44,20 +44,16 @@
 
 	ScummChunkSizeMode _sizeMode;
 
-	uint32 _size;  //read from the header
-	uint32 _dsize; //the computed data size
+	uint32 _size;	//read from the header
+	uint32 _dsize;	//the computed data size (using _size and _sizeMode)
 
-	bool _readData;			//do we want the data to be read?
-	bool _parseSubBlocks;   //do we want the subblocks to be parsed?
+	int _flags;		//see ScummBlockFlags
 
-	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) {}
+		uint32 size, uint32 dsize, int flags)
+		: _tag(tag), _sizeMode(sizeMode), _size(size), _dsize(dsize), _flags(flags) {}
+	virtual ~sbCreator() {}
 
 	virtual ScummBlock* create(ScummTag* tag, uint32 size, Common::SeekableReadStream* stream) = 0;
 
@@ -78,8 +74,8 @@
 	sbCreatorT(ScummTag* tag,
 		ScummChunkSizeMode sizeMode,
 		uint32 size, uint32 dsize,
-		bool readData, bool parseSubBlocks, bool isStopper)
-		:  sbCreator(tag, sizeMode, size, dsize, readData, parseSubBlocks, isStopper) {}
+		int flags)
+		:  sbCreator(tag, sizeMode, size, dsize, flags) {}
 
 	virtual ScummBlock* create(ScummTag* tag, uint32 size, Common::SeekableReadStream* stream) {
 		ASSERT(tag);
@@ -90,14 +86,12 @@
 				t == wxT("????") ||
 				t == wxT("??") );
 		ASSERT(stream);
-		ASSERT(_size == -1 || _size == size);
+		ASSERT(_size == (uint32)(-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;
+		block->_flags = _flags;
 		return block;
 	}
 };
@@ -132,52 +126,62 @@
 
 #include "plugin_detail.h"
 
-#define SCUMM_BLOCK(blocktype, tag, sizeMode, size, dsize, readData, parseSubBlocks, isStopper) \
+#define USE_VAR(var) var = var
+
+#define SCUMM_BLOCK(blocktype, tag, sizeMode, size, dsize, flags) \
 	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); \
+		(&GENERATE_UNIQUE_IDENTIFIER_SUB(t), sizeMode, size, dsize, flags); \
 	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) \
+	SCUMM_BLOCK(blocktype, tag, INVALID_SIZE_MODE, -1, -1, READ_DATA) \
 		static int GENERATE_UNIQUE_IDENTIFIER_SUB(parser) = \
-		GENERATE_UNIQUE_IDENTIFIER_SUB(creator).addParser(presenterGUID);
+		GENERATE_UNIQUE_IDENTIFIER_SUB(creator).addParser(presenterGUID); \
+		USE_VAR(GENERATE_UNIQUE_IDENTIFIER_SUB(parser));
 
 #define CUSTOM_BLOCK_EX(blocktype, tag, presenterGUID) \
-	SCUMM_BLOCK(blocktype, tag, INVALID_SIZE_MODE, -1, -1, false, false, false) \
+	SCUMM_BLOCK(blocktype, tag, INVALID_SIZE_MODE, -1, -1, 0) \
 	static int GENERATE_UNIQUE_IDENTIFIER_SUB(parser) = \
-	GENERATE_UNIQUE_IDENTIFIER_SUB(creator).addParser(presenterGUID);
+	GENERATE_UNIQUE_IDENTIFIER_SUB(creator).addParser(presenterGUID); \
+	USE_VAR(GENERATE_UNIQUE_IDENTIFIER_SUB(parser));
 
 #define BLOCKY_BLOCK_EX(blocktype, tag, presenterGUID) \
-	SCUMM_BLOCK(blocktype, tag, INVALID_SIZE_MODE, -1, -1, false, true, false) \
+	SCUMM_BLOCK(blocktype, tag, INVALID_SIZE_MODE, -1, -1, PARSE_SUB_BLOCKS) \
 	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);
+	GENERATE_UNIQUE_IDENTIFIER_SUB(creator).addParser(presenterGUID); \
+	USE_VAR(GENERATE_UNIQUE_IDENTIFIER_SUB(parser)); \
+	USE_VAR(GENERATE_UNIQUE_IDENTIFIER_SUB(parser2));
 
 #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) \
+	SCUMM_BLOCK(ScummBlock, tag, INVALID_SIZE_MODE, -1, -1, 0) \
 	static int GENERATE_UNIQUE_IDENTIFIER_SUB(parser) = \
-		GENERATE_UNIQUE_IDENTIFIER_SUB(creator).addParser(CoreFileTypes::binaryParserGUID());
+		GENERATE_UNIQUE_IDENTIFIER_SUB(creator).addParser(CoreFileTypes::binaryParserGUID()); \
+	USE_VAR(GENERATE_UNIQUE_IDENTIFIER_SUB(parser));
 
 #define BLOCKY_BLOCK(tag) \
-	SCUMM_BLOCK(ScummBlock, tag, INVALID_SIZE_MODE, -1, -1, false, true, false) \
+	SCUMM_BLOCK(ScummBlock, tag, INVALID_SIZE_MODE, -1, -1, PARSE_SUB_BLOCKS) \
 	static int GENERATE_UNIQUE_IDENTIFIER_SUB(parser) = \
-		GENERATE_UNIQUE_IDENTIFIER_SUB(creator).addParser(blockyBlockPresenterGUID());
+		GENERATE_UNIQUE_IDENTIFIER_SUB(creator).addParser(blockyBlockPresenterGUID()); \
+	USE_VAR(GENERATE_UNIQUE_IDENTIFIER_SUB(parser));
 
 #define BLOCKY_STOPPER(tag) \
-	SCUMM_BLOCK(ScummBlock, tag, INVALID_SIZE_MODE, -1, -1, false, true, true) \
+	SCUMM_BLOCK(ScummBlock, tag, INVALID_SIZE_MODE, -1, -1, PARSE_SUB_BLOCKS | IS_STOPPER) \
 	static int GENERATE_UNIQUE_IDENTIFIER_SUB(parser) = \
-	GENERATE_UNIQUE_IDENTIFIER_SUB(creator).addParser(blockyBlockPresenterGUID());
+	GENERATE_UNIQUE_IDENTIFIER_SUB(creator).addParser(blockyBlockPresenterGUID()); \
+	USE_VAR(GENERATE_UNIQUE_IDENTIFIER_SUB(parser));
 
 #define ROOT_BLOCK(tag) \
-	SCUMM_BLOCK(RootScummBlock, tag, TILL_END, -1, -1, false, true, false) \
+	SCUMM_BLOCK(RootScummBlock, tag, TILL_END, -1, -1, PARSE_SUB_BLOCKS) \
 		static int GENERATE_UNIQUE_IDENTIFIER_SUB(parser) = \
-		GENERATE_UNIQUE_IDENTIFIER_SUB(creator).addParser(blockyBlockPresenterGUID());
+		GENERATE_UNIQUE_IDENTIFIER_SUB(creator).addParser(blockyBlockPresenterGUID()); \
+	USE_VAR(GENERATE_UNIQUE_IDENTIFIER_SUB(parser));
 
 /////////////////////////////////////////////////////////////////////////////
 /////////////////////////////////////////////////////////////////////////////
@@ -254,25 +258,25 @@
 	//Other
 	BASIC_BLOCK("ADL ")
 	BASIC_BLOCK("AMI ")
-	SCUMM_BLOCK(ScummBlock, "DATA", TILL_END, -1, -1, false, false, false) //TODO: probably not correct
+	SCUMM_BLOCK(ScummBlock, "DATA", TILL_END, -1, -1, 0) //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
+	SCUMM_BLOCK(ScummBlock, "iMUS", TILL_END, -1, -1, PARSE_SUB_BLOCKS) //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
+	SCUMM_BLOCK(RawScummBlock, "LABN", TILL_END, -1, -1, 0) //TODO: parse it properly
+	SCUMM_BLOCK(RawScummBlock, "LB83", TILL_END, -1, -1, 0) //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
+	SCUMM_BLOCK(RawScummBlock, "MCMP", TILL_END, -1, -1, 0) //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
+	SCUMM_BLOCK(RawScummBlock, "RIFF", TILL_END, -1, -1, 0) //TODO: parse it properly
 	BASIC_BLOCK("ROL ")
 	BLOCKY_STOPPER("ROOM")
 	DATA_BLOCK(ScummIMHDBlock, "IMHD", CoreFileTypes::binaryParserGUID())

Modified: scummex/branches/gsoc2007-gameresbrowser/src/plugins/scumm/ScummBlockInfoPresenter.cpp
===================================================================
--- scummex/branches/gsoc2007-gameresbrowser/src/plugins/scumm/ScummBlockInfoPresenter.cpp	2007-07-13 16:20:32 UTC (rev 28056)
+++ scummex/branches/gsoc2007-gameresbrowser/src/plugins/scumm/ScummBlockInfoPresenter.cpp	2007-07-13 16:30:04 UTC (rev 28057)
@@ -134,8 +134,8 @@
 	_text << wxT("Offset in file: ") << toHex(block->_rootOffs) << wxEndl();
 	_text << wxT("Size: ") << block->_size << wxEndl();
 	_text << wxT("Data Size: ") << block->_dsize << wxEndl();
-	_text << wxT("Read Data: ") << (block->_readData ? wxT("true") : wxT("false")) << wxEndl();
-	_text << wxT("Parse Sub Blocks: ") << (block->_parseSubBlocks ? wxT("true") : wxT("false"))  << wxEndl();
+	_text << wxT("Read Data: ") << (block->ifReadData() ? wxT("true") : wxT("false")) << wxEndl();
+	_text << wxT("Parse Sub Blocks: ") << (block->ifParseSubBlocks() ? wxT("true") : wxT("false"))  << wxEndl();
 
 	wxString sizeMode;
 	switch(block->_sizeMode) {

Modified: scummex/branches/gsoc2007-gameresbrowser/src/plugins/scumm/ScummBlockPresenter.h
===================================================================
--- scummex/branches/gsoc2007-gameresbrowser/src/plugins/scumm/ScummBlockPresenter.h	2007-07-13 16:20:32 UTC (rev 28056)
+++ scummex/branches/gsoc2007-gameresbrowser/src/plugins/scumm/ScummBlockPresenter.h	2007-07-13 16:30:04 UTC (rev 28057)
@@ -21,10 +21,10 @@
 // easier.
 
 struct FileNScummBlock {
+	IFile* _ifile;
 	bool _ownIFile;
-	IFile* _ifile;
+	ScummBlock* _block;
 	bool _ownBlock;
-	ScummBlock* _block;
 
 	FileNScummBlock(IFile* ifile, bool ownIFile, ScummBlock* block, bool ownBlock)
 		: _ifile(ifile), _ownIFile(ownIFile), _block(block), _ownBlock(ownBlock) {}


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