diff --git a/code/nel/tools/pipeline/max/class_data.cpp b/code/nel/tools/pipeline/max/class_data.cpp
new file mode 100644
index 000000000..551ffc1d0
--- /dev/null
+++ b/code/nel/tools/pipeline/max/class_data.cpp
@@ -0,0 +1,173 @@
+/**
+ * \file class_data.cpp
+ * \brief CClassData
+ * \date 2012-08-18 19:24GMT
+ * \author Jan Boon (Kaetemi)
+ * CClassData
+ */
+
+/*
+ * Copyright (C) 2012 by authors
+ *
+ * This file is part of RYZOM CORE PIPELINE.
+ * RYZOM CORE PIPELINE is free software: you can redistribute it
+ * and/or modify it under the terms of the GNU Affero General Public
+ * License as published by the Free Software Foundation, either
+ * version 3 of the License, or (at your option) any later version.
+ *
+ * RYZOM CORE PIPELINE is distributed in the hope that it will be
+ * useful, but WITHOUT ANY WARRANTY; without even the implied warranty
+ * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public
+ * License along with RYZOM CORE PIPELINE. If not, see
+ * .
+ */
+
+#include
+#include "class_data.h"
+
+// STL includes
+
+// NeL includes
+// #include
+
+// Project includes
+
+using namespace std;
+// using namespace NLMISC;
+
+namespace PIPELINE {
+namespace MAX {
+
+////////////////////////////////////////////////////////////////////////
+////////////////////////////////////////////////////////////////////////
+////////////////////////////////////////////////////////////////////////
+
+CClassData::CClassData()
+{
+
+}
+
+CClassData::~CClassData()
+{
+
+}
+
+std::string CClassData::getClassName()
+{
+ return "ClassData";
+}
+
+void CClassData::toString(std::ostream &ostream, const std::string &pad)
+{
+ CStorageContainer::toString(ostream, pad);
+}
+
+IStorageObject *CClassData::createChunkById(uint16 id, bool container)
+{
+ if (container)
+ {
+ switch (id)
+ {
+ case 0x2100: // ClassDataEntry
+ return new CClassDataEntry();
+ }
+ }
+ return CStorageContainer::createChunkById(id, container);
+}
+
+void CClassData::serialized(TStorageObjectContainer::iterator soit, bool container)
+{
+ CStorageContainer::serialized(soit, container);
+}
+
+////////////////////////////////////////////////////////////////////////
+////////////////////////////////////////////////////////////////////////
+////////////////////////////////////////////////////////////////////////
+
+CClassDataEntry::CClassDataEntry()
+{
+
+}
+
+CClassDataEntry::~CClassDataEntry()
+{
+
+}
+
+std::string CClassDataEntry::getClassName()
+{
+ return "ClassData";
+}
+
+void CClassDataEntry::toString(std::ostream &ostream, const std::string &pad)
+{
+ CStorageContainer::toString(ostream, pad);
+}
+
+IStorageObject *CClassDataEntry::createChunkById(uint16 id, bool container)
+{
+ if (!container)
+ {
+ switch (id)
+ {
+ case 0x2110: // ClassDataHeader
+ return new CClassDataHeader();
+ }
+ }
+ switch (id)
+ {
+ case 0x2120: // ClassDataBody: Depends on the ClassDataHeader: TODO
+ return CStorageContainer::createChunkById(id, container);
+ }
+ return CStorageContainer::createChunkById(id, container);
+}
+
+void CClassDataEntry::serialized(TStorageObjectContainer::iterator soit, bool container)
+{
+ CStorageContainer::serialized(soit, container);
+}
+
+////////////////////////////////////////////////////////////////////////
+////////////////////////////////////////////////////////////////////////
+////////////////////////////////////////////////////////////////////////
+
+CClassDataHeader::CClassDataHeader()
+{
+
+}
+
+CClassDataHeader::~CClassDataHeader()
+{
+
+}
+
+std::string CClassDataHeader::getClassName()
+{
+ return "ClassDataHeader";
+}
+
+void CClassDataHeader::serial(NLMISC::IStream &stream)
+{
+ stream.serial(ClassID);
+ stream.serial(SuperClassID);
+}
+
+void CClassDataHeader::toString(std::ostream &ostream, const std::string &pad)
+{
+ ostream << "(" << getClassName() << ") { ";
+ ostream << "\n" << pad << "ClassID: " << NLMISC::toString(ClassID);
+ ostream << "\n" << pad << "SuperClassID: " << SuperClassID;
+ ostream << "} ";
+}
+
+////////////////////////////////////////////////////////////////////////
+////////////////////////////////////////////////////////////////////////
+////////////////////////////////////////////////////////////////////////
+
+} /* namespace MAX */
+} /* namespace PIPELINE */
+
+/* end of file */
diff --git a/code/nel/tools/pipeline/max/class_data.h b/code/nel/tools/pipeline/max/class_data.h
new file mode 100644
index 000000000..cda06e060
--- /dev/null
+++ b/code/nel/tools/pipeline/max/class_data.h
@@ -0,0 +1,116 @@
+/**
+ * \file class_data.h
+ * \brief CClassData
+ * \date 2012-08-18 19:24GMT
+ * \author Jan Boon (Kaetemi)
+ * CClassData
+ */
+
+/*
+ * Copyright (C) 2012 by authors
+ *
+ * This file is part of RYZOM CORE PIPELINE.
+ * RYZOM CORE PIPELINE is free software: you can redistribute it
+ * and/or modify it under the terms of the GNU Affero General Public
+ * License as published by the Free Software Foundation, either
+ * version 3 of the License, or (at your option) any later version.
+ *
+ * RYZOM CORE PIPELINE is distributed in the hope that it will be
+ * useful, but WITHOUT ANY WARRANTY; without even the implied warranty
+ * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public
+ * License along with RYZOM CORE PIPELINE. If not, see
+ * .
+ */
+
+#ifndef PIPELINE_CLASS_DATA_H
+#define PIPELINE_CLASS_DATA_H
+#include
+
+// STL includes
+
+// NeL includes
+#include
+
+// Project includes
+#include "storage_object.h"
+#include "storage_value.h"
+
+namespace PIPELINE {
+namespace MAX {
+
+/**
+ * \brief CClassData
+ * \date 2012-08-18 19:24GMT
+ * \author Jan Boon (Kaetemi)
+ * CClassData
+ */
+class CClassData : public CStorageContainer
+{
+public:
+ CClassData();
+ virtual ~CClassData();
+
+ // inherited
+ virtual std::string getClassName();
+ virtual void toString(std::ostream &ostream, const std::string &pad = "");
+
+protected:
+ virtual IStorageObject *createChunkById(uint16 id, bool container);
+ virtual void serialized(TStorageObjectContainer::iterator soit, bool container);
+
+}; /* class CClassData */
+
+/**
+ * \brief CClassDataEntry
+ * \date 2012-08-18 18:01GMT
+ * \author Jan Boon (Kaetemi)
+ * CClassDataEntry
+ */
+class CClassDataEntry : public CStorageContainer
+{
+public:
+ CClassDataEntry();
+ virtual ~CClassDataEntry();
+
+ // inherited
+ virtual std::string getClassName();
+ virtual void toString(std::ostream &ostream, const std::string &pad = "");
+
+protected:
+ virtual IStorageObject *createChunkById(uint16 id, bool container);
+ virtual void serialized(TStorageObjectContainer::iterator soit, bool container);
+
+}; /* class CClassDataEntry */
+
+/**
+ * \brief CClassDataHeader
+ * \date 2012-08-18 18:01GMT
+ * \author Jan Boon (Kaetemi)
+ * CClassDirectoryHeader
+ */
+class CClassDataHeader : public IStorageObject
+{
+public:
+ CClassDataHeader();
+ virtual ~CClassDataHeader();
+
+ // public data
+ NLMISC::CClassId ClassID;
+ uint32 SuperClassID;
+
+ // inherited
+ virtual std::string getClassName();
+ virtual void serial(NLMISC::IStream &stream);
+ virtual void toString(std::ostream &ostream, const std::string &pad = "");
+
+}; /* class CClassDataHeader */
+
+} /* namespace MAX */
+} /* namespace PIPELINE */
+
+#endif /* #ifndef PIPELINE_CLASS_DATA_H */
+
+/* end of file */
diff --git a/code/nel/tools/pipeline/max_dump/main.cpp b/code/nel/tools/pipeline/max_dump/main.cpp
index 011c87d61..c4cb5f8ca 100644
--- a/code/nel/tools/pipeline/max_dump/main.cpp
+++ b/code/nel/tools/pipeline/max_dump/main.cpp
@@ -20,248 +20,14 @@
#include "../max/storage_object.h"
#include "../max/dll_directory.h"
#include "../max/class_directory_3.h"
+#include "../max/class_data.h"
//static const char *filename = "/srv/work/database/interfaces/anims_max/cp_fy_hof_species.max";
static const char *filename = "/home/kaetemi/source/minimax/GE_Acc_MikotoBaniere.max";
//static const char *filename = "/home/kaetemi/3dsMax/scenes/test2008.max";
//static const char *filename = "/home/kaetemi/3dsMax/scenes/teapot_test_scene.max";
-static const char *streamname = "ClassDirectory3";
+static const char *streamname = "ClassData";
-inline uint8 cleanChar(uint8 c)
-{
- if (c >= 32 && c <= 126) return c;
- return 46;
-}
-
-namespace PIPELINE {
-namespace MAX {
-
-
-
-
-/*
-struct CClass_ID : public NLMISC::IStreamable
-{
- uint32 A;
- uint32 B;
-
- virtual void serial(NLMISC::IStream &stream);
- virtual std::string getClassName();
-};
-void CClass_ID::serial(NLMISC::IStream &stream)
-{
- stream.serial(A);
- stream.serial(B);
-}
-std::string CClass_ID::getClassName()
-{
- return "Class_ID";
-}
-
-struct CClassDirectoryHeader : public IStorageStreamable
-{
- uint32 DllIndex;
- CClass_ID ClassID;
- uint32 SuperClassID;
- virtual void serial(NLMISC::IStream &stream);
- virtual void dump(const std::string &pad);
- virtual std::string getClassName();
-};
-void CClassDirectoryHeader::serial(NLMISC::IStream &stream)
-{
- stream.serial(DllIndex);
- stream.serial(ClassID);
- stream.serial(SuperClassID);
-}
-void CClassDirectoryHeader::dump(const std::string &pad)
-{
- printf("CClassDirectoryHeader - DllIndex: %u, ClassID: (A: 0x%X, B: 0x%X), SuperClassID: 0x%X\n", DllIndex, ClassID.A, ClassID.B, SuperClassID);
-}
-std::string CClassDirectoryHeader::getClassName()
-{
- return "ClassDirectoryHeader";
-}
-
-void CStorageContainer::serial(CStorageStream *stream)
-{
-
-}
-IStorageObject *CStorageContainer::serialChunk(CStorageStream *stream)
-{
- IStorageObject *storageObject = NULL;
- if (stream->isChunkContainer())
- {
- switch (stream->getChunkId())
- {
- case 0x2040: // ClassEntry: container with dll index, class id, superclass id and class name
- case 0x2038: // DllEntry: container with dll desc and name
- default:
- storageObject = new CStorageContainer();
- break;
- }
- }
- else
- {
- switch (stream->getChunkId())
- {
- case 0x2060:
- storageObject = new CClassDirectoryHeader();
- break;
- case 0x21C0: // FileVersion: 4 byte in the dlldir thing, exists in 2010 but not in 3.x
- storageObject = new CStorageValue();
- break;
- case 0x2039: // DllDescription: dll description in the DllEntry
- case 0x2037: // DllFilename: dll name in the DllEntry
- case 0x2042: // ClassName: name of class in ClassEntry
- storageObject = new CStorageUCString();
- break;
- default:
- storageObject = new CStorageRaw();
- break;
- }
- }
- storageObject->serial(stream);
- return storageObject;
-}
-void CStorageContainer::dump(const std::string &pad)
-{
- printf("CStorageContainer - items: %i\n", (sint32)size());
- for (iterator it = this->begin(), end = this->end(); it != end; ++it)
- {
- std::string padpad = pad + "\t";
- printf("%s[0x%X] ", padpad.c_str(), (sint32)(it->first));
- (it->second)->dump(padpad);
- }
-}
-
-void CStorageRaw::serial(CStorageStream *stream)
-{
- if (stream->isReading())
- {
- resize(stream->getChunkSize());
- stream->serialBuffer(&(*this)[0], size());
- }
- else
- {
- throw EStorage();
- }
-}
-void CStorageRaw::dump(const std::string &pad)
-{
- std::vector buffer;
- buffer.resize(size() + 1);
- for (std::vector::size_type i = 0; i < size(); ++i)
- buffer[i] = cleanChar((*this)[i]);
- buffer[buffer.size() - 1] = 0;
- printf("CStorageRaw - bytes: %i\n", (sint32)size());
- printf("%s%s\n", pad.c_str(), &buffer[0]);
-}
-
-void CStorageUCString::serial(CStorageStream *stream)
-{
- if (stream->isReading())
- {
- sint32 size = stream->getChunkSize();
- resize(size / 2);
- stream->serialBuffer((uint8 *)&(*this)[0], size);
- }
- else
- {
- throw EStorage();
- }
-}
-void CStorageUCString::dump(const std::string &pad)
-{
- std::vector buffer;
- buffer.resize(size() + 1);
- for (size_type i = 0; i < size(); ++i)
- buffer[i] = (*this)[i] > 255 ? 46 : cleanChar((*this)[i]);
- buffer[buffer.size() - 1] = 0;
- printf("CStorageUCString - length: %i\n", (sint32)size());
- printf("%s%s\n", pad.c_str(), &buffer[0]);
-}
-
-void CStorageString::serial(CStorageStream *stream)
-{
- if (stream->isReading())
- {
- resize(stream->getChunkSize());
- stream->serialBuffer((uint8 *)(&(*this)[0]), size());
- }
- else
- {
- throw EStorage();
- }
-}
-void CStorageString::dump(const std::string &pad)
-{
- std::vector buffer;
- buffer.resize(size() + 1);
- for (std::vector::size_type i = 0; i < size(); ++i)
- buffer[i] = cleanChar((*this)[i]);
- buffer[buffer.size() - 1] = 0;
- printf("CStorageString - length: %i\n", (sint32)size());
- printf("%s%s\n", pad.c_str(), &buffer[0]);
-}
-
-template
-void CStorageValue::serial(CStorageStream *stream)
-{
- stream->serial(Value);
-}
-template
-void CStorageValue::dump(const std::string &pad)
-{
- printf("CStorageValue - bytes: %i\n", (sint32)(sizeof(T)));
- std::string valstr = NLMISC::toString(Value);
- printf("%s%s\n", pad.c_str(), valstr.c_str());
-}
-*/
-}
-}
-/*
-static void dumpData(PIPELINE::MAX::CStorageStream *in, const std::string &pad)
-{
- sint32 size = in->getChunkSize();
- std::vector buffer;
- buffer.resize(size + 2);
- in->serialBuffer(&buffer[0], size);
- switch (in->getChunkId())
- {
- case 8249: // some dll description
- case 8247: // some dll name
- for (std::vector::size_type i = 0; i < buffer.size() / 2; ++i)
- buffer[i] = cleanChar(buffer[i * 2]);
- buffer[(buffer.size() / 2) - 1] = 0;
- printf("%sUTF16: %s\n", pad.c_str(), &buffer[0]);
- break;
- default:
- for (std::vector::size_type i = 0; i < buffer.size(); ++i)
- buffer[i] = cleanChar(buffer[i]);
- buffer[buffer.size() - 2] = 0;
- printf("%sRAW: %s\n", pad.c_str(), &buffer[0]);
- break;
- }
-}
-
-static void dumpContainer(PIPELINE::MAX::CStorageStream *in, const std::string &pad)
-{
- while (in->enterChunk())
- {
- printf("%sCHUNK ID: %i, SIZE: %i, CONTAINER: %i\n", pad.c_str(), (sint32)in->getChunkId(), (sint32)in->getChunkSize(), (sint32)in->isChunkContainer());
- if (in->isChunkContainer())
- {
- dumpContainer(in, pad + "\t");
- }
- else
- {
- dumpData(in, pad + "\t");
- }
- sint32 skipped = in->leaveChunk();
- printf("%sSKIPPED: %i\n", pad.c_str(), skipped);
- }
-}
-*/
// int __stdcall WinMain(void *, void *, void *, int)
int main(int argc, char **argv)
{
@@ -312,7 +78,7 @@ int main(int argc, char **argv)
//gsf_input_dump(input, 1); // just a regular hex dump of this input stream
PIPELINE::MAX::CStorageStream instream(input);
//dumpContainer(instream, "");
- PIPELINE::MAX::CClassDirectory3 ctr;
+ PIPELINE::MAX::CClassData ctr;
ctr.serial(instream);
ctr.toString(std::cout);
std::cout << "\n";