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

MP1 YAML STRG integration

This commit is contained in:
Jack Andersen
2015-07-31 14:38:35 -10:00
parent 5075cb6dc4
commit df2adc10da
5 changed files with 100 additions and 27 deletions

View File

@@ -10,9 +10,10 @@ namespace Retro
namespace DNAMP1
{
struct STRG : ISTRG, BigDNA
struct STRG : ISTRG, BigYAML
{
DECL_EXPLICIT_DNA
DECL_EXPLICIT_YAML
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;
@@ -63,18 +64,18 @@ struct STRG : ISTRG, BigDNA
{
STRG strg;
strg.read(rs);
std::ofstream strgOut(outPath.getAbsolutePath());
strg.writeAngelScript(strgOut);
FILE* fp = HECL::Fopen(outPath.getAbsolutePath().c_str(), _S("w"));
strg.toYAMLFile(fp);
fclose(fp);
return true;
}
static bool Cook(const HECL::ProjectPath& inPath, const HECL::ProjectPath& outPath)
{
STRG strg;
HECL::Database::ASUniqueModule mod = HECL::Database::ASUniqueModule::CreateFromPath(inPath);
if (!mod)
return false;
strg.readAngelScript(mod);
FILE* fp = HECL::Fopen(inPath.getAbsolutePath().c_str(), _S("r"));
strg.fromYAMLFile(fp);
fclose(fp);
Athena::io::FileWriter ws(outPath.getAbsolutePath());
strg.write(ws);
return true;