Massive template-based DNA refactor

This commit is contained in:
Jack Andersen 2018-02-21 21:24:51 -10:00
parent b405f33ded
commit e4ff23c279
265 changed files with 3993 additions and 5773 deletions

View File

@ -1273,7 +1273,7 @@ bool WriteCMDL(const hecl::ProjectPath& outPath, const hecl::ProjectPath& inPath
mesh.colorLayerCount, mesh.uvLayerCount, mesh.colorLayerCount, mesh.uvLayerCount,
false, false, groupIdx); false, false, groupIdx);
endOff = targetMSet.materials.back().binarySize(endOff); targetMSet.materials.back().binarySize(endOff);
targetMSet.head.addMaterialEndOff(endOff); targetMSet.head.addMaterialEndOff(endOff);
} }
@ -1299,7 +1299,8 @@ bool WriteCMDL(const hecl::ProjectPath& outPath, const hecl::ProjectPath& inPath
for (const hecl::ProjectPath& path : texPaths) for (const hecl::ProjectPath& path : texPaths)
targetMSet.head.addTexture(path); targetMSet.head.addTexture(path);
size_t secSz = targetMSet.binarySize(0); size_t secSz = 0;
targetMSet.binarySize(secSz);
size_t secSz32 = ROUND_UP_32(secSz); size_t secSz32 = ROUND_UP_32(secSz);
head.secSizes.push_back(secSz32); head.secSizes.push_back(secSz32);
paddingSizes.push_back(secSz32 - secSz); paddingSizes.push_back(secSz32 - secSz);
@ -1522,14 +1523,15 @@ bool WriteHMDLCMDL(const hecl::ProjectPath& outPath, const hecl::ProjectPath& in
{ {
std::string diagName = hecl::Format("%s:%s", inPath.getLastComponentUTF8().data(), mat.name.c_str()); std::string diagName = hecl::Format("%s:%s", inPath.getLastComponentUTF8().data(), mat.name.c_str());
targetMSet.materials.emplace_back(FE, diagName, mat, mat.iprops, texPaths); targetMSet.materials.emplace_back(FE, diagName, mat, mat.iprops, texPaths);
endOff = targetMSet.materials.back().binarySize(endOff); targetMSet.materials.back().binarySize(endOff);
targetMSet.head.addMaterialEndOff(endOff); targetMSet.head.addMaterialEndOff(endOff);
} }
for (const hecl::ProjectPath& path : texPaths) for (const hecl::ProjectPath& path : texPaths)
targetMSet.head.addTexture(path); targetMSet.head.addTexture(path);
size_t secSz = targetMSet.binarySize(0); size_t secSz = 0;
targetMSet.binarySize(secSz);
size_t secSz32 = ROUND_UP_32(secSz); size_t secSz32 = ROUND_UP_32(secSz);
head.secSizes.push_back(secSz32); head.secSizes.push_back(secSz32);
paddingSizes.push_back(secSz32 - secSz); paddingSizes.push_back(secSz32 - secSz);
@ -1539,7 +1541,8 @@ bool WriteHMDLCMDL(const hecl::ProjectPath& outPath, const hecl::ProjectPath& in
hecl::blender::HMDLBuffers bufs = mesh.getHMDLBuffers(false, poolSkinIndex); hecl::blender::HMDLBuffers bufs = mesh.getHMDLBuffers(false, poolSkinIndex);
/* Metadata */ /* Metadata */
size_t secSz = bufs.m_meta.binarySize(0); size_t secSz = 0;
bufs.m_meta.binarySize(secSz);
size_t secSz32 = ROUND_UP_32(secSz); size_t secSz32 = ROUND_UP_32(secSz);
if (secSz32 == 0) if (secSz32 == 0)
secSz32 = 32; secSz32 = 32;
@ -1720,7 +1723,7 @@ bool WriteHMDLMREASecs(std::vector<std::vector<uint8_t>>& secsOut, const hecl::P
std::string diagName = hecl::Format("%s:%s", inPath.getLastComponentUTF8().data(), mat.name.c_str()); std::string diagName = hecl::Format("%s:%s", inPath.getLastComponentUTF8().data(), mat.name.c_str());
matSet.materials.emplace_back(FE, diagName, mat, mat.iprops, texPaths); matSet.materials.emplace_back(FE, diagName, mat, mat.iprops, texPaths);
endOff = matSet.materials.back().binarySize(endOff); matSet.materials.back().binarySize(endOff);
matSet.head.addMaterialEndOff(endOff); matSet.head.addMaterialEndOff(endOff);
} }
@ -1731,7 +1734,9 @@ bool WriteHMDLMREASecs(std::vector<std::vector<uint8_t>>& secsOut, const hecl::P
for (const hecl::ProjectPath& path : texPaths) for (const hecl::ProjectPath& path : texPaths)
matSet.head.addTexture(path); matSet.head.addTexture(path);
secsOut.emplace_back(matSet.binarySize(0), 0); size_t secSz = 0;
matSet.binarySize(secSz);
secsOut.emplace_back(secSz, 0);
athena::io::MemoryWriter w(secsOut.back().data(), secsOut.back().size()); athena::io::MemoryWriter w(secsOut.back().data(), secsOut.back().size());
matSet.write(w); matSet.write(w);
} }
@ -1757,7 +1762,9 @@ bool WriteHMDLMREASecs(std::vector<std::vector<uint8_t>>& secsOut, const hecl::P
meshHeader.aabb[0] = aabb.min; meshHeader.aabb[0] = aabb.min;
meshHeader.aabb[1] = aabb.max; meshHeader.aabb[1] = aabb.max;
secsOut.emplace_back(meshHeader.binarySize(0), 0); size_t secSz = 0;
meshHeader.binarySize(secSz);
secsOut.emplace_back(secSz, 0);
athena::io::MemoryWriter w(secsOut.back().data(), secsOut.back().size()); athena::io::MemoryWriter w(secsOut.back().data(), secsOut.back().size());
meshHeader.write(w); meshHeader.write(w);
} }
@ -1776,7 +1783,9 @@ bool WriteHMDLMREASecs(std::vector<std::vector<uint8_t>>& secsOut, const hecl::P
/* Metadata */ /* Metadata */
{ {
secsOut.emplace_back(bufs.m_meta.binarySize(0), 0); size_t secSz = 0;
bufs.m_meta.binarySize(secSz);
secsOut.emplace_back(secSz, 0);
athena::io::MemoryWriter w(secsOut.back().data(), secsOut.back().size()); athena::io::MemoryWriter w(secsOut.back().data(), secsOut.back().size());
bufs.m_meta.write(w); bufs.m_meta.write(w);
} }
@ -1823,7 +1832,9 @@ bool WriteHMDLMREASecs(std::vector<std::vector<uint8_t>>& secsOut, const hecl::P
header.aabb[0] = aabb.min; header.aabb[0] = aabb.min;
header.aabb[1] = aabb.max; header.aabb[1] = aabb.max;
secsOut.emplace_back(header.binarySize(0), 0); size_t secSz = 0;
header.binarySize(secSz);
secsOut.emplace_back(secSz, 0);
athena::io::MemoryWriter w(secsOut.back().data(), secsOut.back().size()); athena::io::MemoryWriter w(secsOut.back().data(), secsOut.back().size());
header.write(w); header.write(w);
} }
@ -1836,7 +1847,8 @@ template bool WriteHMDLMREASecs<DNAMP1::HMDLMaterialSet, DNACMDL::SurfaceHeader_
(std::vector<std::vector<uint8_t>>& secsOut, const hecl::ProjectPath& inPath, (std::vector<std::vector<uint8_t>>& secsOut, const hecl::ProjectPath& inPath,
const std::vector<Mesh>& meshes, zeus::CAABox& fullAABB, std::vector<zeus::CAABox>& meshAABBs); const std::vector<Mesh>& meshes, zeus::CAABox& fullAABB, std::vector<zeus::CAABox>& meshAABBs);
void SurfaceHeader_1::read(athena::io::IStreamReader& reader) template <>
void SurfaceHeader_1::Enumerate<BigDNA::Read>(typename Read::StreamT& reader)
{ {
/* centroid */ /* centroid */
centroid = reader.readVec3fBig(); centroid = reader.readVec3fBig();
@ -1867,7 +1879,8 @@ void SurfaceHeader_1::read(athena::io::IStreamReader& reader)
reader.seekAlign32(); reader.seekAlign32();
} }
void SurfaceHeader_1::write(athena::io::IStreamWriter& writer) const template <>
void SurfaceHeader_1::Enumerate<BigDNA::Write>(typename Write::StreamT& writer)
{ {
/* centroid */ /* centroid */
writer.writeVec3fBig(centroid); writer.writeVec3fBig(centroid);
@ -1895,15 +1908,16 @@ void SurfaceHeader_1::write(athena::io::IStreamWriter& writer) const
writer.seekAlign32(); writer.seekAlign32();
} }
size_t SurfaceHeader_1::binarySize(size_t __isz) const template <>
void SurfaceHeader_1::Enumerate<BigDNA::BinarySize>(typename BinarySize::StreamT& s)
{ {
__isz += (aabbSz ? 24 : 0); s += (aabbSz ? 24 : 0);
__isz += 44; s += 44;
__isz = (__isz + 31) & ~31; s = (s + 31) & ~31;
return __isz;
} }
void SurfaceHeader_2::read(athena::io::IStreamReader& reader) template <>
void SurfaceHeader_2::Enumerate<BigDNA::Read>(typename Read::StreamT& reader)
{ {
/* centroid */ /* centroid */
centroid = reader.readVec3fBig(); centroid = reader.readVec3fBig();
@ -1938,7 +1952,8 @@ void SurfaceHeader_2::read(athena::io::IStreamReader& reader)
reader.seekAlign32(); reader.seekAlign32();
} }
void SurfaceHeader_2::write(athena::io::IStreamWriter& writer) const template <>
void SurfaceHeader_2::Enumerate<BigDNA::Write>(typename Write::StreamT& writer)
{ {
/* centroid */ /* centroid */
writer.writeVec3fBig(centroid); writer.writeVec3fBig(centroid);
@ -1970,15 +1985,16 @@ void SurfaceHeader_2::write(athena::io::IStreamWriter& writer) const
writer.seekAlign32(); writer.seekAlign32();
} }
size_t SurfaceHeader_2::binarySize(size_t __isz) const template <>
void SurfaceHeader_2::Enumerate<BigDNA::BinarySize>(typename BinarySize::StreamT& s)
{ {
__isz += (aabbSz ? 24 : 0); s += (aabbSz ? 24 : 0);
__isz += 48; s += 48;
__isz = (__isz + 31) & ~31; s = (s + 31) & ~31;
return __isz;
} }
void SurfaceHeader_3::read(athena::io::IStreamReader& reader) template <>
void SurfaceHeader_3::Enumerate<BigDNA::Read>(typename Read::StreamT& reader)
{ {
/* centroid */ /* centroid */
centroid = reader.readVec3fBig(); centroid = reader.readVec3fBig();
@ -2015,7 +2031,8 @@ void SurfaceHeader_3::read(athena::io::IStreamReader& reader)
reader.seekAlign32(); reader.seekAlign32();
} }
void SurfaceHeader_3::write(athena::io::IStreamWriter& writer) const template <>
void SurfaceHeader_3::Enumerate<BigDNA::Write>(typename Write::StreamT& writer)
{ {
/* centroid */ /* centroid */
writer.writeVec3fBig(centroid); writer.writeVec3fBig(centroid);
@ -2049,12 +2066,12 @@ void SurfaceHeader_3::write(athena::io::IStreamWriter& writer) const
writer.seekAlign32(); writer.seekAlign32();
} }
size_t SurfaceHeader_3::binarySize(size_t __isz) const template <>
void SurfaceHeader_3::Enumerate<BigDNA::BinarySize>(typename BinarySize::StreamT& s)
{ {
__isz += (aabbSz ? 24 : 0); s += (aabbSz ? 24 : 0);
__isz += 49; s += 49;
__isz = (__isz + 31) & ~31; s = (s + 31) & ~31;
return __isz;
} }
} }

View File

@ -17,12 +17,12 @@ using Material = hecl::blender::Material;
struct Header : BigDNA struct Header : BigDNA
{ {
DECL_DNA AT_DECL_DNA
Value<atUint32> magic; Value<atUint32> magic;
Value<atUint32> version; Value<atUint32> version;
struct Flags : BigDNA struct Flags : BigDNA
{ {
DECL_DNA AT_DECL_DNA
Value<atUint32> flags = 0; Value<atUint32> flags = 0;
bool shortNormals() const {return (flags & 0x2) != 0;} bool shortNormals() const {return (flags & 0x2) != 0;}
void setShortNormals(bool val) {flags &= ~0x2; flags |= val << 1;} void setShortNormals(bool val) {flags &= ~0x2; flags |= val << 1;}
@ -39,7 +39,7 @@ struct Header : BigDNA
struct SurfaceHeader_1 : BigDNA struct SurfaceHeader_1 : BigDNA
{ {
DECL_EXPLICIT_DNA AT_DECL_EXPLICIT_DNA
Value<atVec3f> centroid; Value<atVec3f> centroid;
Value<atUint32> matIdx = 0; Value<atUint32> matIdx = 0;
Value<atUint16> qDiv = 0x8000; Value<atUint16> qDiv = 0x8000;
@ -57,7 +57,7 @@ struct SurfaceHeader_1 : BigDNA
struct SurfaceHeader_2 : BigDNA struct SurfaceHeader_2 : BigDNA
{ {
DECL_EXPLICIT_DNA AT_DECL_EXPLICIT_DNA
Value<atVec3f> centroid; Value<atVec3f> centroid;
Value<atUint32> matIdx = 0; Value<atUint32> matIdx = 0;
Value<atUint16> qDiv = 0x8000; Value<atUint16> qDiv = 0x8000;
@ -77,7 +77,7 @@ struct SurfaceHeader_2 : BigDNA
struct SurfaceHeader_3 : BigDNA struct SurfaceHeader_3 : BigDNA
{ {
DECL_EXPLICIT_DNA AT_DECL_EXPLICIT_DNA
Value<atVec3f> centroid; Value<atVec3f> centroid;
Value<atUint32> matIdx = 0; Value<atUint32> matIdx = 0;
Value<atUint16> qDiv = 0x8000; Value<atUint16> qDiv = 0x8000;

View File

@ -1,5 +1,8 @@
make_dnalist(liblist DNACommon make_dnalist(liblist DNACommon
CMDL CMDL
FONT
DGRP
FSM2
MAPA MAPA
MAPU MAPU
EGMC EGMC
@ -27,8 +30,8 @@ set(DNACOMMON_SOURCES
WPSC.hpp WPSC.cpp WPSC.hpp WPSC.cpp
DPSC.hpp DPSC.cpp DPSC.hpp DPSC.cpp
ParticleCommon.cpp ParticleCommon.cpp
FONT.hpp FONT.cpp FONT.cpp
DGRP.hpp DGRP.cpp DGRP.cpp
ATBL.hpp ATBL.cpp ATBL.hpp ATBL.cpp
DeafBabe.hpp DeafBabe.cpp DeafBabe.hpp DeafBabe.cpp
BabeDead.hpp BabeDead.cpp BabeDead.hpp BabeDead.cpp

View File

@ -67,9 +67,14 @@ static const std::vector<FourCC> DecalTypes =
SBIG('CHDL'),SBIG('ENDL') SBIG('CHDL'),SBIG('ENDL')
}; };
template <>
const char* CRSM<UniqueID32>::DNAType() { return "CRSM<UniqueID32>"; }
template <>
const char* CRSM<UniqueID64>::DNAType() { return "CRSM<UniqueID64>"; }
template <class IDType> template <class IDType>
void CRSM<IDType>::read(athena::io::YAMLDocReader& r) void CRSM<IDType>::_read(athena::io::YAMLDocReader& r)
{ {
for (const auto& elem : r.getCurNode()->m_mapChildren) for (const auto& elem : r.getCurNode()->m_mapChildren)
{ {
@ -117,7 +122,7 @@ void CRSM<IDType>::read(athena::io::YAMLDocReader& r)
} }
template <class IDType> template <class IDType>
void CRSM<IDType>::write(athena::io::YAMLDocWriter& w) const void CRSM<IDType>::_write(athena::io::YAMLDocWriter& w) const
{ {
for (const auto& pair : x0_generators) for (const auto& pair : x0_generators)
if (pair.second) if (pair.second)
@ -140,13 +145,16 @@ void CRSM<IDType>::write(athena::io::YAMLDocWriter& w) const
} }
template <class IDType> template <class IDType>
size_t CRSM<IDType>::binarySize(size_t __isz) const void CRSM<IDType>::_binarySize(size_t& __isz) const
{ {
__isz += 4; __isz += 4;
for (const auto& pair : x0_generators) for (const auto& pair : x0_generators)
{ {
if (pair.second) if (pair.second)
__isz = pair.second.binarySize(__isz + 4); {
__isz += 4;
pair.second.binarySize(__isz);
}
} }
for (const auto& pair : x10_sfx) for (const auto& pair : x10_sfx)
{ {
@ -157,18 +165,20 @@ size_t CRSM<IDType>::binarySize(size_t __isz) const
for (const auto& pair : x20_decals) for (const auto& pair : x20_decals)
{ {
if (pair.second) if (pair.second)
__isz = pair.second.binarySize(__isz + 4); {
__isz += 4;
pair.second.binarySize(__isz);
}
} }
if (x30_RNGE != 50.f) if (x30_RNGE != 50.f)
__isz += 12; __isz += 12;
if (x34_FOFF != 0.2f) if (x34_FOFF != 0.2f)
__isz += 12; __isz += 12;
return __isz;
} }
template <class IDType> template <class IDType>
void CRSM<IDType>::read(athena::io::IStreamReader &r) void CRSM<IDType>::_read(athena::io::IStreamReader &r)
{ {
uint32_t clsId; uint32_t clsId;
r.readBytesToBuf(&clsId, 4); r.readBytesToBuf(&clsId, 4);
@ -230,7 +240,7 @@ void CRSM<IDType>::read(athena::io::IStreamReader &r)
} }
template <class IDType> template <class IDType>
void CRSM<IDType>::write(athena::io::IStreamWriter& w) const void CRSM<IDType>::_write(athena::io::IStreamWriter& w) const
{ {
w.writeBytes("CRSM", 4); w.writeBytes("CRSM", 4);
for (const auto& pair : x0_generators) for (const auto& pair : x0_generators)
@ -273,6 +283,9 @@ void CRSM<IDType>::write(athena::io::IStreamWriter& w) const
w.writeBytes("_END", 4); w.writeBytes("_END", 4);
} }
AT_SUBSPECIALIZE_DNA_YAML(CRSM<UniqueID32>)
AT_SUBSPECIALIZE_DNA_YAML(CRSM<UniqueID64>)
template <class IDType> template <class IDType>
void CRSM<IDType>::gatherDependencies(std::vector<hecl::ProjectPath>& pathsOut) const void CRSM<IDType>::gatherDependencies(std::vector<hecl::ProjectPath>& pathsOut) const
{ {
@ -302,7 +315,7 @@ bool ExtractCRSM(PAKEntryReadStream& rs, const hecl::ProjectPath& outPath)
{ {
CRSM<IDType> crsm; CRSM<IDType> crsm;
crsm.read(rs); crsm.read(rs);
crsm.toYAMLStream(writer); athena::io::ToYAMLStream(crsm, writer);
return true; return true;
} }
return false; return false;

View File

@ -9,23 +9,16 @@
namespace DataSpec::DNAParticle namespace DataSpec::DNAParticle
{ {
template <class IDType> template <class IDType>
struct CRSM : BigYAML struct CRSM : BigDNA
{ {
static const char* DNAType() { return "CRSM"; } AT_DECL_EXPLICIT_DNA_YAML
const char* DNATypeV() const { return DNAType(); } AT_SUBDECL_DNA
std::unordered_map<FourCC, ChildResourceFactory<IDType>> x0_generators; std::unordered_map<FourCC, ChildResourceFactory<IDType>> x0_generators;
std::unordered_map<FourCC, uint32_t> x10_sfx; std::unordered_map<FourCC, uint32_t> x10_sfx;
std::unordered_map<FourCC, ChildResourceFactory<IDType>> x20_decals; std::unordered_map<FourCC, ChildResourceFactory<IDType>> x20_decals;
float x30_RNGE; float x30_RNGE;
float x34_FOFF; float x34_FOFF;
void read(athena::io::YAMLDocReader& r);
void write(athena::io::YAMLDocWriter& w) const;
size_t binarySize(size_t __isz) const;
void read(athena::io::IStreamReader& r);
void write(athena::io::IStreamWriter& w) const;
CRSM(); CRSM();
void gatherDependencies(std::vector<hecl::ProjectPath>&) const; void gatherDependencies(std::vector<hecl::ProjectPath>&) const;

View File

@ -5,105 +5,6 @@
namespace DataSpec::DNADGRP namespace DataSpec::DNADGRP
{ {
template <class IDType>
void DGRP<IDType>::read(athena::io::IStreamReader& __dna_reader)
{
/* dependCount */
dependCount = __dna_reader.readUint32Big();
/* depends */
__dna_reader.enumerate(depends, dependCount);
}
template <class IDType>
void DGRP<IDType>::write(athena::io::IStreamWriter& __dna_writer) const
{
/* dependCount */
__dna_writer.writeUint32Big(dependCount);
/* depends */
__dna_writer.enumerate(depends);
}
template <class IDType>
void DGRP<IDType>::read(athena::io::YAMLDocReader& __dna_docin)
{
/* dependCount squelched */
/* depends */
dependCount = __dna_docin.enumerate("depends", depends);
}
template <class IDType>
void DGRP<IDType>::write(athena::io::YAMLDocWriter& __dna_docout) const
{
/* dependCount squelched */
/* depends */
__dna_docout.enumerate("depends", depends);
}
template <class IDType>
const char* DGRP<IDType>::DNAType()
{
return "urde::DGRP";
}
template <class IDType>
size_t DGRP<IDType>::binarySize(size_t __isz) const
{
__isz = __EnumerateSize(__isz, depends);
return __isz + 4;
}
template <class IDType>
void DGRP<IDType>::ObjectTag::read(athena::io::IStreamReader& __dna_reader)
{
/* type */
type.read(__dna_reader);
/* id */
id.read(__dna_reader);
}
template <class IDType>
void DGRP<IDType>::ObjectTag::write(athena::io::IStreamWriter& __dna_writer) const
{
/* type */
type.write(__dna_writer);
/* id */
id.write(__dna_writer);
}
template <class IDType>
void DGRP<IDType>::ObjectTag::read(athena::io::YAMLDocReader& __dna_docin)
{
/* type */
__dna_docin.enumerate("type", type);
/* id */
__dna_docin.enumerate("id", id);
}
template <class IDType>
void DGRP<IDType>::ObjectTag::write(athena::io::YAMLDocWriter& __dna_docout) const
{
/* type */
__dna_docout.enumerate("type", type);
/* id */
__dna_docout.enumerate("id", id);
}
template <class IDType>
const char* DGRP<IDType>::ObjectTag::DNAType()
{
return "urde::DGRP::ObjectTag";
}
template <class IDType>
size_t DGRP<IDType>::ObjectTag::binarySize(size_t __isz) const
{
__isz = type.binarySize(__isz);
__isz = id.binarySize(__isz);
return __isz;
}
template struct DGRP<UniqueID32>;
template struct DGRP<UniqueID64>;
template <class IDType> template <class IDType>
bool ExtractDGRP(PAKEntryReadStream& rs, const hecl::ProjectPath& outPath) bool ExtractDGRP(PAKEntryReadStream& rs, const hecl::ProjectPath& outPath)
@ -113,7 +14,7 @@ bool ExtractDGRP(PAKEntryReadStream& rs, const hecl::ProjectPath& outPath)
{ {
DGRP<IDType> dgrp; DGRP<IDType> dgrp;
dgrp.read(rs); dgrp.read(rs);
dgrp.toYAMLStream(writer); athena::io::ToYAMLStream(dgrp, writer);
return true; return true;
} }
return false; return false;
@ -136,4 +37,5 @@ bool WriteDGRP(const DGRP<IDType>& dgrp, const hecl::ProjectPath& outPath)
} }
template bool WriteDGRP<UniqueID32>(const DGRP<UniqueID32>& dgrp, const hecl::ProjectPath& outPath); template bool WriteDGRP<UniqueID32>(const DGRP<UniqueID32>& dgrp, const hecl::ProjectPath& outPath);
template bool WriteDGRP<UniqueID64>(const DGRP<UniqueID64>& dgrp, const hecl::ProjectPath& outPath); template bool WriteDGRP<UniqueID64>(const DGRP<UniqueID64>& dgrp, const hecl::ProjectPath& outPath);
} }

View File

@ -6,14 +6,15 @@
namespace DataSpec::DNADGRP namespace DataSpec::DNADGRP
{ {
template <class IDType> template <class IDType>
struct DGRP : BigYAML struct AT_SPECIALIZE_PARMS(DataSpec::UniqueID32, DataSpec::UniqueID64) DGRP : BigDNA
{ {
DECL_YAML AT_DECL_DNA_YAML
Value<atUint32> dependCount; Value<atUint32> dependCount;
struct ObjectTag : BigYAML struct ObjectTag : BigDNA
{ {
DECL_YAML AT_DECL_DNA_YAML
DNAFourCC type; DNAFourCC type;
IDType id; IDType id;
}; };
@ -21,10 +22,11 @@ struct DGRP : BigYAML
Vector<ObjectTag, DNA_COUNT(dependCount)> depends; Vector<ObjectTag, DNA_COUNT(dependCount)> depends;
}; };
template <class IDType> template <class IDType>
bool ExtractDGRP(PAKEntryReadStream& rs, const hecl::ProjectPath& outPath); bool ExtractDGRP(PAKEntryReadStream& rs, const hecl::ProjectPath& outPath);
template <class IDType> template <class IDType>
bool WriteDGRP(const DGRP<IDType>& dgrp, const hecl::ProjectPath& outPath); bool WriteDGRP(const DGRP<IDType>& dgrp, const hecl::ProjectPath& outPath);
} }
#endif // __COMMON_DGRP_HPP__ #endif // __COMMON_DGRP_HPP__

View File

@ -89,15 +89,19 @@ void UniqueIDBridge::setThreadProject(hecl::Database::Project& project)
} }
/** PAK 32-bit Unique ID */ /** PAK 32-bit Unique ID */
void UniqueID32::read(athena::io::IStreamReader& reader) template <>
void UniqueID32::Enumerate<BigDNA::Read>(typename Read::StreamT& reader)
{assign(reader.readUint32Big());} {assign(reader.readUint32Big());}
void UniqueID32::write(athena::io::IStreamWriter& writer) const template <>
void UniqueID32::Enumerate<BigDNA::Write>(typename Write::StreamT& writer)
{writer.writeUint32Big(m_id);} {writer.writeUint32Big(m_id);}
void UniqueID32::read(athena::io::YAMLDocReader& reader) template <>
void UniqueID32::Enumerate<BigDNA::ReadYaml>(typename ReadYaml::StreamT& reader)
{ {
*this = UniqueIDBridge::MakePathFromString<UniqueID32>(reader.readString(nullptr)); *this = UniqueIDBridge::MakePathFromString<UniqueID32>(reader.readString(nullptr));
} }
void UniqueID32::write(athena::io::YAMLDocWriter& writer) const template <>
void UniqueID32::Enumerate<BigDNA::WriteYaml>(typename WriteYaml::StreamT& writer)
{ {
if (!operator bool()) if (!operator bool())
return; return;
@ -108,8 +112,9 @@ void UniqueID32::write(athena::io::YAMLDocWriter& writer) const
(std::string(path.getRelativePathUTF8()) + '|' + path.getAuxInfoUTF8().data()) : (std::string(path.getRelativePathUTF8()) + '|' + path.getAuxInfoUTF8().data()) :
path.getRelativePathUTF8()); path.getRelativePathUTF8());
} }
size_t UniqueID32::binarySize(size_t __isz) const template <>
{return __isz + 4;} void UniqueID32::Enumerate<BigDNA::BinarySize>(typename BinarySize::StreamT& s)
{s += 4;}
std::string UniqueID32::toString() const std::string UniqueID32::toString() const
{ {
@ -137,24 +142,25 @@ AuxiliaryID32& AuxiliaryID32::operator=(const UniqueID32& id)
return *this; return *this;
} }
void AuxiliaryID32::read(athena::io::IStreamReader& reader) template <>
void AuxiliaryID32::Enumerate<BigDNA::Read>(typename Read::StreamT& reader)
{ {
assign(reader.readUint32Big()); assign(reader.readUint32Big());
m_baseId = *this; m_baseId = *this;
} }
template <>
void AuxiliaryID32::write(athena::io::IStreamWriter& writer) const void AuxiliaryID32::Enumerate<BigDNA::Write>(typename Write::StreamT& writer)
{ {
writer.writeUint32Big(m_id); writer.writeUint32Big(m_id);
} }
template <>
void AuxiliaryID32::read(athena::io::YAMLDocReader& reader) void AuxiliaryID32::Enumerate<BigDNA::ReadYaml>(typename ReadYaml::StreamT& reader)
{ {
hecl::ProjectPath readPath = UniqueIDBridge::MakePathFromString<UniqueID32>(reader.readString(nullptr)); hecl::ProjectPath readPath = UniqueIDBridge::MakePathFromString<UniqueID32>(reader.readString(nullptr));
*this = readPath.ensureAuxInfo(m_auxStr); *this = readPath.ensureAuxInfo(m_auxStr);
} }
template <>
void AuxiliaryID32::write(athena::io::YAMLDocWriter& writer) const void AuxiliaryID32::Enumerate<BigDNA::WriteYaml>(typename WriteYaml::StreamT& writer)
{ {
if (!operator bool()) if (!operator bool())
return; return;
@ -171,15 +177,19 @@ void AuxiliaryID32::write(athena::io::YAMLDocWriter& writer) const
/** PAK 64-bit Unique ID */ /** PAK 64-bit Unique ID */
void UniqueID64::read(athena::io::IStreamReader& reader) template <>
void UniqueID64::Enumerate<BigDNA::Read>(typename Read::StreamT& reader)
{assign(reader.readUint64Big());} {assign(reader.readUint64Big());}
void UniqueID64::write(athena::io::IStreamWriter& writer) const template <>
void UniqueID64::Enumerate<BigDNA::Write>(typename Write::StreamT& writer)
{writer.writeUint64Big(m_id);} {writer.writeUint64Big(m_id);}
void UniqueID64::read(athena::io::YAMLDocReader& reader) template <>
void UniqueID64::Enumerate<BigDNA::ReadYaml>(typename ReadYaml::StreamT& reader)
{ {
*this = UniqueIDBridge::MakePathFromString<UniqueID64>(reader.readString(nullptr)); *this = UniqueIDBridge::MakePathFromString<UniqueID64>(reader.readString(nullptr));
} }
void UniqueID64::write(athena::io::YAMLDocWriter& writer) const template <>
void UniqueID64::Enumerate<BigDNA::WriteYaml>(typename WriteYaml::StreamT& writer)
{ {
if (!operator bool()) if (!operator bool())
return; return;
@ -187,11 +197,12 @@ void UniqueID64::write(athena::io::YAMLDocWriter& writer) const
if (!path) if (!path)
return; return;
writer.writeString(nullptr, path.getAuxInfo().size() ? writer.writeString(nullptr, path.getAuxInfo().size() ?
(std::string(path.getRelativePathUTF8()) + '|' + path.getAuxInfoUTF8().data()) : (std::string(path.getRelativePathUTF8()) + '|' + path.getAuxInfoUTF8().data()) :
path.getRelativePathUTF8()); path.getRelativePathUTF8());
} }
size_t UniqueID64::binarySize(size_t __isz) const template <>
{return __isz + 8;} void UniqueID64::Enumerate<BigDNA::BinarySize>(typename BinarySize::StreamT& s)
{s += 8;}
std::string UniqueID64::toString() const std::string UniqueID64::toString() const
{ {
@ -201,21 +212,25 @@ std::string UniqueID64::toString() const
} }
/** PAK 128-bit Unique ID */ /** PAK 128-bit Unique ID */
void UniqueID128::read(athena::io::IStreamReader& reader) template <>
void UniqueID128::Enumerate<BigDNA::Read>(typename Read::StreamT& reader)
{ {
m_id[0] = reader.readUint64Big(); m_id[0] = reader.readUint64Big();
m_id[1] = reader.readUint64Big(); m_id[1] = reader.readUint64Big();
} }
void UniqueID128::write(athena::io::IStreamWriter& writer) const template <>
void UniqueID128::Enumerate<BigDNA::Write>(typename Write::StreamT& writer)
{ {
writer.writeUint64Big(m_id[0]); writer.writeUint64Big(m_id[0]);
writer.writeUint64Big(m_id[1]); writer.writeUint64Big(m_id[1]);
} }
void UniqueID128::read(athena::io::YAMLDocReader& reader) template <>
void UniqueID128::Enumerate<BigDNA::ReadYaml>(typename ReadYaml::StreamT& reader)
{ {
*this = UniqueIDBridge::MakePathFromString<UniqueID128>(reader.readString(nullptr)); *this = UniqueIDBridge::MakePathFromString<UniqueID128>(reader.readString(nullptr));
} }
void UniqueID128::write(athena::io::YAMLDocWriter& writer) const template <>
void UniqueID128::Enumerate<BigDNA::WriteYaml>(typename WriteYaml::StreamT& writer)
{ {
if (!operator bool()) if (!operator bool())
return; return;
@ -223,11 +238,12 @@ void UniqueID128::write(athena::io::YAMLDocWriter& writer) const
if (!path) if (!path)
return; return;
writer.writeString(nullptr, path.getAuxInfo().size() ? writer.writeString(nullptr, path.getAuxInfo().size() ?
(std::string(path.getRelativePathUTF8()) + '|' + path.getAuxInfoUTF8().data()) : (std::string(path.getRelativePathUTF8()) + '|' + path.getAuxInfoUTF8().data()) :
path.getRelativePathUTF8()); path.getRelativePathUTF8());
} }
size_t UniqueID128::binarySize(size_t __isz) const template <>
{return __isz + 16;} void UniqueID128::Enumerate<BigDNA::BinarySize>(typename BinarySize::StreamT& s)
{s += 16;}
std::string UniqueID128::toString() const std::string UniqueID128::toString() const
{ {

View File

@ -19,11 +19,12 @@ extern ThreadLocalPtr<class PAKRouterBase> g_PakRouter;
extern ThreadLocalPtr<hecl::blender::Token> g_ThreadBlenderToken; extern ThreadLocalPtr<hecl::blender::Token> g_ThreadBlenderToken;
/* This comes up a great deal */ /* This comes up a great deal */
typedef athena::io::DNA<athena::BigEndian> BigDNA; typedef athena::io::DNA<athena::Big> BigDNA;
typedef athena::io::DNAYaml<athena::BigEndian> BigYAML; typedef athena::io::DNAV<athena::Big> BigDNAV;
typedef athena::io::DNAVYaml<athena::Big> BigDNAVYaml;
/** FourCC with DNA read/write */ /** FourCC with DNA read/write */
class DNAFourCC final : public BigYAML, public hecl::FourCC class DNAFourCC final : public BigDNA, public hecl::FourCC
{ {
public: public:
DNAFourCC() : hecl::FourCC() {} DNAFourCC() : hecl::FourCC() {}
@ -33,55 +34,53 @@ public:
: hecl::FourCC(name) {} : hecl::FourCC(name) {}
DNAFourCC(uint32_t n) DNAFourCC(uint32_t n)
: hecl::FourCC(n) {} : hecl::FourCC(n) {}
AT_DECL_EXPLICIT_DNA_YAML
Delete expl;
void read(athena::io::IStreamReader& reader)
{reader.readUBytesToBuf(fcc, 4);}
void write(athena::io::IStreamWriter& writer) const
{writer.writeUBytes((atUint8*)fcc, 4);}
void read(athena::io::YAMLDocReader& reader)
{std::string rs = reader.readString(nullptr); strncpy(fcc, rs.c_str(), 4);}
void write(athena::io::YAMLDocWriter& writer) const
{writer.writeString(nullptr, std::string(fcc, 4));}
size_t binarySize(size_t __isz) const
{return __isz + 4;}
}; };
template <> inline void DNAFourCC::Enumerate<BigDNA::Read>(typename Read::StreamT& r)
{ r.readUBytesToBuf(fcc, 4); }
template <> inline void DNAFourCC::Enumerate<BigDNA::Write>(typename Write::StreamT& w)
{ w.writeUBytes((atUint8*)fcc, 4); }
template <> inline void DNAFourCC::Enumerate<BigDNA::ReadYaml>(typename ReadYaml::StreamT& r)
{ std::string rs = r.readString(nullptr); strncpy(fcc, rs.c_str(), 4); }
template <> inline void DNAFourCC::Enumerate<BigDNA::WriteYaml>(typename WriteYaml::StreamT& w)
{ w.writeString(nullptr, std::string(fcc, 4)); }
template <> inline void DNAFourCC::Enumerate<BigDNA::BinarySize>(typename BinarySize::StreamT& s)
{ s += 4; }
class DNAColor final : public BigYAML, public zeus::CColor class DNAColor final : public BigDNA, public zeus::CColor
{ {
public: public:
DNAColor() = default; DNAColor() = default;
DNAColor(const zeus::CColor& color) : zeus::CColor(color) {} DNAColor(const zeus::CColor& color) : zeus::CColor(color) {}
AT_DECL_EXPLICIT_DNA_YAML
Delete expl;
void read(athena::io::IStreamReader& reader)
{zeus::CColor::readRGBABig(reader);}
void write(athena::io::IStreamWriter& writer) const
{zeus::CColor::writeRGBABig(writer);}
void read(athena::io::YAMLDocReader& reader)
{
size_t count;
if (auto v = reader.enterSubVector(nullptr, count))
{
r = (count >= 1) ? reader.readFloat(nullptr) : 0.f;
g = (count >= 2) ? reader.readFloat(nullptr) : 0.f;
b = (count >= 3) ? reader.readFloat(nullptr) : 0.f;
a = (count >= 4) ? reader.readFloat(nullptr) : 0.f;
}
}
void write(athena::io::YAMLDocWriter& writer) const
{
if (auto v = writer.enterSubVector(nullptr))
{
writer.writeFloat(nullptr, r);
writer.writeFloat(nullptr, g);
writer.writeFloat(nullptr, b);
writer.writeFloat(nullptr, a);
}
}
size_t binarySize(size_t __isz) const
{return __isz + 16;}
}; };
template <> inline void DNAColor::Enumerate<BigDNA::Read>(typename Read::StreamT& _r)
{ zeus::CColor::readRGBABig(_r); }
template <> inline void DNAColor::Enumerate<BigDNA::Write>(typename Write::StreamT& _w)
{ zeus::CColor::writeRGBABig(_w); }
template <> inline void DNAColor::Enumerate<BigDNA::ReadYaml>(typename ReadYaml::StreamT& _r)
{
size_t count;
if (auto v = _r.enterSubVector(nullptr, count))
{
r = (count >= 1) ? _r.readFloat(nullptr) : 0.f;
g = (count >= 2) ? _r.readFloat(nullptr) : 0.f;
b = (count >= 3) ? _r.readFloat(nullptr) : 0.f;
a = (count >= 4) ? _r.readFloat(nullptr) : 0.f;
}
}
template <> inline void DNAColor::Enumerate<BigDNA::WriteYaml>(typename WriteYaml::StreamT& _w)
{
if (auto v = _w.enterSubVector(nullptr))
{
_w.writeFloat(nullptr, r);
_w.writeFloat(nullptr, g);
_w.writeFloat(nullptr, b);
_w.writeFloat(nullptr, a);
}
}
template <> inline void DNAColor::Enumerate<BigDNA::BinarySize>(typename BinarySize::StreamT& _s)
{ _s += 16; }
using FourCC = hecl::FourCC; using FourCC = hecl::FourCC;
class UniqueID32; class UniqueID32;
@ -136,19 +135,14 @@ public:
}; };
/** PAK 32-bit Unique ID */ /** PAK 32-bit Unique ID */
class UniqueID32 : public BigYAML class UniqueID32 : public BigDNA
{ {
protected: protected:
uint32_t m_id = 0xffffffff; uint32_t m_id = 0xffffffff;
public: public:
static UniqueID32 kInvalidId; static UniqueID32 kInvalidId;
Delete expl; AT_DECL_EXPLICIT_DNA_YAML
operator bool() const {return m_id != 0xffffffff && m_id != 0;} operator bool() const {return m_id != 0xffffffff && m_id != 0;}
void read(athena::io::IStreamReader& reader);
void write(athena::io::IStreamWriter& writer) const;
void read(athena::io::YAMLDocReader& reader);
void write(athena::io::YAMLDocWriter& writer) const;
size_t binarySize(size_t __isz) const;
void assign(uint32_t id) { m_id = id ? id : 0xffffffff; } void assign(uint32_t id) { m_id = id ? id : 0xffffffff; }
UniqueID32& operator=(const hecl::ProjectPath& path) UniqueID32& operator=(const hecl::ProjectPath& path)
@ -190,31 +184,24 @@ class AuxiliaryID32 : public UniqueID32
const hecl::SystemChar* m_addExtension; const hecl::SystemChar* m_addExtension;
UniqueID32 m_baseId; UniqueID32 m_baseId;
public: public:
AT_DECL_DNA
Delete __d2;
AuxiliaryID32(const hecl::SystemChar* auxStr, AuxiliaryID32(const hecl::SystemChar* auxStr,
const hecl::SystemChar* addExtension=nullptr) const hecl::SystemChar* addExtension=nullptr)
: m_auxStr(auxStr), m_addExtension(addExtension) {} : m_auxStr(auxStr), m_addExtension(addExtension) {}
AuxiliaryID32& operator=(const hecl::ProjectPath& path); AuxiliaryID32& operator=(const hecl::ProjectPath& path);
AuxiliaryID32& operator=(const UniqueID32& id); AuxiliaryID32& operator=(const UniqueID32& id);
void read(athena::io::IStreamReader& reader);
void write(athena::io::IStreamWriter& writer) const;
void read(athena::io::YAMLDocReader& reader);
void write(athena::io::YAMLDocWriter& writer) const;
const UniqueID32& getBaseId() const {return m_baseId;} const UniqueID32& getBaseId() const {return m_baseId;}
}; };
/** PAK 64-bit Unique ID */ /** PAK 64-bit Unique ID */
class UniqueID64 : public BigYAML class UniqueID64 : public BigDNA
{ {
uint64_t m_id = 0xffffffffffffffff; uint64_t m_id = 0xffffffffffffffff;
public: public:
Delete expl; AT_DECL_EXPLICIT_DNA_YAML
operator bool() const {return m_id != 0xffffffffffffffff && m_id != 0;} operator bool() const {return m_id != 0xffffffffffffffff && m_id != 0;}
void read(athena::io::IStreamReader& reader);
void write(athena::io::IStreamWriter& writer) const;
void read(athena::io::YAMLDocReader& reader);
void write(athena::io::YAMLDocWriter& writer) const;
size_t binarySize(size_t __isz) const;
void assign(uint64_t id) { m_id = id ? id : 0xffffffffffffffff; } void assign(uint64_t id) { m_id = id ? id : 0xffffffffffffffff; }
UniqueID64& operator=(const hecl::ProjectPath& path) UniqueID64& operator=(const hecl::ProjectPath& path)
@ -258,7 +245,7 @@ public:
}; };
/** PAK 128-bit Unique ID */ /** PAK 128-bit Unique ID */
class UniqueID128 : public BigYAML class UniqueID128 : public BigDNA
{ {
union union
{ {
@ -268,15 +255,10 @@ class UniqueID128 : public BigYAML
#endif #endif
}; };
public: public:
Delete expl; AT_DECL_EXPLICIT_DNA_YAML
UniqueID128() {m_id[0]=0xffffffffffffffff; m_id[1]=0xffffffffffffffff;} UniqueID128() {m_id[0]=0xffffffffffffffff; m_id[1]=0xffffffffffffffff;}
operator bool() const operator bool() const
{return m_id[0] != 0xffffffffffffffff && m_id[0] != 0 && m_id[1] != 0xffffffffffffffff && m_id[1] != 0;} {return m_id[0] != 0xffffffffffffffff && m_id[0] != 0 && m_id[1] != 0xffffffffffffffff && m_id[1] != 0;}
void read(athena::io::IStreamReader& reader);
void write(athena::io::IStreamWriter& writer) const;
void read(athena::io::YAMLDocReader& reader);
void write(athena::io::YAMLDocWriter& writer) const;
size_t binarySize(size_t __isz) const;
UniqueID128& operator=(const hecl::ProjectPath& path) UniqueID128& operator=(const hecl::ProjectPath& path)
{ {

View File

@ -2,8 +2,15 @@
namespace DataSpec::DNAParticle namespace DataSpec::DNAParticle
{ {
template <>
const char* DPSM<UniqueID32>::DNAType() { return "DPSM<UniqueID32>"; }
template <>
const char* DPSM<UniqueID64>::DNAType() { return "DPSM<UniqueID64>"; }
template <class IDType> template <class IDType>
void DPSM<IDType>::read(athena::io::YAMLDocReader& r) void DPSM<IDType>::_read(athena::io::YAMLDocReader& r)
{ {
for (const auto& elem : r.getCurNode()->m_mapChildren) for (const auto& elem : r.getCurNode()->m_mapChildren)
{ {
@ -69,7 +76,7 @@ void DPSM<IDType>::read(athena::io::YAMLDocReader& r)
} }
template <class IDType> template <class IDType>
void DPSM<IDType>::write(athena::io::YAMLDocWriter& w) const void DPSM<IDType>::_write(athena::io::YAMLDocWriter& w) const
{ {
writeQuadDecalInfo(w, x0_quad, true); writeQuadDecalInfo(w, x0_quad, true);
writeQuadDecalInfo(w, x1c_quad, false); writeQuadDecalInfo(w, x1c_quad, false);
@ -164,53 +171,88 @@ void DPSM<IDType>::writeQuadDecalInfo(athena::io::YAMLDocWriter& w,
} }
template <class IDType> template <class IDType>
size_t DPSM<IDType>::binarySize(size_t __isz) const void DPSM<IDType>::_binarySize(size_t& s) const
{ {
__isz += 4; s += 4;
__isz = getQuadDecalBinarySize(__isz, x0_quad); getQuadDecalBinarySize(s, x0_quad);
__isz = getQuadDecalBinarySize(__isz, x1c_quad); getQuadDecalBinarySize(s, x1c_quad);
if (x38_DMDL) if (x38_DMDL)
__isz = x38_DMDL.binarySize(__isz + 4); {
s += 4;
x38_DMDL.binarySize(s);
}
if (x48_DLFT) if (x48_DLFT)
__isz = x48_DLFT.binarySize(__isz + 4); {
s += 4;
x48_DLFT.binarySize(s);
}
if (x4c_DMOP) if (x4c_DMOP)
__isz = x4c_DMOP.binarySize(__isz + 4); {
s += 4;
x4c_DMOP.binarySize(s);
}
if (x50_DMRT) if (x50_DMRT)
__isz = x50_DMRT.binarySize(__isz + 4); {
s += 4;
x50_DMRT.binarySize(s);
}
if (x54_DMSC) if (x54_DMSC)
__isz = x54_DMSC.binarySize(__isz + 4); {
s += 4;
x54_DMSC.binarySize(s);
}
if (x58_DMCL) if (x58_DMCL)
__isz = x58_DMCL.binarySize(__isz + 4); {
x58_DMCL.binarySize(s);
}
if (x5c_24_DMAB) if (x5c_24_DMAB)
__isz += 9; s += 9;
if (x5c_25_DMOO) if (x5c_25_DMOO)
__isz += 9; s += 9;
return __isz;
} }
template <class IDType> template <class IDType>
size_t DPSM<IDType>::getQuadDecalBinarySize(size_t __isz, const typename DPSM<IDType>::SQuadDescr& quad) const void DPSM<IDType>::getQuadDecalBinarySize(size_t& s, const typename DPSM<IDType>::SQuadDescr& quad) const
{ {
if (quad.x0_LFT) if (quad.x0_LFT)
__isz = quad.x0_LFT.binarySize(__isz + 4); {
s += 4;
quad.x0_LFT.binarySize(s);
}
if (quad.x4_SZE) if (quad.x4_SZE)
__isz = quad.x4_SZE.binarySize(__isz + 4); {
s += 4;
quad.x4_SZE.binarySize(s);
}
if (quad.x8_ROT) if (quad.x8_ROT)
__isz = quad.x8_ROT.binarySize(__isz + 4); {
s += 4;
quad.x8_ROT.binarySize(s);
}
if (quad.xc_OFF) if (quad.xc_OFF)
__isz = quad.xc_OFF.binarySize(__isz + 4); {
s += 4;
quad.xc_OFF.binarySize(s);
}
if (quad.x10_CLR) if (quad.x10_CLR)
__isz = quad.x10_CLR.binarySize(__isz + 4); {
s += 4;
quad.x10_CLR.binarySize(s);
}
if (quad.x14_TEX) if (quad.x14_TEX)
__isz = quad.x14_TEX.binarySize(__isz + 4); {
s += 4;
quad.x14_TEX.binarySize(s);
}
if (quad.x18_ADD) if (quad.x18_ADD)
__isz = quad.x18_ADD.binarySize(__isz + 4); {
s += 4;
return __isz; quad.x18_ADD.binarySize(s);
}
} }
template <class IDType> template <class IDType>
void DPSM<IDType>::read(athena::io::IStreamReader& r) void DPSM<IDType>::_read(athena::io::IStreamReader& r)
{ {
uint32_t clsId; uint32_t clsId;
r.readBytesToBuf(&clsId, 4); r.readBytesToBuf(&clsId, 4);
@ -280,7 +322,7 @@ void DPSM<IDType>::read(athena::io::IStreamReader& r)
} }
template <class IDType> template <class IDType>
void DPSM<IDType>::write(athena::io::IStreamWriter& w) const void DPSM<IDType>::_write(athena::io::IStreamWriter& w) const
{ {
w.writeBytes("DPSM", 4); w.writeBytes("DPSM", 4);
writeQuadDecalInfo(w, x0_quad, true); writeQuadDecalInfo(w, x0_quad, true);
@ -373,6 +415,8 @@ void DPSM<IDType>::gatherDependencies(std::vector<hecl::ProjectPath>& pathsOut)
g_curSpec->flattenDependencies(x38_DMDL.id, pathsOut); g_curSpec->flattenDependencies(x38_DMDL.id, pathsOut);
} }
AT_SUBSPECIALIZE_DNA_YAML(DPSM<UniqueID32>)
AT_SUBSPECIALIZE_DNA_YAML(DPSM<UniqueID64>)
template struct DPSM<UniqueID32>; template struct DPSM<UniqueID32>;
template struct DPSM<UniqueID64>; template struct DPSM<UniqueID64>;
@ -384,7 +428,7 @@ bool ExtractDPSM(PAKEntryReadStream& rs, const hecl::ProjectPath& outPath)
{ {
DPSM<IDType> dpsm; DPSM<IDType> dpsm;
dpsm.read(rs); dpsm.read(rs);
dpsm.toYAMLStream(writer); athena::io::ToYAMLStream(dpsm, writer);
return true; return true;
} }
return false; return false;

View File

@ -9,10 +9,10 @@ namespace DataSpec::DNAParticle
{ {
template <class IDType> template <class IDType>
struct DPSM : BigYAML struct DPSM : BigDNA
{ {
static const char* DNAType() { return "DPSM"; } AT_DECL_EXPLICIT_DNA_YAML
const char* DNATypeV() const { return DNAType(); } AT_SUBDECL_DNA
struct SQuadDescr struct SQuadDescr
{ {
@ -38,15 +38,10 @@ struct DPSM : BigYAML
struct { bool x5c_24_DMAB : 1; bool x5c_25_DMOO : 1;}; struct { bool x5c_24_DMAB : 1; bool x5c_25_DMOO : 1;};
uint8_t dummy; uint8_t dummy;
}; };
void read(athena::io::YAMLDocReader& r);
void write(athena::io::YAMLDocWriter& w) const;
template <class Reader> template <class Reader>
void readQuadDecalInfo(Reader& r, uint32_t clsId, SQuadDescr& quad); void readQuadDecalInfo(Reader& r, uint32_t clsId, SQuadDescr& quad);
void writeQuadDecalInfo(athena::io::YAMLDocWriter& w, const SQuadDescr& quad, bool first) const; void writeQuadDecalInfo(athena::io::YAMLDocWriter& w, const SQuadDescr& quad, bool first) const;
size_t binarySize(size_t __isz) const; void getQuadDecalBinarySize(size_t& s, const SQuadDescr& desc) const;
size_t getQuadDecalBinarySize(size_t __isz, const SQuadDescr& ) const;
void read(athena::io::IStreamReader& r);
void write(athena::io::IStreamWriter& w) const;
void writeQuadDecalInfo(athena::io::IStreamWriter& w, const SQuadDescr& quad, bool first) const; void writeQuadDecalInfo(athena::io::IStreamWriter& w, const SQuadDescr& quad, bool first) const;
void gatherDependencies(std::vector<hecl::ProjectPath>&) const; void gatherDependencies(std::vector<hecl::ProjectPath>&) const;

View File

@ -114,7 +114,9 @@ static void PopulateAreaFields(DEAFBABE& db,
db.bspSize = octree.second; db.bspSize = octree.second;
db.unk1 = 0x1000000; db.unk1 = 0x1000000;
db.length = db.binarySize(0) - 8; size_t dbSize = 0;
db.binarySize(dbSize);
db.length = dbSize - 8;
db.magic = 0xDEAFBABE; db.magic = 0xDEAFBABE;
db.version = 3; db.version = 3;
db.aabb[0] = fullAABB.min; db.aabb[0] = fullAABB.min;

View File

@ -7,12 +7,12 @@ namespace DataSpec::DNACommon
{ {
struct EGMC : public BigDNA struct EGMC : public BigDNA
{ {
DECL_DNA AT_DECL_DNA
Value<atUint32> count; Value<atUint32> count;
struct Object : BigDNA struct Object : BigDNA
{ {
DECL_DNA AT_DECL_DNA
Value<atUint32> mesh; Value<atUint32> mesh;
Value<atUint32> instanceId; Value<atUint32> instanceId;
}; };

View File

@ -2,197 +2,9 @@
namespace DataSpec::DNAParticle namespace DataSpec::DNAParticle
{ {
template <class IDType>
void ELSM<IDType>::read(athena::io::YAMLDocReader& r)
{
for (const auto& elem : r.getCurNode()->m_mapChildren)
{
if (elem.first.size() < 4)
{
LogModule.report(logvisor::Warning, "short FourCC in element '%s'", elem.first.c_str());
continue;
}
switch(*reinterpret_cast<const uint32_t*>(elem.first.data()))
{
case SBIG('LIFE'):
x0_LIFE.read(r);
break;
case SBIG('SLIF'):
x4_SLIF.read(r);
break;
case SBIG('GRAT'):
x8_GRAT.read(r);
break;
case SBIG('SCNT'):
xc_SCNT.read(r);
break;
case SBIG('SSEG'):
x10_SSEG.read(r);
break;
case SBIG('COLR'):
x14_COLR.read(r);
break;
case SBIG('IEMT'):
x18_IEMT.read(r);
break;
case SBIG('FEMT'):
x1c_FEMT.read(r);
break;
case SBIG('AMPL'):
x20_AMPL.read(r);
break;
case SBIG('AMPD'):
x24_AMPD.read(r);
break;
case SBIG('LWD1'):
x28_LWD1.read(r);
break;
case SBIG('LWD2'):
x2c_LWD2.read(r);
break;
case SBIG('LWD3'):
x30_LWD3.read(r);
break;
case SBIG('LCL1'):
x34_LCL1.read(r);
break;
case SBIG('LCL2'):
x38_LCL2.read(r);
break;
case SBIG('LCL3'):
x3c_LCL3.read(r);
break;
case SBIG('SSWH'):
x40_SSWH.read(r);
break;
case SBIG('GPSM'):
x50_GPSM.read(r);
break;
case SBIG('EPSM'):
x60_EPSM.read(r);
break;
case SBIG('ZERY'):
x70_ZERY.read(r);
break;
}
}
}
template <class IDType> template <class IDType>
void ELSM<IDType>::write(athena::io::YAMLDocWriter& w) const void ELSM<IDType>::_read(athena::io::IStreamReader& r)
{
if (x0_LIFE)
if (auto rec = w.enterSubRecord("LIFE"))
x0_LIFE.write(w);
if (x4_SLIF)
if (auto rec = w.enterSubRecord("SLIF"))
x4_SLIF.write(w);
if (x8_GRAT)
if (auto rec = w.enterSubRecord("GRAT"))
x8_GRAT.write(w);
if (xc_SCNT)
if (auto rec = w.enterSubRecord("SCNT"))
xc_SCNT.write(w);
if (x10_SSEG)
if (auto rec = w.enterSubRecord("SSEG"))
x10_SSEG.write(w);
if (x14_COLR)
if (auto rec = w.enterSubRecord("COLR"))
x14_COLR.write(w);
if (x18_IEMT)
if (auto rec = w.enterSubRecord("IEMT"))
x18_IEMT.write(w);
if (x1c_FEMT)
if (auto rec = w.enterSubRecord("FEMT"))
x1c_FEMT.write(w);
if (x20_AMPL)
if (auto rec = w.enterSubRecord("AMPL"))
x20_AMPL.write(w);
if (x24_AMPD)
if (auto rec = w.enterSubRecord("AMPD"))
x24_AMPD.write(w);
if (x28_LWD1)
if (auto rec = w.enterSubRecord("LWD1"))
x28_LWD1.write(w);
if (x2c_LWD2)
if (auto rec = w.enterSubRecord("LWD2"))
x2c_LWD2.write(w);
if (x30_LWD3)
if (auto rec = w.enterSubRecord("LWD3"))
x30_LWD3.write(w);
if (x34_LCL1)
if (auto rec = w.enterSubRecord("LCL1"))
x34_LCL1.write(w);
if (x38_LCL2)
if (auto rec = w.enterSubRecord("LCL2"))
x38_LCL2.write(w);
if (x3c_LCL3)
if (auto rec = w.enterSubRecord("LCL3"))
x3c_LCL3.write(w);
if (x40_SSWH)
if (auto rec = w.enterSubRecord("SSWH"))
x40_SSWH.write(w);
if (x50_GPSM)
if (auto rec = w.enterSubRecord("GPSM"))
x50_GPSM.write(w);
if (x60_EPSM)
if (auto rec = w.enterSubRecord("EPSM"))
x60_EPSM.write(w);
if (x70_ZERY)
if (auto rec = w.enterSubRecord("ZERY"))
x70_ZERY.write(w);
}
template <class IDType>
size_t ELSM<IDType>::binarySize(size_t __isz) const
{
__isz += 4;
if (x0_LIFE)
__isz = x0_LIFE.binarySize(__isz + 4);
if (x4_SLIF)
__isz = x4_SLIF.binarySize(__isz + 4);
if (x8_GRAT)
__isz = x8_GRAT.binarySize(__isz + 4);
if (xc_SCNT)
__isz = xc_SCNT.binarySize(__isz + 4);
if (x10_SSEG)
__isz = x10_SSEG.binarySize(__isz + 4);
if (x14_COLR)
__isz = x14_COLR.binarySize(__isz + 4);
if (x18_IEMT)
__isz = x18_IEMT.binarySize(__isz + 4);
if (x1c_FEMT)
__isz = x1c_FEMT.binarySize(__isz + 4);
if (x20_AMPL)
__isz = x20_AMPL.binarySize(__isz + 4);
if (x24_AMPD)
__isz = x24_AMPD.binarySize(__isz + 4);
if (x28_LWD1)
__isz = x28_LWD1.binarySize(__isz + 4);
if (x2c_LWD2)
__isz = x2c_LWD2.binarySize(__isz + 4);
if (x30_LWD3)
__isz = x30_LWD3.binarySize(__isz + 4);
if (x34_LCL1)
__isz = x34_LCL1.binarySize(__isz + 4);
if (x38_LCL2)
__isz = x38_LCL2.binarySize(__isz + 4);
if (x3c_LCL3)
__isz = x3c_LCL3.binarySize(__isz + 4);
if (x40_SSWH)
__isz = x40_SSWH.binarySize(__isz + 4);
if (x50_GPSM)
__isz = x50_GPSM.binarySize(__isz + 4);
if (x60_EPSM)
__isz = x60_EPSM.binarySize(__isz + 4);
if (x70_ZERY)
__isz = x70_ZERY.binarySize(__isz + 4);
return __isz;
}
template <class IDType>
void ELSM<IDType>::read(athena::io::IStreamReader& r)
{ {
uint32_t clsId; uint32_t clsId;
r.readBytesToBuf(&clsId, 4); r.readBytesToBuf(&clsId, 4);
@ -276,7 +88,7 @@ void ELSM<IDType>::read(athena::io::IStreamReader& r)
} }
template <class IDType> template <class IDType>
void ELSM<IDType>::write(athena::io::IStreamWriter& w) const void ELSM<IDType>::_write(athena::io::IStreamWriter& w) const
{ {
w.writeBytes((atInt8*)"ELSM", 4); w.writeBytes((atInt8*)"ELSM", 4);
if (x0_LIFE) if (x0_LIFE)
@ -382,6 +194,262 @@ void ELSM<IDType>::write(athena::io::IStreamWriter& w) const
w.writeBytes("_END", 4); w.writeBytes("_END", 4);
} }
template <class IDType>
void ELSM<IDType>::_binarySize(size_t& s) const
{
s += 4;
if (x0_LIFE)
{
s += 4;
x0_LIFE.binarySize(s);
}
if (x4_SLIF)
{
s += 4;
x4_SLIF.binarySize(s);
}
if (x8_GRAT)
{
s += 4;
x8_GRAT.binarySize(s);
}
if (xc_SCNT)
{
s += 4;
xc_SCNT.binarySize(s);
}
if (x10_SSEG)
{
s += 4;
x10_SSEG.binarySize(s);
}
if (x14_COLR)
{
s += 4;
x14_COLR.binarySize(s);
}
if (x18_IEMT)
{
s += 4;
x18_IEMT.binarySize(s);
}
if (x1c_FEMT)
{
s += 4;
x1c_FEMT.binarySize(s);
}
if (x20_AMPL)
{
s += 4;
x20_AMPL.binarySize(s);
}
if (x24_AMPD)
{
s += 4;
x24_AMPD.binarySize(s);
}
if (x28_LWD1)
{
s += 4;
x28_LWD1.binarySize(s);
}
if (x2c_LWD2)
{
s += 4;
x2c_LWD2.binarySize(s);
}
if (x30_LWD3)
{
s += 4;
x30_LWD3.binarySize(s);
}
if (x34_LCL1)
{
s += 4;
x34_LCL1.binarySize(s);
}
if (x38_LCL2)
{
s += 4;
x38_LCL2.binarySize(s);
}
if (x3c_LCL3)
{
s += 4;
x3c_LCL3.binarySize(s);
}
if (x40_SSWH)
{
s += 4;
x40_SSWH.binarySize(s);
}
if (x50_GPSM)
{
s += 4;
x50_GPSM.binarySize(s);
}
if (x60_EPSM)
{
s += 4;
x60_EPSM.binarySize(s);
}
if (x70_ZERY)
{
s += 4;
x70_ZERY.binarySize(s);
}
}
template <class IDType>
void ELSM<IDType>::_read(athena::io::YAMLDocReader& r)
{
for (const auto& elem : r.getCurNode()->m_mapChildren)
{
if (elem.first.size() < 4)
{
LogModule.report(logvisor::Warning, "short FourCC in element '%s'", elem.first.c_str());
continue;
}
switch(*reinterpret_cast<const uint32_t*>(elem.first.data()))
{
case SBIG('LIFE'):
x0_LIFE.read(r);
break;
case SBIG('SLIF'):
x4_SLIF.read(r);
break;
case SBIG('GRAT'):
x8_GRAT.read(r);
break;
case SBIG('SCNT'):
xc_SCNT.read(r);
break;
case SBIG('SSEG'):
x10_SSEG.read(r);
break;
case SBIG('COLR'):
x14_COLR.read(r);
break;
case SBIG('IEMT'):
x18_IEMT.read(r);
break;
case SBIG('FEMT'):
x1c_FEMT.read(r);
break;
case SBIG('AMPL'):
x20_AMPL.read(r);
break;
case SBIG('AMPD'):
x24_AMPD.read(r);
break;
case SBIG('LWD1'):
x28_LWD1.read(r);
break;
case SBIG('LWD2'):
x2c_LWD2.read(r);
break;
case SBIG('LWD3'):
x30_LWD3.read(r);
break;
case SBIG('LCL1'):
x34_LCL1.read(r);
break;
case SBIG('LCL2'):
x38_LCL2.read(r);
break;
case SBIG('LCL3'):
x3c_LCL3.read(r);
break;
case SBIG('SSWH'):
x40_SSWH.read(r);
break;
case SBIG('GPSM'):
x50_GPSM.read(r);
break;
case SBIG('EPSM'):
x60_EPSM.read(r);
break;
case SBIG('ZERY'):
x70_ZERY.read(r);
break;
}
}
}
template <class IDType>
void ELSM<IDType>::_write(athena::io::YAMLDocWriter& w) const
{
if (x0_LIFE)
if (auto rec = w.enterSubRecord("LIFE"))
x0_LIFE.write(w);
if (x4_SLIF)
if (auto rec = w.enterSubRecord("SLIF"))
x4_SLIF.write(w);
if (x8_GRAT)
if (auto rec = w.enterSubRecord("GRAT"))
x8_GRAT.write(w);
if (xc_SCNT)
if (auto rec = w.enterSubRecord("SCNT"))
xc_SCNT.write(w);
if (x10_SSEG)
if (auto rec = w.enterSubRecord("SSEG"))
x10_SSEG.write(w);
if (x14_COLR)
if (auto rec = w.enterSubRecord("COLR"))
x14_COLR.write(w);
if (x18_IEMT)
if (auto rec = w.enterSubRecord("IEMT"))
x18_IEMT.write(w);
if (x1c_FEMT)
if (auto rec = w.enterSubRecord("FEMT"))
x1c_FEMT.write(w);
if (x20_AMPL)
if (auto rec = w.enterSubRecord("AMPL"))
x20_AMPL.write(w);
if (x24_AMPD)
if (auto rec = w.enterSubRecord("AMPD"))
x24_AMPD.write(w);
if (x28_LWD1)
if (auto rec = w.enterSubRecord("LWD1"))
x28_LWD1.write(w);
if (x2c_LWD2)
if (auto rec = w.enterSubRecord("LWD2"))
x2c_LWD2.write(w);
if (x30_LWD3)
if (auto rec = w.enterSubRecord("LWD3"))
x30_LWD3.write(w);
if (x34_LCL1)
if (auto rec = w.enterSubRecord("LCL1"))
x34_LCL1.write(w);
if (x38_LCL2)
if (auto rec = w.enterSubRecord("LCL2"))
x38_LCL2.write(w);
if (x3c_LCL3)
if (auto rec = w.enterSubRecord("LCL3"))
x3c_LCL3.write(w);
if (x40_SSWH)
if (auto rec = w.enterSubRecord("SSWH"))
x40_SSWH.write(w);
if (x50_GPSM)
if (auto rec = w.enterSubRecord("GPSM"))
x50_GPSM.write(w);
if (x60_EPSM)
if (auto rec = w.enterSubRecord("EPSM"))
x60_EPSM.write(w);
if (x70_ZERY)
if (auto rec = w.enterSubRecord("ZERY"))
x70_ZERY.write(w);
}
AT_SUBSPECIALIZE_DNA_YAML(ELSM<UniqueID32>)
AT_SUBSPECIALIZE_DNA_YAML(ELSM<UniqueID64>)
template <>
const char* ELSM<UniqueID32>::DNAType() { return "urde::ELSM<UniqueID32>"; }
template <>
const char* ELSM<UniqueID64>::DNAType() { return "urde::ELSM<UniqueID64>"; }
template <class IDType> template <class IDType>
void ELSM<IDType>::gatherDependencies(std::vector<hecl::ProjectPath>& pathsOut) const void ELSM<IDType>::gatherDependencies(std::vector<hecl::ProjectPath>& pathsOut) const
{ {
@ -401,7 +469,7 @@ bool ExtractELSM(PAKEntryReadStream& rs, const hecl::ProjectPath& outPath)
{ {
ELSM<IDType> elsm; ELSM<IDType> elsm;
elsm.read(rs); elsm.read(rs);
elsm.toYAMLStream(writer); athena::io::ToYAMLStream(elsm, writer);
return true; return true;
} }
return false; return false;

View File

@ -8,10 +8,10 @@
namespace DataSpec::DNAParticle namespace DataSpec::DNAParticle
{ {
template <class IDType> template <class IDType>
struct ELSM : BigYAML struct ELSM : BigDNA
{ {
static const char* DNAType() { return "urde::ELSM"; } AT_DECL_EXPLICIT_DNA_YAML
const char* DNATypeV() const { return DNAType(); } AT_SUBDECL_DNA
IntElementFactory x0_LIFE; IntElementFactory x0_LIFE;
IntElementFactory x4_SLIF; IntElementFactory x4_SLIF;
RealElementFactory x8_GRAT; RealElementFactory x8_GRAT;
@ -33,12 +33,6 @@ struct ELSM : BigYAML
ChildResourceFactory<IDType> x60_EPSM; ChildResourceFactory<IDType> x60_EPSM;
BoolHelper x70_ZERY; BoolHelper x70_ZERY;
void read(athena::io::YAMLDocReader& r);
void write(athena::io::YAMLDocWriter& w) const;
size_t binarySize(size_t __isz) const;
void read(athena::io::IStreamReader& r);
void write(athena::io::IStreamWriter& w) const;
void gatherDependencies(std::vector<hecl::ProjectPath>&) const; void gatherDependencies(std::vector<hecl::ProjectPath>&) const;
}; };

View File

@ -4,66 +4,8 @@ namespace DataSpec::DNAFont
{ {
logvisor::Module LogModule("urde::DNAFont"); logvisor::Module LogModule("urde::DNAFont");
void GlyphRect::read(athena::io::IStreamReader& __dna_reader)
{
/* left */
left = __dna_reader.readFloatBig();
/* top */
top = __dna_reader.readFloatBig();
/* right */
right = __dna_reader.readFloatBig();
/* bottom */
bottom = __dna_reader.readFloatBig();
}
void GlyphRect::write(athena::io::IStreamWriter& __dna_writer) const
{
/* left */
__dna_writer.writeFloatBig(left);
/* top */
__dna_writer.writeFloatBig(top);
/* right */
__dna_writer.writeFloatBig(right);
/* bottom */
__dna_writer.writeFloatBig(bottom);
}
void GlyphRect::read(athena::io::YAMLDocReader& __dna_docin)
{
/* left */
left = __dna_docin.readFloat("left");
/* top */
top = __dna_docin.readFloat("top");
/* right */
right = __dna_docin.readFloat("right");
/* bottom */
bottom = __dna_docin.readFloat("bottom");
}
void GlyphRect::write(athena::io::YAMLDocWriter& __dna_docout) const
{
/* left */
__dna_docout.writeFloat("left", left);
/* top */
__dna_docout.writeFloat("top", top);
/* right */
__dna_docout.writeFloat("right", right);
/* bottom */
__dna_docout.writeFloat("bottom", bottom);
}
const char* GlyphRect::DNAType()
{
return "GlyphRect";
}
size_t GlyphRect::binarySize(size_t __isz) const
{
return __isz + 16;
}
template <class IDType> template <class IDType>
void FONT<IDType>::read(athena::io::IStreamReader& __dna_reader) void FONT<IDType>::_read(athena::io::IStreamReader& __dna_reader)
{ {
/* magic */ /* magic */
atUint32 magic; atUint32 magic;
@ -115,7 +57,7 @@ void FONT<IDType>::read(athena::io::IStreamReader& __dna_reader)
} }
template <class IDType> template <class IDType>
void FONT<IDType>::write(athena::io::IStreamWriter& __dna_writer) const void FONT<IDType>::_write(athena::io::IStreamWriter& __dna_writer) const
{ {
/* magic */ /* magic */
__dna_writer.writeBytes((atInt8*)"FONT", 4); __dna_writer.writeBytes((atInt8*)"FONT", 4);
@ -155,7 +97,7 @@ void FONT<IDType>::write(athena::io::IStreamWriter& __dna_writer) const
} }
template <class IDType> template <class IDType>
void FONT<IDType>::read(athena::io::YAMLDocReader& __dna_docin) void FONT<IDType>::_read(athena::io::YAMLDocReader& __dna_docin)
{ {
/* version */ /* version */
version = __dna_docin.readUint32("version"); version = __dna_docin.readUint32("version");
@ -204,7 +146,7 @@ void FONT<IDType>::read(athena::io::YAMLDocReader& __dna_docin)
} }
template <class IDType> template <class IDType>
void FONT<IDType>::write(athena::io::YAMLDocWriter& __dna_docout) const void FONT<IDType>::_write(athena::io::YAMLDocWriter& __dna_docout) const
{ {
/* version */ /* version */
__dna_docout.writeUint32("version", version); __dna_docout.writeUint32("version", version);
@ -241,300 +183,32 @@ void FONT<IDType>::write(athena::io::YAMLDocWriter& __dna_docout) const
__dna_docout.enumerate("kerningInfo", kerningInfo); __dna_docout.enumerate("kerningInfo", kerningInfo);
} }
template <class IDType> template <>
const char* FONT<IDType>::DNAType() const char* FONT<UniqueID32>::DNAType()
{ {
return "FONT"; return "FONT<UniqueID32>";
}
template <>
const char* FONT<UniqueID64>::DNAType()
{
return "FONT<UniqueID64>";
} }
template <class IDType> template <class IDType>
size_t FONT<IDType>::binarySize(size_t __isz) const void FONT<IDType>::_binarySize(size_t& __isz) const
{ {
__isz += name.size() + 1; __isz += name.size() + 1;
__isz = textureId.binarySize(__isz); textureId.binarySize(__isz);
for (const std::unique_ptr<IGlyph>& glyph : glyphs) for (const std::unique_ptr<IGlyph>& glyph : glyphs)
__isz = glyph->binarySize(__isz); glyph->binarySize(__isz);
__isz = __EnumerateSize(__isz, kerningInfo); for (const KerningInfo& k : kerningInfo)
return __isz + 46; k.binarySize(__isz);
__isz += 46;
} }
void IGlyph::read(athena::io::IStreamReader& __dna_reader) AT_SUBSPECIALIZE_DNA_YAML(FONT<UniqueID32>)
{ AT_SUBSPECIALIZE_DNA_YAML(FONT<UniqueID64>)
/* m_character */
m_character = __dna_reader.readUint16Big();
/* m_glyphRect */
m_glyphRect.read(__dna_reader);
}
void IGlyph::write(athena::io::IStreamWriter& __dna_writer) const
{
/* m_character */
__dna_writer.writeUint16Big(m_character);
/* m_glyphRect */
m_glyphRect.write(__dna_writer);
}
void IGlyph::read(athena::io::YAMLDocReader& __dna_docin)
{
/* m_character */
m_character = __dna_docin.readUint16("m_character");
/* m_glyphRect */
__dna_docin.enumerate("m_glyphRect", m_glyphRect);
}
void IGlyph::write(athena::io::YAMLDocWriter& __dna_docout) const
{
/* m_character */
__dna_docout.writeUint16("m_character", m_character);
/* m_glyphRect */
__dna_docout.enumerate("m_glyphRect", m_glyphRect);
}
const char* IGlyph::DNAType()
{
return "FONT::IGlyph";
}
size_t IGlyph::binarySize(size_t __isz) const
{
__isz = m_glyphRect.binarySize(__isz);
return __isz + 2;
}
void GlyphMP1::read(athena::io::IStreamReader& __dna_reader)
{
IGlyph::read(__dna_reader);
/* m_leftPadding */
m_leftPadding = __dna_reader.readInt32Big();
/* m_advance */
m_advance = __dna_reader.readInt32Big();
/* m_rightPadding */
m_rightPadding = __dna_reader.readInt32Big();
/* m_width */
m_width = __dna_reader.readInt32Big();
/* m_height */
m_height = __dna_reader.readInt32Big();
/* m_baseline */
m_baseline = __dna_reader.readInt32Big();
/* m_kerningIndex */
m_kerningIndex = __dna_reader.readInt32Big();
}
void GlyphMP1::write(athena::io::IStreamWriter& __dna_writer) const
{
IGlyph::write(__dna_writer);
/* m_leftPadding */
__dna_writer.writeInt32Big(m_leftPadding);
/* m_advance */
__dna_writer.writeInt32Big(m_advance);
/* m_rightPadding */
__dna_writer.writeInt32Big(m_rightPadding);
/* m_width */
__dna_writer.writeInt32Big(m_width);
/* m_height */
__dna_writer.writeInt32Big(m_height);
/* m_baseline */
__dna_writer.writeInt32Big(m_baseline);
/* m_kerningIndex */
__dna_writer.writeInt32Big(m_kerningIndex);
}
void GlyphMP1::read(athena::io::YAMLDocReader& __dna_docin)
{
IGlyph::read(__dna_docin);
/* m_leftPadding */
m_leftPadding = __dna_docin.readInt32("m_leftPadding");
/* m_advance */
m_advance = __dna_docin.readInt32("m_advance");
/* m_rightPadding */
m_rightPadding = __dna_docin.readInt32("m_rightPadding");
/* m_width */
m_width = __dna_docin.readInt32("m_width");
/* m_height */
m_height = __dna_docin.readInt32("m_height");
/* m_baseline */
m_baseline = __dna_docin.readInt32("m_baseline");
/* m_kerningIndex */
m_kerningIndex = __dna_docin.readInt32("m_kerningIndex");
}
void GlyphMP1::write(athena::io::YAMLDocWriter& __dna_docout) const
{
IGlyph::write(__dna_docout);
/* m_leftPadding */
__dna_docout.writeInt32("m_leftPadding", m_leftPadding);
/* m_advance */
__dna_docout.writeInt32("m_advance", m_advance);
/* m_rightPadding */
__dna_docout.writeInt32("m_rightPadding", m_rightPadding);
/* m_width */
__dna_docout.writeInt32("m_width", m_width);
/* m_height */
__dna_docout.writeInt32("m_height", m_height);
/* m_baseline */
__dna_docout.writeInt32("m_baseline", m_baseline);
/* m_kerningIndex */
__dna_docout.writeInt32("m_kerningIndex", m_kerningIndex);
}
const char* GlyphMP1::DNAType()
{
return "GlyphMP1";
}
size_t GlyphMP1::binarySize(size_t __isz) const
{
__isz = IGlyph::binarySize(__isz);
return __isz + 28;
}
void GlyphMP2::read(athena::io::IStreamReader& __dna_reader)
{
IGlyph::read(__dna_reader);
/* m_layer */
m_layer = __dna_reader.readByte();
/* m_leftPadding */
m_leftPadding = __dna_reader.readByte();
/* m_advance */
m_advance = __dna_reader.readByte();
/* m_rightPadding */
m_rightPadding = __dna_reader.readByte();
/* m_width */
m_width = __dna_reader.readByte();
/* m_height */
m_height = __dna_reader.readByte();
/* m_baseline */
m_baseline = __dna_reader.readByte();
/* m_kerningIndex */
m_kerningIndex = __dna_reader.readInt16Big();
}
void GlyphMP2::write(athena::io::IStreamWriter& __dna_writer) const
{
IGlyph::write(__dna_writer);
/* m_layer */
__dna_writer.writeByte(m_layer);
/* m_leftPadding */
__dna_writer.writeByte(m_leftPadding);
/* m_advance */
__dna_writer.writeByte(m_advance);
/* m_rightPadding */
__dna_writer.writeByte(m_rightPadding);
/* m_width */
__dna_writer.writeByte(m_width);
/* m_height */
__dna_writer.writeByte(m_height);
/* m_baseline */
__dna_writer.writeByte(m_baseline);
/* m_kerningIndex */
__dna_writer.writeInt16Big(m_kerningIndex);
}
void GlyphMP2::read(athena::io::YAMLDocReader& __dna_docin)
{
IGlyph::read(__dna_docin);
/* m_layer */
m_layer = __dna_docin.readByte("m_layer");
/* m_leftPadding */
m_leftPadding = __dna_docin.readByte("m_leftPadding");
/* m_advance */
m_advance = __dna_docin.readByte("m_advance");
/* m_rightPadding */
m_rightPadding = __dna_docin.readByte("m_rightPadding");
/* m_width */
m_width = __dna_docin.readByte("m_width");
/* m_height */
m_height = __dna_docin.readByte("m_height");
/* m_baseline */
m_baseline = __dna_docin.readByte("m_baseline");
/* m_kerningIndex */
m_kerningIndex = __dna_docin.readInt16("m_kerningIndex");
}
void GlyphMP2::write(athena::io::YAMLDocWriter& __dna_docout) const
{
IGlyph::write(__dna_docout);
/* m_layer */
__dna_docout.writeByte("m_layer", m_layer);
/* m_leftPadding */
__dna_docout.writeByte("m_leftPadding", m_leftPadding);
/* m_advance */
__dna_docout.writeByte("m_advance", m_advance);
/* m_rightPadding */
__dna_docout.writeByte("m_rightPadding", m_rightPadding);
/* m_width */
__dna_docout.writeByte("m_width", m_width);
/* m_height */
__dna_docout.writeByte("m_height", m_height);
/* m_baseline */
__dna_docout.writeByte("m_baseline", m_baseline);
/* m_kerningIndex */
__dna_docout.writeInt16("m_kerningIndex", m_kerningIndex);
}
const char* GlyphMP2::DNAType()
{
return "GlyphMP2";
}
size_t GlyphMP2::binarySize(size_t __isz) const
{
__isz = IGlyph::binarySize(__isz);
return __isz + 9;
}
void KerningInfo::read(athena::io::IStreamReader& __dna_reader)
{
/* thisChar */
thisChar = __dna_reader.readUint16Big();
/* nextChar */
nextChar = __dna_reader.readUint16Big();
/* adjust */
adjust = __dna_reader.readInt32Big();
}
void KerningInfo::write(athena::io::IStreamWriter& __dna_writer) const
{
/* thisChar */
__dna_writer.writeUint16Big(thisChar);
/* nextChar */
__dna_writer.writeUint16Big(nextChar);
/* adjust */
__dna_writer.writeInt32Big(adjust);
}
void KerningInfo::read(athena::io::YAMLDocReader& __dna_docin)
{
/* thisChar */
thisChar = __dna_docin.readUint16("thisChar");
/* nextChar */
nextChar = __dna_docin.readUint16("nextChar");
/* adjust */
adjust = __dna_docin.readInt32("adjust");
}
void KerningInfo::write(athena::io::YAMLDocWriter& __dna_docout) const
{
/* thisChar */
__dna_docout.writeUint16("thisChar", thisChar);
/* nextChar */
__dna_docout.writeUint16("nextChar", nextChar);
/* adjust */
__dna_docout.writeInt32("adjust", adjust);
}
const char* KerningInfo::DNAType()
{
return "KerningInfo";
}
size_t KerningInfo::binarySize(size_t __isz) const
{
return __isz + 8;
}
template struct FONT<UniqueID32>;
template struct FONT<UniqueID64>;
template <class IDType> template <class IDType>
bool ExtractFONT(PAKEntryReadStream& rs, const hecl::ProjectPath& outPath) bool ExtractFONT(PAKEntryReadStream& rs, const hecl::ProjectPath& outPath)
@ -544,7 +218,7 @@ bool ExtractFONT(PAKEntryReadStream& rs, const hecl::ProjectPath& outPath)
{ {
FONT<IDType> font; FONT<IDType> font;
font.read(rs); font.read(rs);
font.toYAMLStream(writer); athena::io::ToYAMLStream(font, writer);
return true; return true;
} }
return false; return false;

View File

@ -6,17 +6,17 @@
namespace DataSpec::DNAFont namespace DataSpec::DNAFont
{ {
struct GlyphRect : BigYAML struct GlyphRect : BigDNA
{ {
DECL_YAML AT_DECL_DNA_YAML
Value<float> left; Value<float> left;
Value<float> top; Value<float> top;
Value<float> right; Value<float> right;
Value<float> bottom; Value<float> bottom;
}; };
struct IGlyph : BigYAML struct IGlyph : BigDNAV
{ {
DECL_YAML AT_DECL_DNA_YAML
Value<atUint16> m_character; Value<atUint16> m_character;
GlyphRect m_glyphRect; GlyphRect m_glyphRect;
@ -39,7 +39,8 @@ struct IGlyph : BigYAML
struct GlyphMP1 : IGlyph struct GlyphMP1 : IGlyph
{ {
DECL_YAML AT_DECL_DNA_YAML
AT_DECL_DNAV
Value<atInt32> m_leftPadding; Value<atInt32> m_leftPadding;
Value<atInt32> m_advance; Value<atInt32> m_advance;
Value<atInt32> m_rightPadding; Value<atInt32> m_rightPadding;
@ -59,7 +60,8 @@ struct GlyphMP1 : IGlyph
struct GlyphMP2 : IGlyph struct GlyphMP2 : IGlyph
{ {
DECL_YAML AT_DECL_DNA_YAML
AT_DECL_DNAV
Value<atInt8> m_layer; Value<atInt8> m_layer;
Value<atInt8> m_leftPadding; Value<atInt8> m_leftPadding;
Value<atInt8> m_advance; Value<atInt8> m_advance;
@ -79,18 +81,19 @@ struct GlyphMP2 : IGlyph
atInt32 kerningIndex() const { return m_kerningIndex; } atInt32 kerningIndex() const { return m_kerningIndex; }
}; };
struct KerningInfo : BigYAML struct KerningInfo : BigDNA
{ {
DECL_YAML AT_DECL_DNA_YAML
Value<atUint16> thisChar; Value<atUint16> thisChar;
Value<atUint16> nextChar; Value<atUint16> nextChar;
Value<atInt32> adjust; Value<atInt32> adjust;
}; };
template <class IDType> template <class IDType>
struct FONT : BigYAML struct AT_SPECIALIZE_PARMS(DataSpec::UniqueID32, DataSpec::UniqueID64) FONT : BigDNA
{ {
DECL_YAML AT_DECL_EXPLICIT_DNA_YAML
AT_SUBDECL_DNA
Value<atUint32> version; Value<atUint32> version;
Value<atUint32> unknown1; Value<atUint32> unknown1;
Value<atInt32> lineHeight; Value<atInt32> lineHeight;

View File

@ -9,904 +9,10 @@ namespace DataSpec::DNAFSM2
logvisor::Module LogDNAFSM2("urde::DNAFSM2"); logvisor::Module LogDNAFSM2("urde::DNAFSM2");
template <class IDType> template <class IDType>
void FSM2<IDType>::Header::read(athena::io::IStreamReader& __dna_reader) template <class Op>
void FSM2<IDType>::Enumerate(typename Op::StreamT& s)
{ {
/* magic */ Do<Op>({"header"}, header, s);
magic.read(__dna_reader);
/* version */
version = __dna_reader.readUint32Big();
}
template <class IDType>
void FSM2<IDType>::Header::write(athena::io::IStreamWriter& __dna_writer) const
{
/* magic */
magic.write(__dna_writer);
/* version */
__dna_writer.writeUint32Big(version);
}
template <class IDType>
void FSM2<IDType>::Header::read(athena::io::YAMLDocReader& __dna_docin)
{
/* magic */
__dna_docin.enumerate("magic", magic);
/* version */
version = __dna_docin.readUint32("version");
}
template <class IDType>
void FSM2<IDType>::Header::write(athena::io::YAMLDocWriter& __dna_docout) const
{
/* magic */
__dna_docout.enumerate("magic", magic);
/* version */
__dna_docout.writeUint32("version", version);
}
template <class IDType>
const char* FSM2<IDType>::Header::DNAType()
{
return "FSM2::Header";
}
template <class IDType>
size_t FSM2<IDType>::Header::binarySize(size_t __isz) const
{
__isz = magic.binarySize(__isz);
return __isz + 4;
}
template <class IDType>
void FSM2<IDType>::CommonStruct::read(athena::io::IStreamReader& __dna_reader)
{
/* name */
name = __dna_reader.readString(-1);
/* unknown */
unknown = __dna_reader.readUint32Big();
}
template <class IDType>
void FSM2<IDType>::CommonStruct::write(athena::io::IStreamWriter& __dna_writer) const
{
/* name */
__dna_writer.writeString(name, -1);
/* unknown */
__dna_writer.writeUint32Big(unknown);
}
template <class IDType>
void FSM2<IDType>::CommonStruct::read(athena::io::YAMLDocReader& __dna_docin)
{
/* name */
name = __dna_docin.readString("name");
/* unknown */
unknown = __dna_docin.readUint32("unknown");
}
template <class IDType>
void FSM2<IDType>::CommonStruct::write(athena::io::YAMLDocWriter& __dna_docout) const
{
/* name */
__dna_docout.writeString("name", name);
/* unknown */
__dna_docout.writeUint32("unknown", unknown);
}
template <class IDType>
const char* FSM2<IDType>::CommonStruct::DNAType()
{
return "FSM2::CommonStruct";
}
template <class IDType>
size_t FSM2<IDType>::CommonStruct::binarySize(size_t __isz) const
{
__isz += name.size() + 1;
__isz += 4;
return __isz;
}
template <class IDType>
void FSM2<IDType>::FSMV1::read(athena::io::IStreamReader& __dna_reader)
{
/* stateCount */
stateCount = __dna_reader.readUint32Big();
/* unknown1Count */
unknown1Count = __dna_reader.readUint32Big();
/* unknown2Count */
unknown2Count = __dna_reader.readUint32Big();
/* unknown3Count */
unknown3Count = __dna_reader.readUint32Big();
/* states */
__dna_reader.enumerate(states, stateCount);
/* unknown1 */
__dna_reader.enumerate(unknown1, unknown1Count);
/* unknown2 */
__dna_reader.enumerate(unknown2, unknown2Count);
/* unknown3 */
__dna_reader.enumerate(unknown3, unknown3Count);
}
template <class IDType>
void FSM2<IDType>::FSMV1::write(athena::io::IStreamWriter& __dna_writer) const
{
/* stateCount */
__dna_writer.writeUint32Big(stateCount);
/* unknown1Count */
__dna_writer.writeUint32Big(unknown1Count);
/* unknown2Count */
__dna_writer.writeUint32Big(unknown2Count);
/* unknown3Count */
__dna_writer.writeUint32Big(unknown3Count);
/* states */
__dna_writer.enumerate(states);
/* unknown1 */
__dna_writer.enumerate(unknown1);
/* unknown2 */
__dna_writer.enumerate(unknown2);
/* unknown3 */
__dna_writer.enumerate(unknown3);
}
template <class IDType>
void FSM2<IDType>::FSMV1::read(athena::io::YAMLDocReader& __dna_docin)
{
/* states */
stateCount = __dna_docin.enumerate("states", states);
/* unknown1 */
unknown1Count = __dna_docin.enumerate("unknown1", unknown1);
/* unknown2 */
unknown2Count = __dna_docin.enumerate("unknown2", unknown2);
/* unknown3 */
unknown3Count = __dna_docin.enumerate("unknown3", unknown3);
}
template <class IDType>
void FSM2<IDType>::FSMV1::write(athena::io::YAMLDocWriter& __dna_docout) const
{
/* states */
__dna_docout.enumerate("states", states);
/* unknown1 */
__dna_docout.enumerate("unknown1", unknown1);
/* unknown2 */
__dna_docout.enumerate("unknown2", unknown2);
/* unknown3 */
__dna_docout.enumerate("unknown3", unknown3);
}
template <class IDType>
const char* FSM2<IDType>::FSMV1::DNAType()
{
return "FSM2::FSMV1";
}
template <class IDType>
size_t FSM2<IDType>::FSMV1::binarySize(size_t __isz) const
{
__isz = __EnumerateSize(__isz, states);
__isz = __EnumerateSize(__isz, unknown1);
__isz = __EnumerateSize(__isz, unknown2);
__isz = __EnumerateSize(__isz, unknown3);
return __isz + 16;
}
template <class IDType>
void FSM2<IDType>::FSMV1::State::read(athena::io::IStreamReader& __dna_reader)
{
/* name */
name = __dna_reader.readString(-1);
/* unknownCount */
unknownCount = __dna_reader.readUint32Big();
/* unknown */
__dna_reader.enumerate(unknown, unknownCount);
}
template <class IDType>
void FSM2<IDType>::FSMV1::State::write(athena::io::IStreamWriter& __dna_writer) const
{
/* name */
__dna_writer.writeString(name, -1);
/* unknownCount */
__dna_writer.writeUint32Big(unknownCount);
/* unknown */
__dna_writer.enumerate(unknown);
}
template <class IDType>
void FSM2<IDType>::FSMV1::State::read(athena::io::YAMLDocReader& __dna_docin)
{
/* name */
name = __dna_docin.readString("name");
/* unknownCount squelched */
/* unknown */
unknownCount = __dna_docin.enumerate("unknown", unknown);
}
template <class IDType>
void FSM2<IDType>::FSMV1::State::write(athena::io::YAMLDocWriter& __dna_docout) const
{
/* name */
__dna_docout.writeString("name", name);
/* unknownCount squelched */
/* unknown */
__dna_docout.enumerate("unknown", unknown);
}
template <class IDType>
const char* FSM2<IDType>::FSMV1::State::DNAType()
{
return "FSM2::FSMV1::State";
}
template <class IDType>
size_t FSM2<IDType>::FSMV1::State::binarySize(size_t __isz) const
{
__isz += name.size() + 1;
__isz = __EnumerateSize(__isz, unknown);
return __isz + 4;
}
template <class IDType>
void FSM2<IDType>::FSMV1::Unknown1::read(athena::io::IStreamReader& __dna_reader)
{
/* name */
name = __dna_reader.readString(-1);
/* unknown1 */
unknown1 = __dna_reader.readFloatBig();
/* unknown2Count */
unknown2Count = __dna_reader.readUint32Big();
/* unknown2 */
__dna_reader.enumerate(unknown2, unknown2Count);
/* unknown3 */
unknown3 = __dna_reader.readUByte();
}
template <class IDType>
void FSM2<IDType>::FSMV1::Unknown1::write(athena::io::IStreamWriter& __dna_writer) const
{
/* name */
__dna_writer.writeString(name, -1);
/* unknown1 */
__dna_writer.writeFloatBig(unknown1);
/* unknown2Count */
__dna_writer.writeUint32Big(unknown2Count);
/* unknown2 */
__dna_writer.enumerate(unknown2);
/* unknown3 */
__dna_writer.writeUByte(unknown3);
}
template <class IDType>
void FSM2<IDType>::FSMV1::Unknown1::read(athena::io::YAMLDocReader& __dna_docin)
{
/* name */
name = __dna_docin.readString("name");
/* unknown1 */
unknown1 = __dna_docin.readFloat("unknown1");
/* unknown2Count squelched */
/* unknown2 */
unknown2Count = __dna_docin.enumerate("unknown2", unknown2);
/* unknown3 */
unknown3 = __dna_docin.readUByte("unknown3");
}
template <class IDType>
void FSM2<IDType>::FSMV1::Unknown1::write(athena::io::YAMLDocWriter& __dna_docout) const
{
/* name */
__dna_docout.writeString("name", name);
/* unknown1 */
__dna_docout.writeFloat("unknown1", unknown1);
/* unknown2Count squelched */
/* unknown2 */
__dna_docout.enumerate("unknown2", unknown2);
/* unknown3 */
__dna_docout.writeUByte("unknown3", unknown3);
}
template <class IDType>
const char* FSM2<IDType>::FSMV1::Unknown1::DNAType()
{
return "FSM2::FSMV1::Unknown1";
}
template <class IDType>
size_t FSM2<IDType>::FSMV1::Unknown1::binarySize(size_t __isz) const
{
__isz += name.size() + 1;
__isz = __EnumerateSize(__isz, unknown2);
return __isz + 9;
}
template <class IDType>
void FSM2<IDType>::FSMV1::Unknown2::read(athena::io::IStreamReader& __dna_reader)
{
/* name */
name = __dna_reader.readString(-1);
/* unknownCount */
unknownCount = __dna_reader.readUint32Big();
/* unknown */
__dna_reader.enumerate(unknown, unknownCount);
}
template <class IDType>
void FSM2<IDType>::FSMV1::Unknown2::write(athena::io::IStreamWriter& __dna_writer) const
{
/* name */
__dna_writer.writeString(name, -1);
/* unknownCount */
__dna_writer.writeUint32Big(unknownCount);
/* unknown */
__dna_writer.enumerate(unknown);
}
template <class IDType>
void FSM2<IDType>::FSMV1::Unknown2::read(athena::io::YAMLDocReader& __dna_docin)
{
/* name */
name = __dna_docin.readString("name");
/* unknownCount squelched */
/* unknown */
unknownCount = __dna_docin.enumerate("unknown", unknown);
}
template <class IDType>
void FSM2<IDType>::FSMV1::Unknown2::write(athena::io::YAMLDocWriter& __dna_docout) const
{
/* name */
__dna_docout.writeString("name", name);
/* unknownCount squelched */
/* unknown */
__dna_docout.enumerate("unknown", unknown);
}
template <class IDType>
const char* FSM2<IDType>::FSMV1::Unknown2::DNAType()
{
return "FSM2::FSMV1::Unknown2";
}
template <class IDType>
size_t FSM2<IDType>::FSMV1::Unknown2::binarySize(size_t __isz) const
{
__isz += name.size() + 1;
__isz = __EnumerateSize(__isz, unknown);
return __isz + 4;
}
template <class IDType>
void FSM2<IDType>::FSMV1::Unknown3::read(athena::io::IStreamReader& __dna_reader)
{
/* name */
name = __dna_reader.readString(-1);
/* unknownCount */
unknownCount = __dna_reader.readUint32Big();
/* unknown */
__dna_reader.enumerate(unknown, unknownCount);
/* fsmId */
fsmId.read(__dna_reader);
}
template <class IDType>
void FSM2<IDType>::FSMV1::Unknown3::write(athena::io::IStreamWriter& __dna_writer) const
{
/* name */
__dna_writer.writeString(name, -1);
/* unknownCount */
__dna_writer.writeUint32Big(unknownCount);
/* unknown */
__dna_writer.enumerate(unknown);
/* fsmId */
fsmId.write(__dna_writer);
}
template <class IDType>
void FSM2<IDType>::FSMV1::Unknown3::read(athena::io::YAMLDocReader& __dna_docin)
{
/* name */
name = __dna_docin.readString("name");
/* unknownCount squelched */
/* unknown */
unknownCount = __dna_docin.enumerate("unknown", unknown);
/* fsmId */
__dna_docin.enumerate("fsmId", fsmId);
}
template <class IDType>
void FSM2<IDType>::FSMV1::Unknown3::write(athena::io::YAMLDocWriter& __dna_docout) const
{
/* name */
__dna_docout.writeString("name", name);
/* unknownCount squelched */
/* unknown */
__dna_docout.enumerate("unknown", unknown);
/* fsmId */
__dna_docout.enumerate("fsmId", fsmId);
}
template <class IDType>
const char* FSM2<IDType>::FSMV1::Unknown3::DNAType()
{
return "FSM2::FSMV1::Unknown3";
}
template <class IDType>
size_t FSM2<IDType>::FSMV1::Unknown3::binarySize(size_t __isz) const
{
__isz += name.size() + 1;
__isz = __EnumerateSize(__isz, unknown);
__isz = fsmId.binarySize(__isz);
return __isz + 4;
}
template <class IDType>
void FSM2<IDType>::FSMV2::read(athena::io::IStreamReader& __dna_reader)
{
/* stateCount */
stateCount = __dna_reader.readUint32Big();
/* unknown1Count */
unknown1Count = __dna_reader.readUint32Big();
/* unknown2Count */
unknown2Count = __dna_reader.readUint32Big();
/* unknown3Count */
unknown3Count = __dna_reader.readUint32Big();
/* states */
__dna_reader.enumerate(states, stateCount);
/* unknown1 */
__dna_reader.enumerate(unknown1, unknown1Count);
/* unknown2 */
__dna_reader.enumerate(unknown2, unknown2Count);
/* unknown3 */
__dna_reader.enumerate(unknown3, unknown3Count);
}
template <class IDType>
void FSM2<IDType>::FSMV2::write(athena::io::IStreamWriter& __dna_writer) const
{
/* stateCount */
__dna_writer.writeUint32Big(stateCount);
/* unknown1Count */
__dna_writer.writeUint32Big(unknown1Count);
/* unknown2Count */
__dna_writer.writeUint32Big(unknown2Count);
/* unknown3Count */
__dna_writer.writeUint32Big(unknown3Count);
/* states */
__dna_writer.enumerate(states);
/* unknown1 */
__dna_writer.enumerate(unknown1);
/* unknown2 */
__dna_writer.enumerate(unknown2);
/* unknown3 */
__dna_writer.enumerate(unknown3);
}
template <class IDType>
void FSM2<IDType>::FSMV2::read(athena::io::YAMLDocReader& __dna_docin)
{
/* states */
stateCount = __dna_docin.enumerate("states", states);
/* unknown1 */
unknown1Count = __dna_docin.enumerate("unknown1", unknown1);
/* unknown2 */
unknown2Count = __dna_docin.enumerate("unknown2", unknown2);
/* unknown3 */
unknown3Count = __dna_docin.enumerate("unknown3", unknown3);
}
template <class IDType>
void FSM2<IDType>::FSMV2::write(athena::io::YAMLDocWriter& __dna_docout) const
{
/* states */
__dna_docout.enumerate("states", states);
/* unknown1 */
__dna_docout.enumerate("unknown1", unknown1);
/* unknown2 */
__dna_docout.enumerate("unknown2", unknown2);
/* unknown3 */
__dna_docout.enumerate("unknown3", unknown3);
}
template <class IDType>
const char* FSM2<IDType>::FSMV2::DNAType()
{
return "FSM2::FSMV2";
}
template <class IDType>
size_t FSM2<IDType>::FSMV2::binarySize(size_t __isz) const
{
__isz = __EnumerateSize(__isz, states);
__isz = __EnumerateSize(__isz, unknown1);
__isz = __EnumerateSize(__isz, unknown2);
__isz = __EnumerateSize(__isz, unknown3);
return __isz + 16;
}
template <class IDType>
void FSM2<IDType>::FSMV2::State::read(athena::io::IStreamReader& __dna_reader)
{
/* name */
name = __dna_reader.readString(-1);
/* unknown1 */
unknown1 = __dna_reader.readUint32Big();
/* unknown2 */
unknown2 = __dna_reader.readUint32Big();
/* unknown3 */
unknown3 = __dna_reader.readUint32Big();
/* unknown4 */
unknown4 = __dna_reader.readUint32Big();
/* unknown5Count */
unknown5Count = __dna_reader.readUint32Big();
/* unknown5 */
__dna_reader.enumerate(unknown5, unknown5Count);
}
template <class IDType>
void FSM2<IDType>::FSMV2::State::write(athena::io::IStreamWriter& __dna_writer) const
{
/* name */
__dna_writer.writeString(name, -1);
/* unknown1 */
__dna_writer.writeUint32Big(unknown1);
/* unknown2 */
__dna_writer.writeUint32Big(unknown2);
/* unknown3 */
__dna_writer.writeUint32Big(unknown3);
/* unknown4 */
__dna_writer.writeUint32Big(unknown4);
/* unknown5Count */
__dna_writer.writeUint32Big(unknown5Count);
/* unknown5 */
__dna_writer.enumerate(unknown5);
}
template <class IDType>
void FSM2<IDType>::FSMV2::State::read(athena::io::YAMLDocReader& __dna_docin)
{
/* name */
name = __dna_docin.readString("name");
/* unknown1 */
unknown1 = __dna_docin.readUint32("unknown1");
/* unknown2 */
unknown2 = __dna_docin.readUint32("unknown2");
/* unknown3 */
unknown3 = __dna_docin.readUint32("unknown3");
/* unknown4 */
unknown4 = __dna_docin.readUint32("unknown4");
/* unknown5Count squelched */
/* unknown5 */
unknown5Count = __dna_docin.enumerate("unknown5", unknown5);
}
template <class IDType>
void FSM2<IDType>::FSMV2::State::write(athena::io::YAMLDocWriter& __dna_docout) const
{
/* name */
__dna_docout.writeString("name", name);
/* unknown1 */
__dna_docout.writeUint32("unknown1", unknown1);
/* unknown2 */
__dna_docout.writeUint32("unknown2", unknown2);
/* unknown3 */
__dna_docout.writeUint32("unknown3", unknown3);
/* unknown4 */
__dna_docout.writeUint32("unknown4", unknown4);
/* unknown5Count squelched */
/* unknown5 */
__dna_docout.enumerate("unknown5", unknown5);
}
template <class IDType>
const char* FSM2<IDType>::FSMV2::State::DNAType()
{
return "FSM2::FSMV2::State";
}
template <class IDType>
size_t FSM2<IDType>::FSMV2::State::binarySize(size_t __isz) const
{
__isz += name.size() + 1;
__isz = __EnumerateSize(__isz, unknown5);
return __isz + 20;
}
template <class IDType>
void FSM2<IDType>::FSMV2::Unknown1::read(athena::io::IStreamReader& __dna_reader)
{
/* name */
name = __dna_reader.readString(-1);
/* unknown1 */
unknown1 = __dna_reader.readUint32Big();
/* unknown2 */
unknown2 = __dna_reader.readUint32Big();
/* unknown3 */
unknown3 = __dna_reader.readUint32Big();
/* unknown4 */
unknown4 = __dna_reader.readUint32Big();
/* unknown5 */
unknown5 = __dna_reader.readFloatBig();
/* unknown6Count */
unknown6Count = __dna_reader.readUint32Big();
/* unknown6 */
__dna_reader.enumerate(unknown6, unknown6Count);
/* unknown7 */
unknown7 = __dna_reader.readUByte();
}
template <class IDType>
void FSM2<IDType>::FSMV2::Unknown1::write(athena::io::IStreamWriter& __dna_writer) const
{
/* name */
__dna_writer.writeString(name, -1);
/* unknown1 */
__dna_writer.writeUint32Big(unknown1);
/* unknown2 */
__dna_writer.writeUint32Big(unknown2);
/* unknown3 */
__dna_writer.writeUint32Big(unknown3);
/* unknown4 */
__dna_writer.writeUint32Big(unknown4);
/* unknown5 */
__dna_writer.writeUint32Big(unknown5);
/* unknown6Count */
__dna_writer.writeFloatBig(unknown6Count);
/* unknown6 */
__dna_writer.enumerate(unknown6);
/* unknown6 */
__dna_writer.writeUByte(unknown7);
}
template <class IDType>
void FSM2<IDType>::FSMV2::Unknown1::read(athena::io::YAMLDocReader& __dna_docin)
{
/* name */
name = __dna_docin.readString("name");
/* unknown1 */
unknown1 = __dna_docin.readUint32("unknown1");
/* unknown2 */
unknown2 = __dna_docin.readUint32("unknown2");
/* unknown3 */
unknown3 = __dna_docin.readUint32("unknown3");
/* unknown4 */
unknown4 = __dna_docin.readUint32("unknown4");
/* unknown5 */
unknown5 = __dna_docin.readFloat("unknown5");
/* unknown6Count squelched */
/* unknown6 */
unknown6Count = __dna_docin.enumerate("unknown6", unknown6);
/* unknown7 */
unknown7 = __dna_docin.readUByte("unknown7");
}
template <class IDType>
void FSM2<IDType>::FSMV2::Unknown1::write(athena::io::YAMLDocWriter& __dna_docout) const
{
/* name */
__dna_docout.writeString("name", name);
/* unknown1 */
__dna_docout.writeUint32("unknown1", unknown1);
/* unknown2 */
__dna_docout.writeUint32("unknown2", unknown2);
/* unknown3 */
__dna_docout.writeUint32("unknown3", unknown3);
/* unknown4 */
__dna_docout.writeUint32("unknown4", unknown4);
/* unknown5 */
__dna_docout.writeFloat("unknown5", unknown5);
/* unknown6Count squelched */
/* unknown6 */
__dna_docout.enumerate("unknown6", unknown6);
/* unknown7 */
__dna_docout.writeUByte("unknown7", unknown7);
}
template <class IDType>
const char* FSM2<IDType>::FSMV2::Unknown1::DNAType()
{
return "FSM2::FSMV2::Unknown1";
}
template <class IDType>
size_t FSM2<IDType>::FSMV2::Unknown1::binarySize(size_t __isz) const
{
__isz += name.size() + 1;
__isz = __EnumerateSize(__isz, unknown6);
return __isz + 25;
}
template <class IDType>
void FSM2<IDType>::FSMV2::Unknown2::read(athena::io::IStreamReader& __dna_reader)
{
/* name */
name = __dna_reader.readString(-1);
/* unknown1 */
unknown1 = __dna_reader.readUint32Big();
/* unknown2 */
unknown2 = __dna_reader.readUint32Big();
/* unknown3 */
unknown3 = __dna_reader.readUint32Big();
/* unknown4 */
unknown4 = __dna_reader.readUint32Big();
/* unknown5Count */
unknown5Count = __dna_reader.readUint32Big();
/* unknown5 */
__dna_reader.enumerate(unknown5, unknown5Count);
}
template <class IDType>
void FSM2<IDType>::FSMV2::Unknown2::write(athena::io::IStreamWriter& __dna_writer) const
{
/* name */
__dna_writer.writeString(name, -1);
/* unknown1 */
__dna_writer.writeUint32Big(unknown1);
/* unknown2 */
__dna_writer.writeUint32Big(unknown2);
/* unknown3 */
__dna_writer.writeUint32Big(unknown3);
/* unknown4 */
__dna_writer.writeUint32Big(unknown4);
/* unknown5Count */
__dna_writer.writeUint32Big(unknown5Count);
/* unknown5 */
__dna_writer.enumerate(unknown5);
}
template <class IDType>
void FSM2<IDType>::FSMV2::Unknown2::read(athena::io::YAMLDocReader& __dna_docin)
{
/* name */
name = __dna_docin.readString("name");
/* unknown1 */
unknown1 = __dna_docin.readUint32("unknown1");
/* unknown2 */
unknown2 = __dna_docin.readUint32("unknown2");
/* unknown3 */
unknown3 = __dna_docin.readUint32("unknown3");
/* unknown4 */
unknown4 = __dna_docin.readUint32("unknown4");
/* unknown5Count squelched */
/* unknown5 */
unknown5Count = __dna_docin.enumerate("unknown5", unknown5);
}
template <class IDType>
void FSM2<IDType>::FSMV2::Unknown2::write(athena::io::YAMLDocWriter& __dna_docout) const
{
/* name */
__dna_docout.writeString("name", name);
/* unknown1 */
__dna_docout.writeUint32("unknown1", unknown1);
/* unknown2 */
__dna_docout.writeUint32("unknown2", unknown2);
/* unknown3 */
__dna_docout.writeUint32("unknown3", unknown3);
/* unknown4 */
__dna_docout.writeUint32("unknown4", unknown4);
/* unknown5Count squelched */
/* unknown5 */
__dna_docout.enumerate("unknown5", unknown5);
}
template <class IDType>
const char* FSM2<IDType>::FSMV2::Unknown2::DNAType()
{
return "FSM2::FSMV2::Unknown2";
}
template <class IDType>
size_t FSM2<IDType>::FSMV2::Unknown2::binarySize(size_t __isz) const
{
__isz += name.size() + 1;
__isz = __EnumerateSize(__isz, unknown5);
return __isz + 20;
}
template <class IDType>
void FSM2<IDType>::FSMV2::Unknown3::read(athena::io::IStreamReader& __dna_reader)
{
/* name */
name = __dna_reader.readString(-1);
/* unknown1 */
unknown1 = __dna_reader.readUint32Big();
/* unknown2 */
unknown2 = __dna_reader.readUint32Big();
/* unknown3 */
unknown3 = __dna_reader.readUint32Big();
/* unknown4 */
unknown4 = __dna_reader.readUint32Big();
/* unknown5Count */
unknown5Count = __dna_reader.readUint32Big();
/* unknown5 */
__dna_reader.enumerate(unknown5, unknown5Count);
/* fsmId */
fsmId.read(__dna_reader);
}
template <class IDType>
void FSM2<IDType>::FSMV2::Unknown3::write(athena::io::IStreamWriter& __dna_writer) const
{
/* name */
__dna_writer.writeString(name, -1);
/* unknown1 */
__dna_writer.writeUint32Big(unknown1);
/* unknown2 */
__dna_writer.writeUint32Big(unknown2);
/* unknown3 */
__dna_writer.writeUint32Big(unknown3);
/* unknown4 */
__dna_writer.writeUint32Big(unknown4);
/* unknown5Count */
__dna_writer.writeUint32Big(unknown5Count);
/* unknown5 */
__dna_writer.enumerate(unknown5);
/* fsmId */
fsmId.write(__dna_writer);
}
template <class IDType>
void FSM2<IDType>::FSMV2::Unknown3::read(athena::io::YAMLDocReader& __dna_docin)
{
/* name */
name = __dna_docin.readString("name");
/* unknown1 */
unknown1 = __dna_docin.readUint32("unknown1");
/* unknown2 */
unknown2 = __dna_docin.readUint32("unknown2");
/* unknown3 */
unknown3 = __dna_docin.readUint32("unknown3");
/* unknown4 */
unknown4 = __dna_docin.readUint32("unknown4");
/* unknown5Count squelched */
/* unknown5 */
unknown5Count = __dna_docin.enumerate("unknown5", unknown5);
/* fsmId */
__dna_docin.enumerate("fsmId", fsmId);
}
template <class IDType>
void FSM2<IDType>::FSMV2::Unknown3::write(athena::io::YAMLDocWriter& __dna_docout) const
{
/* name */
__dna_docout.writeString("name", name);
/* unknown1 */
__dna_docout.writeUint32("unknown1", unknown1);
/* unknown2 */
__dna_docout.writeUint32("unknown2", unknown2);
/* unknown3 */
__dna_docout.writeUint32("unknown3", unknown3);
/* unknown4 */
__dna_docout.writeUint32("unknown4", unknown4);
/* unknown5Count squelched */
/* unknown5 */
__dna_docout.enumerate("unknown5", unknown5);
/* fsmId */
__dna_docout.enumerate("fsmId", fsmId);
}
template <class IDType>
const char* FSM2<IDType>::FSMV2::Unknown3::DNAType()
{
return "FSM2::FSMV2::Unknown3";
}
template <class IDType>
size_t FSM2<IDType>::FSMV2::Unknown3::binarySize(size_t __isz) const
{
__isz += name.size() + 1;
__isz = __EnumerateSize(__isz, unknown5);
__isz = fsmId.binarySize(__isz);
return __isz + 20;
}
template <class IDType>
void FSM2<IDType>::read(athena::io::IStreamReader& in)
{
header.read(in);
if (header.magic != SBIG('FSM2')) if (header.magic != SBIG('FSM2'))
{ {
LogDNAFSM2.report(logvisor::Fatal, "Invalid FSM2 magic '%.4s' expected 'FSM2'", header.magic.toString().c_str()); LogDNAFSM2.report(logvisor::Fatal, "Invalid FSM2 magic '%.4s' expected 'FSM2'", header.magic.toString().c_str());
@ -914,67 +20,32 @@ void FSM2<IDType>::read(athena::io::IStreamReader& in)
} }
if (header.version == 1) if (header.version == 1)
detail.reset(new FSMV1); {
if (!detail)
detail.reset(new FSMV1);
Do<Op>({"detail"}, static_cast<FSMV1&>(*detail), s);
}
else if (header.version == 2) else if (header.version == 2)
detail.reset(new FSMV2); {
if (!detail)
detail.reset(new FSMV2);
Do<Op>({"detail"}, static_cast<FSMV2&>(*detail), s);
}
else else
{ {
LogDNAFSM2.report(logvisor::Fatal, "Invalid FSM2 version '%i'", header.version); LogDNAFSM2.report(logvisor::Fatal, "Invalid FSM2 version '%i'", header.version);
return; return;
} }
detail->read(in);
} }
template <class IDType> AT_SPECIALIZE_DNA(FSM2<UniqueID32>)
void FSM2<IDType>::write(athena::io::IStreamWriter& out) const AT_SPECIALIZE_DNA(FSM2<UniqueID64>)
{
header.write(out);
detail->write(out);
}
template <class IDType> template <>
void FSM2<IDType>::read(athena::io::YAMLDocReader& in) const char* FSM2<UniqueID32>::DNAType() { return "urde::FSM2<UniqueID32>"; }
{
header.read(in);
if (header.magic != SBIG('FSM2'))
{
LogDNAFSM2.report(logvisor::Fatal, "Invalid FSM2 magic '%.4s' expected 'FSM2'", header.magic.toString().c_str());
return;
}
if (header.version == 1) template <>
detail.reset(new FSMV1); const char* FSM2<UniqueID64>::DNAType() { return "urde::FSM2<UniqueID64>"; }
else if (header.version == 2)
detail.reset(new FSMV2);
else
{
LogDNAFSM2.report(logvisor::Fatal, "Invalid FSM2 version '%i'", header.version);
return;
}
detail->read(in);
}
template <class IDType>
void FSM2<IDType>::write(athena::io::YAMLDocWriter& out) const
{
header.write(out);
detail->write(out);
}
template <class IDType>
size_t FSM2<IDType>::binarySize(size_t __isz) const
{
__isz = header.binarySize(__isz);
return detail->binarySize(__isz);
}
template <class IDType>
const char* FSM2<IDType>::DNAType() { return "urde::FSM2"; }
template <class IDType>
const char* FSM2<IDType>::DNATypeV() const { return FSM2<IDType>::DNAType(); }
template struct FSM2<UniqueID32>; template struct FSM2<UniqueID32>;
template struct FSM2<UniqueID64>; template struct FSM2<UniqueID64>;
@ -987,7 +58,7 @@ bool ExtractFSM2(PAKEntryReadStream& rs, const hecl::ProjectPath& outPath)
{ {
FSM2<IDType> fsm2; FSM2<IDType> fsm2;
fsm2.read(rs); fsm2.read(rs);
fsm2.toYAMLStream(writer); athena::io::ToYAMLStream(fsm2, writer);
return true; return true;
} }
return false; return false;

View File

@ -7,46 +7,47 @@
namespace DataSpec::DNAFSM2 namespace DataSpec::DNAFSM2
{ {
struct IFSM : BigYAML struct IFSM : BigDNAVYaml
{ {
Delete _d; Delete _d;
}; };
template <class IDType> template <class IDType>
struct FSM2 : BigYAML struct AT_SPECIALIZE_PARMS(DataSpec::UniqueID32, DataSpec::UniqueID64) FSM2 : BigDNA
{ {
struct Header : BigYAML struct Header : BigDNA
{ {
DECL_YAML AT_DECL_DNA_YAML
DNAFourCC magic; DNAFourCC magic = FOURCC('FSM2');
Value<atUint32> version; Value<atUint32> version;
} header; } header;
struct CommonStruct : BigYAML struct CommonStruct : BigDNA
{ {
DECL_YAML AT_DECL_DNA_YAML
String<-1> name; String<-1> name;
Value<atUint32> unknown; Value<atUint32> unknown;
}; };
struct FSMV1 : IFSM struct FSMV1 : IFSM
{ {
DECL_YAML AT_DECL_DNA_YAML
AT_DECL_DNAV
Value<atUint32> stateCount; Value<atUint32> stateCount;
Value<atUint32> unknown1Count; Value<atUint32> unknown1Count;
Value<atUint32> unknown2Count; Value<atUint32> unknown2Count;
Value<atUint32> unknown3Count; Value<atUint32> unknown3Count;
struct State : BigYAML struct State : BigDNA
{ {
DECL_YAML AT_DECL_DNA_YAML
String<-1> name; String<-1> name;
Value<atUint32> unknownCount; Value<atUint32> unknownCount;
Vector<CommonStruct, DNA_COUNT(unknownCount)> unknown; Vector<CommonStruct, DNA_COUNT(unknownCount)> unknown;
}; };
struct Unknown1 : BigYAML struct Unknown1 : BigDNA
{ {
DECL_YAML AT_DECL_DNA_YAML
String<-1> name; String<-1> name;
Value<float> unknown1; Value<float> unknown1;
Value<atUint32> unknown2Count; Value<atUint32> unknown2Count;
@ -54,17 +55,17 @@ struct FSM2 : BigYAML
Value<atUint8> unknown3; Value<atUint8> unknown3;
}; };
struct Unknown2 : BigYAML struct Unknown2 : BigDNA
{ {
DECL_YAML AT_DECL_DNA_YAML
String<-1> name; String<-1> name;
Value<atUint32> unknownCount; Value<atUint32> unknownCount;
Vector<CommonStruct, DNA_COUNT(unknownCount)> unknown; Vector<CommonStruct, DNA_COUNT(unknownCount)> unknown;
}; };
struct Unknown3 : BigYAML struct Unknown3 : BigDNA
{ {
DECL_YAML AT_DECL_DNA_YAML
String<-1> name; String<-1> name;
Value<atUint32> unknownCount; Value<atUint32> unknownCount;
Vector<CommonStruct, DNA_COUNT(unknownCount)> unknown; Vector<CommonStruct, DNA_COUNT(unknownCount)> unknown;
@ -79,14 +80,15 @@ struct FSM2 : BigYAML
struct FSMV2 : IFSM struct FSMV2 : IFSM
{ {
DECL_YAML AT_DECL_DNA_YAML
AT_DECL_DNAV
Value<atUint32> stateCount; Value<atUint32> stateCount;
Value<atUint32> unknown1Count; Value<atUint32> unknown1Count;
Value<atUint32> unknown2Count; Value<atUint32> unknown2Count;
Value<atUint32> unknown3Count; Value<atUint32> unknown3Count;
struct State : BigYAML struct State : BigDNA
{ {
DECL_YAML AT_DECL_DNA_YAML
String<-1> name; String<-1> name;
Value<atUint32> unknown1; Value<atUint32> unknown1;
Value<atUint32> unknown2; Value<atUint32> unknown2;
@ -96,9 +98,9 @@ struct FSM2 : BigYAML
Vector<CommonStruct, DNA_COUNT(unknown5Count)> unknown5; Vector<CommonStruct, DNA_COUNT(unknown5Count)> unknown5;
}; };
struct Unknown1 : BigYAML struct Unknown1 : BigDNA
{ {
DECL_YAML AT_DECL_DNA_YAML
String<-1> name; String<-1> name;
Value<atUint32> unknown1; Value<atUint32> unknown1;
Value<atUint32> unknown2; Value<atUint32> unknown2;
@ -110,9 +112,9 @@ struct FSM2 : BigYAML
Value<atUint8> unknown7; Value<atUint8> unknown7;
}; };
struct Unknown2 : BigYAML struct Unknown2 : BigDNA
{ {
DECL_YAML AT_DECL_DNA_YAML
String<-1> name; String<-1> name;
Value<atUint32> unknown1; Value<atUint32> unknown1;
Value<atUint32> unknown2; Value<atUint32> unknown2;
@ -122,9 +124,9 @@ struct FSM2 : BigYAML
Vector<CommonStruct, DNA_COUNT(unknown5Count)> unknown5; Vector<CommonStruct, DNA_COUNT(unknown5Count)> unknown5;
}; };
struct Unknown3 : BigYAML struct Unknown3 : BigDNA
{ {
DECL_YAML AT_DECL_DNA_YAML
String<-1> name; String<-1> name;
Value<atUint32> unknown1; Value<atUint32> unknown1;
Value<atUint32> unknown2; Value<atUint32> unknown2;
@ -141,14 +143,8 @@ struct FSM2 : BigYAML
Vector<Unknown3, DNA_COUNT(unknown3Count)> unknown3; Vector<Unknown3, DNA_COUNT(unknown3Count)> unknown3;
}; };
void read(athena::io::IStreamReader& in);
void write(athena::io::IStreamWriter& out) const;
void read(athena::io::YAMLDocReader& in);
void write(athena::io::YAMLDocWriter& out) const;
std::unique_ptr<IFSM> detail; std::unique_ptr<IFSM> detail;
size_t binarySize(size_t __isz) const; AT_DECL_EXPLICIT_DNA_YAML
static const char* DNAType();
const char* DNATypeV() const;
}; };
template <class IDType> template <class IDType>

View File

@ -14,7 +14,8 @@ namespace DataSpec::DNAMAPA
static logvisor::Module Log("DNAMAPA"); static logvisor::Module Log("DNAMAPA");
void MAPA::read(athena::io::IStreamReader& __dna_reader) template <>
void MAPA::Enumerate<BigDNA::Read>(typename Read::StreamT& __dna_reader)
{ {
/* magic */ /* magic */
magic = __dna_reader.readUint32Big(); magic = __dna_reader.readUint32Big();
@ -58,7 +59,8 @@ void MAPA::read(athena::io::IStreamReader& __dna_reader)
__dna_reader.enumerate(surfaces, header->surfaceCount()); __dna_reader.enumerate(surfaces, header->surfaceCount());
} }
void MAPA::write(athena::io::IStreamWriter& __dna_writer) const template <>
void MAPA::Enumerate<BigDNA::Write>(typename Write::StreamT& __dna_writer)
{ {
/* magic */ /* magic */
__dna_writer.writeUint32Big(magic); __dna_writer.writeUint32Big(magic);
@ -77,17 +79,20 @@ void MAPA::write(athena::io::IStreamWriter& __dna_writer) const
__dna_writer.enumerate(surfaces); __dna_writer.enumerate(surfaces);
} }
size_t MAPA::binarySize(size_t __isz) const template <>
void MAPA::Enumerate<BigDNA::BinarySize>(typename BinarySize::StreamT& s)
{ {
__isz = header->binarySize(__isz); header->binarySize(s);
for (const std::unique_ptr<IMappableObject>& mo : mappableObjects) for (const std::unique_ptr<IMappableObject>& mo : mappableObjects)
__isz = mo->binarySize(__isz); mo->binarySize(s);
__isz += vertices.size() * 12; s += vertices.size() * 12;
__isz = __EnumerateSize(__isz, surfaceHeaders); for (const SurfaceHeader& sh : surfaceHeaders)
__isz = __EnumerateSize(__isz, surfaces); sh.binarySize(s);
return __isz + 8; for (const Surface& su : surfaces)
su.binarySize(s);
s += 8;
} }
static const char* RetroMapVisModes[] = static const char* RetroMapVisModes[] =
@ -417,7 +422,7 @@ bool Cook(const hecl::blender::MapArea& mapaIn, const hecl::ProjectPath& out)
size_t offsetCur = 0; size_t offsetCur = 0;
for (const auto& mo : mapa.mappableObjects) for (const auto& mo : mapa.mappableObjects)
offsetCur = mo->binarySize(offsetCur); mo->binarySize(offsetCur);
offsetCur += mapa.vertices.size() * 12; offsetCur += mapa.vertices.size() * 12;
offsetCur += mapaIn.surfaces.size() * 32; offsetCur += mapaIn.surfaces.size() * 32;
@ -458,11 +463,12 @@ bool Cook(const hecl::blender::MapArea& mapaIn, const hecl::ProjectPath& out)
surfHead.normal = surfIn.normal.val; surfHead.normal = surfIn.normal.val;
surfHead.centroid = surfIn.centerOfMass; surfHead.centroid = surfIn.centerOfMass;
surfHead.polyOff = offsetCur; surfHead.polyOff = offsetCur;
offsetCur = prim.binarySize(offsetCur + 4); offsetCur += 4;
prim.binarySize(offsetCur);
surfHead.edgeOff = offsetCur; surfHead.edgeOff = offsetCur;
offsetCur += 4; offsetCur += 4;
for (const auto& border : surf.borders) for (const auto& border : surf.borders)
offsetCur = border.binarySize(offsetCur); border.binarySize(offsetCur);
} }
athena::io::FileWriter f(out.getAbsolutePath()); athena::io::FileWriter f(out.getAbsolutePath());

View File

@ -9,10 +9,10 @@ namespace DataSpec::DNAMAPA
{ {
struct MAPA : BigDNA struct MAPA : BigDNA
{ {
Delete _d; AT_DECL_EXPLICIT_DNA
Value<atUint32> magic; Value<atUint32> magic;
Value<atUint32> version; Value<atUint32> version;
struct IMAPAHeader : BigDNA struct IMAPAHeader : BigDNAV
{ {
Delete _d; Delete _d;
virtual atUint32 visMode() const=0; virtual atUint32 visMode() const=0;
@ -23,7 +23,8 @@ struct MAPA : BigDNA
struct HeaderMP1 : IMAPAHeader struct HeaderMP1 : IMAPAHeader
{ {
DECL_DNA AT_DECL_DNA
AT_DECL_DNAV
Value<atUint32> unknown1 = 0; Value<atUint32> unknown1 = 0;
Value<atUint32> mapVisMode = 0; Value<atUint32> mapVisMode = 0;
Value<atVec3f> boundingBox[2] = {}; Value<atVec3f> boundingBox[2] = {};
@ -38,7 +39,8 @@ struct MAPA : BigDNA
struct HeaderMP2 : IMAPAHeader struct HeaderMP2 : IMAPAHeader
{ {
DECL_DNA AT_DECL_DNA
AT_DECL_DNAV
Value<atUint32> unknown1 = 0; Value<atUint32> unknown1 = 0;
Value<atUint32> mapVisMode = 0; Value<atUint32> mapVisMode = 0;
Value<atVec3f> boundingBox[2] = {}; Value<atVec3f> boundingBox[2] = {};
@ -56,7 +58,8 @@ struct MAPA : BigDNA
struct HeaderMP3 : IMAPAHeader struct HeaderMP3 : IMAPAHeader
{ {
DECL_DNA AT_DECL_DNA
AT_DECL_DNAV
Value<atUint32> unknown1 = 0; Value<atUint32> unknown1 = 0;
Value<atUint32> mapVisMode = 0; Value<atUint32> mapVisMode = 0;
Value<atVec3f> boundingBox[2] = {}; Value<atVec3f> boundingBox[2] = {};
@ -77,13 +80,9 @@ struct MAPA : BigDNA
}; };
void read(athena::io::IStreamReader& __dna_reader);
void write(athena::io::IStreamWriter& __dna_writer) const;
size_t binarySize(size_t __isz) const;
std::unique_ptr<IMAPAHeader> header; std::unique_ptr<IMAPAHeader> header;
struct IMappableObject : BigDNA struct IMappableObject : BigDNAV
{ {
Delete _d; Delete _d;
enum class Type : atUint32 enum class Type : atUint32
@ -111,24 +110,24 @@ struct MAPA : BigDNA
SaveStation = 34, SaveStation = 34,
MissileStation = 37 MissileStation = 37
}; };
virtual ~IMappableObject() {}
}; };
struct MappableObjectMP1_2 : IMappableObject struct MappableObjectMP1_2 : IMappableObject
{ {
DECL_DNA AT_DECL_DNA
AT_DECL_DNAV
Value<Type> type; Value<Type> type;
Value<atUint32> visMode; Value<atUint32> visMode;
Value<atUint32> sclyId; Value<atUint32> sclyId;
Value<atInt32> seek1 = -1; Value<atInt32> seek1 = -1;
Value<atVec4f> transformMtx[3]; Value<atVec4f> transformMtx[3];
Value<atInt32> seek2[4] = {-1, -1, -1, -1}; Value<atInt32> seek2[4] = {-1, -1, -1, -1};
virtual ~MappableObjectMP1_2() {}
}; };
struct MappableObjectMP3 : IMappableObject struct MappableObjectMP3 : IMappableObject
{ {
DECL_DNA AT_DECL_DNA
AT_DECL_DNAV
Value<Type> type; Value<Type> type;
Value<atUint32> visMode; Value<atUint32> visMode;
Value<atUint32> sclyId; Value<atUint32> sclyId;
@ -136,7 +135,6 @@ struct MAPA : BigDNA
Value<atInt32> seek1 = -1; Value<atInt32> seek1 = -1;
Value<atVec4f> transformMtx[3]; Value<atVec4f> transformMtx[3];
Value<atInt32> seek2[4] = {-1, -1, -1, -1}; Value<atInt32> seek2[4] = {-1, -1, -1, -1};
virtual ~MappableObjectMP3() {}
}; };
std::vector<std::unique_ptr<IMappableObject>> mappableObjects; std::vector<std::unique_ptr<IMappableObject>> mappableObjects;
@ -144,7 +142,7 @@ struct MAPA : BigDNA
struct SurfaceHeader : BigDNA struct SurfaceHeader : BigDNA
{ {
DECL_DNA AT_DECL_DNA
Value<atVec3f> normal; Value<atVec3f> normal;
Value<atVec3f> centroid; Value<atVec3f> centroid;
Value<atUint32> polyOff; Value<atUint32> polyOff;
@ -155,11 +153,11 @@ struct MAPA : BigDNA
struct Surface : BigDNA struct Surface : BigDNA
{ {
DECL_DNA AT_DECL_DNA
Value<atUint32> primitiveCount; Value<atUint32> primitiveCount;
struct Primitive : BigDNA struct Primitive : BigDNA
{ {
DECL_DNA AT_DECL_DNA
Value<atUint32> type; Value<atUint32> type;
Value<atUint32> indexCount; Value<atUint32> indexCount;
Vector<atUint8, DNA_COUNT(indexCount)> indices; Vector<atUint8, DNA_COUNT(indexCount)> indices;
@ -169,7 +167,7 @@ struct MAPA : BigDNA
Value<atUint32> borderCount; Value<atUint32> borderCount;
struct Border : BigDNA struct Border : BigDNA
{ {
DECL_DNA AT_DECL_DNA
Value<atUint32> indexCount; Value<atUint32> indexCount;
Vector<atUint8, DNA_COUNT(indexCount)> indices; Vector<atUint8, DNA_COUNT(indexCount)> indices;
Align<4> align; Align<4> align;
@ -178,8 +176,6 @@ struct MAPA : BigDNA
}; };
Vector<Surface, DNA_COUNT(header->surfaceCount())> surfaces; Vector<Surface, DNA_COUNT(header->surfaceCount())> surfaces;
}; };
template <typename PAKRouter> template <typename PAKRouter>

View File

@ -7,19 +7,19 @@ namespace DataSpec::DNAMAPU
{ {
struct MAPU : BigDNA struct MAPU : BigDNA
{ {
DECL_DNA AT_DECL_DNA
Value<uint32_t> magic; Value<uint32_t> magic;
Value<uint32_t> version; Value<uint32_t> version;
UniqueID32 hexMapa; UniqueID32 hexMapa;
Value<uint32_t> worldCount; Value<uint32_t> worldCount;
struct Transform : BigDNA struct Transform : BigDNA
{ {
DECL_DNA AT_DECL_DNA
Value<atVec4f> xf[3]; Value<atVec4f> xf[3];
}; };
struct World : BigDNA struct World : BigDNA
{ {
DECL_DNA AT_DECL_DNA
String<-1> name; String<-1> name;
UniqueID32 mlvl; UniqueID32 mlvl;
Transform transform; Transform transform;

View File

@ -3,8 +3,14 @@
namespace DataSpec::DNAParticle namespace DataSpec::DNAParticle
{ {
template <>
const char* GPSM<UniqueID32>::DNAType() {return "GPSM<UniqueID32>";}
template <>
const char* GPSM<UniqueID64>::DNAType() {return "GPSM<UniqueID64>";}
template <class IDType> template <class IDType>
void GPSM<IDType>::read(athena::io::YAMLDocReader& r) void GPSM<IDType>::_read(typename ReadYaml::StreamT& r)
{ {
for (const auto& elem : r.getCurNode()->m_mapChildren) for (const auto& elem : r.getCurNode()->m_mapChildren)
{ {
@ -266,7 +272,7 @@ void GPSM<IDType>::read(athena::io::YAMLDocReader& r)
} }
template <class IDType> template <class IDType>
void GPSM<IDType>::write(athena::io::YAMLDocWriter& w) const void GPSM<IDType>::_write(typename WriteYaml::StreamT& w) const
{ {
if (x0_PSIV) if (x0_PSIV)
if (auto rec = w.enterSubRecord("PSIV")) if (auto rec = w.enterSubRecord("PSIV"))
@ -496,176 +502,364 @@ void GPSM<IDType>::write(athena::io::YAMLDocWriter& w) const
} }
template <class IDType> template <class IDType>
size_t GPSM<IDType>::binarySize(size_t __isz) const void GPSM<IDType>::_binarySize(typename BinarySize::StreamT& s) const
{ {
__isz += 4; s += 4;
if (x0_PSIV) if (x0_PSIV)
__isz = x0_PSIV.binarySize(__isz + 4); {
s += 4;
x0_PSIV.binarySize(s);
}
if (x4_PSVM) if (x4_PSVM)
__isz = x4_PSVM.binarySize(__isz + 4); {
s += 4;
x4_PSVM.binarySize(s);
}
if (x8_PSOV) if (x8_PSOV)
__isz = x8_PSOV.binarySize(__isz + 4); {
s += 4;
x8_PSOV.binarySize(s);
}
if (xc_PSLT) if (xc_PSLT)
__isz = xc_PSLT.binarySize(__isz + 4); {
s += 4;
xc_PSLT.binarySize(s);
}
if (x10_PSWT) if (x10_PSWT)
__isz = x10_PSWT.binarySize(__isz + 4); {
s += 4;
x10_PSWT.binarySize(s);
}
if (x14_PSTS) if (x14_PSTS)
__isz = x14_PSTS.binarySize(__isz + 4); {
s += 4;
x14_PSTS.binarySize(s);
}
if (x18_POFS) if (x18_POFS)
__isz = x18_POFS.binarySize(__isz + 4); {
s += 4;
x18_POFS.binarySize(s);
}
if (x1c_SEED) if (x1c_SEED)
__isz = x1c_SEED.binarySize(__isz + 4); {
s += 4;
x1c_SEED.binarySize(s);
}
if (x20_LENG) if (x20_LENG)
__isz = x20_LENG.binarySize(__isz + 4); {
s += 4;
x20_LENG.binarySize(s);
}
if (x24_WIDT) if (x24_WIDT)
__isz = x24_WIDT.binarySize(__isz + 4); {
s += 4;
x24_WIDT.binarySize(s);
}
if (x28_MAXP) if (x28_MAXP)
__isz = x28_MAXP.binarySize(__isz + 4); {
s += 4;
x28_MAXP.binarySize(s);
}
if (x2c_GRTE) if (x2c_GRTE)
__isz = x2c_GRTE.binarySize(__isz + 4); {
s += 4;
x2c_GRTE.binarySize(s);
}
if (x30_COLR) if (x30_COLR)
__isz = x30_COLR.binarySize(__isz + 4); {
s += 4;
x30_COLR.binarySize(s);
}
if (x34_LTME) if (x34_LTME)
__isz = x34_LTME.binarySize(__isz + 4); {
s += 4;
x34_LTME.binarySize(s);
}
if (x38_ILOC) if (x38_ILOC)
__isz = x38_ILOC.binarySize(__isz + 4); {
s += 4;
x38_ILOC.binarySize(s);
}
if (x3c_IVEC) if (x3c_IVEC)
__isz = x3c_IVEC.binarySize(__isz + 4); {
s += 4;
x3c_IVEC.binarySize(s);
}
if (x40_EMTR) if (x40_EMTR)
__isz = x40_EMTR.binarySize(__isz + 4); {
s += 4;
x40_EMTR.binarySize(s);
}
if (x44_24_LINE) if (x44_24_LINE)
__isz += 9; s += 9;
if (x44_25_FXLL) if (x44_25_FXLL)
__isz += 9; s += 9;
if (x44_26_AAPH) if (x44_26_AAPH)
__isz += 9; s += 9;
if (x44_27_ZBUF) if (x44_27_ZBUF)
__isz += 9; s += 9;
if (x44_28_SORT) if (x44_28_SORT)
__isz += 9; s += 9;
if (x44_29_LIT_) if (x44_29_LIT_)
__isz += 9; s += 9;
if (x44_30_MBLR) if (x44_30_MBLR)
__isz += 9; s += 9;
if (x44_31_PMAB) if (x44_31_PMAB)
__isz += 9; s += 9;
if (x45_24_PMUS) if (x45_24_PMUS)
__isz += 9; s += 9;
if (!x45_25_PMOO) if (!x45_25_PMOO)
__isz += 9; s += 9;
if (x45_26_VMD1) if (x45_26_VMD1)
__isz += 9; s += 9;
if (x45_27_VMD2) if (x45_27_VMD2)
__isz += 9; s += 9;
if (x45_28_VMD3) if (x45_28_VMD3)
__isz += 9; s += 9;
if (x45_29_VMD4) if (x45_29_VMD4)
__isz += 9; s += 9;
if (x45_30_CIND) if (x45_30_CIND)
__isz += 9; s += 9;
if (x45_31_OPTS) if (x45_31_OPTS)
__isz += 9; s += 9;
if (x30_30_ORNT) if (x30_30_ORNT)
__isz += 9; s += 9;
if (x30_31_RSOP) if (x30_31_RSOP)
__isz += 9; s += 9;
if (x48_MBSP) if (x48_MBSP)
__isz = x48_MBSP.binarySize(__isz + 4); {
s += 4;
x48_MBSP.binarySize(s);
}
if (x4c_SIZE) if (x4c_SIZE)
__isz = x4c_SIZE.binarySize(__isz + 4); {
s += 4;
x4c_SIZE.binarySize(s);
}
if (x50_ROTA) if (x50_ROTA)
__isz = x50_ROTA.binarySize(__isz + 4); {
s += 4;
x50_ROTA.binarySize(s);
}
if (x54_TEXR) if (x54_TEXR)
__isz = x54_TEXR.binarySize(__isz + 4); {
s += 4;
x54_TEXR.binarySize(s);
}
if (x58_TIND) if (x58_TIND)
__isz = x58_TIND.binarySize(__isz + 4); {
s += 4;
x58_TIND.binarySize(s);
}
if (x5c_PMDL) if (x5c_PMDL)
__isz = x5c_PMDL.binarySize(__isz + 4); {
s += 4;
x5c_PMDL.binarySize(s);
}
if (x6c_PMOP) if (x6c_PMOP)
__isz = x6c_PMOP.binarySize(__isz + 4); {
s += 4;
x6c_PMOP.binarySize(s);
}
if (x70_PMRT) if (x70_PMRT)
__isz = x70_PMRT.binarySize(__isz + 4); {
s += 4;
x70_PMRT.binarySize(s);
}
if (x74_PMSC) if (x74_PMSC)
__isz = x74_PMSC.binarySize(__isz + 4); {
s += 4;
x74_PMSC.binarySize(s);
}
if (x78_PMCL) if (x78_PMCL)
__isz = x78_PMCL.binarySize(__isz + 4); {
s += 4;
x78_PMCL.binarySize(s);
}
if (x7c_VEL1) if (x7c_VEL1)
__isz = x7c_VEL1.binarySize(__isz + 4); {
s += 4;
x7c_VEL1.binarySize(s);
}
if (x80_VEL2) if (x80_VEL2)
__isz = x80_VEL2.binarySize(__isz + 4); {
s += 4;
x80_VEL2.binarySize(s);
}
if (x84_VEL3) if (x84_VEL3)
__isz = x84_VEL3.binarySize(__isz + 4); {
s += 4;
x84_VEL3.binarySize(s);
}
if (x88_VEL4) if (x88_VEL4)
__isz = x88_VEL4.binarySize(__isz + 4); {
s += 4;
x88_VEL4.binarySize(s);
}
if (x8c_ICTS) if (x8c_ICTS)
__isz = x8c_ICTS.binarySize(__isz + 4); {
s += 4;
x8c_ICTS.binarySize(s);
}
if (x9c_NCSY) if (x9c_NCSY)
__isz = x9c_NCSY.binarySize(__isz + 4); {
s += 4;
x9c_NCSY.binarySize(s);
}
if (xa0_CSSD) if (xa0_CSSD)
__isz = xa0_CSSD.binarySize(__isz + 4); {
s += 4;
xa0_CSSD.binarySize(s);
}
if (xa4_IDTS) if (xa4_IDTS)
__isz = xa4_IDTS.binarySize(__isz + 4); {
s += 4;
xa4_IDTS.binarySize(s);
}
if (xb4_NDSY) if (xb4_NDSY)
__isz = xb4_NDSY.binarySize(__isz + 4); {
s += 4;
xb4_NDSY.binarySize(s);
}
if (xb8_IITS) if (xb8_IITS)
__isz = xb8_IITS.binarySize(__isz + 4); {
s += 4;
xb8_IITS.binarySize(s);
}
if (xc8_PISY) if (xc8_PISY)
__isz = xc8_PISY.binarySize(__isz + 4); {
s += 4;
xc8_PISY.binarySize(s);
}
if (xcc_SISY) if (xcc_SISY)
__isz = xcc_SISY.binarySize(__isz + 4); {
s += 4;
xcc_SISY.binarySize(s);
}
if (xd0_KSSM) if (xd0_KSSM)
__isz = xd0_KSSM.binarySize(__isz + 4); {
s += 4;
xd0_KSSM.binarySize(s);
}
if (xd4_SSWH) if (xd4_SSWH)
__isz = xd4_SSWH.binarySize(__isz + 4); {
s += 4;
xd4_SSWH.binarySize(s);
}
if (xd8_SELC) if (xd8_SELC)
__isz = xd8_SELC.binarySize(__isz + 4); {
s += 4;
xd8_SELC.binarySize(s);
}
if (xe4_SSSD) if (xe4_SSSD)
__isz = xe4_SSSD.binarySize(__isz + 4); {
s += 4;
xe4_SSSD.binarySize(s);
}
if (xe8_SSPO) if (xe8_SSPO)
__isz = xe8_SSPO.binarySize(__isz + 4); {
s += 4;
xe8_SSPO.binarySize(s);
}
if (xf8_SESD) if (xf8_SESD)
__isz = xf8_SESD.binarySize(__isz + 4); {
s += 4;
xf8_SESD.binarySize(s);
}
if (xfc_SEPO) if (xfc_SEPO)
__isz = xfc_SEPO.binarySize(__isz + 4); {
s += 4;
xfc_SEPO.binarySize(s);
}
if (xec_PMLC) if (xec_PMLC)
__isz = xec_PMLC.binarySize(__isz + 4); {
s += 4;
xec_PMLC.binarySize(s);
}
if (x100_LTYP) if (x100_LTYP)
__isz = x100_LTYP.binarySize(__isz + 4); {
s += 4;
x100_LTYP.binarySize(s);
}
if (x104_LCLR) if (x104_LCLR)
__isz = x104_LCLR.binarySize(__isz + 4); {
s += 4;
x104_LCLR.binarySize(s);
}
if (x108_LINT) if (x108_LINT)
__isz = x108_LINT.binarySize(__isz + 4); {
s += 4;
x108_LINT.binarySize(s);
}
if (x10c_LOFF) if (x10c_LOFF)
__isz = x10c_LOFF.binarySize(__isz + 4); {
s += 4;
x10c_LOFF.binarySize(s);
}
if (x110_LDIR) if (x110_LDIR)
__isz = x110_LDIR.binarySize(__isz + 4); {
s += 4;
x110_LDIR.binarySize(s);
}
if (x114_LFOT) if (x114_LFOT)
__isz = x114_LFOT.binarySize(__isz + 4); {
s += 4;
x114_LFOT.binarySize(s);
}
if (x118_LFOR) if (x118_LFOR)
__isz = x118_LFOR.binarySize(__isz + 4); {
s += 4;
x118_LFOR.binarySize(s);
}
if (x11c_LSLA) if (x11c_LSLA)
__isz = x11c_LSLA.binarySize(__isz + 4); {
s += 4;
x11c_LSLA.binarySize(s);
}
if (x10c_ADV1) if (x10c_ADV1)
__isz = x10c_ADV1.binarySize(__isz + 4); {
s += 4;
x10c_ADV1.binarySize(s);
}
if (x110_ADV2) if (x110_ADV2)
__isz = x110_ADV2.binarySize(__isz + 4); {
s += 4;
x110_ADV2.binarySize(s);
}
if (x114_ADV3) if (x114_ADV3)
__isz = x114_ADV3.binarySize(__isz + 4); {
s += 4;
x114_ADV3.binarySize(s);
}
if (x118_ADV4) if (x118_ADV4)
__isz = x118_ADV4.binarySize(__isz + 4); {
s += 4;
x118_ADV4.binarySize(s);
}
if (x11c_ADV5) if (x11c_ADV5)
__isz = x11c_ADV5.binarySize(__isz + 4); {
s += 4;
x11c_ADV5.binarySize(s);
}
if (x120_ADV6) if (x120_ADV6)
__isz = x120_ADV6.binarySize(__isz + 4); {
s += 4;
x120_ADV6.binarySize(s);
}
if (x124_ADV7) if (x124_ADV7)
__isz = x124_ADV7.binarySize(__isz + 4); {
s += 4;
x124_ADV7.binarySize(s);
}
if (x128_ADV8) if (x128_ADV8)
__isz = x128_ADV8.binarySize(__isz + 4); {
return __isz; s += 4;
x128_ADV8.binarySize(s);
}
} }
template <class IDType> template <class IDType>
void GPSM<IDType>::read(athena::io::IStreamReader& r) void GPSM<IDType>::_read(typename Read::StreamT& r)
{ {
uint32_t clsId; uint32_t clsId;
r.readBytesToBuf(&clsId, 4); r.readBytesToBuf(&clsId, 4);
@ -949,7 +1143,7 @@ void GPSM<IDType>::read(athena::io::IStreamReader& r)
} }
template <class IDType> template <class IDType>
void GPSM<IDType>::write(athena::io::IStreamWriter& w) const void GPSM<IDType>::_write(typename Write::StreamT& w) const
{ {
w.writeBytes((atInt8*)"GPSM", 4); w.writeBytes((atInt8*)"GPSM", 4);
if (x0_PSIV) if (x0_PSIV)
@ -1342,6 +1536,9 @@ void GPSM<IDType>::write(athena::io::IStreamWriter& w) const
w.writeBytes("_END", 4); w.writeBytes("_END", 4);
} }
AT_SUBSPECIALIZE_DNA_YAML(GPSM<UniqueID32>)
AT_SUBSPECIALIZE_DNA_YAML(GPSM<UniqueID64>)
template <class IDType> template <class IDType>
void GPSM<IDType>::gatherDependencies(std::vector<hecl::ProjectPath>& pathsOut) const void GPSM<IDType>::gatherDependencies(std::vector<hecl::ProjectPath>& pathsOut) const
{ {
@ -1370,7 +1567,7 @@ bool ExtractGPSM(PAKEntryReadStream& rs, const hecl::ProjectPath& outPath)
{ {
GPSM<IDType> gpsm; GPSM<IDType> gpsm;
gpsm.read(rs); gpsm.read(rs);
gpsm.toYAMLStream(writer); athena::io::ToYAMLStream(gpsm, writer);
return true; return true;
} }
return false; return false;

View File

@ -9,11 +9,10 @@ namespace DataSpec::DNAParticle
{ {
template <class IDType> template <class IDType>
struct GPSM : BigYAML struct GPSM : BigDNA
{ {
static const char* DNAType() {return "GPSM";} AT_DECL_EXPLICIT_DNA_YAML
const char* DNATypeV() const {return DNAType();} AT_SUBDECL_DNA
VectorElementFactory x0_PSIV; VectorElementFactory x0_PSIV;
ModVectorElementFactory x4_PSVM; ModVectorElementFactory x4_PSVM;
VectorElementFactory x8_PSOV; VectorElementFactory x8_PSOV;
@ -105,12 +104,6 @@ struct GPSM : BigYAML
x45_25_PMOO = true; x45_25_PMOO = true;
} }
void read(athena::io::YAMLDocReader& r);
void write(athena::io::YAMLDocWriter& w) const;
size_t binarySize(size_t __isz) const;
void read(athena::io::IStreamReader& r);
void write(athena::io::IStreamWriter& w) const;
void gatherDependencies(std::vector<hecl::ProjectPath>&) const; void gatherDependencies(std::vector<hecl::ProjectPath>&) const;
}; };

View File

@ -4,7 +4,180 @@ namespace DataSpec::DNAParticle
{ {
logvisor::Module LogModule("urde::DNAParticle"); logvisor::Module LogModule("urde::DNAParticle");
void RealElementFactory::read(athena::io::YAMLDocReader& r) template <>
void REConstant::Enumerate<BigDNA::ReadYaml>(typename ReadYaml::StreamT& r)
{
val = r.readFloat(nullptr);
}
template <>
void REConstant::Enumerate<BigDNA::WriteYaml>(typename WriteYaml::StreamT& w)
{
w.writeFloat(nullptr, val);
}
template <>
void REConstant::Enumerate<BigDNA::BinarySize>(typename BinarySize::StreamT& s)
{
s += 4;
}
template <>
void REConstant::Enumerate<BigDNA::Read>(typename Read::StreamT& r)
{
val = r.readFloatBig();
}
template <>
void REConstant::Enumerate<BigDNA::Write>(typename Write::StreamT& w)
{
w.writeFloatBig(val);
}
template <>
void IEConstant::Enumerate<BigDNA::ReadYaml>(typename ReadYaml::StreamT& r)
{
val = r.readUint32(nullptr);
}
template <>
void IEConstant::Enumerate<BigDNA::WriteYaml>(typename WriteYaml::StreamT& w)
{
w.writeUint32(nullptr, val);
}
template <>
void IEConstant::Enumerate<BigDNA::BinarySize>(typename BinarySize::StreamT& s)
{
s += 4;
}
template <>
void IEConstant::Enumerate<BigDNA::Read>(typename Read::StreamT& r)
{
val = r.readUint32Big();
}
template <>
void IEConstant::Enumerate<BigDNA::Write>(typename Write::StreamT& w)
{
w.writeUint32Big(val);
}
template <>
void VEConstant::Enumerate<BigDNA::ReadYaml>(typename ReadYaml::StreamT& r)
{
size_t elemCount;
if (auto v = r.enterSubVector(nullptr, elemCount))
{
for (int i=0 ; i<3 && i<elemCount ; ++i)
{
if (auto rec = r.enterSubRecord(nullptr))
comps[i].read(r);
}
}
}
template <>
void VEConstant::Enumerate<BigDNA::WriteYaml>(typename WriteYaml::StreamT& w)
{
if (auto v = w.enterSubVector(nullptr))
for (int i=0 ; i<3 ; ++i)
if (auto rec = w.enterSubRecord(nullptr))
comps[i].write(w);
}
template <>
void VEConstant::Enumerate<BigDNA::BinarySize>(typename BinarySize::StreamT& s)
{
comps[0].binarySize(s);
comps[1].binarySize(s);
comps[2].binarySize(s);
}
template <>
void VEConstant::Enumerate<BigDNA::Read>(typename Read::StreamT& r)
{
comps[0].read(r);
comps[1].read(r);
comps[2].read(r);
}
template <>
void VEConstant::Enumerate<BigDNA::Write>(typename Write::StreamT& w)
{
comps[0].write(w);
comps[1].write(w);
comps[2].write(w);
}
template <>
void CEConstant::Enumerate<BigDNA::ReadYaml>(typename ReadYaml::StreamT& r)
{
for (int i=0 ; i<4 ; ++i)
if (auto rec = r.enterSubRecord(nullptr))
comps[i].read(r);
}
template <>
void CEConstant::Enumerate<BigDNA::WriteYaml>(typename WriteYaml::StreamT& w)
{
if (auto v = w.enterSubVector(nullptr))
for (int i=0 ; i<4 ; ++i)
if (auto rec = w.enterSubRecord(nullptr))
comps[i].write(w);
}
template <>
void CEConstant::Enumerate<BigDNA::BinarySize>(typename BinarySize::StreamT& s)
{
comps[0].binarySize(s);
comps[1].binarySize(s);
comps[2].binarySize(s);
comps[3].binarySize(s);
}
template <>
void CEConstant::Enumerate<BigDNA::Read>(typename Read::StreamT& r)
{
comps[0].read(r);
comps[1].read(r);
comps[2].read(r);
comps[3].read(r);
}
template <>
void CEConstant::Enumerate<BigDNA::Write>(typename Write::StreamT& w)
{
comps[0].write(w);
comps[1].write(w);
comps[2].write(w);
comps[3].write(w);
}
template <>
void MVEConstant::Enumerate<BigDNA::ReadYaml>(typename ReadYaml::StreamT& r)
{
for (int i=0 ; i<3 ; ++i)
if (auto rec = r.enterSubRecord(nullptr))
comps[i].read(r);
}
template <>
void MVEConstant::Enumerate<BigDNA::WriteYaml>(typename WriteYaml::StreamT& w)
{
if (auto v = w.enterSubVector(nullptr))
for (int i=0 ; i<3 ; ++i)
if (auto rec = w.enterSubRecord(nullptr))
comps[i].write(w);
}
template <>
void MVEConstant::Enumerate<BigDNA::BinarySize>(typename BinarySize::StreamT& s)
{
comps[0].binarySize(s);
comps[1].binarySize(s);
comps[2].binarySize(s);
}
template <>
void MVEConstant::Enumerate<BigDNA::Read>(typename Read::StreamT& r)
{
comps[0].read(r);
comps[1].read(r);
comps[2].read(r);
}
template <>
void MVEConstant::Enumerate<BigDNA::Write>(typename Write::StreamT& w)
{
comps[0].write(w);
comps[1].write(w);
comps[2].write(w);
}
template <>
void RealElementFactory::Enumerate<BigDNA::ReadYaml>(typename ReadYaml::StreamT& r)
{ {
const auto& mapChildren = r.getCurNode()->m_mapChildren; const auto& mapChildren = r.getCurNode()->m_mapChildren;
if (mapChildren.empty()) if (mapChildren.empty())
@ -127,22 +300,24 @@ void RealElementFactory::read(athena::io::YAMLDocReader& r)
m_elem->read(r); m_elem->read(r);
} }
void RealElementFactory::write(athena::io::YAMLDocWriter& w) const template <>
void RealElementFactory::Enumerate<BigDNA::WriteYaml>(typename WriteYaml::StreamT& w)
{ {
if (m_elem) if (m_elem)
if (auto rec = w.enterSubRecord(m_elem->ClassID())) if (auto rec = w.enterSubRecord(m_elem->ClassID()))
m_elem->write(w); m_elem->write(w);
} }
size_t RealElementFactory::binarySize(size_t __isz) const template <>
void RealElementFactory::Enumerate<BigDNA::BinarySize>(typename BinarySize::StreamT& s)
{ {
s += 4;
if (m_elem) if (m_elem)
return m_elem->binarySize(__isz + 4); m_elem->binarySize(s);
else
return __isz + 4;
} }
void RealElementFactory::read(athena::io::IStreamReader& r) template <>
void RealElementFactory::Enumerate<BigDNA::Read>(typename Read::StreamT& r)
{ {
uint32_t clsId; uint32_t clsId;
r.readBytesToBuf(&clsId, 4); r.readBytesToBuf(&clsId, 4);
@ -259,7 +434,8 @@ void RealElementFactory::read(athena::io::IStreamReader& r)
m_elem->read(r); m_elem->read(r);
} }
void RealElementFactory::write(athena::io::IStreamWriter& w) const template <>
void RealElementFactory::Enumerate<BigDNA::Write>(typename Write::StreamT& w)
{ {
if (m_elem) if (m_elem)
{ {
@ -271,7 +447,8 @@ void RealElementFactory::write(athena::io::IStreamWriter& w) const
} }
void IntElementFactory::read(athena::io::YAMLDocReader& r) template <>
void IntElementFactory::Enumerate<BigDNA::ReadYaml>(typename ReadYaml::StreamT& r)
{ {
const auto& mapChildren = r.getCurNode()->m_mapChildren; const auto& mapChildren = r.getCurNode()->m_mapChildren;
if (mapChildren.empty()) if (mapChildren.empty())
@ -346,22 +523,24 @@ void IntElementFactory::read(athena::io::YAMLDocReader& r)
m_elem->read(r); m_elem->read(r);
} }
void IntElementFactory::write(athena::io::YAMLDocWriter& w) const template <>
void IntElementFactory::Enumerate<BigDNA::WriteYaml>(typename WriteYaml::StreamT& w)
{ {
if (m_elem) if (m_elem)
if (auto rec = w.enterSubRecord(m_elem->ClassID())) if (auto rec = w.enterSubRecord(m_elem->ClassID()))
m_elem->write(w); m_elem->write(w);
} }
size_t IntElementFactory::binarySize(size_t __isz) const template <>
void IntElementFactory::Enumerate<BigDNA::BinarySize>(typename BinarySize::StreamT& s)
{ {
s += 4;
if (m_elem) if (m_elem)
return m_elem->binarySize(__isz + 4); m_elem->binarySize(s);
else
return __isz + 4;
} }
void IntElementFactory::read(athena::io::IStreamReader& r) template <>
void IntElementFactory::Enumerate<BigDNA::Read>(typename Read::StreamT& r)
{ {
uint32_t clsId; uint32_t clsId;
r.readBytesToBuf(&clsId, 4); r.readBytesToBuf(&clsId, 4);
@ -430,7 +609,8 @@ void IntElementFactory::read(athena::io::IStreamReader& r)
m_elem->read(r); m_elem->read(r);
} }
void IntElementFactory::write(athena::io::IStreamWriter& w) const template <>
void IntElementFactory::Enumerate<BigDNA::Write>(typename Write::StreamT& w)
{ {
if (m_elem) if (m_elem)
{ {
@ -441,7 +621,8 @@ void IntElementFactory::write(athena::io::IStreamWriter& w) const
w.writeBytes((atInt8*)"NONE", 4); w.writeBytes((atInt8*)"NONE", 4);
} }
void VectorElementFactory::read(athena::io::YAMLDocReader& r) template <>
void VectorElementFactory::Enumerate<BigDNA::ReadYaml>(typename ReadYaml::StreamT& r)
{ {
const auto& mapChildren = r.getCurNode()->m_mapChildren; const auto& mapChildren = r.getCurNode()->m_mapChildren;
if (mapChildren.empty()) if (mapChildren.empty())
@ -516,22 +697,24 @@ void VectorElementFactory::read(athena::io::YAMLDocReader& r)
m_elem->read(r); m_elem->read(r);
} }
void VectorElementFactory::write(athena::io::YAMLDocWriter& w) const template <>
void VectorElementFactory::Enumerate<BigDNA::WriteYaml>(typename WriteYaml::StreamT& w)
{ {
if (m_elem) if (m_elem)
if (auto rec = w.enterSubRecord(m_elem->ClassID())) if (auto rec = w.enterSubRecord(m_elem->ClassID()))
m_elem->write(w); m_elem->write(w);
} }
size_t VectorElementFactory::binarySize(size_t __isz) const template <>
void VectorElementFactory::Enumerate<BigDNA::BinarySize>(typename BinarySize::StreamT& s)
{ {
s += 4;
if (m_elem) if (m_elem)
return m_elem->binarySize(__isz + 4); m_elem->binarySize(s);
else
return __isz + 4;
} }
void VectorElementFactory::read(athena::io::IStreamReader& r) template <>
void VectorElementFactory::Enumerate<BigDNA::Read>(typename Read::StreamT& r)
{ {
uint32_t clsId; uint32_t clsId;
r.readBytesToBuf(&clsId, 4); r.readBytesToBuf(&clsId, 4);
@ -600,7 +783,8 @@ void VectorElementFactory::read(athena::io::IStreamReader& r)
m_elem->read(r); m_elem->read(r);
} }
void VectorElementFactory::write(athena::io::IStreamWriter& w) const template <>
void VectorElementFactory::Enumerate<BigDNA::Write>(typename Write::StreamT& w)
{ {
if (m_elem) if (m_elem)
{ {
@ -612,7 +796,8 @@ void VectorElementFactory::write(athena::io::IStreamWriter& w) const
} }
void ColorElementFactory::read(athena::io::YAMLDocReader& r) template <>
void ColorElementFactory::Enumerate<BigDNA::ReadYaml>(typename ReadYaml::StreamT& r)
{ {
const auto& mapChildren = r.getCurNode()->m_mapChildren; const auto& mapChildren = r.getCurNode()->m_mapChildren;
if (mapChildren.empty()) if (mapChildren.empty())
@ -654,22 +839,24 @@ void ColorElementFactory::read(athena::io::YAMLDocReader& r)
m_elem->read(r); m_elem->read(r);
} }
void ColorElementFactory::write(athena::io::YAMLDocWriter& w) const template <>
void ColorElementFactory::Enumerate<BigDNA::WriteYaml>(typename WriteYaml::StreamT& w)
{ {
if (m_elem) if (m_elem)
if (auto rec = w.enterSubRecord(m_elem->ClassID())) if (auto rec = w.enterSubRecord(m_elem->ClassID()))
m_elem->write(w); m_elem->write(w);
} }
size_t ColorElementFactory::binarySize(size_t __isz) const template <>
void ColorElementFactory::Enumerate<BigDNA::BinarySize>(typename BinarySize::StreamT& s)
{ {
s += 4;
if (m_elem) if (m_elem)
return m_elem->binarySize(__isz + 4); m_elem->binarySize(s);
else
return __isz + 4;
} }
void ColorElementFactory::read(athena::io::IStreamReader& r) template <>
void ColorElementFactory::Enumerate<BigDNA::Read>(typename Read::StreamT& r)
{ {
uint32_t clsId; uint32_t clsId;
r.readBytesToBuf(&clsId, 4); r.readBytesToBuf(&clsId, 4);
@ -705,7 +892,8 @@ void ColorElementFactory::read(athena::io::IStreamReader& r)
m_elem->read(r); m_elem->read(r);
} }
void ColorElementFactory::write(athena::io::IStreamWriter& w) const template <>
void ColorElementFactory::Enumerate<BigDNA::Write>(typename Write::StreamT& w)
{ {
if (m_elem) if (m_elem)
{ {
@ -717,7 +905,8 @@ void ColorElementFactory::write(athena::io::IStreamWriter& w) const
} }
void ModVectorElementFactory::read(athena::io::YAMLDocReader& r) template <>
void ModVectorElementFactory::Enumerate<BigDNA::ReadYaml>(typename ReadYaml::StreamT& r)
{ {
const auto& mapChildren = r.getCurNode()->m_mapChildren; const auto& mapChildren = r.getCurNode()->m_mapChildren;
if (mapChildren.empty()) if (mapChildren.empty())
@ -776,22 +965,24 @@ void ModVectorElementFactory::read(athena::io::YAMLDocReader& r)
m_elem->read(r); m_elem->read(r);
} }
void ModVectorElementFactory::write(athena::io::YAMLDocWriter& w) const template <>
void ModVectorElementFactory::Enumerate<BigDNA::WriteYaml>(typename WriteYaml::StreamT& w)
{ {
if (m_elem) if (m_elem)
if (auto rec = w.enterSubRecord(m_elem->ClassID())) if (auto rec = w.enterSubRecord(m_elem->ClassID()))
m_elem->write(w); m_elem->write(w);
} }
size_t ModVectorElementFactory::binarySize(size_t __isz) const template <>
void ModVectorElementFactory::Enumerate<BigDNA::BinarySize>(typename BinarySize::StreamT& s)
{ {
s += 4;
if (m_elem) if (m_elem)
return m_elem->binarySize(__isz + 4); m_elem->binarySize(s);
else
return __isz + 4;
} }
void ModVectorElementFactory::read(athena::io::IStreamReader& r) template <>
void ModVectorElementFactory::Enumerate<BigDNA::Read>(typename Read::StreamT& r)
{ {
uint32_t clsId; uint32_t clsId;
r.readBytesToBuf(&clsId, 4); r.readBytesToBuf(&clsId, 4);
@ -844,7 +1035,8 @@ void ModVectorElementFactory::read(athena::io::IStreamReader& r)
m_elem->read(r); m_elem->read(r);
} }
void ModVectorElementFactory::write(athena::io::IStreamWriter& w) const template <>
void ModVectorElementFactory::Enumerate<BigDNA::Write>(typename Write::StreamT& w)
{ {
if (m_elem) if (m_elem)
{ {
@ -856,7 +1048,8 @@ void ModVectorElementFactory::write(athena::io::IStreamWriter& w) const
} }
void EmitterElementFactory::read(athena::io::YAMLDocReader& r) template <>
void EmitterElementFactory::Enumerate<BigDNA::ReadYaml>(typename ReadYaml::StreamT& r)
{ {
const auto& mapChildren = r.getCurNode()->m_mapChildren; const auto& mapChildren = r.getCurNode()->m_mapChildren;
if (mapChildren.empty()) if (mapChildren.empty())
@ -891,22 +1084,24 @@ void EmitterElementFactory::read(athena::io::YAMLDocReader& r)
m_elem->read(r); m_elem->read(r);
} }
void EmitterElementFactory::write(athena::io::YAMLDocWriter& w) const template <>
void EmitterElementFactory::Enumerate<BigDNA::WriteYaml>(typename WriteYaml::StreamT& w)
{ {
if (m_elem) if (m_elem)
if (auto rec = w.enterSubRecord(m_elem->ClassID())) if (auto rec = w.enterSubRecord(m_elem->ClassID()))
m_elem->write(w); m_elem->write(w);
} }
size_t EmitterElementFactory::binarySize(size_t __isz) const template <>
void EmitterElementFactory::Enumerate<BigDNA::BinarySize>(typename BinarySize::StreamT& s)
{ {
s += 4;
if (m_elem) if (m_elem)
return m_elem->binarySize(__isz + 4); m_elem->binarySize(s);
else
return __isz + 4;
} }
void EmitterElementFactory::read(athena::io::IStreamReader& r) template <>
void EmitterElementFactory::Enumerate<BigDNA::Read>(typename Read::StreamT& r)
{ {
uint32_t clsId; uint32_t clsId;
r.readBytesToBuf(&clsId, 4); r.readBytesToBuf(&clsId, 4);
@ -935,7 +1130,8 @@ void EmitterElementFactory::read(athena::io::IStreamReader& r)
m_elem->read(r); m_elem->read(r);
} }
void EmitterElementFactory::write(athena::io::IStreamWriter& w) const template <>
void EmitterElementFactory::Enumerate<BigDNA::Write>(typename Write::StreamT& w)
{ {
if (m_elem) if (m_elem)
{ {
@ -946,4 +1142,473 @@ void EmitterElementFactory::write(athena::io::IStreamWriter& w) const
w.writeBytes((atInt8*)"NONE", 4); w.writeBytes((atInt8*)"NONE", 4);
} }
template <>
void BoolHelper::Enumerate<BigDNA::ReadYaml>(typename ReadYaml::StreamT& r)
{
value = r.readBool(nullptr);
}
template <>
void BoolHelper::Enumerate<BigDNA::WriteYaml>(typename WriteYaml::StreamT& w)
{
w.writeBool(nullptr, value);
}
template <>
void BoolHelper::Enumerate<BigDNA::BinarySize>(typename BinarySize::StreamT& s)
{
s += 5;
}
template <>
void BoolHelper::Enumerate<BigDNA::Read>(typename Read::StreamT& r)
{
uint32_t clsId;
r.readBytesToBuf(&clsId, 4);
if (clsId == SBIG('CNST'))
value = r.readBool();
else
value = false;
}
template <>
void BoolHelper::Enumerate<BigDNA::Write>(typename Write::StreamT& w)
{
w.writeBytes((atInt8*)"CNST", 4);
w.writeBool(value);
}
template <>
void EESimpleEmitterTR::Enumerate<BigDNA::ReadYaml>(typename ReadYaml::StreamT& r)
{
position.m_elem.reset();
velocity.m_elem.reset();
if (auto rec = r.enterSubRecord("ILOC"))
position.read(r);
if (auto rec = r.enterSubRecord("IVEC"))
velocity.read(r);
}
template <>
void EESimpleEmitterTR::Enumerate<BigDNA::WriteYaml>(typename WriteYaml::StreamT& w)
{
if (auto rec = w.enterSubRecord("ILOC"))
position.write(w);
if (auto rec = w.enterSubRecord("IVEC"))
velocity.write(w);
}
template <>
void EESimpleEmitterTR::Enumerate<BigDNA::BinarySize>(typename BinarySize::StreamT& s)
{
s += 8;
position.binarySize(s);
velocity.binarySize(s);
}
template <>
void EESimpleEmitterTR::Enumerate<BigDNA::Read>(typename Read::StreamT& r)
{
position.m_elem.reset();
velocity.m_elem.reset();
uint32_t clsId;
r.readBytesToBuf(&clsId, 4);
if (clsId == SBIG('ILOC'))
{
position.read(r);
r.readBytesToBuf(&clsId, 4);
if (clsId == SBIG('IVEC'))
velocity.read(r);
}
}
template <>
void EESimpleEmitterTR::Enumerate<BigDNA::Write>(typename Write::StreamT& w)
{
w.writeBytes((atInt8*)"ILOC", 4);
position.write(w);
w.writeBytes((atInt8*)"IVEC", 4);
velocity.write(w);
}
template <class IDType>
void UVEConstant<IDType>::_read(typename ReadYaml::StreamT& r)
{
tex.clear();
if (auto rec = r.enterSubRecord("tex"))
tex.read(r);
}
template <class IDType>
void UVEConstant<IDType>::_write(typename WriteYaml::StreamT& w) const
{
if (auto rec = w.enterSubRecord("tex"))
tex.write(w);
}
template <class IDType>
void UVEConstant<IDType>::_binarySize(typename BinarySize::StreamT& _s) const
{
_s += 4;
tex.binarySize(_s);
}
template <class IDType>
void UVEConstant<IDType>::_read(typename Read::StreamT& r)
{
tex.clear();
uint32_t clsId;
r.readBytesToBuf(&clsId, 4);
if (clsId == SBIG('CNST'))
tex.read(r);
}
template <class IDType>
void UVEConstant<IDType>::_write(typename Write::StreamT& w) const
{
w.writeBytes((atInt8*)"CNST", 4);
tex.write(w);
}
AT_SUBSPECIALIZE_DNA_YAML(UVEConstant<UniqueID32>)
AT_SUBSPECIALIZE_DNA_YAML(UVEConstant<UniqueID64>)
template struct UVEConstant<UniqueID32>;
template struct UVEConstant<UniqueID64>;
template <class IDType>
void UVEAnimTexture<IDType>::_read(typename ReadYaml::StreamT& r)
{
tex.clear();
if (auto rec = r.enterSubRecord("tex"))
tex.read(r);
if (auto rec = r.enterSubRecord("tileW"))
tileW.read(r);
if (auto rec = r.enterSubRecord("tileH"))
tileH.read(r);
if (auto rec = r.enterSubRecord("strideW"))
strideW.read(r);
if (auto rec = r.enterSubRecord("strideH"))
strideH.read(r);
if (auto rec = r.enterSubRecord("cycleFrames"))
cycleFrames.read(r);
if (auto rec = r.enterSubRecord("loop"))
loop = r.readBool(nullptr);
}
template <class IDType>
void UVEAnimTexture<IDType>::_write(typename WriteYaml::StreamT& w) const
{
if (auto rec = w.enterSubRecord("tex"))
tex.write(w);
if (auto rec = w.enterSubRecord("tileW"))
tileW.write(w);
if (auto rec = w.enterSubRecord("tileH"))
tileH.write(w);
if (auto rec = w.enterSubRecord("strideW"))
strideW.write(w);
if (auto rec = w.enterSubRecord("strideH"))
strideH.write(w);
if (auto rec = w.enterSubRecord("cycleFrames"))
cycleFrames.write(w);
w.writeBool("loop", loop);
}
template <class IDType>
void UVEAnimTexture<IDType>::_binarySize(typename BinarySize::StreamT& _s) const
{
_s += 9;
tex.binarySize(_s);
tileW.binarySize(_s);
tileH.binarySize(_s);
strideW.binarySize(_s);
strideH.binarySize(_s);
cycleFrames.binarySize(_s);
}
template <class IDType>
void UVEAnimTexture<IDType>::_read(typename Read::StreamT& r)
{
tex.clear();
uint32_t clsId;
r.readBytesToBuf(&clsId, 4);
if (clsId == SBIG('CNST'))
tex.read(r);
tileW.read(r);
tileH.read(r);
strideW.read(r);
strideH.read(r);
cycleFrames.read(r);
r.readBytesToBuf(&clsId, 4);
if (clsId == SBIG('CNST'))
loop = r.readBool();
}
template <class IDType>
void UVEAnimTexture<IDType>::_write(typename Write::StreamT& w) const
{
w.writeBytes((atInt8*)"CNST", 4);
tex.write(w);
tileW.write(w);
tileH.write(w);
strideW.write(w);
strideH.write(w);
cycleFrames.write(w);
w.writeBytes((atInt8*)"CNST", 4);
w.writeBool(loop);
}
AT_SUBSPECIALIZE_DNA_YAML(UVEAnimTexture<UniqueID32>)
AT_SUBSPECIALIZE_DNA_YAML(UVEAnimTexture<UniqueID64>)
template struct UVEAnimTexture<UniqueID32>;
template struct UVEAnimTexture<UniqueID64>;
template <class IDType>
void UVElementFactory<IDType>::_read(typename Read::StreamT& r)
{
uint32_t clsId;
r.readBytesToBuf(&clsId, 4);
switch (clsId)
{
case SBIG('CNST'):
m_elem.reset(new struct UVEConstant<IDType>);
break;
case SBIG('ATEX'):
m_elem.reset(new struct UVEAnimTexture<IDType>);
break;
default:
m_elem.reset();
return;
}
m_elem->read(r);
}
template <class IDType>
void UVElementFactory<IDType>::_write(typename Write::StreamT& w) const
{
if (m_elem)
{
w.writeBytes((atInt8*)m_elem->ClassID(), 4);
m_elem->write(w);
}
else
w.writeBytes((atInt8*)"NONE", 4);
}
template <class IDType>
void UVElementFactory<IDType>::_read(typename ReadYaml::StreamT& r)
{
if (auto rec = r.enterSubRecord("CNST"))
{
m_elem.reset(new struct UVEConstant<IDType>);
m_elem->read(r);
}
else if (auto rec = r.enterSubRecord("ATEX"))
{
m_elem.reset(new struct UVEAnimTexture<IDType>);
m_elem->read(r);
}
else
m_elem.reset();
}
template <class IDType>
void UVElementFactory<IDType>::_write(typename WriteYaml::StreamT& w) const
{
if (m_elem)
if (auto rec = w.enterSubRecord(m_elem->ClassID()))
m_elem->write(w);
}
template <class IDType>
void UVElementFactory<IDType>::_binarySize(typename BinarySize::StreamT& _s) const
{
if (m_elem)
m_elem->binarySize(_s);
_s += 4;
}
AT_SUBSPECIALIZE_DNA_YAML(UVElementFactory<UniqueID32>)
AT_SUBSPECIALIZE_DNA_YAML(UVElementFactory<UniqueID64>)
template struct UVElementFactory<UniqueID32>;
template struct UVElementFactory<UniqueID64>;
template <class IDType>
template <class Op>
void SpawnSystemKeyframeData<IDType>::SpawnSystemKeyframeInfo::Enumerate(typename Op::StreamT& s)
{
Do<Op>({"id"}, id, s);
Do<Op>({"a"}, a, s);
Do<Op>({"b"}, b, s);
Do<Op>({"c"}, c, s);
}
template <class IDType>
void SpawnSystemKeyframeData<IDType>::_read(typename ReadYaml::StreamT& r)
{
if (auto rec = r.enterSubRecord("a"))
a = r.readUint32(nullptr);
if (auto rec = r.enterSubRecord("b"))
b = r.readUint32(nullptr);
if (auto rec = r.enterSubRecord("endFrame"))
endFrame = r.readUint32(nullptr);
if (auto rec = r.enterSubRecord("d"))
d = r.readUint32(nullptr);
spawns.clear();
size_t spawnCount;
if (auto v = r.enterSubVector("spawns", spawnCount))
{
spawns.reserve(spawnCount);
for (const auto& child : r.getCurNode()->m_seqChildren)
{
if (auto rec = r.enterSubRecord(nullptr))
{
spawns.emplace_back();
spawns.back().first = r.readUint32("startFrame");
size_t systemCount;
if (auto v = r.enterSubVector("systems", systemCount))
{
spawns.back().second.reserve(systemCount);
for (const auto& in : r.getCurNode()->m_seqChildren)
{
spawns.back().second.emplace_back();
SpawnSystemKeyframeInfo& info = spawns.back().second.back();
if (auto rec = r.enterSubRecord(nullptr))
info.read(r);
}
}
}
}
}
}
template <class IDType>
void SpawnSystemKeyframeData<IDType>::_write(typename WriteYaml::StreamT& w) const
{
if (spawns.empty())
return;
w.writeUint32("a", a);
w.writeUint32("b", b);
w.writeUint32("endFrame", endFrame);
w.writeUint32("d", d);
if (auto v = w.enterSubVector("spawns"))
{
for (const auto& spawn : spawns)
{
if (auto rec = w.enterSubRecord(nullptr))
{
w.writeUint32("startFrame", spawn.first);
if (auto v = w.enterSubVector("systems"))
for (const auto& info : spawn.second)
if (auto rec = w.enterSubRecord(nullptr))
info.write(w);
}
}
}
}
template <class IDType>
void SpawnSystemKeyframeData<IDType>::_binarySize(typename BinarySize::StreamT& s) const
{
s += 20;
for (const auto& spawn : spawns)
{
s += 8;
for (const auto& info : spawn.second)
info.binarySize(s);
}
}
template <class IDType>
void SpawnSystemKeyframeData<IDType>::_read(typename Read::StreamT& r)
{
uint32_t clsId;
r.readBytesToBuf(&clsId, 4);
if (clsId != SBIG('CNST'))
return;
a = r.readUint32Big();
b = r.readUint32Big();
endFrame = r.readUint32Big();
d = r.readUint32Big();
uint32_t count = r.readUint32Big();
spawns.clear();
spawns.reserve(count);
for (size_t i=0 ; i<count ; ++i)
{
spawns.emplace_back();
spawns.back().first = r.readUint32Big();
uint32_t infoCount = r.readUint32Big();
spawns.back().second.reserve(infoCount);
for (size_t j=0 ; j<infoCount ; ++j)
{
spawns.back().second.emplace_back();
spawns.back().second.back().read(r);
}
}
}
template <class IDType>
void SpawnSystemKeyframeData<IDType>::_write(typename Write::StreamT& w) const
{
if (spawns.empty())
{
w.writeBytes((atInt8*)"NONE", 4);
return;
}
w.writeBytes((atInt8*)"CNST", 4);
w.writeUint32Big(a);
w.writeUint32Big(b);
w.writeUint32Big(endFrame);
w.writeUint32Big(d);
w.writeUint32Big(spawns.size());
for (const auto& spawn : spawns)
{
w.writeUint32Big(spawn.first);
w.writeUint32Big(spawn.second.size());
for (const auto& info : spawn.second)
info.write(w);
}
}
AT_SUBSPECIALIZE_DNA_YAML(SpawnSystemKeyframeData<UniqueID32>)
AT_SUBSPECIALIZE_DNA_YAML(SpawnSystemKeyframeData<UniqueID64>)
template struct SpawnSystemKeyframeData<UniqueID32>;
template struct SpawnSystemKeyframeData<UniqueID64>;
template <class IDType>
void ChildResourceFactory<IDType>::_read(typename ReadYaml::StreamT& r)
{
id.clear();
if (auto rec = r.enterSubRecord("CNST"))
id.read(r);
}
template <class IDType>
void ChildResourceFactory<IDType>::_write(typename WriteYaml::StreamT& w) const
{
if (id)
if (auto rec = w.enterSubRecord("CNST"))
id.write(w);
}
template <class IDType>
void ChildResourceFactory<IDType>::_binarySize(typename BinarySize::StreamT& s) const
{
if (id)
id.binarySize(s);
s += 4;
}
template <class IDType>
void ChildResourceFactory<IDType>::_read(typename Read::StreamT& r)
{
id.clear();
uint32_t clsId;
r.readBytesToBuf(&clsId, 4);
if (clsId == SBIG('CNST'))
id.read(r);
}
template <class IDType>
void ChildResourceFactory<IDType>::_write(typename Write::StreamT& w) const
{
if (id)
{
w.writeBytes((atInt8*)"CNST", 4);
id.write(w);
}
else
w.writeBytes((atInt8*)"NONE", 4);
}
AT_SUBSPECIALIZE_DNA_YAML(ChildResourceFactory<UniqueID32>)
AT_SUBSPECIALIZE_DNA_YAML(ChildResourceFactory<UniqueID64>)
template struct ChildResourceFactory<UniqueID32>;
template struct ChildResourceFactory<UniqueID64>;
} }

File diff suppressed because it is too large Load Diff

View File

@ -15,26 +15,26 @@ enum class EScanCategory
Artifact Artifact
}; };
struct Header : BigYAML struct Header : BigDNA
{ {
DECL_YAML AT_DECL_DNA_YAML
Value<atUint32> magic; Value<atUint32> magic;
Value<atUint32> version; Value<atUint32> version;
Value<atUint32> areaCount; Value<atUint32> areaCount;
}; };
struct EnvironmentVariable : BigYAML struct EnvironmentVariable : BigDNA
{ {
DECL_YAML AT_DECL_DNA_YAML
String<-1> name; String<-1> name;
Value<atUint32> unk1; Value<atUint32> unk1;
Value<atUint32> unk2; Value<atUint32> unk2;
Value<atUint32> unk3; Value<atUint32> unk3;
}; };
struct Layer : BigYAML struct Layer : BigDNA
{ {
DECL_YAML AT_DECL_DNA_YAML
Value<atUint32> areaId; Value<atUint32> areaId;
Value<atUint32> layer; Value<atUint32> layer;
}; };
@ -45,7 +45,7 @@ static bool ExtractSAVW(PAKEntryReadStream& rs, const hecl::ProjectPath& outPath
SAVW savw; SAVW savw;
savw.read(rs); savw.read(rs);
athena::io::FileWriter writer(outPath.getAbsolutePath()); athena::io::FileWriter writer(outPath.getAbsolutePath());
savw.toYAMLStream(writer); athena::io::ToYAMLStream(savw, writer);
return true; return true;
} }

View File

@ -10,9 +10,9 @@
namespace DataSpec namespace DataSpec
{ {
struct ISTRG : BigYAML struct ISTRG : BigDNAVYaml
{ {
virtual ~ISTRG() {} virtual ~ISTRG() = default;
virtual size_t count() const=0; virtual size_t count() const=0;
virtual std::string getUTF8(const FourCC& lang, size_t idx) const=0; virtual std::string getUTF8(const FourCC& lang, size_t idx) const=0;

View File

@ -3,8 +3,14 @@
namespace DataSpec::DNAParticle namespace DataSpec::DNAParticle
{ {
template <>
const char* SWSH<UniqueID32>::DNAType() { return "SWSH<UniqueID32>"; }
template <>
const char* SWSH<UniqueID64>::DNAType() { return "SWSH<UniqueID64>"; }
template <class IDType> template <class IDType>
void SWSH<IDType>::read(athena::io::YAMLDocReader& r) void SWSH<IDType>::_read(typename BigDNA::ReadYaml::StreamT& r)
{ {
for (const auto& elem : r.getCurNode()->m_mapChildren) for (const auto& elem : r.getCurNode()->m_mapChildren)
{ {
@ -108,7 +114,7 @@ void SWSH<IDType>::read(athena::io::YAMLDocReader& r)
} }
template <class IDType> template <class IDType>
void SWSH<IDType>::write(athena::io::YAMLDocWriter& w) const void SWSH<IDType>::_write(typename BigDNA::WriteYaml::StreamT& w) const
{ {
if (x0_PSLT) if (x0_PSLT)
if (auto rec = w.enterSubRecord("PSLT")) if (auto rec = w.enterSubRecord("PSLT"))
@ -188,71 +194,120 @@ void SWSH<IDType>::write(athena::io::YAMLDocWriter& w) const
template <class IDType> template <class IDType>
size_t SWSH<IDType>::binarySize(size_t __isz) const void SWSH<IDType>::_binarySize(typename BigDNA::BinarySize::StreamT& s) const
{ {
__isz += 4; s += 4;
if (x0_PSLT) if (x0_PSLT)
__isz = x0_PSLT.binarySize(__isz + 4); {
s += 4;
x0_PSLT.binarySize(s);
}
if (x4_TIME) if (x4_TIME)
__isz = x4_TIME.binarySize(__isz + 4); {
s += 4;
x4_TIME.binarySize(s);
}
if (x8_LRAD) if (x8_LRAD)
__isz = x8_LRAD.binarySize(__isz + 4); {
s += 4;
x8_LRAD.binarySize(s);
}
if (xc_RRAD) if (xc_RRAD)
__isz = xc_RRAD.binarySize(__isz + 4); {
s += 4;
xc_RRAD.binarySize(s);
}
if (x10_LENG) if (x10_LENG)
__isz = x10_LENG.binarySize(__isz + 4); {
s += 4;
x10_LENG.binarySize(s);
}
if (x14_COLR) if (x14_COLR)
__isz = x14_COLR.binarySize(__isz + 4); {
s += 4;
x14_COLR.binarySize(s);
}
if (x18_SIDE) if (x18_SIDE)
__isz = x18_SIDE.binarySize(__isz + 4); {
s += 4;
x18_SIDE.binarySize(s);
}
if (x1c_IROT) if (x1c_IROT)
__isz = x1c_IROT.binarySize(__isz + 4); {
s += 4;
x1c_IROT.binarySize(s);
}
if (x20_ROTM) if (x20_ROTM)
__isz = x20_ROTM.binarySize(__isz + 4); {
s += 4;
x20_ROTM.binarySize(s);
}
if (x24_POFS) if (x24_POFS)
__isz = x24_POFS.binarySize(__isz + 4); {
s += 4;
x24_POFS.binarySize(s);
}
if (x28_IVEL) if (x28_IVEL)
__isz = x28_IVEL.binarySize(__isz + 4); {
s += 4;
x28_IVEL.binarySize(s);
}
if (x2c_NPOS) if (x2c_NPOS)
__isz = x2c_NPOS.binarySize(__isz + 4); {
s += 4;
x2c_NPOS.binarySize(s);
}
if (x30_VELM) if (x30_VELM)
__isz = x30_VELM.binarySize(__isz + 4); {
s += 4;
x30_VELM.binarySize(s);
}
if (x34_VLM2) if (x34_VLM2)
__isz = x34_VLM2.binarySize(__isz + 4); {
s += 4;
x34_VLM2.binarySize(s);
}
if (x38_SPLN) if (x38_SPLN)
__isz = x38_SPLN.binarySize(__isz + 4); {
s += 4;
x38_SPLN.binarySize(s);
}
if (x3c_TEXR) if (x3c_TEXR)
__isz = x3c_TEXR.binarySize(__isz + 4); {
s += 4;
x3c_TEXR.binarySize(s);
}
if (x40_TSPN) if (x40_TSPN)
__isz = x40_TSPN.binarySize(__isz + 4); {
s += 4;
x40_TSPN.binarySize(s);
}
if (x44_24_LLRD) if (x44_24_LLRD)
__isz += 9; s += 9;
if (!x44_25_CROS) if (!x44_25_CROS)
__isz += 9; s += 9;
if (x44_26_VLS1) if (x44_26_VLS1)
__isz += 9; s += 9;
if (x44_27_VLS2) if (x44_27_VLS2)
__isz += 9; s += 9;
if (x44_28_SROT) if (x44_28_SROT)
__isz += 9; s += 9;
if (x44_29_WIRE) if (x44_29_WIRE)
__isz += 9; s += 9;
if (x44_30_TEXW) if (x44_30_TEXW)
__isz += 9; s += 9;
if (x44_31_AALP) if (x44_31_AALP)
__isz += 9; s += 9;
if (x45_24_ZBUF) if (x45_24_ZBUF)
__isz += 9; s += 9;
if (x45_25_ORNT) if (x45_25_ORNT)
__isz += 9; s += 9;
if (x45_26_CRND) if (x45_26_CRND)
__isz += 9; s += 9;
return __isz;
} }
template <class IDType> template <class IDType>
void SWSH<IDType>::read(athena::io::IStreamReader& r) void SWSH<IDType>::_read(typename BigDNA::Read::StreamT& r)
{ {
uint32_t clsId; uint32_t clsId;
r.readBytesToBuf(&clsId, 4); r.readBytesToBuf(&clsId, 4);
@ -371,7 +426,7 @@ void SWSH<IDType>::read(athena::io::IStreamReader& r)
} }
template <class IDType> template <class IDType>
void SWSH<IDType>::write(athena::io::IStreamWriter& w) const void SWSH<IDType>::_write(typename BigDNA::Write::StreamT& w) const
{ {
w.writeBytes((atInt8*)"SWSH", 4); w.writeBytes((atInt8*)"SWSH", 4);
if (x0_PSLT) if (x0_PSLT)
@ -485,6 +540,9 @@ void SWSH<IDType>::write(athena::io::IStreamWriter& w) const
w.writeBytes("_END", 4); w.writeBytes("_END", 4);
} }
AT_SUBSPECIALIZE_DNA_YAML(SWSH<UniqueID32>)
AT_SUBSPECIALIZE_DNA_YAML(SWSH<UniqueID64>)
template <class IDType> template <class IDType>
void SWSH<IDType>::gatherDependencies(std::vector<hecl::ProjectPath>& pathsOut) const void SWSH<IDType>::gatherDependencies(std::vector<hecl::ProjectPath>& pathsOut) const
{ {
@ -503,7 +561,7 @@ bool ExtractSWSH(PAKEntryReadStream& rs, const hecl::ProjectPath& outPath)
{ {
SWSH<IDType> swsh; SWSH<IDType> swsh;
swsh.read(rs); swsh.read(rs);
swsh.toYAMLStream(writer); athena::io::ToYAMLStream(swsh, writer);
return true; return true;
} }
return false; return false;

View File

@ -9,10 +9,10 @@ namespace DataSpec::DNAParticle
{ {
template <class IDType> template <class IDType>
struct SWSH : public BigYAML struct SWSH : public BigDNA
{ {
static const char* DNAType() { return "SWSH"; } AT_DECL_EXPLICIT_DNA_YAML
const char* DNATypeV() const { return DNAType(); } AT_SUBDECL_DNA
IntElementFactory x0_PSLT; IntElementFactory x0_PSLT;
RealElementFactory x4_TIME; RealElementFactory x4_TIME;
@ -42,13 +42,6 @@ struct SWSH : public BigYAML
uint16_t dummy = 0; uint16_t dummy = 0;
}; };
void read(athena::io::YAMLDocReader& r);
void write(athena::io::YAMLDocWriter& w) const;
size_t binarySize(size_t __isz) const;
void read(athena::io::IStreamReader& r);
void write(athena::io::IStreamWriter& w) const;
SWSH() SWSH()
{ {
x44_25_CROS = true; x44_25_CROS = true;

View File

@ -9,7 +9,7 @@ class CVarManager;
} }
namespace DataSpec namespace DataSpec
{ {
struct ITweak : BigYAML struct ITweak : BigDNA
{ {
virtual void initCVars(hecl::CVarManager*) {} virtual void initCVars(hecl::CVarManager*) {}

View File

@ -7,9 +7,9 @@
namespace DataSpec namespace DataSpec
{ {
/* Same as CDamageInfo */ /* Same as CDamageInfo */
struct SShotParam : BigYAML struct SShotParam : BigDNA
{ {
DECL_YAML AT_DECL_DNA_YAML
Value<atInt32> weaponType = -1; Value<atInt32> weaponType = -1;
bool charged : 1; bool charged : 1;
bool combo : 1; bool combo : 1;
@ -24,19 +24,19 @@ struct SShotParam : BigYAML
struct SComboShotParam : SShotParam struct SComboShotParam : SShotParam
{ {
DECL_YAML AT_DECL_DNA_YAML
SComboShotParam() { combo = true; } SComboShotParam() { combo = true; }
}; };
struct SChargedShotParam : SShotParam struct SChargedShotParam : SShotParam
{ {
DECL_YAML AT_DECL_DNA_YAML
SChargedShotParam() { charged = true; } SChargedShotParam() { charged = true; }
}; };
struct SWeaponInfo : BigYAML struct SWeaponInfo : BigDNA
{ {
DECL_YAML AT_DECL_DNA_YAML
Value<float> x0_coolDown = 0.1f; Value<float> x0_coolDown = 0.1f;
SShotParam x4_normal; SShotParam x4_normal;
SChargedShotParam x20_charged; SChargedShotParam x20_charged;
@ -44,7 +44,7 @@ struct SWeaponInfo : BigYAML
struct ITweakPlayerGun : ITweak struct ITweakPlayerGun : ITweak
{ {
DECL_YAML AT_DECL_DNA_YAML
virtual float GetUpLookAngle() const = 0; virtual float GetUpLookAngle() const = 0;
virtual float GetDownLookAngle() const = 0; virtual float GetDownLookAngle() const = 0;
virtual float GetVerticalSpread() const = 0; virtual float GetVerticalSpread() const = 0;

View File

@ -28,7 +28,7 @@ bool ExtractTweak(PAKEntryReadStream& rs, const hecl::ProjectPath& outPath)
{ {
T tweak; T tweak;
tweak.read(rs); tweak.read(rs);
tweak.toYAMLStream(writer); athena::io::ToYAMLStream(tweak, writer);
return true; return true;
} }
return false; return false;

View File

@ -4,7 +4,7 @@ namespace DataSpec::DNAParticle
{ {
template <class IDType> template <class IDType>
void WPSM<IDType>::read(athena::io::YAMLDocReader& r) void WPSM<IDType>::_read(athena::io::YAMLDocReader& r)
{ {
for (const auto& elem : r.getCurNode()->m_mapChildren) for (const auto& elem : r.getCurNode()->m_mapChildren)
{ {
@ -126,7 +126,7 @@ void WPSM<IDType>::read(athena::io::YAMLDocReader& r)
} }
template <class IDType> template <class IDType>
void WPSM<IDType>::write(athena::io::YAMLDocWriter& w) const void WPSM<IDType>::_write(athena::io::YAMLDocWriter& w) const
{ {
if (x0_IORN) if (x0_IORN)
if (auto rec = w.enterSubRecord("IORN")) if (auto rec = w.enterSubRecord("IORN"))
@ -232,82 +232,180 @@ void WPSM<IDType>::write(athena::io::YAMLDocWriter& w) const
} }
template <class IDType> template <class IDType>
size_t WPSM<IDType>::binarySize(size_t __isz) const void WPSM<IDType>::_binarySize(size_t& __isz) const
{ {
__isz += 4; __isz += 4;
if (x0_IORN) if (x0_IORN)
__isz = x0_IORN.binarySize(__isz + 4); {
__isz += 4;
x0_IORN.binarySize(__isz);
}
if (x4_IVEC) if (x4_IVEC)
__isz = x4_IVEC.binarySize(__isz + 4); {
__isz += 4;
x4_IVEC.binarySize(__isz);
}
if (x8_PSOV) if (x8_PSOV)
__isz = x8_PSOV.binarySize(__isz + 4); {
__isz += 4;
x8_PSOV.binarySize(__isz);
}
if (xc_PSVM) if (xc_PSVM)
__isz = xc_PSVM.binarySize(__isz + 4); {
__isz += 4;
xc_PSVM.binarySize(__isz);
}
if (x10_VMD2) if (x10_VMD2)
__isz = x10_VMD2.binarySize(__isz + 4); {
__isz += 4;
x10_VMD2.binarySize(__isz);
}
if (x14_PSLT) if (x14_PSLT)
__isz = x14_PSLT.binarySize(__isz + 4); {
__isz += 4;
x14_PSLT.binarySize(__isz);
}
if (x18_PSCL) if (x18_PSCL)
__isz = x18_PSCL.binarySize(__isz + 4); {
__isz += 4;
x18_PSCL.binarySize(__isz);
}
if (x1c_PCOL) if (x1c_PCOL)
__isz = x1c_PCOL.binarySize(__isz + 4); {
__isz += 4;
x1c_PCOL.binarySize(__isz);
}
if (x20_POFS) if (x20_POFS)
__isz = x20_POFS.binarySize(__isz + 4); {
__isz += 4;
x20_POFS.binarySize(__isz);
}
if (x24_OFST) if (x24_OFST)
__isz = x24_OFST.binarySize(__isz + 4); {
__isz += 4;
x24_OFST.binarySize(__isz);
}
if (x28_APSO) if (x28_APSO)
__isz = x28_APSO.binarySize(__isz + 4); {
__isz += 4;
x28_APSO.binarySize(__isz);
}
if (x29_HOMG) if (x29_HOMG)
__isz = x29_HOMG.binarySize(__isz + 4); {
__isz += 4;
x29_HOMG.binarySize(__isz);
}
if (x2a_AP11) if (x2a_AP11)
__isz = x2a_AP11.binarySize(__isz + 4); {
__isz += 4;
x2a_AP11.binarySize(__isz);
}
if (x2b_AP21) if (x2b_AP21)
__isz = x2b_AP21.binarySize(__isz + 4); {
__isz += 4;
x2b_AP21.binarySize(__isz);
}
if (x2c_AS11) if (x2c_AS11)
__isz = x2c_AS11.binarySize(__isz + 4); {
__isz += 4;
x2c_AS11.binarySize(__isz);
}
if (x2d_AS12) if (x2d_AS12)
__isz = x2d_AS12.binarySize(__isz + 4); {
__isz += 4;
x2d_AS12.binarySize(__isz);
}
if (x2e_AS13) if (x2e_AS13)
__isz = x2e_AS13.binarySize(__isz + 4); {
__isz += 4;
x2e_AS13.binarySize(__isz);
}
if (x30_TRAT) if (x30_TRAT)
__isz = x30_TRAT.binarySize(__isz + 4); {
__isz += 4;
x30_TRAT.binarySize(__isz);
}
if (x34_APSM) if (x34_APSM)
__isz = x34_APSM.binarySize(__isz + 4); {
__isz += 4;
x34_APSM.binarySize(__isz);
}
if (x44_APS2) if (x44_APS2)
__isz = x44_APS2.binarySize(__isz + 4); {
__isz += 4;
x44_APS2.binarySize(__isz);
}
if (x54_ASW1) if (x54_ASW1)
__isz = x54_ASW1.binarySize(__isz + 4); {
__isz += 4;
x54_ASW1.binarySize(__isz);
}
if (x64_ASW2) if (x64_ASW2)
__isz = x64_ASW2.binarySize(__isz + 4); {
__isz += 4;
x64_ASW2.binarySize(__isz);
}
if (x74_ASW3) if (x74_ASW3)
__isz = x74_ASW3.binarySize(__isz + 4); {
__isz += 4;
x74_ASW3.binarySize(__isz);
}
if (x84_OHEF) if (x84_OHEF)
__isz = x84_OHEF.binarySize(__isz + 4); {
__isz += 4;
x84_OHEF.binarySize(__isz);
}
if (x94_COLR) if (x94_COLR)
__isz = x94_COLR.binarySize(__isz + 4); {
__isz += 4;
x94_COLR.binarySize(__isz);
}
if (!xa4_EWTR) if (!xa4_EWTR)
__isz = xa4_EWTR.binarySize(__isz + 4); {
__isz += 4;
xa4_EWTR.binarySize(__isz);
}
if (!xa5_LWTR) if (!xa5_LWTR)
__isz = xa5_LWTR.binarySize(__isz + 4); {
__isz += 4;
xa5_LWTR.binarySize(__isz);
}
if (!xa6_SWTR) if (!xa6_SWTR)
__isz = xa6_SWTR.binarySize(__isz + 4); {
__isz += 4;
xa6_SWTR.binarySize(__isz);
}
if (xa8_PJFX != ~0) if (xa8_PJFX != ~0)
__isz += 12; __isz += 12;
if (xac_RNGE) if (xac_RNGE)
__isz = xac_RNGE.binarySize(__isz + 4); {
__isz += 4;
xac_RNGE.binarySize(__isz);
}
if (xb0_FOFF) if (xb0_FOFF)
__isz = xb0_FOFF.binarySize(__isz + 4); {
__isz += 4;
xb0_FOFF.binarySize(__isz);
}
if (xunk_FC60) if (xunk_FC60)
__isz = xunk_FC60.binarySize(__isz + 4); {
__isz += 4;
xunk_FC60.binarySize(__isz);
}
if (xunk_SPS1) if (xunk_SPS1)
__isz = xunk_SPS1.binarySize(__isz + 4); {
__isz += 4;
xunk_SPS1.binarySize(__isz);
}
if (xunk_SPS2) if (xunk_SPS2)
__isz = xunk_SPS2.binarySize(__isz + 4); {
return __isz; __isz += 4;
xunk_SPS2.binarySize(__isz);
}
} }
template <class IDType> template <class IDType>
void WPSM<IDType>::read(athena::io::IStreamReader& r) void WPSM<IDType>::_read(athena::io::IStreamReader& r)
{ {
uint32_t clsId; uint32_t clsId;
r.readBytesToBuf(&clsId, 4); r.readBytesToBuf(&clsId, 4);
@ -441,7 +539,7 @@ void WPSM<IDType>::read(athena::io::IStreamReader& r)
} }
template <class IDType> template <class IDType>
void WPSM<IDType>::write(athena::io::IStreamWriter &w) const void WPSM<IDType>::_write(athena::io::IStreamWriter &w) const
{ {
w.writeBytes("WPSM", 4); w.writeBytes("WPSM", 4);
if (x0_IORN) if (x0_IORN)
@ -618,6 +716,15 @@ void WPSM<IDType>::write(athena::io::IStreamWriter &w) const
w.writeBytes("_END", 4); w.writeBytes("_END", 4);
} }
AT_SUBSPECIALIZE_DNA_YAML(WPSM<UniqueID32>)
AT_SUBSPECIALIZE_DNA_YAML(WPSM<UniqueID64>)
template <>
const char* WPSM<UniqueID32>::DNAType() { return "WPSM<UniqueID32>"; }
template <>
const char* WPSM<UniqueID64>::DNAType() { return "WPSM<UniqueID64>"; }
template <class IDType> template <class IDType>
void WPSM<IDType>::gatherDependencies(std::vector<hecl::ProjectPath>& pathsOut) const void WPSM<IDType>::gatherDependencies(std::vector<hecl::ProjectPath>& pathsOut) const
{ {
@ -641,7 +748,7 @@ bool ExtractWPSM(PAKEntryReadStream& rs, const hecl::ProjectPath& outPath)
{ {
WPSM<IDType> wpsm; WPSM<IDType> wpsm;
wpsm.read(rs); wpsm.read(rs);
wpsm.toYAMLStream(writer); athena::io::ToYAMLStream(wpsm, writer);
return true; return true;
} }
return false; return false;

View File

@ -8,10 +8,10 @@
namespace DataSpec::DNAParticle namespace DataSpec::DNAParticle
{ {
template <class IDType> template <class IDType>
struct WPSM : BigYAML struct WPSM : BigDNA
{ {
static const char* DNAType() { return "WPSM"; } AT_DECL_EXPLICIT_DNA_YAML
const char* DNATypeV() const { return DNAType(); } AT_SUBDECL_DNA
VectorElementFactory x0_IORN; VectorElementFactory x0_IORN;
VectorElementFactory x4_IVEC; VectorElementFactory x4_IVEC;
VectorElementFactory x8_PSOV; VectorElementFactory x8_PSOV;
@ -47,12 +47,6 @@ struct WPSM : BigYAML
BoolHelper xunk_SPS1; BoolHelper xunk_SPS1;
BoolHelper xunk_SPS2; BoolHelper xunk_SPS2;
void read(athena::io::YAMLDocReader& r);
void write(athena::io::YAMLDocWriter& w) const;
size_t binarySize(size_t __isz) const;
void read(athena::io::IStreamReader& r);
void write(athena::io::IStreamWriter& w) const;
WPSM() WPSM()
{ {
xa4_EWTR = true; xa5_LWTR = true; xa6_SWTR = true; xa4_EWTR = true; xa5_LWTR = true; xa6_SWTR = true;

127
DataSpec/DNAMP1/AFSM.cpp Normal file
View File

@ -0,0 +1,127 @@
#include "AFSM.hpp"
namespace DataSpec::DNAMP1
{
template <>
void AFSM::State::Transition::Enumerate<BigDNA::Read>(typename Read::StreamT& r)
{
triggerCount = r.readUint32Big();
int i = 0;
r.enumerate<Trigger>(triggers, triggerCount,
[&](athena::io::IStreamReader& in, Trigger& tr){
tr.first = i == 0;
tr.read(in);
i++;
});
}
template <>
void AFSM::State::Transition::Enumerate<BigDNA::Write>(typename Write::StreamT& w)
{
w.writeInt32Big(triggerCount);
w.enumerate(triggers);
}
template <>
void AFSM::State::Transition::Enumerate<BigDNA::ReadYaml>(typename ReadYaml::StreamT& r)
{
int i = 0;
/* triggers */
triggerCount = r.enumerate<Trigger>("triggers", triggers,
[&](athena::io::YAMLDocReader& in, Trigger& tr){
tr.first = i == 0;
tr.read(in);
i++;
});
}
template <>
void AFSM::State::Transition::Enumerate<BigDNA::WriteYaml>(typename WriteYaml::StreamT& w)
{
/* triggers */
w.enumerate("triggers", triggers);
}
template <>
void AFSM::State::Transition::Enumerate<BigDNA::BinarySize>(typename BinarySize::StreamT& s)
{
s += 4;
for (const Trigger& trig : triggers)
trig.binarySize(s);
}
const char* AFSM::State::Transition::DNAType()
{
return "urde::DNAMP1::AFSM::Transition";
}
template <>
void AFSM::State::Transition::Trigger::Enumerate<BigDNA::Read>(athena::io::IStreamReader& __dna_reader)
{
/* name */
name = __dna_reader.readString(-1);
/* parameter */
parameter = __dna_reader.readFloatBig();
if (first)
{
/* targetState */
targetState = __dna_reader.readUint32Big();
}
}
template <>
void AFSM::State::Transition::Trigger::Enumerate<BigDNA::Write>(athena::io::IStreamWriter& __dna_writer)
{
/* name */
__dna_writer.writeString(name, -1);
/* parameter */
__dna_writer.writeFloatBig(parameter);
if (first)
{
/* targetState */
__dna_writer.writeUint32Big(targetState);
}
}
template <>
void AFSM::State::Transition::Trigger::Enumerate<BigDNA::ReadYaml>(athena::io::YAMLDocReader& __dna_docin)
{
/* name */
name = __dna_docin.readString("name");
/* parameter */
parameter = __dna_docin.readFloat("parameter");
if (first)
{
/* targetState */
targetState = __dna_docin.readUint32("targetState");
}
}
template <>
void AFSM::State::Transition::Trigger::Enumerate<BigDNA::WriteYaml>(athena::io::YAMLDocWriter& __dna_docout)
{
/* name */
__dna_docout.writeString("name", name);
/* parameter */
__dna_docout.writeFloat("parameter", parameter);
if (first)
{
/* targetState */
__dna_docout.writeUint32("targetState", targetState);
}
}
template <>
void AFSM::State::Transition::Trigger::Enumerate<BigDNA::BinarySize>(size_t& __isz)
{
__isz += name.size() + 1;
__isz += (first ? 8 : 4);
}
const char* AFSM::State::Transition::Trigger::DNAType()
{
return "urde::DNAMP1::AFSM::State::Transition::Trigger";
}
}

View File

@ -7,150 +7,34 @@
namespace DataSpec::DNAMP1 namespace DataSpec::DNAMP1
{ {
struct AFSM : public BigYAML struct AFSM : public BigDNA
{ {
DECL_YAML AT_DECL_DNA_YAML
Value<atUint32> stateCount; Value<atUint32> stateCount;
Vector<String<-1>, DNA_COUNT(stateCount)> stateNames; Vector<String<-1>, DNA_COUNT(stateCount)> stateNames;
Value<atUint32> triggerCount; Value<atUint32> triggerCount;
struct State : public BigYAML struct State : public BigDNA
{ {
DECL_YAML AT_DECL_DNA_YAML
Value<atUint32> transitionCount; Value<atUint32> transitionCount;
struct Transition : public BigYAML struct Transition : public BigDNA
{ {
Delete _d; AT_DECL_EXPLICIT_DNA_YAML
Value<atUint32> triggerCount; Value<atUint32> triggerCount;
struct Trigger : public BigYAML struct Trigger : public BigDNA
{ {
Delete _d; AT_DECL_EXPLICIT_DNA_YAML
bool first = false; bool first = false;
String<-1> name; String<-1> name;
Value<float> parameter; Value<float> parameter;
Value<atUint32> targetState; Value<atUint32> targetState;
void read(athena::io::IStreamReader& __dna_reader)
{
/* name */
name = __dna_reader.readString(-1);
/* parameter */
parameter = __dna_reader.readFloatBig();
if (first)
{
/* targetState */
targetState = __dna_reader.readUint32Big();
}
}
void write(athena::io::IStreamWriter& __dna_writer) const
{
/* name */
__dna_writer.writeString(name, -1);
/* parameter */
__dna_writer.writeFloatBig(parameter);
if (first)
{
/* targetState */
__dna_writer.writeUint32Big(targetState);
}
}
void read(athena::io::YAMLDocReader& __dna_docin)
{
/* name */
name = __dna_docin.readString("name");
/* parameter */
parameter = __dna_docin.readFloat("parameter");
if (first)
{
/* targetState */
targetState = __dna_docin.readUint32("targetState");
}
}
void write(athena::io::YAMLDocWriter& __dna_docout) const
{
/* name */
__dna_docout.writeString("name", name);
/* parameter */
__dna_docout.writeFloat("parameter", parameter);
if (first)
{
/* targetState */
__dna_docout.writeUint32("targetState", targetState);
}
}
static const char* DNAType()
{
return "urde::DNAMP1::AFSM::Transition::Trigger";
}
size_t binarySize(size_t __isz) const
{
__isz += name.size() + 1;
return __isz + (first ? 8 : 4);
}
}; };
Vector<Trigger, DNA_COUNT(triggerCount)> triggers; Vector<Trigger, DNA_COUNT(triggerCount)> triggers;
void read(athena::io::IStreamReader& __dna_reader)
{
/* triggerCount */
triggerCount = __dna_reader.readUint32Big();
int i = 0;
/* triggers */
__dna_reader.enumerate<Trigger>(triggers, triggerCount,
[&](athena::io::IStreamReader& in, Trigger& tr){
tr.first = i == 0;
tr.read(in);
i++;
});
}
void write(athena::io::IStreamWriter& __dna_writer) const
{
/* triggerCount */
__dna_writer.writeInt32Big(triggerCount);
/* triggers */
__dna_writer.enumerate(triggers);
}
void read(athena::io::YAMLDocReader& __dna_docin)
{
int i = 0;
/* triggers */
triggerCount = __dna_docin.enumerate<Trigger>("triggers", triggers,
[&](athena::io::YAMLDocReader& in, Trigger& tr){
tr.first = i == 0;
tr.read(in);
i++;
});
}
void write(athena::io::YAMLDocWriter& __dna_docout) const
{
/* triggers */
__dna_docout.enumerate("triggers", triggers);
}
static const char* DNAType()
{
return "urde::DNAMP1::AFSM::Transition";
}
size_t binarySize(size_t __isz) const
{
__isz = __EnumerateSize(__isz, triggers);
return __isz + 4;
}
}; };
Vector<Transition, DNA_COUNT(transitionCount)> transitions; Vector<Transition, DNA_COUNT(transitionCount)> transitions;
}; };
Vector<State, DNA_COUNT(stateCount)> states; Vector<State, DNA_COUNT(stateCount)> states;
static bool Extract(PAKEntryReadStream& rs, const hecl::ProjectPath& outPath) static bool Extract(PAKEntryReadStream& rs, const hecl::ProjectPath& outPath)
@ -158,7 +42,7 @@ struct AFSM : public BigYAML
AFSM afsm; AFSM afsm;
afsm.read(rs); afsm.read(rs);
athena::io::FileWriter writer(outPath.getAbsolutePath()); athena::io::FileWriter writer(outPath.getAbsolutePath());
afsm.toYAMLStream(writer); athena::io::ToYAMLStream(afsm, writer);
return true; return true;
} }
}; };

View File

@ -11,7 +11,7 @@ class AGSC
{ {
struct Header : BigDNA struct Header : BigDNA
{ {
DECL_DNA AT_DECL_DNA
String<-1> audioDir; String<-1> audioDir;
String<-1> groupName; String<-1> groupName;
}; };

View File

@ -9,7 +9,9 @@ extern hecl::Database::DataSpecEntry SpecEntMP1PC;
namespace DNAMP1 namespace DNAMP1
{ {
void ANCS::CharacterSet::CharacterInfo::PASDatabase::AnimState::ParmInfo::read(athena::io::IStreamReader& reader) template <>
void ANCS::CharacterSet::CharacterInfo::PASDatabase::AnimState::ParmInfo::Enumerate<BigDNA::Read>
(athena::io::IStreamReader& reader)
{ {
parmType = reader.readUint32Big(); parmType = reader.readUint32Big();
weightFunction = reader.readUint32Big(); weightFunction = reader.readUint32Big();
@ -36,7 +38,9 @@ void ANCS::CharacterSet::CharacterInfo::PASDatabase::AnimState::ParmInfo::read(a
} }
} }
void ANCS::CharacterSet::CharacterInfo::PASDatabase::AnimState::ParmInfo::write(athena::io::IStreamWriter& writer) const template <>
void ANCS::CharacterSet::CharacterInfo::PASDatabase::AnimState::ParmInfo::Enumerate<BigDNA::Write>
(athena::io::IStreamWriter& writer)
{ {
writer.writeUint32Big(parmType); writer.writeUint32Big(parmType);
writer.writeUint32Big(weightFunction); writer.writeUint32Big(weightFunction);
@ -63,7 +67,8 @@ void ANCS::CharacterSet::CharacterInfo::PASDatabase::AnimState::ParmInfo::write(
} }
} }
size_t ANCS::CharacterSet::CharacterInfo::PASDatabase::AnimState::ParmInfo::binarySize(size_t __isz) const template <>
void ANCS::CharacterSet::CharacterInfo::PASDatabase::AnimState::ParmInfo::Enumerate<BigDNA::BinarySize>(size_t& __isz)
{ {
__isz += 12; __isz += 12;
switch (DataType(parmType)) switch (DataType(parmType))
@ -78,10 +83,11 @@ size_t ANCS::CharacterSet::CharacterInfo::PASDatabase::AnimState::ParmInfo::bina
__isz += 2; __isz += 2;
break; break;
} }
return __isz;
} }
void ANCS::CharacterSet::CharacterInfo::PASDatabase::AnimState::ParmInfo::read(athena::io::YAMLDocReader& reader) template <>
void ANCS::CharacterSet::CharacterInfo::PASDatabase::AnimState::ParmInfo::Enumerate<BigDNA::ReadYaml>
(athena::io::YAMLDocReader& reader)
{ {
parmType = reader.readUint32("parmType"); parmType = reader.readUint32("parmType");
weightFunction = reader.readUint32("weightFunction"); weightFunction = reader.readUint32("weightFunction");
@ -113,7 +119,9 @@ void ANCS::CharacterSet::CharacterInfo::PASDatabase::AnimState::ParmInfo::read(a
} }
} }
void ANCS::CharacterSet::CharacterInfo::PASDatabase::AnimState::ParmInfo::write(athena::io::YAMLDocWriter& writer) const template <>
void ANCS::CharacterSet::CharacterInfo::PASDatabase::AnimState::ParmInfo::Enumerate<BigDNA::WriteYaml>
(athena::io::YAMLDocWriter& writer)
{ {
writer.writeUint32("parmType", parmType); writer.writeUint32("parmType", parmType);
writer.writeUint32("weightFunction", weightFunction); writer.writeUint32("weightFunction", weightFunction);
@ -148,7 +156,9 @@ const char* ANCS::CharacterSet::CharacterInfo::PASDatabase::AnimState::ParmInfo:
return "urde::DNAMP1::ANCS::CharacterSet::CharacterInfo::PASDatabase::AnimState::ParmInfo"; return "urde::DNAMP1::ANCS::CharacterSet::CharacterInfo::PASDatabase::AnimState::ParmInfo";
} }
void ANCS::CharacterSet::CharacterInfo::PASDatabase::AnimState::read(athena::io::IStreamReader& reader) template <>
void ANCS::CharacterSet::CharacterInfo::PASDatabase::AnimState::Enumerate<BigDNA::Read>
(athena::io::IStreamReader& reader)
{ {
id = reader.readUint32Big(); id = reader.readUint32Big();
atUint32 parmInfoCount = reader.readUint32Big(); atUint32 parmInfoCount = reader.readUint32Big();
@ -186,7 +196,9 @@ void ANCS::CharacterSet::CharacterInfo::PASDatabase::AnimState::read(athena::io:
}); });
} }
void ANCS::CharacterSet::CharacterInfo::PASDatabase::AnimState::write(athena::io::IStreamWriter& writer) const template <>
void ANCS::CharacterSet::CharacterInfo::PASDatabase::AnimState::Enumerate<BigDNA::Write>
(athena::io::IStreamWriter& writer)
{ {
writer.writeUint32Big(id); writer.writeUint32Big(id);
writer.writeUint32Big(parmInfos.size()); writer.writeUint32Big(parmInfos.size());
@ -225,10 +237,12 @@ void ANCS::CharacterSet::CharacterInfo::PASDatabase::AnimState::write(athena::io
} }
} }
size_t ANCS::CharacterSet::CharacterInfo::PASDatabase::AnimState::binarySize(size_t __isz) const template <>
void ANCS::CharacterSet::CharacterInfo::PASDatabase::AnimState::Enumerate<BigDNA::BinarySize>(size_t& __isz)
{ {
__isz += 12; __isz += 12;
__isz = __EnumerateSize(__isz, parmInfos); for (const ParmInfo& pi : parmInfos)
pi.binarySize(__isz);
__isz += animInfos.size() * 4; __isz += animInfos.size() * 4;
for (const ParmInfo& pi : parmInfos) for (const ParmInfo& pi : parmInfos)
@ -247,11 +261,11 @@ size_t ANCS::CharacterSet::CharacterInfo::PASDatabase::AnimState::binarySize(siz
default: break; default: break;
} }
} }
return __isz;
} }
void ANCS::CharacterSet::CharacterInfo::PASDatabase::AnimState::read(athena::io::YAMLDocReader& reader) template <>
void ANCS::CharacterSet::CharacterInfo::PASDatabase::AnimState::Enumerate<BigDNA::ReadYaml>
(athena::io::YAMLDocReader& reader)
{ {
id = reader.readUint32("id"); id = reader.readUint32("id");
@ -289,7 +303,9 @@ void ANCS::CharacterSet::CharacterInfo::PASDatabase::AnimState::read(athena::io:
}); });
} }
void ANCS::CharacterSet::CharacterInfo::PASDatabase::AnimState::write(athena::io::YAMLDocWriter& writer) const template <>
void ANCS::CharacterSet::CharacterInfo::PASDatabase::AnimState::Enumerate<BigDNA::WriteYaml>
(athena::io::YAMLDocWriter& writer)
{ {
writer.writeUint32("id", id); writer.writeUint32("id", id);
@ -334,7 +350,8 @@ const char* ANCS::CharacterSet::CharacterInfo::PASDatabase::AnimState::DNAType()
return "urde::DNAMP1::ANCS::CharacterSet::CharacterInfo::PASDatabase::AnimState"; return "urde::DNAMP1::ANCS::CharacterSet::CharacterInfo::PASDatabase::AnimState";
} }
void ANCS::CharacterSet::CharacterInfo::read(athena::io::IStreamReader& reader) template <>
void ANCS::CharacterSet::CharacterInfo::Enumerate<BigDNA::Read>(athena::io::IStreamReader& reader)
{ {
idx = reader.readUint32Big(); idx = reader.readUint32Big();
atUint16 sectionCount = reader.readUint16Big(); atUint16 sectionCount = reader.readUint16Big();
@ -394,7 +411,8 @@ void ANCS::CharacterSet::CharacterInfo::read(athena::io::IStreamReader& reader)
} }
} }
void ANCS::CharacterSet::CharacterInfo::write(athena::io::IStreamWriter& writer) const template <>
void ANCS::CharacterSet::CharacterInfo::Enumerate<BigDNA::Write>(athena::io::IStreamWriter& writer)
{ {
writer.writeUint32Big(idx); writer.writeUint32Big(idx);
@ -466,7 +484,8 @@ void ANCS::CharacterSet::CharacterInfo::write(athena::io::IStreamWriter& writer)
} }
} }
size_t ANCS::CharacterSet::CharacterInfo::binarySize(size_t __isz) const template <>
void ANCS::CharacterSet::CharacterInfo::Enumerate<BigDNA::BinarySize>(size_t& __isz)
{ {
__isz += 6; __isz += 6;
@ -488,23 +507,28 @@ size_t ANCS::CharacterSet::CharacterInfo::binarySize(size_t __isz) const
__isz += 12; __isz += 12;
__isz += 4; __isz += 4;
__isz = __EnumerateSize(__isz, animations); for (const Animation& a : animations)
a.binarySize(__isz);
__isz = pasDatabase.binarySize(__isz); pasDatabase.binarySize(__isz);
__isz += 4; __isz += 4;
__isz = __EnumerateSize(__isz, partResData.part); for (const UniqueID32& id : partResData.part)
id.binarySize(__isz);
__isz += 4; __isz += 4;
__isz = __EnumerateSize(__isz, partResData.swhc); for (const UniqueID32& id : partResData.swhc)
id.binarySize(__isz);
__isz += 4; __isz += 4;
__isz = __EnumerateSize(__isz, partResData.unk); for (const UniqueID32& id : partResData.unk)
id.binarySize(__isz);
if (sectionCount > 5) if (sectionCount > 5)
{ {
__isz += 4; __isz += 4;
__isz = __EnumerateSize(__isz, partResData.elsc); for (const UniqueID32& id : partResData.elsc)
id.binarySize(__isz);
} }
__isz += 4; __isz += 4;
@ -512,13 +536,15 @@ size_t ANCS::CharacterSet::CharacterInfo::binarySize(size_t __isz) const
if (sectionCount > 1) if (sectionCount > 1)
{ {
__isz += 4; __isz += 4;
__isz = __EnumerateSize(__isz, animAABBs); for (const ActionAABB& aabb : animAABBs)
aabb.binarySize(__isz);
} }
if (sectionCount > 2) if (sectionCount > 2)
{ {
__isz += 4; __isz += 4;
__isz = __EnumerateSize(__isz, effects); for (const Effect& e : effects)
e.binarySize(__isz);
} }
if (sectionCount > 3) if (sectionCount > 3)
@ -526,11 +552,10 @@ size_t ANCS::CharacterSet::CharacterInfo::binarySize(size_t __isz) const
if (sectionCount > 4) if (sectionCount > 4)
__isz += 4 + animIdxs.size() * 4; __isz += 4 + animIdxs.size() * 4;
return __isz;
} }
void ANCS::CharacterSet::CharacterInfo::read(athena::io::YAMLDocReader& reader) template <>
void ANCS::CharacterSet::CharacterInfo::Enumerate<BigDNA::ReadYaml>(athena::io::YAMLDocReader& reader)
{ {
idx = reader.readUint32("idx"); idx = reader.readUint32("idx");
atUint16 sectionCount = reader.readUint16("sectionCount"); atUint16 sectionCount = reader.readUint16("sectionCount");
@ -579,7 +604,8 @@ void ANCS::CharacterSet::CharacterInfo::read(athena::io::YAMLDocReader& reader)
} }
} }
void ANCS::CharacterSet::CharacterInfo::write(athena::io::YAMLDocWriter& writer) const template <>
void ANCS::CharacterSet::CharacterInfo::Enumerate<BigDNA::WriteYaml>(athena::io::YAMLDocWriter& writer)
{ {
writer.writeUint32("idx", idx); writer.writeUint32("idx", idx);
@ -644,7 +670,8 @@ const char* ANCS::CharacterSet::CharacterInfo::DNAType()
return "urde::DNAMP1::ANCS::CharacterSet::CharacterInfo"; return "urde::DNAMP1::ANCS::CharacterSet::CharacterInfo";
} }
void ANCS::AnimationSet::MetaAnimFactory::read(athena::io::IStreamReader& reader) template <>
void ANCS::AnimationSet::MetaAnimFactory::Enumerate<BigDNA::Read>(athena::io::IStreamReader& reader)
{ {
IMetaAnim::Type type(IMetaAnim::Type(reader.readUint32Big())); IMetaAnim::Type type(IMetaAnim::Type(reader.readUint32Big()));
switch (type) switch (type)
@ -675,7 +702,8 @@ void ANCS::AnimationSet::MetaAnimFactory::read(athena::io::IStreamReader& reader
} }
} }
void ANCS::AnimationSet::MetaAnimFactory::write(athena::io::IStreamWriter& writer) const template <>
void ANCS::AnimationSet::MetaAnimFactory::Enumerate<BigDNA::Write>(athena::io::IStreamWriter& writer)
{ {
if (!m_anim) if (!m_anim)
return; return;
@ -683,14 +711,17 @@ void ANCS::AnimationSet::MetaAnimFactory::write(athena::io::IStreamWriter& write
m_anim->write(writer); m_anim->write(writer);
} }
size_t ANCS::AnimationSet::MetaAnimFactory::binarySize(size_t __isz) const template <>
void ANCS::AnimationSet::MetaAnimFactory::Enumerate<BigDNA::BinarySize>(size_t& __isz)
{ {
if (!m_anim) if (!m_anim)
return __isz; return;
return m_anim->binarySize(__isz + 4); __isz += 4;
m_anim->binarySize(__isz);
} }
void ANCS::AnimationSet::MetaAnimFactory::read(athena::io::YAMLDocReader& reader) template <>
void ANCS::AnimationSet::MetaAnimFactory::Enumerate<BigDNA::ReadYaml>(athena::io::YAMLDocReader& reader)
{ {
std::string type = reader.readString("type"); std::string type = reader.readString("type");
std::transform(type.begin(), type.end(), type.begin(), tolower); std::transform(type.begin(), type.end(), type.begin(), tolower);
@ -723,10 +754,10 @@ void ANCS::AnimationSet::MetaAnimFactory::read(athena::io::YAMLDocReader& reader
{ {
m_anim.reset(nullptr); m_anim.reset(nullptr);
} }
} }
void ANCS::AnimationSet::MetaAnimFactory::write(athena::io::YAMLDocWriter& writer) const template <>
void ANCS::AnimationSet::MetaAnimFactory::Enumerate<BigDNA::WriteYaml>(athena::io::YAMLDocWriter& writer)
{ {
if (!m_anim) if (!m_anim)
return; return;
@ -739,7 +770,8 @@ const char* ANCS::AnimationSet::MetaAnimFactory::DNAType()
return "urde::DNAMP1::ANCS::AnimationSet::MetaAnimFactory"; return "urde::DNAMP1::ANCS::AnimationSet::MetaAnimFactory";
} }
void ANCS::AnimationSet::MetaTransFactory::read(athena::io::IStreamReader& reader) template <>
void ANCS::AnimationSet::MetaTransFactory::Enumerate<BigDNA::Read>(athena::io::IStreamReader& reader)
{ {
IMetaTrans::Type type(IMetaTrans::Type(reader.readUint32Big())); IMetaTrans::Type type(IMetaTrans::Type(reader.readUint32Big()));
switch (type) switch (type)
@ -763,7 +795,8 @@ void ANCS::AnimationSet::MetaTransFactory::read(athena::io::IStreamReader& reade
} }
} }
void ANCS::AnimationSet::MetaTransFactory::write(athena::io::IStreamWriter& writer) const template <>
void ANCS::AnimationSet::MetaTransFactory::Enumerate<BigDNA::Write>(athena::io::IStreamWriter& writer)
{ {
if (!m_trans) if (!m_trans)
{ {
@ -774,14 +807,17 @@ void ANCS::AnimationSet::MetaTransFactory::write(athena::io::IStreamWriter& writ
m_trans->write(writer); m_trans->write(writer);
} }
size_t ANCS::AnimationSet::MetaTransFactory::binarySize(size_t __isz) const template <>
void ANCS::AnimationSet::MetaTransFactory::Enumerate<BigDNA::BinarySize>(size_t& __isz)
{ {
__isz += 4;
if (!m_trans) if (!m_trans)
return __isz + 4; return;
return m_trans->binarySize(__isz + 4); m_trans->binarySize(__isz);
} }
void ANCS::AnimationSet::MetaTransFactory::read(athena::io::YAMLDocReader& reader) template <>
void ANCS::AnimationSet::MetaTransFactory::Enumerate<BigDNA::ReadYaml>(athena::io::YAMLDocReader& reader)
{ {
std::string type = reader.readString("type"); std::string type = reader.readString("type");
std::transform(type.begin(), type.end(), type.begin(), tolower); std::transform(type.begin(), type.end(), type.begin(), tolower);
@ -807,7 +843,8 @@ void ANCS::AnimationSet::MetaTransFactory::read(athena::io::YAMLDocReader& reade
} }
void ANCS::AnimationSet::MetaTransFactory::write(athena::io::YAMLDocWriter& writer) const template <>
void ANCS::AnimationSet::MetaTransFactory::Enumerate<BigDNA::WriteYaml>(athena::io::YAMLDocWriter& writer)
{ {
if (!m_trans) if (!m_trans)
{ {
@ -823,7 +860,8 @@ const char* ANCS::AnimationSet::MetaTransFactory::DNAType()
return "urde::DNAMP1::ANCS::AnimationSet::MetaTransFactory"; return "urde::DNAMP1::ANCS::AnimationSet::MetaTransFactory";
} }
void ANCS::AnimationSet::read(athena::io::IStreamReader& reader) template <>
void ANCS::AnimationSet::Enumerate<BigDNA::Read>(athena::io::IStreamReader& reader)
{ {
atUint16 sectionCount = reader.readUint16Big(); atUint16 sectionCount = reader.readUint16Big();
@ -858,7 +896,8 @@ void ANCS::AnimationSet::read(athena::io::IStreamReader& reader)
} }
} }
void ANCS::AnimationSet::write(athena::io::IStreamWriter& writer) const template <>
void ANCS::AnimationSet::Enumerate<BigDNA::Write>(athena::io::IStreamWriter& writer)
{ {
atUint16 sectionCount; atUint16 sectionCount;
if (animResources.size()) if (animResources.size())
@ -900,7 +939,8 @@ void ANCS::AnimationSet::write(athena::io::IStreamWriter& writer) const
} }
} }
size_t ANCS::AnimationSet::binarySize(size_t __isz) const template <>
void ANCS::AnimationSet::Enumerate<BigDNA::BinarySize>(size_t& __isz)
{ {
atUint16 sectionCount; atUint16 sectionCount;
if (animResources.size()) if (animResources.size())
@ -913,35 +953,39 @@ size_t ANCS::AnimationSet::binarySize(size_t __isz) const
sectionCount = 1; sectionCount = 1;
__isz += 6; __isz += 6;
__isz = __EnumerateSize(__isz, animations); for (const Animation& a : animations)
a.binarySize(__isz);
__isz += 4; __isz += 4;
__isz = __EnumerateSize(__isz, transitions); for (const Transition& t : transitions)
__isz = defaultTransition.binarySize(__isz); t.binarySize(__isz);
defaultTransition.binarySize(__isz);
if (sectionCount > 1) if (sectionCount > 1)
{ {
__isz += 4; __isz += 4;
__isz = __EnumerateSize(__isz, additiveAnims); for (const AdditiveAnimationInfo& aa : additiveAnims)
aa.binarySize(__isz);
__isz += 8; __isz += 8;
} }
if (sectionCount > 2) if (sectionCount > 2)
{ {
__isz += 4; __isz += 4;
__isz = __EnumerateSize(__isz, halfTransitions); for (const HalfTransition& ht : halfTransitions)
ht.binarySize(__isz);
} }
if (sectionCount > 3) if (sectionCount > 3)
{ {
__isz += 4; __isz += 4;
__isz = __EnumerateSize(__isz, animResources); for (const AnimationResources& ar : animResources)
ar.binarySize(__isz);
} }
return __isz;
} }
void ANCS::AnimationSet::read(athena::io::YAMLDocReader& reader) template <>
void ANCS::AnimationSet::Enumerate<BigDNA::ReadYaml>(athena::io::YAMLDocReader& reader)
{ {
atUint16 sectionCount = reader.readUint16("sectionCount"); atUint16 sectionCount = reader.readUint16("sectionCount");
@ -971,7 +1015,8 @@ void ANCS::AnimationSet::read(athena::io::YAMLDocReader& reader)
} }
} }
void ANCS::AnimationSet::write(athena::io::YAMLDocWriter& writer) const template <>
void ANCS::AnimationSet::Enumerate<BigDNA::WriteYaml>(athena::io::YAMLDocWriter& writer)
{ {
atUint16 sectionCount; atUint16 sectionCount;
if (animResources.size()) if (animResources.size())
@ -1037,7 +1082,7 @@ bool ANCS::Extract(const SpecBase& dataSpec,
if (force || yamlType == hecl::ProjectPath::Type::None) if (force || yamlType == hecl::ProjectPath::Type::None)
{ {
athena::io::FileWriter writer(yamlPath.getAbsolutePath()); athena::io::FileWriter writer(yamlPath.getAbsolutePath());
ancs.toYAMLStream(writer); athena::io::ToYAMLStream(ancs, writer);
} }
if (force || blendType == hecl::ProjectPath::Type::None) if (force || blendType == hecl::ProjectPath::Type::None)
@ -1067,7 +1112,7 @@ bool ANCS::Extract(const SpecBase& dataSpec,
if (pakRouter.lookupAndReadDNA(res.second.evntId, evnt, true)) if (pakRouter.lookupAndReadDNA(res.second.evntId, evnt, true))
{ {
athena::io::FileWriter writer(evntYamlPath.getAbsolutePath()); athena::io::FileWriter writer(evntYamlPath.getAbsolutePath());
evnt.toYAMLStream(writer); athena::io::ToYAMLStream(evnt, writer);
} }
} }
} }
@ -1091,7 +1136,7 @@ bool ANCS::Cook(const hecl::ProjectPath& outPath,
Log.report(logvisor::Fatal, _S("can't open '%s' for reading"), Log.report(logvisor::Fatal, _S("can't open '%s' for reading"),
yamlPath.getRelativePath().data()); yamlPath.getRelativePath().data());
if (!BigYAML::ValidateFromYAMLStream<ANCS>(reader)) if (!athena::io::ValidateFromYAMLStream<ANCS>(reader))
{ {
Log.report(logvisor::Fatal, _S("'%s' is not urde::DNAMP1::ANCS type"), Log.report(logvisor::Fatal, _S("'%s' is not urde::DNAMP1::ANCS type"),
yamlPath.getRelativePath().data()); yamlPath.getRelativePath().data());

View File

@ -14,23 +14,23 @@
namespace DataSpec::DNAMP1 namespace DataSpec::DNAMP1
{ {
struct ANCS : BigYAML struct ANCS : BigDNA
{ {
using CINFType = CINF; using CINFType = CINF;
using CSKRType = CSKR; using CSKRType = CSKR;
using ANIMType = ANIM; using ANIMType = ANIM;
DECL_YAML AT_DECL_DNA_YAML
Value<atUint16> version; Value<atUint16> version;
struct CharacterSet : BigYAML struct CharacterSet : BigDNA
{ {
DECL_YAML AT_DECL_DNA_YAML
Value<atUint16> version; Value<atUint16> version;
Value<atUint32> characterCount; Value<atUint32> characterCount;
struct CharacterInfo : BigYAML struct CharacterInfo : BigDNA
{ {
DECL_YAML AT_DECL_DNA_YAML
Delete expl; Delete expl;
atUint32 idx; atUint32 idx;
@ -39,30 +39,30 @@ struct ANCS : BigYAML
UniqueID32 cskr; UniqueID32 cskr;
UniqueID32 cinf; UniqueID32 cinf;
struct Animation : BigYAML struct Animation : BigDNA
{ {
DECL_YAML AT_DECL_DNA_YAML
Value<atUint32> animIdx; Value<atUint32> animIdx;
String<-1> strA; String<-1> strA;
String<-1> strB; String<-1> strB;
}; };
std::vector<Animation> animations; std::vector<Animation> animations;
struct PASDatabase : BigYAML struct PASDatabase : BigDNA
{ {
DECL_YAML AT_DECL_DNA_YAML
Value<atUint32> magic; Value<atUint32> magic;
Value<atUint32> animStateCount; Value<atUint32> animStateCount;
Value<atUint32> defaultState; Value<atUint32> defaultState;
struct AnimState : BigYAML struct AnimState : BigDNA
{ {
DECL_YAML AT_DECL_DNA_YAML
Delete expl; Delete expl;
atUint32 id; atUint32 id;
struct ParmInfo : BigYAML struct ParmInfo : BigDNA
{ {
DECL_YAML AT_DECL_DNA_YAML
Delete expl; Delete expl;
enum class DataType enum class DataType
{ {
@ -112,22 +112,22 @@ struct ANCS : BigYAML
atUint32 unk1 = 0; atUint32 unk1 = 0;
struct ActionAABB : BigYAML struct ActionAABB : BigDNA
{ {
DECL_YAML AT_DECL_DNA_YAML
String<-1> name; String<-1> name;
Value<atVec3f> aabb[2]; Value<atVec3f> aabb[2];
}; };
std::vector<ActionAABB> animAABBs; std::vector<ActionAABB> animAABBs;
struct Effect : BigYAML struct Effect : BigDNA
{ {
DECL_YAML AT_DECL_DNA_YAML
String<-1> name; String<-1> name;
Value<atUint32> compCount; Value<atUint32> compCount;
struct EffectComponent : BigYAML struct EffectComponent : BigDNA
{ {
DECL_YAML AT_DECL_DNA_YAML
String<-1> name; String<-1> name;
DNAFourCC type; DNAFourCC type;
UniqueID32 id; UniqueID32 id;
@ -148,16 +148,15 @@ struct ANCS : BigYAML
Vector<CharacterInfo, DNA_COUNT(characterCount)> characters; Vector<CharacterInfo, DNA_COUNT(characterCount)> characters;
} characterSet; } characterSet;
struct AnimationSet : BigYAML struct AnimationSet : BigDNA
{ {
DECL_YAML AT_DECL_DNA_YAML
Delete expl; Delete expl;
struct MetaAnimPrimitive; struct MetaAnimPrimitive;
struct IMetaAnim : BigYAML struct IMetaAnim : BigDNAVYaml
{ {
Delete expl; Delete expl;
virtual ~IMetaAnim() {}
enum class Type enum class Type
{ {
Primitive = 0, Primitive = 0,
@ -172,16 +171,15 @@ struct ANCS : BigYAML
virtual void gatherPrimitives(std::map<atUint32, DNAANCS::AnimationResInfo<UniqueID32>>& out)=0; virtual void gatherPrimitives(std::map<atUint32, DNAANCS::AnimationResInfo<UniqueID32>>& out)=0;
virtual bool enumeratePrimitives(const std::function<bool(MetaAnimPrimitive& prim)>& func)=0; virtual bool enumeratePrimitives(const std::function<bool(MetaAnimPrimitive& prim)>& func)=0;
}; };
struct MetaAnimFactory : BigYAML struct MetaAnimFactory : BigDNA
{ {
DECL_YAML AT_DECL_EXPLICIT_DNA_YAML
Delete expl;
std::unique_ptr<IMetaAnim> m_anim; std::unique_ptr<IMetaAnim> m_anim;
}; };
struct MetaAnimPrimitive : IMetaAnim struct MetaAnimPrimitive : IMetaAnim
{ {
Delete expl2; AT_DECL_DNA_YAML
AT_DECL_DNAV
MetaAnimPrimitive() : IMetaAnim(Type::Primitive, "Primitive") {} MetaAnimPrimitive() : IMetaAnim(Type::Primitive, "Primitive") {}
UniqueID32 animId; UniqueID32 animId;
@ -190,70 +188,6 @@ struct ANCS : BigYAML
Value<float> unk1; Value<float> unk1;
Value<atUint32> unk2; Value<atUint32> unk2;
void read(athena::io::IStreamReader& __dna_reader)
{
/* animId */
animId.read(__dna_reader);
/* animIdx */
animIdx = __dna_reader.readUint32Big();
/* animName */
animName = __dna_reader.readString(-1);
/* unk1 */
unk1 = __dna_reader.readFloatBig();
/* unk2 */
unk2 = __dna_reader.readUint32Big();
}
void write(athena::io::IStreamWriter& __dna_writer) const
{
/* animId */
animId.write(__dna_writer);
/* animIdx */
__dna_writer.writeUint32Big(animIdx);
/* animName */
__dna_writer.writeString(animName, -1);
/* unk1 */
__dna_writer.writeFloatBig(unk1);
/* unk2 */
__dna_writer.writeUint32Big(unk2);
}
void read(athena::io::YAMLDocReader& __dna_docin)
{
/* animIdx */
animIdx = __dna_docin.readUint32("animIdx");
/* animName */
animName = __dna_docin.readString("animName");
/* unk1 */
unk1 = __dna_docin.readFloat("unk1");
/* unk2 */
unk2 = __dna_docin.readUint32("unk2");
}
void write(athena::io::YAMLDocWriter& __dna_docout) const
{
/* animIdx */
__dna_docout.writeUint32("animIdx", animIdx);
/* animName */
__dna_docout.writeString("animName", animName);
/* unk1 */
__dna_docout.writeFloat("unk1", unk1);
/* unk2 */
__dna_docout.writeUint32("unk2", unk2);
}
static const char* DNAType()
{
return "DataSpec::DNAMP1::ANCS::AnimationSet::MetaAnimPrimitive";
}
size_t binarySize(size_t __isz) const
{
__isz = animId.binarySize(__isz);
__isz += animName.size() + 1;
return __isz + 12;
}
void gatherPrimitives(std::map<atUint32, DNAANCS::AnimationResInfo<UniqueID32>>& out) void gatherPrimitives(std::map<atUint32, DNAANCS::AnimationResInfo<UniqueID32>>& out)
{ {
out[animIdx] = {animName, animId, UniqueID32(), false}; out[animIdx] = {animName, animId, UniqueID32(), false};
@ -268,7 +202,8 @@ struct ANCS : BigYAML
{ {
MetaAnimBlend() MetaAnimBlend()
: IMetaAnim(Type::Blend, "Blend") {} : IMetaAnim(Type::Blend, "Blend") {}
DECL_YAML AT_DECL_DNA_YAML
AT_DECL_DNAV
MetaAnimFactory animA; MetaAnimFactory animA;
MetaAnimFactory animB; MetaAnimFactory animB;
Value<float> unkFloat; Value<float> unkFloat;
@ -293,7 +228,8 @@ struct ANCS : BigYAML
{ {
MetaAnimPhaseBlend() MetaAnimPhaseBlend()
: IMetaAnim(Type::PhaseBlend, "PhaseBlend") {} : IMetaAnim(Type::PhaseBlend, "PhaseBlend") {}
DECL_YAML AT_DECL_DNA_YAML
AT_DECL_DNAV
MetaAnimFactory animA; MetaAnimFactory animA;
MetaAnimFactory animB; MetaAnimFactory animB;
Value<float> unkFloat; Value<float> unkFloat;
@ -317,11 +253,12 @@ struct ANCS : BigYAML
struct MetaAnimRandom : IMetaAnim struct MetaAnimRandom : IMetaAnim
{ {
MetaAnimRandom() : IMetaAnim(Type::Random, "Random") {} MetaAnimRandom() : IMetaAnim(Type::Random, "Random") {}
DECL_YAML AT_DECL_DNA_YAML
AT_DECL_DNAV
Value<atUint32> animCount; Value<atUint32> animCount;
struct Child : BigYAML struct Child : BigDNA
{ {
DECL_YAML AT_DECL_DNA
MetaAnimFactory anim; MetaAnimFactory anim;
Value<atUint32> probability; Value<atUint32> probability;
}; };
@ -344,7 +281,8 @@ struct ANCS : BigYAML
struct MetaAnimSequence : IMetaAnim struct MetaAnimSequence : IMetaAnim
{ {
MetaAnimSequence() : IMetaAnim(Type::Sequence, "Sequence") {} MetaAnimSequence() : IMetaAnim(Type::Sequence, "Sequence") {}
DECL_YAML AT_DECL_DNA_YAML
AT_DECL_DNAV
Value<atUint32> animCount; Value<atUint32> animCount;
Vector<MetaAnimFactory, DNA_COUNT(animCount)> children; Vector<MetaAnimFactory, DNA_COUNT(animCount)> children;
@ -363,18 +301,17 @@ struct ANCS : BigYAML
} }
}; };
struct Animation : BigYAML struct Animation : BigDNA
{ {
DECL_YAML AT_DECL_DNA_YAML
String<-1> name; String<-1> name;
MetaAnimFactory metaAnim; MetaAnimFactory metaAnim;
}; };
std::vector<Animation> animations; std::vector<Animation> animations;
struct IMetaTrans : BigYAML struct IMetaTrans : BigDNAVYaml
{ {
Delete expl; Delete expl;
virtual ~IMetaTrans() {}
enum class Type enum class Type
{ {
MetaAnim = 0, MetaAnim = 0,
@ -388,9 +325,9 @@ struct ANCS : BigYAML
virtual void gatherPrimitives(std::map<atUint32, DNAANCS::AnimationResInfo<UniqueID32>>& out) {} virtual void gatherPrimitives(std::map<atUint32, DNAANCS::AnimationResInfo<UniqueID32>>& out) {}
virtual bool enumeratePrimitives(const std::function<bool(MetaAnimPrimitive& prim)>& func) {return true;} virtual bool enumeratePrimitives(const std::function<bool(MetaAnimPrimitive& prim)>& func) {return true;}
}; };
struct MetaTransFactory : BigYAML struct MetaTransFactory : BigDNA
{ {
DECL_YAML AT_DECL_DNA_YAML
Delete expl; Delete expl;
std::unique_ptr<IMetaTrans> m_trans; std::unique_ptr<IMetaTrans> m_trans;
}; };
@ -398,7 +335,8 @@ struct ANCS : BigYAML
{ {
MetaTransMetaAnim() MetaTransMetaAnim()
: IMetaTrans(Type::MetaAnim, "MetaAnim") {} : IMetaTrans(Type::MetaAnim, "MetaAnim") {}
DECL_YAML AT_DECL_DNA_YAML
AT_DECL_DNAV
MetaAnimFactory anim; MetaAnimFactory anim;
void gatherPrimitives(std::map<atUint32, DNAANCS::AnimationResInfo<UniqueID32>>& out) void gatherPrimitives(std::map<atUint32, DNAANCS::AnimationResInfo<UniqueID32>>& out)
@ -415,7 +353,8 @@ struct ANCS : BigYAML
{ {
MetaTransTrans() MetaTransTrans()
: IMetaTrans(Type::Trans, "Trans") {} : IMetaTrans(Type::Trans, "Trans") {}
DECL_YAML AT_DECL_DNA_YAML
AT_DECL_DNAV
Value<float> transDurTime; Value<float> transDurTime;
Value<atUint32> transDurTimeMode; Value<atUint32> transDurTimeMode;
Value<bool> unk2; Value<bool> unk2;
@ -426,7 +365,8 @@ struct ANCS : BigYAML
{ {
MetaTransPhaseTrans() MetaTransPhaseTrans()
: IMetaTrans(Type::PhaseTrans, "PhaseTrans") {} : IMetaTrans(Type::PhaseTrans, "PhaseTrans") {}
DECL_YAML AT_DECL_DNA_YAML
AT_DECL_DNAV
Value<float> transDurTime; Value<float> transDurTime;
Value<atUint32> transDurTimeMode; Value<atUint32> transDurTimeMode;
Value<bool> unk2; Value<bool> unk2;
@ -434,9 +374,9 @@ struct ANCS : BigYAML
Value<atUint32> flags; Value<atUint32> flags;
}; };
struct Transition : BigYAML struct Transition : BigDNA
{ {
DECL_YAML AT_DECL_DNA_YAML
Value<atUint32> unk; Value<atUint32> unk;
Value<atUint32> animIdxA; Value<atUint32> animIdxA;
Value<atUint32> animIdxB; Value<atUint32> animIdxB;
@ -445,9 +385,9 @@ struct ANCS : BigYAML
std::vector<Transition> transitions; std::vector<Transition> transitions;
MetaTransFactory defaultTransition; MetaTransFactory defaultTransition;
struct AdditiveAnimationInfo : BigYAML struct AdditiveAnimationInfo : BigDNA
{ {
DECL_YAML AT_DECL_DNA_YAML
Value<atUint32> animIdx; Value<atUint32> animIdx;
Value<float> unk1; Value<float> unk1;
Value<float> unk2; Value<float> unk2;
@ -457,17 +397,17 @@ struct ANCS : BigYAML
float floatA = 0.0; float floatA = 0.0;
float floatB = 0.0; float floatB = 0.0;
struct HalfTransition : BigYAML struct HalfTransition : BigDNA
{ {
DECL_YAML AT_DECL_DNA_YAML
Value<atUint32> animIdx; Value<atUint32> animIdx;
MetaTransFactory metaTrans; MetaTransFactory metaTrans;
}; };
std::vector<HalfTransition> halfTransitions; std::vector<HalfTransition> halfTransitions;
struct AnimationResources : BigYAML struct AnimationResources : BigDNA
{ {
DECL_YAML AT_DECL_DNA_YAML
UniqueID32 animId; UniqueID32 animId;
UniqueID32 evntId; UniqueID32 evntId;
}; };

View File

@ -94,7 +94,48 @@ void ANIM::IANIM::sendANIMToBlender(hecl::blender::PyOutStream& os, const DNAANI
} }
} }
void ANIM::ANIM0::read(athena::io::IStreamReader& reader) template <>
void ANIM::Enumerate<BigDNA::Read>(typename Read::StreamT& reader)
{
atUint32 version = reader.readUint32Big();
switch (version)
{
case 0:
m_anim.reset(new struct ANIM0);
m_anim->read(reader);
break;
case 2:
m_anim.reset(new struct ANIM2(false));
m_anim->read(reader);
break;
case 3:
m_anim.reset(new struct ANIM2(true));
m_anim->read(reader);
break;
default:
Log.report(logvisor::Error, "unrecognized ANIM version");
break;
}
}
template <>
void ANIM::Enumerate<BigDNA::Write>(typename Write::StreamT& writer)
{
writer.writeUint32Big(m_anim->m_version);
m_anim->write(writer);
}
template <>
void ANIM::Enumerate<BigDNA::BinarySize>(typename BinarySize::StreamT& s)
{
s += 4;
m_anim->binarySize(s);
}
const char* ANIM::ANIM0::DNAType() { return "ANIM0"; }
template <>
void ANIM::ANIM0::Enumerate<BigDNA::Read>(athena::io::IStreamReader& reader)
{ {
Header head; Header head;
head.read(reader); head.read(reader);
@ -164,7 +205,8 @@ void ANIM::ANIM0::read(athena::io::IStreamReader& reader)
evnt.read(reader); evnt.read(reader);
} }
void ANIM::ANIM0::write(athena::io::IStreamWriter& writer) const template <>
void ANIM::ANIM0::Enumerate<BigDNA::Write>(athena::io::IStreamWriter& writer)
{ {
Header head; Header head;
head.unk0 = 0; head.unk0 = 0;
@ -242,7 +284,8 @@ void ANIM::ANIM0::write(athena::io::IStreamWriter& writer) const
evnt.write(writer); evnt.write(writer);
} }
size_t ANIM::ANIM0::binarySize(size_t __isz) const template <>
void ANIM::ANIM0::Enumerate<BigDNA::BinarySize>(size_t& __isz)
{ {
Header head; Header head;
@ -250,7 +293,7 @@ size_t ANIM::ANIM0::binarySize(size_t __isz) const
for (const std::pair<atUint32, bool>& bone : bones) for (const std::pair<atUint32, bool>& bone : bones)
maxId = std::max(maxId, bone.first); maxId = std::max(maxId, bone.first);
__isz = head.binarySize(__isz); head.binarySize(__isz);
__isz += maxId + 1; __isz += maxId + 1;
__isz += bones.size() + 4; __isz += bones.size() + 4;
@ -262,10 +305,13 @@ size_t ANIM::ANIM0::binarySize(size_t __isz) const
__isz += head.keyCount * 12; __isz += head.keyCount * 12;
} }
return __isz + 4; __isz += 4;
} }
void ANIM::ANIM2::read(athena::io::IStreamReader& reader) const char* ANIM::ANIM2::DNAType() { return "ANIM2"; }
template <>
void ANIM::ANIM2::Enumerate<BigDNA::Read>(athena::io::IStreamReader& reader)
{ {
Header head; Header head;
head.read(reader); head.read(reader);
@ -374,7 +420,8 @@ void ANIM::ANIM2::read(athena::io::IStreamReader& reader)
chanKeys = bsReader.read(bsData.get(), keyframeCount, channels, head.rotDiv, head.translationMult, 0.f); chanKeys = bsReader.read(bsData.get(), keyframeCount, channels, head.rotDiv, head.translationMult, 0.f);
} }
void ANIM::ANIM2::write(athena::io::IStreamWriter& writer) const template <>
void ANIM::ANIM2::Enumerate<BigDNA::Write>(athena::io::IStreamWriter& writer)
{ {
Header head; Header head;
head.evnt = evnt; head.evnt = evnt;
@ -408,7 +455,11 @@ void ANIM::ANIM2::write(athena::io::IStreamWriter& writer) const
head.rotDiv, head.translationMult, scaleMult, bsSize); head.rotDiv, head.translationMult, scaleMult, bsSize);
/* Tally up buffer size */ /* Tally up buffer size */
head.scratchSize = head.binarySize(0) + keyBmp.binarySize(0) + bsSize; size_t scratchSize = 0;
head.binarySize(scratchSize);
keyBmp.binarySize(scratchSize);
scratchSize += bsSize;
head.scratchSize = scratchSize;
if (m_version == 3) if (m_version == 3)
{ {
for (const std::pair<atUint32, bool>& bone : bones) for (const std::pair<atUint32, bool>& bone : bones)
@ -492,7 +543,8 @@ void ANIM::ANIM2::write(athena::io::IStreamWriter& writer) const
writer.writeUBytes(bsData.get(), bsSize); writer.writeUBytes(bsData.get(), bsSize);
} }
size_t ANIM::ANIM2::binarySize(size_t __isz) const template <>
void ANIM::ANIM2::Enumerate<BigDNA::BinarySize>(size_t& __isz)
{ {
Header head; Header head;
@ -500,8 +552,8 @@ size_t ANIM::ANIM2::binarySize(size_t __isz) const
for (atUint32 frame : frames) for (atUint32 frame : frames)
keyBmp.setBit(frame); keyBmp.setBit(frame);
__isz = head.binarySize(__isz); head.binarySize(__isz);
__isz = keyBmp.binarySize(__isz); keyBmp.binarySize(__isz);
__isz += 8; __isz += 8;
if (m_version == 3) if (m_version == 3)
{ {
@ -522,7 +574,7 @@ size_t ANIM::ANIM2::binarySize(size_t __isz) const
} }
} }
return __isz + DNAANIM::ComputeBitstreamSize(frames.size(), channels); __isz += DNAANIM::ComputeBitstreamSize(frames.size(), channels);
} }
ANIM::ANIM(const BlenderAction& act, ANIM::ANIM(const BlenderAction& act,

View File

@ -11,9 +11,9 @@ namespace DataSpec::DNAMP1
struct ANIM : BigDNA struct ANIM : BigDNA
{ {
Delete expl; AT_DECL_EXPLICIT_DNA
struct IANIM : BigDNA struct IANIM : BigDNAV
{ {
Delete expl; Delete expl;
atUint32 m_version; atUint32 m_version;
@ -32,12 +32,13 @@ struct ANIM : BigDNA
struct ANIM0 : IANIM struct ANIM0 : IANIM
{ {
DECL_EXPLICIT_DNA AT_DECL_EXPLICIT_DNA
AT_DECL_DNAV
ANIM0() : IANIM(0) {} ANIM0() : IANIM(0) {}
struct Header : BigDNA struct Header : BigDNA
{ {
DECL_DNA AT_DECL_DNA
Value<float> duration; Value<float> duration;
Value<atUint32> unk0; Value<atUint32> unk0;
Value<float> interval; Value<float> interval;
@ -50,12 +51,13 @@ struct ANIM : BigDNA
struct ANIM2 : IANIM struct ANIM2 : IANIM
{ {
DECL_EXPLICIT_DNA AT_DECL_EXPLICIT_DNA
AT_DECL_DNAV
ANIM2(bool pc) : IANIM(pc ? 3 : 2) {} ANIM2(bool pc) : IANIM(pc ? 3 : 2) {}
struct Header : BigDNA struct Header : BigDNA
{ {
DECL_DNA AT_DECL_DNA
Value<atUint32> scratchSize; Value<atUint32> scratchSize;
UniqueID32 evnt; UniqueID32 evnt;
Value<atUint32> unk0 = 1; Value<atUint32> unk0 = 1;
@ -194,39 +196,6 @@ struct ANIM : BigDNA
}; };
std::unique_ptr<IANIM> m_anim; std::unique_ptr<IANIM> m_anim;
void read(athena::io::IStreamReader& reader)
{
atUint32 version = reader.readUint32Big();
switch (version)
{
case 0:
m_anim.reset(new struct ANIM0);
m_anim->read(reader);
break;
case 2:
m_anim.reset(new struct ANIM2(false));
m_anim->read(reader);
break;
case 3:
m_anim.reset(new struct ANIM2(true));
m_anim->read(reader);
break;
default:
Log.report(logvisor::Error, "unrecognized ANIM version");
break;
}
}
void write(athena::io::IStreamWriter& writer) const
{
writer.writeUint32Big(m_anim->m_version);
m_anim->write(writer);
}
size_t binarySize(size_t __isz) const
{
return m_anim->binarySize(__isz + 4);
}
void sendANIMToBlender(hecl::blender::PyOutStream& os, const DNAANIM::RigInverter<CINF>& rig, bool) const void sendANIMToBlender(hecl::blender::PyOutStream& os, const DNAANIM::RigInverter<CINF>& rig, bool) const
{ {

View File

@ -9,11 +9,11 @@ namespace DataSpec::DNAMP1
struct CINF : BigDNA struct CINF : BigDNA
{ {
DECL_DNA AT_DECL_DNA
Value<atUint32> boneCount; Value<atUint32> boneCount;
struct Bone : BigDNA struct Bone : BigDNA
{ {
DECL_DNA AT_DECL_DNA
Value<atUint32> id; Value<atUint32> id;
Value<atUint32> parentId; Value<atUint32> parentId;
Value<atVec3f> origin; Value<atVec3f> origin;
@ -28,7 +28,7 @@ struct CINF : BigDNA
Value<atUint32> nameCount; Value<atUint32> nameCount;
struct Name : BigDNA struct Name : BigDNA
{ {
DECL_DNA AT_DECL_DNA
String<-1> name; String<-1> name;
Value<atUint32> boneId; Value<atUint32> boneId;
}; };

View File

@ -1140,7 +1140,9 @@ MaterialSet::Material::Material(const hecl::Backend::GX& gx,
found = true; found = true;
++uvAnimsCount; ++uvAnimsCount;
uvAnims.emplace_back(tcg.m_gameFunction, tcg.m_gameArgs); uvAnims.emplace_back(tcg.m_gameFunction, tcg.m_gameArgs);
uvAnimsSize = uvAnims.back().binarySize(uvAnimsSize); size_t tmpUvAnimsSize = uvAnimsSize;
uvAnims.back().binarySize(tmpUvAnimsSize);
uvAnimsSize = tmpUvAnimsSize;
break; break;
} }
} }
@ -1233,7 +1235,9 @@ HMDLMaterialSet::Material::Material(hecl::Frontend::Frontend& FE,
++uvAnimsCount; ++uvAnimsCount;
uvAnims.emplace_back(sourceInst.m_call.m_name, gameArgs); uvAnims.emplace_back(sourceInst.m_call.m_name, gameArgs);
uvAnimsSize = uvAnims.back().binarySize(uvAnimsSize); size_t tmpUvAnimsSize = uvAnimsSize;
uvAnims.back().binarySize(tmpUvAnimsSize);
uvAnimsSize = tmpUvAnimsSize;
} }
} }
@ -1296,6 +1300,36 @@ MaterialSet::Material::UVAnimation::UVAnimation(const std::string& gameFunction,
Log.report(logvisor::Fatal, "unsupported UV anim '%s'", gameFunction.c_str()); Log.report(logvisor::Fatal, "unsupported UV anim '%s'", gameFunction.c_str());
} }
template <class Op>
void MaterialSet::Material::UVAnimation::Enumerate(typename Op::StreamT& s)
{
Do<Op>({}, mode, s);
switch (mode)
{
case Mode::MvInvNoTranslation:
case Mode::MvInv:
case Mode::Model:
break;
case Mode::Scroll:
case Mode::HStrip:
case Mode::VStrip:
for (int i=0 ; i<4 ; ++i)
Do<Op>({}, vals[i], s);
break;
case Mode::Rotation:
case Mode::CylinderEnvironment:
for (int i=0 ; i<2 ; ++i)
Do<Op>({}, vals[i], s);
break;
case Mode::Eight:
for (int i=0 ; i<9 ; ++i)
Do<Op>({}, vals[i], s);
break;
}
}
AT_SPECIALIZE_DNA(MaterialSet::Material::UVAnimation)
} }
namespace DataSpec::DNAMP2 namespace DataSpec::DNAMP2

View File

@ -13,10 +13,10 @@ struct MaterialSet : BigDNA
{ {
static constexpr bool OneSection() {return false;} static constexpr bool OneSection() {return false;}
DECL_DNA AT_DECL_DNA
struct MaterialSetHead : BigDNA struct MaterialSetHead : BigDNA
{ {
DECL_DNA AT_DECL_DNA
Value<atUint32> textureCount = 0; Value<atUint32> textureCount = 0;
Vector<UniqueID32, DNA_COUNT(textureCount)> textureIDs; Vector<UniqueID32, DNA_COUNT(textureCount)> textureIDs;
Value<atUint32> materialCount = 0; Value<atUint32> materialCount = 0;
@ -28,10 +28,10 @@ struct MaterialSet : BigDNA
struct Material : BigDNA struct Material : BigDNA
{ {
DECL_DNA AT_DECL_DNA
struct Flags : BigDNA struct Flags : BigDNA
{ {
DECL_DNA AT_DECL_DNA
Value<atUint32> flags = 0; Value<atUint32> flags = 0;
bool konstValuesEnabled() const {return (flags & 0x8) != 0;} bool konstValuesEnabled() const {return (flags & 0x8) != 0;}
void setKonstValuesEnabled(bool enabled) {flags &= ~0x8; flags |= atUint32(enabled) << 3;} void setKonstValuesEnabled(bool enabled) {flags &= ~0x8; flags |= atUint32(enabled) << 3;}
@ -62,7 +62,7 @@ struct MaterialSet : BigDNA
Vector<atUint32, DNA_COUNT(textureCount)> textureIdxs; Vector<atUint32, DNA_COUNT(textureCount)> textureIdxs;
struct VAFlags : BigDNA struct VAFlags : BigDNA
{ {
DECL_DNA AT_DECL_DNA
Value<atUint32> vaFlags = 0; Value<atUint32> vaFlags = 0;
GX::AttrType position() const {return GX::AttrType(vaFlags & 0x3);} GX::AttrType position() const {return GX::AttrType(vaFlags & 0x3);}
void setPosition(GX::AttrType val) {vaFlags &= ~0x3; vaFlags |= atUint32(val);} void setPosition(GX::AttrType val) {vaFlags &= ~0x3; vaFlags |= atUint32(val);}
@ -143,7 +143,7 @@ struct MaterialSet : BigDNA
Value<atUint32> colorChannelCount = 0; Value<atUint32> colorChannelCount = 0;
struct ColorChannel : BigDNA struct ColorChannel : BigDNA
{ {
DECL_DNA AT_DECL_DNA
Value<atUint32> flags = 0; Value<atUint32> flags = 0;
bool lighting() const {return (flags & 0x1) != 0;} bool lighting() const {return (flags & 0x1) != 0;}
void setLighting(bool enabled) {flags &= ~0x1; flags |= atUint32(enabled);} void setLighting(bool enabled) {flags &= ~0x1; flags |= atUint32(enabled);}
@ -163,7 +163,7 @@ struct MaterialSet : BigDNA
Value<atUint32> tevStageCount = 0; Value<atUint32> tevStageCount = 0;
struct TEVStage : BigDNA struct TEVStage : BigDNA
{ {
DECL_DNA AT_DECL_DNA
Value<atUint32> ciFlags = 0; Value<atUint32> ciFlags = 0;
Value<atUint32> aiFlags = 0; Value<atUint32> aiFlags = 0;
Value<atUint32> ccFlags = 0; Value<atUint32> ccFlags = 0;
@ -221,7 +221,7 @@ struct MaterialSet : BigDNA
Vector<TEVStage, DNA_COUNT(tevStageCount)> tevStages; Vector<TEVStage, DNA_COUNT(tevStageCount)> tevStages;
struct TEVStageTexInfo : BigDNA struct TEVStageTexInfo : BigDNA
{ {
DECL_DNA AT_DECL_DNA
Value<atUint16> pad = 0; Value<atUint16> pad = 0;
Value<atUint8> texSlot = 0xff; Value<atUint8> texSlot = 0xff;
Value<atUint8> tcgSlot = 0xff; Value<atUint8> tcgSlot = 0xff;
@ -231,7 +231,7 @@ struct MaterialSet : BigDNA
Value<atUint32> tcgCount = 0; Value<atUint32> tcgCount = 0;
struct TexCoordGen : BigDNA struct TexCoordGen : BigDNA
{ {
DECL_DNA AT_DECL_DNA
Value<atUint32> flags = 0; Value<atUint32> flags = 0;
GX::TexGenType type() const {return GX::TexGenType(flags & 0xf);} GX::TexGenType type() const {return GX::TexGenType(flags & 0xf);}
@ -251,7 +251,7 @@ struct MaterialSet : BigDNA
Value<atUint32> uvAnimsCount = 0; Value<atUint32> uvAnimsCount = 0;
struct UVAnimation : BigDNA struct UVAnimation : BigDNA
{ {
Delete expl; AT_DECL_EXPLICIT_DNA
enum class Mode enum class Mode
{ {
MvInvNoTranslation, MvInvNoTranslation,
@ -265,96 +265,6 @@ struct MaterialSet : BigDNA
Eight Eight
} mode; } mode;
float vals[9]; float vals[9];
void read(athena::io::IStreamReader& reader)
{
mode = Mode(reader.readUint32Big());
switch (mode)
{
case Mode::MvInvNoTranslation:
case Mode::MvInv:
case Mode::Model:
break;
case Mode::Scroll:
case Mode::HStrip:
case Mode::VStrip:
vals[0] = reader.readFloatBig();
vals[1] = reader.readFloatBig();
vals[2] = reader.readFloatBig();
vals[3] = reader.readFloatBig();
break;
case Mode::Rotation:
case Mode::CylinderEnvironment:
vals[0] = reader.readFloatBig();
vals[1] = reader.readFloatBig();
break;
case Mode::Eight:
vals[0] = reader.readFloatBig();
vals[1] = reader.readFloatBig();
vals[2] = reader.readFloatBig();
vals[3] = reader.readFloatBig();
vals[4] = reader.readFloatBig();
vals[5] = reader.readFloatBig();
vals[6] = reader.readFloatBig();
vals[7] = reader.readFloatBig();
vals[8] = reader.readFloatBig();
break;
}
}
void write(athena::io::IStreamWriter& writer) const
{
writer.writeUint32Big(atUint32(mode));
switch (mode)
{
case Mode::MvInvNoTranslation:
case Mode::MvInv:
case Mode::Model:
break;
case Mode::Scroll:
case Mode::HStrip:
case Mode::VStrip:
writer.writeFloatBig(vals[0]);
writer.writeFloatBig(vals[1]);
writer.writeFloatBig(vals[2]);
writer.writeFloatBig(vals[3]);
break;
case Mode::Rotation:
case Mode::CylinderEnvironment:
writer.writeFloatBig(vals[0]);
writer.writeFloatBig(vals[1]);
break;
case Mode::Eight:
writer.writeFloatBig(vals[0]);
writer.writeFloatBig(vals[1]);
writer.writeFloatBig(vals[2]);
writer.writeFloatBig(vals[3]);
writer.writeFloatBig(vals[4]);
writer.writeFloatBig(vals[5]);
writer.writeFloatBig(vals[6]);
writer.writeFloatBig(vals[7]);
writer.writeFloatBig(vals[8]);
break;
}
}
size_t binarySize(size_t __isz) const
{
switch (mode)
{
case Mode::MvInvNoTranslation:
case Mode::MvInv:
case Mode::Model:
return __isz + 4;
case Mode::Scroll:
case Mode::HStrip:
case Mode::VStrip:
return __isz + 20;
case Mode::Rotation:
case Mode::CylinderEnvironment:
return __isz + 12;
case Mode::Eight:
return __isz + 40;
}
return __isz + 4;
}
UVAnimation() = default; UVAnimation() = default;
UVAnimation(const std::string& gameFunction, UVAnimation(const std::string& gameFunction,
@ -447,12 +357,12 @@ struct HMDLMaterialSet : BigDNA
{ {
static constexpr bool OneSection() {return false;} static constexpr bool OneSection() {return false;}
DECL_DNA AT_DECL_DNA
MaterialSet::MaterialSetHead head; MaterialSet::MaterialSetHead head;
struct Material : BigDNA struct Material : BigDNA
{ {
DECL_DNA AT_DECL_DNA
MaterialSet::Material::Flags flags; MaterialSet::Material::Flags flags;
Value<atUint32> textureCount = 0; Value<atUint32> textureCount = 0;

View File

@ -39,6 +39,7 @@ make_dnalist(liblist DNAMP1
set(DNAMP1_SOURCES set(DNAMP1_SOURCES
DNAMP1.hpp DNAMP1.cpp DNAMP1.hpp DNAMP1.cpp
AFSM.cpp
PAK.cpp PAK.cpp
MLVL.cpp MLVL.cpp
STRG.hpp STRG.cpp STRG.hpp STRG.cpp
@ -57,6 +58,7 @@ set(DNAMP1_SOURCES
MREA.cpp MREA.cpp
SCLY.hpp SCLY.cpp SCLY.hpp SCLY.cpp
FRME.cpp FRME.cpp
SCAN.cpp
DeafBabe.cpp DeafBabe.cpp
Tweaks/CTweakPlayer.cpp Tweaks/CTweakPlayer.cpp
Tweaks/CTweakTargeting.cpp Tweaks/CTweakTargeting.cpp

View File

@ -9,15 +9,15 @@ namespace DataSpec::DNAMP1
struct CSKR : BigDNA struct CSKR : BigDNA
{ {
DECL_DNA AT_DECL_DNA
Value<atUint32> skinningRuleCount; Value<atUint32> skinningRuleCount;
struct SkinningRule : BigDNA struct SkinningRule : BigDNA
{ {
DECL_DNA AT_DECL_DNA
Value<atUint32> weightCount; Value<atUint32> weightCount;
struct Weight : BigDNA struct Weight : BigDNA
{ {
DECL_DNA AT_DECL_DNA
Value<atUint32> boneId; Value<atUint32> boneId;
Value<float> weight; Value<float> weight;
}; };

View File

@ -11,7 +11,7 @@ class CSNG
{ {
struct Header : BigDNA struct Header : BigDNA
{ {
DECL_DNA AT_DECL_DNA
Value<atUint32> magic = 0x2; Value<atUint32> magic = 0x2;
Value<atUint32> midiSetupId; Value<atUint32> midiSetupId;
Value<atUint32> songGroupId; Value<atUint32> songGroupId;

View File

@ -30,6 +30,33 @@ void DCLN::Collision::NodesendToBlender(hecl::blender::PyOutStream& os) const
} }
#endif #endif
template <class Op>
void DCLN::Collision::Node::Enumerate(typename Op::StreamT& s)
{
Do<Op>({"xf[0]"}, xf[0], s);
Do<Op>({"xf[1]"}, xf[1], s);
Do<Op>({"xf[2]"}, xf[2], s);
Do<Op>({"halfExtent"}, halfExtent, s);
Do<Op>({"isLeaf"}, isLeaf, s);
if (isLeaf)
{
if (!leafData)
leafData.reset(new LeafData);
Do<Op>({"leafData"}, *leafData, s);
}
else
{
if (!left)
left.reset(new Node);
Do<Op>({"left"}, *left, s);
if (!right)
right.reset(new Node);
Do<Op>({"right"}, *right, s);
}
}
AT_SPECIALIZE_DNA(DCLN::Collision::Node)
void DCLN::sendToBlender(hecl::blender::Connection& conn, std::string_view entryName) void DCLN::sendToBlender(hecl::blender::Connection& conn, std::string_view entryName)
{ {
/* Open Py Stream and read sections */ /* Open Py Stream and read sections */

View File

@ -17,7 +17,7 @@ struct DCLN : BigDNA
{ {
using Mesh = hecl::blender::ColMesh; using Mesh = hecl::blender::ColMesh;
DECL_DNA AT_DECL_DNA
Value<atUint32> colCount; Value<atUint32> colCount;
struct Collision : BigDNA struct Collision : BigDNA
{ {
@ -25,7 +25,7 @@ struct DCLN : BigDNA
using Edge = DeafBabe::Edge; using Edge = DeafBabe::Edge;
using Triangle = DeafBabe::Triangle; using Triangle = DeafBabe::Triangle;
DECL_DNA AT_DECL_DNA
Value<atUint32> magic; Value<atUint32> magic;
Value<atUint32> version; Value<atUint32> version;
Value<atUint32> memSize; Value<atUint32> memSize;
@ -46,11 +46,11 @@ struct DCLN : BigDNA
struct Node : BigDNA struct Node : BigDNA
{ {
Delete _d; AT_DECL_EXPLICIT_DNA
struct LeafData : BigDNA struct LeafData : BigDNA
{ {
DECL_DNA AT_DECL_DNA
Value<atUint32> triangleIndexCount; Value<atUint32> triangleIndexCount;
Vector<atUint16, DNA_COUNT(triangleIndexCount)> triangleIndices; Vector<atUint16, DNA_COUNT(triangleIndexCount)> triangleIndices;
size_t getMemoryUsage() const { return (((triangleIndices.size() * 2) + 16) + 3) & ~3; } size_t getMemoryUsage() const { return (((triangleIndices.size() * 2) + 16) + 3) & ~3; }
@ -63,56 +63,6 @@ struct DCLN : BigDNA
std::unique_ptr<Node> left; std::unique_ptr<Node> left;
std::unique_ptr<Node> right; std::unique_ptr<Node> right;
void read(athena::io::IStreamReader & __dna_reader)
{
xf[0] = __dna_reader.readVec4fBig();
xf[1] = __dna_reader.readVec4fBig();
xf[2] = __dna_reader.readVec4fBig();
halfExtent = __dna_reader.readVec3fBig();
isLeaf = __dna_reader.readBool();
if (isLeaf)
{
leafData.reset(new LeafData);
leafData->read(__dna_reader);
}
else
{
left.reset(new Node);
left->read(__dna_reader);
right.reset(new Node);
right->read(__dna_reader);
}
}
void write(athena::io::IStreamWriter & __dna_writer) const
{
__dna_writer.writeVec4fBig(xf[0]);
__dna_writer.writeVec4fBig(xf[1]);
__dna_writer.writeVec4fBig(xf[2]);
__dna_writer.writeVec3fBig(halfExtent);
__dna_writer.writeBool(isLeaf);
if (isLeaf && leafData)
leafData->write(__dna_writer);
else if (!isLeaf && left && right)
{
left->write(__dna_writer);
right->write(__dna_writer);
}
}
size_t binarySize(size_t __isz) const
{
__isz += 61;
if (isLeaf && leafData)
__isz = leafData->binarySize(__isz);
else if (!isLeaf && left && right)
{
__isz = left->binarySize(__isz);
__isz = right->binarySize(__isz);
}
return __isz;
}
size_t getMemoryUsage() const size_t getMemoryUsage() const
{ {
size_t ret = 80; size_t ret = 80;

View File

@ -8,12 +8,12 @@ namespace DataSpec::DNAMP1
struct DeafBabe : BigDNA struct DeafBabe : BigDNA
{ {
DECL_DNA AT_DECL_DNA
using BspNodeType = DataSpec::BspNodeType; using BspNodeType = DataSpec::BspNodeType;
struct Material : BigDNA struct Material : BigDNA
{ {
DECL_DNA AT_DECL_DNA
Value<atUint32> material = 0; Value<atUint32> material = 0;
bool unknown() const { return material & 1; } bool unknown() const { return material & 1; }
void setUnknown(bool v) { material &= ~1; material |= int(v); } void setUnknown(bool v) { material &= ~1; material |= int(v); }
@ -107,13 +107,13 @@ struct DeafBabe : BigDNA
struct Edge : BigDNA struct Edge : BigDNA
{ {
DECL_DNA AT_DECL_DNA
Value<atUint16> verts[2]; Value<atUint16> verts[2];
}; };
struct Triangle : BigDNA struct Triangle : BigDNA
{ {
DECL_DNA AT_DECL_DNA
Value<atUint16> edges[3]; Value<atUint16> edges[3];
}; };

View File

@ -3,94 +3,32 @@
namespace DataSpec::DNAMP1 namespace DataSpec::DNAMP1
{ {
void EVNT::read(athena::io::IStreamReader& reader) template <class Op>
void EVNT::Enumerate(typename Op::StreamT& s)
{ {
version = reader.readUint32Big(); Do<Op>({"version"}, version, s);
atUint32 loopCount = reader.readUint32Big(); DoSize<Op>({"boolPOICount"}, boolPOICount, s);
reader.enumerate(boolPOINodes, loopCount); Do<Op>({"boolPOINodes"}, boolPOINodes, boolPOICount, s);
int32POINodes.clear(); DoSize<Op>({"int32POICount"}, int32POICount, s);
atUint32 uevtCount = reader.readUint32Big(); Do<Op>({"int32POINodes"}, int32POINodes, int32POICount, s);
reader.enumerate(int32POINodes, uevtCount);
atUint32 effectCount = reader.readUint32Big(); DoSize<Op>({"particlePOICount"}, particlePOICount, s);
reader.enumerate(particlePOINodes, effectCount); Do<Op>({"particlePOINodes"}, particlePOINodes, particlePOICount, s);
if (version == 2) if (version == 2)
{ {
atUint32 sfxCount = reader.readUint32Big(); DoSize<Op>({"soundPOICount"}, soundPOICount, s);
reader.enumerate(soundPOINodes, sfxCount); Do<Op>({"particlePOINodes"}, soundPOINodes, soundPOICount, s);
} }
} }
void EVNT::write(athena::io::IStreamWriter& writer) const AT_SPECIALIZE_DNA_YAML(EVNT)
{
writer.writeUint32Big(version);
writer.writeUint32Big(boolPOINodes.size());
writer.enumerate(boolPOINodes);
writer.writeUint32Big(int32POINodes.size());
writer.enumerate(int32POINodes);
writer.writeUint32Big(particlePOINodes.size());
writer.enumerate(particlePOINodes);
if (version == 2)
{
writer.writeUint32Big(soundPOINodes.size());
writer.enumerate(soundPOINodes);
}
}
void EVNT::read(athena::io::YAMLDocReader& reader)
{
version = reader.readUint32("version");
reader.enumerate("boolPOINodes", boolPOINodes);
int32POINodes.clear();
reader.enumerate("int32POINodes", int32POINodes);
reader.enumerate("particlePOINodes", particlePOINodes);
if (version == 2)
{
reader.enumerate("soundPOINodes", soundPOINodes);
}
}
void EVNT::write(athena::io::YAMLDocWriter& writer) const
{
writer.writeUint32("version", version);
writer.enumerate("boolPOINodes", boolPOINodes);
writer.enumerate("int32POINodes", int32POINodes);
writer.enumerate("particlePOINodes", particlePOINodes);
if (version == 2)
{
writer.enumerate("soundPOINodes", soundPOINodes);
}
}
const char* EVNT::DNAType() const char* EVNT::DNAType()
{ {
return "urde::DNAMP1::EVNT"; return "urde::DNAMP1::EVNT";
} }
size_t EVNT::binarySize(size_t __isz) const
{
__isz = __EnumerateSize(__isz, boolPOINodes);
__isz = __EnumerateSize(__isz, int32POINodes);
__isz = __EnumerateSize(__isz, particlePOINodes);
if (version == 2)
__isz = __EnumerateSize(__isz, soundPOINodes);
return __isz + (version == 2 ? 20 : 16);
}
} }

View File

@ -7,19 +7,18 @@
namespace DataSpec::DNAMP1 namespace DataSpec::DNAMP1
{ {
struct EVNT : BigYAML struct EVNT : BigDNA
{ {
DECL_YAML AT_DECL_EXPLICIT_DNA_YAML
Delete expl;
Value<atUint32> version; Value<atUint32> version;
struct POINode : BigYAML struct POINode : BigDNA
{ {
DECL_YAML AT_DECL_DNA_YAML
Value<atUint16> unk0; Value<atUint16> unk0;
String<-1> name; String<-1> name;
Value<atUint16> type; Value<atUint16> type;
struct CharAnimTime : BigYAML struct CharAnimTime : BigDNA
{ {
enum class Type : atUint32 enum class Type : atUint32
{ {
@ -30,7 +29,7 @@ struct EVNT : BigYAML
Infinity Infinity
}; };
DECL_YAML AT_DECL_DNA_YAML
Value<float> time; Value<float> time;
Value<Type> type; Value<Type> type;
}; };
@ -45,22 +44,24 @@ struct EVNT : BigYAML
struct BoolPOINode : POINode struct BoolPOINode : POINode
{ {
DECL_YAML AT_DECL_DNA_YAML
Value<atUint8> value; Value<atUint8> value;
}; };
std::vector<BoolPOINode> boolPOINodes; Value<atUint32> boolPOICount;
Vector<BoolPOINode, DNA_COUNT(boolPOICount)> boolPOINodes;
struct Int32POINode : POINode struct Int32POINode : POINode
{ {
DECL_YAML AT_DECL_DNA_YAML
Value<atUint32> value; Value<atUint32> value;
String<-1> locator; String<-1> locator;
}; };
std::vector<Int32POINode> int32POINodes; Value<atUint32> int32POICount;
Vector<Int32POINode, DNA_COUNT(int32POICount)> int32POINodes;
struct ParticlePOINode : POINode struct ParticlePOINode : POINode
{ {
DECL_YAML AT_DECL_DNA_YAML
Value<atUint32> duration; Value<atUint32> duration;
DNAFourCC ptype; DNAFourCC ptype;
UniqueID32 id; UniqueID32 id;
@ -68,23 +69,25 @@ struct EVNT : BigYAML
Value<float> scale; Value<float> scale;
Value<atUint32> parentMode; Value<atUint32> parentMode;
}; };
std::vector<ParticlePOINode> particlePOINodes; Value<atUint32> particlePOICount;
Vector<ParticlePOINode, DNA_COUNT(particlePOICount)> particlePOINodes;
struct SoundPOINode : POINode struct SoundPOINode : POINode
{ {
DECL_YAML AT_DECL_DNA_YAML
Value<atUint32> soundId; Value<atUint32> soundId;
Value<float> falloff; Value<float> falloff;
Value<float> maxDist; Value<float> maxDist;
}; };
std::vector<SoundPOINode> soundPOINodes; Value<atUint32> soundPOICount;
Vector<SoundPOINode, DNA_COUNT(soundPOICount)> soundPOINodes;
static bool Extract(PAKEntryReadStream& rs, const hecl::ProjectPath& outPath) static bool Extract(PAKEntryReadStream& rs, const hecl::ProjectPath& outPath)
{ {
EVNT evnt; EVNT evnt;
evnt.read(rs); evnt.read(rs);
athena::io::FileWriter writer(outPath.getAbsolutePath()); athena::io::FileWriter writer(outPath.getAbsolutePath());
evnt.toYAMLStream(writer); athena::io::ToYAMLStream(evnt, writer);
return true; return true;
} }
@ -92,7 +95,7 @@ struct EVNT : BigYAML
{ {
EVNT evnt; EVNT evnt;
athena::io::FileReader reader(inPath.getAbsolutePath()); athena::io::FileReader reader(inPath.getAbsolutePath());
evnt.fromYAMLStream(reader); athena::io::FromYAMLStream(evnt, reader);
athena::io::FileWriter ws(outPath.getAbsolutePath()); athena::io::FileWriter ws(outPath.getAbsolutePath());
evnt.write(ws); evnt.write(ws);
return true; return true;

View File

@ -4,7 +4,9 @@
namespace DataSpec::DNAMP1 namespace DataSpec::DNAMP1
{ {
void FRME::read(athena::io::IStreamReader& __dna_reader)
template <>
void FRME::Enumerate<BigDNA::Read>(athena::io::IStreamReader& __dna_reader)
{ {
/* version */ /* version */
version = __dna_reader.readUint32Big(); version = __dna_reader.readUint32Big();
@ -23,7 +25,8 @@ void FRME::read(athena::io::IStreamReader& __dna_reader)
}); });
} }
void FRME::write(athena::io::IStreamWriter& __dna_writer) const template <>
void FRME::Enumerate<BigDNA::Write>(athena::io::IStreamWriter& __dna_writer)
{ {
/* version */ /* version */
__dna_writer.writeUint32Big(version); __dna_writer.writeUint32Big(version);
@ -39,13 +42,16 @@ void FRME::write(athena::io::IStreamWriter& __dna_writer) const
__dna_writer.enumerate(widgets); __dna_writer.enumerate(widgets);
} }
size_t FRME::binarySize(size_t __isz) const template <>
void FRME::Enumerate<BigDNA::BinarySize>(size_t& __isz)
{ {
__isz = __EnumerateSize(__isz, widgets); for (const Widget& w : widgets)
return __isz + 20; w.binarySize(__isz);
__isz += 20;
} }
void FRME::Widget::read(athena::io::IStreamReader& __dna_reader) template <>
void FRME::Widget::Enumerate<BigDNA::Read>(athena::io::IStreamReader& __dna_reader)
{ {
/* type */ /* type */
type.read(__dna_reader); type.read(__dna_reader);
@ -96,7 +102,8 @@ void FRME::Widget::read(athena::io::IStreamReader& __dna_reader)
unk2 = __dna_reader.readInt16Big(); unk2 = __dna_reader.readInt16Big();
} }
void FRME::Widget::write(athena::io::IStreamWriter& __dna_writer) const template <>
void FRME::Widget::Enumerate<BigDNA::Write>(athena::io::IStreamWriter& __dna_writer)
{ {
/* type */ /* type */
DNAFourCC _type = widgetInfo ? widgetInfo->fourcc() : FOURCC('BWIG'); DNAFourCC _type = widgetInfo ? widgetInfo->fourcc() : FOURCC('BWIG');
@ -131,18 +138,20 @@ void FRME::Widget::write(athena::io::IStreamWriter& __dna_writer) const
__dna_writer.writeInt16Big(unk2); __dna_writer.writeInt16Big(unk2);
} }
size_t FRME::Widget::binarySize(size_t __isz) const template <>
void FRME::Widget::Enumerate<BigDNA::BinarySize>(size_t& __isz)
{ {
__isz = type.binarySize(__isz); type.binarySize(__isz);
__isz = header.binarySize(__isz); header.binarySize(__isz);
if (widgetInfo) if (widgetInfo)
__isz = widgetInfo->binarySize(__isz); widgetInfo->binarySize(__isz);
if (isWorker) if (isWorker)
__isz += 4; __isz += 4;
return __isz + 67; __isz += 67;
} }
void FRME::Widget::CAMRInfo::read(athena::io::IStreamReader& __dna_reader) template <>
void FRME::Widget::CAMRInfo::Enumerate<BigDNA::Read>(athena::io::IStreamReader& __dna_reader)
{ {
projectionType = ProjectionType(__dna_reader.readUint32Big()); projectionType = ProjectionType(__dna_reader.readUint32Big());
if (projectionType == ProjectionType::Perspective) if (projectionType == ProjectionType::Perspective)
@ -155,7 +164,8 @@ void FRME::Widget::CAMRInfo::read(athena::io::IStreamReader& __dna_reader)
projection->read(__dna_reader); projection->read(__dna_reader);
} }
void FRME::Widget::CAMRInfo::write(athena::io::IStreamWriter& __dna_writer) const template <>
void FRME::Widget::CAMRInfo::Enumerate<BigDNA::Write>(athena::io::IStreamWriter& __dna_writer)
{ {
if (!projection) if (!projection)
Log.report(logvisor::Fatal, _S("Invalid CAMR projection object!")); Log.report(logvisor::Fatal, _S("Invalid CAMR projection object!"));
@ -166,15 +176,16 @@ void FRME::Widget::CAMRInfo::write(athena::io::IStreamWriter& __dna_writer) cons
projection->write(__dna_writer); projection->write(__dna_writer);
} }
size_t FRME::Widget::CAMRInfo::binarySize(size_t __isz) const template <>
void FRME::Widget::CAMRInfo::Enumerate<BigDNA::BinarySize>(size_t& __isz)
{ {
__isz = projection->binarySize(__isz); projection->binarySize(__isz);
return __isz + 4; __isz += 4;
} }
void FRME::Widget::LITEInfo::read(athena::io::IStreamReader& __dna_reader) template <>
void FRME::Widget::LITEInfo::Enumerate<BigDNA::Read>(athena::io::IStreamReader& __dna_reader)
{ {
IWidgetInfo::read(__dna_reader);
/* type */ /* type */
type = ELightType(__dna_reader.readUint32Big()); type = ELightType(__dna_reader.readUint32Big());
/* distC */ /* distC */
@ -197,9 +208,9 @@ void FRME::Widget::LITEInfo::read(athena::io::IStreamReader& __dna_reader)
cutoff = __dna_reader.readFloatBig(); cutoff = __dna_reader.readFloatBig();
} }
void FRME::Widget::LITEInfo::write(athena::io::IStreamWriter& __dna_writer) const template <>
void FRME::Widget::LITEInfo::Enumerate<BigDNA::Write>(athena::io::IStreamWriter& __dna_writer)
{ {
IWidgetInfo::write(__dna_writer);
/* type */ /* type */
__dna_writer.writeUint32Big(atUint32(type)); __dna_writer.writeUint32Big(atUint32(type));
/* distC */ /* distC */
@ -222,93 +233,35 @@ void FRME::Widget::LITEInfo::write(athena::io::IStreamWriter& __dna_writer) cons
__dna_writer.writeFloatBig(cutoff); __dna_writer.writeFloatBig(cutoff);
} }
size_t FRME::Widget::LITEInfo::binarySize(size_t __isz) const template <>
void FRME::Widget::LITEInfo::Enumerate<BigDNA::BinarySize>(size_t& __isz)
{ {
__isz = IWidgetInfo::binarySize(__isz); __isz += ((type == ELightType::Spot) ? 36 : 32);
return __isz + ((type == ELightType::Spot) ? 36 : 32);
} }
void FRME::Widget::TXPNInfo::read(athena::io::IStreamReader& __dna_reader) template <class Op>
void FRME::Widget::TXPNInfo::Enumerate(typename Op::StreamT& s)
{ {
IWidgetInfo::read(__dna_reader); Do<Op>({"xDim"}, xDim, s);
/* xDim */ Do<Op>({"zDim"}, zDim, s);
xDim = __dna_reader.readFloatBig(); Do<Op>({"scaleCenter"}, scaleCenter, s);
/* zDim */ Do<Op>({"font"}, font, s);
zDim = __dna_reader.readFloatBig(); Do<Op>({"wordWrap"}, wordWrap, s);
/* scaleCenter */ Do<Op>({"horizontal"}, horizontal, s);
scaleCenter = __dna_reader.readVec3fBig(); Do<Op>({"justification"}, justification, s);
/* font */ Do<Op>({"verticalJustification"}, verticalJustification, s);
font.read(__dna_reader); Do<Op>({"fillColor"}, fillColor, s);
/* unk1 */ Do<Op>({"outlineColor"}, outlineColor, s);
wordWrap = __dna_reader.readBool(); Do<Op>({"blockExtent"}, blockExtent, s);
/* unk2 */
horizontal = __dna_reader.readBool();
/* justification */
justification = Justification(__dna_reader.readUint32Big());
/* verticalJustification */
verticalJustification = VerticalJustification(__dna_reader.readUint32Big());
/* fillColor */
fillColor = __dna_reader.readVec4fBig();
/* outlineColor */
outlineColor = __dna_reader.readVec4fBig();
/* pointScale */
blockExtent = __dna_reader.readVec2fBig();
if (version == 1) if (version == 1)
{ {
/* jpnFont */ Do<Op>({"jpnFont"}, jpnFont, s);
jpnFont.read(__dna_reader); Do<Op>({"jpnPointScale[0]"}, jpnPointScale[0], s);
/* jpnPointScale[0] */ Do<Op>({"jpnPointScale[1]"}, jpnPointScale[1], s);
jpnPointScale[0] = __dna_reader.readInt32Big();
/* jpnPointScale[0] */
jpnPointScale[1] = __dna_reader.readInt32Big();
} }
} }
void FRME::Widget::TXPNInfo::write(athena::io::IStreamWriter& __dna_writer) const AT_SPECIALIZE_DNA(FRME::Widget::TXPNInfo)
{
IWidgetInfo::write(__dna_writer);
/* xDim */
__dna_writer.writeFloatBig(xDim);
/* zDim */
__dna_writer.writeFloatBig(zDim);
/* scaleCenter */
__dna_writer.writeVec3fBig(scaleCenter);
/* font */
font.write(__dna_writer);
/* unk1 */
__dna_writer.writeBool(wordWrap);
/* unk2 */
__dna_writer.writeBool(horizontal);
/* justification */
__dna_writer.writeUint32Big(atUint32(justification));
/* verticalJustification */
__dna_writer.writeUint32Big(atUint32(verticalJustification));
/* fillColor */
__dna_writer.writeVec4fBig(fillColor);
/* outlineColor */
__dna_writer.writeVec4fBig(outlineColor);
/* pointScale */
__dna_writer.writeVec2fBig(blockExtent);
if (version == 1)
{
/* jpnFont */
jpnFont.write(__dna_writer);
/* jpnPointScale[0] */
__dna_writer.writeInt32Big(jpnPointScale[0]);
/* jpnPointScale[1] */
__dna_writer.writeInt32Big(jpnPointScale[1]);
}
}
size_t FRME::Widget::TXPNInfo::binarySize(size_t __isz) const
{
__isz = IWidgetInfo::binarySize(__isz);
__isz = font.binarySize(__isz);
if (version == 1)
__isz = jpnFont.binarySize(__isz);
return __isz + (version == 1 ? 78 : 66);
}
bool FRME::Extract(const SpecBase &dataSpec, bool FRME::Extract(const SpecBase &dataSpec,
PAKEntryReadStream &rs, PAKEntryReadStream &rs,

View File

@ -4,12 +4,13 @@
#include "../DNACommon/DNACommon.hpp" #include "../DNACommon/DNACommon.hpp"
#include "DNAMP1.hpp" #include "DNAMP1.hpp"
#include <athena/FileWriter.hpp> #include <athena/FileWriter.hpp>
#include "athena/DNAOp.hpp"
namespace DataSpec::DNAMP1 namespace DataSpec::DNAMP1
{ {
struct FRME : BigDNA struct FRME : BigDNA
{ {
DECL_EXPLICIT_DNA AT_DECL_EXPLICIT_DNA
Value<atUint32> version; Value<atUint32> version;
Value<atUint32> unk1; Value<atUint32> unk1;
Value<atUint32> modelCount; // Matches MODL widgets Value<atUint32> modelCount; // Matches MODL widgets
@ -18,12 +19,12 @@ struct FRME : BigDNA
struct Widget : BigDNA struct Widget : BigDNA
{ {
DECL_EXPLICIT_DNA AT_DECL_EXPLICIT_DNA
FRME* owner; FRME* owner;
DNAFourCC type; DNAFourCC type;
struct WidgetHeader : BigDNA struct WidgetHeader : BigDNA
{ {
DECL_DNA AT_DECL_DNA
String<-1> name; String<-1> name;
String<-1> parent; String<-1> parent;
Value<bool> useAnimController; Value<bool> useAnimController;
@ -34,12 +35,9 @@ struct FRME : BigDNA
Value<atUint32> modelDrawFlags; Value<atUint32> modelDrawFlags;
} header; } header;
struct IWidgetInfo : BigDNA struct IWidgetInfo : BigDNAV
{ {
Delete _d; Delete _dBase;
virtual void read(athena::io::IStreamReader&) {}
void write(athena::io::IStreamWriter&) const {}
size_t binarySize(size_t __isz) const { return __isz; }
virtual FourCC fourcc() const=0; virtual FourCC fourcc() const=0;
}; };
@ -54,19 +52,22 @@ struct FRME : BigDNA
struct BWIGInfo : IWidgetInfo struct BWIGInfo : IWidgetInfo
{ {
Delete _d2; AT_DECL_DNA
const char* DNATypeV() const { return "FRME::BWIG"; }
FourCC fourcc() const { return FOURCC('BWIG'); } FourCC fourcc() const { return FOURCC('BWIG'); }
}; };
struct HWIGInfo : IWidgetInfo struct HWIGInfo : IWidgetInfo
{ {
Delete _d2; AT_DECL_DNA
const char* DNATypeV() const { return "FRME::HWIG"; }
FourCC fourcc() const { return FOURCC('HWIG'); } FourCC fourcc() const { return FOURCC('HWIG'); }
}; };
struct CAMRInfo : IWidgetInfo struct CAMRInfo : IWidgetInfo
{ {
DECL_EXPLICIT_DNA AT_DECL_EXPLICIT_DNA
const char* DNATypeV() const { return "FRME::CAMR"; }
enum class ProjectionType enum class ProjectionType
{ {
Perspective, Perspective,
@ -74,7 +75,7 @@ struct FRME : BigDNA
}; };
Value<ProjectionType> projectionType; Value<ProjectionType> projectionType;
struct IProjection : BigDNA struct IProjection : BigDNAV
{ {
Delete _d; Delete _d;
const ProjectionType type; const ProjectionType type;
@ -83,7 +84,8 @@ struct FRME : BigDNA
struct PerspectiveProjection : IProjection struct PerspectiveProjection : IProjection
{ {
DECL_DNA AT_DECL_DNA
AT_DECL_DNAV
PerspectiveProjection() : IProjection(ProjectionType::Perspective) {} PerspectiveProjection() : IProjection(ProjectionType::Perspective) {}
Value<float> fov; Value<float> fov;
Value<float> aspect; Value<float> aspect;
@ -93,7 +95,8 @@ struct FRME : BigDNA
struct OrthographicProjection : IProjection struct OrthographicProjection : IProjection
{ {
DECL_DNA AT_DECL_DNA
AT_DECL_DNAV
OrthographicProjection() : IProjection(ProjectionType::Orthographic) {} OrthographicProjection() : IProjection(ProjectionType::Orthographic) {}
Value<float> left; Value<float> left;
Value<float> right; Value<float> right;
@ -109,7 +112,8 @@ struct FRME : BigDNA
struct MODLInfo : IWidgetInfo struct MODLInfo : IWidgetInfo
{ {
DECL_DNA AT_DECL_DNA
const char* DNATypeV() const { return "FRME::MODL"; }
UniqueID32 model; UniqueID32 model;
enum class BlendMode enum class BlendMode
{ {
@ -127,7 +131,8 @@ struct FRME : BigDNA
struct LITEInfo : IWidgetInfo struct LITEInfo : IWidgetInfo
{ {
DECL_EXPLICIT_DNA AT_DECL_EXPLICIT_DNA
const char* DNATypeV() const { return "FRME::LITE"; }
enum class ELightType : atUint32 enum class ELightType : atUint32
{ {
Spot = 0, Spot = 0,
@ -152,7 +157,8 @@ struct FRME : BigDNA
struct ENRGInfo : IWidgetInfo struct ENRGInfo : IWidgetInfo
{ {
DECL_DNA AT_DECL_DNA
const char* DNATypeV() const { return "FRME::ENRG"; }
UniqueID32 texture; UniqueID32 texture;
FourCC fourcc() const { return FOURCC('ENRG'); } FourCC fourcc() const { return FOURCC('ENRG'); }
@ -160,7 +166,8 @@ struct FRME : BigDNA
struct METRInfo : IWidgetInfo struct METRInfo : IWidgetInfo
{ {
DECL_DNA AT_DECL_DNA
const char* DNATypeV() const { return "FRME::METR"; }
Value<bool> unk1; Value<bool> unk1;
Value<bool> noRoundUp; Value<bool> noRoundUp;
Value<atUint32> maxCapacity; Value<atUint32> maxCapacity;
@ -171,7 +178,8 @@ struct FRME : BigDNA
struct GRUPInfo : IWidgetInfo struct GRUPInfo : IWidgetInfo
{ {
DECL_DNA AT_DECL_DNA
const char* DNATypeV() const { return "FRME::GRUP"; }
Value<atInt16> defaultWorker; Value<atInt16> defaultWorker;
Value<bool> unk3; Value<bool> unk3;
@ -180,7 +188,8 @@ struct FRME : BigDNA
struct TBGPInfo : IWidgetInfo struct TBGPInfo : IWidgetInfo
{ {
DECL_DNA AT_DECL_DNA
const char* DNATypeV() const { return "FRME::TBGP"; }
Value<atUint16> elementCount; Value<atUint16> elementCount;
Value<atUint16> unk2; Value<atUint16> unk2;
Value<atUint32> unkEnum; Value<atUint32> unkEnum;
@ -202,7 +211,8 @@ struct FRME : BigDNA
struct SLGPInfo : IWidgetInfo struct SLGPInfo : IWidgetInfo
{ {
DECL_DNA AT_DECL_DNA
const char* DNATypeV() const { return "FRME::SLGP"; }
Value<float> min; Value<float> min;
Value<float> max; Value<float> max;
Value<float> cur; Value<float> cur;
@ -213,7 +223,8 @@ struct FRME : BigDNA
struct PANEInfo : IWidgetInfo struct PANEInfo : IWidgetInfo
{ {
DECL_DNA AT_DECL_DNA
const char* DNATypeV() const { return "FRME::PANE"; }
Value<float> xDim; Value<float> xDim;
Value<float> zDim; Value<float> zDim;
Value<atVec3f> scaleCenter; Value<atVec3f> scaleCenter;
@ -223,6 +234,7 @@ struct FRME : BigDNA
struct TXPNInfo : IWidgetInfo struct TXPNInfo : IWidgetInfo
{ {
const char* DNATypeV() const { return "FRME::TXPN"; }
enum class Justification : atUint32 enum class Justification : atUint32
{ {
Left = 0, Left = 0,
@ -251,7 +263,8 @@ struct FRME : BigDNA
RightMono RightMono
}; };
DECL_EXPLICIT_DNA AT_DECL_EXPLICIT_DNA
atUint32 version = 0; atUint32 version = 0;
TXPNInfo() {} TXPNInfo() {}
TXPNInfo(atUint32 version) TXPNInfo(atUint32 version)
@ -277,7 +290,8 @@ struct FRME : BigDNA
struct IMGPInfo : IWidgetInfo struct IMGPInfo : IWidgetInfo
{ {
DECL_DNA AT_DECL_DNA
const char* DNATypeV() const { return "FRME::IMGP"; }
UniqueID32 texture; UniqueID32 texture;
Value<atUint32> unk1; Value<atUint32> unk1;
Value<atUint32> unk2; Value<atUint32> unk2;

View File

@ -6,23 +6,23 @@
namespace DataSpec::DNAMP1 namespace DataSpec::DNAMP1
{ {
struct HINT : BigYAML struct HINT : BigDNA
{ {
DECL_YAML AT_DECL_DNA_YAML
Value<atUint32> magic; Value<atUint32> magic;
Value<atUint32> version; Value<atUint32> version;
struct Hint : BigYAML struct Hint : BigDNA
{ {
DECL_YAML AT_DECL_DNA_YAML
String<-1> name; String<-1> name;
Value<float> immediateTime; Value<float> immediateTime;
Value<float> normalTime; Value<float> normalTime;
UniqueID32 stringID; UniqueID32 stringID;
Value<atUint32> textPageCount; Value<atUint32> textPageCount;
struct Location : BigYAML struct Location : BigDNA
{ {
DECL_YAML AT_DECL_DNA_YAML
UniqueID32 worldAssetID; UniqueID32 worldAssetID;
UniqueID32 areaAssetID; UniqueID32 areaAssetID;
Value<atUint32> areaID; Value<atUint32> areaID;
@ -41,7 +41,7 @@ struct HINT : BigYAML
HINT hint; HINT hint;
hint.read(rs); hint.read(rs);
athena::io::FileWriter writer(outPath.getAbsolutePath()); athena::io::FileWriter writer(outPath.getAbsolutePath());
hint.toYAMLStream(writer); athena::io::ToYAMLStream(hint, writer);
return true; return true;
} }
@ -49,7 +49,7 @@ struct HINT : BigYAML
{ {
HINT hint; HINT hint;
athena::io::FileReader reader(inPath.getAbsolutePath()); athena::io::FileReader reader(inPath.getAbsolutePath());
hint.fromYAMLStream(reader); athena::io::FromYAMLStream(hint, reader);
athena::io::FileWriter ws(outPath.getAbsolutePath()); athena::io::FileWriter ws(outPath.getAbsolutePath());
hint.write(ws); hint.write(ws);
return true; return true;

View File

@ -55,7 +55,7 @@ bool MLVL::Extract(const SpecBase& dataSpec, PAKEntryReadStream& rs, const hecl:
} }
athena::io::FileWriter writer(outPath.getWithExtension(_S(".yaml"), true).getAbsolutePath()); athena::io::FileWriter writer(outPath.getWithExtension(_S(".yaml"), true).getAbsolutePath());
mlvl.toYAMLStream(writer, static_cast<YAMLWriteMemberFn>(&MLVL::writeMeta)); athena::io::ToYAMLStream(mlvl, writer, &MLVL::writeMeta);
hecl::blender::Connection& conn = btok.getBlenderConnection(); hecl::blender::Connection& conn = btok.getBlenderConnection();
return DNAMLVL::ReadMLVLToBlender(conn, mlvl, outPath, pakRouter, entry, force, fileChanged); return DNAMLVL::ReadMLVLToBlender(conn, mlvl, outPath, pakRouter, entry, force, fileChanged);
} }
@ -65,7 +65,7 @@ bool MLVL::Cook(const hecl::ProjectPath& outPath, const hecl::ProjectPath& inPat
{ {
MLVL mlvl = {}; MLVL mlvl = {};
athena::io::FileReader reader(inPath.getWithExtension(_S(".yaml"), true).getAbsolutePath()); athena::io::FileReader reader(inPath.getWithExtension(_S(".yaml"), true).getAbsolutePath());
mlvl.fromYAMLStream(reader, static_cast<YAMLReadMemberFn>(&MLVL::readMeta)); athena::io::FromYAMLStream(mlvl, reader, &MLVL::readMeta);
mlvl.magic = 0xDEAFBABE; mlvl.magic = 0xDEAFBABE;
mlvl.version = 0x11; mlvl.version = 0x11;
@ -129,7 +129,7 @@ bool MLVL::Cook(const hecl::ProjectPath& outPath, const hecl::ProjectPath& inPat
athena::io::FileReader freader(objectsPath.getAbsolutePath()); athena::io::FileReader freader(objectsPath.getAbsolutePath());
if (!freader.isOpen()) if (!freader.isOpen())
continue; continue;
if (!BigYAML::ValidateFromYAMLStream<DNAMP1::SCLY::ScriptLayer>(freader)) if (!athena::io::ValidateFromYAMLStream<DNAMP1::SCLY::ScriptLayer>(freader))
continue; continue;
athena::io::YAMLDocReader reader; athena::io::YAMLDocReader reader;
@ -432,7 +432,7 @@ bool MLVL::CookSAVW(const hecl::ProjectPath& outPath,
athena::io::FileReader freader(objectsPath.getAbsolutePath()); athena::io::FileReader freader(objectsPath.getAbsolutePath());
if (!freader.isOpen()) if (!freader.isOpen())
continue; continue;
if (!BigYAML::ValidateFromYAMLStream<DNAMP1::SCLY::ScriptLayer>(freader)) if (!athena::io::ValidateFromYAMLStream<DNAMP1::SCLY::ScriptLayer>(freader))
continue; continue;
athena::io::YAMLDocReader reader; athena::io::YAMLDocReader reader;

View File

@ -8,9 +8,9 @@
namespace DataSpec::DNAMP1 namespace DataSpec::DNAMP1
{ {
struct MLVL : BigYAML struct MLVL : BigDNA
{ {
DECL_YAML AT_DECL_DNA_YAML
Value<atUint32> magic; Value<atUint32> magic;
Value<atUint32> version; Value<atUint32> version;
UniqueID32 worldNameId; UniqueID32 worldNameId;
@ -18,9 +18,9 @@ struct MLVL : BigYAML
UniqueID32 worldSkyboxId; UniqueID32 worldSkyboxId;
Value<atUint32> memRelayLinkCount; Value<atUint32> memRelayLinkCount;
struct MemRelayLink : BigYAML struct MemRelayLink : BigDNA
{ {
DECL_YAML AT_DECL_DNA_YAML
Value<atUint32> memRelayId; Value<atUint32> memRelayId;
Value<atUint32> targetId; Value<atUint32> targetId;
Value<atUint16> msg; Value<atUint16> msg;
@ -30,9 +30,9 @@ struct MLVL : BigYAML
Value<atUint32> areaCount; Value<atUint32> areaCount;
Value<atUint32> unknown1; Value<atUint32> unknown1;
struct Area : BigYAML struct Area : BigDNA
{ {
DECL_YAML AT_DECL_DNA_YAML
UniqueID32 areaNameId; UniqueID32 areaNameId;
Value<atVec4f> transformMtx[3]; Value<atVec4f> transformMtx[3];
Value<atVec3f> aabb[2]; Value<atVec3f> aabb[2];
@ -44,9 +44,9 @@ struct MLVL : BigYAML
Value<atUint32> padding; Value<atUint32> padding;
Value<atUint32> depCount; Value<atUint32> depCount;
struct Dependency : BigYAML struct Dependency : BigDNA
{ {
DECL_YAML AT_DECL_DNA_YAML
UniqueID32 id; UniqueID32 id;
DNAFourCC type; DNAFourCC type;
@ -60,13 +60,13 @@ struct MLVL : BigYAML
Vector<atUint32, DNA_COUNT(depLayerCount)> depLayers; Vector<atUint32, DNA_COUNT(depLayerCount)> depLayers;
Value<atUint32> dockCount; Value<atUint32> dockCount;
struct Dock : BigYAML struct Dock : BigDNA
{ {
DECL_YAML AT_DECL_DNA_YAML
Value<atUint32> endpointCount; Value<atUint32> endpointCount;
struct Endpoint : BigYAML struct Endpoint : BigDNA
{ {
DECL_YAML AT_DECL_DNA_YAML
Value<atUint32> areaIdx; Value<atUint32> areaIdx;
Value<atUint32> dockIdx; Value<atUint32> dockIdx;
}; };
@ -96,9 +96,9 @@ struct MLVL : BigYAML
Value<atUint32> unknown3; Value<atUint32> unknown3;
Value<atUint32> audioGroupCount; Value<atUint32> audioGroupCount;
struct AudioGroup : BigYAML struct AudioGroup : BigDNA
{ {
DECL_YAML AT_DECL_DNA_YAML
Value<atUint32> groupId; Value<atUint32> groupId;
UniqueID32 agscId; UniqueID32 agscId;
}; };
@ -106,9 +106,9 @@ struct MLVL : BigYAML
String<-1> unkString; String<-1> unkString;
Value<atUint32> layerFlagCount; Value<atUint32> layerFlagCount;
struct LayerFlags : BigYAML struct LayerFlags : BigDNA
{ {
DECL_YAML AT_DECL_DNA_YAML
Value<atUint32> layerCount; Value<atUint32> layerCount;
Value<atUint64> flags; Value<atUint64> flags;
}; };

View File

@ -459,7 +459,9 @@ bool MREA::PCCook(const hecl::ProjectPath& outPath,
/* Header section */ /* Header section */
{ {
secs.emplace_back(head.binarySize(0), 0); size_t secSz = 0;
head.binarySize(secSz);
secs.emplace_back(secSz, 0);
athena::io::MemoryWriter w(secs.back().data(), secs.back().size()); athena::io::MemoryWriter w(secs.back().data(), secs.back().size());
head.write(w); head.write(w);
int i = w.position(); int i = w.position();
@ -530,7 +532,7 @@ bool MREA::PCCook(const hecl::ProjectPath& outPath,
athena::io::FileReader freader(layer.getAbsolutePath()); athena::io::FileReader freader(layer.getAbsolutePath());
if (!freader.isOpen()) if (!freader.isOpen())
continue; continue;
if (!BigYAML::ValidateFromYAMLStream<DNAMP1::SCLY::ScriptLayer>(freader)) if (!athena::io::ValidateFromYAMLStream<DNAMP1::SCLY::ScriptLayer>(freader))
continue; continue;
athena::io::YAMLDocReader reader; athena::io::YAMLDocReader reader;
@ -539,11 +541,15 @@ bool MREA::PCCook(const hecl::ProjectPath& outPath,
sclyData.layers.emplace_back(); sclyData.layers.emplace_back();
sclyData.layers.back().read(reader); sclyData.layers.back().read(reader);
sclyData.layerSizes.push_back(sclyData.layers.back().binarySize(0)); size_t layerSize = 0;
sclyData.layers.back().binarySize(layerSize);
sclyData.layerSizes.push_back(layerSize);
} }
sclyData.layerCount = sclyData.layers.size(); sclyData.layerCount = sclyData.layers.size();
secs.emplace_back(sclyData.binarySize(0), 0); size_t secSz = 0;
sclyData.binarySize(secSz);
secs.emplace_back(secSz, 0);
athena::io::MemoryWriter w(secs.back().data(), secs.back().size()); athena::io::MemoryWriter w(secs.back().data(), secs.back().size());
sclyData.write(w); sclyData.write(w);
} }
@ -577,7 +583,9 @@ bool MREA::PCCook(const hecl::ProjectPath& outPath,
conn.saveBlend(); conn.saveBlend();
#endif #endif
secs.emplace_back(collision.binarySize(0), 0); size_t secSz = 0;
collision.binarySize(secSz);
secs.emplace_back(secSz, 0);
athena::io::MemoryWriter w(secs.back().data(), secs.back().size()); athena::io::MemoryWriter w(secs.back().data(), secs.back().size());
collision.write(w); collision.write(w);
} }

View File

@ -12,7 +12,7 @@ struct MREA
{ {
struct Header : BigDNA struct Header : BigDNA
{ {
DECL_DNA AT_DECL_DNA
Value<atUint32> magic; Value<atUint32> magic;
Value<atUint32> version; Value<atUint32> version;
Value<atVec4f> localToWorldMtx[3]; Value<atVec4f> localToWorldMtx[3];
@ -31,10 +31,10 @@ struct MREA
struct MeshHeader : BigDNA struct MeshHeader : BigDNA
{ {
DECL_DNA AT_DECL_DNA
struct VisorFlags : BigDNA struct VisorFlags : BigDNA
{ {
DECL_DNA AT_DECL_DNA
Value<atUint32> flags; Value<atUint32> flags;
enum class ThermalLevel enum class ThermalLevel
{ {
@ -70,7 +70,7 @@ struct MREA
struct BabeDeadLight : BigDNA struct BabeDeadLight : BigDNA
{ {
DECL_DNA AT_DECL_DNA
enum class LightType : atUint32 enum class LightType : atUint32
{ {
LocalAmbient, LocalAmbient,

View File

@ -7,9 +7,9 @@
namespace DataSpec::DNAMP1 namespace DataSpec::DNAMP1
{ {
struct MazeSeeds : BigYAML struct MazeSeeds : BigDNA
{ {
DECL_YAML AT_DECL_DNA_YAML
Value<atUint32> seeds[300]; Value<atUint32> seeds[300];
}; };
} }

View File

@ -6,7 +6,8 @@
namespace DataSpec::DNAMP1 namespace DataSpec::DNAMP1
{ {
void PAK::read(athena::io::IStreamReader& reader) template <>
void PAK::Enumerate<BigDNA::Read>(typename Read::StreamT& reader)
{ {
atUint32 version = reader.readUint32Big(); atUint32 version = reader.readUint32Big();
if (version != 0x00030005) if (version != 0x00030005)
@ -48,7 +49,8 @@ void PAK::read(athena::io::IStreamReader& reader)
m_nameMap[entry.name] = entry.id; m_nameMap[entry.name] = entry.id;
} }
void PAK::write(athena::io::IStreamWriter& writer) const template <>
void PAK::Enumerate<BigDNA::Write>(typename Write::StreamT& writer)
{ {
writer.writeUint32Big(0x00030005); writer.writeUint32Big(0x00030005);
writer.writeUint32Big(0); writer.writeUint32Big(0);
@ -71,16 +73,15 @@ void PAK::write(athena::io::IStreamWriter& writer) const
} }
} }
size_t PAK::binarySize(size_t __isz) const template <>
void PAK::Enumerate<BigDNA::BinarySize>(typename BinarySize::StreamT& s)
{ {
__isz += 12; s += 12;
for (const NameEntry& entry : m_nameEntries) for (const NameEntry& entry : m_nameEntries)
__isz += 12 + entry.name.size(); s += 12 + entry.name.size();
__isz += m_entries.size() * 20 + 4; s += m_entries.size() * 20 + 4;
return __isz;
} }
std::unique_ptr<atUint8[]> std::unique_ptr<atUint8[]>

View File

@ -14,11 +14,11 @@ struct PAK : BigDNA
bool m_useLzo; bool m_useLzo;
bool m_noShare; bool m_noShare;
PAK(bool useLzo, bool noShare) : m_useLzo(useLzo), m_noShare(noShare) {} PAK(bool useLzo, bool noShare) : m_useLzo(useLzo), m_noShare(noShare) {}
DECL_EXPLICIT_DNA AT_DECL_EXPLICIT_DNA
struct NameEntry : BigDNA struct NameEntry : BigDNA
{ {
DECL_DNA AT_DECL_DNA
DNAFourCC type; DNAFourCC type;
UniqueID32 id; UniqueID32 id;
Value<atUint32> nameLen; Value<atUint32> nameLen;
@ -27,7 +27,7 @@ struct PAK : BigDNA
struct Entry : BigDNA struct Entry : BigDNA
{ {
DECL_DNA AT_DECL_DNA
Value<atUint32> compressed; Value<atUint32> compressed;
DNAFourCC type; DNAFourCC type;
UniqueID32 id; UniqueID32 id;

View File

@ -7,12 +7,12 @@ namespace DataSpec
{ {
struct PATH : BigDNA struct PATH : BigDNA
{ {
DECL_DNA AT_DECL_DNA
Value<atUint32> version; Value<atUint32> version;
struct Node : BigDNA struct Node : BigDNA
{ {
DECL_DNA AT_DECL_DNA
Value<atVec3f> position; Value<atVec3f> position;
Value<atVec3f> normal; Value<atVec3f> normal;
}; };
@ -21,7 +21,7 @@ struct PATH : BigDNA
struct Link : BigDNA struct Link : BigDNA
{ {
DECL_DNA AT_DECL_DNA
Value<atUint32> nodeIdx; Value<atUint32> nodeIdx;
Value<atUint32> regionIdx; Value<atUint32> regionIdx;
Value<float> width2d; Value<float> width2d;
@ -32,7 +32,7 @@ struct PATH : BigDNA
struct Region : BigDNA struct Region : BigDNA
{ {
DECL_DNA AT_DECL_DNA
Value<atUint32> nodeCount; Value<atUint32> nodeCount;
Value<atUint32> nodeStart; Value<atUint32> nodeStart;
Value<atUint32> linkCount; Value<atUint32> linkCount;
@ -57,7 +57,7 @@ struct PATH : BigDNA
struct OctreeNode : BigDNA struct OctreeNode : BigDNA
{ {
DECL_DNA AT_DECL_DNA
Value<atUint32> isLeaf; Value<atUint32> isLeaf;
Value<atVec3f> points[3]; Value<atVec3f> points[3];
Value<atUint32> children[8]; Value<atUint32> children[8];

View File

@ -6,9 +6,9 @@
namespace DataSpec::DNAMP1 namespace DataSpec::DNAMP1
{ {
struct Scan : BigYAML struct Scan : BigDNA
{ {
DECL_YAML AT_DECL_DNA_YAML
UniqueID32 scanId; UniqueID32 scanId;
Value<SAVWCommon::EScanCategory> category; Value<SAVWCommon::EScanCategory> category;
@ -16,9 +16,9 @@ struct Scan : BigYAML
Scan(const UniqueID32& id) : scanId(id), category(SAVWCommon::EScanCategory::None) {} Scan(const UniqueID32& id) : scanId(id), category(SAVWCommon::EScanCategory::None) {}
}; };
struct SAVW : BigYAML struct SAVW : BigDNA
{ {
DECL_YAML AT_DECL_DNA_YAML
SAVWCommon::Header header; SAVWCommon::Header header;
Value<atUint32> skippableCutsceneCount; Value<atUint32> skippableCutsceneCount;
Vector<atUint32, DNA_COUNT(skippableCutsceneCount)> skippableCutscenes; Vector<atUint32, DNA_COUNT(skippableCutsceneCount)> skippableCutscenes;

81
DataSpec/DNAMP1/SCAN.cpp Normal file
View File

@ -0,0 +1,81 @@
#include "SCAN.hpp"
namespace DataSpec::DNAMP1
{
static const std::vector<std::string> PaneNames =
{
"imagepane_pane0", "imagepane_pane1", "imagepane_pane2", "imagepane_pane3", "imagepane_pane01",
"imagepane_pane12", "imagepane_pane23", "imagepane_pane012", "imagepane_pane123", "imagepane_pane0123",
"imagepane_pane4", "imagepane_pane5", "imagepane_pane6", "imagepane_pane7", "imagepane_pane45",
"imagepane_pane56", "imagepane_pane67", "imagepane_pane456", "imagepane_pane567", "imagepane_pane4567"
};
template <>
void SCAN::Texture::Enumerate<BigDNA::Read>(typename Read::StreamT& r)
{
texture.read(r);
appearanceRange = r.readFloatBig();
position = Position(r.readUint32Big());
width = r.readUint32Big();
height = r.readUint32Big();
interval = r.readFloatBig();
fadeDuration = r.readFloatBig();
}
template <>
void SCAN::Texture::Enumerate<BigDNA::Write>(typename Write::StreamT& w)
{
texture.write(w);
w.writeFloatBig(appearanceRange);
w.writeUint32Big(atUint32(position));
w.writeUint32Big(width);
w.writeUint32Big(height);
w.writeFloatBig(interval);
w.writeFloatBig(fadeDuration);
}
template <>
void SCAN::Texture::Enumerate<BigDNA::ReadYaml>(typename ReadYaml::StreamT& r)
{
r.enumerate("texture", texture);
appearanceRange = r.readFloat("appearanceRange");
std::string tmp = r.readString("position");
auto idx = std::find(PaneNames.begin(), PaneNames.end(), tmp);
if (idx != PaneNames.end())
position = Position(idx - PaneNames.begin());
else
position = Position::Invalid;
width = r.readUint32("width");
height = r.readUint32("height");
interval = r.readFloat("interval");
fadeDuration = r.readFloat("fadeDuration");
}
template <>
void SCAN::Texture::Enumerate<BigDNA::WriteYaml>(typename WriteYaml::StreamT& w)
{
w.enumerate("texture", texture);
w.writeFloat("appearanceRange", appearanceRange);
if (position != Position::Invalid)
w.writeString("position", PaneNames.at(atUint32(position)));
else
w.writeString("position", "undefined");
w.writeUint32("width", width);
w.writeUint32("height", height);
w.writeFloat("interval", interval);
w.writeFloat("fadeDuration", fadeDuration);
}
const char* SCAN::Texture::DNAType() { return "urde::DNAMP1::SCAN::Texture"; }
template <>
void SCAN::Texture::Enumerate<BigDNA::BinarySize>(typename BinarySize::StreamT& s)
{
texture.binarySize(s);
s += 24;
}
}

View File

@ -7,17 +7,9 @@
namespace DataSpec::DNAMP1 namespace DataSpec::DNAMP1
{ {
static const std::vector<std::string> PaneNames = struct SCAN : BigDNA
{ {
"imagepane_pane0", "imagepane_pane1", "imagepane_pane2", "imagepane_pane3", "imagepane_pane01", AT_DECL_DNA_YAML
"imagepane_pane12", "imagepane_pane23", "imagepane_pane012", "imagepane_pane123", "imagepane_pane0123",
"imagepane_pane4", "imagepane_pane5", "imagepane_pane6", "imagepane_pane7", "imagepane_pane45",
"imagepane_pane56", "imagepane_pane67", "imagepane_pane456", "imagepane_pane567", "imagepane_pane4567"
};
struct SCAN : BigYAML
{
DECL_YAML
Value<atUint32> version; Value<atUint32> version;
Value<atUint32> magic; Value<atUint32> magic;
UniqueID32 frame; UniqueID32 frame;
@ -40,9 +32,9 @@ struct SCAN : BigYAML
Value<bool> isImportant; Value<bool> isImportant;
struct Texture : BigYAML struct Texture : BigDNA
{ {
Delete __delete; AT_DECL_EXPLICIT_DNA_YAML
UniqueID32 texture; UniqueID32 texture;
Value<float> appearanceRange; Value<float> appearanceRange;
enum class Position : atInt32 enum class Position : atInt32
@ -56,96 +48,6 @@ struct SCAN : BigYAML
Value<atUint32> height; // height of animation cell Value<atUint32> height; // height of animation cell
Value<float> interval; // 0.0 - 1.0 Value<float> interval; // 0.0 - 1.0
Value<float> fadeDuration; // 0.0 - 1.0 Value<float> fadeDuration; // 0.0 - 1.0
void read(athena::io::IStreamReader& __dna_reader)
{
/* texture */
texture.read(__dna_reader);
/* appearanceRange */
appearanceRange = __dna_reader.readFloatBig();
/* position */
position = Position(__dna_reader.readUint32Big());
/* width */
width = __dna_reader.readUint32Big();
/* height */
height = __dna_reader.readUint32Big();
/* interval */
interval = __dna_reader.readFloatBig();
/* fadeDuration */
fadeDuration = __dna_reader.readFloatBig();
}
void write(athena::io::IStreamWriter& __dna_writer) const
{
/* texture */
texture.write(__dna_writer);
/* appearanceRange */
__dna_writer.writeFloatBig(appearanceRange);
/* position */
__dna_writer.writeUint32Big(atUint32(position));
/* width */
__dna_writer.writeUint32Big(width);
/* height */
__dna_writer.writeUint32Big(height);
/* interval */
__dna_writer.writeFloatBig(interval);
/* fadeDuration */
__dna_writer.writeFloatBig(fadeDuration);
}
void read(athena::io::YAMLDocReader& __dna_docin)
{
/* texture */
__dna_docin.enumerate("texture", texture);
/* appearanceRange */
appearanceRange = __dna_docin.readFloat("appearanceRange");
/* position */
std::string tmp = __dna_docin.readString("position");
auto idx = std::find(PaneNames.begin(), PaneNames.end(), tmp);
if (idx != PaneNames.end())
position = Position(idx - PaneNames.begin());
else
position = Position::Invalid;
/* width */
width = __dna_docin.readUint32("width");
/* height */
height = __dna_docin.readUint32("height");
/* interval */
interval = __dna_docin.readFloat("interval");
/* fadeDuration */
fadeDuration = __dna_docin.readFloat("fadeDuration");
}
void write(athena::io::YAMLDocWriter& __dna_docout) const
{
/* texture */
__dna_docout.enumerate("texture", texture);
/* appearanceRange */
__dna_docout.writeFloat("appearanceRange", appearanceRange);
/* position */
if (position != Position::Invalid)
__dna_docout.writeString("position", PaneNames.at(atUint32(position)));
else
__dna_docout.writeString("position", "undefined");
/* width */
__dna_docout.writeUint32("width", width);
/* height */
__dna_docout.writeUint32("height", height);
/* interval */
__dna_docout.writeFloat("interval", interval);
/* fadeDuration */
__dna_docout.writeFloat("fadeDuration", fadeDuration);
}
const char* DNAType() { return "urde::DNAMP1::SCAN::Texture"; }
size_t binarySize(size_t __isz) const
{
__isz = texture.binarySize(__isz);
return __isz + 24;
}
}; };
Texture textures[4]; Texture textures[4];
@ -155,7 +57,7 @@ struct SCAN : BigYAML
SCAN scan; SCAN scan;
scan.read(rs); scan.read(rs);
athena::io::FileWriter writer(outPath.getAbsolutePath()); athena::io::FileWriter writer(outPath.getAbsolutePath());
scan.toYAMLStream(writer); athena::io::ToYAMLStream(scan, writer);
return true; return true;
} }
@ -172,7 +74,7 @@ struct SCAN : BigYAML
athena::io::FileReader reader(inPath.getAbsolutePath()); athena::io::FileReader reader(inPath.getAbsolutePath());
if (reader.hasError()) if (reader.hasError())
return Category::None; return Category::None;
if (!scan.fromYAMLStream(reader)) if (!athena::io::FromYAMLStream(scan, reader))
return Category::None; return Category::None;
return scan.category; return scan.category;
} }
@ -208,6 +110,7 @@ struct SCAN : BigYAML
g_curSpec->flattenDependencies(textures[i].texture, pathsOut); g_curSpec->flattenDependencies(textures[i].texture, pathsOut);
} }
}; };
} }
#endif #endif

View File

@ -4,7 +4,8 @@
namespace DataSpec::DNAMP1 namespace DataSpec::DNAMP1
{ {
void SCLY::read(athena::io::IStreamReader& rs) template <>
void SCLY::Enumerate<BigDNA::Read>(athena::io::IStreamReader& rs)
{ {
fourCC = rs.readUint32Little(); fourCC = rs.readUint32Little();
version = rs.readUint32Big(); version = rs.readUint32Big();
@ -18,7 +19,8 @@ void SCLY::read(athena::io::IStreamReader& rs)
}); });
} }
void SCLY::write(athena::io::IStreamWriter& ws) const template <>
void SCLY::Enumerate<BigDNA::Write>(athena::io::IStreamWriter& ws)
{ {
ws.writeUint32Big(fourCC); ws.writeUint32Big(fourCC);
ws.writeUint32Big(version); ws.writeUint32Big(version);
@ -27,11 +29,13 @@ void SCLY::write(athena::io::IStreamWriter& ws) const
ws.enumerate(layers); ws.enumerate(layers);
} }
size_t SCLY::binarySize(size_t __isz) const template <>
void SCLY::Enumerate<BigDNA::BinarySize>(size_t& __isz)
{ {
__isz += 12; __isz += 12;
__isz += layerSizes.size() * 4; __isz += layerSizes.size() * 4;
return __EnumerateSize(__isz, layers); for (const ScriptLayer& layer : layers)
layer.binarySize(__isz);
} }
void SCLY::exportToLayerDirectories(const PAK::Entry& entry, PAKRouter<PAKBridge>& pakRouter, bool force) const void SCLY::exportToLayerDirectories(const PAK::Entry& entry, PAKRouter<PAKBridge>& pakRouter, bool force) const
@ -53,7 +57,7 @@ void SCLY::exportToLayerDirectories(const PAK::Entry& entry, PAKRouter<PAKBridge
if (force || yamlFile.isNone()) if (force || yamlFile.isNone())
{ {
athena::io::FileWriter writer(yamlFile.getAbsolutePath()); athena::io::FileWriter writer(yamlFile.getAbsolutePath());
layers[i].toYAMLStream(writer); athena::io::ToYAMLStream(layers[i], writer);
} }
} }
} }
@ -84,7 +88,8 @@ void SCLY::ScriptLayer::nameIDs(PAKRouter<PAKBridge>& pakRouter) const
obj->nameIDs(pakRouter); obj->nameIDs(pakRouter);
} }
void SCLY::read(athena::io::YAMLDocReader& docin) template <>
void SCLY::Enumerate<BigDNA::ReadYaml>(athena::io::YAMLDocReader& docin)
{ {
fourCC = docin.readUint32("fourCC"); fourCC = docin.readUint32("fourCC");
version = docin.readUint32("version"); version = docin.readUint32("version");
@ -92,7 +97,8 @@ void SCLY::read(athena::io::YAMLDocReader& docin)
docin.enumerate("layers", layers); docin.enumerate("layers", layers);
} }
void SCLY::write(athena::io::YAMLDocWriter& docout) const template <>
void SCLY::Enumerate<BigDNA::WriteYaml>(athena::io::YAMLDocWriter& docout)
{ {
docout.writeUint32("fourCC", fourCC); docout.writeUint32("fourCC", fourCC);
docout.writeUint32("version", version); docout.writeUint32("version", version);
@ -105,7 +111,8 @@ const char* SCLY::DNAType()
return "urde::DNAMP1::SCLY"; return "urde::DNAMP1::SCLY";
} }
void SCLY::ScriptLayer::read(athena::io::IStreamReader& rs) template <>
void SCLY::ScriptLayer::Enumerate<BigDNA::Read>(athena::io::IStreamReader& rs)
{ {
unknown = rs.readUByte(); unknown = rs.readUByte();
objectCount = rs.readUint32Big(); objectCount = rs.readUint32Big();
@ -136,7 +143,8 @@ void SCLY::ScriptLayer::read(athena::io::IStreamReader& rs)
} }
} }
void SCLY::ScriptLayer::read(athena::io::YAMLDocReader& rs) template <>
void SCLY::ScriptLayer::Enumerate<BigDNA::ReadYaml>(athena::io::YAMLDocReader& rs)
{ {
unknown = rs.readUByte("unknown"); unknown = rs.readUByte("unknown");
size_t objCount; size_t objCount;
@ -169,14 +177,16 @@ void SCLY::ScriptLayer::read(athena::io::YAMLDocReader& rs)
objectCount = 0; objectCount = 0;
} }
void SCLY::ScriptLayer::write(athena::io::IStreamWriter& ws) const template <>
void SCLY::ScriptLayer::Enumerate<BigDNA::Write>(athena::io::IStreamWriter& ws)
{ {
ws.writeUByte(unknown); ws.writeUByte(unknown);
ws.writeUint32Big(objectCount); ws.writeUint32Big(objectCount);
for (const std::unique_ptr<IScriptObject>& obj : objects) for (const std::unique_ptr<IScriptObject>& obj : objects)
{ {
ws.writeByte(obj->type); ws.writeByte(obj->type);
atUint32 expLen = obj->binarySize(0); size_t expLen = 0;
obj->binarySize(expLen);
ws.writeUint32Big(expLen); ws.writeUint32Big(expLen);
auto start = ws.position(); auto start = ws.position();
obj->write(ws); obj->write(ws);
@ -186,18 +196,19 @@ void SCLY::ScriptLayer::write(athena::io::IStreamWriter& ws) const
} }
} }
size_t SCLY::ScriptLayer::binarySize(size_t __isz) const template <>
void SCLY::ScriptLayer::Enumerate<BigDNA::BinarySize>(size_t& __isz)
{ {
__isz += 5; __isz += 5;
for (const std::unique_ptr<IScriptObject>& obj : objects) for (const std::unique_ptr<IScriptObject>& obj : objects)
{ {
__isz += 5; __isz += 5;
__isz = obj->binarySize(__isz); obj->binarySize(__isz);
} }
return __isz;
} }
void SCLY::ScriptLayer::write(athena::io::YAMLDocWriter& ws) const template <>
void SCLY::ScriptLayer::Enumerate<BigDNA::WriteYaml>(athena::io::YAMLDocWriter& ws)
{ {
ws.writeUByte("unknown", unknown); ws.writeUByte("unknown", unknown);
if (auto v = ws.enterSubVector("objects")) if (auto v = ws.enterSubVector("objects"))

View File

@ -7,36 +7,27 @@
namespace DataSpec::DNAMP1 namespace DataSpec::DNAMP1
{ {
struct SCLY : BigYAML struct SCLY : BigDNA
{ {
DECL_EXPLICIT_YAML AT_DECL_EXPLICIT_DNA_YAML
Delete _d;
Value<FourCC> fourCC; Value<FourCC> fourCC;
Value<atUint32> version; Value<atUint32> version;
Value<atUint32> layerCount; Value<atUint32> layerCount;
Vector<atUint32, DNA_COUNT(layerCount)> layerSizes; Vector<atUint32, DNA_COUNT(layerCount)> layerSizes;
struct ScriptLayer : BigYAML struct ScriptLayer : BigDNA
{ {
DECL_EXPLICIT_YAML AT_DECL_EXPLICIT_DNA_YAML
Delete _d;
Value<atUint8> unknown; Value<atUint8> unknown;
Value<atUint32> objectCount; Value<atUint32> objectCount;
Vector<std::unique_ptr<IScriptObject>, DNA_COUNT(objectCount)> objects; Vector<std::unique_ptr<IScriptObject>, DNA_COUNT(objectCount)> objects;
void read(athena::io::IStreamReader &rs);
void write(athena::io::IStreamWriter &ws) const;
size_t binarySize(size_t __isz) const;
void addCMDLRigPairs(PAKRouter<PAKBridge>& pakRouter, void addCMDLRigPairs(PAKRouter<PAKBridge>& pakRouter,
std::unordered_map<UniqueID32, std::pair<UniqueID32, UniqueID32>>& addTo) const; std::unordered_map<UniqueID32, std::pair<UniqueID32, UniqueID32>>& addTo) const;
void nameIDs(PAKRouter<PAKBridge>& pakRouter) const; void nameIDs(PAKRouter<PAKBridge>& pakRouter) const;
}; };
Vector<ScriptLayer, DNA_COUNT(layerCount)> layers; Vector<ScriptLayer, DNA_COUNT(layerCount)> layers;
void read(athena::io::IStreamReader &rs);
void write(athena::io::IStreamWriter &ws) const;
size_t binarySize(size_t __isz) const;
void exportToLayerDirectories(const PAK::Entry &, PAKRouter<PAKBridge>&, bool) const; void exportToLayerDirectories(const PAK::Entry &, PAKRouter<PAKBridge>&, bool) const;
void addCMDLRigPairs(PAKRouter<PAKBridge>& pakRouter, void addCMDLRigPairs(PAKRouter<PAKBridge>& pakRouter,
std::unordered_map<UniqueID32, std::pair<UniqueID32, UniqueID32>>& addTo) const; std::unordered_map<UniqueID32, std::pair<UniqueID32, UniqueID32>>& addTo) const;

View File

@ -393,7 +393,8 @@ void STRG::_read(athena::io::IStreamReader& reader)
langMap.emplace(item.first, &item.second); langMap.emplace(item.first, &item.second);
} }
void STRG::read(athena::io::IStreamReader& reader) template <>
void STRG::Enumerate<BigDNA::Read>(typename Read::StreamT& reader)
{ {
atUint32 magic = reader.readUint32Big(); atUint32 magic = reader.readUint32Big();
if (magic != 0x87654321) if (magic != 0x87654321)
@ -406,7 +407,8 @@ void STRG::read(athena::io::IStreamReader& reader)
_read(reader); _read(reader);
} }
void STRG::write(athena::io::IStreamWriter& writer) const template <>
void STRG::Enumerate<BigDNA::Write>(typename Write::StreamT& writer)
{ {
writer.writeUint32Big(0x87654321); writer.writeUint32Big(0x87654321);
writer.writeUint32Big(0); writer.writeUint32Big(0);
@ -475,29 +477,29 @@ void STRG::write(athena::io::IStreamWriter& writer) const
} }
} }
size_t STRG::binarySize(size_t __isz) const template <>
void STRG::Enumerate<BigDNA::BinarySize>(typename BinarySize::StreamT& _s)
{ {
__isz += 16; _s += 16;
__isz += langs.size() * 12; _s += langs.size() * 12;
size_t strCount = STRG::count(); size_t strCount = STRG::count();
__isz += langs.size() * strCount * 4; _s += langs.size() * strCount * 4;
for (const std::pair<FourCC, std::vector<std::u16string>>& lang : langs) for (const std::pair<FourCC, std::vector<std::u16string>>& lang : langs)
{ {
atUint32 langStrCount = lang.second.size(); atUint32 langStrCount = lang.second.size();
for (atUint32 s = 0; s < strCount; ++s) for (atUint32 s = 0; s < strCount; ++s)
{ {
if (s < langStrCount) if (s < langStrCount)
__isz += (CookString(lang.second[s]).size() + 1) * 2; _s += (CookString(lang.second[s]).size() + 1) * 2;
else else
__isz += 1; _s += 1;
} }
} }
return __isz;
} }
void STRG::read(athena::io::YAMLDocReader& reader) template <>
void STRG::Enumerate<BigDNA::ReadYaml>(typename ReadYaml::StreamT& reader)
{ {
const athena::io::YAMLNode* root = reader.getRootNode(); const athena::io::YAMLNode* root = reader.getRootNode();
@ -557,7 +559,8 @@ void STRG::read(athena::io::YAMLDocReader& reader)
langMap.emplace(item.first, &item.second); langMap.emplace(item.first, &item.second);
} }
void STRG::write(athena::io::YAMLDocWriter& writer) const template <>
void STRG::Enumerate<BigDNA::WriteYaml>(typename WriteYaml::StreamT& writer)
{ {
for (const auto& lang : langs) for (const auto& lang : langs)
{ {

View File

@ -11,8 +11,8 @@ namespace DataSpec::DNAMP1
struct STRG : ISTRG struct STRG : ISTRG
{ {
DECL_YAML AT_DECL_EXPLICIT_DNA_YAML
Delete expl; AT_DECL_DNAV
void _read(athena::io::IStreamReader& reader); void _read(athena::io::IStreamReader& reader);
std::vector<std::pair<FourCC, std::vector<std::u16string>>> langs; std::vector<std::pair<FourCC, std::vector<std::u16string>>> langs;
std::unordered_map<FourCC, std::vector<std::u16string>*> langMap; std::unordered_map<FourCC, std::vector<std::u16string>*> langMap;
@ -61,7 +61,7 @@ struct STRG : ISTRG
STRG strg; STRG strg;
strg.read(rs); strg.read(rs);
athena::io::TransactionalFileWriter writer(outPath.getAbsolutePath()); athena::io::TransactionalFileWriter writer(outPath.getAbsolutePath());
strg.toYAMLStream(writer); athena::io::ToYAMLStream(strg, writer);
return true; return true;
} }
@ -69,7 +69,7 @@ struct STRG : ISTRG
{ {
STRG strg; STRG strg;
athena::io::FileReader reader(inPath.getAbsolutePath()); athena::io::FileReader reader(inPath.getAbsolutePath());
strg.fromYAMLStream(reader); athena::io::FromYAMLStream(strg, reader);
athena::io::TransactionalFileWriter ws(outPath.getAbsolutePath()); athena::io::TransactionalFileWriter ws(outPath.getAbsolutePath());
strg.write(ws); strg.write(ws);
return true; return true;

View File

@ -9,7 +9,8 @@ namespace DataSpec::DNAMP1
{ {
struct AIJumpPoint : IScriptObject struct AIJumpPoint : IScriptObject
{ {
DECL_YAML AT_DECL_DNA_YAML
AT_DECL_DNAV
String<-1> name; String<-1> name;
Value<atVec3f> location; Value<atVec3f> location;
Value<atVec3f> orientation; Value<atVec3f> orientation;

View File

@ -9,7 +9,8 @@ namespace DataSpec::DNAMP1
struct AIKeyframe : IScriptObject struct AIKeyframe : IScriptObject
{ {
DECL_YAML AT_DECL_DNA_YAML
AT_DECL_DNAV
String<-1> name; String<-1> name;
Value<atUint32> unknown1; Value<atUint32> unknown1;
Value<bool> unknown2; Value<bool> unknown2;

View File

@ -8,7 +8,8 @@ namespace DataSpec::DNAMP1
{ {
struct Actor : IScriptObject struct Actor : IScriptObject
{ {
DECL_YAML AT_DECL_DNA_YAML
AT_DECL_DNAV
String<-1> name SO_NAME_SPECPROP(); String<-1> name SO_NAME_SPECPROP();
Value<atVec3f> location SO_LOCATION_SPECPROP(); Value<atVec3f> location SO_LOCATION_SPECPROP();
Value<atVec3f> orientation SO_ORIENTATION_SPECPROP(); Value<atVec3f> orientation SO_ORIENTATION_SPECPROP();

View File

@ -9,7 +9,8 @@ namespace DataSpec::DNAMP1
{ {
struct ActorContraption : IScriptObject struct ActorContraption : IScriptObject
{ {
DECL_YAML AT_DECL_DNA_YAML
AT_DECL_DNAV
String<-1> name; String<-1> name;
Value<atVec3f> location; Value<atVec3f> location;
Value<atVec3f> orientation; Value<atVec3f> orientation;

View File

@ -9,7 +9,8 @@ namespace DataSpec::DNAMP1
{ {
struct ActorKeyframe : IScriptObject struct ActorKeyframe : IScriptObject
{ {
DECL_YAML AT_DECL_DNA_YAML
AT_DECL_DNAV
String<-1> name; String<-1> name;
Value<atUint32> animationId; Value<atUint32> animationId;
Value<bool> unknown1; Value<bool> unknown1;

View File

@ -9,7 +9,8 @@ namespace DataSpec::DNAMP1
{ {
struct ActorRotate : IScriptObject struct ActorRotate : IScriptObject
{ {
DECL_YAML AT_DECL_DNA_YAML
AT_DECL_DNAV
String<-1> name; String<-1> name;
Value<atVec3f> rotationOffset; Value<atVec3f> rotationOffset;
Value<float> timeScale; Value<float> timeScale;

View File

@ -9,7 +9,8 @@ namespace DataSpec::DNAMP1
{ {
struct AmbientAI : IScriptObject struct AmbientAI : IScriptObject
{ {
DECL_YAML AT_DECL_DNA_YAML
AT_DECL_DNAV
String<-1> name; String<-1> name;
Value<atVec3f> location; Value<atVec3f> location;
Value<atVec3f> orientation; Value<atVec3f> orientation;

View File

@ -9,7 +9,8 @@ namespace DataSpec::DNAMP1
{ {
struct AreaAttributes : IScriptObject struct AreaAttributes : IScriptObject
{ {
DECL_YAML AT_DECL_DNA_YAML
AT_DECL_DNAV
enum class EWeatherType : atUint32 enum class EWeatherType : atUint32
{ {
None, None,

View File

@ -9,7 +9,8 @@ namespace DataSpec::DNAMP1
{ {
struct AtomicAlpha : IScriptObject struct AtomicAlpha : IScriptObject
{ {
DECL_YAML AT_DECL_DNA_YAML
AT_DECL_DNAV
String<-1> name; String<-1> name;
Value<atVec3f> location; Value<atVec3f> location;
Value<atVec3f> orientation; Value<atVec3f> orientation;

View File

@ -9,7 +9,8 @@ namespace DataSpec::DNAMP1
{ {
struct AtomicBeta : IScriptObject struct AtomicBeta : IScriptObject
{ {
DECL_YAML AT_DECL_DNA_YAML
AT_DECL_DNAV
String<-1> name; String<-1> name;
Value<atVec3f> location; Value<atVec3f> location;
Value<atVec3f> orientation; Value<atVec3f> orientation;

View File

@ -9,7 +9,8 @@ namespace DataSpec::DNAMP1
{ {
struct Babygoth : IScriptObject struct Babygoth : IScriptObject
{ {
DECL_YAML AT_DECL_DNA_YAML
AT_DECL_DNAV
String<-1> name; String<-1> name;
Value<atVec3f> location; Value<atVec3f> location;
Value<atVec3f> orientation; Value<atVec3f> orientation;

View File

@ -9,7 +9,8 @@ namespace DataSpec::DNAMP1
{ {
struct BallTrigger : IScriptObject struct BallTrigger : IScriptObject
{ {
DECL_YAML AT_DECL_DNA_YAML
AT_DECL_DNAV
String<-1> name; String<-1> name;
Value<atVec3f> location; Value<atVec3f> location;
Value<atVec3f> volume; Value<atVec3f> volume;

View File

@ -9,7 +9,8 @@ namespace DataSpec::DNAMP1
{ {
struct Beetle : IScriptObject struct Beetle : IScriptObject
{ {
DECL_YAML AT_DECL_DNA_YAML
AT_DECL_DNAV
String<-1> name; String<-1> name;
Value<atUint32> unknown1; Value<atUint32> unknown1;
Value<atVec3f> location; Value<atVec3f> location;

View File

@ -9,7 +9,8 @@ namespace DataSpec::DNAMP1
{ {
struct BloodFlower : IScriptObject struct BloodFlower : IScriptObject
{ {
DECL_YAML AT_DECL_DNA_YAML
AT_DECL_DNAV
String<-1> name; String<-1> name;
Value<atVec3f> location; Value<atVec3f> location;
Value<atVec3f> orientation; Value<atVec3f> orientation;

View File

@ -9,7 +9,8 @@ namespace DataSpec::DNAMP1
{ {
struct Burrower : IScriptObject struct Burrower : IScriptObject
{ {
DECL_YAML AT_DECL_DNA_YAML
AT_DECL_DNAV
String<-1> name; String<-1> name;
Value<atVec3f> location; Value<atVec3f> location;
Value<atVec3f> orientation; Value<atVec3f> orientation;

View File

@ -134,7 +134,11 @@ set(ScriptObjectsMP1_SOURCES
Parameters.cpp Parameters.cpp
Actor.cpp Actor.cpp
Platform.cpp Platform.cpp
DoorArea.cpp) DoorArea.cpp
Oculus.cpp
Ridley.cpp
Water.cpp
WorldTeleporter.cpp)
dataspec_add_list(DNAMP1/ScriptObjects ScriptObjectsMP1_SOURCES) dataspec_add_list(DNAMP1/ScriptObjects ScriptObjectsMP1_SOURCES)
list(APPEND ScriptObjectsMP1_SOURCES ${liblist}) list(APPEND ScriptObjectsMP1_SOURCES ${liblist})

View File

@ -9,7 +9,8 @@ namespace DataSpec::DNAMP1
{ {
struct Camera : IScriptObject struct Camera : IScriptObject
{ {
DECL_YAML AT_DECL_DNA_YAML
AT_DECL_DNAV
String<-1> name; String<-1> name;
Value<atVec3f> location; Value<atVec3f> location;
Value<atVec3f> orientation; Value<atVec3f> orientation;

View File

@ -9,7 +9,8 @@ namespace DataSpec::DNAMP1
{ {
struct CameraBlurKeyframe : IScriptObject struct CameraBlurKeyframe : IScriptObject
{ {
DECL_YAML AT_DECL_DNA_YAML
AT_DECL_DNAV
String<-1> name; String<-1> name;
Value<bool> active; Value<bool> active;
Value<atUint32> btype; Value<atUint32> btype;

View File

@ -9,7 +9,8 @@ namespace DataSpec::DNAMP1
{ {
struct CameraFilterKeyframe : IScriptObject struct CameraFilterKeyframe : IScriptObject
{ {
DECL_YAML AT_DECL_DNA_YAML
AT_DECL_DNAV
String<-1> name; String<-1> name;
Value<bool> active; Value<bool> active;
Value<atUint32> ftype; Value<atUint32> ftype;

View File

@ -9,16 +9,17 @@ namespace DataSpec::DNAMP1
{ {
struct CameraHint : IScriptObject struct CameraHint : IScriptObject
{ {
DECL_YAML AT_DECL_DNA_YAML
AT_DECL_DNAV
String<-1> name; String<-1> name;
Value<atVec3f> location; Value<atVec3f> location;
Value<atVec3f> orientation; Value<atVec3f> orientation;
Value<bool> active; Value<bool> active;
Value<atUint32> priority; Value<atUint32> priority;
Value<atUint32> behaviour; Value<atUint32> behaviour;
struct CameraHintParameters : BigYAML struct CameraHintParameters : BigDNA
{ {
DECL_YAML AT_DECL_DNA
Value<atUint32> propertyCount; Value<atUint32> propertyCount;
Value<bool> calculateCamPos; // 0x1 Value<bool> calculateCamPos; // 0x1
Value<bool> chaseAllowed; // 0x2 Value<bool> chaseAllowed; // 0x2
@ -44,15 +45,15 @@ struct CameraHint : IScriptObject
Value<bool> unknown22; // 0x200000 Value<bool> unknown22; // 0x200000
} cameraHintParameters; } cameraHintParameters;
struct BoolFloat : BigYAML struct BoolFloat : BigDNA
{ {
DECL_YAML AT_DECL_DNA
Value<bool> active; Value<bool> active;
Value<float> value; Value<float> value;
} minDist, maxDist, backwardsDist; // 0x400000, 0x800000, 0x1000000 } minDist, maxDist, backwardsDist; // 0x400000, 0x800000, 0x1000000
struct BoolVec3f : BigYAML struct BoolVec3f : BigDNA
{ {
DECL_YAML AT_DECL_DNA
Value<bool> active; Value<bool> active;
Value<atVec3f> value; Value<atVec3f> value;
} lookAtOffset, chaseLookAtOffset; // 0x2000000, 0x4000000 } lookAtOffset, chaseLookAtOffset; // 0x2000000, 0x4000000

View File

@ -9,7 +9,8 @@ namespace DataSpec::DNAMP1
{ {
struct CameraHintTrigger : IScriptObject struct CameraHintTrigger : IScriptObject
{ {
DECL_YAML AT_DECL_DNA_YAML
AT_DECL_DNAV
String<-1> name; String<-1> name;
Value<atVec3f> location; Value<atVec3f> location;
Value<atVec3f> orientation; Value<atVec3f> orientation;

View File

@ -9,7 +9,8 @@ namespace DataSpec::DNAMP1
{ {
struct CameraPitchVolume : IScriptObject struct CameraPitchVolume : IScriptObject
{ {
DECL_YAML AT_DECL_DNA_YAML
AT_DECL_DNAV
String<-1> name; String<-1> name;
Value<atVec3f> location; Value<atVec3f> location;
Value<atVec3f> orientation; Value<atVec3f> orientation;

View File

@ -9,7 +9,8 @@ namespace DataSpec::DNAMP1
{ {
struct CameraShaker : IScriptObject struct CameraShaker : IScriptObject
{ {
DECL_YAML AT_DECL_DNA_YAML
AT_DECL_DNAV
String<-1> name; String<-1> name;
Value<float> xMag; Value<float> xMag;
Value<float> xB; Value<float> xB;

View File

@ -9,7 +9,8 @@ namespace DataSpec::DNAMP1
{ {
struct CameraWaypoint : IScriptObject struct CameraWaypoint : IScriptObject
{ {
DECL_YAML AT_DECL_DNA_YAML
AT_DECL_DNAV
String<-1> name; String<-1> name;
Value<atVec3f> location; Value<atVec3f> location;
Value<atVec3f> orientation; Value<atVec3f> orientation;

View File

@ -9,7 +9,8 @@ namespace DataSpec::DNAMP1
{ {
struct ChozoGhost : IScriptObject struct ChozoGhost : IScriptObject
{ {
DECL_YAML AT_DECL_DNA_YAML
AT_DECL_DNAV
String<-1> name; String<-1> name;
Value<atVec3f> location; Value<atVec3f> location;
Value<atVec3f> orientation; Value<atVec3f> orientation;

View File

@ -9,7 +9,8 @@ namespace DataSpec::DNAMP1
{ {
struct ColorModulate : IScriptObject struct ColorModulate : IScriptObject
{ {
DECL_YAML AT_DECL_DNA_YAML
AT_DECL_DNAV
String<-1> name; String<-1> name;
Value<atVec4f> unknown1; Value<atVec4f> unknown1;
Value<atVec4f> unknown2; Value<atVec4f> unknown2;

View File

@ -9,7 +9,8 @@ namespace DataSpec::DNAMP1
{ {
struct ControllerAction : IScriptObject struct ControllerAction : IScriptObject
{ {
DECL_YAML AT_DECL_DNA_YAML
AT_DECL_DNAV
String<-1> name; String<-1> name;
Value<bool> active; Value<bool> active;
Value<atUint32> command; Value<atUint32> command;

View File

@ -9,7 +9,8 @@ namespace DataSpec::DNAMP1
{ {
struct Counter : IScriptObject struct Counter : IScriptObject
{ {
DECL_YAML AT_DECL_DNA_YAML
AT_DECL_DNAV
String<-1> name; String<-1> name;
Value<atUint32> startValue; // needs verification Value<atUint32> startValue; // needs verification
Value<atUint32> maxValue; Value<atUint32> maxValue;

View File

@ -9,7 +9,8 @@ namespace DataSpec::DNAMP1
{ {
struct CoverPoint : IScriptObject struct CoverPoint : IScriptObject
{ {
DECL_YAML AT_DECL_DNA_YAML
AT_DECL_DNAV
String<-1> name; String<-1> name;
Value<atVec3f> location; Value<atVec3f> location;
Value<atVec3f> orientation; Value<atVec3f> orientation;

Some files were not shown because too many files have changed in this diff Show More