diff --git a/code/nel/tools/pipeline/max/dll_directory.cpp b/code/nel/tools/pipeline/max/dll_directory.cpp new file mode 100644 index 000000000..21917e718 --- /dev/null +++ b/code/nel/tools/pipeline/max/dll_directory.cpp @@ -0,0 +1,132 @@ +/** + * \file dll_directory.cpp + * \brief CDllDirectory + * \date 2012-08-18 09:01GMT + * \author Jan Boon (Kaetemi) + * CDllDirectory + */ + +/* + * 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 "dll_directory.h" + +// STL includes + +// NeL includes +// #include + +// Project includes + +using namespace std; +// using namespace NLMISC; + +namespace PIPELINE { +namespace MAX { + +CDllDirectory::CDllDirectory() +{ + +} + +CDllDirectory::~CDllDirectory() +{ + +} + +std::string CDllDirectory::getClassName() +{ + return "DllDirectory"; +} + +void CDllDirectory::toString(std::ostream &ostream, const std::string &pad) +{ + CStorageContainer::toString(ostream, pad); +} + +IStorageObject *CDllDirectory::createChunkById(uint16 id, bool container) +{ + if (container) + { + switch (id) + { + case 0x2038: // DllEntry + return new CDllEntry(); + } + } + else + { + switch (id) + { + case 0x21C0: // FileVersion + return new CStorageValue(); + } + } + return CStorageContainer::createChunkById(id, container); +} + +void CDllDirectory::serialized(TStorageObjectContainer::iterator soit, bool container) +{ + CStorageContainer::serialized(soit, container); +} + +CDllEntry::CDllEntry() +{ + +} + +CDllEntry::~CDllEntry() +{ + +} + +std::string CDllEntry::getClassName() +{ + return "DllEntry"; +} + +void CDllEntry::toString(std::ostream &ostream, const std::string &pad) +{ + CStorageContainer::toString(ostream, pad); +} + +IStorageObject *CDllEntry::createChunkById(uint16 id, bool container) +{ + if (!container) + { + switch (id) + { + case 0x2039: // DllDescription + case 0x2037: // DllFilename + return new CStorageValue(); + } + } + return CStorageContainer::createChunkById(id, container); +} + +void CDllEntry::serialized(TStorageObjectContainer::iterator soit, bool container) +{ + CStorageContainer::serialized(soit, container); +} + +} /* namespace MAX */ +} /* namespace PIPELINE */ + +/* end of file */ diff --git a/code/nel/tools/pipeline/max/dll_directory.h b/code/nel/tools/pipeline/max/dll_directory.h new file mode 100644 index 000000000..12d7db959 --- /dev/null +++ b/code/nel/tools/pipeline/max/dll_directory.h @@ -0,0 +1,92 @@ +/** + * \file dll_directory.h + * \brief CDllDirectory + * \date 2012-08-18 09:01GMT + * \author Jan Boon (Kaetemi) + * CDllDirectory + */ + +/* + * 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_DLL_DIRECTORY_H +#define PIPELINE_DLL_DIRECTORY_H +#include + +// STL includes + +// NeL includes + +// Project includes +#include "storage_object.h" +#include "storage_value.h" + +namespace PIPELINE { +namespace MAX { + +/** + * \brief CDllDirectory + * \date 2012-08-18 09:01GMT + * \author Jan Boon (Kaetemi) + * CDllDirectory + */ +class CDllDirectory : public CStorageContainer +{ +public: + CDllDirectory(); + virtual ~CDllDirectory(); + + // 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 CDllDirectory */ + +/** + * \brief CDllEntry + * \date 2012-08-18 09:01GMT + * \author Jan Boon (Kaetemi) + * CDllDirectory + */ +class CDllEntry : public CStorageContainer +{ +public: + CDllEntry(); + virtual ~CDllEntry(); + + // 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 CDllDirectory */ + +} /* namespace MAX */ +} /* namespace PIPELINE */ + +#endif /* #ifndef PIPELINE_DLL_DIRECTORY_H */ + +/* end of file */ diff --git a/code/nel/tools/pipeline/max/storage_value.cpp b/code/nel/tools/pipeline/max/storage_value.cpp index de3e7c3ec..3f192466d 100644 --- a/code/nel/tools/pipeline/max/storage_value.cpp +++ b/code/nel/tools/pipeline/max/storage_value.cpp @@ -39,9 +39,51 @@ using namespace std; // using namespace NLMISC; namespace PIPELINE { +namespace MAX { -void dummy_storage_value_cpp() { } +template <> +void CStorageValue::serial(NLMISC::IStream &stream) +{ + stream.serialBuffer(static_cast(static_cast(&Value[0])), Value.size()); +} +template <> +void CStorageValue::serial(NLMISC::IStream &stream) +{ + stream.serialBuffer(static_cast(static_cast(&Value[0])), Value.size() * 2); +} + +template <> +void CStorageValue::toString(std::ostream &ostream, const std::string &pad) +{ + ostream << "(" << getClassName() << ") { " << Value.toUtf8() << " } "; +} + +template <> +void CStorageValue::setSize(sint32 size) +{ + Value.resize(size); +} + +template <> +void CStorageValue::setSize(sint32 size) +{ + Value.resize(size / 2); +} + +template <> +bool CStorageValue::getSize(sint32 &size) const +{ + return Value.size(); +} + +template <> +bool CStorageValue::getSize(sint32 &size) const +{ + return Value.size() * 2; +} + +} /* namespace MAX */ } /* namespace PIPELINE */ /* end of file */ diff --git a/code/nel/tools/pipeline/max/storage_value.h b/code/nel/tools/pipeline/max/storage_value.h index 9661033c3..f0eab9688 100644 --- a/code/nel/tools/pipeline/max/storage_value.h +++ b/code/nel/tools/pipeline/max/storage_value.h @@ -61,7 +61,7 @@ public: // should be protected but that doesn't compile, nice c++! }; template -std::string getClassName() +std::string CStorageValue::getClassName() { return "CStorageValue"; } @@ -73,16 +73,10 @@ void CStorageValue::serial(NLMISC::IStream &stream) } template <> -void CStorageValue::serial(NLMISC::IStream &stream) -{ - stream.serialBuffer(static_cast(static_cast(&Value[0])), Value.size()); -} +void CStorageValue::serial(NLMISC::IStream &stream); template <> -void CStorageValue::serial(NLMISC::IStream &stream) -{ - stream.serialBuffer(static_cast(static_cast(&Value[0])), Value.size() * 2); -} +void CStorageValue::serial(NLMISC::IStream &stream); template void CStorageValue::toString(std::ostream &ostream, const std::string &pad) @@ -90,6 +84,9 @@ void CStorageValue::toString(std::ostream &ostream, const std::string &pad) ostream << "(" << getClassName() << ") { " << Value << " } "; } +template <> +void CStorageValue::toString(std::ostream &ostream, const std::string &pad); + template void CStorageValue::setSize(sint32 size) { @@ -99,16 +96,10 @@ void CStorageValue::setSize(sint32 size) } template <> -void CStorageValue::setSize(sint32 size) -{ - Value.resize(size); -} +void CStorageValue::setSize(sint32 size); template <> -void CStorageValue::setSize(sint32 size) -{ - Value.resize(size / 2); -} +void CStorageValue::setSize(sint32 size); template bool CStorageValue::getSize(sint32 &size) const @@ -118,16 +109,10 @@ bool CStorageValue::getSize(sint32 &size) const } template <> -bool CStorageValue::getSize(sint32 &size) const -{ - return Value.size(); -} +bool CStorageValue::getSize(sint32 &size) const; template <> -bool CStorageValue::getSize(sint32 &size) const -{ - return Value.size() * 2; -} +bool CStorageValue::getSize(sint32 &size) const; } /* namespace MAX */ } /* namespace PIPELINE */ diff --git a/code/nel/tools/pipeline/max_dump/main.cpp b/code/nel/tools/pipeline/max_dump/main.cpp index 5afb062c5..0f1421ba6 100644 --- a/code/nel/tools/pipeline/max_dump/main.cpp +++ b/code/nel/tools/pipeline/max_dump/main.cpp @@ -18,6 +18,7 @@ #include "../max/storage_stream.h" #include "../max/storage_object.h" +#include "../max/dll_directory.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"; @@ -34,6 +35,9 @@ inline uint8 cleanChar(uint8 c) namespace PIPELINE { namespace MAX { + + + /* struct CClass_ID : public NLMISC::IStreamable { @@ -307,7 +311,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::CStorageContainer ctr; + PIPELINE::MAX::CDllDirectory ctr; ctr.serial(instream); ctr.toString(std::cout); std::cout << "\n";