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

Humungous refactor

This commit is contained in:
Jack Andersen
2016-03-04 13:04:53 -10:00
parent 552ec1db4a
commit 783fb4c4fe
330 changed files with 2943 additions and 3077 deletions

View File

@@ -14,7 +14,7 @@ struct STRG : ISTRG
{
DECL_YAML
Delete expl;
void _read(Athena::io::IStreamReader& reader);
void _read(athena::io::IStreamReader& reader);
std::vector<std::pair<FourCC, std::vector<std::wstring>>> langs;
std::unordered_map<FourCC, std::vector<std::wstring>*> langMap;
std::map<std::string, int32_t> names;
@@ -42,7 +42,7 @@ struct STRG : ISTRG
{
auto search = langMap.find(lang);
if (search != langMap.end())
return HECL::WideToUTF8(search->second->at(idx));
return hecl::WideToUTF8(search->second->at(idx));
return std::string();
}
inline std::wstring getUTF16(const FourCC& lang, size_t idx) const
@@ -52,35 +52,35 @@ struct STRG : ISTRG
return search->second->at(idx);
return std::wstring();
}
inline HECL::SystemString getSystemString(const FourCC& lang, size_t idx) const
inline hecl::SystemString getSystemString(const FourCC& lang, size_t idx) const
{
auto search = langMap.find(lang);
if (search != langMap.end())
#if HECL_UCS2
return search->second->at(idx);
#else
return HECL::WideToUTF8(search->second->at(idx));
return hecl::WideToUTF8(search->second->at(idx));
#endif
return HECL::SystemString();
return hecl::SystemString();
}
static bool Extract(PAKEntryReadStream& rs, const HECL::ProjectPath& outPath)
static bool Extract(PAKEntryReadStream& rs, const hecl::ProjectPath& outPath)
{
STRG strg;
strg.read(rs);
FILE* fp = HECL::Fopen(outPath.getAbsolutePath().c_str(), _S("wb"));
FILE* fp = hecl::Fopen(outPath.getAbsolutePath().c_str(), _S("wb"));
strg.toYAMLFile(fp);
fclose(fp);
return true;
}
static bool Cook(const HECL::ProjectPath& inPath, const HECL::ProjectPath& outPath)
static bool Cook(const hecl::ProjectPath& inPath, const hecl::ProjectPath& outPath)
{
STRG strg;
FILE* fp = HECL::Fopen(inPath.getAbsolutePath().c_str(), _S("rb"));
FILE* fp = hecl::Fopen(inPath.getAbsolutePath().c_str(), _S("rb"));
strg.fromYAMLFile(fp);
fclose(fp);
Athena::io::FileWriter ws(outPath.getAbsolutePath());
athena::io::FileWriter ws(outPath.getAbsolutePath());
strg.write(ws);
return true;
}