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

zbychs at users.sourceforge.net zbychs at users.sourceforge.net
Sun Jul 15 02:41:32 CEST 2007


Revision: 28081
          http://scummvm.svn.sourceforge.net/scummvm/?rev=28081&view=rev
Author:   zbychs
Date:     2007-07-14 17:41:31 -0700 (Sat, 14 Jul 2007)

Log Message:
-----------
Small additions to the scumm presenters.
Better configure script.

Modified Paths:
--------------
    scummex/branches/gsoc2007-gameresbrowser/configure.ac
    scummex/branches/gsoc2007-gameresbrowser/globalDefines
    scummex/branches/gsoc2007-gameresbrowser/src/browser/GUIInterfaces.h
    scummex/branches/gsoc2007-gameresbrowser/src/browserapp/Makefile.am
    scummex/branches/gsoc2007-gameresbrowser/src/browserapp/Test2.cpp
    scummex/branches/gsoc2007-gameresbrowser/src/plugins/basic/DirectoryPresenter.cpp
    scummex/branches/gsoc2007-gameresbrowser/src/plugins/scumm/Makefile.am
    scummex/branches/gsoc2007-gameresbrowser/src/plugins/scumm/ScummBlock.cpp
    scummex/branches/gsoc2007-gameresbrowser/src/plugins/scumm/ScummBlockFactory.cpp
    scummex/branches/gsoc2007-gameresbrowser/src/plugins/scumm/ScummBlockPresenter.cpp
    scummex/branches/gsoc2007-gameresbrowser/src/plugins/scumm/ScummFileTypes.cpp
    scummex/branches/gsoc2007-gameresbrowser/src/plugins/scumm/ScummFileTypes.h
    scummex/branches/gsoc2007-gameresbrowser/src/plugins/scumm/ScummParser.cpp
    scummex/branches/gsoc2007-gameresbrowser/src/plugins/scumm/scumm_plugin.cpp
    scummex/branches/gsoc2007-gameresbrowser/vc8/scumm_plugin/scumm_plugin.vcproj

Added Paths:
-----------
    scummex/branches/gsoc2007-gameresbrowser/src/plugins/scumm/ScummCommonPresenters.cpp
    scummex/branches/gsoc2007-gameresbrowser/src/plugins/scumm/ScummCommonPresenters.h
    scummex/branches/gsoc2007-gameresbrowser/src/plugins/scumm/ScummPresenterBase.cpp
    scummex/branches/gsoc2007-gameresbrowser/src/plugins/scumm/ScummPresenterBase.h
    scummex/branches/gsoc2007-gameresbrowser/src/plugins/scumm/ScummSpecificPresenters.cpp
    scummex/branches/gsoc2007-gameresbrowser/src/plugins/scumm/ScummSpecificPresenters.h
    scummex/branches/gsoc2007-gameresbrowser/src/plugins/scumm/ScummSpecificPresenters2.cpp
    scummex/branches/gsoc2007-gameresbrowser/src/plugins/scumm/ScummSpecificPresenters2.h

Removed Paths:
-------------
    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/ScummImage.cpp

Property Changed:
----------------
    scummex/branches/gsoc2007-gameresbrowser/vc8/
    scummex/branches/gsoc2007-gameresbrowser/vc8/basic_plugin/
    scummex/branches/gsoc2007-gameresbrowser/vc8/browser/
    scummex/branches/gsoc2007-gameresbrowser/vc8/browserapp/
    scummex/branches/gsoc2007-gameresbrowser/vc8/core/
    scummex/branches/gsoc2007-gameresbrowser/vc8/scumm_plugin/

Modified: scummex/branches/gsoc2007-gameresbrowser/configure.ac
===================================================================
--- scummex/branches/gsoc2007-gameresbrowser/configure.ac	2007-07-14 21:52:26 UTC (rev 28080)
+++ scummex/branches/gsoc2007-gameresbrowser/configure.ac	2007-07-15 00:41:31 UTC (rev 28081)
@@ -3,25 +3,49 @@
 
 AM_INIT_AUTOMAKE([-Wall -Werror foreign])
 
-AC_ARG_ENABLE(debug,
-[  --enable-debug    Turn on debugging],
+AC_ARG_ENABLE([debug],
+	[AS_HELP_STRING([--disable-debug],
+	[don't define _DEBUG during build])],
 [case "${enableval}" in
   yes) debug=true ;;
   no)  debug=false ;;
   *) AC_MSG_ERROR(bad value ${enableval} for --enable-debug) ;;
-esac],[debug=false])
+esac],[debug=true])
 AM_CONDITIONAL(DO_DEBUG, test x$debug = xtrue)
+#AM_CONDITIONAL(NO_DEBUG, test x$debug = xfalse)
 
-AC_ARG_ENABLE(unicode,
-[  --disable-unicode    Turn off unicode],
+AC_ARG_ENABLE([unicode],
+	[AS_HELP_STRING([--enable-unicode],
+	[turn on unicode])],
 [case "${enableval}" in
   yes) unicode=true ;;
   no)  unicode=false ;;
   *) AC_MSG_ERROR(bad value ${enableval} for --enable-unicode) ;;
-esac],[unicode=true])
+esac],[unicode=notset])
 AM_CONDITIONAL(DO_UNICODE, test x$unicode = xtrue)
+AM_CONDITIONAL(NO_UNICODE, test x$unicode = xfalse)
 
+AC_ARG_ENABLE([wxdebug],
+	[AS_HELP_STRING([--enable-wxdebug],
+	[use debug version of wxWidgets])],
+[case "${enableval}" in
+  yes) wxdebug=true ;;
+  no)  wxdebug=false ;;
+  *) AC_MSG_ERROR(bad value ${enableval} for --enable-wxdebug) ;;
+esac],[wxdebug=notset])
+AM_CONDITIONAL(DO_WXDEBUG, test x$wxdebug = xtrue)
+AM_CONDITIONAL(NO_WXDEBUG, test x$wxdebug = xfalse)
 
+AC_ARG_WITH([wxversion],
+            [AS_HELP_STRING([--with-wxversion=2.8],
+              [give a specific wxWidgets version])],
+            [],
+            [with_wxversion=notset])
+
+AS_IF([test "x$with_wxversion" != xnotset],
+            [AC_SUBST([WX_VERSION_OPT], ["--version=$with_wxversion"])],
+	    [])
+
 AC_PROG_CXX
 AC_PROG_RANLIB
 AC_CONFIG_HEADERS([config.h])

Modified: scummex/branches/gsoc2007-gameresbrowser/globalDefines
===================================================================
--- scummex/branches/gsoc2007-gameresbrowser/globalDefines	2007-07-14 21:52:26 UTC (rev 28080)
+++ scummex/branches/gsoc2007-gameresbrowser/globalDefines	2007-07-15 00:41:31 UTC (rev 28081)
@@ -1,25 +1,24 @@
 ###########################################################################################
 
-if DO_DEBUG
-    WX_DEBUG = yes
-else
-    WX_DEBUG = no
+if DO_WXDEBUG
+    WX_DEBUG = --debug=yes
 endif
+if NO_WXDEBUG
+    WX_DEBUG = --debug=no
+endif
 
-#below defining or not defining _UNICODE is only for sanity
-#wxWidgets redefines _UNICODE anyway
 if DO_UNICODE
-    WX_UNICODE = yes
+    WX_UNICODE = --unicode=yes
     UNICODE = _UNICODE
-else
-    WX_UNICODE = no
-    UNICODE =
 endif
+if NO_UNICODE
+    WX_UNICODE = --unicode=no
+    UNICODE = 
+endif
 
-WX_VERSION = 2.8
 WX_CONFIG = wx-config
 #WX_CONFIG = /usr/bin/wx-config
-WX_OPTS = --version=$(WX_VERSION) --debug=$(WX_DEBUG) --unicode=$(WX_UNICODE)
+WX_OPTS = $(WX_VERSION_OPT) $(WX_DEBUG) $(WX_UNICODE)
 WX_FLAGS = $(shell $(WX_CONFIG) $(WX_OPTS) --cxxflags)
 WX_LIBS = $(shell $(WX_CONFIG) $(WX_OPTS) --libs)
 
@@ -36,7 +35,8 @@
 
 ###########################################################################################
 
-BASE_FLAGS = -g -Wall -fno-strict-aliasing $(patsubst %, -D%, $(GLOBAL_DEFINES) )
+#-Wall -fno-strict-aliasing
+BASE_FLAGS = -g $(patsubst %, -D%, $(GLOBAL_DEFINES) )
 AM_CXXFLAGS = $(BASE_FLAGS) $(WX_FLAGS)
 
 AM_CPPFLAGS = -I$(top_srcdir)/src/core -I$(top_srcdir)/src/browser -I$(top_srcdir)/src/plugins -I$(top_srcdir)/src/plugins/basic -I$(top_srcdir)/src/plugins/scumm

Modified: scummex/branches/gsoc2007-gameresbrowser/src/browser/GUIInterfaces.h
===================================================================
--- scummex/branches/gsoc2007-gameresbrowser/src/browser/GUIInterfaces.h	2007-07-14 21:52:26 UTC (rev 28080)
+++ scummex/branches/gsoc2007-gameresbrowser/src/browser/GUIInterfaces.h	2007-07-15 00:41:31 UTC (rev 28081)
@@ -6,7 +6,7 @@
 
 #include "BObject.h"
 
