mirror of https://github.com/AxioDL/metaforce.git
Various fixes
Add MLVL blend support (needs some minor refactoring) Add MP2 MAPA Support
This commit is contained in:
parent
855337e8ca
commit
6f0c7851ea
|
@ -219,12 +219,12 @@ ResExtractor<PAKBridge> 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 {};
|
||||
}
|
||||
|
|
|
@ -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<PAKBridge>& pakRouter,
|
||||
const DNAMP1::PAK::Entry& entry,
|
||||
bool force,
|
||||
std::function<void(const HECL::SystemChar*)> fileChanged)
|
||||
{
|
||||
MAPA mapa;
|
||||
mapa.read(rs);
|
||||
HECL::BlenderConnection& conn = HECL::BlenderConnection::SharedConnection();
|
||||
return DNAMAPA::ReadMAPAToBlender(conn, mapa, outPath, pakRouter, entry, force);
|
||||
}
|
||||
};
|
||||
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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<atUint32> layerNameOffsetCount;
|
||||
Vector<atUint32, DNA_COUNT(layerNameOffsetCount)> layerNameOffsets;
|
||||
|
||||
static bool Extract(PAKEntryReadStream& rs, const HECL::ProjectPath& outPath)
|
||||
|
||||
static bool Extract(const SpecBase& dataSpec,
|
||||
PAKEntryReadStream& rs,
|
||||
const HECL::ProjectPath& outPath,
|
||||
PAKRouter<PAKBridge>& pakRouter,
|
||||
const DNAMP1::PAK::Entry& entry,
|
||||
bool force,
|
||||
std::function<void(const HECL::SystemChar*)> 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);
|
||||
}
|
||||
};
|
||||
|
||||
|
|
|
@ -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<areaLayers.layerCount ; ++l)
|
||||
areaDeps.layers.reserve(layerFlags.layerCount);
|
||||
for (unsigned l=1 ; l<layerFlags.layerCount ; ++l)
|
||||
{
|
||||
areaDeps.layers.emplace_back();
|
||||
Level::Area::Layer& layer = areaDeps.layers.back();
|
||||
layer.name = LayerName(mlvl.layerNames[layerIdx++]);
|
||||
layer.active = areaLayers.flags >> 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> 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 {};
|
||||
}
|
||||
|
|
|
@ -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<atUint32> layerNameOffsetCount;
|
||||
Vector<atUint32, DNA_COUNT(layerNameOffsetCount)> layerNameOffsets;
|
||||
|
||||
static bool Extract(PAKEntryReadStream& rs, const HECL::ProjectPath& outPath)
|
||||
|
||||
static bool Extract(const SpecBase& dataSpec,
|
||||
PAKEntryReadStream& rs,
|
||||
const HECL::ProjectPath& outPath,
|
||||
PAKRouter<PAKBridge>& pakRouter,
|
||||
const PAK::Entry& entry,
|
||||
bool force,
|
||||
std::function<void(const HECL::SystemChar*)> 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);
|
||||
}
|
||||
};
|
||||
|
||||
|
|
Loading…
Reference in New Issue