[Scummvm-cvs-logs] SF.net SVN: scummvm: [27969] scummex/branches/gsoc2007-gameresbrowser
zbychs at users.sourceforge.net
zbychs at users.sourceforge.net
Sun Jul 8 18:26:22 CEST 2007
Revision: 27969
http://scummvm.svn.sourceforge.net/scummvm/?rev=27969&view=rev
Author: zbychs
Date: 2007-07-08 09:26:22 -0700 (Sun, 08 Jul 2007)
Log Message:
-----------
Added more of support for Scumm data files - no block specific parsers yet.
Modified Paths:
--------------
scummex/branches/gsoc2007-gameresbrowser/src/core/CoreFileTypes.cpp
scummex/branches/gsoc2007-gameresbrowser/src/core/CoreFileTypes.h
scummex/branches/gsoc2007-gameresbrowser/src/core/core_stdafx.h
scummex/branches/gsoc2007-gameresbrowser/src/core/ochain.cpp
scummex/branches/gsoc2007-gameresbrowser/src/core/ochain.h
scummex/branches/gsoc2007-gameresbrowser/src/core/safe_static.h
scummex/branches/gsoc2007-gameresbrowser/src/core/tostring.h
scummex/branches/gsoc2007-gameresbrowser/src/gui/DirectoryPresenter.cpp
scummex/branches/gsoc2007-gameresbrowser/src/gui/DirectoryPresenter.h
scummex/branches/gsoc2007-gameresbrowser/src/gui/ExplorationTree.cpp
scummex/branches/gsoc2007-gameresbrowser/src/gui/ExplorationTree.h
scummex/branches/gsoc2007-gameresbrowser/src/gui/FileInfoPresenter.cpp
scummex/branches/gsoc2007-gameresbrowser/src/gui/MainForm.cpp
scummex/branches/gsoc2007-gameresbrowser/src/gui/MainForm.wxform
scummex/branches/gsoc2007-gameresbrowser/src/gui/MainFormCommands.cpp
scummex/branches/gsoc2007-gameresbrowser/src/gui/Test1.cpp
scummex/branches/gsoc2007-gameresbrowser/src/gui/Test2.cpp
scummex/branches/gsoc2007-gameresbrowser/src/plugins/scumm/BlockyBlockPresenter.cpp
scummex/branches/gsoc2007-gameresbrowser/src/plugins/scumm/BlockyBlockPresenter.h
scummex/branches/gsoc2007-gameresbrowser/src/plugins/scumm/ScummBlockPresenter.cpp
scummex/branches/gsoc2007-gameresbrowser/src/plugins/scumm/ScummBlockPresenter.h
scummex/branches/gsoc2007-gameresbrowser/src/plugins/scumm/ScummRecognizer.cpp
scummex/branches/gsoc2007-gameresbrowser/src/plugins/scumm/ScummRecognizer.h
scummex/branches/gsoc2007-gameresbrowser/src/plugins/scumm/resource.cpp
scummex/branches/gsoc2007-gameresbrowser/src/plugins/scumm/resource.h
scummex/branches/gsoc2007-gameresbrowser/vc8/core/core.vcproj
scummex/branches/gsoc2007-gameresbrowser/vc8/plugins/plugins.vcproj
scummex/branches/gsoc2007-gameresbrowser/wxdev/Browser.dev
scummex/branches/gsoc2007-gameresbrowser/wxdev/Browser.layout
Added Paths:
-----------
scummex/branches/gsoc2007-gameresbrowser/src/core/tostring.cpp
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/ScummFileTypes.cpp
scummex/branches/gsoc2007-gameresbrowser/src/plugins/scumm/ScummFileTypes.h
Property Changed:
----------------
scummex/branches/gsoc2007-gameresbrowser/vc8/Browser/
scummex/branches/gsoc2007-gameresbrowser/vc8/core/
scummex/branches/gsoc2007-gameresbrowser/vc8/plugin_sample1/
scummex/branches/gsoc2007-gameresbrowser/vc8/plugins/
scummex/branches/gsoc2007-gameresbrowser/wxdev/
Modified: scummex/branches/gsoc2007-gameresbrowser/src/core/CoreFileTypes.cpp
===================================================================
--- scummex/branches/gsoc2007-gameresbrowser/src/core/CoreFileTypes.cpp 2007-07-08 13:53:56 UTC (rev 27968)
+++ scummex/branches/gsoc2007-gameresbrowser/src/core/CoreFileTypes.cpp 2007-07-08 16:26:22 UTC (rev 27969)
@@ -33,7 +33,13 @@
/////////////////////////////////////////////////////////////////////////////
/////////////////////////////////////////////////////////////////////////////
+// Presenters TODO: move it to a different header
+SAFE_STATIC(fileInfoPresenterGUID, BGUID, (wxT("CoreObjects"), wxT("FileInfoPresenter"), 1) )
+
+/////////////////////////////////////////////////////////////////////////////
+/////////////////////////////////////////////////////////////////////////////
+
} // namespace CoreFileTypes
} // namespace Browser
Modified: scummex/branches/gsoc2007-gameresbrowser/src/core/CoreFileTypes.h
===================================================================
--- scummex/branches/gsoc2007-gameresbrowser/src/core/CoreFileTypes.h 2007-07-08 13:53:56 UTC (rev 27968)
+++ scummex/branches/gsoc2007-gameresbrowser/src/core/CoreFileTypes.h 2007-07-08 16:26:22 UTC (rev 27969)
@@ -32,7 +32,13 @@
/////////////////////////////////////////////////////////////////////////////
/////////////////////////////////////////////////////////////////////////////
+// Presenters TODO: move it to a different header
+SAFE_STATIC_DECL(fileInfoPresenterGUID, BGUID)
+
+/////////////////////////////////////////////////////////////////////////////
+/////////////////////////////////////////////////////////////////////////////
+
} // namespace CoreFileTypes
} // namespace Browser
Modified: scummex/branches/gsoc2007-gameresbrowser/src/core/core_stdafx.h
===================================================================
--- scummex/branches/gsoc2007-gameresbrowser/src/core/core_stdafx.h 2007-07-08 13:53:56 UTC (rev 27968)
+++ scummex/branches/gsoc2007-gameresbrowser/src/core/core_stdafx.h 2007-07-08 16:26:22 UTC (rev 27969)
@@ -23,11 +23,13 @@
#define infoout std::wcout
#define streamout std::wostream
#define strstreamout std::wostringstream
+ #define fstreamout std::wfstream
#else
#define errout std::cerr
#define infoout std::cout
#define streamout std::ostream
#define strstreamout std::ostringstream
+ #define fstreamout std::fstream
#endif
#define coreString wxString
Modified: scummex/branches/gsoc2007-gameresbrowser/src/core/ochain.cpp
===================================================================
--- scummex/branches/gsoc2007-gameresbrowser/src/core/ochain.cpp 2007-07-08 13:53:56 UTC (rev 27968)
+++ scummex/branches/gsoc2007-gameresbrowser/src/core/ochain.cpp 2007-07-08 16:26:22 UTC (rev 27969)
@@ -15,6 +15,8 @@
#include <iostream>
#include <algorithm>
+#include <fstream>
+
#include "debugmem.h"
namespace Browser {
@@ -553,6 +555,20 @@
return out;
}
+bool ObjectChain::dumpObjectChain(coreString fileName) {
+ fstreamout file;
+ file.open(fileName.mb_str(), std::ios_base::out | std::ios_base::trunc);
+
+ if (!file.fail())
+ this->dumpObjectChainStart(wxString(wxT("ObjectChain")), file);
+
+ if (!file.fail())
+ return true;
+
+ errout << wxT("Failed Dumping Object Chain to file: ") << fileName << std::endl;
+ return false;
+}
+
void ObjectChain::dumpObjectChainStart(coreString ochainname, streamout& os) {
ASSERT_STATICS_ALLOWED();
static int graph_count = -1;
Modified: scummex/branches/gsoc2007-gameresbrowser/src/core/ochain.h
===================================================================
--- scummex/branches/gsoc2007-gameresbrowser/src/core/ochain.h 2007-07-08 13:53:56 UTC (rev 27968)
+++ scummex/branches/gsoc2007-gameresbrowser/src/core/ochain.h 2007-07-08 16:26:22 UTC (rev 27969)
@@ -45,6 +45,7 @@
public:
+ bool dumpObjectChain(coreString fileName);
void dumpObjectChainStart(coreString ochainname, streamout& os);
void dumpObjectChain(coreString ochainname, streamout& os);
Modified: scummex/branches/gsoc2007-gameresbrowser/src/core/safe_static.h
===================================================================
--- scummex/branches/gsoc2007-gameresbrowser/src/core/safe_static.h 2007-07-08 13:53:56 UTC (rev 27968)
+++ scummex/branches/gsoc2007-gameresbrowser/src/core/safe_static.h 2007-07-08 16:26:22 UTC (rev 27969)
@@ -28,6 +28,10 @@
return safe; \
}
+#define INLINE_SAFE_STATIC(name, type, initialisation) \
+ inline \
+ SAFE_STATIC(name, type, initialisation)
+
#define SAFE_CLASS_STATIC_DECL(clazz, name, type) \
const type& name();
Added: scummex/branches/gsoc2007-gameresbrowser/src/core/tostring.cpp
===================================================================
--- scummex/branches/gsoc2007-gameresbrowser/src/core/tostring.cpp (rev 0)
+++ scummex/branches/gsoc2007-gameresbrowser/src/core/tostring.cpp 2007-07-08 16:26:22 UTC (rev 27969)
@@ -0,0 +1,23 @@
+/////////////////////////////////////////////////////////////////////////////
+// tostring.cpp
+//
+// Declares toString() template
+//
+
+#include "core_stdafx.h"
+
+#include "tostring.h"
+
+#include "debugmem.h"
+
+namespace Browser {
+
+/////////////////////////////////////////////////////////////////////////////
+/////////////////////////////////////////////////////////////////////////////
+
+SAFE_STATIC(wxEndl, wxString, (wxT("\n")))
+
+/////////////////////////////////////////////////////////////////////////////
+/////////////////////////////////////////////////////////////////////////////
+
+} // namespace Browser
Property changes on: scummex/branches/gsoc2007-gameresbrowser/src/core/tostring.cpp
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Name: svn:eol-style
+ native
Modified: scummex/branches/gsoc2007-gameresbrowser/src/core/tostring.h
===================================================================
--- scummex/branches/gsoc2007-gameresbrowser/src/core/tostring.h 2007-07-08 13:53:56 UTC (rev 27968)
+++ scummex/branches/gsoc2007-gameresbrowser/src/core/tostring.h 2007-07-08 16:26:22 UTC (rev 27969)
@@ -12,6 +12,8 @@
#include <ostream>
#include <sstream>
+#include "safe_static.h"
+
namespace Browser {
/////////////////////////////////////////////////////////////////////////////
@@ -80,6 +82,8 @@
return os << str.c_str();
}
+SAFE_STATIC_DECL(wxEndl, wxString)
+
/////////////////////////////////////////////////////////////////////////////
/////////////////////////////////////////////////////////////////////////////
Modified: scummex/branches/gsoc2007-gameresbrowser/src/gui/DirectoryPresenter.cpp
===================================================================
--- scummex/branches/gsoc2007-gameresbrowser/src/gui/DirectoryPresenter.cpp 2007-07-08 13:53:56 UTC (rev 27968)
+++ scummex/branches/gsoc2007-gameresbrowser/src/gui/DirectoryPresenter.cpp 2007-07-08 16:26:22 UTC (rev 27969)
@@ -57,10 +57,6 @@
deleteKidChains();
- //is this in the right place? after the kids unrealisation? probably.
- VirtualNode* node = _inodeprovider->getNode();
- ExplorationTree::get()->deleteChildren(node->getTreeItem());
-
_expanded = false;
_idirectory = NULL;
_inodeprovider = NULL;
@@ -71,7 +67,7 @@
BObject::doUnrealize(ochain);
}
-bool DirectoryPresenter::prepareKidChain(const RCPtr<VirtualNode>& virtualNode, guid_list& parsers) {
+ObjectChain* DirectoryPresenter::prepareKidChain(const RCPtr<VirtualNode>& virtualNode, guid_list& parsers) {
ObjectChain* kidchain = new ObjectChain();
@@ -96,11 +92,10 @@
//ASSERT(false); //failure here means we've got a missing plugin
delete kidchain;
//virtualNode is deleted automatically
- return false;
+ return NULL;
}
- _kidChains.push_back( kidchain );
- return true;
+ return kidchain;
}
void DirectoryPresenter::expand() {
@@ -134,7 +129,27 @@
guid_list parsers;
//could omit it - ObjectChain::complete() would find it
parsers.push_back( DirectoryPresenter::static_GUID() );
- prepareKidChain(virtualDir, parsers);
+
+ ObjectChain* kidchain = prepareKidChain(virtualDir, parsers);
+ if (!kidchain) {
+ errout << wxT("ERROR: DirectoryPresenter::expand(): can't prepare kid chain for dir: ")
+ << idirectory->getName() << std::endl;
+ ExplorationTree::get()->deleteItem(kidTreeItem);
+ } else {
+ kidchain->complete();
+ bool res = kidchain->realize();
+ if (!res) {
+ errout << wxT("ERROR: DirectoryPresenter::expand(): can't realize chain for dir: ")
+ << idirectory->getName() << std::endl;
+ wxString outName = idirectory->getName() + wxT(".dot");
+ errout << wxT("Dumping Object Chain to: ") << outName << std::endl;
+ kidchain->dumpObjectChain(outName);
+ delete kidchain;
+ ExplorationTree::get()->deleteItem(kidTreeItem);
+ } else {
+ _kidChains.push_back(kidchain);
+ }
+ }
}
const std::list<IFile*>& files = _idirectory->getFiles();
@@ -163,15 +178,34 @@
//Ok, we've got the best parsers, so create a dedicated ObjectChain:
- prepareKidChain(virtualNode, parsers);
+ ObjectChain* kidchain = prepareKidChain(virtualNode, parsers);
+ if (!kidchain) {
+ errout << wxT("ERROR: DirectoryPresenter::expand(): can't prepare kid chain for file: ")
+ << ifile->getName() << wxT(" file type: ") << outFileType.getFileTypeGUID() << std::endl;
+ ExplorationTree::get()->deleteItem(kidTreeItem);
+ } else {
+ kidchain->complete();
+ bool res = kidchain->realize();
+ if (!res) {
+ errout << wxT("ERROR: DirectoryPresenter::expand(): can't realize chain for file: ")
+ << ifile->getName() << wxT(" file type: ") << outFileType.getFileTypeGUID() << std::endl;
+ wxString outName = ifile->getName() + wxT(".dot");
+ errout << wxT("Dumping Object Chain to: ") << outName << std::endl;
+ kidchain->dumpObjectChain(outName);
+ delete kidchain;
+ ExplorationTree::get()->deleteItem(kidTreeItem);
+ } else {
+ _kidChains.push_back(kidchain);
+ }
+ }
}
//now realize those chains:
- if (!realizeKidChains()) {
+ /*if (!realizeKidChains()) {
deleteKidChains();
errout << wxT("ERROR: DirectoryPresenter::expand(): can't realize kids.") << std::endl;
return; //TODO: report error
- }
+ }*/
}
void DirectoryPresenter::deleteKidChains() {
@@ -181,21 +215,19 @@
delete kidchain; //unrealize
}
_kidChains.clear();
+
+ VirtualNode* node = _inodeprovider->getNode();
+ ExplorationTree::get()->deleteChildren(node->getTreeItem());
}
bool DirectoryPresenter::realizeKidChains() {
bool res = true;
- std::list<ObjectChain*>::const_iterator i;
+ /*std::list<ObjectChain*>::const_iterator i;
for (i = _kidChains.begin(); i != _kidChains.end(); ++i) {
ObjectChain* kidchain = *i;
kidchain->complete();
-
- /*RCPtr<FilePresenter> fpres(new FilePresenter());
- kidchain->addObject(fpres);
- kidchain->complete();*/
-
res &= kidchain->realize();
- }
+ }*/
return res;
}
Modified: scummex/branches/gsoc2007-gameresbrowser/src/gui/DirectoryPresenter.h
===================================================================
--- scummex/branches/gsoc2007-gameresbrowser/src/gui/DirectoryPresenter.h 2007-07-08 13:53:56 UTC (rev 27968)
+++ scummex/branches/gsoc2007-gameresbrowser/src/gui/DirectoryPresenter.h 2007-07-08 16:26:22 UTC (rev 27969)
@@ -47,7 +47,7 @@
virtual void deleteKidChains();
virtual void expand();
- bool prepareKidChain(const RCPtr<VirtualNode>& virtualNode, guid_list& parsers);
+ ObjectChain* prepareKidChain(const RCPtr<VirtualNode>& virtualNode, guid_list& parsers);
virtual void dumpObjectChains(streamout& os);
Modified: scummex/branches/gsoc2007-gameresbrowser/src/gui/ExplorationTree.cpp
===================================================================
--- scummex/branches/gsoc2007-gameresbrowser/src/gui/ExplorationTree.cpp 2007-07-08 13:53:56 UTC (rev 27968)
+++ scummex/branches/gsoc2007-gameresbrowser/src/gui/ExplorationTree.cpp 2007-07-08 16:26:22 UTC (rev 27969)
@@ -218,6 +218,12 @@
}
}
+void ExplorationTree::deleteItem(const wxTreeItemId& item) {
+ ASSERT_VALID_TREE_ITEM(item);
+ _explorationTree->Delete(item);
+ //_recDel(parent, false);
+}
+
void ExplorationTree::deleteChildren(const wxTreeItemId& parent) {
ASSERT_VALID_TREE_ITEM(parent);
_explorationTree->DeleteChildren(parent);
Modified: scummex/branches/gsoc2007-gameresbrowser/src/gui/ExplorationTree.h
===================================================================
--- scummex/branches/gsoc2007-gameresbrowser/src/gui/ExplorationTree.h 2007-07-08 13:53:56 UTC (rev 27968)
+++ scummex/branches/gsoc2007-gameresbrowser/src/gui/ExplorationTree.h 2007-07-08 16:26:22 UTC (rev 27969)
@@ -57,6 +57,7 @@
wxTreeItemId getSelected();
wxTreeItemId appendItem(const wxTreeItemId& parent, wxString title);
void _recDel(const wxTreeItemId& item, bool thisToo); //HACK
+ void deleteItem(const wxTreeItemId& item);
void deleteChildren(const wxTreeItemId& parent);
void setItemData(const wxTreeItemId& item, wxTreeItemData* data);
wxTreeItemData* getItemData(const wxTreeItemId& item);
Modified: scummex/branches/gsoc2007-gameresbrowser/src/gui/FileInfoPresenter.cpp
===================================================================
--- scummex/branches/gsoc2007-gameresbrowser/src/gui/FileInfoPresenter.cpp 2007-07-08 13:53:56 UTC (rev 27968)
+++ scummex/branches/gsoc2007-gameresbrowser/src/gui/FileInfoPresenter.cpp 2007-07-08 16:26:22 UTC (rev 27969)
@@ -130,35 +130,34 @@
return wxT("ERROR: could not get IFile interface");
}
- wxString endl(wxT("\n"));
wxString text;
- text << wxT("File name: ") << ifile->getName() << endl;
+ text << wxT("File name: ") << ifile->getName() << wxEndl();
text << wxT("File type: ");
if (ifile->getFileType().isOk())
- text << toStringEx(ifile->getFileType().getFileTypeGUID().identifier) << endl;
+ text << toStringEx(ifile->getFileType().getFileTypeGUID().identifier) << wxEndl();
else
- text << wxT("Unknown") << endl;
+ text << wxT("Unknown") << wxEndl();
IDirectory* idir = ifile->getParentDirectory();
if (!idir) {
- text << wxT("No directory info.") << endl;
+ text << wxT("No directory info.") << wxEndl();
} else {
- text << wxT("Parent directory: ") << idir->getName() << endl;
+ text << wxT("Parent directory: ") << idir->getName() << wxEndl();
text << wxT("Directory type: ");
if (idir->getDirectoryFileType().isOk())
- text << toStringEx(idir->getDirectoryFileType().getFileTypeGUID().identifier) << endl;
+ text << toStringEx(idir->getDirectoryFileType().getFileTypeGUID().identifier) << wxEndl();
else
- text << wxT("Unknown") << endl;
+ text << wxT("Unknown") << wxEndl();
}
Common::SeekableReadStream* stream = ifile->getStream();
if (!stream) {
- text << wxT("ERROR while getting Stream") << endl;
+ text << wxT("ERROR while getting Stream") << wxEndl();
} else {
uint32 p = stream->pos();
uint32 s = stream->size();
- text << wxT("Size: ") << s << endl;
- text << wxT("Current position in file: ") << p << endl;
+ text << wxT("Size: ") << s << wxEndl();
+ text << wxT("Current position in file: ") << p << wxEndl();
}
_fileSlot->releaseInterface();
Modified: scummex/branches/gsoc2007-gameresbrowser/src/gui/MainForm.cpp
===================================================================
--- scummex/branches/gsoc2007-gameresbrowser/src/gui/MainForm.cpp 2007-07-08 13:53:56 UTC (rev 27968)
+++ scummex/branches/gsoc2007-gameresbrowser/src/gui/MainForm.cpp 2007-07-08 16:26:22 UTC (rev 27969)
@@ -13,12 +13,6 @@
#include <fstream>
-#ifdef NO_BOBJECTS
- #undef NO_BOBJECTS
-#endif
-
-#ifndef NO_BOBJECTS
-
#include "ExplorationTree.h"
#include "ftregistry.h"
#include "oregistry.h"
@@ -26,8 +20,6 @@
#include "safe_static.h"
-#endif
-
#include "debugmem.h"
using namespace Browser;
@@ -72,9 +64,7 @@
mainPanel->SetSize( wxSize(400, 300) );
Layout();
-#ifndef NO_BOBJECTS
ExplorationTree::initialize(browserTree, browserNotebook);
-#endif
wxChar* leak = new wxChar[5]; // a deliberate memory leak
leak[0] = 'L'; leak[1] = 'E'; leak[2] = 'A'; leak[3] = 'K'; leak[4] = '\0';
@@ -82,7 +72,6 @@
void MainForm::ZCleanup() {
-#ifndef NO_BOBJECTS
InitializedObjects::get()->report();
ExplorationTree::release();
@@ -97,8 +86,6 @@
InitializedObjects::release();
set_statics_not_allowed();
-#endif
-
}
MainForm::~MainForm() {
@@ -148,10 +135,10 @@
WxMenuBar1->Append(ID_COMMANDS_MENU_Mnu_Obj, wxT("Commands"));
wxMenu *ID_TEST_MENU_Mnu_Obj = new wxMenu(0);
- ID_TEST_MENU_Mnu_Obj->Append(ID_TEST1, wxT("Test1"), wxT(""), wxITEM_NORMAL);
- ID_TEST_MENU_Mnu_Obj->Append(ID_TEST1_CLEANUP, wxT("Test1 Cleanup"), wxT(""), wxITEM_NORMAL);
- ID_TEST_MENU_Mnu_Obj->Append(ID_TEST0, wxT("Test0"), wxT(""), wxITEM_NORMAL);
- ID_TEST_MENU_Mnu_Obj->Append(ID_TEST2, wxT("Test2"), wxT(""), wxITEM_NORMAL);
+ ID_TEST_MENU_Mnu_Obj->Append(ID_TEST1, wxT("Test1 - No Scumm Plugins"), wxT(""), wxITEM_NORMAL);
+ ID_TEST_MENU_Mnu_Obj->Append(ID_TEST1_CLEANUP, wxT("Test Cleanup"), wxT(""), wxITEM_NORMAL);
+ ID_TEST_MENU_Mnu_Obj->Append(ID_TEST0, wxT("Test0 - No Scumm Plugins"), wxT(""), wxITEM_NORMAL);
+ ID_TEST_MENU_Mnu_Obj->Append(ID_TEST2, wxT("Test2 - With Scumm Plugins"), wxT(""), wxITEM_NORMAL);
WxMenuBar1->Append(ID_TEST_MENU_Mnu_Obj, wxT("Tests"));
SetMenuBar(WxMenuBar1);
Modified: scummex/branches/gsoc2007-gameresbrowser/src/gui/MainForm.wxform
===================================================================
--- scummex/branches/gsoc2007-gameresbrowser/src/gui/MainForm.wxform 2007-07-08 13:53:56 UTC (rev 27968)
+++ scummex/branches/gsoc2007-gameresbrowser/src/gui/MainForm.wxform 2007-07-08 16:26:22 UTC (rev 27969)
@@ -1,4 +1,4 @@
-object frmNewForm_1: TfrmNewForm
+object frmNewForm: TfrmNewForm
Left = 8
Top = 8
AutoScroll = False
@@ -326,7 +326,7 @@
6172726965642E57785F436865636B65640816436172726965642E57585F4249
544D41502E446174610A0C00000007544269746D617000000000164361727269
65642E57785F46696C65486973746F72790818436172726965642E5778437573
- 746F6D4D656E754974656D0A6305000011000000545778437573746F6D4D656E
+ 746F6D4D656E754974656D0A9D05000011000000545778437573746F6D4D656E
754974656D5450463018547778437573746F6D4D656E754974656D5772617070
65720011436172726965642E49735375624D656E750810436172726965642E45
56545F4D656E7506074F6E546573743112436172726965642E57785F456E6162
@@ -334,42 +334,44 @@
57785F49444E616D65060849445F544553543112436172726965642E57785F49
4456616C756503F30318436172726965642E57785F4D656E754974656D537479
6C65070F77784D6E7549746D5F4E6F726D616C12436172726965642E57785F43
- 617074696F6E0605546573743112436172726965642E57785F436865636B6564
- 0816436172726965642E57585F4249544D41502E446174610A0C000000075442
- 69746D61700000000016436172726965642E57785F46696C65486973746F7279
- 08000011000000545778437573746F6D4D656E754974656D5450463018547778
- 437573746F6D4D656E754974656D577261707065720011436172726965642E49
- 735375624D656E750810436172726965642E4556545F4D656E75060E4F6E5465
- 737431436C65616E757012436172726965642E57785F456E61626C6564091143
- 6172726965642E57785F48696464656E0811436172726965642E57785F49444E
- 616D65061049445F54455354315F434C45414E555012436172726965642E5778
- 5F494456616C756503F40318436172726965642E57785F4D656E754974656D53
- 74796C65070F77784D6E7549746D5F4E6F726D616C12436172726965642E5778
- 5F43617074696F6E060D546573743120436C65616E757012436172726965642E
+ 617074696F6E06185465737431202D204E6F205363756D6D20506C7567696E73
+ 12436172726965642E57785F436865636B65640816436172726965642E57585F
+ 4249544D41502E446174610A0C00000007544269746D61700000000016436172
+ 726965642E57785F46696C65486973746F727908000011000000545778437573
+ 746F6D4D656E754974656D5450463018547778437573746F6D4D656E75497465
+ 6D577261707065720011436172726965642E49735375624D656E750810436172
+ 726965642E4556545F4D656E75060E4F6E5465737431436C65616E7570124361
+ 72726965642E57785F456E61626C65640911436172726965642E57785F486964
+ 64656E0811436172726965642E57785F49444E616D65061049445F5445535431
+ 5F434C45414E555012436172726965642E57785F494456616C756503F4031843
+ 6172726965642E57785F4D656E754974656D5374796C65070F77784D6E754974
+ 6D5F4E6F726D616C12436172726965642E57785F43617074696F6E060C546573
+ 7420436C65616E757012436172726965642E57785F436865636B656408164361
+ 72726965642E57585F4249544D41502E446174610A0C00000007544269746D61
+ 700000000016436172726965642E57785F46696C65486973746F727908000011
+ 000000545778437573746F6D4D656E754974656D545046301854777843757374
+ 6F6D4D656E754974656D577261707065720011436172726965642E4973537562
+ 4D656E750810436172726965642E4556545F4D656E7506074F6E546573743012
+ 436172726965642E57785F456E61626C65640911436172726965642E57785F48
+ 696464656E0811436172726965642E57785F49444E616D65060849445F544553
+ 543012436172726965642E57785F494456616C756503FE031843617272696564
+ 2E57785F4D656E754974656D5374796C65070F77784D6E7549746D5F4E6F726D
+ 616C12436172726965642E57785F43617074696F6E06185465737430202D204E
+ 6F205363756D6D20506C7567696E7312436172726965642E57785F436865636B
+ 65640816436172726965642E57585F4249544D41502E446174610A0C00000007
+ 544269746D61700000000016436172726965642E57785F46696C65486973746F
+ 727908000011000000545778437573746F6D4D656E754974656D545046301854
+ 7778437573746F6D4D656E754974656D57726170706572001143617272696564
+ 2E49735375624D656E750810436172726965642E4556545F4D656E7506074F6E
+ 546573743212436172726965642E57785F456E61626C65640911436172726965
+ 642E57785F48696464656E0811436172726965642E57785F49444E616D650608
+ 49445F544553543212436172726965642E57785F494456616C75650300041843
+ 6172726965642E57785F4D656E754974656D5374796C65070F77784D6E754974
+ 6D5F4E6F726D616C12436172726965642E57785F43617074696F6E061A546573
+ 7432202D2057697468205363756D6D20506C7567696E7312436172726965642E
57785F436865636B65640816436172726965642E57585F4249544D41502E4461
74610A0C00000007544269746D61700000000016436172726965642E57785F46
- 696C65486973746F727908000011000000545778437573746F6D4D656E754974
- 656D5450463018547778437573746F6D4D656E754974656D5772617070657200
- 11436172726965642E49735375624D656E750810436172726965642E4556545F
- 4D656E7506074F6E546573743012436172726965642E57785F456E61626C6564
- 0911436172726965642E57785F48696464656E0811436172726965642E57785F
- 49444E616D65060849445F544553543012436172726965642E57785F49445661
- 6C756503FE0318436172726965642E57785F4D656E754974656D5374796C6507
- 0F77784D6E7549746D5F4E6F726D616C12436172726965642E57785F43617074
- 696F6E0605546573743012436172726965642E57785F436865636B6564081643
- 6172726965642E57585F4249544D41502E446174610A0C00000007544269746D
- 61700000000016436172726965642E57785F46696C65486973746F7279080000
- 11000000545778437573746F6D4D656E754974656D5450463018547778437573
- 746F6D4D656E754974656D577261707065720011436172726965642E49735375
- 624D656E750810436172726965642E4556545F4D656E7506074F6E5465737432
- 12436172726965642E57785F456E61626C65640911436172726965642E57785F
- 48696464656E0811436172726965642E57785F49444E616D65060849445F5445
- 53543212436172726965642E57785F494456616C756503000418436172726965
- 642E57785F4D656E754974656D5374796C65070F77784D6E7549746D5F4E6F72
- 6D616C12436172726965642E57785F43617074696F6E06055465737432124361
- 72726965642E57785F436865636B65640816436172726965642E57585F424954
- 4D41502E446174610A0C00000007544269746D61700000000016436172726965
- 642E57785F46696C65486973746F72790800000000}
+ 696C65486973746F72790800000000}
Wx_HasHistory = False
end
end
Modified: scummex/branches/gsoc2007-gameresbrowser/src/gui/MainFormCommands.cpp
===================================================================
--- scummex/branches/gsoc2007-gameresbrowser/src/gui/MainFormCommands.cpp 2007-07-08 13:53:56 UTC (rev 27968)
+++ scummex/branches/gsoc2007-gameresbrowser/src/gui/MainFormCommands.cpp 2007-07-08 16:26:22 UTC (rev 27969)
@@ -14,7 +14,6 @@
#include "VirtualNode.h"
#include <iostream>
-#include <fstream>
#include <wx/filedlg.h>
#include <wx/wfstream.h>
@@ -55,17 +54,12 @@
if (res == wxID_OK) {
wxString fileName = saveDlg->GetPath();
- std::wfstream file;
- file.open(fileName.mb_str(), std::ios_base::out | std::ios_base::trunc);
-
- if (!file.fail())
- ochain->dumpObjectChainStart(wxString(wxT("ObjectChain")), file);
-
- if (!file.fail())
+ bool res = ochain->dumpObjectChain(fileName);
+ if (res)
wxMessageBox(wxString(wxT("Dumped to file: ")) + fileName,
wxT("Dump Object Chain"), wxOK | wxICON_INFORMATION, this);
else
- wxMessageBox(wxString(wxT("Failed writing to file: ")) + fileName,
+ wxMessageBox(wxString(wxT("Failed dumping to file: ")) + fileName,
wxT("Dump Object Chain Failed"), wxOK | wxICON_ERROR, this);
}
Modified: scummex/branches/gsoc2007-gameresbrowser/src/gui/Test1.cpp
===================================================================
--- scummex/branches/gsoc2007-gameresbrowser/src/gui/Test1.cpp 2007-07-08 13:53:56 UTC (rev 27968)
+++ scummex/branches/gsoc2007-gameresbrowser/src/gui/Test1.cpp 2007-07-08 16:26:22 UTC (rev 27969)
@@ -19,8 +19,6 @@
#include "plugin.h"
#include "oregistry.h"
-//#ifndef NO_BOBJECTS
-
#include "ExplorationTree.h"
#include "VirtualNode.h"
@@ -33,8 +31,6 @@
#include "FileTypeRecognizer.h"
#include "TextPresenter.h"
-//#endif
-
#include "debugmem.h"
using namespace Browser;
@@ -42,8 +38,6 @@
/////////////////////////////////////////////////////////////////////////////
/////////////////////////////////////////////////////////////////////////////
-//#ifndef NO_BOBJECTS
-
PLUGIN_DESC_EX(Test1Plugin, wxT("MyPlugins"), 1)
//PLUGGED_OBJECT(RootDirectory)
PLUGGED_OBJECT(DirectoryPresenter)
@@ -59,8 +53,6 @@
PLUGGED_OBJECT(BMPFileTypeParserResolver)
PLUGIN_END
-//#endif
-
/////////////////////////////////////////////////////////////////////////////
/////////////////////////////////////////////////////////////////////////////
@@ -119,8 +111,6 @@
infoout << wxT("Registering Test1 Plugin.") << std::endl;
ObjectRegistry::get()->registerPlugin( &getTest1Plugin, false );
-#ifndef NO_BOBJECTS
-
wxTreeItemId rootItem = ExplorationTree::get()->addRoot(wxT("RootDirectory"));
RCPtr<RootDirectory> rootDir( new RootDirectory(rootItem) );
@@ -155,8 +145,6 @@
wxOK | wxICON_ERROR, this);
}
-#endif
-
}
/////////////////////////////////////////////////////////////////////////////
@@ -164,13 +152,13 @@
void MainForm::OnTest1Cleanup(wxCommandEvent& event) {
infoout << wxT("Test1 Cleanup.") << std::endl;
-#ifndef NO_BOBJECTS
+
ObjectChain* rootChain = ExplorationTree::get()->getRootObjectChain();
rootChain->removeAllObjects();
//deleting the root
ExplorationTree::get()->deleteAllItems();
-#endif
+
}
/////////////////////////////////////////////////////////////////////////////
Modified: scummex/branches/gsoc2007-gameresbrowser/src/gui/Test2.cpp
===================================================================
--- scummex/branches/gsoc2007-gameresbrowser/src/gui/Test2.cpp 2007-07-08 13:53:56 UTC (rev 27968)
+++ scummex/branches/gsoc2007-gameresbrowser/src/gui/Test2.cpp 2007-07-08 16:26:22 UTC (rev 27969)
@@ -31,10 +31,12 @@
#include "FileTypeRecognizer.h"
#include "TextPresenter.h"
+#include "scumm/ScummRecognizer.h"
+
#include "scumm/ScummParser.h"
+#include "scumm/ScummBlockPresenter.h"
+#include "scumm/ScummBlockInfoPresenter.h"
#include "scumm/BlockyBlockPresenter.h"
-#include "scumm/ScummRecognizer.h"
-#include "scumm/ScummBlockPresenter.h"
#include "debugmem.h"
@@ -61,11 +63,13 @@
PLUGGED_OBJECT(TextFileTypeRecognizer)
PLUGGED_OBJECT(TextFileTypeParserResolver)
+ PLUGGED_OBJECT(ScummFileTypeRecognizer)
+ PLUGGED_OBJECT(ScummFileTypeParserResolver)
+
//PLUGGED_OBJECT(ScummParser)
+ PLUGGED_OBJECT(ScummBlockPresenter)
+ PLUGGED_OBJECT(ScummBlockInfoPresenter)
PLUGGED_OBJECT(BlockyBlockPresenter)
- PLUGGED_OBJECT(ScummBlockPresenter)
- PLUGGED_OBJECT(ScummFileTypeRecognizer)
- PLUGGED_OBJECT(ScummFileTypeParserResolver)
PLUGIN_END
/////////////////////////////////////////////////////////////////////////////
Modified: scummex/branches/gsoc2007-gameresbrowser/src/plugins/scumm/BlockyBlockPresenter.cpp
===================================================================
--- scummex/branches/gsoc2007-gameresbrowser/src/plugins/scumm/BlockyBlockPresenter.cpp 2007-07-08 13:53:56 UTC (rev 27968)
+++ scummex/branches/gsoc2007-gameresbrowser/src/plugins/scumm/BlockyBlockPresenter.cpp 2007-07-08 16:26:22 UTC (rev 27969)
@@ -22,22 +22,6 @@
// When a parser gets a file with one of the ScummBlock file types it doesn't
// have to parse it - just dynamic_cast<IScummBlockFileImpl> and getBlock().
-class IScummBlockFileImpl : public IFileImplBase {
-protected:
- bool _ownBlock;
- ScummBlock* _block;
- Common::SeekableReadStream* _stream;
-public:
- //inherit guid - it's a concrete implementation of an abstract interface
- IScummBlockFileImpl(IDirectory* parentDir, coreString name, ScummBlock* block, bool ownBlock);
- virtual ~IScummBlockFileImpl();
- virtual Common::SeekableReadStream* getStream();
-
- virtual ScummBlock* getBlock() {
- return _block;
- }
-};
-
/////////////////////////////////////////////////////////////////////////////
/////////////////////////////////////////////////////////////////////////////
@@ -154,7 +138,7 @@
/////////////////////////////////////////////////////////////////////////////
SLOT_DESCS_EX(BlockyBlockPresenter)
- SLOT_DESC(_fileSlot, SLOT_DEFAULT)
+ SLOT_DESC(_blockSlot, SLOT_DEFAULT)
END_DESCS
PIN_DESCS_EX(BlockyBlockPresenter)
@@ -166,45 +150,37 @@
if (!res)
return false;
- _ifile = _fileSlot->getInterface();
- if (!_ifile) {
- errout << wxT("BlockyBlockPresenter::doRealize(): could not get IFile interface") << std::endl;
- _realized = false;
- return false;
- }
-
return true;
}
void BlockyBlockPresenter::doUnrealize(ObjectChain* ochain) {
- _ifile = NULL;
- _fileSlot->releaseInterface();
+ _iprov = NULL;
+ _blockSlot->releaseInterface();
BObject::doUnrealize(ochain);
}
IBlocksDirectoryImpl* BlockyBlockPresenter::getDirectoryImpl() {
if (_idirectory == NULL) {
- ScummBlock* block = NULL;
- IScummBlockFileImpl* scummFile = dynamic_cast<IScummBlockFileImpl*>(_ifile);
- bool ownBlock = false;
- if (scummFile) {
- block = scummFile->getBlock();
- ownBlock = false;
- } else {
- block = ScummParser::getScummBlock(_ifile->getStream());
- ownBlock = true;
- errout << wxT("BlockyBlockPresenter::getDirectoryImpl(): TODO: implement readScummBlockFromStream()") << std::endl;
+ _iprov = _blockSlot->getInterface();
+ if (!_iprov) {
+ errout << wxT("BlockyBlockPresenter::getDirectoryImpl(): could not get IProvider<ScummBlock> interface") << std::endl;
+ return NULL;
}
+ FileNScummBlock* fileNBlock = _iprov->getData();
+ ASSERT(fileNBlock);
+ ASSERT(fileNBlock->getIFile());
+ ScummBlock* block = fileNBlock->getBlock();
+
if (!block) {
errout << wxT("BlockyBlockPresenter::getDirectoryImpl(): null block") << std::endl;
return NULL;
}
- _idirectory = new IBlocksDirectoryImpl(_ifile->getParentDirectory(),
- block->getTag()->toString(), block, ownBlock);
- _idirectory->setDirectoryFileType(_ifile->getFileType());
+ _idirectory = new IBlocksDirectoryImpl(fileNBlock->getIFile()->getParentDirectory(),
+ block->getTag()->toString(), block, false);
+ _idirectory->setDirectoryFileType(fileNBlock->getIFile()->getFileType());
}
_idirCount++;
Modified: scummex/branches/gsoc2007-gameresbrowser/src/plugins/scumm/BlockyBlockPresenter.h
===================================================================
--- scummex/branches/gsoc2007-gameresbrowser/src/plugins/scumm/BlockyBlockPresenter.h 2007-07-08 13:53:56 UTC (rev 27968)
+++ scummex/branches/gsoc2007-gameresbrowser/src/plugins/scumm/BlockyBlockPresenter.h 2007-07-08 16:26:22 UTC (rev 27969)
@@ -5,6 +5,7 @@
#define _BLOCKY_BLOCK_PRESENTER_H_
#include "CoreInterfaces.h"
+#include "scumm/ScummBlockPresenter.h"
#include "scumm/resource.h"
@@ -23,10 +24,10 @@
DECLARE_BOBJECT_CLASS(BlockyBlockPresenter, BObject)
protected:
- Slot<IFile>* _fileSlot;
+ Slot< IProvider<FileNScummBlock> >* _blockSlot;
Pin<IDirectory>* _directoryPin;
- IFile* _ifile;
+ IProvider<FileNScummBlock>* _iprov;
int _idirCount;
IBlocksDirectoryImpl* _idirectory;
@@ -37,7 +38,7 @@
SLOTS_DECL
BlockyBlockPresenter()
- : _ifile(NULL), _idirCount(0), _idirectory(NULL) {}
+ : _iprov(NULL), _idirCount(0), _idirectory(NULL) {}
virtual bool doRealize(ObjectChain* ochain);
virtual void doUnrealize(ObjectChain* ochain);
@@ -49,6 +50,29 @@
/////////////////////////////////////////////////////////////////////////////
/////////////////////////////////////////////////////////////////////////////
+// IScummBlockFileImpl - a file representing a ScummBlock
+// When a parser gets a file with one of the ScummBlock file types it doesn't
+// have to parse it - just dynamic_cast<IScummBlockFileImpl> and getBlock().
+
+class IScummBlockFileImpl : public IFileImplBase {
+protected:
+ bool _ownBlock;
+ ScummBlock* _block;
+ Common::SeekableReadStream* _stream;
+public:
+ //inherit guid - it's a concrete implementation of an abstract interface
+ IScummBlockFileImpl(IDirectory* parentDir, coreString name, ScummBlock* block, bool ownBlock);
+ virtual ~IScummBlockFileImpl();
+ virtual Common::SeekableReadStream* getStream();
+
+ virtual ScummBlock* getBlock() {
+ return _block;
+ }
+};
+
+/////////////////////////////////////////////////////////////////////////////
+/////////////////////////////////////////////////////////////////////////////
+
// IVirtualBlocksDirectoryImpl: a directory that is a list of ScummBlocks.
// IBlocksDirectoryImpl: a directory that reads a list of ScummBlocks from a ScummBlock.
Added: scummex/branches/gsoc2007-gameresbrowser/src/plugins/scumm/ScummBlockInfoPresenter.cpp
===================================================================
--- scummex/branches/gsoc2007-gameresbrowser/src/plugins/scumm/ScummBlockInfoPresenter.cpp (rev 0)
+++ scummex/branches/gsoc2007-gameresbrowser/src/plugins/scumm/ScummBlockInfoPresenter.cpp 2007-07-08 16:26:22 UTC (rev 27969)
@@ -0,0 +1,78 @@
+/////////////////////////////////////////////////////////////////////////////
+// ScummBlockPresenter.cpp
+
+#include "plugins_stdafx.h"
+
+#include "scumm/ScummBlockInfoPresenter.h"
+#include "scumm/ScummBlockPresenter.h"
+
+#include "CoreInterfaces.h"
+
+#include <iostream>
+
+#include "debugmem.h"
+
+namespace Browser {
+
+/////////////////////////////////////////////////////////////////////////////
+/////////////////////////////////////////////////////////////////////////////
+
+SLOT_DESCS_EX(ScummBlockInfoPresenter)
+ SLOT_DESC(_blockSlot, SLOT_DEFAULT)
+END_DESCS
+PIN_DESCS_EX(ScummBlockInfoPresenter)
+ PIN_DESC_r(_textPin, PIN_DEFAULT | PIN_MULTICAST, getTextImpl, ITextImpl)
+END_DESCS
+
+
+ITextImpl* ScummBlockInfoPresenter::getTextImpl() {
+ //infoout << wxT("ScummBlockInfoPresenter::getTextImpl(): ") << std::endl;
+
+ IProvider<FileNScummBlock>* iprov = _blockSlot->getInterface();
+ if (!iprov) {
+ errout << wxT("ScummBlockInfoPresenter::getTextImpl(): could not get IProvider<FileNScummBlock> interface") << std::endl;
+ return NULL;
+ }
+
+ ASSERT(iprov->getData());
+ ScummBlock* block = iprov->getData()->getBlock();
+
+ if (!block) {
+ errout << wxT("ScummBlockInfoPresenter::getTextImpl(): NULL block") << std::endl;
+ _blockSlot->releaseInterface();
+ return NULL;
+ }
+
+ ScummTag* tag = block->getTag();
+ ASSERT(tag);
+ wxString name = tag->toString();
+
+ wxString text;
+
+ text << wxT("Block type: ") << name << wxEndl();
+ text << wxT("Size mode: ") << block->_sizeMode << wxEndl();
+ text << wxT("Size: ") << block->_size << wxEndl();
+ text << wxT("Data Size: ") << block->_dsize << wxEndl();
+ text << wxT("Read Data: ") << (block->_readData ? wxT("true") : wxT("false")) << wxEndl();
+ text << wxT("Parse Sub Blocks: ") << (block->_parseSubBlocks ? wxT("true") : wxT("false")) << wxEndl();
+ text << wxT("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: ") << binfo->htmlfile << wxEndl();
+ text << wxT("Icon: ") << binfo->iconid << wxEndl();
+ } else {
+ text << wxT("Could not find block info.") << wxEndl();
+ }
+
+ _blockSlot->releaseInterface();
+
+ return new ITextImpl(name, text);
+}
+
+/////////////////////////////////////////////////////////////////////////////
+/////////////////////////////////////////////////////////////////////////////
+
+} // namespace Browser
Property changes on: scummex/branches/gsoc2007-gameresbrowser/src/plugins/scumm/ScummBlockInfoPresenter.cpp
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Name: svn:eol-style
+ native
Added: scummex/branches/gsoc2007-gameresbrowser/src/plugins/scumm/ScummBlockInfoPresenter.h
===================================================================
--- scummex/branches/gsoc2007-gameresbrowser/src/plugins/scumm/ScummBlockInfoPresenter.h (rev 0)
+++ scummex/branches/gsoc2007-gameresbrowser/src/plugins/scumm/ScummBlockInfoPresenter.h 2007-07-08 16:26:22 UTC (rev 27969)
@@ -0,0 +1,42 @@
+/////////////////////////////////////////////////////////////////////////////
+// ScummBlockPresenter.h
+
+#ifndef _SCUMM_BLOCK_INFO_PRESENTER_H_
+#define _SCUMM_BLOCK_INFO_PRESENTER_H_
+
+//#include "scumm/ScummBlockPresenter.h"
+#include "CoreInterfaces.h"
+
+#include "scumm/resource.h"
+
+namespace Browser {
+
+using namespace Scumm;
+
+/////////////////////////////////////////////////////////////////////////////
+/////////////////////////////////////////////////////////////////////////////
+
+struct FileNScummBlock;
+
+class ScummBlockInfoPresenter : public BObject {
+ DECLARE_BOBJECT_CLASS(ScummBlockInfoPresenter, BObject)
+
+protected:
+ Slot< IProvider<FileNScummBlock> >* _blockSlot;
+ Pin<IText>* _textPin;
+
+public:
+ ASSIGN_DESC(0,wxT("ScummObjects"), 1)
+
+ PINS_DECL
+ SLOTS_DECL
+
+ ITextImpl* getTextImpl();
+};
+
+/////////////////////////////////////////////////////////////////////////////
+/////////////////////////////////////////////////////////////////////////////
+
+} // namespace Browser
+
+#endif //_SCUMM_BLOCK_INFO_PRESENTER_H_
Property changes on: scummex/branches/gsoc2007-gameresbrowser/src/plugins/scumm/ScummBlockInfoPresenter.h
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Name: svn:eol-style
+ native
Modified: scummex/branches/gsoc2007-gameresbrowser/src/plugins/scumm/ScummBlockPresenter.cpp
===================================================================
--- scummex/branches/gsoc2007-gameresbrowser/src/plugins/scumm/ScummBlockPresenter.cpp 2007-07-08 13:53:56 UTC (rev 27968)
+++ scummex/branches/gsoc2007-gameresbrowser/src/plugins/scumm/ScummBlockPresenter.cpp 2007-07-08 16:26:22 UTC (rev 27969)
@@ -4,6 +4,8 @@
#include "plugins_stdafx.h"
#include "scumm/ScummBlockPresenter.h"
+#include "scumm/BlockyBlockPresenter.h"
+#include "scumm/ScummParser.h"
#include "CoreInterfaces.h"
@@ -16,86 +18,81 @@
/////////////////////////////////////////////////////////////////////////////
/////////////////////////////////////////////////////////////////////////////
-PIN_DESCS_EX(ScummBlockPresenter)
- PIN_DESC_r(_panelRecieverPin, PIN_DEFAULT, getPanelRecieverImpl, IPanelRecieverImpl)
+SLOT_DESCS_EX(ScummBlockPresenter)
+ SLOT_DESC(_fileSlot, SLOT_DEFAULT)
END_DESCS
-SLOT_DESCS_EX(ScummBlockPresenter)
- SLOT_DESC(_blockSlot, SLOT_DEFAULT)
+PIN_DESCS_EX(ScummBlockPresenter)
+ PIN_DESC_r(_blockPin, PIN_DEFAULT | PIN_MULTICAST, getBlock, IProviderImpl<FileNScummBlock>)
END_DESCS
+ScummBlockPresenter::~ScummBlockPresenter() {
+ if (_ownBlock && _block)
+ delete _block;
+}
+
bool ScummBlockPresenter::doRealize(ObjectChain* ochain) {
bool res = BObject::doRealize(ochain);
if (!res)
return false;
- _iprov = _blockSlot->getInterface();
- if (!_iprov) {
- _realized = false;
- return false;
- }
-
return true;
}
void ScummBlockPresenter::doUnrealize(ObjectChain* ochain) {
- _iprov = NULL;
- _blockSlot->releaseInterface();
+ if (_ownBlock && _block)
+ delete _block;
+ _block = NULL;
+ _created = false;
+ _ownBlock = false;
+ _ifile = NULL;
+ _fileSlot->releaseInterface();
+
BObject::doUnrealize(ochain);
}
-IPanelRecieverImpl* ScummBlockPresenter::getPanelRecieverImpl() {
- //infoout << wxT("FilePresenter::getPanelRecieverImpl(): ") << std::endl;
- return new IPanelRecieverImpl(this);
-}
+void ScummBlockPresenter::create() {
+ //infoout << wxT("ScummBlockPresenter::create(): ") << std::endl;
+ if (_created)
+ return;
+ _created = true;
+ _ifile = _fileSlot->getInterface();
+ if (!_ifile) {
+ errout << wxT("ScummBlockPresenter::create(): could not get IFile interface") << std::endl;
+ return;
+ }
-coreString ScummBlockPresenter::getPanelTitle() {
+ ScummBlock* block = NULL;
+ IScummBlockFileImpl* scummFile = dynamic_cast<IScummBlockFileImpl*>(_ifile);
+ if (scummFile) {
+ block = scummFile->getBlock();
+ _ownBlock = false;
+ } else {
+ block = ScummParser::getScummBlock(_ifile->getStream());
+ _ownBlock = true;
+ }
- ScummBlock* block = _iprov->getData();
if (!block) {
- errout << wxT("ScummBlockPresenter::getPanelTitle(): NULL block") << std::endl;
- return wxT("null block");
+ errout << wxT("ScummBlockPresenter::create(): null block") << std::endl;
+ return;
}
-
- ASSERT(block->getTag());
- coreString name = block->getTag()->toString();
-
- return name;
+
+ _block = block;
}
-void ScummBlockPresenter::panelActivate(wxPanel* panel) {
- //infoout << wxT("FilePresenter::panelActivate()") << std::endl;
+IProviderImpl<FileNScummBlock>* ScummBlockPresenter::getBlock() {
+ //infoout << wxT("ScummBlockPresenter::getBlock(): ") << std::endl;
- ScummBlock* block = _iprov->getData();
- if (!block) {
- errout << wxT("ScummBlockPresenter::panelActivate(): null block") << std::endl;
- return;
- }
+ create();
+ if (!_block)
+ return NULL;
- ASSERT(block->getTag());
- coreString text;
- text += block->getTag()->toString();
- text += wxT(" ");
- text += toString(block->_sizeMode);
- text += wxT(" ");
- text += toString(block->_size);
- text += wxT(" ");
- text += toString(block->_dsize);
- text += wxT(" ");
- text += toString(block->_readData);
- text += wxT(" ");
- text += toString(block->_parseSubBlocks);
- text += wxT(" ");
- text += toString(block->_parsed);
- new wxStaticText(panel, wxID_ANY, text);
+ return new IProviderImpl<FileNScummBlock>(
+ new FileNScummBlock(_ifile, false, _block, false), true);
}
-void ScummBlockPresenter::panelDeactivate() {
- //infoout << wxT("FilePresenter::panelDeactivate()") << std::endl;
-}
-
/////////////////////////////////////////////////////////////////////////////
/////////////////////////////////////////////////////////////////////////////
Modified: scummex/branches/gsoc2007-gameresbrowser/src/plugins/scumm/ScummBlockPresenter.h
===================================================================
--- scummex/branches/gsoc2007-gameresbrowser/src/plugins/scumm/ScummBlockPresenter.h 2007-07-08 13:53:56 UTC (rev 27968)
+++ scummex/branches/gsoc2007-gameresbrowser/src/plugins/scumm/ScummBlockPresenter.h 2007-07-08 16:26:22 UTC (rev 27969)
@@ -4,9 +4,6 @@
#ifndef _SCUMM_BLOCK_PRESENTER_H_
#define _SCUMM_BLOCK_PRESENTER_H_
-#include <wx/wx.h>
-
-#include "PanelProvider.h"
#include "CoreInterfaces.h"
#include "scumm/resource.h"
@@ -18,32 +15,59 @@
/////////////////////////////////////////////////////////////////////////////
/////////////////////////////////////////////////////////////////////////////
-class ScummBlockPresenter : public BObject, public PanelReciever {
+struct FileNScummBlock {
+ bool _ownIFile;
+ IFile* _ifile;
+ bool _ownBlock;
+ ScummBlock* _block;
+
+ FileNScummBlock(IFile* ifile, bool ownIFile, ScummBlock* block, bool ownBlock)
+ : _ifile(ifile), _ownIFile(ownIFile), _block(block), _ownBlock(ownBlock) {}
+
+ ~FileNScummBlock() {
+ if (_ownBlock && _block)
+ delete _block;
+ if (_ownIFile && _ifile)
+ delete _ifile;
+ }
+
+ IFile* getIFile() {
+ return _ifile;
+ }
+
+ ScummBlock* getBlock() {
+ return _block;
+ }
+};
+
+class ScummBlockPresenter : public BObject {
DECLARE_BOBJECT_CLASS(ScummBlockPresenter, BObject)
protected:
- Slot< IProvider<ScummBlock> >* _blockSlot;
- Pin<IPanelReciever>* _panelRecieverPin;
+ Slot<IFile>* _fileSlot;
+ Pin< IProvider<FileNScummBlock> >* _blockPin;
- IProvider<ScummBlock>* _iprov;
+ IFile* _ifile;
+ bool _created;
+ bool _ownBlock;
+ ScummBlock* _block;
public:
- ASSIGN_DESC(0,wxT("CoreObjects"), 1)
+ ASSIGN_DESC(0,wxT("ScummObjects"), 1)
PINS_DECL
SLOTS_DECL
ScummBlockPresenter()
- : _iprov(NULL) {}
+ : _ifile(NULL), _created(false), _ownBlock(false), _block(NULL) {}
+ ~ScummBlockPresenter();
+
virtual bool doRealize(ObjectChain* ochain);
virtual void doUnrealize(ObjectChain* ochain);
- virtual coreString getPanelTitle();
- virtual void panelActivate(wxPanel* panel);
- virtual void panelDeactivate();
-
- IPanelRecieverImpl* getPanelRecieverImpl();
+ virtual void create();
+ IProviderImpl<FileNScummBlock>* getBlock();
};
/////////////////////////////////////////////////////////////////////////////
Added: scummex/branches/gsoc2007-gameresbrowser/src/plugins/scumm/ScummFileTypes.cpp
===================================================================
--- scummex/branches/gsoc2007-gameresbrowser/src/plugins/scumm/ScummFileTypes.cpp (rev 0)
+++ scummex/branches/gsoc2007-gameresbrowser/src/plugins/scumm/ScummFileTypes.cpp 2007-07-08 16:26:22 UTC (rev 27969)
@@ -0,0 +1,34 @@
+/////////////////////////////////////////////////////////////////////////////
+// ScummFileTypes.cpp
+
+#include "plugins_stdafx.h"
+
+#include "ScummFileTypes.h"
+
+#include "debugmem.h"
+
+namespace Browser {
+
+namespace Scumm {
+
+/////////////////////////////////////////////////////////////////////////////
+/////////////////////////////////////////////////////////////////////////////
+// ScummFileTypes
+
+SAFE_STATIC(newScummFileType, BGUID, (wxT("ScummFileTypes"), wxT("New Scumm File"), 1) )
+SAFE_STATIC(oldScummFileType, BGUID, (wxT("ScummFileTypes"), wxT("Old Scumm File"), 1) )
+
+SAFE_STATIC(scummParserGUID, BGUID, (wxT("ScummObjects"), wxT("ScummParser"), 1) )
+SAFE_STATIC(scummBlockPresenterGUID, BGUID, (wxT("ScummObjects"), wxT("ScummBlockPresenter"), 1) )
+SAFE_STATIC(scummBlockInfoPresenterGUID, BGUID, (wxT("ScummObjects"), wxT("ScummBlockInfoPresenter"), 1) )
+SAFE_STATIC(blockyBlockPresenterGUID, BGUID, (wxT("ScummObjects"), wxT("BlockyBlockPresenter"), 1) )
+
+//SAFE_STATIC(rootDirectoryFileType, RecognizedFileType,
+// (PERFECT_MATCH, BGUID(wxT("CoreFileTypes"), wxT("Root Directory"), 1)) )
+
+/////////////////////////////////////////////////////////////////////////////
+/////////////////////////////////////////////////////////////////////////////
+
+} // namespace Scumm
+
+} // namespace Browser
Property changes on: scummex/branches/gsoc2007-gameresbrowser/src/plugins/scumm/ScummFileTypes.cpp
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Name: svn:eol-style
+ native
Added: scummex/branches/gsoc2007-gameresbrowser/src/plugins/scumm/ScummFileTypes.h
===================================================================
--- scummex/branches/gsoc2007-gameresbrowser/src/plugins/scumm/ScummFileTypes.h (rev 0)
+++ scummex/branches/gsoc2007-gameresbrowser/src/plugins/scumm/ScummFileTypes.h 2007-07-08 16:26:22 UTC (rev 27969)
@@ -0,0 +1,37 @@
+/////////////////////////////////////////////////////////////////////////////
+// ScummFileTypes.h
+
+#ifndef _SCUMM_FILE_TYPES_H_
+#define _SCUMM_FILE_TYPES_H_
+
+#include "guid.h"
+#include "FileType.h"
+
+#include "safe_static.h"
+
+namespace Browser {
+
+namespace Scumm {
+
+/////////////////////////////////////////////////////////////////////////////
+/////////////////////////////////////////////////////////////////////////////
+// ScummFileTypes
+
+SAFE_STATIC_DECL(newScummFileType, BGUID)
+SAFE_STATIC_DECL(oldScummFileType, BGUID)
+
+SAFE_STATIC_DECL(scummParserGUID, BGUID)
+SAFE_STATIC_DECL(scummBlockPresenterGUID, BGUID)
+SAFE_STATIC_DECL(scummBlockInfoPresenterGUID, BGUID)
+SAFE_STATIC_DECL(blockyBlockPresenterGUID, BGUID)
+
+//SAFE_STATIC_DECL(rootDirectoryFileType, RecognizedFileType)
+
+/////////////////////////////////////////////////////////////////////////////
+/////////////////////////////////////////////////////////////////////////////
+
+} // namespace Scumm
+
+} // namespace Browser
+
+#endif // _SCUMM_FILE_TYPES_H_
Property changes on: scummex/branches/gsoc2007-gameresbrowser/src/plugins/scumm/ScummFileTypes.h
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Name: svn:eol-style
+ native
Modified: scummex/branches/gsoc2007-gameresbrowser/src/plugins/scumm/ScummRecognizer.cpp
===================================================================
--- scummex/branches/gsoc2007-gameresbrowser/src/plugins/scumm/ScummRecognizer.cpp 2007-07-08 13:53:56 UTC (rev 27968)
+++ scummex/branches/gsoc2007-gameresbrowser/src/plugins/scumm/ScummRecognizer.cpp 2007-07-08 16:26:22 UTC (rev 27969)
@@ -6,9 +6,12 @@
#include "scumm/ScummRecognizer.h"
#include "scumm/scummutil.h"
#include "scumm/resource.h"
+#include "scumm/ScummFileTypes.h"
#include "common/xorstream.h"
+#include "CoreFileTypes.h"
+
#include "debugmem.h"
namespace Browser {
@@ -21,9 +24,6 @@
// Sample object chain:
// old/newScummFileType -> ScummParser -> IDirectory -> IFile -> BlockyBlockPresenter
-SAFE_STATIC(newScummFileType, BGUID, (wxT("ScummFileTypes"), wxT("New Scumm File"), 1) )
-SAFE_STATIC(oldScummFileType, BGUID, (wxT("ScummFileTypes"), wxT("Old Scumm File"), 1) )
-
/////////////////////////////////////////////////////////////////////////////
/////////////////////////////////////////////////////////////////////////////
@@ -40,7 +40,7 @@
FourTag tag4;
tag4.read(xorstream);
- if (Scumm::getBlockType(tag4) != NULL) {
+ if (Scumm::getBlockInfo(tag4) != NULL) {
outStream = xorstream;
outTag = new FourTag(tag4);
return true;
@@ -48,7 +48,7 @@
TwoTag tag2;
tag2.read(xorstream);
- if (Scumm::getOldBlockType(tag2) != NULL) {
+ if (Scumm::getBlockInfo(tag2) != NULL) {
outStream = xorstream;
outTag = new TwoTag(tag2);
return true;
@@ -98,33 +98,27 @@
/////////////////////////////////////////////////////////////////////////////
ResolvedFileTypeParsers ScummFileTypeParserResolver::resolve(const BGUID& fileType) {
- guid_list parsers;
- //FIXME: this is temporary
- ASSERT_STATICS_ALLOWED();
- //static BGUID scummParserGUID(wxT("ScummObjects"), wxT("ScummParser"), 1);
- //parsers.push_back(scummParserGUID);
- static BGUID scummParserGUID(wxT("ScummObjects"), wxT("BlockyBlockPresenter"), 1);
- parsers.push_back(scummParserGUID);
- static BGUID filePresenterGUID(wxT("CoreObjects"), wxT("FileInfoPresenter"), 1);
- parsers.push_back(filePresenterGUID);
-
- if (fileType == newScummFileType()) {
+ if (fileType == newScummFileType() ||
+ fileType == oldScummFileType()) {
+ guid_list parsers;
+ parsers.push_back(scummBlockPresenterGUID());
+ parsers.push_back(scummBlockInfoPresenterGUID());
+ parsers.push_back(blockyBlockPresenterGUID());
+ parsers.push_back(CoreFileTypes::fileInfoPresenterGUID());
return ResolvedFileTypeParsers(IDEAL_PARSERS, parsers);
}
-
- if (fileType == oldScummFileType()) {
- return ResolvedFileTypeParsers(IDEAL_PARSERS, parsers);
- }
- if (fileType == ScummTag::getFileTypeGUID("LECF")) {
+ if (fileType.facility == wxT("NewScummBlock") ||
+ fileType.facility == wxT("OldScummBlock")) {
+ guid_list parsers;
+ parsers = getScummBlockParsers(fileType);
+ parsers.push_front(scummBlockPresenterGUID());
+ parsers.push_back(scummBlockInfoPresenterGUID());
+ parsers.push_back(CoreFileTypes::fileInfoPresenterGUID());
return ResolvedFileTypeParsers(IDEAL_PARSERS, parsers);
}
- if (fileType == ScummTag::getFileTypeGUID("LFLF")) {
- return ResolvedFileTypeParsers(IDEAL_PARSERS, parsers);
- }
-
return ResolvedFileTypeParsers::NoParsers();
}
Modified: scummex/branches/gsoc2007-gameresbrowser/src/plugins/scumm/ScummRecognizer.h
===================================================================
--- scummex/branches/gsoc2007-gameresbrowser/src/plugins/scumm/ScummRecognizer.h 2007-07-08 13:53:56 UTC (rev 27968)
+++ scummex/branches/gsoc2007-gameresbrowser/src/plugins/scumm/ScummRecognizer.h 2007-07-08 16:26:22 UTC (rev 27969)
@@ -13,12 +13,6 @@
/////////////////////////////////////////////////////////////////////////////
/////////////////////////////////////////////////////////////////////////////
-SAFE_STATIC_DECL(newScummFileType, BGUID)
-SAFE_STATIC_DECL(oldScummFileType, BGUID)
-
-/////////////////////////////////////////////////////////////////////////////
-/////////////////////////////////////////////////////////////////////////////
-
namespace Scumm {
struct ScummTag;
}
@@ -27,7 +21,7 @@
DECLARE_BOBJECT_CLASS(ScummFileTypeRecognizer, BObject)
public:
- ASSIGN_DESC(IS_FILE_TYPE_RECOGNIZER, wxT("CoreObjects"), 1)
+ ASSIGN_DESC(IS_FILE_TYPE_RECOGNIZER, wxT("ScummObjects"), 1)
virtual RecognizedFileType doRecognize(VirtualFile* file, IFile* ifile);
static bool scummRecognize(Common::SeekableReadStream* stream,
@@ -41,7 +35,7 @@
DECLARE_BOBJECT_CLASS(ScummFileTypeParserResolver, BObject)
public:
- ASSIGN_DESC(IS_FILE_TYPE_RESOLVER, wxT("CoreObjects"), 1)
+ ASSIGN_DESC(IS_FILE_TYPE_RESOLVER, wxT("ScummObjects"), 1)
virtual ResolvedFileTypeParsers resolve(const BGUID& fileType);
};
Modified: scummex/branches/gsoc2007-gameresbrowser/src/plugins/scumm/resource.cpp
===================================================================
--- scummex/branches/gsoc2007-gameresbrowser/src/plugins/scumm/resource.cpp 2007-07-08 13:53:56 UTC (rev 27968)
+++ scummex/branches/gsoc2007-gameresbrowser/src/plugins/scumm/resource.cpp 2007-07-08 16:26:22 UTC (rev 27969)
@@ -31,6 +31,7 @@
#include "plugins_stdafx.h"
#include "scumm/resource.h"
+#include "scumm/ScummFileTypes.h"
#include <list>
@@ -45,8 +46,413 @@
/////////////////////////////////////////////////////////////////////////////
/////////////////////////////////////////////////////////////////////////////
+/*static*/ BGUID ScummTag::getFileTypeGUID(const char* tag) {
+ ASSERT(tag && tag[0] && tag[1]);
+ if (!tag[2])
+ return BGUID(wxT("OldScummBlock"), Browser::toString(tag), 1);
+ ASSERT(tag[2] && tag[3] && !tag[4]);
+ return BGUID(wxT("NewScummBlock"), Browser::toString(tag), 1);
+}
+
+bool operator==(const ScummTag& tag0, const ScummTag& tag1) {
+ return tag0.equals(tag1);
+}
+
+/////////////////////////////////////////////////////////////////////////////
+/////////////////////////////////////////////////////////////////////////////
+
+TwoTag::TwoTag() {}
+TwoTag::TwoTag(byte one, byte two)
+ : _one(one), _two(two) {}
+TwoTag::TwoTag(const char* chars)
+ : _one((byte)chars[0]), _two((byte)chars[1]) {}
+
+/*static*/ TwoTag create(const char* chars) {
+ return TwoTag(chars);
+}
+
+bool TwoTag::read(Common::ReadStream* stream) {
+ _one = stream->readByte();
+ if (stream->ioFailed()) return false;
+ _two = stream->readByte();
+ if (stream->ioFailed()) return false;
+ return true;
+}
+
+bool TwoTag::isNewTag() const {
+ return false;
+}
+
+bool TwoTag::equals(const ScummTag& other) const {
+ if (typeid(*this) != typeid(other))
+ return false;
+ const TwoTag& oth = static_cast<const TwoTag&>(other);
+ return (_one == oth._one) && (_two == oth._two);
+}
+
+bool TwoTag::equals(const char* chars) const {
+ return (_one == (byte)chars[0]) && (_two == (byte)chars[1]);
+}
+
+wxString TwoTag::toString() const {
+ char chars[3];
+ chars[0] = (char)_one;
+ chars[1] = (char)_two;
+ chars[2] = '\0';
+ return Browser::toString(chars);
+}
+
+BGUID TwoTag::getFileTypeGUID() {
+ return BGUID(wxT("OldScummBlock"), toString(), 1);
+}
+
+/////////////////////////////////////////////////////////////////////////////
+/////////////////////////////////////////////////////////////////////////////
+
+FourTag::FourTag() {}
+FourTag::FourTag(byte one, byte two, byte three, byte four)
+ : _one(one), _two(two), _three(three), _four(four) {}
+FourTag::FourTag(const char* chars)
+ : _one((byte)chars[0]), _two((byte)chars[1]),
+ _three((byte)chars[2]), _four((byte)chars[3]) {}
+
+/*static*/ FourTag FourTag::create(const char* chars) {
+ return FourTag(chars);
+}
+
+bool FourTag::read(Common::ReadStream* stream) {
+ _one = stream->readByte();
+ if (stream->ioFailed()) return false;
+ _two = stream->readByte();
+ if (stream->ioFailed()) return false;
+ _three = stream->readByte();
+ if (stream->ioFailed()) return false;
+ _four = stream->readByte();
+ if (stream->ioFailed()) return false;
+ return true;
+}
+
+bool FourTag::isNewTag() const {
+ return true;
+}
+
+bool FourTag::equals(const ScummTag& other) const {
+ if (typeid(*this) != typeid(other))
+ return false;
+ const FourTag& oth = static_cast<const FourTag&>(other);
+ return (_one == oth._one) && (_two == oth._two) &&
+ (_three == oth._three) && (_four == oth._four);
+}
+
+bool FourTag::equals(const char* chars) const {
+ return (_one == (byte)chars[0]) &&
+ (_two == (byte)chars[1]) &&
+ (_three == (byte)chars[2]) &&
+ (_four == (byte)chars[3]);
+}
+
+wxString FourTag::toString() const {
+ char chars[5];
+ chars[0] = (char)_one;
+ chars[1] = (char)_two;
+ chars[2] = (char)_three;
+ chars[3] = (char)_four;
+ chars[4] = '\0';
+ return Browser::toString(chars);
+}
+
+BGUID FourTag::getFileTypeGUID() {
+ return BGUID(wxT("NewScummBlock"), toString(), 1);
+}
+
+/////////////////////////////////////////////////////////////////////////////
+/////////////////////////////////////////////////////////////////////////////
+
+ScummBlock::ScummBlock(ScummTag* tag, uint32 size, Common::SeekableReadStream* stream)
+ : _tag(tag), _sizeMode(INVALID_SIZE_MODE),
+ _ownStream(true), _mineStream(stream),
+ _parsed(false), _size(size), _dsize(-1), _data(NULL),
+ _readData(false), _parseSubBlocks(false) {}
+
+ScummBlock::~ScummBlock() {
+ if(_tag)
+ delete _tag;
+ scumm_blocks::iterator i;
+ for (i = _subblocks.begin(); i != _subblocks.end(); ++i)
+ delete *i;
+ if (_ownStream)
+ delete _mineStream;
+ if (_data)
+ delete [] _data;
+}
+
+ScummTag* ScummBlock::getTag() {
+ return _tag;
+}
+
+const ScummBlock::scumm_blocks& ScummBlock::getSubBlocks() {
+ return _subblocks;
+}
+
+Common::SeekableReadStream* ScummBlock::getStream() {
+ return _mineStream;
+}
+
+RecognizedFileType ScummBlock::getFileType() {
+ return RecognizedFileType(IDEAL_MATCH, _tag->getFileTypeGUID());
+}
+
+bool ScummBlock::parse() {
+ if(_parsed)
+ return true;
+
+ ASSERT(_mineStream);
+ _mineStream->seek(0, SEEK_SET);
+
+ if (!readHeader())
+ return false;
+
+ if (!determineSizeMode())
+ return false;
+
+ if (!determineDataSize())
+ return false;
+
+ if (_readData && !readData())
+ return false;
+
+ if (_parseSubBlocks && !parseSubBlocks())
+ return false;
+
+ _parsed = true;
+ return true;
+}
+
+/////////////////////////////////////////////////////////////////////////////
+/////////////////////////////////////////////////////////////////////////////
+//protected:
+
+ScummBlock* ScummBlock::newBlock(ScummTag* tag, uint32 size, Common::SeekableReadStream* stream) {
+ return ScummBlockFactory::create(tag, size, stream);
+}
+
+bool ScummBlock::readHeader(ScummTag*& outTag, uint32& outSize) {
+ if (_tag->isNewTag()) {
+ outTag = new FourTag();
+ if (!outTag->read(_mineStream)) {
+ delete outTag;
+ return false;
+ }
+
+ outSize = _mineStream->readUint32BE();
+ if (_mineStream->ioFailed()) {
+ delete outTag;
+ return false;
+ }
+ } else {
+ outSize = _mineStream->readUint32LE();
+ if (_mineStream->ioFailed()) return false;
+
+ outTag = new TwoTag();
+ if (!outTag->read(_mineStream)) {
+ delete outTag;
+ return false;
+ }
+ }
+ return true;
+}
+
+bool ScummBlock::determineHeaderSize(uint32& outSize) {
+ outSize = (_tag->isNewTag() ? 8 : 6);
+ return true;
+}
+
+bool ScummBlock::readHeader() {
+ ScummTag* outTag;
+ uint32 outSize;
+ if (!readHeader(outTag, outSize))
+ return false;
+ ASSERT( _size == -1 || _size == outSize );
+ _size = outSize;
+ ASSERT( _tag->equals(*outTag) );
+ delete outTag;
+ return true;
+}
+
+bool ScummBlock::determineSizeMode() {
+ if (_sizeMode != INVALID_SIZE_MODE)
+ return true;
+ //_sizeMode = (_tag->isNewTag() ? TILL_END : HEADER_INCLUDED);
+ _sizeMode = HEADER_INCLUDED; //a reasonable default
+ return true;
+}
+
+bool ScummBlock::determineDataSize() {
+ uint32 outSize;
+ if (!determineDataSize(outSize))
+ return false;
+ _dsize = outSize;
+ return true;
+}
+
+bool ScummBlock::determineDataSize(uint32& outSize) {
+ if (_dsize != -1) {
+ outSize = _dsize;
+ return true;
+ }
+
+ uint32 hsize;
+ if (!determineHeaderSize(hsize))
+ return false;
+ if (!determineSizeMode())
+ return false;
+
+ switch (_sizeMode) {
+ case HEADER_INCLUDED:
+ outSize = _size - hsize;
+ return true;
+
+ case HEADER_NOT_INCLUDED:
+ outSize = _size;
+ return true;
+
+ case HEADER_NOT_INCLUDED_MINUS_ONE:
+ outSize = _size + 1;
+ return true;
+
+ case TILL_END:
+ {
+ uint32 ssize = _mineStream->size();
+ if (_mineStream->ioFailed()) return false;
+
+ outSize = ssize - hsize;
+ }
+ return true;
+
+ case ENTRY_BASED:
+ default:
+ break;
+ }
+
+ ASSERT(false);
+ return false;
+}
+
+bool ScummBlock::readData() {
+ return doReadData();
+}
+
+bool ScummBlock::parseSubBlocks() {
+ return doParseSubBlocks();
+}
+
+//utility function
+bool ScummBlock::doReadData() {
+ ASSERT(_dsize >= 0);
+ ASSERT( !_data );
+ _data = new byte[_dsize];
+ uint32 read = _mineStream->read(_data, _dsize);
+ if (_mineStream->ioFailed() || read != _dsize) {
+ delete [] _data;
+ _data = NULL;
+ return false;
+ }
+ return true;
+}
+
+//utility function
+bool ScummBlock::doParseSubBlocks() {
+ uint32 hsize;
+ if (!determineHeaderSize(hsize))
+ return false;
+
+ while (true) {
+ uint32 pos = _mineStream->pos();
+ if (_mineStream->ioFailed())
+ return false;
+
+ if (_mineStream->eos())
+ break;
+ if (_mineStream->ioFailed())
+ return false;
+
+ ScummTag* outTag;
+ uint32 outSize;
+ if (!readHeader(outTag, outSize))
+ return false;
+
+ uint32 end = _mineStream->size();
+ if (_mineStream->ioFailed()) {
+ delete outTag;
+ return false;
+ }
+
+ Common::SeekableSubReadStream* kidstream =
+ new Common::SeekableSubReadStream(_mineStream, pos, end, false);
+
+ ScummBlock* kidblock = newBlock(outTag, outSize, kidstream);
+ if (!kidblock->determineDataSize()) {
+ delete kidblock;
+ return false;
+ }
+ uint32 kidSize = kidblock->_dsize;
+
+ kidSize += hsize;
+ if (kidSize != end - pos) {
+ delete kidstream;
+ kidstream =
+ new Common::SeekableSubReadStream(_mineStream, pos, pos + kidSize, false);
+ kidblock->_mineStream = kidstream;
+ }
+
+ _subblocks.push_back(kidblock);
+
+ _mineStream->seek(pos + kidSize);
+ if (_mineStream->ioFailed())
+ return false;
+ }
+
+ return true;
+}
+
+/////////////////////////////////////////////////////////////////////////////
+/////////////////////////////////////////////////////////////////////////////
+
+//a ScummBlock that has only a block tag + some data
+class RawScummBlock : public ScummBlock {
+public:
+ RawScummBlock(ScummTag* tag, uint32 size, Common::SeekableReadStream* stream)
+ : ScummBlock(tag, size, stream) {
+ ASSERT(_sizeMode == TILL_END);
+ ASSERT(!_readData);
+ ASSERT(!_parseSubBlocks);
+ }
+
+ virtual bool parse() {
+ _parsed = true;
+ return true;
+ }
+
+protected:
+
+ virtual bool readHeader() {
+ ASSERT(false); //we don't have a standard header
+ return false;
+ }
+
+ virtual bool determineHeaderSize(uint32& outSize) {
+ outSize = (_tag->isNewTag() ? 4 : 2);
+ return true;
+ }
+};
+
+/////////////////////////////////////////////////////////////////////////////
+/////////////////////////////////////////////////////////////////////////////
+
struct sbCreator {
ScummTag* _tag;
+ guid_list _parsers;
+
ScummChunkSizeMode _sizeMode;
uint32 _size; //read from the header
@@ -63,6 +469,10 @@
_readData(readData), _parseSubBlocks(parseSubBlocks) {}
virtual ScummBlock* create(ScummTag* tag, uint32 size, Common::SeekableReadStream* stream) = 0;
+ int addParser(const BGUID& parserGUID) {
+ _parsers.push_back(parserGUID);
+ return 1;
+ }
};
template<typename T>
@@ -103,14 +513,16 @@
#define SCUMM_BLOCK(blocktype, tag, sizeMode, size, dsize, readData, parseSubBlocks) \
static TAG_TYPE(tag) GENERATE_UNIQUE_IDENTIFIER_SUB(t)(tag); \
static sbCreatorT<blocktype> GENERATE_UNIQUE_IDENTIFIER_SUB(creator) \
- (&GENERATE_UNIQUE_IDENTIFIER_SUB(t), sizeMode, size, dsize, readData, parseSubBlocks); \
+ (&GENERATE_UNIQUE_IDENTIFIER_SUB(t), sizeMode, size, dsize, readData, parseSubBlocks); \
static ret_pair GENERATE_UNIQUE_IDENTIFIER_SUB(insert) = creators.insert( \
- the_pair( wxString(wxT(tag)), &GENERATE_UNIQUE_IDENTIFIER_SUB(creator)) );
+ the_pair( wxString(wxT(tag)), &GENERATE_UNIQUE_IDENTIFIER_SUB(creator)) );
#define BASIC_BLOCK(tag) \
SCUMM_BLOCK(ScummBlock, tag, INVALID_SIZE_MODE, -1, -1, false, false)
#define BLOCKY_BLOCK(tag) \
- SCUMM_BLOCK(ScummBlock, tag, INVALID_SIZE_MODE, -1, -1, false, true)
+ SCUMM_BLOCK(ScummBlock, tag, INVALID_SIZE_MODE, -1, -1, false, true) \
+ static int GENERATE_UNIQUE_IDENTIFIER_SUB(parser) = \
+ GENERATE_UNIQUE_IDENTIFIER_SUB(creator).addParser(blockyBlockPresenterGUID());
typedef std::map<wxString, sbCreator*> creator_map_t;
const creator_map_t& sb_creators() {
@@ -124,10 +536,45 @@
//static sbCreatorT<ScummBlock> creator(&tag, INVALID_SIZE_MODE, -1, -1, false, true);
//static ret_pair res = info_map.insert(wxT("tag"), &creator);
+ BASIC_BLOCK("ADL ")
+ BASIC_BLOCK("AMI ")
+ BASIC_BLOCK("APAL")
+ BASIC_BLOCK("CLUT")
+ SCUMM_BLOCK(ScummBlock, "DATA", TILL_END, -1, -1, false, false) //TODO: probably not correct
+
+ BASIC_BLOCK("FRMT")
+ BASIC_BLOCK("GMD")
+ SCUMM_BLOCK(ScummBlock, "iMUS", TILL_END, -1, -1, false, true) //TODO: probably not correct
+ BASIC_BLOCK("JUMP")
+
+ SCUMM_BLOCK(RawScummBlock, "LABN", TILL_END, -1, -1, false, false) //TODO: parse it properly
+ SCUMM_BLOCK(RawScummBlock, "LB83", TILL_END, -1, -1, false, false) //TODO: parse it properly
BLOCKY_BLOCK("LECF")
BLOCKY_BLOCK("LFLF")
BASIC_BLOCK("LOFF")
+ BASIC_BLOCK("MAP ")
+ SCUMM_BLOCK(RawScummBlock, "MCMP", TILL_END, -1, -1, false, false) //TODO: parse it properly
+ BASIC_BLOCK("MIDI")
+ BASIC_BLOCK("NPAL")
+ BASIC_BLOCK("OFFS")
+ BASIC_BLOCK("PALS")
+ SCUMM_BLOCK(RawScummBlock, "RIFF", TILL_END, -1, -1, false, false) //TODO: parse it properly
+ BASIC_BLOCK("ROL ")
+ BLOCKY_BLOCK("ROOM")
+ BLOCKY_BLOCK("RMSC")
+ BASIC_BLOCK("SPK ")
+ BASIC_BLOCK("STOP")
+
+ BLOCKY_BLOCK("WRAP") //FIXME: Is this ok? Shouldn't the OFFS subblock be used here?
+
+ //files
+ BLOCKY_BLOCK(".IMC")
+ BLOCKY_BLOCK(".IMX")
+ BASIC_BLOCK(".LUA")
+ BASIC_BLOCK("TXT.")
+ BLOCKY_BLOCK(".WAV")
+
return creators;
}
@@ -137,17 +584,34 @@
wxString tagName = tag->toString();
i = sb_creators().find(tagName);
if (i == sb_creators().end()) {
- return new ScummBlock(tag, size, stream);
+ return new ScummBlock(tag, size, stream); //revert to a default block when unknown
}
sbCreator* creator = i->second;
return creator->create(tag, size, stream);
}
-ScummBlock* ScummBlock::newBlock(ScummTag* tag, uint32 size, Common::SeekableReadStream* stream) {
- return ScummBlockFactory::create(tag, size, stream);
+guid_list getScummBlockParsers(const BGUID& tagGUID) {
+ creator_map_t::const_iterator i;
+ wxString tagName = tagGUID.identifier;
+ i = sb_creators().find(tagName);
+ if (i == sb_creators().end()) {
+ return guid_list();
+ }
+ sbCreator* creator = i->second;
+ return creator->_parsers;
}
-const blockInfo* getBlockType(const FourTag& tag) {
+/////////////////////////////////////////////////////////////////////////////
+/////////////////////////////////////////////////////////////////////////////
+
+const blockInfo* getBlockInfo(const ScummTag& tag) {
+ if (tag.isNewTag())
+ return getNewBlockInfo(static_cast<const FourTag&>(tag));
+ else
+ return getOldBlockInfo(static_cast<const TwoTag&>(tag));
+}
+
+const blockInfo* getNewBlockInfo(const FourTag& tag) {
for (int i = 0; blocksInfo[i].name != 0; i++)
if (tag.equals(blocksInfo[i].name))
@@ -156,7 +620,7 @@
return NULL;
}
-const blockInfo* getOldBlockType(const TwoTag& tag) {
+const blockInfo* getOldBlockInfo(const TwoTag& tag) {
for (int i = 0; oldBlocksInfo[i].name != 0; i++)
if (tag.equals(oldBlocksInfo[i].name))
Modified: scummex/branches/gsoc2007-gameresbrowser/src/plugins/scumm/resource.h
===================================================================
--- scummex/branches/gsoc2007-gameresbrowser/src/plugins/scumm/resource.h 2007-07-08 13:53:56 UTC (rev 27968)
+++ scummex/branches/gsoc2007-gameresbrowser/src/plugins/scumm/resource.h 2007-07-08 16:26:22 UTC (rev 27969)
@@ -34,6 +34,7 @@
#include "common/stream.h"
#include "FileType.h"
+#include "FileTypeRecognizer.h"
#include <list>
@@ -52,64 +53,27 @@
virtual wxString toString() const = 0;
virtual BGUID getFileTypeGUID() = 0;
- static BGUID getFileTypeGUID(const char* tag) {
- ASSERT(tag && tag[0] && tag[1]);
- if (!tag[2])
- return BGUID(wxT("OldScummBlock"), Browser::toString(tag), 1);
- ASSERT(tag[2] && tag[3] && !tag[4]);
- return BGUID(wxT("NewScummBlock"), Browser::toString(tag), 1);
- }
+ static BGUID getFileTypeGUID(const char* tag);
};
+bool operator==(const ScummTag& tag0, const ScummTag& tag1);
+
struct TwoTag : ScummTag {
byte _one;
byte _two;
- TwoTag() {}
- TwoTag(byte one, byte two)
- : _one(one), _two(two) {}
- TwoTag(const char* chars)
- : _one((byte)chars[0]), _two((byte)chars[1]) {}
+ TwoTag();
+ TwoTag(byte one, byte two);
+ TwoTag(const char* chars);
- static TwoTag create(const char* chars) {
- return TwoTag(chars);
- }
+ static TwoTag create(const char* chars);
- virtual bool read(Common::ReadStream* stream) {
- _one = stream->readByte();
- if (stream->ioFailed()) return false;
- _two = stream->readByte();
- if (stream->ioFailed()) return false;
- return true;
- }
-
- virtual bool isNewTag() const {
- return false;
- }
-
- virtual bool equals(const ScummTag& other) const {
- if (typeid(*this) != typeid(other))
- return false;
- const TwoTag& oth = static_cast<const TwoTag&>(other);
- return (_one == oth._one) && (_two == oth._two);
- }
-
- virtual bool equals(const char* chars) const {
- return (_one == (byte)chars[0]) && (_two == (byte)chars[1]);
- }
-
- virtual wxString toString() const {
- char chars[3];
- chars[0] = (char)_one;
- chars[1] = (char)_two;
- chars[2] = '\0';
- return Browser::toString(chars);
- }
-
- virtual BGUID getFileTypeGUID() {
- return BGUID(wxT("OldScummBlock"), toString(), 1);
- }
-
+ virtual bool isNewTag() const;
+ virtual bool read(Common::ReadStream* stream);
+ virtual bool equals(const ScummTag& other) const;
+ virtual bool equals(const char* chars) const;
+ virtual wxString toString() const;
+ virtual BGUID getFileTypeGUID();
};
struct FourTag : ScummTag {
@@ -118,69 +82,20 @@
byte _three;
byte _four;
- FourTag() {}
- FourTag(byte one, byte two, byte three, byte four)
- : _one(one), _two(two), _three(three), _four(four) {}
- FourTag(const char* chars)
- : _one((byte)chars[0]), _two((byte)chars[1]),
- _three((byte)chars[2]), _four((byte)chars[3]) {}
+ FourTag();
+ FourTag(byte one, byte two, byte three, byte four);
+ FourTag(const char* chars);
- static FourTag create(const char* chars) {
- return FourTag(chars);
- }
+ static FourTag create(const char* chars);
- virtual bool read(Common::ReadStream* stream) {
- _one = stream->readByte();
- if (stream->ioFailed()) return false;
- _two = stream->readByte();
- if (stream->ioFailed()) return false;
- _three = stream->readByte();
- if (stream->ioFailed()) return false;
- _four = stream->readByte();
- if (stream->ioFailed()) return false;
- return true;
- }
-
- virtual bool isNewTag() const {
- return true;
- }
-
- virtual bool equals(const ScummTag& other) const {
- if (typeid(*this) != typeid(other))
- return false;
- const FourTag& oth = static_cast<const FourTag&>(other);
- return (_one == oth._one) && (_two == oth._two) &&
- (_three == oth._three) && (_four == oth._four);
- }
-
- virtual bool equals(const char* chars) const {
- return (_one == (byte)chars[0]) &&
- (_two == (byte)chars[1]) &&
- (_three == (byte)chars[2]) &&
- (_four == (byte)chars[3]);
- }
-
- virtual wxString toString() const {
- char chars[5];
- chars[0] = (char)_one;
- chars[1] = (char)_two;
- chars[2] = (char)_three;
- chars[3] = (char)_four;
- chars[4] = '\0';
- return Browser::toString(chars);
- }
-
- virtual BGUID getFileTypeGUID() {
- return BGUID(wxT("NewScummBlock"), toString(), 1);
- }
-
+ virtual bool isNewTag() const;
+ virtual bool read(Common::ReadStream* stream);
+ virtual bool equals(const ScummTag& other) const;
+ virtual bool equals(const char* chars) const;
+ virtual wxString toString() const;
+ virtual BGUID getFileTypeGUID();
};
-inline
-bool operator==(const ScummTag& tag0, const ScummTag& tag1) {
- return tag0.equals(tag1);
-}
-
/////////////////////////////////////////////////////////////////////////////
/////////////////////////////////////////////////////////////////////////////
@@ -203,13 +118,15 @@
extern const struct blockInfo blocksInfo[];
extern const struct blockInfo oldBlocksInfo[];
-const blockInfo* getBlockType(const FourTag& tag);
-const blockInfo* getOldBlockType(const TwoTag& tag);
+const blockInfo* getBlockInfo(const ScummTag& tag);
+const blockInfo* getNewBlockInfo(const FourTag& tag);
+const blockInfo* getOldBlockInfo(const TwoTag& tag);
/////////////////////////////////////////////////////////////////////////////
/////////////////////////////////////////////////////////////////////////////
// Interfaces
+/*
template<typename T>
class ILECFBlock : public IInterface {
public:
@@ -219,26 +136,15 @@
delete this;
}
};
+*/
/////////////////////////////////////////////////////////////////////////////
/////////////////////////////////////////////////////////////////////////////
-//to be used by TextPresenter, so it has a title and the text
-class IText : public IInterface {
-public:
- GUID_FOR(IText, wxT("CoreInterfaces"), 1);
- virtual const wxString& getTitle() = 0;
- virtual const wxString& getText() = 0;
- virtual void release() {
- delete this;
- }
-};
-
-/////////////////////////////////////////////////////////////////////////////
-/////////////////////////////////////////////////////////////////////////////
-
class ScummBlock;
+guid_list getScummBlockParsers(const BGUID& tagGUID);
+
class ScummBlockFactory {
public:
static ScummBlock* create(ScummTag* tag, uint32 size, Common::SeekableReadStream* stream);
@@ -254,6 +160,8 @@
};
struct sbCreator;
+template<typename T>
+struct sbCreatorT;
class ScummBlock {
public: //HACK: <-- only temporary
@@ -278,247 +186,33 @@
friend struct sbCreatorT;
public:
- ScummBlock(ScummTag* tag, uint32 size, Common::SeekableReadStream* stream)
- : _tag(tag), _sizeMode(INVALID_SIZE_MODE),
- _ownStream(true), _mineStream(stream),
- _parsed(false), _size(size), _dsize(-1), _data(NULL),
- _readData(false), _parseSubBlocks(false) {}
+ ScummBlock(ScummTag* tag, uint32 size, Common::SeekableReadStream* stream);
+ ~ScummBlock();
- ~ScummBlock() {
- if(_tag)
- delete _tag;
- scumm_blocks::iterator i;
- for (i = _subblocks.begin(); i != _subblocks.end(); ++i)
- delete *i;
- if (_ownStream)
- delete _mineStream;
- if (_data)
- delete [] _data;
- }
+ ScummTag* getTag();
- ScummTag* getTag() {
- return _tag;
- }
+ const scumm_blocks& getSubBlocks();
+ Common::SeekableReadStream* getStream();
+ RecognizedFileType getFileType();
- const scumm_blocks& getSubBlocks() {
- return _subblocks;
- }
+ virtual bool parse();
- Common::SeekableReadStream* getStream() {
- return _mineStream;
- }
-
- RecognizedFileType getFileType() {
- return RecognizedFileType(IDEAL_MATCH, _tag->getFileTypeGUID());
- }
-
- virtual bool parse() {
- if(_parsed)
- return true;
-
- ASSERT(_mineStream);
- _mineStream->seek(0, SEEK_SET);
-
- if (!readHeader())
- return false;
-
- if (!determineSizeMode())
- return false;
-
- if (!determineDataSize())
- return false;
-
- if (_readData && !readData())
- return false;
-
- if (_parseSubBlocks && !parseSubBlocks())
- return false;
-
- _parsed = true;
- return true;
- }
-
protected:
+
virtual ScummBlock* newBlock(ScummTag* tag, uint32 size, Common::SeekableReadStream* stream);
- virtual bool readHeader(ScummTag*& outTag, uint32& outSize) {
- if (_tag->isNewTag()) {
- outTag = new FourTag();
- if (!outTag->read(_mineStream)) {
- delete outTag;
- return false;
- }
+ virtual bool readHeader();
+ bool readHeader(ScummTag*& outTag, uint32& outSize);
+ virtual bool readData();
+ virtual bool parseSubBlocks();
- outSize = _mineStream->readUint32BE();
- if (_mineStream->ioFailed()) {
- delete outTag;
- return false;
- }
- } else {
- outSize = _mineStream->readUint32LE();
- if (_mineStream->ioFailed()) return false;
+ virtual bool determineHeaderSize(uint32& outSize);
+ virtual bool determineSizeMode();
+ virtual bool determineDataSize();
+ virtual bool determineDataSize(uint32& outSize);
- outTag = new TwoTag();
- if (!outTag->read(_mineStream)) {
- delete outTag;
- return false;
- }
- }
- return true;
- }
-
- virtual bool determineHeaderSize(uint32& outSize) {
- outSize = (_tag->isNewTag() ? 8 : 6);
- return true;
- }
-
- virtual bool readHeader() {
- ScummTag* outTag;
- uint32 outSize;
- if (!readHeader(outTag, outSize))
- return false;
- ASSERT( _size == -1 || _size == outSize );
- _size = outSize;
- ASSERT( _tag->equals(*outTag) );
- delete outTag;
- return true;
- }
-
- virtual bool determineSizeMode() {
- if (_sizeMode != INVALID_SIZE_MODE)
- return true;
- //_sizeMode = (_tag->isNewTag() ? TILL_END : HEADER_INCLUDED);
- _sizeMode = HEADER_INCLUDED; //a reasonable default
- return true;
- }
-
- virtual bool determineDataSize() {
- uint32 outSize;
- if (!determineDataSize(outSize))
- return false;
- _dsize = outSize;
- return true;
- }
-
- virtual bool determineDataSize(uint32& outSize) {
- if (_dsize != -1) {
- outSize = _dsize;
- return true;
- }
-
- uint32 hsize;
- if (!determineHeaderSize(hsize))
- return false;
- if (!determineSizeMode())
- return false;
-
- switch (_sizeMode) {
- case HEADER_INCLUDED:
- outSize = _size - hsize;
- return true;
-
- case HEADER_NOT_INCLUDED:
- outSize = _size;
- return true;
-
- case HEADER_NOT_INCLUDED_MINUS_ONE:
- outSize = _size + 1;
- return true;
-
- case TILL_END:
- {
- uint32 ssize = _mineStream->size();
- if (_mineStream->ioFailed()) return false;
-
- outSize = ssize - hsize;
- }
- return true;
-
- case ENTRY_BASED:
- default:
- break;
- }
-
- ASSERT(false);
- return false;
- }
-
- virtual bool readData() {
- return doReadData();
- }
-
- virtual bool parseSubBlocks() {
- return doParseSubBlocks();
- }
-
- //utility function
- bool doReadData() {
- ASSERT(_dsize >= 0);
- ASSERT( !_data );
- _data = new byte[_dsize];
- uint32 read = _mineStream->read(_data, _dsize);
- if (_mineStream->ioFailed() || read != _dsize) {
- delete [] _data;
- _data = NULL;
- return false;
- }
- return true;
- }
-
- //utility function
- bool doParseSubBlocks() {
- uint32 hsize;
- if (!determineHeaderSize(hsize))
- return false;
-
- while (true) {
- uint32 pos = _mineStream->pos();
- if (_mineStream->ioFailed())
- return false;
-
- if (_mineStream->eos())
- break;
- if (_mineStream->ioFailed())
- return false;
-
- ScummTag* outTag;
- uint32 outSize;
- if (!readHeader(outTag, outSize))
- return false;
-
- uint32 end = _mineStream->size();
- if (_mineStream->ioFailed()) {
- delete outTag;
- return false;
- }
-
- Common::SeekableSubReadStream* kidstream =
- new Common::SeekableSubReadStream(_mineStream, pos, end, false);
-
- ScummBlock* kidblock = newBlock(outTag, outSize, kidstream);
- if (!kidblock->determineDataSize()) {
- delete kidblock;
- return false;
- }
- uint32 kidSize = kidblock->_dsize;
-
- kidSize += hsize;
- if (kidSize != end - pos) {
- delete kidstream;
- kidstream =
- new Common::SeekableSubReadStream(_mineStream, pos, pos + kidSize, false);
- kidblock->_mineStream = kidstream;
- }
-
- _subblocks.push_back(kidblock);
-
- _mineStream->seek(pos + kidSize);
- if (_mineStream->ioFailed())
- return false;
- }
-
- return true;
- }
+ bool doReadData();
+ bool doParseSubBlocks();
};
/////////////////////////////////////////////////////////////////////////////
Property changes on: scummex/branches/gsoc2007-gameresbrowser/vc8/Browser
___________________________________________________________________
Name: svn:ignore
- Debug
Browser.vcproj.ELWOOD.RootBoot.user
+ Debug
Browser.vcproj.ELWOOD.RootBoot.user
Unicode Debug
Property changes on: scummex/branches/gsoc2007-gameresbrowser/vc8/core
___________________________________________________________________
Name: svn:ignore
- Debug
core.vcproj.ELWOOD.RootBoot.user
+ Debug
core.vcproj.ELWOOD.RootBoot.user
Unicode Debug
Modified: scummex/branches/gsoc2007-gameresbrowser/vc8/core/core.vcproj
===================================================================
--- scummex/branches/gsoc2007-gameresbrowser/vc8/core/core.vcproj 2007-07-08 13:53:56 UTC (rev 27968)
+++ scummex/branches/gsoc2007-gameresbrowser/vc8/core/core.vcproj 2007-07-08 16:26:22 UTC (rev 27969)
@@ -350,6 +350,18 @@
>
</File>
<File
+ RelativePath="..\..\src\core\tostring.cpp"
+ >
+ <FileConfiguration
+ Name="Unicode Debug|Win32"
+ >
+ <Tool
+ Name="VCCLCompilerTool"
+ GeneratePreprocessedFile="0"
+ />
+ </FileConfiguration>
+ </File>
+ <File
RelativePath="..\..\src\core\tostring.h"
>
</File>
Property changes on: scummex/branches/gsoc2007-gameresbrowser/vc8/plugin_sample1
___________________________________________________________________
Name: svn:ignore
- Debug
plugin_sample1.vcproj.ELWOOD.RootBoot.user
+ Debug
plugin_sample1.vcproj.ELWOOD.RootBoot.user
Unicode Debug
Property changes on: scummex/branches/gsoc2007-gameresbrowser/vc8/plugins
___________________________________________________________________
Name: svn:ignore
- Debug
plugins.vcproj.ELWOOD.RootBoot.user
+ Debug
plugins.vcproj.ELWOOD.RootBoot.user
Unicode Debug
Modified: scummex/branches/gsoc2007-gameresbrowser/vc8/plugins/plugins.vcproj
===================================================================
--- scummex/branches/gsoc2007-gameresbrowser/vc8/plugins/plugins.vcproj 2007-07-08 13:53:56 UTC (rev 27968)
+++ scummex/branches/gsoc2007-gameresbrowser/vc8/plugins/plugins.vcproj 2007-07-08 16:26:22 UTC (rev 27969)
@@ -343,6 +343,14 @@
>
</File>
<File
+ RelativePath="..\..\src\plugins\scumm\ScummBlockInfoPresenter.cpp"
+ >
+ </File>
+ <File
+ RelativePath="..\..\src\plugins\scumm\ScummBlockInfoPresenter.h"
+ >
+ </File>
+ <File
RelativePath="..\..\src\plugins\scumm\ScummBlockPresenter.cpp"
>
</File>
@@ -351,6 +359,14 @@
>
</File>
<File
+ RelativePath="..\..\src\plugins\scumm\ScummFileTypes.cpp"
+ >
+ </File>
+ <File
+ RelativePath="..\..\src\plugins\scumm\ScummFileTypes.h"
+ >
+ </File>
+ <File
RelativePath="..\..\src\plugins\scumm\ScummParser.cpp"
>
</File>
@@ -361,6 +377,14 @@
<File
RelativePath="..\..\src\plugins\scumm\ScummRecognizer.cpp"
>
+ <FileConfiguration
+ Name="Unicode Debug|Win32"
+ >
+ <Tool
+ Name="VCCLCompilerTool"
+ GeneratePreprocessedFile="0"
+ />
+ </FileConfiguration>
</File>
<File
RelativePath="..\..\src\plugins\scumm\ScummRecognizer.h"
Property changes on: scummex/branches/gsoc2007-gameresbrowser/wxdev
___________________________________________________________________
Name: svn:ignore
+ Objects
Output
Modified: scummex/branches/gsoc2007-gameresbrowser/wxdev/Browser.dev
===================================================================
--- scummex/branches/gsoc2007-gameresbrowser/wxdev/Browser.dev 2007-07-08 13:53:56 UTC (rev 27968)
+++ scummex/branches/gsoc2007-gameresbrowser/wxdev/Browser.dev 2007-07-08 16:26:22 UTC (rev 27969)
@@ -11,16 +11,17 @@
Folders=
[Unit1]
-FileName=..\src\gui\BrowserDlg.wxform
+FileName=..\src\gui\BrowserApp.cpp
Folder=Browser
-Compile=0
-Link=0
+Compile=1
+Link=1
Priority=1000
OverrideBuildCmd=0
BuildCmd=
+CompileCpp=1
[Unit2]
-FileName=..\src\gui\BrowserApp.cpp
+FileName=..\src\gui\BrowserApp.h
CompileCpp=1
Folder=Browser
Compile=1
@@ -30,26 +31,27 @@
BuildCmd=
[Unit3]
-FileName=..\src\gui\BrowserApp.h
+FileName=..\src\gui\BrowserApp.rc
CompileCpp=1
Folder=Browser
Compile=1
-Link=1
+Link=0
Priority=1000
OverrideBuildCmd=0
BuildCmd=
[Unit4]
-FileName=..\src\gui\BrowserApp.rc
+FileName=..\src\gui\MainForm.cpp
Folder=Browser
Compile=1
-Link=0
+Link=1
Priority=1000
OverrideBuildCmd=0
BuildCmd=
+CompileCpp=1
[Unit5]
-FileName=..\src\gui\BrowserDlg.cpp
+FileName=..\src\gui\MainForm.h
CompileCpp=1
Folder=Browser
Compile=1
@@ -59,11 +61,11 @@
BuildCmd=
[Unit6]
-FileName=..\src\gui\BrowserDlg.h
+FileName=..\src\gui\MainForm.wxform
CompileCpp=1
Folder=Browser
-Compile=1
-Link=1
+Compile=0
+Link=0
Priority=1000
OverrideBuildCmd=0
BuildCmd=
@@ -142,7 +144,7 @@
compilerType=1
[Unit7]
-FileName=..\src\gui\MainForm.cpp
+FileName=TextPresenterDlg.h
CompileCpp=1
Folder=Browser
Compile=1
@@ -152,7 +154,7 @@
BuildCmd=
[Unit8]
-FileName=..\src\gui\MainForm.h
+FileName=TextPresenterDlg.cpp
CompileCpp=1
Folder=Browser
Compile=1
@@ -162,7 +164,7 @@
BuildCmd=
[Unit9]
-FileName=..\src\gui\MainForm.wxform
+FileName=TextPresenterDlg.wxform
Folder=Browser
Compile=0
Link=0
Modified: scummex/branches/gsoc2007-gameresbrowser/wxdev/Browser.layout
===================================================================
--- scummex/branches/gsoc2007-gameresbrowser/wxdev/Browser.layout 2007-07-08 13:53:56 UTC (rev 27968)
+++ scummex/branches/gsoc2007-gameresbrowser/wxdev/Browser.layout 2007-07-08 16:26:22 UTC (rev 27969)
@@ -1,17 +1,17 @@
[Editor_4]
CursorCol=3
CursorRow=51
-TopLine=21
+TopLine=51
LeftChar=1
-Open=0
+Open=1
Top=0
[Editor_5]
CursorCol=1
CursorRow=1
TopLine=1
LeftChar=1
-Open=0
-Top=0
+Open=1
+Top=1
[Editor_0]
CursorCol=1
CursorRow=1
@@ -21,10 +21,10 @@
Top=0
[Editor_3]
CursorCol=1
-CursorRow=182
-TopLine=152
+CursorRow=169
+TopLine=139
LeftChar=1
-Open=0
+Open=1
Top=0
[Editor_1]
CursorCol=1
@@ -35,7 +35,7 @@
Top=0
[Editors]
Focused=-1
-Order=
+Order=-1
[Editor_2]
Open=0
Top=0
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