mirror of
https://github.com/AxioDL/metaforce.git
synced 2025-12-09 05:47:42 +00:00
All cooked resources extracting; decompression bug-fixes
This commit is contained in:
@@ -44,8 +44,13 @@ void STRG::_read(Athena::io::IStreamReader& reader)
|
||||
reader.seek(strCount * 4);
|
||||
for (atUint32 s=0 ; s<strCount ; ++s)
|
||||
strs.emplace_back(reader.readWString());
|
||||
langs.emplace(std::make_pair(lang, strs));
|
||||
langs.emplace_back(lang, strs);
|
||||
}
|
||||
|
||||
langMap.clear();
|
||||
langMap.reserve(langCount);
|
||||
for (std::pair<FourCC, std::vector<std::wstring>>& item : langs)
|
||||
langMap.emplace(item.first, &item.second);
|
||||
}
|
||||
|
||||
void STRG::read(Athena::io::IStreamReader& reader)
|
||||
@@ -140,6 +145,35 @@ bool STRG::readAngelScript(const AngelScript::asIScriptModule& in)
|
||||
|
||||
void STRG::writeAngelScript(std::ofstream& out) const
|
||||
{
|
||||
std::wstring_convert<std::codecvt_utf8<wchar_t>> wconv;
|
||||
for (const std::pair<FourCC, std::vector<std::wstring>>& lang : langs)
|
||||
{
|
||||
out << "STRG::Language " << lang.first.toString() << "({";
|
||||
bool comma = false;
|
||||
unsigned idx = 0;
|
||||
for (const std::wstring& str : lang.second)
|
||||
{
|
||||
if (comma)
|
||||
out << ",";
|
||||
out << "\n/* " << idx++ << " */ \"";
|
||||
out << wconv.to_bytes(str);
|
||||
out << "\"";
|
||||
comma = true;
|
||||
}
|
||||
out << "\n});\n";
|
||||
}
|
||||
|
||||
out << "STRG::Names NAMES({";
|
||||
bool comma = false;
|
||||
for (const std::pair<std::string, int32_t>& name : names)
|
||||
{
|
||||
if (comma)
|
||||
out << ",";
|
||||
out << "\n ";
|
||||
comma = true;
|
||||
out << "{\"" << name.first << "\", " << name.second << "}";
|
||||
}
|
||||
out << "\n});\n";
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user