mirror of
https://github.com/AxioDL/metaforce.git
synced 2025-12-09 01:07:43 +00:00
Humungous refactor
This commit is contained in:
@@ -6,7 +6,7 @@ namespace DataSpec
|
||||
namespace DNAMP2
|
||||
{
|
||||
|
||||
void STRG::_read(Athena::io::IStreamReader& reader)
|
||||
void STRG::_read(athena::io::IStreamReader& reader)
|
||||
{
|
||||
atUint32 langCount = reader.readUint32Big();
|
||||
atUint32 strCount = reader.readUint32Big();
|
||||
@@ -32,8 +32,8 @@ void STRG::_read(Athena::io::IStreamReader& reader)
|
||||
}* nameIndex = (NameIdxEntry*)nameTableBuf.get();
|
||||
for (atUint32 n=0 ; n<nameCount ; ++n)
|
||||
{
|
||||
const char* name = (char*)(nameTableBuf.get() + HECL::SBig(nameIndex[n].nameOff));
|
||||
names[name] = HECL::SBig(nameIndex[n].strIdx);
|
||||
const char* name = (char*)(nameTableBuf.get() + hecl::SBig(nameIndex[n].nameOff));
|
||||
names[name] = hecl::SBig(nameIndex[n].strIdx);
|
||||
}
|
||||
|
||||
langs.clear();
|
||||
@@ -53,20 +53,20 @@ void STRG::_read(Athena::io::IStreamReader& reader)
|
||||
langMap.emplace(item.first, &item.second);
|
||||
}
|
||||
|
||||
void STRG::read(Athena::io::IStreamReader& reader)
|
||||
void STRG::read(athena::io::IStreamReader& reader)
|
||||
{
|
||||
atUint32 magic = reader.readUint32Big();
|
||||
if (magic != 0x87654321)
|
||||
Log.report(LogVisor::Error, "invalid STRG magic");
|
||||
Log.report(logvisor::Error, "invalid STRG magic");
|
||||
|
||||
atUint32 version = reader.readUint32Big();
|
||||
if (version != 1)
|
||||
Log.report(LogVisor::Error, "invalid STRG version");
|
||||
Log.report(logvisor::Error, "invalid STRG version");
|
||||
|
||||
_read(reader);
|
||||
}
|
||||
|
||||
void STRG::write(Athena::io::IStreamWriter& writer) const
|
||||
void STRG::write(athena::io::IStreamWriter& writer) const
|
||||
{
|
||||
writer.writeUint32Big(0x87654321);
|
||||
writer.writeUint32Big(1);
|
||||
@@ -166,9 +166,9 @@ size_t STRG::binarySize(size_t __isz) const
|
||||
return __isz;
|
||||
}
|
||||
|
||||
void STRG::read(Athena::io::YAMLDocReader& reader)
|
||||
void STRG::read(athena::io::YAMLDocReader& reader)
|
||||
{
|
||||
const Athena::io::YAMLNode* root = reader.getRootNode();
|
||||
const athena::io::YAMLNode* root = reader.getRootNode();
|
||||
|
||||
/* Validate Pass */
|
||||
if (root->m_type == YAML_MAPPING_NODE)
|
||||
@@ -179,19 +179,19 @@ void STRG::read(Athena::io::YAMLDocReader& reader)
|
||||
continue;
|
||||
if (lang.first.size() != 4)
|
||||
{
|
||||
Log.report(LogVisor::Warning, "STRG language string '%s' must be exactly 4 characters; skipping", lang.first.c_str());
|
||||
Log.report(logvisor::Warning, "STRG language string '%s' must be exactly 4 characters; skipping", lang.first.c_str());
|
||||
return;
|
||||
}
|
||||
if (lang.second->m_type != YAML_SEQUENCE_NODE)
|
||||
{
|
||||
Log.report(LogVisor::Warning, "STRG language string '%s' must contain a sequence; skipping", lang.first.c_str());
|
||||
Log.report(logvisor::Warning, "STRG language string '%s' must contain a sequence; skipping", lang.first.c_str());
|
||||
return;
|
||||
}
|
||||
for (const auto& str : lang.second->m_seqChildren)
|
||||
{
|
||||
if (str->m_type != YAML_SCALAR_NODE)
|
||||
{
|
||||
Log.report(LogVisor::Warning, "STRG language '%s' must contain all scalars; skipping", lang.first.c_str());
|
||||
Log.report(logvisor::Warning, "STRG language '%s' must contain all scalars; skipping", lang.first.c_str());
|
||||
return;
|
||||
}
|
||||
}
|
||||
@@ -199,7 +199,7 @@ void STRG::read(Athena::io::YAMLDocReader& reader)
|
||||
}
|
||||
else
|
||||
{
|
||||
Log.report(LogVisor::Warning, "STRG must have a mapping root node; skipping");
|
||||
Log.report(logvisor::Warning, "STRG must have a mapping root node; skipping");
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -209,15 +209,15 @@ void STRG::read(Athena::io::YAMLDocReader& reader)
|
||||
{
|
||||
std::vector<std::wstring> strs;
|
||||
for (const auto& str : lang.second->m_seqChildren)
|
||||
strs.emplace_back(HECL::UTF8ToWide(str->m_scalarString));
|
||||
strs.emplace_back(hecl::UTF8ToWide(str->m_scalarString));
|
||||
langs.emplace_back(FourCC(lang.first.c_str()), strs);
|
||||
}
|
||||
|
||||
names.clear();
|
||||
const Athena::io::YAMLNode* namesNode = root->findMapChild("names");
|
||||
const athena::io::YAMLNode* namesNode = root->findMapChild("names");
|
||||
if (namesNode)
|
||||
for (const auto& item : namesNode->m_mapChildren)
|
||||
names[item.first] = Athena::io::NodeToVal<atInt32>(item.second.get());
|
||||
names[item.first] = athena::io::NodeToVal<atInt32>(item.second.get());
|
||||
|
||||
langMap.clear();
|
||||
langMap.reserve(langs.size());
|
||||
@@ -225,7 +225,7 @@ void STRG::read(Athena::io::YAMLDocReader& reader)
|
||||
langMap.emplace(item.first, &item.second);
|
||||
}
|
||||
|
||||
void STRG::write(Athena::io::YAMLDocWriter& writer) const
|
||||
void STRG::write(athena::io::YAMLDocWriter& writer) const
|
||||
{
|
||||
for (const auto& lang : langs)
|
||||
{
|
||||
@@ -249,7 +249,7 @@ void STRG::write(Athena::io::YAMLDocWriter& writer) const
|
||||
|
||||
const char* STRG::DNAType()
|
||||
{
|
||||
return "Retro::DNAMP2::STRG";
|
||||
return "urde::DNAMP2::STRG";
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user