2018-10-07 03:42:33 +00:00
|
|
|
#pragma once
|
2016-08-31 19:58:21 +00:00
|
|
|
|
|
|
|
#include "../PAK.hpp"
|
|
|
|
|
2018-12-08 05:30:43 +00:00
|
|
|
namespace DataSpec {
|
2016-08-31 19:58:21 +00:00
|
|
|
|
|
|
|
template <class T>
|
2018-12-08 05:30:43 +00:00
|
|
|
bool WriteTweak(const T& tweak, const hecl::ProjectPath& outPath) {
|
|
|
|
athena::io::FileWriter w(outPath.getAbsolutePath(), true, false);
|
|
|
|
if (w.hasError())
|
2016-08-31 19:58:21 +00:00
|
|
|
return false;
|
2018-12-08 05:30:43 +00:00
|
|
|
tweak.write(w);
|
|
|
|
int64_t rem = w.position() % 32;
|
|
|
|
if (rem)
|
|
|
|
for (int64_t i = 0; i < 32 - rem; ++i)
|
|
|
|
w.writeUByte(0xff);
|
|
|
|
return true;
|
2016-08-31 19:58:21 +00:00
|
|
|
}
|
|
|
|
|
2018-12-08 05:30:43 +00:00
|
|
|
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);
|
|
|
|
athena::io::ToYAMLStream(tweak, writer);
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
return false;
|
2016-08-31 19:58:21 +00:00
|
|
|
}
|
|
|
|
|
2018-12-08 05:30:43 +00:00
|
|
|
} // namespace DataSpec
|