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

ANCS cook fixes; initial Tweak DNA pipeline

This commit is contained in:
Jack Andersen
2016-08-31 09:58:21 -10:00
parent 405a344fdf
commit 4a7d3e8b40
14 changed files with 96 additions and 20 deletions

View File

@@ -0,0 +1,39 @@
#ifndef __DNACOMMON_TWEAKWRITER_HPP__
#define __DNACOMMON_TWEAKWRITER_HPP__
#include "../PAK.hpp"
namespace DataSpec
{
template <class T>
bool WriteTweak(const T& tweak, const hecl::ProjectPath& outPath)
{
athena::io::FileWriter w(outPath.getAbsolutePath(), true, false);
if (w.hasError())
return false;
tweak.write(w);
int64_t rem = w.position() % 32;
if (rem)
for (int64_t i=0 ; i<32-rem ; ++i)
w.writeBytes((atInt8*)"\xff", 1);
return true;
}
template <class T>
bool ExtractTweak(PAKEntryReadStream& rs, const hecl::ProjectPath& outPath)
{
athena::io::FileWriter writer(outPath.getAbsolutePath());
if (writer.isOpen())
{
T tweak;
tweak.read(rs);
tweak.toYAMLStream(writer);
return true;
}
return false;
}
}
#endif // __DNACOMMON_TWEAKWRITER_HPP__