2
0
mirror of https://github.com/AxioDL/metaforce.git synced 2025-12-09 23:07:43 +00:00

Added binarySize method to DNA implementations

This commit is contained in:
Jack Andersen
2015-10-17 18:08:45 -10:00
parent 6bd5c42a9e
commit 9529fad78f
21 changed files with 668 additions and 15 deletions

View File

@@ -137,6 +137,35 @@ void STRG::write(Athena::io::IStreamWriter& writer) const
}
}
size_t STRG::binarySize(size_t __isz) const
{
__isz += 16;
__isz += langs.size() * 12;
__isz += 8;
__isz += names.size() * 8;
for (const std::pair<std::string, int32_t>& name : names)
__isz += name.first.size() + 1;
size_t strCount = STRG::count();
for (const std::pair<DNAFourCC, std::vector<std::wstring>>& lang : langs)
{
atUint32 langStrCount = lang.second.size();
__isz += strCount * 4;
for (atUint32 s=0 ; s<strCount ; ++s)
{
if (s < langStrCount)
__isz += (lang.second[s].size() + 1) * 2;
else
__isz += 1;
}
}
return __isz;
}
void STRG::fromYAML(Athena::io::YAMLDocReader& reader)
{
const Athena::io::YAMLNode* root = reader.getRootNode();