2015-07-17 21:33:38 -07:00
|
|
|
#include <stdio.h>
|
|
|
|
|
2015-07-16 17:01:05 -07:00
|
|
|
#define NOD_ATHENA 1
|
2015-07-15 18:57:34 -07:00
|
|
|
#include "DNAMP1.hpp"
|
2015-07-16 17:01:05 -07:00
|
|
|
#include "STRG.hpp"
|
|
|
|
#include "MLVL.hpp"
|
2015-07-18 23:19:46 -07:00
|
|
|
#include "../DNACommon/TXTR.hpp"
|
2015-07-27 19:24:36 -07:00
|
|
|
#include "CMDL.hpp"
|
2015-07-15 18:57:34 -07:00
|
|
|
|
|
|
|
namespace Retro
|
|
|
|
{
|
|
|
|
namespace DNAMP1
|
|
|
|
{
|
|
|
|
LogVisor::LogModule Log("Retro::DNAMP1");
|
2015-07-16 17:01:05 -07:00
|
|
|
|
|
|
|
PAKBridge::PAKBridge(HECL::Database::Project& project, const NOD::DiscBase::IPartition::Node& node)
|
2015-07-17 21:33:38 -07:00
|
|
|
: m_project(project), m_node(node), m_pak(false)
|
2015-07-16 17:01:05 -07:00
|
|
|
{
|
|
|
|
NOD::AthenaPartReadStream rs(node.beginReadStream());
|
|
|
|
m_pak.read(rs);
|
|
|
|
}
|
|
|
|
|
2015-07-18 23:19:46 -07:00
|
|
|
HECL::SystemString PAKBridge::getLevelString() const
|
2015-07-16 17:01:05 -07:00
|
|
|
{
|
2015-07-18 23:19:46 -07:00
|
|
|
HECL::SystemString retval;
|
2015-07-16 17:01:05 -07: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);
|
|
|
|
if (retval.size())
|
|
|
|
retval += _S(", ");
|
2015-07-18 23:19:46 -07:00
|
|
|
retval += mlvlName.getSystemString(ENGL, 0);
|
2015-07-16 17:01:05 -07:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
return retval;
|
|
|
|
}
|
|
|
|
|
|
|
|
ResExtractor PAKBridge::LookupExtractor(const PAK::Entry& entry)
|
|
|
|
{
|
2015-07-18 23:19:46 -07:00
|
|
|
switch (entry.type.toUint32())
|
|
|
|
{
|
|
|
|
case SBIG('STRG'):
|
2015-07-31 17:38:35 -07:00
|
|
|
return {STRG::Extract, ".yaml"};
|
2015-07-18 23:19:46 -07:00
|
|
|
case SBIG('TXTR'):
|
|
|
|
return {TXTR::Extract, ".png"};
|
2015-07-27 19:24:36 -07:00
|
|
|
case SBIG('CMDL'):
|
2015-07-29 13:45:47 -07:00
|
|
|
return {CMDL::Extract, ".blend", 1};
|
2015-08-01 21:25:38 -07:00
|
|
|
case SBIG('MLVL'):
|
|
|
|
return {MLVL::Extract, ".yaml"};
|
2015-07-18 23:19:46 -07:00
|
|
|
}
|
2015-07-16 17:01:05 -07:00
|
|
|
return {};
|
|
|
|
}
|
|
|
|
|
2015-07-15 18:57:34 -07:00
|
|
|
}
|
|
|
|
}
|