#include "STRG.hpp" #include "DNAMP1.hpp" namespace Retro { namespace DNAMP1 { void STRG::_read(Athena::io::IStreamReader& reader) { atUint32 langCount = reader.readUint32(); atUint32 strCount = reader.readUint32(); std::vector readLangs; readLangs.reserve(langCount); for (atUint32 l=0 ; l strs; reader.seek(strCount * 4 + 4); for (atUint32 s=0 ; s>& lang : langs) { lang.first.write(writer); writer.writeUint32(offset); offset += strCount * 4 + 4; atUint32 langStrCount = lang.second.size(); for (atUint32 s=0 ; s>& lang : langs) { atUint32 langStrCount = lang.second.size(); atUint32 tableSz = strCount * 4; for (atUint32 s=0 ; s> wconv; /* Validate pass */ for (AngelScript::asUINT i=0 ; i& strsin = ASTYPE_STRGLanguage.vectorCast(in.GetAddressOfGlobalVar(i)); std::vector strs; for (const std::string* str : strsin) strs.emplace_back(wconv.from_bytes(*str)); langs.emplace(std::make_pair(FourCC(name), strs)); } } return true; } void STRG::writeAngelScript(std::ofstream& out) const { std::wbuffer_convert> wconv(out.rdbuf()); std::wostream wout(&wconv); for (const std::pair>& lang : langs) { out << "STRG::Language " << lang.first.toString() << "({"; bool comma = false; for (const std::wstring& str : lang.second) { out << (comma?", \"":"\""); wout << str; out << "\""; comma = true; } out << "});\n"; } } } }