diff --git a/DataSpec/DNAMP2/DNAMP2.cpp b/DataSpec/DNAMP2/DNAMP2.cpp index eb05ca440..636d7e6ec 100644 --- a/DataSpec/DNAMP2/DNAMP2.cpp +++ b/DataSpec/DNAMP2/DNAMP2.cpp @@ -219,12 +219,12 @@ ResExtractor PAKBridge::LookupExtractor(const DNAMP1::PAK::Entry& ent return {nullptr, CMDL::Extract, {_S(".blend")}, 1}; case SBIG('ANCS'): return {nullptr, ANCS::Extract, {_S(".yaml"), _S(".blend")}, 2}; - case SBIG('MREA'): - return {nullptr, MREA::Extract, {_S(".blend")}, 3}; case SBIG('MLVL'): - return {MLVL::Extract, nullptr, {_S(".yaml")}}; -// case SBIG('MAPA'): -// return {nullptr, MAPA::Extract, {_S(".blend")}, 4}; + return {nullptr, MLVL::Extract, {_S(".blend")}, 3}; + case SBIG('MREA'): + return {nullptr, MREA::Extract, {_S(".blend")}, 4}; + case SBIG('MAPA'): + return {nullptr, MAPA::Extract, {_S(".blend")}, 4}; } return {}; } diff --git a/DataSpec/DNAMP2/MAPA.hpp b/DataSpec/DNAMP2/MAPA.hpp index 8b1ba643f..a76e7ee1a 100644 --- a/DataSpec/DNAMP2/MAPA.hpp +++ b/DataSpec/DNAMP2/MAPA.hpp @@ -1,14 +1,30 @@ #ifndef __DNAMP2_MAPA_HPP__ #define __DNAMP2_MAPA_HPP__ +#include "../DNACommon/PAK.hpp" #include "../DNAMP1/MAPA.hpp" +#include "DNAMP2.hpp" namespace Retro { namespace DNAMP2 { struct MAPA : DNAMP1::MAPA -{}; +{ + static bool Extract(const SpecBase& dataSpec, + PAKEntryReadStream& rs, + const HECL::ProjectPath& outPath, + PAKRouter& pakRouter, + const DNAMP1::PAK::Entry& entry, + bool force, + std::function fileChanged) + { + MAPA mapa; + mapa.read(rs); + HECL::BlenderConnection& conn = HECL::BlenderConnection::SharedConnection(); + return DNAMAPA::ReadMAPAToBlender(conn, mapa, outPath, pakRouter, entry, force); + } +}; } } diff --git a/DataSpec/DNAMP2/MLVL.hpp b/DataSpec/DNAMP2/MLVL.hpp index 4bf3f4c03..30a80cf85 100644 --- a/DataSpec/DNAMP2/MLVL.hpp +++ b/DataSpec/DNAMP2/MLVL.hpp @@ -2,6 +2,8 @@ #define __DNAMP2_MLVL_HPP__ #include "../DNACommon/PAK.hpp" +#include "../DNACommon/MLVL.hpp" +#include "DNAMP2.hpp" namespace Retro { @@ -91,14 +93,23 @@ struct MLVL : BigYAML Value layerNameOffsetCount; Vector layerNameOffsets; - static bool Extract(PAKEntryReadStream& rs, const HECL::ProjectPath& outPath) + + static bool Extract(const SpecBase& dataSpec, + PAKEntryReadStream& rs, + const HECL::ProjectPath& outPath, + PAKRouter& pakRouter, + const DNAMP1::PAK::Entry& entry, + bool force, + std::function fileChanged) { MLVL mlvl; mlvl.read(rs); FILE* fp = HECL::Fopen(outPath.getAbsolutePath().c_str(), _S("wb")); mlvl.toYAMLFile(fp); fclose(fp); - return true; + HECL::BlenderConnection& conn = HECL::BlenderConnection::SharedConnection(); + return DNAMLVL::ReadMLVLToBlender(conn, mlvl, outPath, pakRouter, + entry, force, fileChanged); } }; diff --git a/DataSpec/DNAMP3/DNAMP3.cpp b/DataSpec/DNAMP3/DNAMP3.cpp index 58ff06097..dcbf5d09d 100644 --- a/DataSpec/DNAMP3/DNAMP3.cpp +++ b/DataSpec/DNAMP3/DNAMP3.cpp @@ -154,24 +154,24 @@ void PAKBridge::build() HECL::SNPrintf(num, 16, _S("%02u "), ai); areaDeps.name = num + areaDeps.name; - const MLVL::LayerFlags& areaLayers = *layerFlagsIt++; - if (areaLayers.layerCount) + const MLVL::LayerFlags& layerFlags = *layerFlagsIt++; + if (layerFlags.layerCount) { - areaDeps.layers.reserve(areaLayers.layerCount); - for (unsigned l=0 ; l> l & 0x1; + layer.active = layerFlags.flags >> (l-1) & 0x1; /* Trim possible trailing whitespace */ -#if HECL_UCS2 + #if HECL_UCS2 while (layer.name.size() && iswspace(layer.name.back())) layer.name.pop_back(); -#else + #else while (layer.name.size() && isspace(layer.name.back())) layer.name.pop_back(); -#endif + #endif HECL::SNPrintf(num, 16, layer.active ? _S("%02ua ") : _S("%02u "), l-1); layer.name = num + layer.name; } @@ -229,10 +229,10 @@ ResExtractor PAKBridge::LookupExtractor(const PAK::Entry& entry) return {nullptr, CMDL::Extract, {_S(".blend")}, 1}; case SBIG('CHAR'): return {nullptr, CHAR::Extract, {_S(".yaml"), _S(".blend")}, 2}; - case SBIG('MREA'): - return {nullptr, MREA::Extract, {_S(".blend")}, 3}; case SBIG('MLVL'): - return {MLVL::Extract, nullptr, {_S(".yaml")}}; + return {nullptr, MLVL::Extract, {_S(".blend")}, 3}; + case SBIG('MREA'): + return {nullptr, MREA::Extract, {_S(".blend")}, 4}; } return {}; } diff --git a/DataSpec/DNAMP3/MLVL.hpp b/DataSpec/DNAMP3/MLVL.hpp index f1762c0a0..4110c3c54 100644 --- a/DataSpec/DNAMP3/MLVL.hpp +++ b/DataSpec/DNAMP3/MLVL.hpp @@ -2,6 +2,8 @@ #define __DNAMP3_MLVL_HPP__ #include "../DNACommon/PAK.hpp" +#include "../DNACommon/MLVL.hpp" +#include "DNAMP3.hpp" namespace Retro { @@ -75,14 +77,23 @@ struct MLVL : BigYAML Value layerNameOffsetCount; Vector layerNameOffsets; - static bool Extract(PAKEntryReadStream& rs, const HECL::ProjectPath& outPath) + + static bool Extract(const SpecBase& dataSpec, + PAKEntryReadStream& rs, + const HECL::ProjectPath& outPath, + PAKRouter& pakRouter, + const PAK::Entry& entry, + bool force, + std::function fileChanged) { MLVL mlvl; mlvl.read(rs); FILE* fp = HECL::Fopen(outPath.getAbsolutePath().c_str(), _S("wb")); mlvl.toYAMLFile(fp); fclose(fp); - return true; + HECL::BlenderConnection& conn = HECL::BlenderConnection::SharedConnection(); + return DNAMLVL::ReadMLVLToBlender(conn, mlvl, outPath, pakRouter, + entry, force, fileChanged); } };