2019-08-23 23:24:04 +00:00
|
|
|
#include "DataSpec/DNACommon/CRSC.hpp"
|
|
|
|
#include "DataSpec/DNACommon/PAK.hpp"
|
|
|
|
|
2018-12-08 05:30:43 +00:00
|
|
|
namespace DataSpec::DNAParticle {
|
2016-03-28 08:54:02 +00:00
|
|
|
|
2020-03-29 06:56:54 +00:00
|
|
|
template struct PPImpl<_CRSM<UniqueID32>>;
|
|
|
|
template struct PPImpl<_CRSM<UniqueID64>>;
|
2016-03-28 08:54:02 +00:00
|
|
|
|
2020-03-29 06:56:54 +00:00
|
|
|
AT_SUBSPECIALIZE_DNA_YAML(PPImpl<_CRSM<UniqueID32>>)
|
|
|
|
AT_SUBSPECIALIZE_DNA_YAML(PPImpl<_CRSM<UniqueID64>>)
|
2016-03-28 08:54:02 +00:00
|
|
|
|
2018-02-22 07:24:51 +00:00
|
|
|
template <>
|
2020-03-29 06:56:54 +00:00
|
|
|
std::string_view PPImpl<_CRSM<UniqueID32>>::DNAType() {
|
2021-04-10 08:42:06 +00:00
|
|
|
return "CRSM<UniqueID32>"sv;
|
2018-12-08 05:30:43 +00:00
|
|
|
}
|
2018-02-22 07:24:51 +00:00
|
|
|
|
|
|
|
template <>
|
2020-03-29 06:56:54 +00:00
|
|
|
std::string_view PPImpl<_CRSM<UniqueID64>>::DNAType() {
|
2021-04-10 08:42:06 +00:00
|
|
|
return "CRSM<UniqueID64>"sv;
|
2016-03-28 08:54:02 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
template <class IDType>
|
2018-12-08 05:30:43 +00:00
|
|
|
bool ExtractCRSM(PAKEntryReadStream& rs, const hecl::ProjectPath& outPath) {
|
|
|
|
athena::io::FileWriter writer(outPath.getAbsolutePath());
|
|
|
|
if (writer.isOpen()) {
|
|
|
|
CRSM<IDType> crsm;
|
|
|
|
crsm.read(rs);
|
|
|
|
athena::io::ToYAMLStream(crsm, writer);
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
return false;
|
2016-03-28 08:54:02 +00:00
|
|
|
}
|
|
|
|
template bool ExtractCRSM<UniqueID32>(PAKEntryReadStream& rs, const hecl::ProjectPath& outPath);
|
|
|
|
template bool ExtractCRSM<UniqueID64>(PAKEntryReadStream& rs, const hecl::ProjectPath& outPath);
|
|
|
|
|
|
|
|
template <class IDType>
|
2018-12-08 05:30:43 +00:00
|
|
|
bool WriteCRSM(const CRSM<IDType>& crsm, const hecl::ProjectPath& outPath) {
|
|
|
|
athena::io::FileWriter w(outPath.getAbsolutePath(), true, false);
|
|
|
|
if (w.hasError())
|
|
|
|
return false;
|
|
|
|
crsm.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-03-28 08:54:02 +00:00
|
|
|
}
|
|
|
|
template bool WriteCRSM<UniqueID32>(const CRSM<UniqueID32>& crsm, const hecl::ProjectPath& outPath);
|
|
|
|
template bool WriteCRSM<UniqueID64>(const CRSM<UniqueID64>& crsm, const hecl::ProjectPath& outPath);
|
2018-12-08 05:30:43 +00:00
|
|
|
} // namespace DataSpec::DNAParticle
|