-class wxImage;
+#include <wx/image.h>
 
 namespace Browser {
 

Modified: scummex/branches/gsoc2007-gameresbrowser/src/browserapp/Makefile.am
===================================================================
--- scummex/branches/gsoc2007-gameresbrowser/src/browserapp/Makefile.am	2007-07-14 21:52:26 UTC (rev 28080)
+++ scummex/branches/gsoc2007-gameresbrowser/src/browserapp/Makefile.am	2007-07-15 00:41:31 UTC (rev 28081)
@@ -1,8 +1,71 @@
 include $(top_srcdir)/globalDefines
 
-LDADD = ../core/libcore.a ../browser/libbrowser.a ../plugins/basic/libbasic.a ../plugins/scumm/libscumm.a \
-	../browser/wx2scstream.o ../core/tostring.o ../browser/xorstream.o ../browser/GUIInterfaces.o
-AM_LDFLAGS = $(WX_LIBS)
+#LDADD = ../core/libcore.a ../browser/libbrowser.a ../plugins/basic/libbasic.a ../plugins/scumm/libscumm.a \
+LDADD = \
+	../core/BObject.o \
+	../core/ObjectChain.o \
+	../core/ObjectRegistry.o \
+	../core/core.o \
+	../core/core_stdafx.o \
+	../core/guid.o \
+	../core/pinslot.o \
+	../core/rcobject.o \
+	../core/safe_static.o \
+	../core/tostring.o \
+	\
+	../browser/CoreFileTypes.o \
+	../browser/CoreInterfaces.o \
+	../browser/Directories.o \
+	../browser/ExplorationTree.o \
+	../browser/FileTypeRecognizer.o \
+	../browser/FileTypeRegistry.o \
+	../browser/GUIInterfaces.o \
+	../browser/PanelProvider.o \
+	../browser/PluginUtil.o \
+	../browser/VirtualNode.o \
+	../browser/browser.o \
+	../browser/browser_stdafx.o \
+	../browser/streams/simplefile.o \
+	../browser/streams/stream.o \
+	../browser/streams/wx2scstream.o \
+	../browser/streams/xorstream.o \
+	\
+	../plugins/basic/AuxInterfaces.o \
+	../plugins/basic/BasicParsers.o \
+	../plugins/basic/BitmapPanel.o \
+	../plugins/basic/DirectoryPresenter.o \
+	../plugins/basic/DiskFileProvider.o \
+	../plugins/basic/FileInfoPresenter.o \
+	../plugins/basic/HtmlPresenter.o \
+	../plugins/basic/ImagePresenter.o \
+	../plugins/basic/TextPresenter.o \
+	../plugins/basic/IconPresenter.o \
+	../plugins/basic/basic_plugin.o \
+	../plugins/basic/basic_stdafx.o \
+	\
+	../plugins/scumm/BlockyBlockPresenter.o \
+	../plugins/scumm/ScummBlock.o \
+	../plugins/scumm/ScummBlockFactory.o \
+	../plugins/scumm/ScummBlockPresenter.o \
+	../plugins/scumm/ScummPresenterBase.o \
+	../plugins/scumm/ScummCommonPresenters.o \
+	../plugins/scumm/ScummSpecificPresenters.o \
+	../plugins/scumm/ScummSpecificPresenters2.o \
+	../plugins/scumm/ScummFileTypes.o \
+	../plugins/scumm/ScummParser.o \
+	../plugins/scumm/ScummRecognizer.o \
+	../plugins/scumm/ScummResource.o \
+	../plugins/scumm/ScummTag.o \
+	../plugins/scumm/bomp.o \
+	../plugins/scumm/codec37.o \
+	../plugins/scumm/codec47.o \
+	../plugins/scumm/descumm.o \
+	../plugins/scumm/descumm6.o \
+	../plugins/scumm/scaler.o \
+	../plugins/scumm/scumm_plugin.o \
+	../plugins/scumm/scumm_stdafx.o
+
+bin_LDFLAGS = $(WX_LIBS)
 bin_PROGRAMS = browserapp
 browserapp_SOURCES = \
 	BrowserApp.cpp \

Modified: scummex/branches/gsoc2007-gameresbrowser/src/browserapp/Test2.cpp
===================================================================
--- scummex/branches/gsoc2007-gameresbrowser/src/browserapp/Test2.cpp	2007-07-14 21:52:26 UTC (rev 28080)
+++ scummex/branches/gsoc2007-gameresbrowser/src/browserapp/Test2.cpp	2007-07-15 00:41:31 UTC (rev 28081)
@@ -42,7 +42,9 @@
 #include "scumm/ScummRecognizer.h"
 #include "scumm/ScummParser.h"
 #include "scumm/ScummBlockPresenter.h"
-#include "scumm/ScummBlockInfoPresenter.h"
+#include "scumm/ScummCommonPresenters.h"
+#include "scumm/ScummSpecificPresenters.h"
+#include "scumm/ScummSpecificPresenters2.h"
 #include "scumm/BlockyBlockPresenter.h"
 
 #include "debugmem.h"
@@ -92,6 +94,12 @@
 
 	PLUGGED_OBJECT(ScummScriptBlockPresenter)	
 
+	PLUGGED_OBJECT(ScummRNAMBlockPresenter)	
+	PLUGGED_OBJECT(ScummMAXSBlockPresenter)	
+	PLUGGED_OBJECT(ScummDOBJBlockPresenter)	
+	PLUGGED_OBJECT(ScummANAMBlockPresenter)	
+	PLUGGED_OBJECT(ScummDIRBlockPresenter)	
+
 PLUGIN_END
 
 /////////////////////////////////////////////////////////////////////////////

Modified: scummex/branches/gsoc2007-gameresbrowser/src/plugins/basic/DirectoryPresenter.cpp
===================================================================
--- scummex/branches/gsoc2007-gameresbrowser/src/plugins/basic/DirectoryPresenter.cpp	2007-07-14 21:52:26 UTC (rev 28080)
+++ scummex/branches/gsoc2007-gameresbrowser/src/plugins/basic/DirectoryPresenter.cpp	2007-07-15 00:41:31 UTC (rev 28081)
@@ -90,7 +90,7 @@
 			break;
 		RCPtr<BObject> parser = ObjectRegistry::get()->getObject( *(*i) );
 		if (parser.get() == NULL) {
-			errout << wxT("ERROR: DirectoryPresenter::prepareKidChain(): can't create parser: ") << (*i) << std::endl;
+			errout << wxT("ERROR: DirectoryPresenter::prepareKidChain(): can't create parser: ") << *(*i) << std::endl;
 			addingOk = false;
 			break;
 		}

Modified: scummex/branches/gsoc2007-gameresbrowser/src/plugins/scumm/Makefile.am
===================================================================
--- scummex/branches/gsoc2007-gameresbrowser/src/plugins/scumm/Makefile.am	2007-07-14 21:52:26 UTC (rev 28080)
+++ scummex/branches/gsoc2007-gameresbrowser/src/plugins/scumm/Makefile.am	2007-07-15 00:41:31 UTC (rev 28081)
@@ -9,13 +9,18 @@
 	ScummBlock.h \
 	ScummBlockFactory.cpp \
 	ScummBlockFactory.h \
-	ScummBlockInfoPresenter.cpp \
-	ScummBlockInfoPresenter.h \
 	ScummBlockPresenter.cpp \
 	ScummBlockPresenter.h \
+	ScummPresenterBase.cpp \
+	ScummPresenterBase.h \
+	ScummCommonPresenters.cpp \
+	ScummCommonPresenters.h \
+	ScummSpecificPresenters.cpp \
+	ScummSpecificPresenters.h \
+	ScummSpecificPresenters2.cpp \
+	ScummSpecificPresenters2.h \
 	ScummFileTypes.cpp \
 	ScummFileTypes.h \
-	ScummImage.cpp \
 	ScummImageDetail.h \
 	ScummParser.cpp \
 	ScummParser.h \

Modified: scummex/branches/gsoc2007-gameresbrowser/src/plugins/scumm/ScummBlock.cpp
===================================================================
--- scummex/branches/gsoc2007-gameresbrowser/src/plugins/scumm/ScummBlock.cpp	2007-07-14 21:52:26 UTC (rev 28080)
+++ scummex/branches/gsoc2007-gameresbrowser/src/plugins/scumm/ScummBlock.cpp	2007-07-15 00:41:31 UTC (rev 28081)
@@ -231,6 +231,7 @@
 
 	switch (_sizeMode) {
 		case HEADER_INCLUDED:
+			ASSERT(_size >= hsize);
 			outSize = _size - hsize;
 			return true;
 

Modified: scummex/branches/gsoc2007-gameresbrowser/src/plugins/scumm/ScummBlockFactory.cpp
===================================================================
--- scummex/branches/gsoc2007-gameresbrowser/src/plugins/scumm/ScummBlockFactory.cpp	2007-07-14 21:52:26 UTC (rev 28080)
+++ scummex/branches/gsoc2007-gameresbrowser/src/plugins/scumm/ScummBlockFactory.cpp	2007-07-15 00:41:31 UTC (rev 28081)
@@ -255,6 +255,30 @@
 	CUSTOM_BLOCK("EX", scummScriptBlockPresenterGUID())
 	CUSTOM_BLOCK("OC", scummScriptBlockPresenterGUID())
 
+	//Directories
+	CUSTOM_BLOCK("DOBJ", scummDOBJBlockPresenterGUID())
+	CUSTOM_BLOCK("0O",   scummDOBJBlockPresenterGUID())
+	CUSTOM_BLOCK("ANAM", scummANAMBlockPresenterGUID())
+
+	CUSTOM_BLOCK("DROO", scummDIRBlockPresenterGUID())
+	CUSTOM_BLOCK("0R",   scummDIRBlockPresenterGUID())
+	CUSTOM_BLOCK("DSCR", scummDIRBlockPresenterGUID())
+	CUSTOM_BLOCK("0S",   scummDIRBlockPresenterGUID())
+	CUSTOM_BLOCK("DSOU", scummDIRBlockPresenterGUID())
+	CUSTOM_BLOCK("0N",   scummDIRBlockPresenterGUID())
+	CUSTOM_BLOCK("DCOS", scummDIRBlockPresenterGUID())
+	CUSTOM_BLOCK("0C",   scummDIRBlockPresenterGUID())
+	CUSTOM_BLOCK("DCHR", scummDIRBlockPresenterGUID())
+	CUSTOM_BLOCK("DRSC", scummDIRBlockPresenterGUID())
+
+	CUSTOM_BLOCK("LOFF", scummLOFFBlockPresenterGUID())
+	CUSTOM_BLOCK("OFFS", scummOFFSBlockPresenterGUID())
+
+	//Infos
+	CUSTOM_BLOCK("RNAM", scummRNAMBlockPresenterGUID())
+	CUSTOM_BLOCK("RN", scummRNAMBlockPresenterGUID())
+	CUSTOM_BLOCK("MAXS", scummMAXSBlockPresenterGUID())
+
 	//Other
 	BASIC_BLOCK("ADL ")
 	BASIC_BLOCK("AMI ")
@@ -269,11 +293,9 @@
 	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, 0) //TODO: parse it properly
 	BASIC_BLOCK("MIDI")
-	CUSTOM_BLOCK("OFFS", scummOFFSBlockPresenterGUID())
 
 	BLOCKY_BLOCK("PALS")
 	SCUMM_BLOCK(RawScummBlock, "RIFF", TILL_END, -1, -1, 0) //TODO: parse it properly
@@ -288,6 +310,7 @@
 	CUSTOM_BLOCK("TRNS", scummTRNSBlockPresenterGUID())
 
 	BLOCKY_BLOCK("WRAP") //FIXME: Is this ok? Shouldn't the OFFS subblock be used here?
+	//BLOCKY_BLOCK("SOUN") //This not ok.
 
 	BLOCKY_BLOCK("PALS")
 	BLOCKY_BLOCK("OBCD")

Deleted: scummex/branches/gsoc2007-gameresbrowser/src/plugins/scumm/ScummBlockInfoPresenter.cpp
===================================================================
--- scummex/branches/gsoc2007-gameresbrowser/src/plugins/scumm/ScummBlockInfoPresenter.cpp	2007-07-14 21:52:26 UTC (rev 28080)
+++ scummex/branches/gsoc2007-gameresbrowser/src/plugins/scumm/ScummBlockInfoPresenter.cpp	2007-07-15 00:41:31 UTC (rev 28081)
@@ -1,521 +0,0 @@
-/////////////////////////////////////////////////////////////////////////////
-// ScummBlockPresenter.cpp
-
-#include "scumm_stdafx.h"
-
-#include "scumm/ScummResource.h"
-#include "scumm/ScummBlockInfoPresenter.h"
-#include "scumm/ScummBlockPresenter.h"
-#include "scumm/descumm.h"
-
-#include "CoreInterfaces.h"
-#include "PluginUtil.h"
-
-#include <iostream>
-
-#include "debugmem.h"
-
-namespace Browser {
-
-using namespace Core;
-
-/////////////////////////////////////////////////////////////////////////////
-/////////////////////////////////////////////////////////////////////////////
-
-wxString toHex(uint32 num, int digits = 8) {
-	return wxString::Format(wxString::Format(wxT("%%0%dX"), digits), num);
-}
-
-/////////////////////////////////////////////////////////////////////////////
-/////////////////////////////////////////////////////////////////////////////
-
-SLOT_DESCS(ScummBlockPresenterBase)
-	SLOT_DESC(_blockSlot, SLOT_DEFAULT)
-END_DESCS
-
-void ScummBlockPresenterBase::create() {
-	//infoout << wxT("ScummBlockPresenterBase::create(): ") << std::endl;
-	if(_created)
-		return;
-	_created = true;
-
-	IProvider<FileNScummBlock>* iprov = _blockSlot->getInterface();
-	if (!iprov) {
-		errout << wxT("ScummBlockPresenterBase::create(): could not get IProvider<FileNScummBlock> interface") << std::endl;
-		return;
-	}
-
-	ASSERT(iprov->getData());
-	ScummBlock* block = iprov->getData()->getBlock();
-
-	if (!block) {
-		errout << wxT("ScummBlockPresenterBase::create(): NULL block") << std::endl;
-		_blockSlot->releaseInterface();
-		return;
-	}
-
-	uint32 hsize;
-	if (!block->determineHeaderSize(hsize)) {
-		errout << wxT("ScummBlockInfoPresenterBase::create(): could not determine header size") << std::endl;
-		_blockSlot->releaseInterface();
-		return;
-	}
-
-	ScummTag* tag = block->getTag();
-	ASSERT(tag);
-	_title = tag->toString();
-
-	Common::SeekableReadStream* stream = block->getStream();
-	ASSERT(stream);
-
-	stream->seek(hsize, SEEK_SET);
-
-	inCreate(block, stream);
-
-	_blockSlot->releaseInterface();
-}
-
-/////////////////////////////////////////////////////////////////////////////
-/////////////////////////////////////////////////////////////////////////////
-
-PIN_DESCS(ScummBlockInfoPresenterBase)
-	PIN_DESC_r(_textPin, PIN_DEFAULT | PIN_MULTICAST, getTextImpl, ITextImpl)
-END_DESCS
-
-
-void ScummBlockInfoPresenterBase::inCreate(ScummBlock* block, Common::SeekableReadStream* stream) {
-	//infoout << wxT("ScummBlockInfoPresenterBase::inCreate(): ") << std::endl;
-	doCreate(block, stream);
-}
-
-ITextImpl* ScummBlockInfoPresenterBase::getTextImpl() {
-	//infoout << wxT("ScummBlockInfoPresenterBase::getTextImpl(): ") << std::endl;
-	create();
-	if (_text.IsEmpty())
-		return new ITextImpl(wxT("ERROR"), wxT("no info to display"));
-	return new ITextImpl(_title, _text, _monospace);
-}
-
-/////////////////////////////////////////////////////////////////////////////
-/////////////////////////////////////////////////////////////////////////////
-
-PIN_DESCS(ScummBlockImagePresenter)
-	PIN_DESC_r(_imagePin, PIN_DEFAULT | PIN_MULTICAST, getImageImpl, IImageImpl)
-END_DESCS
-
-
-void ScummBlockImagePresenter::inCreate(ScummBlock* block, Common::SeekableReadStream* stream) {
-	//infoout << wxT("ScummBlockImagePresenter::inCreate(): ") << std::endl;
-	doCreate(block, stream);
-}
-
-IImageImpl* ScummBlockImagePresenter::getImageImpl() {
-	//infoout << wxT("ScummBlockImagePresenter::getImageImpl(): ") << std::endl;
-	create();
-	return new IImageImpl(/*_title,*/ &_image, false);
-}
-
-/////////////////////////////////////////////////////////////////////////////
-/////////////////////////////////////////////////////////////////////////////
-
-PIN_DESCS(ScummBlockInfoPresenter)
-	PIN_DESC_r(_urlPin, PIN_DEFAULT | PIN_MULTICAST, getUrlImpl, IUrlImpl)
-	PIN_DESC_r(_iconPin, PIN_DEFAULT | PIN_MULTICAST, getIconImpl, IIconImpl)
-END_DESCS
-
-void ScummBlockInfoPresenter::doCreate(ScummBlock* block, Common::SeekableReadStream* stream) {
-	//infoout << wxT("ScummBlockInfoPresenter::doCreate(): ") << std::endl;
-	ScummTag* tag = block->getTag();
-	ASSERT(tag);
-
-	_title = wxT("Block Info");
-
-	_text = wxT("");
-	_text << wxT("Block type: ") << _title << wxEndl();
-	_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->ifReadData() ? wxT("true") : wxT("false")) << wxEndl();
-	_text << wxT("Parse Sub Blocks: ") << (block->ifParseSubBlocks() ? wxT("true") : wxT("false"))  << wxEndl();
-
-	wxString sizeMode;
-	switch(block->_sizeMode) {
-		case INVALID_SIZE_MODE:
-			sizeMode = wxT("INVALID_SIZE_MODE"); break;
-		case HEADER_INCLUDED:
-			sizeMode = wxT("HEADER_INCLUDED"); break;
-		case HEADER_NOT_INCLUDED:
-			sizeMode = wxT("HEADER_NOT_INCLUDED"); break;
-		case HEADER_NOT_INCLUDED_MINUS_ONE:
-			sizeMode = wxT("HEADER_NOT_INCLUDED_MINUS_ONE"); break;
-		case ENTRY_BASED:
-			sizeMode = wxT("ENTRY_BASED"); break;
-		case TILL_END: 
-			sizeMode = wxT("TILL_END"); break;
-		default:
-			sizeMode = wxT("ERROR: bad size mode"); break;
-	}
-	_text << wxT("Size mode: ") << sizeMode << wxEndl();
-
-	//_text << wxT("Parsed: ") << (block->_parsed ? wxT("true") : wxT("false"))  << wxEndl();
-	_text << wxEndl();
-
-	const blockInfo* binfo = getBlockInfo(*tag);
-	if (binfo) {
-		_text << wxT("Description: ") << binfo->description << wxEndl();
-		_text << wxT("Help file: ") << binfo->htmlfile << wxEndl();
-		_text << wxT("Icon number: ") << binfo->iconid << wxEndl();
-		_url = toString(binfo->htmlfile);
-		if (!_url.IsEmpty())
-		    _url = PluginUtil::getResourcePath(_url);
-		_icon = binfo->iconid;
-	} else {
-		_text << wxT("Could not find block info.") << wxEndl();
-		_url = wxT("");
-		_icon = -1;
-	}
-}
-
-IUrlImpl* ScummBlockInfoPresenter::getUrlImpl() {
-	//infoout << wxT("ScummBlockInfoPresenter::getUrlImpl(): ") << std::endl;
-	create();
-	if (_text.IsEmpty()) //empty _text marks invalid data
-		return new IUrlImpl(wxT("No help"));
-	if (_url.IsEmpty())
-		return new IUrlImpl(wxT("No help"));
-	return new IUrlImpl(wxT("Help"), _url);
-}
-
-IIconImpl* ScummBlockInfoPresenter::getIconImpl() {
-	//infoout << wxT("ScummBlockInfoPresenter::getIconImpl(): ") << std::endl;
-	create();
-	return new IIconImpl(_icon);
-}
-
-/////////////////////////////////////////////////////////////////////////////
-/////////////////////////////////////////////////////////////////////////////
-
-void ScummEntryBlockPresenter::determineNumEntries(ScummBlock* block, Common::SeekableReadStream* stream) {
-	switch(_countMode) {
-		case ENTRY_COUNT_MODE_BYTE:
-			_numEntries = stream->readByte();
-			break;
-		case ENTRY_COUNT_MODE_INT32BE:
-			_numEntries = stream->readUint32BE();
-			break;
-		case ENTRY_COUNT_MODE_INT32LE:
-			_numEntries = stream->readUint32LE();
-			break;
-		case ENTRY_COUNT_MODE_CUSTOM:
-			{
-			uint32 p = stream->pos();
-			uint32 s = stream->size();
-			_numEntries = (s - p) / _customEntrySize;
-			}
-			break;
-		case ENTRY_COUNT_MODE_FIXED:
-			//use current _numEntries
-			break;
-		default:
-			errout << wxT("ScummEntryBlockPresenter::determineNumEntries(): invalid count mode") << std::endl;
-			_numEntries = 0;
-			break;
-	}
-}
-
-void ScummEntryBlockPresenter::doCreate(ScummBlock* block, Common::SeekableReadStream* stream) {
-	//infoout << wxT("ScummEntryBlockPresenter::doCreate(): ") << std::endl;
-
-	determineNumEntries(block, stream);
-
-	_text = doPreEntries(block, stream);
-	for (uint32 i = 0; i < _numEntries; ++i) {
-		_text += doReadEntry(block, i, stream);
-	}
-	_text += doPostEntries(block, stream);
-}
-
-/////////////////////////////////////////////////////////////////////////////
-/////////////////////////////////////////////////////////////////////////////
-
-wxString ScummLOFFBlockPresenter::doPreEntries(ScummBlock* block, Common::SeekableReadStream* stream) {
-	return wxString::Format(wxT("Number of rooms: %d\n\n"), _numEntries);
-}
-
-wxString ScummLOFFBlockPresenter::doReadEntry(ScummBlock* block, uint32 idx, Common::SeekableReadStream* stream) {
-	//infoout << wxT("ScummLOFFBlockPresenter::doReadEntry(): ") << std::endl;
-
-	byte roomNumber = stream->readByte();
-	uint32 offset = stream->readUint32LE();
-
-	wxString txt;
-	txt << wxT("Room Number: ") << roomNumber << wxEndl();
-	txt << wxT("Offset: ") << toHex(offset) << wxEndl();
-	return txt;
-}
-
-/////////////////////////////////////////////////////////////////////////////
-/////////////////////////////////////////////////////////////////////////////
-
-wxString ScummOFFSBlockPresenter::doPreEntries(ScummBlock* block, Common::SeekableReadStream* stream) {
-	return wxString::Format(wxT("Number of offsets: %d\n\n"), _numEntries);
-}
-
-wxString ScummOFFSBlockPresenter::doReadEntry(ScummBlock* block, uint32 idx, Common::SeekableReadStream* stream) {
-	//infoout << wxT("ScummLOFFBlockPresenter::doReadEntry(): ") << std::endl;
-
-	uint32 offset = stream->readUint32LE();
-
-	wxString txt;
-	txt << wxT("Offset: ") << toHex(offset) << wxEndl();
-	return txt;
-}
-
-/////////////////////////////////////////////////////////////////////////////
-/////////////////////////////////////////////////////////////////////////////
-
-void ScummRMHDBlockPresenter::doCreate(ScummBlock* block, Common::SeekableReadStream* stream) {
-	//infoout << wxT("ScummRMHDBlockPresenter::doCreate(): ") << std::endl;
-
-	uint32 width = stream->readUint16LE();
-	uint32 height = stream->readUint16LE();
-	uint32 objs = stream->readUint16LE();
-
-	wxString txt;
-	txt << wxT("Room Width: ") << width << wxEndl();
-	txt << wxT("Room Height: ") << height << wxEndl();
-	txt << wxT("Number Of Objects: ") << objs << wxEndl();
-	_text = txt;
-}
-
-/////////////////////////////////////////////////////////////////////////////
-/////////////////////////////////////////////////////////////////////////////
-
-void ScummTRNSBlockPresenter::doCreate(ScummBlock* block, Common::SeekableReadStream* stream) {
-	//infoout << wxT("ScummTRNSBlockPresenter::doCreate(): ") << std::endl;
-
-	uint32 transparentColor = stream->readUint16LE();
-
-	wxString txt;
-	txt << wxT("Transparent Color: ") << transparentColor << wxEndl();
-	_text = txt;
-}
-
-/////////////////////////////////////////////////////////////////////////////
-/////////////////////////////////////////////////////////////////////////////
-// taken from ScummEX
-
-int _getScummVersionDialog() {
-	int choice;
-	wxString games[22] = {
-	wxT("Maniac Mansion (C64)"),
-	wxT("Maniac Mansion (PC)"),
-	wxT("Zak McKracken"),
-	wxT("Zak McKracken (FM Towns)"),
-	wxT("Indiana Jones & The Last Crusade"),
-	wxT("Sampler (Loom, Indy3, SOMI)"),
-	wxT("The Secret of Monkey Island (Demo)"),
-	wxT("The Secret of Monkey Island (EGA)"),
-	wxT("The Secret of Monkey Island"),
-	wxT("Loom"),
-	wxT("Loom (CD)"),
-	wxT("Monkey Island 2: LeChuck's Revenge"),
-	wxT("Indiana Jones & The Fate of Atlantis"),
-	wxT("Day of the Tentacle"),
-	wxT("Sam & Max Hit The Road (Demo)"),
-	wxT("Sam & Max Hit The Road (Mac demo)"),
-	wxT("Sam & Max Hit The Road (Disk)"),
-	wxT("Sam & Max Hit The Road (CD)"),
-	wxT("Full Throttle"),
-	wxT("The Dig"),
-	wxT("The Dig (Win95)"),
-	wxT("The Curse of Monkey Island")
-	};
-	
-	wxSingleChoiceDialog *dialog = new wxSingleChoiceDialog(PluginUtil::getMainForm(), wxT("Please select the correct game"), wxT("Scumm version selection"), 22, games, NULL, wxOK|wxCANCEL|wxCENTRE, wxDefaultPosition);
-	int ret = -1;
-	if (dialog->ShowModal() == wxID_OK) {
-		choice = dialog->GetSelection();
-		switch (choice) {
-			case 0:
-				ret = 1;
-				break;
-			case 1:
-			case 2:
-				ret = 2;
-				break;
-			case 3:
-			case 4:
-			case 9:
-				ret = 3;
-				break;
-			case 5:
-			case 6:
-			case 7:
-				ret = 4;
-				break;
-			case 8:
-			case 10:
-			case 11:
-			case 12:
-				ret = 5;
-				break;
-			case 13:
-			case 14:
-			case 16:
-				ret = 6;
-				break;
-			case 17:
-			case 18:
-			case 19:
-				ret = 7;
-				break;
-			case 20:
-			case 21:
-				ret = 8;
-				break;
-		}
-	}
-	dialog->Destroy();
-	return ret;
-}
-
-void ScummScriptBlockPresenter::doCreate(ScummBlock* block, Common::SeekableReadStream* stream) {
-	//infoout << wxT("ScummScriptBlockPresenter::doCreate(): ") << std::endl;
-
-	_monospace = true;
-	_title = wxT("Script");
-
-	RootScummBlock* rootBlock = block->getRootScummBlock();
-	ASSERT(rootBlock);
-
-	int scummVersion = rootBlock->getScummVersion();
-	if (scummVersion == -1)
-		scummVersion = _getScummVersionDialog();
-	if (scummVersion != -1) {
-		rootBlock->setScummVersion(scummVersion);
-
-		Common::SeekableReadStream* stream = block->getStream();
-		stream->seek(0, SEEK_SET);
-		DeScumm descumm(*stream, stream->size(), scummVersion);
-
-		_text = descumm.getText();
-		if (_text.IsEmpty())
-			_text = wxT("<Empty script>");
-	} else {
-		if (_text.IsEmpty())
-			_text = wxT("<Unknown Scumm Version>");
-	}
-}
-
-/////////////////////////////////////////////////////////////////////////////
-/////////////////////////////////////////////////////////////////////////////
-
-void ScummPALBlockPresenter::doCreate(ScummBlock* block, Common::SeekableReadStream* stream) {
-	//infoout << wxT("ScummPALBlockPresenter::doCreate(): ") << std::endl;
-
-	ScummPALBlock* palBlock = dynamic_cast<ScummPALBlock*>(block);
-	if (!palBlock) {
-		errout << wxT("ScummPALBlockPresenter::doCreate(): unknown palette format") << std::endl;
-		return;
-	}
-
-	int palCnt = palBlock->getColCount();
-	byte* palData = palBlock->getPAL();
-
-	const int _w = 16;
-	const int _h = (palCnt + _w - 1) / _w;
-	const int w = 10;
-	const int h = 10;
-	_image.Create(16*w, 16*h, false);
-
-	for (int _y = 0; _y < _h; ++_y)
-		for (int _x = 0; _x < _w; ++_x)
-			for (int y = 0; y < h; ++y)
-				for (int x = 0; x < w; ++x) {
-					int col = _y * _w + _x;
-					if (col < palCnt)
-						_image.SetRGB(_x * w + x, _y * h + y,
-							palData[col * 3 + 0], palData[col * 3 + 1], palData[col * 3 + 2]);
-					else
-						_image.SetRGB(_x * w + x, _y * h + y, 0, 0, 0);
-				}
-}
-
-/////////////////////////////////////////////////////////////////////////////
-/////////////////////////////////////////////////////////////////////////////
-
-} // namespace Browser
-
-// This thing here is taken from ScummEX
-// It provides "low-level" decoding of images. It's used by ScummIMGBlockPresenter.
-#include "scumm/ScummImageDetail.h"
-
-namespace Browser {
-
-using namespace Core;
-
-/////////////////////////////////////////////////////////////////////////////
-/////////////////////////////////////////////////////////////////////////////
-
-void ScummIMGBlockPresenter::doCreate(ScummBlock* block, Common::SeekableReadStream* stream) {
-	//infoout << wxT("ScummIMGBlockPresenter::doCreate(): ") << std::endl;
-
-	Image img;
-
-	ScummTag* tag = block->getTag();
-
-	bool obj = false;
-	obj |= tag->equals("IM01");
-	obj |= tag->equals("IM02");
-	obj |= tag->equals("IM03");
-	obj |= tag->equals("IM04");
-	obj |= tag->equals("IM05");
-	obj |= tag->equals("IM06");
-	obj |= tag->equals("IM07");
-	obj |= tag->equals("IM08");
-	obj |= tag->equals("IM09");
-	obj |= tag->equals("IM0A");
-	obj |= tag->equals("IM0B");
-	obj |= tag->equals("IM0C");
-	obj |= tag->equals("IM0D");
-	obj |= tag->equals("IM0E");
-	obj |= tag->equals("IM0F");
-
-	obj |= tag->equals("OI");
-	obj |= tag->equals("OBIM");
-
-	if (obj) {
-		if (!img.drawObject(block, _image))
-			_image.Create(5,5,false);
-		return;
-	}
-		 
-	bool bkg = false;
-	bkg |= tag->equals("BM");
-	bkg |= tag->equals("RMIM");
-	bkg |= tag->equals("IMAG");
-
-	if (bkg) {
-		if (!img.drawBG(block, _image))
-			_image.Create(5,5,false);
-
-		/*if (_boxesDisplayed)
-			g_scummex->boxesDraw(block);*/
-		return;
-	}
-
-	/*case BOXD:
-	case BX:
-		g_scummex->boxesDraw(_blockId);
-		break;
-
-	case FOBJ:
-		g_scummex->SmushFrameDraw(_blockId);
-		break;*/
-}
-
-/////////////////////////////////////////////////////////////////////////////
-/////////////////////////////////////////////////////////////////////////////
-
-} // namespace Browser

