mirror of
https://github.com/AxioDL/metaforce.git
synced 2025-12-09 17:47:43 +00:00
Fully working PAK/MLVL/STRG reads
This commit is contained in:
@@ -1,4 +1,5 @@
|
||||
#include <utility>
|
||||
#include <set>
|
||||
|
||||
#define NOD_ATHENA 1
|
||||
#include "SpecBase.hpp"
|
||||
@@ -93,27 +94,40 @@ struct SpecMP3 : SpecBase
|
||||
rep.childOpts.emplace_back();
|
||||
ExtractReport& childRep = rep.childOpts.back();
|
||||
childRep.name = item.first;
|
||||
if (!item.first.compare("Worlds.pak"))
|
||||
continue;
|
||||
else if (!item.first.compare("Metroid6.pak"))
|
||||
{
|
||||
childRep.desc = _S("Phaaze");
|
||||
continue;
|
||||
}
|
||||
|
||||
std::set<HECL::SystemString> worldNames;
|
||||
DNAMP3::PAK& pak = item.second->pak;
|
||||
for (DNAMP3::PAK::Entry& entry : pak.m_entries)
|
||||
{
|
||||
if (entry.type == MLVL)
|
||||
{
|
||||
NOD::AthenaPartReadStream rs(item.second->node.beginReadStream(entry.offset));
|
||||
PAKEntryReadStream rs = entry.beginReadStream(item.second->node);
|
||||
DNAMP3::MLVL mlvl;
|
||||
mlvl.read(rs);
|
||||
const DNAMP3::PAK::Entry* nameEnt = pak.lookupEntry(mlvl.worldNameId);
|
||||
if (nameEnt)
|
||||
{
|
||||
PAKEntryReadStream rs = nameEnt->beginReadStream(item.second->node);
|
||||
DNAMP3::STRG mlvlName;
|
||||
NOD::AthenaPartReadStream rs(item.second->node.beginReadStream(nameEnt->offset));
|
||||
mlvlName.read(rs);
|
||||
if (childRep.desc.size())
|
||||
childRep.desc += _S(", ");
|
||||
childRep.desc += mlvlName.getSystemString(ENGL, 0);
|
||||
worldNames.emplace(mlvlName.getSystemString(ENGL, 0));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
for (const std::string& name : worldNames)
|
||||
{
|
||||
if (childRep.desc.size())
|
||||
childRep.desc += _S(", ");
|
||||
childRep.desc += name;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user