metaforce/DataSpec/DNAMP3/DNAMP3.cpp

72 lines
1.7 KiB
C++
Raw Normal View History

2015-07-17 00:01:05 +00:00
#include <set>
#define NOD_ATHENA 1
2015-07-16 01:57:34 +00:00
#include "DNAMP3.hpp"
2015-07-17 00:01:05 +00:00
#include "STRG.hpp"
#include "MLVL.hpp"
#include "CMDL.hpp"
2015-07-19 06:19:46 +00:00
#include "../DNACommon/TXTR.hpp"
2015-07-16 01:57:34 +00:00
namespace Retro
{
namespace DNAMP3
{
2015-07-17 00:01:05 +00:00
2015-07-16 01:57:34 +00:00
LogVisor::LogModule Log("Retro::DNAMP3");
2015-07-17 00:01:05 +00:00
PAKBridge::PAKBridge(HECL::Database::Project& project, const NOD::DiscBase::IPartition::Node& node)
: m_project(project), m_node(node)
{
NOD::AthenaPartReadStream rs(node.beginReadStream());
m_pak.read(rs);
/* Append Level String */
2015-07-19 06:19:46 +00:00
std::set<HECL::SystemString, CaseInsensitiveCompare> uniq;
2015-07-17 00:01:05 +00:00
for (const PAK::Entry& entry : m_pak.m_entries)
{
if (entry.type == Retro::MLVL)
{
PAKEntryReadStream rs = entry.beginReadStream(m_node);
MLVL mlvl;
mlvl.read(rs);
const PAK::Entry* nameEnt = m_pak.lookupEntry(mlvl.worldNameId);
if (nameEnt)
{
PAKEntryReadStream rs = nameEnt->beginReadStream(m_node);
STRG mlvlName;
mlvlName.read(rs);
2015-07-19 06:19:46 +00:00
uniq.insert(mlvlName.getSystemString(ENGL, 0));
2015-07-17 00:01:05 +00:00
}
}
}
bool comma = false;
2015-07-19 06:19:46 +00:00
for (const HECL::SystemString& str : uniq)
2015-07-17 00:01:05 +00:00
{
if (comma)
m_levelString += _S(", ");
comma = true;
m_levelString += str;
2015-07-17 00:01:05 +00:00
}
}
void PAKBridge::build()
{
}
ResExtractor<PAKBridge> PAKBridge::LookupExtractor(const PAK::Entry& entry)
2015-07-17 00:01:05 +00:00
{
2015-07-19 06:19:46 +00:00
switch (entry.type.toUint32())
{
case SBIG('STRG'):
2015-08-09 03:55:11 +00:00
return {STRG::Extract, nullptr, ".yaml"};
2015-07-19 06:19:46 +00:00
case SBIG('TXTR'):
return {TXTR::Extract, nullptr, ".png"};
case SBIG('CMDL'):
return {nullptr, CMDL::Extract, ".blend", 1};
2015-07-19 06:19:46 +00:00
}
2015-07-17 00:01:05 +00:00
return {};
}
2015-07-16 01:57:34 +00:00
}
}