Deleted: scummex/branches/gsoc2007-gameresbrowser/src/plugins/scumm/ScummBlockInfoPresenter.h
===================================================================
--- scummex/branches/gsoc2007-gameresbrowser/src/plugins/scumm/ScummBlockInfoPresenter.h	2007-07-14 21:52:26 UTC (rev 28080)
+++ scummex/branches/gsoc2007-gameresbrowser/src/plugins/scumm/ScummBlockInfoPresenter.h	2007-07-15 00:41:31 UTC (rev 28081)
@@ -1,272 +0,0 @@
-/////////////////////////////////////////////////////////////////////////////
-// ScummBlockPresenter.h
-
-#ifndef _SCUMM_BLOCK_INFO_PRESENTER_H_
-#define _SCUMM_BLOCK_INFO_PRESENTER_H_
-
-#include "CoreInterfaces.h"
-#include "GUIInterfaces.h"
-#include "basic/AuxInterfaces.h"
-
-#include "scumm/ScummBlock.h"
-
-namespace Browser {
-
-using namespace Core;
-
-using namespace Scumm;
-
-/////////////////////////////////////////////////////////////////////////////
-/////////////////////////////////////////////////////////////////////////////
-// This file declares quite a few presenters for various scumm chunks.
-
-struct FileNScummBlock;
-
-// ScummBlockPresenterBase is a convenience class that makes writing other
-// presenters easier. In the create() method it retrieves the ScummBlock
-// from the _blockSlot, gets it's stream and invokes inCreate()
-class SCUMM_PLUGIN_API ScummBlockPresenterBase : public BObject {
-	DECLARE_BOBJECT_CLASS(ScummBlockPresenterBase, BObject)
-
-protected:
-	Slot< IProvider<FileNScummBlock> >* _blockSlot;
-
-	bool _created;		//internal flag - marks if the presenter has been initialized
-	wxString _title;	//"title" of the presenters output (used as title of the panel)
-
-public:
-	ASSIGN_DESC(0,wxT("ScummObjects"), 1)
-
-	SLOTS_DECL
-
-	ScummBlockPresenterBase()
-	: _created(false) {}
-
-	virtual void create();
-	//recieves stream positioned right after the header
-	virtual void inCreate(ScummBlock* block, Common::SeekableReadStream* stream) = 0;
-};
-
-/////////////////////////////////////////////////////////////////////////////
-/////////////////////////////////////////////////////////////////////////////
-
-// ScummBlockInfoPresenterBase is a convenience base class for all scumm block
-// presenters that display the data as text. It does all the setup job in the
-// inCreate() method, so that all the subclasses need to do is to override
-// doCreate() method and set the _title, _text and _monospace fields as they
-// choose.
-class SCUMM_PLUGIN_API ScummBlockInfoPresenterBase : public ScummBlockPresenterBase {
-	DECLARE_BOBJECT_CLASS(ScummBlockInfoPresenterBase, ScummBlockPresenterBase)
-
-protected:
-	Pin<IText>* _textPin;
-
-	bool _monospace;		//wheather text should be monospace (default: false)
-	wxString _text;			//text to be outputted
-
-public:
-	ASSIGN_DESC(0,wxT("ScummObjects"), 1)
-
-	PINS_DECL
-
-	ScummBlockInfoPresenterBase()
-	: _monospace(false) {}
-
-	virtual void inCreate(ScummBlock* block, Common::SeekableReadStream* stream);
-	virtual void doCreate(ScummBlock* block, Common::SeekableReadStream* stream) = 0;
-	ITextImpl* getTextImpl();
-};
-
-/////////////////////////////////////////////////////////////////////////////
-/////////////////////////////////////////////////////////////////////////////
-
-// ScummBlockImagePresenter is similar to ScummBlockInfoPresenterBase.
-// It is a convenience base class for all scumm block presenters that display
-// the data as an image. It does all the setup job in the inCreate() method,
-// so that all the subclasses need to do is to override doCreate() method and
-// set the _title and _image fields as they choose.
-class SCUMM_PLUGIN_API ScummBlockImagePresenter : public ScummBlockPresenterBase {
-	DECLARE_BOBJECT_CLASS(ScummBlockImagePresenter, ScummBlockPresenterBase)
-
-protected:
-	Pin<IImage>* _imagePin;
-
-	wxImage _image;			//image to be displayed
-
-public:
-	ASSIGN_DESC(0,wxT("ScummObjects"), 1)
-
-	PINS_DECL
-
-	virtual void inCreate(ScummBlock* block, Common::SeekableReadStream* stream);
-	virtual void doCreate(ScummBlock* block, Common::SeekableReadStream* stream) = 0;
-	IImageImpl* getImageImpl();
-};
-
-/////////////////////////////////////////////////////////////////////////////
-/////////////////////////////////////////////////////////////////////////////
-// ScummBlockInfoPresenter displays most basic information about the chunk:
-// it's type, offset in the file, size etc.
-// It also reads the help file url from the blocksInfo[] table (taken from ScummEX)
-// (it's in ScummResource.cpp) and exposes it as an IUrl pin, so that HTMLPresenter
-// can pick it up and display it.
-
-class SCUMM_PLUGIN_API ScummBlockInfoPresenter : public ScummBlockInfoPresenterBase {
-	DECLARE_BOBJECT_CLASS(ScummBlockInfoPresenter, ScummBlockInfoPresenterBase)
-
-protected:
-	Pin<IUrl>* _urlPin;
-	Pin<IIcon>* _iconPin;
-
-	wxString _url;
-	int _icon;
-
-public:
-	ASSIGN_DESC(0,wxT("ScummObjects"), 1)
-
-	PINS_DECL
-
-	virtual void doCreate(ScummBlock* block, Common::SeekableReadStream* stream);
-	IUrlImpl* getUrlImpl();
-	IIconImpl* getIconImpl();
-};
-
-/////////////////////////////////////////////////////////////////////////////
-/////////////////////////////////////////////////////////////////////////////
-
-// Enumeration that describes how number of entries is stored in the chunk.
-enum EntryCountMode {
-	ENTRY_COUNT_MODE_BYTE,		//a byte after the header
-	ENTRY_COUNT_MODE_INT32BE,	//an int32be
-	ENTRY_COUNT_MODE_INT32LE,	//an int32le
-	ENTRY_COUNT_MODE_CUSTOM,	//size of stream (minus header) / _customEntrySize
-	ENTRY_COUNT_MODE_FIXED,		//take the count from _numEntries field
-};
-
-// ScummEntryBlockPresenter is a base class for all the block presenters that
-// need to display some "entries" from the chunk (like offsets in LOFF chunk).
-class SCUMM_PLUGIN_API ScummEntryBlockPresenter : public ScummBlockInfoPresenterBase {
-	DECLARE_BOBJECT_CLASS(ScummEntryBlockPresenter, ScummBlockInfoPresenterBase)
-
-protected:
-	EntryCountMode _countMode;
-	uint32 _customEntrySize;
-	uint32 _numEntries;
-
-public:
-	ASSIGN_DESC(0,wxT("ScummObjects"), 1)
-
-	ScummEntryBlockPresenter(EntryCountMode countMode = ENTRY_COUNT_MODE_BYTE, uint32 customEntrySize = -1, uint32 numEntries = -1)
-	: _countMode(countMode), _customEntrySize(customEntrySize), _numEntries(numEntries) {}
-
-	virtual void doCreate(ScummBlock* block, Common::SeekableReadStream* stream);
-
-	virtual void determineNumEntries(ScummBlock* block, Common::SeekableReadStream* stream);
-	virtual wxString doPreEntries(ScummBlock* block, Common::SeekableReadStream* stream) { return wxT(""); }
-	virtual wxString doReadEntry(ScummBlock* block, uint32 idx, Common::SeekableReadStream* stream) { return wxT(""); }
-	virtual wxString doPostEntries(ScummBlock* block, Common::SeekableReadStream* stream) { return wxT(""); }
-};
-
-/////////////////////////////////////////////////////////////////////////////
-/////////////////////////////////////////////////////////////////////////////
-
-//
-// Presenters for various chunks start here.
-// They are pretty self explanatory.
-//
-
-/////////////////////////////////////////////////////////////////////////////
-/////////////////////////////////////////////////////////////////////////////
-
-class SCUMM_PLUGIN_API ScummLOFFBlockPresenter : public ScummEntryBlockPresenter {
-	DECLARE_BOBJECT_CLASS(ScummLOFFBlockPresenter, ScummEntryBlockPresenter)
-
-public:
-	ASSIGN_DESC(0,wxT("ScummObjects"), 1)
-
-	virtual wxString doPreEntries(ScummBlock* block, Common::SeekableReadStream* stream);
-	virtual wxString doReadEntry(ScummBlock* block, uint32 idx, Common::SeekableReadStream* stream);
-};
-
-/////////////////////////////////////////////////////////////////////////////
-/////////////////////////////////////////////////////////////////////////////
-
-class SCUMM_PLUGIN_API ScummOFFSBlockPresenter : public ScummEntryBlockPresenter {
-	DECLARE_BOBJECT_CLASS(ScummOFFSBlockPresenter, ScummEntryBlockPresenter)
-
-public:
-	ASSIGN_DESC(0,wxT("ScummObjects"), 1)
-
-	ScummOFFSBlockPresenter()
-	: ScummEntryBlockPresenter(ENTRY_COUNT_MODE_CUSTOM, 4) {}
-
-	virtual wxString doPreEntries(ScummBlock* block, Common::SeekableReadStream* stream);
-	virtual wxString doReadEntry(ScummBlock* block, uint32 idx, Common::SeekableReadStream* stream);
-};
-
-/////////////////////////////////////////////////////////////////////////////
-/////////////////////////////////////////////////////////////////////////////
-
-class SCUMM_PLUGIN_API ScummRMHDBlockPresenter : public ScummBlockInfoPresenterBase {
-	DECLARE_BOBJECT_CLASS(ScummRMHDBlockPresenter, ScummBlockInfoPresenterBase)
-
-public:
-	ASSIGN_DESC(0,wxT("ScummObjects"), 1)
-
-	virtual void doCreate(ScummBlock* block, Common::SeekableReadStream* stream);
-};
-
-/////////////////////////////////////////////////////////////////////////////
-/////////////////////////////////////////////////////////////////////////////
-
-class SCUMM_PLUGIN_API ScummTRNSBlockPresenter : public ScummBlockInfoPresenterBase {
-	DECLARE_BOBJECT_CLASS(ScummTRNSBlockPresenter, ScummBlockInfoPresenterBase)
-
-public:
-	ASSIGN_DESC(0,wxT("ScummObjects"), 1)
-
-	virtual void doCreate(ScummBlock* block, Common::SeekableReadStream* stream);
-};
-
-/////////////////////////////////////////////////////////////////////////////
-/////////////////////////////////////////////////////////////////////////////
-
-class SCUMM_PLUGIN_API ScummScriptBlockPresenter : public ScummBlockInfoPresenterBase {
-	DECLARE_BOBJECT_CLASS(ScummScriptBlockPresenter, ScummBlockInfoPresenterBase)
-
-public:
-	ASSIGN_DESC(0,wxT("ScummObjects"), 1)
-
-	virtual void doCreate(ScummBlock* block, Common::SeekableReadStream* stream);
-};
-
-/////////////////////////////////////////////////////////////////////////////
-/////////////////////////////////////////////////////////////////////////////
-
-class SCUMM_PLUGIN_API ScummPALBlockPresenter : public ScummBlockImagePresenter {
-	DECLARE_BOBJECT_CLASS(ScummPALBlockPresenter, ScummBlockImagePresenter)
-
-public:
-	ASSIGN_DESC(0,wxT("ScummObjects"), 1)
-
-	virtual void doCreate(ScummBlock* block, Common::SeekableReadStream* stream);
-};
-
-/////////////////////////////////////////////////////////////////////////////
-/////////////////////////////////////////////////////////////////////////////
-
-class SCUMM_PLUGIN_API ScummIMGBlockPresenter : public ScummBlockImagePresenter {
-	DECLARE_BOBJECT_CLASS(ScummIMGBlockPresenter, ScummBlockImagePresenter)
-
-public:
-	ASSIGN_DESC(0,wxT("ScummObjects"), 1)
-
-	virtual void doCreate(ScummBlock* block, Common::SeekableReadStream* stream);
-};
-
-/////////////////////////////////////////////////////////////////////////////
-/////////////////////////////////////////////////////////////////////////////
-
-} // namespace Browser
-
-#endif //_SCUMM_BLOCK_INFO_PRESENTER_H_

Modified: scummex/branches/gsoc2007-gameresbrowser/src/plugins/scumm/ScummBlockPresenter.cpp
===================================================================
--- scummex/branches/gsoc2007-gameresbrowser/src/plugins/scumm/ScummBlockPresenter.cpp	2007-07-14 21:52:26 UTC (rev 28080)
+++ scummex/branches/gsoc2007-gameresbrowser/src/plugins/scumm/ScummBlockPresenter.cpp	2007-07-15 00:41:31 UTC (rev 28081)
@@ -95,7 +95,7 @@
 		new FileNScummBlock(_ifile, false, _block, false), true);
 }
 
-/*static*/ ScummBlock* ScummBlockPresenter::getScummBlock(Common::SeekableReadStream* stream) {
+ScummBlock* ScummBlockPresenter::getScummBlock(Common::SeekableReadStream* stream) {
 	//infoout << wxT("ScummParser::getScummBlock(): ") << std::endl;
 
 	Common::SeekableReadStream* outStream;

Copied: scummex/branches/gsoc2007-gameresbrowser/src/plugins/scumm/ScummCommonPresenters.cpp (from rev 28068, scummex/branches/gsoc2007-gameresbrowser/src/plugins/scumm/ScummBlockInfoPresenter.cpp)
===================================================================
--- scummex/branches/gsoc2007-gameresbrowser/src/plugins/scumm/ScummCommonPresenters.cpp	                        (rev 0)
+++ scummex/branches/gsoc2007-gameresbrowser/src/plugins/scumm/ScummCommonPresenters.cpp	2007-07-15 00:41:31 UTC (rev 28081)
@@ -0,0 +1,243 @@
+/////////////////////////////////////////////////////////////////////////////
+// ScummCommonPresenters.cpp
+
+#include "scumm_stdafx.h"
+
+#include "scumm/ScummCommonPresenters.h"
+#include "scumm/ScummResource.h"
+#include "scumm/descumm.h"
+
+#include "CoreInterfaces.h"
+#include "PluginUtil.h"
+
+#include <iostream>
+
+#include "debugmem.h"
+
+namespace Browser {
+
+using namespace Core;
+
+/////////////////////////////////////////////////////////////////////////////
+/////////////////////////////////////////////////////////////////////////////
+
+PIN_DESCS(ScummBlockInfoPresenter)
+	PIN_DESC_r(_urlPin, PIN_DEFAULT | PIN_MULTICAST, getUrlImpl, IUrlImpl)
+	PIN_DESC_r(_iconPin, PIN_DEFAULT | PIN_MULTICAST, getIconImpl, IIconImpl)
+END_DESCS
+
+void ScummBlockInfoPresenter::doCreate(ScummBlock* block, Common::SeekableReadStream* stream) {
+	//infoout << wxT("ScummBlockInfoPresenter::doCreate(): ") << std::endl;
+	ScummTag* tag = block->getTag();
+	ASSERT(tag);
+
+	_title = wxT("Block Info");
+
+	_text = wxT("");
+	_text << wxT("Block type: ") << _title << wxEndl();
+	_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->ifReadData() ? wxT("true") : wxT("false")) << wxEndl();
+	_text << wxT("Parse Sub Blocks: ") << (block->ifParseSubBlocks() ? wxT("true") : wxT("false"))  << wxEndl();
+
+	wxString sizeMode;
+	switch(block->_sizeMode) {
+		case INVALID_SIZE_MODE:
+			sizeMode = wxT("INVALID_SIZE_MODE"); break;
+		case HEADER_INCLUDED:
+			sizeMode = wxT("HEADER_INCLUDED"); break;
+		case HEADER_NOT_INCLUDED:
+			sizeMode = wxT("HEADER_NOT_INCLUDED"); break;
+		case HEADER_NOT_INCLUDED_MINUS_ONE:
+			sizeMode = wxT("HEADER_NOT_INCLUDED_MINUS_ONE"); break;
+		case ENTRY_BASED:
+			sizeMode = wxT("ENTRY_BASED"); break;
+		case TILL_END: 
+			sizeMode = wxT("TILL_END"); break;
+		default:
+			sizeMode = wxT("ERROR: bad size mode"); break;
+	}
+	_text << wxT("Size mode: ") << sizeMode << wxEndl();
+
+	//_text << wxT("Parsed: ") << (block->_parsed ? wxT("true") : wxT("false"))  << wxEndl();
+	_text << wxEndl();
+
+	const blockInfo* binfo = getBlockInfo(*tag);
+	if (binfo) {
+		_text << wxT("Description: ") << binfo->description << wxEndl();
+		_text << wxT("Help file: ") << binfo->htmlfile << wxEndl();
+		_text << wxT("Icon number: ") << binfo->iconid << wxEndl();
+		_url = toString(binfo->htmlfile);
+		if (!_url.IsEmpty())
+		    _url = PluginUtil::getResourcePath(_url);
+		_icon = binfo->iconid;
+	} else {
+		_text << wxT("Could not find block info.") << wxEndl();
+		_url = wxT("");
+		_icon = -1;
+	}
+}
+
+IUrlImpl* ScummBlockInfoPresenter::getUrlImpl() {
+	//infoout << wxT("ScummBlockInfoPresenter::getUrlImpl(): ") << std::endl;
+	create();
+	if (!_isOk)
+		return new IUrlImpl(wxT("No help"));
+	if (_url.IsEmpty())
+		return new IUrlImpl(wxT("No help"));
+	return new IUrlImpl(wxT("Help"), _url);
+}
+
+IIconImpl* ScummBlockInfoPresenter::getIconImpl() {
+	//infoout << wxT("ScummBlockInfoPresenter::getIconImpl(): ") << std::endl;
+	create();
+	//TODO: check _isOk
+	return new IIconImpl(_icon);
+}
+
+/////////////////////////////////////////////////////////////////////////////
+/////////////////////////////////////////////////////////////////////////////
+
+void ScummScriptBlockPresenter::doCreate(ScummBlock* block, Common::SeekableReadStream* stream) {
+	//infoout << wxT("ScummScriptBlockPresenter::doCreate(): ") << std::endl;
+
+	_monospace = true;
+	_title = wxT("Script");
+
+	RootScummBlock* rootBlock = block->getRootScummBlock();
+	ASSERT(rootBlock);
+
+	int scummVersion = rootBlock->getScummVersion();
+	if (scummVersion != -1) {
+		Common::SeekableReadStream* stream = block->getStream();
+		stream->seek(0, SEEK_SET);
+		DeScumm descumm(*stream, stream->size(), scummVersion);
+
+		_text = descumm.getText();
+		if (_text.IsEmpty())
+			_text = wxT("<Empty script>");
+	} else {
+		if (_text.IsEmpty())
+			_text = wxT("<Unknown Scumm Version>");
+	}
+}
+
+/////////////////////////////////////////////////////////////////////////////
+/////////////////////////////////////////////////////////////////////////////
+
+void ScummPALBlockPresenter::doCreate(ScummBlock* block, Common::SeekableReadStream* stream) {
+	//infoout << wxT("ScummPALBlockPresenter::doCreate(): ") << std::endl;
+
+	ScummPALBlock* palBlock = dynamic_cast<ScummPALBlock*>(block);
+	if (!palBlock) {
+		_isOk = false;
+		errout << wxT("ScummPALBlockPresenter::doCreate(): unknown palette format") << std::endl;
+		return;
+	}
+
+	int palCnt = palBlock->getColCount();
+	byte* palData = palBlock->getPAL();
+
+	const int _w = 16;
+	const int _h = (palCnt + _w - 1) / _w;
+	const int w = 10;
+	const int h = 10;
+	_image.Create(16*w, 16*h, false);
+
+	for (int _y = 0; _y < _h; ++_y)
+		for (int _x = 0; _x < _w; ++_x)
+			for (int y = 0; y < h; ++y)
+				for (int x = 0; x < w; ++x) {
+					int col = _y * _w + _x;
+					if (col < palCnt)
+						_image.SetRGB(_x * w + x, _y * h + y,
+							palData[col * 3 + 0], palData[col * 3 + 1], palData[col * 3 + 2]);
+					else
+						_image.SetRGB(_x * w + x, _y * h + y, 0, 0, 0);
+				}
+}
+
+/////////////////////////////////////////////////////////////////////////////
+/////////////////////////////////////////////////////////////////////////////
+
+} // namespace Browser
+
+// This thing here is taken from ScummEX
+// It provides "low-level" decoding of images. It's used by ScummIMGBlockPresenter.
+#include "scumm/ScummImageDetail.h"
+
+namespace Browser {
+
+using namespace Core;
+
+/////////////////////////////////////////////////////////////////////////////
+/////////////////////////////////////////////////////////////////////////////
+
+void ScummIMGBlockPresenter::doCreate(ScummBlock* block, Common::SeekableReadStream* stream) {
+	//infoout << wxT("ScummIMGBlockPresenter::doCreate(): ") << std::endl;
+
+	Image img;
+
+	ScummTag* tag = block->getTag();
+
+	bool obj = false;
+	obj |= tag->equals("IM01");
+	obj |= tag->equals("IM02");
+	obj |= tag->equals("IM03");
+	obj |= tag->equals("IM04");
+	obj |= tag->equals("IM05");
+	obj |= tag->equals("IM06");
+	obj |= tag->equals("IM07");
+	obj |= tag->equals("IM08");
+	obj |= tag->equals("IM09");
+	obj |= tag->equals("IM0A");
+	obj |= tag->equals("IM0B");
+	obj |= tag->equals("IM0C");
+	obj |= tag->equals("IM0D");
+	obj |= tag->equals("IM0E");
+	obj |= tag->equals("IM0F");
+
+	obj |= tag->equals("OI");
+	obj |= tag->equals("OBIM");
+
+	if (obj) {
+		if (!img.drawObject(block, _image))
+			_image.Create(5,5,false);
+		else
+			_isOk = false;
+		return;
+	}
+		 
+	bool bkg = false;
+	bkg |= tag->equals("BM");
+	bkg |= tag->equals("RMIM");
+	bkg |= tag->equals("IMAG");
+
+	if (bkg) {
+		if (!img.drawBG(block, _image))
+			_image.Create(5,5,false);
+		else
+			_isOk = false;
+
+		/*if (_boxesDisplayed)
+			g_scummex->boxesDraw(block);*/
+		return;
+	}
+
+	/*case BOXD:
+	case BX:
+		g_scummex->boxesDraw(_blockId);
+		break;
+
+	case FOBJ:
+		g_scummex->SmushFrameDraw(_blockId);
+		break;*/
+
+	_isOk = false;
+}
+
+/////////////////////////////////////////////////////////////////////////////
+/////////////////////////////////////////////////////////////////////////////
+
+} // namespace Browser

Copied: scummex/branches/gsoc2007-gameresbrowser/src/plugins/scumm/ScummCommonPresenters.h (from rev 28068, scummex/branches/gsoc2007-gameresbrowser/src/plugins/scumm/ScummBlockInfoPresenter.h)
===================================================================
--- scummex/branches/gsoc2007-gameresbrowser/src/plugins/scumm/ScummCommonPresenters.h	                        (rev 0)
+++ scummex/branches/gsoc2007-gameresbrowser/src/plugins/scumm/ScummCommonPresenters.h	2007-07-15 00:41:31 UTC (rev 28081)
@@ -0,0 +1,93 @@
+/////////////////////////////////////////////////////////////////////////////
+// ScummCommonPresenters.h
+
+#ifndef _SCUMM_COMMON_PRESENTERS_H_
+#define _SCUMM_COMMON_PRESENTERS_H_
+
+#include "ScummPresenterBase.h"
+
+namespace Browser {
+
+using namespace Core;
+
+using namespace Scumm;
+
+/////////////////////////////////////////////////////////////////////////////
+/////////////////////////////////////////////////////////////////////////////
+//
+// This file declares some "generic" presenters:
+//		- ScummBlockInfoPresenter	(general info about the block)
+//		- ScummScriptBlockPresenter	(descumm)
+//		- ScummPALBlockPresenter	(displays various palletes)
+//		- ScummIMGBlockPresenter	(displays various images)
+//
+/////////////////////////////////////////////////////////////////////////////
+/////////////////////////////////////////////////////////////////////////////
+// ScummBlockInfoPresenter displays most basic information about the chunk:
+// it's type, offset in the file, size etc.
+// It also reads the help file url from the blocksInfo[] table (taken from ScummEX)
+// (it's in ScummResource.cpp) and exposes it as an IUrl pin, so that HTMLPresenter
+// can pick it up and display it.
+
+class SCUMM_PLUGIN_API ScummBlockInfoPresenter : public ScummBlockTextPresenter {
+	DECLARE_BOBJECT_CLASS(ScummBlockInfoPresenter, ScummBlockTextPresenter)
+
+protected:
+	Pin<IUrl>* _urlPin;
+	Pin<IIcon>* _iconPin;
+
+	wxString _url;
+	int _icon;
+
+public:
+	ASSIGN_DESC(0,wxT("ScummObjects"), 1)
+
+	PINS_DECL
+
+	virtual void doCreate(ScummBlock* block, Common::SeekableReadStream* stream);
+	IUrlImpl* getUrlImpl();
+	IIconImpl* getIconImpl();
+};
+
+/////////////////////////////////////////////////////////////////////////////
+/////////////////////////////////////////////////////////////////////////////
+
+class SCUMM_PLUGIN_API ScummScriptBlockPresenter : public ScummBlockTextPresenter {
+	DECLARE_BOBJECT_CLASS(ScummScriptBlockPresenter, ScummBlockTextPresenter)
+
+public:
+	ASSIGN_DESC(0,wxT("ScummObjects"), 1)
+
+	virtual void doCreate(ScummBlock* block, Common::SeekableReadStream* stream);
+};
+
+/////////////////////////////////////////////////////////////////////////////
+/////////////////////////////////////////////////////////////////////////////
+
+class SCUMM_PLUGIN_API ScummPALBlockPresenter : public ScummBlockImagePresenter {
+	DECLARE_BOBJECT_CLASS(ScummPALBlockPresenter, ScummBlockImagePresenter)
+
+public:
+	ASSIGN_DESC(0,wxT("ScummObjects"), 1)
+
+	virtual void doCreate(ScummBlock* block, Common::SeekableReadStream* stream);
+};
+
+/////////////////////////////////////////////////////////////////////////////
+/////////////////////////////////////////////////////////////////////////////
+
+class SCUMM_PLUGIN_API ScummIMGBlockPresenter : public ScummBlockImagePresenter {
+	DECLARE_BOBJECT_CLASS(ScummIMGBlockPresenter, ScummBlockImagePresenter)
+
+public:
+	ASSIGN_DESC(0,wxT("ScummObjects"), 1)
+
+	virtual void doCreate(ScummBlock* block, Common::SeekableReadStream* stream);
+};
+
+/////////////////////////////////////////////////////////////////////////////
+/////////////////////////////////////////////////////////////////////////////
+
+} // namespace Browser
+
+#endif //_SCUMM_COMMON_PRESENTERS_H_

Modified: scummex/branches/gsoc2007-gameresbrowser/src/plugins/scumm/ScummFileTypes.cpp
===================================================================
--- scummex/branches/gsoc2007-gameresbrowser/src/plugins/scumm/ScummFileTypes.cpp	2007-07-14 21:52:26 UTC (rev 28080)
+++ scummex/branches/gsoc2007-gameresbrowser/src/plugins/scumm/ScummFileTypes.cpp	2007-07-15 00:41:31 UTC (rev 28081)
@@ -37,6 +37,12 @@
 
 SAFE_LOCAL_STATIC(scummScriptBlockPresenterGUID, BGUID, (wxT("ScummObjects"), wxT("ScummScriptBlockPresenter"), 1) )
 
+SAFE_LOCAL_STATIC(scummRNAMBlockPresenterGUID, BGUID, (wxT("ScummObjects"), wxT("ScummRNAMBlockPresenter"), 1) )
+SAFE_LOCAL_STATIC(scummMAXSBlockPresenterGUID, BGUID, (wxT("ScummObjects"), wxT("ScummMAXSBlockPresenter"), 1) )
+SAFE_LOCAL_STATIC(scummDOBJBlockPresenterGUID, BGUID, (wxT("ScummObjects"), wxT("ScummDOBJBlockPresenter"), 1) )
+SAFE_LOCAL_STATIC(scummANAMBlockPresenterGUID, BGUID, (wxT("ScummObjects"), wxT("ScummANAMBlockPresenter"), 1) )
+SAFE_LOCAL_STATIC(scummDIRBlockPresenterGUID, BGUID, (wxT("ScummObjects"), wxT("ScummDIRBlockPresenter"), 1) )
+
 /////////////////////////////////////////////////////////////////////////////
 /////////////////////////////////////////////////////////////////////////////
 

Modified: scummex/branches/gsoc2007-gameresbrowser/src/plugins/scumm/ScummFileTypes.h
===================================================================
--- scummex/branches/gsoc2007-gameresbrowser/src/plugins/scumm/ScummFileTypes.h	2007-07-14 21:52:26 UTC (rev 28080)
+++ scummex/branches/gsoc2007-gameresbrowser/src/plugins/scumm/ScummFileTypes.h	2007-07-15 00:41:31 UTC (rev 28081)
@@ -39,6 +39,12 @@
 
 SAFE_LOCAL_STATIC_DECL(scummScriptBlockPresenterGUID, BGUID)
 
+SAFE_LOCAL_STATIC_DECL(scummRNAMBlockPresenterGUID, BGUID)
+SAFE_LOCAL_STATIC_DECL(scummMAXSBlockPresenterGUID, BGUID)
+SAFE_LOCAL_STATIC_DECL(scummDOBJBlockPresenterGUID, BGUID)
+SAFE_LOCAL_STATIC_DECL(scummANAMBlockPresenterGUID, BGUID)
+SAFE_LOCAL_STATIC_DECL(scummDIRBlockPresenterGUID, BGUID)
+
 //SAFE_STATIC_DECL(rootDirectoryFileType, RecognizedFileType)
 
 /////////////////////////////////////////////////////////////////////////////

Deleted: scummex/branches/gsoc2007-gameresbrowser/src/plugins/scumm/ScummImage.cpp
===================================================================
--- scummex/branches/gsoc2007-gameresbrowser/src/plugins/scumm/ScummImage.cpp	2007-07-14 21:52:26 UTC (rev 28080)
+++ scummex/branches/gsoc2007-gameresbrowser/src/plugins/scumm/ScummImage.cpp	2007-07-15 00:41:31 UTC (rev 28081)
@@ -1,25 +0,0 @@
-/////////////////////////////////////////////////////////////////////////////
-// ScummImage.cpp
-
-#include "scumm_stdafx.h"
-
-#include "scumm/ScummBlockInfoPresenter.h"
-#include "scumm/ScummBlockPresenter.h"
-
-#include "CoreInterfaces.h"
-
-#include <iostream>
-
-#include "debugmem.h"
-
-namespace Browser {
-
-using namespace Core;
-
-/////////////////////////////////////////////////////////////////////////////
-/////////////////////////////////////////////////////////////////////////////
-
-/////////////////////////////////////////////////////////////////////////////
-/////////////////////////////////////////////////////////////////////////////
-
-} // namespace Browser

Modified: scummex/branches/gsoc2007-gameresbrowser/src/plugins/scumm/ScummParser.cpp
===================================================================
--- scummex/branches/gsoc2007-gameresbrowser/src/plugins/scumm/ScummParser.cpp	2007-07-14 21:52:26 UTC (rev 28080)
+++ scummex/branches/gsoc2007-gameresbrowser/src/plugins/scumm/ScummParser.cpp	2007-07-15 00:41:31 UTC (rev 28081)
@@ -7,6 +7,7 @@
 
 #include "scumm/ScummFileTypes.h"
 #include "scumm/ScummRecognizer.h"
+#include "PluginUtil.h"
 
 #include <iostream>
 
@@ -24,6 +25,8 @@
 /////////////////////////////////////////////////////////////////////////////
 /////////////////////////////////////////////////////////////////////////////
 
+int _getScummVersionDialog();
+
 void ScummParser::create() {
 	//infoout << wxT("ScummParser::create(): ") << std::endl;
 	if (_created)
@@ -53,16 +56,102 @@
 	ScummBlock* block = ScummBlockFactory::create(outTag, -1, outStream);
 	_ownBlock = true;
 
-	if (!block) { // virtually impossible
+	RootScummBlock* rootBlock = block->getRootScummBlock();
+	if (!block || !rootBlock) { // virtually impossible
 		delete outTag;
 		errout << wxT("ScummBlockPresenter::create(): null block") << std::endl;
 		return;
 	}
 
+	int scummVersion = rootBlock->getScummVersion();
+	if (scummVersion == -1) {
+		scummVersion = _getScummVersionDialog();
+		rootBlock->setScummVersion(scummVersion);
+	}
+
 	_block = block;
 }
 
 /////////////////////////////////////////////////////////////////////////////
 /////////////////////////////////////////////////////////////////////////////
+// taken from ScummEX
 
+int _getScummVersionDialog() {
+	int choice;
+	wxString games[22] = {
+		wxT("Maniac Mansion (C64)"),
+		wxT("Maniac Mansion (PC)"),
+		wxT("Zak McKracken"),
+		wxT("Zak McKracken (FM Towns)"),
+		wxT("Indiana Jones & The Last Crusade"),
+		wxT("Sampler (Loom, Indy3, SOMI)"),
+		wxT("The Secret of Monkey Island (Demo)"),
+		wxT("The Secret of Monkey Island (EGA)"),
+		wxT("The Secret of Monkey Island"),
+		wxT("Loom"),
+		wxT("Loom (CD)"),
+		wxT("Monkey Island 2: LeChuck's Revenge"),
+		wxT("Indiana Jones & The Fate of Atlantis"),
+		wxT("Day of the Tentacle"),
+		wxT("Sam & Max Hit The Road (Demo)"),
+		wxT("Sam & Max Hit The Road (Mac demo)"),
+		wxT("Sam & Max Hit The Road (Disk)"),
+		wxT("Sam & Max Hit The Road (CD)"),
+		wxT("Full Throttle"),
+		wxT("The Dig"),
+		wxT("The Dig (Win95)"),
+		wxT("The Curse of Monkey Island")
+	};
+
+	wxSingleChoiceDialog *dialog = new wxSingleChoiceDialog(PluginUtil::getMainForm(), wxT("Please select the correct game"), wxT("Scumm version selection"), 22, games, NULL, wxOK|wxCANCEL|wxCENTRE, wxDefaultPosition);
+	int ret = -1;
+	if (dialog->ShowModal() == wxID_OK) {
+		choice = dialog->GetSelection();
+		switch (choice) {
+			case 0:
+				ret = 1;
+				break;
+			case 1:
+			case 2:
+				ret = 2;
+				break;
+			case 3:
+			case 4:
+			case 9:
+				ret = 3;
+				break;
+			case 5:
+			case 6:
+			case 7:
+				ret = 4;
+				break;
+			case 8:
+			case 10:
+			case 11:
+			case 12:
+				ret = 5;
+				break;
+			case 13:
+			case 14:
+			case 16:
+				ret = 6;
+				break;
+			case 17:
+			case 18:
+			case 19:
+				ret = 7;
+				break;
+			case 20:
+			case 21:
+				ret = 8;
+				break;
+		}
+	}
+	dialog->Destroy();
+	return ret;
+}
+
+/////////////////////////////////////////////////////////////////////////////
+/////////////////////////////////////////////////////////////////////////////
+
 } // namespace Browser

Added: scummex/branches/gsoc2007-gameresbrowser/src/plugins/scumm/ScummPresenterBase.cpp
===================================================================
--- scummex/branches/gsoc2007-gameresbrowser/src/plugins/scumm/ScummPresenterBase.cpp	                        (rev 0)
+++ scummex/branches/gsoc2007-gameresbrowser/src/plugins/scumm/ScummPresenterBase.cpp	2007-07-15 00:41:31 UTC (rev 28081)
@@ -0,0 +1,171 @@
+/////////////////////////////////////////////////////////////////////////////
+// ScummPresenterBase.cpp
+
+#include "scumm_stdafx.h"
+
+#include "scumm/ScummPresenterBase.h"
+#include "scumm/ScummBlockPresenter.h"
+#include "scumm/descumm.h"
+
+#include "CoreInterfaces.h"
+#include "PluginUtil.h"
+
+#include <iostream>
+
+#include "debugmem.h"
+
+namespace Browser {
+
+using namespace Core;
+
+/////////////////////////////////////////////////////////////////////////////
+/////////////////////////////////////////////////////////////////////////////
+//
+// This file contains abstract base classes for ScummBlockPresenters.
+// See ScummPresenterBase.h.
+//
+/////////////////////////////////////////////////////////////////////////////
+/////////////////////////////////////////////////////////////////////////////
+
+SLOT_DESCS(ScummBlockPresenterBase)
+	SLOT_DESC(_blockSlot, SLOT_DEFAULT)
+END_DESCS
+
+void ScummBlockPresenterBase::create() {
+	//infoout << wxT("ScummBlockPresenterBase::create(): ") << std::endl;
+	if(_created)
+		return;
+	_created = true;
+
+	_isOk = false;
+	IProvider<FileNScummBlock>* iprov = _blockSlot->getInterface();
+	if (!iprov) {
+		errout << wxT("ScummBlockPresenterBase::create(): could not get IProvider<FileNScummBlock> interface") << std::endl;
+		return;
+	}
+
+	ASSERT(iprov->getData());
+	ScummBlock* block = iprov->getData()->getBlock();
+
+	if (!block) {
+		errout << wxT("ScummBlockPresenterBase::create(): NULL block") << std::endl;
+		_blockSlot->releaseInterface();
+		return;
+	}
+
+	uint32 hsize;
+	if (!block->determineHeaderSize(hsize)) {
+		errout << wxT("ScummBlockInfoPresenterBase::create(): could not determine header size") << std::endl;
+		_blockSlot->releaseInterface();
+		return;
+	}
+
+	ScummTag* tag = block->getTag();
+	ASSERT(tag);
+	_title = tag->toString();
+
+	Common::SeekableReadStream* stream = block->getStream();
+	ASSERT(stream);
+
+	stream->seek(hsize, SEEK_SET);
+
+	_isOk = true;
+	inCreate(block, stream);
+
+	_blockSlot->releaseInterface();
+}
+
+/////////////////////////////////////////////////////////////////////////////
+/////////////////////////////////////////////////////////////////////////////
+
+PIN_DESCS(ScummBlockTextPresenter)
+	PIN_DESC_r(_textPin, PIN_DEFAULT | PIN_MULTICAST, getTextImpl, ITextImpl)
+END_DESCS
+
+
+void ScummBlockTextPresenter::inCreate(ScummBlock* block, Common::SeekableReadStream* stream) {
+	//infoout << wxT("ScummBlockTextPresenter::inCreate(): ") << std::endl;
+	doCreate(block, stream);
+}
+
+ITextImpl* ScummBlockTextPresenter::getTextImpl() {
+	//infoout << wxT("ScummBlockTextPresenter::getTextImpl(): ") << std::endl;
+	create();
+	if (!_isOk)
+		return new ITextImpl(wxT("ERROR"), wxT("no info to display"));
+	return new ITextImpl(_title, _text, _monospace);
+}
+
+/////////////////////////////////////////////////////////////////////////////
+/////////////////////////////////////////////////////////////////////////////
+
+PIN_DESCS(ScummBlockImagePresenter)
+	PIN_DESC_r(_imagePin, PIN_DEFAULT | PIN_MULTICAST, getImageImpl, IImageImpl)
+END_DESCS
+
+
+void ScummBlockImagePresenter::inCreate(ScummBlock* block, Common::SeekableReadStream* stream) {
+	//infoout << wxT("ScummBlockImagePresenter::inCreate(): ") << std::endl;
+	doCreate(block, stream);
+}
+
+IImageImpl* ScummBlockImagePresenter::getImageImpl() {
+	//infoout << wxT("ScummBlockImagePresenter::getImageImpl(): ") << std::endl;
+	create();
+	//TODO: check _isOk
+	return new IImageImpl(/*_title,*/ &_image, false);
+}
+
+/////////////////////////////////////////////////////////////////////////////
+/////////////////////////////////////////////////////////////////////////////
+
+void ScummEntryBlockPresenter::determineNumEntries(ScummBlock* block, Common::SeekableReadStream* stream) {
+	switch(_countMode) {
+		case ENTRY_COUNT_MODE_BYTE:
+			_numEntries = stream->readByte();
+			break;
+		case ENTRY_COUNT_MODE_INT16BE:
+			_numEntries = stream->readUint16BE();
+			break;
+		case ENTRY_COUNT_MODE_INT16LE:
+			_numEntries = stream->readUint16LE();
+			break;
+		case ENTRY_COUNT_MODE_INT32BE:
+			_numEntries = stream->readUint32BE();
+			break;
+		case ENTRY_COUNT_MODE_INT32LE:
+			_numEntries = stream->readUint32LE();
+			break;
+		case ENTRY_COUNT_MODE_CUSTOM:
+			{
+			uint32 p = stream->pos();
+			uint32 s = stream->size();
+			_numEntries = (s - p) / _customEntrySize;
+			}
+			break;
+		case ENTRY_COUNT_MODE_FIXED:
+			//use current _numEntries
+			break;
+		default:
+			errout << wxT("ScummEntryBlockPresenter::determineNumEntries(): invalid count mode") << std::endl;
+			_numEntries = 0;
+			break;
+	}
+}
+
+void ScummEntryBlockPresenter::doCreate(ScummBlock* block, Common::SeekableReadStream* stream) {
+	//infoout << wxT("ScummEntryBlockPresenter::doCreate(): ") << std::endl;
+
+	determineNumEntries(block, stream);
+
+	_text = doPreEntries(block, stream);
+	for (uint32 i = 0; i < _numEntries; ++i) {
+		_text += doReadEntry(block, i, stream);
+	}
+	_text += doPostEntries(block, stream);
+}
+
+/////////////////////////////////////////////////////////////////////////////
+/////////////////////////////////////////////////////////////////////////////
+
+} // namespace Browser


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

Added: scummex/branches/gsoc2007-gameresbrowser/src/plugins/scumm/ScummPresenterBase.h
===================================================================
--- scummex/branches/gsoc2007-gameresbrowser/src/plugins/scumm/ScummPresenterBase.h	                        (rev 0)
+++ scummex/branches/gsoc2007-gameresbrowser/src/plugins/scumm/ScummPresenterBase.h	2007-07-15 00:41:31 UTC (rev 28081)
@@ -0,0 +1,163 @@
+/////////////////////////////////////////////////////////////////////////////
+// ScummBlockPresenter.h
+
+#ifndef _SCUMM_PRESENTER_BASE_H_
+#define _SCUMM_PRESENTER_BASE_H_
+
+#include "ScummBlockPresenter.h"
+#include "GUIInterfaces.h"
+#include "basic/AuxInterfaces.h"
+
+#include "scumm/ScummBlock.h"
+
+namespace Browser {
+
+using namespace Core;
+
+using namespace Scumm;
+
+/////////////////////////////////////////////////////////////////////////////
+/////////////////////////////////////////////////////////////////////////////
+//
+// This file contains abstract base classes for ScummBlockPresenters.
+//
+/////////////////////////////////////////////////////////////////////////////
+/////////////////////////////////////////////////////////////////////////////
+// ScummBlockPresenterBase is a convenience class that makes writing other
+// presenters easier. In the create() method it retrieves the ScummBlock
+// from the _blockSlot, gets it's stream and invokes inCreate()
+
+struct FileNScummBlock;
+
+class SCUMM_PLUGIN_API ScummBlockPresenterBase : public BObject {
+	DECLARE_BOBJECT_CLASS(ScummBlockPresenterBase, BObject)
+
+protected:
+	Slot< IProvider<FileNScummBlock> >* _blockSlot;
+
+	bool _isOk;			//weather parsing of data went ok
+	bool _created;		//internal flag - marks if the presenter has been initialized
+	wxString _title;	//"title" of the presenters output (used as title of the panel)
+
+public:
+	ASSIGN_DESC(0,wxT("ScummObjects"), 1)
+
+	SLOTS_DECL
+
+	ScummBlockPresenterBase()
+	: _isOk(true), _created(false) {}
+
+	virtual void create();
+	//recieves stream positioned right after the header
+	virtual void inCreate(ScummBlock* block, Common::SeekableReadStream* stream) = 0;
+};
+
+/////////////////////////////////////////////////////////////////////////////
+/////////////////////////////////////////////////////////////////////////////
+// ScummBlockTextPresenter is a convenience base class for all scumm block
+// presenters that display the data as text. It does all the setup job in the
+// inCreate() method, so that all the subclasses need to do is to override
+// doCreate() method and set the _title, _text and _monospace fields as they
+// choose.
+
+class SCUMM_PLUGIN_API ScummBlockTextPresenter : public ScummBlockPresenterBase {
+	DECLARE_BOBJECT_CLASS(ScummBlockTextPresenter, ScummBlockPresenterBase)
+
+protected:
+	Pin<IText>* _textPin;
+
+	bool _monospace;		//wheather text should be monospace (default: false)
+	wxString _text;			//text to be outputted
+
+public:
+	ASSIGN_DESC(0,wxT("ScummObjects"), 1)
+
+	PINS_DECL
+
+	ScummBlockTextPresenter()
+	: _monospace(false) {}
+
+	virtual void inCreate(ScummBlock* block, Common::SeekableReadStream* stream);
+	virtual void doCreate(ScummBlock* block, Common::SeekableReadStream* stream) = 0;
+	ITextImpl* getTextImpl();
+};
+
+/////////////////////////////////////////////////////////////////////////////
+/////////////////////////////////////////////////////////////////////////////
+// ScummBlockImagePresenter is similar to ScummBlockTextPresenter.
+// It is a convenience base class for all scumm block presenters that display
+// the data as an image. It does all the setup job in the inCreate() method,
+// so that all the subclasses need to do is to override doCreate() method and
+// set the _title and _image fields as they choose.
+
+class SCUMM_PLUGIN_API ScummBlockImagePresenter : public ScummBlockPresenterBase {
+	DECLARE_BOBJECT_CLASS(ScummBlockImagePresenter, ScummBlockPresenterBase)
+
+protected:
+	Pin<IImage>* _imagePin;
+
+	wxImage _image;			//image to be displayed
+
+public:
+	ASSIGN_DESC(0,wxT("ScummObjects"), 1)
+
+	PINS_DECL
+
+	virtual void inCreate(ScummBlock* block, Common::SeekableReadStream* stream);
+	virtual void doCreate(ScummBlock* block, Common::SeekableReadStream* stream) = 0;
+	IImageImpl* getImageImpl();
+};
+
+/////////////////////////////////////////////////////////////////////////////
+/////////////////////////////////////////////////////////////////////////////
+
+// Enumeration that describes how number of entries is stored in the chunk.
+enum EntryCountMode {
+	ENTRY_COUNT_MODE_BYTE,		//a byte after the header
+	ENTRY_COUNT_MODE_INT16BE,	//an int16be
+	ENTRY_COUNT_MODE_INT16LE,	//an int16le
+	ENTRY_COUNT_MODE_INT32BE,	//an int32be
+	ENTRY_COUNT_MODE_INT32LE,	//an int32le
+	ENTRY_COUNT_MODE_CUSTOM,	//size of stream (minus header) / _customEntrySize
+	ENTRY_COUNT_MODE_FIXED,		//take the count from _numEntries field
+};
+
+// ScummEntryBlockPresenter is a base class for all the block presenters that
+// need to display some "entries" from the chunk (like offsets in LOFF chunk)
+// as text.
+class SCUMM_PLUGIN_API ScummEntryBlockPresenter : public ScummBlockTextPresenter {
+	DECLARE_BOBJECT_CLASS(ScummEntryBlockPresenter, ScummBlockTextPresenter)
+
+protected:
+	EntryCountMode _countMode;
+	uint32 _customEntrySize;
+	uint32 _numEntries;
+
+public:
+	ASSIGN_DESC(0,wxT("ScummObjects"), 1)
+
+	ScummEntryBlockPresenter(EntryCountMode countMode = ENTRY_COUNT_MODE_BYTE, uint32 customEntrySize = -1, uint32 numEntries = -1)
+	: _countMode(countMode), _customEntrySize(customEntrySize), _numEntries(numEntries) {}
+
+	virtual void doCreate(ScummBlock* block, Common::SeekableReadStream* stream);
+
+	virtual void determineNumEntries(ScummBlock* block, Common::SeekableReadStream* stream);
+	virtual wxString doPreEntries(ScummBlock* block, Common::SeekableReadStream* stream) { return wxT(""); }
+	virtual wxString doReadEntry(ScummBlock* block, uint32 idx, Common::SeekableReadStream* stream) { return wxT(""); }
+	virtual wxString doPostEntries(ScummBlock* block, Common::SeekableReadStream* stream) { return wxT(""); }
+};
+
+/////////////////////////////////////////////////////////////////////////////
+/////////////////////////////////////////////////////////////////////////////
+
+inline
+wxString toHex(uint32 num, int digits = 8) {
+	return wxString::Format(wxString::Format(wxT("%%0%dX"), digits), num);
+}
+
+/////////////////////////////////////////////////////////////////////////////
+/////////////////////////////////////////////////////////////////////////////
+
+} // namespace Browser
+
+#endif //_SCUMM_PRESENTER_BASE_H_


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

Added: scummex/branches/gsoc2007-gameresbrowser/src/plugins/scumm/ScummSpecificPresenters.cpp
===================================================================
--- scummex/branches/gsoc2007-gameresbrowser/src/plugins/scumm/ScummSpecificPresenters.cpp	                        (rev 0)
+++ scummex/branches/gsoc2007-gameresbrowser/src/plugins/scumm/ScummSpecificPresenters.cpp	2007-07-15 00:41:31 UTC (rev 28081)
@@ -0,0 +1,89 @@
+/////////////////////////////////////////////////////////////////////////////
+// ScummSpecificPresenters.cpp
+
+#include "scumm_stdafx.h"
+
+#include "scumm/ScummSpecificPresenters.h"
+#include "scumm/ScummResource.h"
+
+#include "CoreInterfaces.h"
+#include "PluginUtil.h"
+
+#include <iostream>
+
+#include "debugmem.h"
+
+namespace Browser {
+
+using namespace Core;
+
+/////////////////////////////////////////////////////////////////////////////
+/////////////////////////////////////////////////////////////////////////////
+
+wxString ScummLOFFBlockPresenter::doPreEntries(ScummBlock* block, Common::SeekableReadStream* stream) {
+	return wxString::Format(wxT("Number of rooms: %d\n\n"), _numEntries);
+}
+
+wxString ScummLOFFBlockPresenter::doReadEntry(ScummBlock* block, uint32 idx, Common::SeekableReadStream* stream) {
+	//infoout << wxT("ScummLOFFBlockPresenter::doReadEntry(): ") << std::endl;
+
+	byte roomNumber = stream->readByte();
+	uint32 offset = stream->readUint32LE();
+
+	wxString txt;
+	txt << wxT("Room Number: ") << roomNumber << wxEndl();
+	txt << wxT("Offset: ") << toHex(offset) << wxEndl();
+	return txt;
+}
+
+/////////////////////////////////////////////////////////////////////////////
+/////////////////////////////////////////////////////////////////////////////
+
+wxString ScummOFFSBlockPresenter::doPreEntries(ScummBlock* block, Common::SeekableReadStream* stream) {
+	return wxString::Format(wxT("Number of offsets: %d\n\n"), _numEntries);
+}
+
+wxString ScummOFFSBlockPresenter::doReadEntry(ScummBlock* block, uint32 idx, Common::SeekableReadStream* stream) {
+	//infoout << wxT("ScummLOFFBlockPresenter::doReadEntry(): ") << std::endl;
+
+	uint32 offset = stream->readUint32LE();
+
+	wxString txt;
+	txt << wxT("Offset: ") << toHex(offset) << wxEndl();
+	return txt;
+}
+
+/////////////////////////////////////////////////////////////////////////////
+/////////////////////////////////////////////////////////////////////////////
+
+void ScummRMHDBlockPresenter::doCreate(ScummBlock* block, Common::SeekableReadStream* stream) {
+	//infoout << wxT("ScummRMHDBlockPresenter::doCreate(): ") << std::endl;
+
+	uint32 width = stream->readUint16LE();
+	uint32 height = stream->readUint16LE();
+	uint32 objs = stream->readUint16LE();
+
+	wxString txt;
+	txt << wxT("Room Width: ") << width << wxEndl();
+	txt << wxT("Room Height: ") << height << wxEndl();
+	txt << wxT("Number Of Objects: ") << objs << wxEndl();
+	_text = txt;
+}
+
+/////////////////////////////////////////////////////////////////////////////
+/////////////////////////////////////////////////////////////////////////////
+
+void ScummTRNSBlockPresenter::doCreate(ScummBlock* block, Common::SeekableReadStream* stream) {
+	//infoout << wxT("ScummTRNSBlockPresenter::doCreate(): ") << std::endl;
+
+	uint32 transparentColor = stream->readUint16LE();
+
+	wxString txt;
+	txt << wxT("Transparent Color: ") << transparentColor << wxEndl();
+	_text = txt;
+}
+
+/////////////////////////////////////////////////////////////////////////////
+/////////////////////////////////////////////////////////////////////////////
+
+} // namespace Browser


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

Added: scummex/branches/gsoc2007-gameresbrowser/src/plugins/scumm/ScummSpecificPresenters.h
===================================================================
--- scummex/branches/gsoc2007-gameresbrowser/src/plugins/scumm/ScummSpecificPresenters.h	                        (rev 0)
+++ scummex/branches/gsoc2007-gameresbrowser/src/plugins/scumm/ScummSpecificPresenters.h	2007-07-15 00:41:31 UTC (rev 28081)
@@ -0,0 +1,83 @@
+/////////////////////////////////////////////////////////////////////////////
+// ScummSpecificPresenters.h
+
+#ifndef _SCUMM_SPECIFIC_PRESENTERS_H_
+#define _SCUMM_SPECIFIC_PRESENTERS_H_
+
+#include "ScummPresenterBase.h"
+
+namespace Browser {
+
+using namespace Core;
+
+using namespace Scumm;
+
+/////////////////////////////////////////////////////////////////////////////
+/////////////////////////////////////////////////////////////////////////////
+//
+// This file declares presenters specific for the following scumm chunks:
+//		LOFF
+//		OFFS
+//		RMHD
+//		TRNS
+// They are pretty self explanatory.
+//
+/////////////////////////////////////////////////////////////////////////////
+/////////////////////////////////////////////////////////////////////////////
+
+class SCUMM_PLUGIN_API ScummLOFFBlockPresenter : public ScummEntryBlockPresenter {
+	DECLARE_BOBJECT_CLASS(ScummLOFFBlockPresenter, ScummEntryBlockPresenter)
+
+public:
+	ASSIGN_DESC(0,wxT("ScummObjects"), 1)
+
+	virtual wxString doPreEntries(ScummBlock* block, Common::SeekableReadStream* stream);
+	virtual wxString doReadEntry(ScummBlock* block, uint32 idx, Common::SeekableReadStream* stream);
+};
+
+/////////////////////////////////////////////////////////////////////////////
+/////////////////////////////////////////////////////////////////////////////
+
+class SCUMM_PLUGIN_API ScummOFFSBlockPresenter : public ScummEntryBlockPresenter {
+	DECLARE_BOBJECT_CLASS(ScummOFFSBlockPresenter, ScummEntryBlockPresenter)
+
+public:
+	ASSIGN_DESC(0,wxT("ScummObjects"), 1)
+
+	ScummOFFSBlockPresenter()
+	: ScummEntryBlockPresenter(ENTRY_COUNT_MODE_CUSTOM, 4) {}
+
+	virtual wxString doPreEntries(ScummBlock* block, Common::SeekableReadStream* stream);
+	virtual wxString doReadEntry(ScummBlock* block, uint32 idx, Common::SeekableReadStream* stream);
+};
+
+/////////////////////////////////////////////////////////////////////////////
+/////////////////////////////////////////////////////////////////////////////
+
+class SCUMM_PLUGIN_API ScummRMHDBlockPresenter : public ScummBlockTextPresenter {
+	DECLARE_BOBJECT_CLASS(ScummRMHDBlockPresenter, ScummBlockTextPresenter)
+
+public:
+	ASSIGN_DESC(0,wxT("ScummObjects"), 1)
+
+	virtual void doCreate(ScummBlock* block, Common::SeekableReadStream* stream);
+};
+
+/////////////////////////////////////////////////////////////////////////////
+/////////////////////////////////////////////////////////////////////////////
+
+class SCUMM_PLUGIN_API ScummTRNSBlockPresenter : public ScummBlockTextPresenter {
+	DECLARE_BOBJECT_CLASS(ScummTRNSBlockPresenter, ScummBlockTextPresenter)
+
+public:
+	ASSIGN_DESC(0,wxT("ScummObjects"), 1)
+
+	virtual void doCreate(ScummBlock* block, Common::SeekableReadStream* stream);
+};
+
+/////////////////////////////////////////////////////////////////////////////
+/////////////////////////////////////////////////////////////////////////////
+
+} // namespace Browser
+
+#endif //_SCUMM_SPECIFIC_PRESENTERS_H_


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

Added: scummex/branches/gsoc2007-gameresbrowser/src/plugins/scumm/ScummSpecificPresenters2.cpp
===================================================================
--- scummex/branches/gsoc2007-gameresbrowser/src/plugins/scumm/ScummSpecificPresenters2.cpp	                        (rev 0)
+++ scummex/branches/gsoc2007-gameresbrowser/src/plugins/scumm/ScummSpecificPresenters2.cpp	2007-07-15 00:41:31 UTC (rev 28081)
@@ -0,0 +1,269 @@
+/////////////////////////////////////////////////////////////////////////////
+// ScummSpecificPresenters2.cpp
+
+#include "scumm_stdafx.h"
+
+#include "scumm/ScummSpecificPresenters2.h"
+
+#include "debugmem.h"
+
+namespace Browser {
+
+using namespace Core;
+
+/////////////////////////////////////////////////////////////////////////////
+/////////////////////////////////////////////////////////////////////////////
+//
+// This file declares presenters specific for the following scumm chunks:
+//		RNAM - RNAM and RN
+//		MAXS
+//		
+//		DOBJ - DOBJ and 0O
+//		ANAM
+//
+//		DIR	- DROO, DSCR, DSOU, DCOS, DCHR, DRSC
+//			  0R,   0S,   0N,   0C
+//
+//
+/////////////////////////////////////////////////////////////////////////////
+/////////////////////////////////////////////////////////////////////////////
+
+int _guess_scumm_version(ScummBlock* block) {
+	int guess = 5;
+
+	if (!block) return guess;
+
+	RootScummBlock* rootBlock = block->getRootScummBlock();
+	if (!rootBlock) return guess;
+
+	int scummVersion = rootBlock->getScummVersion();
+	if (scummVersion == -1) return guess;
+
+	return scummVersion;
+}
+
+/////////////////////////////////////////////////////////////////////////////
+/////////////////////////////////////////////////////////////////////////////
+
+void ScummRNAMBlockPresenter::doCreate(ScummBlock* block, Common::SeekableReadStream* stream) {
+	byte roomNo = stream->readByte();
+
+	int scV = _guess_scumm_version(block);
+	if (scV >= 6) {
+		if (roomNo == 0)
+			_text << wxT("No room names are stored in this scumm version.") << wxEndl();
+		else
+			_text << wxT("ERROR") << wxEndl();
+		return;
+	}
+
+	char roomName[10];
+	stream->read(roomName, 9);
+	roomName[9] = '\0';
+	for (int i = 0; i < 9; ++i)
+		roomName[i] ^= 0xFF;
+
+	_text << wxT("Room number: ") << roomNo << wxEndl();
+	_text << wxT("Room name: ") << toString(roomName) << wxEndl();
+}
+
+/////////////////////////////////////////////////////////////////////////////
+/////////////////////////////////////////////////////////////////////////////
+
+#ifdef ARRAYSIZE
+#undef ARRAYSIZE
+#endif
+#define ARRAYSIZE(x) ((int)(sizeof(x) / sizeof(x[0])))
+
+void ScummMAXSBlockPresenter::doCreate(ScummBlock* block, Common::SeekableReadStream* stream) {
+
+	int scV = _guess_scumm_version(block);
+
+	wxChar* fields_ltV6[] = {
+		wxT("Variables"),
+		wxT("Unknown"),
+		wxT("Bit Variables"),
+		wxT("Local Objects"),
+		wxT("Unknown"),
+		wxT("Character Sets"),
+		wxT("Unknown"),
+		wxT("Unknown"),
+		wxT("Inventory Objects"),
+	};
+
+	wxChar* fields_eqV6[] = {
+		wxT("Variables"),
+		wxT("Unknown"),
+		wxT("Bit Variables"),
+		wxT("Local Objects"),
+		wxT("Arrays"),
+		wxT("Unknown"),
+		wxT("Verbs"),
+		wxT("Floating Objects"),
+		wxT("Inventory Objects"),
+		wxT("Rooms"),
+		wxT("Scripts"),
+		wxT("Sounds"),
+		wxT("Character Sets"),
+		wxT("Costumes"),
+		wxT("Global Objects"),
+	};
+
+	wxChar* fields_eqV7[] = {
+		wxT("Variables"),
+		wxT("Bit Variables"),
+		wxT("Unknown"),
+		wxT("Global Objects"),
+		wxT("Local Objects"),
+		wxT("New Names"),
+		wxT("Verbs"),
+		wxT("Floating Objects"),
+		wxT("Inventory Objects"),
+		wxT("Arrays"),
+		wxT("Rooms"),
+		wxT("Scripts"),
+		wxT("Sounds"),
+		wxT("Character Sets"),
+		wxT("Costumes"),
+	};
+
+	wxChar* fields_eqV8[] = {
+		wxT("Variables"),
+		wxT("Bit Variables"),
+		wxT("Unknown"),
+		wxT("Scripts"),
+		wxT("Sounds"),
+		wxT("Character Sets"),
+		wxT("Costumes"),
+		wxT("Rooms"),
+		wxT("Unknown"),
+		wxT("Global Objects"),
+		wxT("Unknown"),
+		wxT("Local Objects"),
+		wxT("New Names"),
+		wxT("Floating Objects"),
+		wxT("Inventory Objects"),
+		wxT("Arrays"),
+		wxT("Verbs"),
+	};
+
+	wxChar** fields;
+	int numFields;
+	if (scV < 6) {
+		fields = fields_ltV6;
+		numFields = ARRAYSIZE(fields_ltV6);
+	} else if (scV == 6) {
+		fields = fields_eqV6;
+		numFields = ARRAYSIZE(fields_eqV6);
+	} else if (scV == 7) {
+		fields = fields_eqV7;
+		numFields = ARRAYSIZE(fields_eqV7);
+	} else {
+		fields = fields_eqV8;
+		numFields = ARRAYSIZE(fields_eqV8);
+	}
+
+	for (int i = 0; i < numFields; ++i) {
+		uint32 value = (scV < 8) ? (uint32)stream->readUint16LE()
+								 : stream->readUint32LE();
+		_text << fields[i] << wxT(": ") << value << wxEndl();
+	}
+}
+
+/////////////////////////////////////////////////////////////////////////////
+/////////////////////////////////////////////////////////////////////////////
+
+ScummDOBJBlockPresenter::ScummDOBJBlockPresenter()
+	: ScummEntryBlockPresenter(ENTRY_COUNT_MODE_INT16LE) {}
+
+wxString ScummDOBJBlockPresenter::doPreEntries(ScummBlock* block, Common::SeekableReadStream* stream) {
+	return wxString::Format(wxT("Number of objects: %d\n\n"), _numEntries);
+}
+
+wxString ScummDOBJBlockPresenter::doReadEntry(ScummBlock* block, uint32 idx, Common::SeekableReadStream* stream) {
+	byte ownerNState = stream->readByte();
+	byte owner   = ownerNState >> 4;
+	byte state   = ownerNState & 0x0F;
+	
+	wxString txt;
+	txt << wxT("Owner: ") << owner;
+	txt << wxT(" State: ") << toHex(state, 1) << wxEndl();
+	return txt;
+}
+
+/////////////////////////////////////////////////////////////////////////////
+/////////////////////////////////////////////////////////////////////////////
+
+ScummANAMBlockPresenter::ScummANAMBlockPresenter()
+	: ScummEntryBlockPresenter(ENTRY_COUNT_MODE_INT16LE) {}
+
+wxString ScummANAMBlockPresenter::doPreEntries(ScummBlock* block, Common::SeekableReadStream* stream) {
+	return wxString::Format(wxT("Number of animations: %d\n\n"), _numEntries);
+}
+
+wxString ScummANAMBlockPresenter::doReadEntry(ScummBlock* block, uint32 idx, Common::SeekableReadStream* stream) {
+	char animName[9];
+	stream->read(animName, 9);
+	animName[8] = '\0';
+
+	wxString txt;
+	txt << wxT("Animation name: ") << toString(animName) << wxEndl();
+	return txt;
+}
+
+/////////////////////////////////////////////////////////////////////////////
+/////////////////////////////////////////////////////////////////////////////
+
+void ScummDIRBlockPresenter::doCreate(ScummBlock* block, Common::SeekableReadStream* stream) {
+
+	int scV = _guess_scumm_version(block);
+
+	if (block->getTag()->equals("DROO") || block->getTag()->equals("0R"))
+		_title = wxT("Directory of Rooms");
+	else if (block->getTag()->equals("DSCR") || block->getTag()->equals("0S"))
+		_title = wxT("Directory of Scripts");
+	else if (block->getTag()->equals("DRSC"))
+		_title = wxT("Directory of Room Scripts");
+	else if (block->getTag()->equals("DSOU") || block->getTag()->equals("0N"))
+		_title = wxT("Directory of Sounds");
+	else if (block->getTag()->equals("DCOS") || block->getTag()->equals("0C"))
+		_title = wxT("Directory of Costumes");
+	else if (block->getTag()->equals("DCHR"))
+		_title = wxT("Directory of Charsets");
+	else
+		_title = wxT("Unknown Directory");
+
+	int32 numberOfItems = (scV < 8) ? (int32)stream->readSint16LE()
+									: stream->readSint32LE();
+
+	byte* itemNumbers = new byte[numberOfItems];
+	uint32* itemOffsets = new uint32[numberOfItems];
+
+	if (scV <= 4) {
+		for (int i = 0; i < numberOfItems; ++i) {
+			itemNumbers[i] = stream->readByte();
+			itemOffsets[i] = (scV < 8) ? stream->readUint32LE()
+										: (uint32)stream->readUint16LE();
+		}
+	} else {
+		for (int i = 0; i < numberOfItems; ++i)
+			itemNumbers[i] = stream->readByte();
+		for (int i = 0; i < numberOfItems; ++i)
+			itemOffsets[i] = (scV < 8) ? stream->readUint32LE()
+										: (uint32)stream->readUint16LE();
+	}
+
+	_text << wxT("Items: ") << numberOfItems << wxEndl();
+	for (int i = 0; i < numberOfItems; ++i) {
+		_text << wxT("Item number: ") << itemNumbers[i] << wxEndl();
+		_text << wxT("Item offset: ") << toHex(itemOffsets[i]) << wxEndl();
+	}
+
+	delete [] itemNumbers;
+	delete [] itemOffsets;
+}
+
+/////////////////////////////////////////////////////////////////////////////
+/////////////////////////////////////////////////////////////////////////////
+
+} // namespace Browser


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

Added: scummex/branches/gsoc2007-gameresbrowser/src/plugins/scumm/ScummSpecificPresenters2.h
===================================================================
--- scummex/branches/gsoc2007-gameresbrowser/src/plugins/scumm/ScummSpecificPresenters2.h	                        (rev 0)
+++ scummex/branches/gsoc2007-gameresbrowser/src/plugins/scumm/ScummSpecificPresenters2.h	2007-07-15 00:41:31 UTC (rev 28081)
@@ -0,0 +1,100 @@
+/////////////////////////////////////////////////////////////////////////////
+// ScummSpecificPresenters2.h
+
+#ifndef _SCUMM_SPECIFIC_PRESENTERS2_H_
+#define _SCUMM_SPECIFIC_PRESENTERS2_H_
+
+#include "ScummPresenterBase.h"
+
+namespace Browser {
+
+using namespace Core;
+
+using namespace Scumm;
+
+/////////////////////////////////////////////////////////////////////////////
+/////////////////////////////////////////////////////////////////////////////
+//
+// This file declares presenters specific for the following scumm chunks:
+//		RNAM - RNAM and RN
+//		MAXS
+//		
+//		DOBJ - DOBJ and 0O
+//		ANAM
+//
+//		DIR	- DROO, DSCR, DSOU, DCOS, DCHR, DRSC
+//			  0R,   0S,   0N,   0C
+//
+//
+/////////////////////////////////////////////////////////////////////////////
+/////////////////////////////////////////////////////////////////////////////
+
+class SCUMM_PLUGIN_API ScummRNAMBlockPresenter : public ScummBlockTextPresenter {
+	DECLARE_BOBJECT_CLASS(ScummRNAMBlockPresenter, ScummBlockTextPresenter)
+
+public:
+	ASSIGN_DESC(0,wxT("ScummObjects"), 1)
+
+	void doCreate(ScummBlock* block, Common::SeekableReadStream* stream);
+};
+
+/////////////////////////////////////////////////////////////////////////////
+/////////////////////////////////////////////////////////////////////////////
+
+class SCUMM_PLUGIN_API ScummMAXSBlockPresenter : public ScummBlockTextPresenter {
+	DECLARE_BOBJECT_CLASS(ScummMAXSBlockPresenter, ScummBlockTextPresenter)
+
+public:
+	ASSIGN_DESC(0,wxT("ScummObjects"), 1)
+
+	void doCreate(ScummBlock* block, Common::SeekableReadStream* stream);
+};
+
+/////////////////////////////////////////////////////////////////////////////
+/////////////////////////////////////////////////////////////////////////////
+
+class SCUMM_PLUGIN_API ScummDOBJBlockPresenter : public ScummEntryBlockPresenter {
+	DECLARE_BOBJECT_CLASS(ScummDOBJBlockPresenter, ScummEntryBlockPresenter)
+
+public:
+	ASSIGN_DESC(0,wxT("ScummObjects"), 1)
+
+	ScummDOBJBlockPresenter();
+
+	wxString doPreEntries(ScummBlock* block, Common::SeekableReadStream* stream);
+	wxString doReadEntry(ScummBlock* block, uint32 idx, Common::SeekableReadStream* stream);
+};
+
+/////////////////////////////////////////////////////////////////////////////
+/////////////////////////////////////////////////////////////////////////////
+
+class SCUMM_PLUGIN_API ScummANAMBlockPresenter : public ScummEntryBlockPresenter {
+	DECLARE_BOBJECT_CLASS(ScummANAMBlockPresenter, ScummEntryBlockPresenter)
+
+public:
+	ASSIGN_DESC(0,wxT("ScummObjects"), 1)
+
+	ScummANAMBlockPresenter();
+
+	wxString doPreEntries(ScummBlock* block, Common::SeekableReadStream* stream);
+	wxString doReadEntry(ScummBlock* block, uint32 idx, Common::SeekableReadStream* stream);
+};
+
+/////////////////////////////////////////////////////////////////////////////
+/////////////////////////////////////////////////////////////////////////////
+
+class SCUMM_PLUGIN_API ScummDIRBlockPresenter : public ScummBlockTextPresenter {
+	DECLARE_BOBJECT_CLASS(ScummDIRBlockPresenter, ScummBlockTextPresenter)
+
+public:
+	ASSIGN_DESC(0,wxT("ScummObjects"), 1)
+
+	void doCreate(ScummBlock* block, Common::SeekableReadStream* stream);
+};
+
+/////////////////////////////////////////////////////////////////////////////
+/////////////////////////////////////////////////////////////////////////////
+
+} // namespace Browser
+
+#endif //_SCUMM_SPECIFIC_PRESENTERS2_H_


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

Modified: scummex/branches/gsoc2007-gameresbrowser/src/plugins/scumm/scumm_plugin.cpp
===================================================================
--- scummex/branches/gsoc2007-gameresbrowser/src/plugins/scumm/scumm_plugin.cpp	2007-07-14 21:52:26 UTC (rev 28080)
+++ scummex/branches/gsoc2007-gameresbrowser/src/plugins/scumm/scumm_plugin.cpp	2007-07-15 00:41:31 UTC (rev 28081)
@@ -19,7 +19,8 @@
 #include "scumm/ScummRecognizer.h"
 #include "scumm/ScummParser.h"
 #include "scumm/ScummBlockPresenter.h"
-#include "scumm/ScummBlockInfoPresenter.h"
+#include "scumm/ScummCommonPresenters.h"
+#include "scumm/ScummSpecificPresenters.h"
 #include "scumm/BlockyBlockPresenter.h"
 
 #include "debugmem.h"


Property changes on: scummex/branches/gsoc2007-gameresbrowser/vc8
___________________________________________________________________
Name: svn:ignore
   - debug unicode
data
debug

   + debug unicode
data
debug
help
data
data2



Property changes on: scummex/branches/gsoc2007-gameresbrowser/vc8/basic_plugin
___________________________________________________________________
Name: svn:ignore
   + basic_plugin.vcproj.ELWOOD.RootBoot.user
Debug
Debug Unicode



Property changes on: scummex/branches/gsoc2007-gameresbrowser/vc8/browser
___________________________________________________________________
Name: svn:ignore
   + browser.vcproj.ELWOOD.RootBoot.user
Debug
Debug Unicode



Property changes on: scummex/branches/gsoc2007-gameresbrowser/vc8/browserapp
___________________________________________________________________
Name: svn:ignore
   + browserapp.vcproj.ELWOOD.RootBoot.user
Debug
Debug Unicode



Property changes on: scummex/branches/gsoc2007-gameresbrowser/vc8/core
___________________________________________________________________
Name: svn:ignore
   + core.vcproj.ELWOOD.RootBoot.user
Debug
Debug Unicode



Property changes on: scummex/branches/gsoc2007-gameresbrowser/vc8/scumm_plugin
___________________________________________________________________
Name: svn:ignore
   + scumm_plugin.vcproj.ELWOOD.RootBoot.user
Debug
Debug Unicode


Modified: scummex/branches/gsoc2007-gameresbrowser/vc8/scumm_plugin/scumm_plugin.vcproj
===================================================================
--- scummex/branches/gsoc2007-gameresbrowser/vc8/scumm_plugin/scumm_plugin.vcproj	2007-07-14 21:52:26 UTC (rev 28080)
+++ scummex/branches/gsoc2007-gameresbrowser/vc8/scumm_plugin/scumm_plugin.vcproj	2007-07-15 00:41:31 UTC (rev 28081)
@@ -324,11 +324,11 @@
 				>
 			</File>
 			<File
-				RelativePath="..\..\src\plugins\scumm\ScummBlockInfoPresenter.cpp"
+				RelativePath="..\..\src\plugins\scumm\ScummBlockPresenter.cpp"
 				>
 			</File>
 			<File
-				RelativePath="..\..\src\plugins\scumm\ScummBlockPresenter.cpp"
+				RelativePath="..\..\src\plugins\scumm\ScummCommonPresenters.cpp"
 				>
 			</File>
 			<File
@@ -336,11 +336,11 @@
 				>
 			</File>
 			<File
-				RelativePath="..\..\src\plugins\scumm\ScummImage.cpp"
+				RelativePath="..\..\src\plugins\scumm\ScummParser.cpp"
 				>
 			</File>
 			<File
-				RelativePath="..\..\src\plugins\scumm\ScummParser.cpp"
+				RelativePath="..\..\src\plugins\scumm\ScummPresenterBase.cpp"
 				>
 			</File>
 			<File
@@ -352,6 +352,14 @@
 				>
 			</File>
 			<File
+				RelativePath="..\..\src\plugins\scumm\ScummSpecificPresenters.cpp"
+				>
+			</File>
+			<File
+				RelativePath="..\..\src\plugins\scumm\ScummSpecificPresenters2.cpp"
+				>
+			</File>
+			<File
 				RelativePath="..\..\src\plugins\scumm\ScummTag.cpp"
 				>
 			</File>
@@ -402,11 +410,11 @@
 				>
 			</File>
 			<File
-				RelativePath="..\..\src\plugins\scumm\ScummBlockInfoPresenter.h"
+				RelativePath="..\..\src\plugins\scumm\ScummBlockPresenter.h"
 				>
 			</File>
 			<File
-				RelativePath="..\..\src\plugins\scumm\ScummBlockPresenter.h"
+				RelativePath="..\..\src\plugins\scumm\ScummCommonPresenters.h"
 				>
 			</File>
 			<File
@@ -422,6 +430,10 @@
 				>
 			</File>
 			<File
+				RelativePath="..\..\src\plugins\scumm\ScummPresenterBase.h"
+				>
+			</File>
+			<File
 				RelativePath="..\..\src\plugins\scumm\ScummRecognizer.h"
 				>
 			</File>
@@ -430,6 +442,14 @@
 				>
 			</File>
 			<File
+				RelativePath="..\..\src\plugins\scumm\ScummSpecificPresenters.h"
+				>
+			</File>
+			<File
+				RelativePath="..\..\src\plugins\scumm\ScummSpecificPresenters2.h"
+				>
+			</File>
+			<File
 				RelativePath="..\..\src\plugins\scumm\ScummTag.h"
 				>
 			</File>


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