YAML RAII refactor

This commit is contained in:
Jack Andersen 2017-02-12 13:56:03 -10:00
parent 1b8baca988
commit 748e81ae6e
29 changed files with 1314 additions and 1842 deletions

View File

@ -81,43 +81,40 @@ void CRSM<IDType>::read(athena::io::YAMLDocReader& r)
continue; continue;
} }
r.enterSubRecord(elem.first.c_str()); if (auto rec = r.enterSubRecord(elem.first.c_str()))
FourCC clsId(elem.first.c_str());
auto gen = std::find_if(GeneratorTypes.begin(), GeneratorTypes.end(), [&clsId](const FourCC& other) -> bool{
return clsId == other;
});
if (gen != GeneratorTypes.end())
{ {
x0_generators[clsId].read(r); FourCC clsId(elem.first.c_str());
r.leaveSubRecord(); auto gen = std::find_if(GeneratorTypes.begin(), GeneratorTypes.end(), [&clsId](const FourCC& other) -> bool{
continue; return clsId == other;
} });
if (gen != GeneratorTypes.end())
{
x0_generators[clsId].read(r);
continue;
}
auto sfx = std::find_if(SFXTypes.begin(), SFXTypes.end(), [&clsId](const FourCC& other) -> bool{ auto sfx = std::find_if(SFXTypes.begin(), SFXTypes.end(), [&clsId](const FourCC& other) -> bool{
return clsId == other; return clsId == other;
}); });
if (sfx != SFXTypes.end()) if (sfx != SFXTypes.end())
{ {
x10_sfx[clsId] = r.readInt32(clsId.toString().c_str()); x10_sfx[clsId] = r.readInt32(clsId.toString().c_str());
r.leaveSubRecord(); continue;
continue; }
}
auto decal = std::find_if(DecalTypes.begin(), DecalTypes.end(), [&clsId](const FourCC& other) -> bool{ auto decal = std::find_if(DecalTypes.begin(), DecalTypes.end(), [&clsId](const FourCC& other) -> bool{
return clsId == other; return clsId == other;
}); });
if (decal != DecalTypes.end()) if (decal != DecalTypes.end())
{ {
x20_decals[clsId].read(r); x20_decals[clsId].read(r);
r.leaveSubRecord(); continue;
continue; }
if (clsId == SBIG('RNGE'))
x30_RNGE = r.readFloat(nullptr);
else if (clsId == SBIG('FOFF'))
x34_FOFF = r.readFloat(nullptr);
} }
if (clsId == SBIG('RNGE'))
x30_RNGE = r.readFloat(nullptr);
else if (clsId == SBIG('FOFF'))
x34_FOFF = r.readFloat(nullptr);
r.leaveSubRecord();
} }
} }
@ -125,30 +122,18 @@ 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)
{ if (auto rec = w.enterSubRecord(pair.first.toString().c_str()))
w.enterSubRecord(pair.first.toString().c_str()); pair.second.write(w);
pair.second.write(w);
w.leaveSubRecord();
}
}
for (const auto& pair : x10_sfx) for (const auto& pair : x10_sfx)
{
if (pair.second != ~0) if (pair.second != ~0)
w.writeUint32(pair.first.toString().c_str(), pair.second); w.writeUint32(pair.first.toString().c_str(), pair.second);
}
for (const auto& pair : x20_decals) for (const auto& pair : x20_decals)
{
if (pair.second) if (pair.second)
{ if (auto rec = w.enterSubRecord(pair.first.toString().c_str()))
w.enterSubRecord(pair.first.toString().c_str()); pair.second.write(w);
pair.second.write(w);
w.leaveSubRecord();
}
}
if (x30_RNGE != 50.f) if (x30_RNGE != 50.f)
w.writeFloat("RNGE", x30_RNGE); w.writeFloat("RNGE", x30_RNGE);

View File

@ -63,21 +63,23 @@ public:
void read(athena::io::YAMLDocReader& reader) void read(athena::io::YAMLDocReader& reader)
{ {
size_t count; size_t count;
reader.enterSubVector(nullptr, count); if (auto v = reader.enterSubVector(nullptr, count))
r = (count >= 1) ? reader.readFloat(nullptr) : 0.f; {
g = (count >= 2) ? reader.readFloat(nullptr) : 0.f; r = (count >= 1) ? reader.readFloat(nullptr) : 0.f;
b = (count >= 3) ? reader.readFloat(nullptr) : 0.f; g = (count >= 2) ? reader.readFloat(nullptr) : 0.f;
a = (count >= 4) ? reader.readFloat(nullptr) : 0.f; b = (count >= 3) ? reader.readFloat(nullptr) : 0.f;
reader.leaveSubVector(); a = (count >= 4) ? reader.readFloat(nullptr) : 0.f;
}
} }
void write(athena::io::YAMLDocWriter& writer) const void write(athena::io::YAMLDocWriter& writer) const
{ {
writer.enterSubVector(nullptr); if (auto v = writer.enterSubVector(nullptr))
writer.writeFloat(nullptr, r); {
writer.writeFloat(nullptr, g); writer.writeFloat(nullptr, r);
writer.writeFloat(nullptr, b); writer.writeFloat(nullptr, g);
writer.writeFloat(nullptr, a); writer.writeFloat(nullptr, b);
writer.leaveSubVector(); writer.writeFloat(nullptr, a);
}
} }
size_t binarySize(size_t __isz) const size_t binarySize(size_t __isz) const
{return __isz + 4;} {return __isz + 4;}

View File

@ -15,58 +15,58 @@ void DPSM<IDType>::read(athena::io::YAMLDocReader& r)
continue; continue;
} }
r.enterSubRecord(elem.first.c_str()); if (auto rec = r.enterSubRecord(elem.first.c_str()))
bool loadFirstDesc = false;
uint32_t clsId = *reinterpret_cast<const uint32_t*>(elem.first.c_str());
switch(clsId)
{ {
case SBIG('1SZE'): bool loadFirstDesc = false;
case SBIG('1LFT'): uint32_t clsId = *reinterpret_cast<const uint32_t*>(elem.first.c_str());
case SBIG('1ROT'): switch(clsId)
case SBIG('1OFF'): {
case SBIG('1CLR'): case SBIG('1SZE'):
case SBIG('1TEX'): case SBIG('1LFT'):
case SBIG('1ADD'): case SBIG('1ROT'):
loadFirstDesc = true; case SBIG('1OFF'):
case SBIG('2SZE'): case SBIG('1CLR'):
case SBIG('2LFT'): case SBIG('1TEX'):
case SBIG('2ROT'): case SBIG('1ADD'):
case SBIG('2OFF'): loadFirstDesc = true;
case SBIG('2CLR'): case SBIG('2SZE'):
case SBIG('2TEX'): case SBIG('2LFT'):
case SBIG('2ADD'): case SBIG('2ROT'):
if (loadFirstDesc) case SBIG('2OFF'):
readQuadDecalInfo(r, clsId, x0_quad); case SBIG('2CLR'):
else case SBIG('2TEX'):
readQuadDecalInfo(r, clsId, x1c_quad); case SBIG('2ADD'):
break; if (loadFirstDesc)
case SBIG('DMDL'): readQuadDecalInfo(r, clsId, x0_quad);
x38_DMDL.read(r); else
break; readQuadDecalInfo(r, clsId, x1c_quad);
case SBIG('DLFT'): break;
x48_DLFT.read(r); case SBIG('DMDL'):
break; x38_DMDL.read(r);
case SBIG('DMOP'): break;
x4c_DMOP.read(r); case SBIG('DLFT'):
break; x48_DLFT.read(r);
case SBIG('DMRT'): break;
x50_DMRT.read(r); case SBIG('DMOP'):
break; x4c_DMOP.read(r);
case SBIG('DMSC'): break;
x54_DMSC.read(r); case SBIG('DMRT'):
break; x50_DMRT.read(r);
case SBIG('DMCL'): break;
x58_DMCL.read(r); case SBIG('DMSC'):
break; x54_DMSC.read(r);
case SBIG('DMAB'): break;
x5c_24_DMAB = r.readBool(nullptr); case SBIG('DMCL'):
break; x58_DMCL.read(r);
case SBIG('DMOO'): break;
x5c_25_DMOO = r.readBool(nullptr); case SBIG('DMAB'):
break; x5c_24_DMAB = r.readBool(nullptr);
break;
case SBIG('DMOO'):
x5c_25_DMOO = r.readBool(nullptr);
break;
}
} }
r.leaveSubRecord();
} }
} }
@ -77,41 +77,24 @@ void DPSM<IDType>::write(athena::io::YAMLDocWriter& w) const
writeQuadDecalInfo(w, x1c_quad, false); writeQuadDecalInfo(w, x1c_quad, false);
if (x38_DMDL) if (x38_DMDL)
{ if (auto rec = w.enterSubRecord("DMDL"))
w.enterSubRecord("DMDL"); x38_DMDL.write(w);
x38_DMDL.write(w);
w.leaveSubRecord();
}
if (x48_DLFT) if (x48_DLFT)
{ if (auto rec = w.enterSubRecord("DLFT"))
w.enterSubRecord("DLFT"); x48_DLFT.write(w);
x48_DLFT.write(w);
w.leaveSubRecord();
}
if (x4c_DMOP) if (x4c_DMOP)
{ if (auto rec = w.enterSubRecord("DMOP"))
w.enterSubRecord("DMOP"); x4c_DMOP.write(w);
x4c_DMOP.write(w);
w.leaveSubRecord();
}
if (x50_DMRT) if (x50_DMRT)
{ if (auto rec = w.enterSubRecord("DMRT"))
w.enterSubRecord("DMRT"); x50_DMRT.write(w);
x50_DMRT.write(w);
w.leaveSubRecord();
}
if (x54_DMSC) if (x54_DMSC)
{ if (auto rec = w.enterSubRecord("DMSC"))
w.enterSubRecord("DMSC"); x54_DMSC.write(w);
x54_DMSC.write(w);
w.leaveSubRecord();
}
if (x58_DMCL) if (x58_DMCL)
{ if (auto rec = w.enterSubRecord("DMCL"))
w.enterSubRecord("DMCL"); x54_DMSC.write(w);
x54_DMSC.write(w);
w.leaveSubRecord();
}
if (x5c_24_DMAB) if (x5c_24_DMAB)
w.writeBool("DMAB", x5c_24_DMAB); w.writeBool("DMAB", x5c_24_DMAB);
if (x5c_25_DMOO) if (x5c_25_DMOO)
@ -160,48 +143,26 @@ void DPSM<IDType>::writeQuadDecalInfo(athena::io::YAMLDocWriter& w,
const typename DPSM<IDType>::SQuadDescr& quad, bool first) const const typename DPSM<IDType>::SQuadDescr& quad, bool first) const
{ {
if (quad.x0_LFT) if (quad.x0_LFT)
{ if (auto rec = w.enterSubRecord((first ? "1LFT" : "2LFT")))
w.enterSubRecord((first ? "1LFT" : "2LFT")); quad.x0_LFT.write(w);
quad.x0_LFT.write(w);
w.leaveSubRecord();
}
if (quad.x4_SZE) if (quad.x4_SZE)
{ if (auto rec = w.enterSubRecord((first ? "1SZE" : "2SZE")))
w.enterSubRecord((first ? "1SZE" : "2SZE")); quad.x4_SZE.write(w);
quad.x4_SZE.write(w);
w.leaveSubRecord();
}
if (quad.x8_ROT) if (quad.x8_ROT)
{ if (auto rec = w.enterSubRecord((first ? "1ROT" : "2ROT")))
w.enterSubRecord((first ? "1ROT" : "2ROT")); quad.x8_ROT.write(w);
quad.x8_ROT.write(w);
w.leaveSubRecord();
}
if (quad.xc_OFF) if (quad.xc_OFF)
{ if (auto rec = w.enterSubRecord((first ? "1OFF" : "2OFF")))
w.enterSubRecord((first ? "1OFF" : "2OFF")); quad.xc_OFF.write(w);
quad.xc_OFF.write(w);
w.leaveSubRecord();
}
if (quad.x10_CLR) if (quad.x10_CLR)
{ if (auto rec = w.enterSubRecord((first ? "1CLR" : "2CLR")))
w.enterSubRecord((first ? "1CLR" : "2CLR")); quad.x10_CLR.write(w);
quad.x10_CLR.write(w);
w.leaveSubRecord();
}
if (quad.x14_TEX) if (quad.x14_TEX)
{ if (auto rec = w.enterSubRecord((first ? "1TEX" : "2TEX")))
w.enterSubRecord((first ? "1TEX" : "2TEX")); quad.x14_TEX.write(w);
quad.x14_TEX.write(w);
w.leaveSubRecord();
}
if (quad.x18_ADD) if (quad.x18_ADD)
{ if (auto rec = w.enterSubRecord((first ? "1ADD" : "2ADD")))
w.enterSubRecord((first ? "1ADD" : "2ADD")); quad.x18_ADD.write(w);
quad.x18_ADD.write(w);
w.leaveSubRecord();
}
} }
template <class IDType> template <class IDType>

View File

@ -84,125 +84,65 @@ template <class IDType>
void ELSM<IDType>::write(athena::io::YAMLDocWriter& w) const void ELSM<IDType>::write(athena::io::YAMLDocWriter& w) const
{ {
if (x0_LIFE) if (x0_LIFE)
{ if (auto rec = w.enterSubRecord("LIFE"))
w.enterSubRecord("LIFE"); x0_LIFE.write(w);
x0_LIFE.write(w);
w.leaveSubRecord();
}
if (x4_SLIF) if (x4_SLIF)
{ if (auto rec = w.enterSubRecord("SLIF"))
w.enterSubRecord("SLIF"); x4_SLIF.write(w);
x4_SLIF.write(w);
w.leaveSubRecord();
}
if (x8_GRAT) if (x8_GRAT)
{ if (auto rec = w.enterSubRecord("GRAT"))
w.enterSubRecord("GRAT"); x8_GRAT.write(w);
x8_GRAT.write(w);
w.leaveSubRecord();
}
if (xc_SCNT) if (xc_SCNT)
{ if (auto rec = w.enterSubRecord("SCNT"))
w.enterSubRecord("SCNT"); xc_SCNT.write(w);
xc_SCNT.write(w);
w.leaveSubRecord();
}
if (x10_SSEG) if (x10_SSEG)
{ if (auto rec = w.enterSubRecord("SSEG"))
w.enterSubRecord("SSEG"); x10_SSEG.write(w);
x10_SSEG.write(w);
w.leaveSubRecord();
}
if (x14_COLR) if (x14_COLR)
{ if (auto rec = w.enterSubRecord("COLR"))
w.enterSubRecord("COLR"); x14_COLR.write(w);
x14_COLR.write(w);
w.leaveSubRecord();
}
if (x18_IEMT) if (x18_IEMT)
{ if (auto rec = w.enterSubRecord("IEMT"))
w.enterSubRecord("IEMT"); x18_IEMT.write(w);
x18_IEMT.write(w);
w.leaveSubRecord();
}
if (x1c_FEMT) if (x1c_FEMT)
{ if (auto rec = w.enterSubRecord("FEMT"))
w.enterSubRecord("FEMT"); x1c_FEMT.write(w);
x1c_FEMT.write(w);
w.leaveSubRecord();
}
if (x20_AMPL) if (x20_AMPL)
{ if (auto rec = w.enterSubRecord("AMPL"))
w.enterSubRecord("AMPL"); x20_AMPL.write(w);
x20_AMPL.write(w);
w.leaveSubRecord();
}
if (x24_AMPD) if (x24_AMPD)
{ if (auto rec = w.enterSubRecord("AMPD"))
w.enterSubRecord("AMPD"); x24_AMPD.write(w);
x24_AMPD.write(w);
w.leaveSubRecord();
}
if (x28_LWD1) if (x28_LWD1)
{ if (auto rec = w.enterSubRecord("LWD1"))
w.enterSubRecord("LWD1"); x28_LWD1.write(w);
x28_LWD1.write(w);
w.leaveSubRecord();
}
if (x2c_LWD2) if (x2c_LWD2)
{ if (auto rec = w.enterSubRecord("LWD2"))
w.enterSubRecord("LWD2"); x2c_LWD2.write(w);
x2c_LWD2.write(w);
w.leaveSubRecord();
}
if (x30_LWD3) if (x30_LWD3)
{ if (auto rec = w.enterSubRecord("LWD3"))
w.enterSubRecord("LWD3"); x30_LWD3.write(w);
x30_LWD3.write(w);
w.leaveSubRecord();
}
if (x34_LCL1) if (x34_LCL1)
{ if (auto rec = w.enterSubRecord("LCL1"))
w.enterSubRecord("LCL1"); x34_LCL1.write(w);
x34_LCL1.write(w);
w.leaveSubRecord();
}
if (x38_LCL2) if (x38_LCL2)
{ if (auto rec = w.enterSubRecord("LCL2"))
w.enterSubRecord("LCL2"); x38_LCL2.write(w);
x38_LCL2.write(w);
w.leaveSubRecord();
}
if (x3c_LCL3) if (x3c_LCL3)
{ if (auto rec = w.enterSubRecord("LCL3"))
w.enterSubRecord("LCL3"); x3c_LCL3.write(w);
x3c_LCL3.write(w);
w.leaveSubRecord();
}
if (x40_SSWH) if (x40_SSWH)
{ if (auto rec = w.enterSubRecord("SSWH"))
w.enterSubRecord("SSWH"); x40_SSWH.write(w);
x40_SSWH.write(w);
w.leaveSubRecord();
}
if (x50_GPSM) if (x50_GPSM)
{ if (auto rec = w.enterSubRecord("GPSM"))
w.enterSubRecord("GPSM"); x50_GPSM.write(w);
x50_GPSM.write(w);
w.leaveSubRecord();
}
if (x60_EPSM) if (x60_EPSM)
{ if (auto rec = w.enterSubRecord("EPSM"))
w.enterSubRecord("EPSM"); x60_EPSM.write(w);
x60_EPSM.write(w);
w.leaveSubRecord();
}
if (x70_ZERY) if (x70_ZERY)
{ if (auto rec = w.enterSubRecord("ZERY"))
w.enterSubRecord("ZERY"); x70_ZERY.write(w);
x70_ZERY.write(w);
w.leaveSubRecord();
}
} }
template <class IDType> template <class IDType>

View File

@ -186,20 +186,20 @@ void FONT<IDType>::read(athena::io::YAMLDocReader& __dna_docin)
/* glyphCount */ /* glyphCount */
/* glyphs */ /* glyphs */
size_t count; size_t count;
__dna_docin.enterSubVector("glyphs", count); if (auto v = __dna_docin.enterSubVector("glyphs", count))
glyphCount = count;
for (atUint32 i = 0; i < glyphCount; i++)
{ {
if (version < 4) glyphCount = count;
glyphs.emplace_back(new GlyphMP1); for (atUint32 i = 0; i < glyphCount; i++)
else {
glyphs.emplace_back(new GlyphMP2); if (version < 4)
glyphs.emplace_back(new GlyphMP1);
else
glyphs.emplace_back(new GlyphMP2);
__dna_docin.enterSubRecord(nullptr); if (auto rec = __dna_docin.enterSubRecord(nullptr))
glyphs.back()->read(__dna_docin); glyphs.back()->read(__dna_docin);
__dna_docin.leaveSubRecord(); }
} }
__dna_docin.leaveSubVector();
/* kerningInfoCount squelched */ /* kerningInfoCount squelched */
/* kerningInfo */ /* kerningInfo */
kerningInfoCount = __dna_docin.enumerate("kerningInfo", kerningInfo); kerningInfoCount = __dna_docin.enumerate("kerningInfo", kerningInfo);
@ -234,16 +234,10 @@ void FONT<IDType>::write(athena::io::YAMLDocWriter& __dna_docout) const
__dna_docout.writeUint32("textureFormat", textureFormat); __dna_docout.writeUint32("textureFormat", textureFormat);
/* glyphCount squelched */ /* glyphCount squelched */
/* glyphs */ /* glyphs */
__dna_docout.enterSubVector("glyphs"); if (auto v = __dna_docout.enterSubVector("glyphs"))
for (const std::unique_ptr<IGlyph>& glyph : glyphs)
for (const std::unique_ptr<IGlyph>& glyph : glyphs) if (auto rec = __dna_docout.enterSubRecord(nullptr))
{ glyph->write(__dna_docout);
__dna_docout.enterSubRecord(nullptr);
glyph->write(__dna_docout);
__dna_docout.leaveSubRecord();
}
__dna_docout.leaveSubVector();
/* kerningInfoCount squelched */ /* kerningInfoCount squelched */
/* kerningInfo */ /* kerningInfo */
__dna_docout.enumerate("kerningInfo", kerningInfo); __dna_docout.enumerate("kerningInfo", kerningInfo);

View File

@ -207,18 +207,20 @@ void PAKRouter<BRIDGETYPE>::build(std::vector<BRIDGETYPE>& bridges, std::functio
{ {
if (namedEntry.name == "holo_cinf") if (namedEntry.name == "holo_cinf")
continue; /* Problematic corner case */ continue; /* Problematic corner case */
catalogWriter.enterSubRecord(namedEntry.name.c_str()); if (auto rec = catalogWriter.enterSubRecord(namedEntry.name.c_str()))
hecl::ProjectPath working = getWorking(namedEntry.id);
if (working.getAuxInfoUTF8().size())
{ {
catalogWriter.enterSubVector(nullptr); hecl::ProjectPath working = getWorking(namedEntry.id);
catalogWriter.writeString(nullptr, working.getRelativePathUTF8().c_str()); if (working.getAuxInfoUTF8().size())
catalogWriter.writeString(nullptr, working.getAuxInfoUTF8().c_str()); {
catalogWriter.leaveSubVector(); if (auto v = catalogWriter.enterSubVector(nullptr))
{
catalogWriter.writeString(nullptr, working.getRelativePathUTF8().c_str());
catalogWriter.writeString(nullptr, working.getAuxInfoUTF8().c_str());
}
}
else
catalogWriter.writeString(nullptr, working.getRelativePathUTF8().c_str());
} }
else
catalogWriter.writeString(nullptr, working.getRelativePathUTF8().c_str());
catalogWriter.leaveSubRecord();
} }
/* Write catalog */ /* Write catalog */

File diff suppressed because it is too large Load Diff

View File

@ -125,19 +125,15 @@ void RealElementFactory::read(athena::io::YAMLDocReader& r)
m_elem.reset(); m_elem.reset();
return; return;
} }
r.enterSubRecord(elem.first.c_str()); if (auto rec = r.enterSubRecord(elem.first.c_str()))
m_elem->read(r); m_elem->read(r);
r.leaveSubRecord();
} }
void RealElementFactory::write(athena::io::YAMLDocWriter& w) const void RealElementFactory::write(athena::io::YAMLDocWriter& w) const
{ {
if (m_elem) if (m_elem)
{ if (auto rec = w.enterSubRecord(m_elem->ClassID()))
w.enterSubRecord(m_elem->ClassID()); m_elem->write(w);
m_elem->write(w);
w.leaveSubRecord();
}
} }
size_t RealElementFactory::binarySize(size_t __isz) const size_t RealElementFactory::binarySize(size_t __isz) const
@ -348,19 +344,15 @@ void IntElementFactory::read(athena::io::YAMLDocReader& r)
m_elem.reset(); m_elem.reset();
return; return;
} }
r.enterSubRecord(elem.first.c_str()); if (auto rec = r.enterSubRecord(elem.first.c_str()))
m_elem->read(r); m_elem->read(r);
r.leaveSubRecord();
} }
void IntElementFactory::write(athena::io::YAMLDocWriter& w) const void IntElementFactory::write(athena::io::YAMLDocWriter& w) const
{ {
if (m_elem) if (m_elem)
{ if (auto rec = w.enterSubRecord(m_elem->ClassID()))
w.enterSubRecord(m_elem->ClassID()); m_elem->write(w);
m_elem->write(w);
w.leaveSubRecord();
}
} }
size_t IntElementFactory::binarySize(size_t __isz) const size_t IntElementFactory::binarySize(size_t __isz) const
@ -522,19 +514,15 @@ void VectorElementFactory::read(athena::io::YAMLDocReader& r)
m_elem.reset(); m_elem.reset();
return; return;
} }
r.enterSubRecord(elem.first.c_str()); if (auto rec = r.enterSubRecord(elem.first.c_str()))
m_elem->read(r); m_elem->read(r);
r.leaveSubRecord();
} }
void VectorElementFactory::write(athena::io::YAMLDocWriter& w) const void VectorElementFactory::write(athena::io::YAMLDocWriter& w) const
{ {
if (m_elem) if (m_elem)
{ if (auto rec = w.enterSubRecord(m_elem->ClassID()))
w.enterSubRecord(m_elem->ClassID()); m_elem->write(w);
m_elem->write(w);
w.leaveSubRecord();
}
} }
size_t VectorElementFactory::binarySize(size_t __isz) const size_t VectorElementFactory::binarySize(size_t __isz) const
@ -664,19 +652,15 @@ void ColorElementFactory::read(athena::io::YAMLDocReader& r)
m_elem.reset(); m_elem.reset();
return; return;
} }
r.enterSubRecord(elem.first.c_str()); if (auto rec = r.enterSubRecord(elem.first.c_str()))
m_elem->read(r); m_elem->read(r);
r.leaveSubRecord();
} }
void ColorElementFactory::write(athena::io::YAMLDocWriter& w) const void ColorElementFactory::write(athena::io::YAMLDocWriter& w) const
{ {
if (m_elem) if (m_elem)
{ if (auto rec = w.enterSubRecord(m_elem->ClassID()))
w.enterSubRecord(m_elem->ClassID()); m_elem->write(w);
m_elem->write(w);
w.leaveSubRecord();
}
} }
size_t ColorElementFactory::binarySize(size_t __isz) const size_t ColorElementFactory::binarySize(size_t __isz) const
@ -790,19 +774,15 @@ void ModVectorElementFactory::read(athena::io::YAMLDocReader& r)
m_elem.reset(); m_elem.reset();
return; return;
} }
r.enterSubRecord(elem.first.c_str()); if (auto rec = r.enterSubRecord(elem.first.c_str()))
m_elem->read(r); m_elem->read(r);
r.leaveSubRecord();
} }
void ModVectorElementFactory::write(athena::io::YAMLDocWriter& w) const void ModVectorElementFactory::write(athena::io::YAMLDocWriter& w) const
{ {
if (m_elem) if (m_elem)
{ if (auto rec = w.enterSubRecord(m_elem->ClassID()))
w.enterSubRecord(m_elem->ClassID()); m_elem->write(w);
m_elem->write(w);
w.leaveSubRecord();
}
} }
size_t ModVectorElementFactory::binarySize(size_t __isz) const size_t ModVectorElementFactory::binarySize(size_t __isz) const
@ -909,19 +889,15 @@ void EmitterElementFactory::read(athena::io::YAMLDocReader& r)
m_elem.reset(); m_elem.reset();
return; return;
} }
r.enterSubRecord(elem.first.c_str()); if (auto rec = r.enterSubRecord(elem.first.c_str()))
m_elem->read(r); m_elem->read(r);
r.leaveSubRecord();
} }
void EmitterElementFactory::write(athena::io::YAMLDocWriter& w) const void EmitterElementFactory::write(athena::io::YAMLDocWriter& w) const
{ {
if (m_elem) if (m_elem)
{ if (auto rec = w.enterSubRecord(m_elem->ClassID()))
w.enterSubRecord(m_elem->ClassID()); m_elem->write(w);
m_elem->write(w);
w.leaveSubRecord();
}
} }
size_t EmitterElementFactory::binarySize(size_t __isz) const size_t EmitterElementFactory::binarySize(size_t __isz) const

View File

@ -631,25 +631,21 @@ struct VEConstant : IVectorElement
void read(athena::io::YAMLDocReader& r) void read(athena::io::YAMLDocReader& r)
{ {
size_t elemCount; size_t elemCount;
r.enterSubVector(nullptr, elemCount); if (auto v = r.enterSubVector(nullptr, elemCount))
for (int i=0 ; i<3 && i<elemCount ; ++i)
{ {
r.enterSubRecord(nullptr); for (int i=0 ; i<3 && i<elemCount ; ++i)
comps[i].read(r); {
r.leaveSubRecord(); if (auto rec = r.enterSubRecord(nullptr))
comps[i].read(r);
}
} }
r.leaveSubVector();
} }
void write(athena::io::YAMLDocWriter& w) const void write(athena::io::YAMLDocWriter& w) const
{ {
w.enterSubVector(nullptr); if (auto v = w.enterSubVector(nullptr))
for (int i=0 ; i<3 ; ++i) for (int i=0 ; i<3 ; ++i)
{ if (auto rec = w.enterSubRecord(nullptr))
w.enterSubRecord(nullptr); comps[i].write(w);
comps[i].write(w);
w.leaveSubRecord();
}
w.leaveSubVector();
} }
size_t binarySize(size_t __isz) const size_t binarySize(size_t __isz) const
{ {
@ -782,22 +778,15 @@ struct CEConstant : IColorElement
void read(athena::io::YAMLDocReader& r) void read(athena::io::YAMLDocReader& r)
{ {
for (int i=0 ; i<4 ; ++i) for (int i=0 ; i<4 ; ++i)
{ if (auto rec = r.enterSubRecord(nullptr))
r.enterSubRecord(nullptr); comps[i].read(r);
comps[i].read(r);
r.leaveSubRecord();
}
} }
void write(athena::io::YAMLDocWriter& w) const void write(athena::io::YAMLDocWriter& w) const
{ {
w.enterSubVector(nullptr); if (auto v = w.enterSubVector(nullptr))
for (int i=0 ; i<4 ; ++i) for (int i=0 ; i<4 ; ++i)
{ if (auto rec = w.enterSubRecord(nullptr))
w.enterSubRecord(nullptr); comps[i].write(w);
comps[i].write(w);
w.leaveSubRecord();
}
w.leaveSubVector();
} }
size_t binarySize(size_t __isz) const size_t binarySize(size_t __isz) const
{ {
@ -912,22 +901,15 @@ struct MVEConstant : IModVectorElement
void read(athena::io::YAMLDocReader& r) void read(athena::io::YAMLDocReader& r)
{ {
for (int i=0 ; i<3 ; ++i) for (int i=0 ; i<3 ; ++i)
{ if (auto rec = r.enterSubRecord(nullptr))
r.enterSubRecord(nullptr); comps[i].read(r);
comps[i].read(r);
r.leaveSubRecord();
}
} }
void write(athena::io::YAMLDocWriter& w) const void write(athena::io::YAMLDocWriter& w) const
{ {
w.enterSubVector(nullptr); if (auto v = w.enterSubVector(nullptr))
for (int i=0 ; i<3 ; ++i) for (int i=0 ; i<3 ; ++i)
{ if (auto rec = w.enterSubRecord(nullptr))
w.enterSubRecord(nullptr); comps[i].write(w);
comps[i].write(w);
w.leaveSubRecord();
}
w.leaveSubVector();
} }
size_t binarySize(size_t __isz) const size_t binarySize(size_t __isz) const
{ {
@ -1050,25 +1032,17 @@ struct EESimpleEmitterTR : EESimpleEmitter
{ {
position.m_elem.reset(); position.m_elem.reset();
velocity.m_elem.reset(); velocity.m_elem.reset();
if (r.enterSubRecord("ILOC")) if (auto rec = r.enterSubRecord("ILOC"))
{
position.read(r); position.read(r);
r.leaveSubRecord(); if (auto rec = r.enterSubRecord("IVEC"))
}
if (r.enterSubRecord("IVEC"))
{
velocity.read(r); velocity.read(r);
r.leaveSubRecord();
}
} }
void write(athena::io::YAMLDocWriter& w) const void write(athena::io::YAMLDocWriter& w) const
{ {
w.enterSubRecord("ILOC"); if (auto rec = w.enterSubRecord("ILOC"))
position.write(w); position.write(w);
w.leaveSubRecord(); if (auto rec = w.enterSubRecord("IVEC"))
w.enterSubRecord("IVEC"); velocity.write(w);
velocity.write(w);
w.leaveSubRecord();
} }
size_t binarySize(size_t __isz) const size_t binarySize(size_t __isz) const
{ {
@ -1109,17 +1083,13 @@ struct UVEConstant : IUVElement
void read(athena::io::YAMLDocReader& r) void read(athena::io::YAMLDocReader& r)
{ {
tex.clear(); tex.clear();
if (r.enterSubRecord("tex")) if (auto rec = r.enterSubRecord("tex"))
{
tex.read(r); tex.read(r);
r.leaveSubRecord();
}
} }
void write(athena::io::YAMLDocWriter& w) const void write(athena::io::YAMLDocWriter& w) const
{ {
w.enterSubRecord("tex"); if (auto rec = w.enterSubRecord("tex"))
tex.write(w); tex.write(w);
w.leaveSubRecord();
} }
size_t binarySize(size_t __isz) const size_t binarySize(size_t __isz) const
{ {
@ -1160,62 +1130,35 @@ struct UVEAnimTexture : IUVElement
void read(athena::io::YAMLDocReader& r) void read(athena::io::YAMLDocReader& r)
{ {
tex.clear(); tex.clear();
if (r.enterSubRecord("tex")) if (auto rec = r.enterSubRecord("tex"))
{
tex.read(r); tex.read(r);
r.leaveSubRecord(); if (auto rec = r.enterSubRecord("tileW"))
}
if (r.enterSubRecord("tileW"))
{
tileW.read(r); tileW.read(r);
r.leaveSubRecord(); if (auto rec = r.enterSubRecord("tileH"))
}
if (r.enterSubRecord("tileH"))
{
tileH.read(r); tileH.read(r);
r.leaveSubRecord(); if (auto rec = r.enterSubRecord("strideW"))
}
if (r.enterSubRecord("strideW"))
{
strideW.read(r); strideW.read(r);
r.leaveSubRecord(); if (auto rec = r.enterSubRecord("strideH"))
}
if (r.enterSubRecord("strideH"))
{
strideH.read(r); strideH.read(r);
r.leaveSubRecord(); if (auto rec = r.enterSubRecord("cycleFrames"))
}
if (r.enterSubRecord("cycleFrames"))
{
cycleFrames.read(r); cycleFrames.read(r);
r.leaveSubRecord(); if (auto rec = r.enterSubRecord("loop"))
}
if (r.enterSubRecord("loop"))
{
loop = r.readBool(nullptr); loop = r.readBool(nullptr);
r.leaveSubRecord();
}
} }
void write(athena::io::YAMLDocWriter& w) const void write(athena::io::YAMLDocWriter& w) const
{ {
w.enterSubRecord("tex"); if (auto rec = w.enterSubRecord("tex"))
tex.write(w); tex.write(w);
w.leaveSubRecord(); if (auto rec = w.enterSubRecord("tileW"))
w.enterSubRecord("tileW"); tileW.write(w);
tileW.write(w); if (auto rec = w.enterSubRecord("tileH"))
w.leaveSubRecord(); tileH.write(w);
w.enterSubRecord("tileH"); if (auto rec = w.enterSubRecord("strideW"))
tileH.write(w); strideW.write(w);
w.leaveSubRecord(); if (auto rec = w.enterSubRecord("strideH"))
w.enterSubRecord("strideW"); strideH.write(w);
strideW.write(w); if (auto rec = w.enterSubRecord("cycleFrames"))
w.leaveSubRecord(); cycleFrames.write(w);
w.enterSubRecord("strideH");
strideH.write(w);
w.leaveSubRecord();
w.enterSubRecord("cycleFrames");
cycleFrames.write(w);
w.leaveSubRecord();
w.writeBool("loop", loop); w.writeBool("loop", loop);
} }
size_t binarySize(size_t __isz) const size_t binarySize(size_t __isz) const
@ -1274,17 +1217,15 @@ struct UVElementFactory : BigYAML
void read(athena::io::YAMLDocReader& r) void read(athena::io::YAMLDocReader& r)
{ {
if (r.enterSubRecord("CNST")) if (auto rec = r.enterSubRecord("CNST"))
{ {
m_elem.reset(new struct UVEConstant<IDType>); m_elem.reset(new struct UVEConstant<IDType>);
m_elem->read(r); m_elem->read(r);
r.leaveSubRecord();
} }
else if (r.enterSubRecord("ATEX")) else if (auto rec = r.enterSubRecord("ATEX"))
{ {
m_elem.reset(new struct UVEAnimTexture<IDType>); m_elem.reset(new struct UVEAnimTexture<IDType>);
m_elem->read(r); m_elem->read(r);
r.leaveSubRecord();
} }
else else
m_elem.reset(); m_elem.reset();
@ -1293,11 +1234,8 @@ struct UVElementFactory : BigYAML
void write(athena::io::YAMLDocWriter& w) const void write(athena::io::YAMLDocWriter& w) const
{ {
if (m_elem) if (m_elem)
{ if (auto rec = w.enterSubRecord(m_elem->ClassID()))
w.enterSubRecord(m_elem->ClassID()); m_elem->write(w);
m_elem->write(w);
w.leaveSubRecord();
}
} }
size_t binarySize(size_t __isz) const size_t binarySize(size_t __isz) const
@ -1358,32 +1296,19 @@ struct SpawnSystemKeyframeData : BigYAML
void read(athena::io::YAMLDocReader& r) void read(athena::io::YAMLDocReader& r)
{ {
if (r.enterSubRecord("id")) if (auto rec = r.enterSubRecord("id"))
{
id.read(r); id.read(r);
r.leaveSubRecord(); if (auto rec = r.enterSubRecord("a"))
}
if (r.enterSubRecord("a"))
{
a = r.readUint32(nullptr); a = r.readUint32(nullptr);
r.leaveSubRecord(); if (auto rec = r.enterSubRecord("b"))
}
if (r.enterSubRecord("b"))
{
b = r.readUint32(nullptr); b = r.readUint32(nullptr);
r.leaveSubRecord(); if (auto rec = r.enterSubRecord("c"))
}
if (r.enterSubRecord("c"))
{
c = r.readUint32(nullptr); c = r.readUint32(nullptr);
r.leaveSubRecord();
}
} }
void write(athena::io::YAMLDocWriter& w) const void write(athena::io::YAMLDocWriter& w) const
{ {
w.enterSubRecord("id"); if (auto rec = w.enterSubRecord("id"))
id.write(w); id.write(w);
w.leaveSubRecord();
w.writeUint32("a", a); w.writeUint32("a", a);
w.writeUint32("b", b); w.writeUint32("b", b);
w.writeUint32("c", c); w.writeUint32("c", c);
@ -1412,55 +1337,39 @@ struct SpawnSystemKeyframeData : BigYAML
void read(athena::io::YAMLDocReader& r) void read(athena::io::YAMLDocReader& r)
{ {
if (r.enterSubRecord("a")) if (auto rec = r.enterSubRecord("a"))
{
a = r.readUint32(nullptr); a = r.readUint32(nullptr);
r.leaveSubRecord(); if (auto rec = r.enterSubRecord("b"))
}
if (r.enterSubRecord("b"))
{
b = r.readUint32(nullptr); b = r.readUint32(nullptr);
r.leaveSubRecord(); if (auto rec = r.enterSubRecord("endFrame"))
}
if (r.enterSubRecord("endFrame"))
{
endFrame = r.readUint32(nullptr); endFrame = r.readUint32(nullptr);
r.leaveSubRecord(); if (auto rec = r.enterSubRecord("d"))
}
if (r.enterSubRecord("d"))
{
d = r.readUint32(nullptr); d = r.readUint32(nullptr);
r.leaveSubRecord();
}
spawns.clear(); spawns.clear();
size_t spawnCount; size_t spawnCount;
if (r.enterSubVector("spawns", spawnCount)) if (auto v = r.enterSubVector("spawns", spawnCount))
{ {
spawns.reserve(spawnCount); spawns.reserve(spawnCount);
for (const auto& child : r.getCurNode()->m_seqChildren) for (const auto& child : r.getCurNode()->m_seqChildren)
{ {
if (r.enterSubRecord(nullptr)) if (auto rec = r.enterSubRecord(nullptr))
{ {
spawns.emplace_back(); spawns.emplace_back();
spawns.back().first = r.readUint32("startFrame"); spawns.back().first = r.readUint32("startFrame");
size_t systemCount; size_t systemCount;
if (r.enterSubVector("systems", systemCount)) if (auto v = r.enterSubVector("systems", systemCount))
{ {
spawns.back().second.reserve(systemCount); spawns.back().second.reserve(systemCount);
for (const auto& in : r.getCurNode()->m_seqChildren) for (const auto& in : r.getCurNode()->m_seqChildren)
{ {
spawns.back().second.emplace_back(); spawns.back().second.emplace_back();
SpawnSystemKeyframeInfo& info = spawns.back().second.back(); SpawnSystemKeyframeInfo& info = spawns.back().second.back();
r.enterSubRecord(nullptr); if (auto rec = r.enterSubRecord(nullptr))
info.read(r); info.read(r);
r.leaveSubRecord();
} }
r.leaveSubVector();
} }
r.leaveSubRecord();
} }
} }
r.leaveSubVector();
} }
} }
void write(athena::io::YAMLDocWriter& w) const void write(athena::io::YAMLDocWriter& w) const
@ -1471,22 +1380,20 @@ struct SpawnSystemKeyframeData : BigYAML
w.writeUint32("b", b); w.writeUint32("b", b);
w.writeUint32("endFrame", endFrame); w.writeUint32("endFrame", endFrame);
w.writeUint32("d", d); w.writeUint32("d", d);
w.enterSubVector("spawns"); if (auto v = w.enterSubVector("spawns"))
for (const auto& spawn : spawns)
{ {
w.enterSubRecord(nullptr); for (const auto& spawn : spawns)
w.writeUint32("startFrame", spawn.first);
w.enterSubVector("systems");
for (const auto& info : spawn.second)
{ {
w.enterSubRecord(nullptr); if (auto rec = w.enterSubRecord(nullptr))
info.write(w); {
w.leaveSubRecord(); 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);
}
} }
w.leaveSubVector();
w.leaveSubRecord();
} }
w.leaveSubVector();
} }
size_t binarySize(size_t __isz) const size_t binarySize(size_t __isz) const
{ {
@ -1566,20 +1473,14 @@ struct ChildResourceFactory : BigYAML
void read(athena::io::YAMLDocReader& r) void read(athena::io::YAMLDocReader& r)
{ {
id.clear(); id.clear();
if (r.enterSubRecord("CNST")) if (auto rec = r.enterSubRecord("CNST"))
{
id.read(r); id.read(r);
r.leaveSubRecord();
}
} }
void write(athena::io::YAMLDocWriter& w) const void write(athena::io::YAMLDocWriter& w) const
{ {
if (id) if (id)
{ if (auto rec = w.enterSubRecord("CNST"))
w.enterSubRecord("CNST"); id.write(w);
id.write(w);
w.leaveSubRecord();
}
} }
size_t binarySize(size_t __isz) const size_t binarySize(size_t __isz) const
{ {

View File

@ -16,96 +16,96 @@ void SWSH<IDType>::read(athena::io::YAMLDocReader& r)
continue; continue;
} }
r.enterSubRecord(elem.first.c_str()); if (auto rec = r.enterSubRecord(elem.first.c_str()))
switch(*reinterpret_cast<const uint32_t*>(elem.first.data()))
{ {
case SBIG('PSLT'): switch(*reinterpret_cast<const uint32_t*>(elem.first.data()))
x0_PSLT.read(r); {
break; case SBIG('PSLT'):
case SBIG('TIME'): x0_PSLT.read(r);
x4_TIME.read(r); break;
break; case SBIG('TIME'):
case SBIG('LRAD'): x4_TIME.read(r);
x8_LRAD.read(r); break;
break; case SBIG('LRAD'):
case SBIG('RRAD'): x8_LRAD.read(r);
xc_RRAD.read(r); break;
break; case SBIG('RRAD'):
case SBIG('LENG'): xc_RRAD.read(r);
x10_LENG.read(r); break;
break; case SBIG('LENG'):
case SBIG('COLR'): x10_LENG.read(r);
x14_COLR.read(r); break;
break; case SBIG('COLR'):
case SBIG('SIDE'): x14_COLR.read(r);
x18_SIDE.read(r); break;
break; case SBIG('SIDE'):
case SBIG('IROT'): x18_SIDE.read(r);
x1c_IROT.read(r); break;
break; case SBIG('IROT'):
case SBIG('ROTM'): x1c_IROT.read(r);
x20_ROTM.read(r); break;
break; case SBIG('ROTM'):
case SBIG('POFS'): x20_ROTM.read(r);
x24_POFS.read(r); break;
break; case SBIG('POFS'):
case SBIG('IVEL'): x24_POFS.read(r);
x28_IVEL.read(r); break;
break; case SBIG('IVEL'):
case SBIG('NPOS'): x28_IVEL.read(r);
x2c_NPOS.read(r); break;
break; case SBIG('NPOS'):
case SBIG('VELM'): x2c_NPOS.read(r);
x30_VELM.read(r); break;
break; case SBIG('VELM'):
case SBIG('VLM2'): x30_VELM.read(r);
x34_VLM2.read(r); break;
break; case SBIG('VLM2'):
case SBIG('SPLN'): x34_VLM2.read(r);
x38_SPLN.read(r); break;
break; case SBIG('SPLN'):
case SBIG('TEXR'): x38_SPLN.read(r);
x3c_TEXR.read(r); break;
break; case SBIG('TEXR'):
case SBIG('TSPN'): x3c_TEXR.read(r);
x40_TSPN.read(r); break;
break; case SBIG('TSPN'):
case SBIG('LLRD'): x40_TSPN.read(r);
x44_24_LLRD = r.readBool(nullptr); break;
break; case SBIG('LLRD'):
case SBIG('CROS'): x44_24_LLRD = r.readBool(nullptr);
x44_25_CROS = r.readBool(nullptr); break;
break; case SBIG('CROS'):
case SBIG('VLS1'): x44_25_CROS = r.readBool(nullptr);
x44_26_VLS1 = r.readBool(nullptr); break;
break; case SBIG('VLS1'):
case SBIG('VLS2'): x44_26_VLS1 = r.readBool(nullptr);
x44_27_VLS2 = r.readBool(nullptr); break;
break; case SBIG('VLS2'):
case SBIG('SROT'): x44_27_VLS2 = r.readBool(nullptr);
x44_28_SROT = r.readBool(nullptr); break;
break; case SBIG('SROT'):
case SBIG('WIRE'): x44_28_SROT = r.readBool(nullptr);
x44_29_WIRE = r.readBool(nullptr); break;
break; case SBIG('WIRE'):
case SBIG('TEXW'): x44_29_WIRE = r.readBool(nullptr);
x44_30_TEXW = r.readBool(nullptr); break;
break; case SBIG('TEXW'):
case SBIG('AALP'): x44_30_TEXW = r.readBool(nullptr);
x44_31_AALP = r.readBool(nullptr); break;
break; case SBIG('AALP'):
case SBIG('ZBUF'): x44_31_AALP = r.readBool(nullptr);
x45_24_ZBUF = r.readBool(nullptr); break;
break; case SBIG('ZBUF'):
case SBIG('ORNT'): x45_24_ZBUF = r.readBool(nullptr);
x45_25_ORNT = r.readBool(nullptr); break;
break; case SBIG('ORNT'):
case SBIG('CRND'): x45_25_ORNT = r.readBool(nullptr);
x45_26_CRND = r.readBool(nullptr); break;
break; case SBIG('CRND'):
x45_26_CRND = r.readBool(nullptr);
break;
}
} }
r.leaveSubRecord();
} }
} }
@ -113,107 +113,56 @@ template <class IDType>
void SWSH<IDType>::write(athena::io::YAMLDocWriter& w) const void SWSH<IDType>::write(athena::io::YAMLDocWriter& w) const
{ {
if (x0_PSLT) if (x0_PSLT)
{ if (auto rec = w.enterSubRecord("PSLT"))
w.enterSubRecord("PSLT"); x0_PSLT.write(w);
x0_PSLT.write(w);
w.leaveSubRecord();
}
if (x4_TIME) if (x4_TIME)
{ if (auto rec = w.enterSubRecord("TIME"))
w.enterSubRecord("TIME"); x4_TIME.write(w);
x4_TIME.write(w);
w.leaveSubRecord();
}
if (x8_LRAD) if (x8_LRAD)
{ if (auto rec = w.enterSubRecord("LRAD"))
w.enterSubRecord("LRAD"); x8_LRAD.write(w);
x8_LRAD.write(w);
w.leaveSubRecord();
}
if (xc_RRAD) if (xc_RRAD)
{ if (auto rec = w.enterSubRecord("RRAD"))
w.enterSubRecord("RRAD"); xc_RRAD.write(w);
xc_RRAD.write(w);
w.leaveSubRecord();
}
if (x10_LENG) if (x10_LENG)
{ if (auto rec = w.enterSubRecord("LENG"))
w.enterSubRecord("LENG"); x10_LENG.write(w);
x10_LENG.write(w);
w.leaveSubRecord();
}
if (x14_COLR) if (x14_COLR)
{ if (auto rec = w.enterSubRecord("COLR"))
w.enterSubRecord("COLR"); x14_COLR.write(w);
x14_COLR.write(w);
w.leaveSubRecord();
}
if (x18_SIDE) if (x18_SIDE)
{ if (auto rec = w.enterSubRecord("SIDE"))
w.enterSubRecord("SIDE"); x18_SIDE.write(w);
x18_SIDE.write(w);
w.leaveSubRecord();
}
if (x1c_IROT) if (x1c_IROT)
{ if (auto rec = w.enterSubRecord("IROT"))
w.enterSubRecord("IROT"); x1c_IROT.write(w);
x1c_IROT.write(w);
w.leaveSubRecord();
}
if (x20_ROTM) if (x20_ROTM)
{ if (auto rec = w.enterSubRecord("ROTM"))
w.enterSubRecord("ROTM"); x20_ROTM.write(w);
x20_ROTM.write(w);
w.leaveSubRecord();
}
if (x24_POFS) if (x24_POFS)
{ if (auto rec = w.enterSubRecord("POFS"))
w.enterSubRecord("POFS"); x24_POFS.write(w);
x24_POFS.write(w);
w.leaveSubRecord();
}
if (x28_IVEL) if (x28_IVEL)
{ if (auto rec = w.enterSubRecord("IVEL"))
w.enterSubRecord("IVEL"); x28_IVEL.write(w);
x28_IVEL.write(w);
w.leaveSubRecord();
}
if (x2c_NPOS) if (x2c_NPOS)
{ if (auto rec = w.enterSubRecord("NPOS"))
w.enterSubRecord("NPOS"); x2c_NPOS.write(w);
x2c_NPOS.write(w);
w.leaveSubRecord();
}
if (x30_VELM) if (x30_VELM)
{ if (auto rec = w.enterSubRecord("VELM"))
w.enterSubRecord("VELM"); x30_VELM.write(w);
x30_VELM.write(w);
w.leaveSubRecord();
}
if (x34_VLM2) if (x34_VLM2)
{ if (auto rec = w.enterSubRecord("VLM2"))
w.enterSubRecord("VLM2"); x34_VLM2.write(w);
x34_VLM2.write(w);
w.leaveSubRecord();
}
if (x38_SPLN) if (x38_SPLN)
{ if (auto rec = w.enterSubRecord("SPLN"))
w.enterSubRecord("SPLN"); x38_SPLN.write(w);
x38_SPLN.write(w);
w.leaveSubRecord();
}
if (x3c_TEXR) if (x3c_TEXR)
{ if (auto rec = w.enterSubRecord("TEXR"))
w.enterSubRecord("TEXR"); x3c_TEXR.write(w);
x3c_TEXR.write(w);
w.leaveSubRecord();
}
if (x40_TSPN) if (x40_TSPN)
{ if (auto rec = w.enterSubRecord("TSPN"))
w.enterSubRecord("TSPN"); x40_TSPN.write(w);
x40_TSPN.write(w);
w.leaveSubRecord();
}
if (x44_24_LLRD) if (x44_24_LLRD)
w.writeBool("LLRD", true); w.writeBool("LLRD", true);

View File

@ -16,115 +16,114 @@ void WPSM<IDType>::read(athena::io::YAMLDocReader& r)
continue; continue;
} }
r.enterSubRecord(elem.first.c_str()); if (auto rec = r.enterSubRecord(elem.first.c_str()))
switch (*reinterpret_cast<const uint32_t*>(elem.first.data()))
{ {
case SBIG('IORN'): switch (*reinterpret_cast<const uint32_t*>(elem.first.data()))
x0_IORN.read(r); {
break; case SBIG('IORN'):
case SBIG('IVEC'): x0_IORN.read(r);
x4_IVEC.read(r); break;
break; case SBIG('IVEC'):
case SBIG('PSOV'): x4_IVEC.read(r);
x8_PSOV.read(r); break;
break; case SBIG('PSOV'):
case SBIG('PSVM'): x8_PSOV.read(r);
xc_PSVM.read(r); break;
break; case SBIG('PSVM'):
case SBIG('VMD2'): xc_PSVM.read(r);
x10_VMD2.read(r); break;
break; case SBIG('VMD2'):
case SBIG('PSLT'): x10_VMD2.read(r);
x14_PSLT.read(r); break;
break; case SBIG('PSLT'):
case SBIG('PSCL'): x14_PSLT.read(r);
x18_PSCL.read(r); break;
break; case SBIG('PSCL'):
case SBIG('PCOL'): x18_PSCL.read(r);
x1c_PCOL.read(r); break;
break; case SBIG('PCOL'):
case SBIG('POFS'): x1c_PCOL.read(r);
x20_POFS.read(r); break;
break; case SBIG('POFS'):
case SBIG('OFST'): x20_POFS.read(r);
x24_OFST.read(r); break;
break; case SBIG('OFST'):
case SBIG('APSO'): x24_OFST.read(r);
x28_APSO.read(r); break;
break; case SBIG('APSO'):
case SBIG('HOMG'): x28_APSO.read(r);
x29_HOMG.read(r); break;
break; case SBIG('HOMG'):
case SBIG('AP11'): x29_HOMG.read(r);
x2a_AP11.read(r); break;
break; case SBIG('AP11'):
case SBIG('AP21'): x2a_AP11.read(r);
x2b_AP21.read(r); break;
break; case SBIG('AP21'):
case SBIG('AS11'): x2b_AP21.read(r);
x2c_AS11.read(r); break;
break; case SBIG('AS11'):
case SBIG('AS12'): x2c_AS11.read(r);
x2d_AS12.read(r); break;
break; case SBIG('AS12'):
case SBIG('AS13'): x2d_AS12.read(r);
x2e_AS13.read(r); break;
break; case SBIG('AS13'):
case SBIG('TRAT'): x2e_AS13.read(r);
x30_TRAT.read(r); break;
break; case SBIG('TRAT'):
case SBIG('APSM'): x30_TRAT.read(r);
x34_APSM.read(r); break;
break; case SBIG('APSM'):
case SBIG('APS2'): x34_APSM.read(r);
x44_APS2.read(r); break;
break; case SBIG('APS2'):
case SBIG('ASW1'): x44_APS2.read(r);
x54_ASW1.read(r); break;
break; case SBIG('ASW1'):
case SBIG('ASW2'): x54_ASW1.read(r);
x64_ASW2.read(r); break;
break; case SBIG('ASW2'):
case SBIG('ASW3'): x64_ASW2.read(r);
x74_ASW3.read(r); break;
break; case SBIG('ASW3'):
case SBIG('OHEF'): x74_ASW3.read(r);
x84_OHEF.read(r); break;
break; case SBIG('OHEF'):
case SBIG('COLR'): x84_OHEF.read(r);
x94_COLR.read(r); break;
break; case SBIG('COLR'):
case SBIG('EWTR'): x94_COLR.read(r);
xa4_EWTR.read(r); break;
break; case SBIG('EWTR'):
case SBIG('LWTR'): xa4_EWTR.read(r);
xa5_LWTR.read(r); break;
break; case SBIG('LWTR'):
case SBIG('SWTR'): xa5_LWTR.read(r);
xa6_SWTR.read(r); break;
break; case SBIG('SWTR'):
case SBIG('PJFX'): xa6_SWTR.read(r);
xa8_PJFX = r.readUint32(nullptr); break;
break; case SBIG('PJFX'):
case SBIG('RNGE'): xa8_PJFX = r.readUint32(nullptr);
xac_RNGE.read(r); break;
break; case SBIG('RNGE'):
case SBIG('FOFF'): xac_RNGE.read(r);
xb0_FOFF.read(r); break;
break; case SBIG('FOFF'):
case SBIG('FC60'): xb0_FOFF.read(r);
xunk_FC60.read(r); break;
break; case SBIG('FC60'):
case SBIG('SPS1'): xunk_FC60.read(r);
xunk_SPS2.read(r); break;
break; case SBIG('SPS1'):
case SBIG('SPS2'): xunk_SPS2.read(r);
xunk_SPS2.read(r); break;
break; case SBIG('SPS2'):
xunk_SPS2.read(r);
break;
}
} }
r.leaveSubRecord();
} }
} }
@ -132,205 +131,106 @@ 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"))
w.enterSubRecord("IORN"); x0_IORN.write(w);
x0_IORN.write(w);
w.leaveSubRecord();
}
if (x4_IVEC) if (x4_IVEC)
{ if (auto rec = w.enterSubRecord("IVEC"))
w.enterSubRecord("IVEC"); x4_IVEC.write(w);
x4_IVEC.write(w);
w.leaveSubRecord();
}
if (x8_PSOV) if (x8_PSOV)
{ if (auto rec = w.enterSubRecord("PSOV"))
w.enterSubRecord("PSOV"); x8_PSOV.write(w);
x8_PSOV.write(w);
w.leaveSubRecord();
}
if (xc_PSVM) if (xc_PSVM)
{ if (auto rec = w.enterSubRecord("PSVM"))
w.enterSubRecord("PSVM"); xc_PSVM.write(w);
xc_PSVM.write(w);
w.leaveSubRecord();
}
if (x10_VMD2) if (x10_VMD2)
{ if (auto rec = w.enterSubRecord("VMD2"))
w.enterSubRecord("VMD2"); x10_VMD2.write(w);
x10_VMD2.write(w);
w.leaveSubRecord();
}
if (x14_PSLT) if (x14_PSLT)
{ if (auto rec = w.enterSubRecord("PSLT"))
w.enterSubRecord("PSLT"); x14_PSLT.write(w);
x14_PSLT.write(w);
w.leaveSubRecord();
}
if (x18_PSCL) if (x18_PSCL)
{ if (auto rec = w.enterSubRecord("PSCL"))
w.enterSubRecord("PSCL"); x18_PSCL.write(w);
x18_PSCL.write(w);
w.leaveSubRecord();
}
if (x1c_PCOL) if (x1c_PCOL)
{ if (auto rec = w.enterSubRecord("PCOL"))
w.enterSubRecord("PCOL"); x1c_PCOL.write(w);
x1c_PCOL.write(w);
w.leaveSubRecord();
}
if (x20_POFS) if (x20_POFS)
{ if (auto rec = w.enterSubRecord("POFS"))
w.enterSubRecord("POFS"); x20_POFS.write(w);
x20_POFS.write(w);
w.leaveSubRecord();
}
if (x24_OFST) if (x24_OFST)
{ if (auto rec = w.enterSubRecord("OFST"))
w.enterSubRecord("OFST"); x24_OFST.write(w);
x24_OFST.write(w);
w.leaveSubRecord();
}
if (x28_APSO) if (x28_APSO)
{ if (auto rec = w.enterSubRecord("APSO"))
w.enterSubRecord("APSO"); x28_APSO.write(w);
x28_APSO.write(w);
w.leaveSubRecord();
}
if (x29_HOMG) if (x29_HOMG)
{ if (auto rec = w.enterSubRecord("HOMG"))
w.enterSubRecord("HOMG"); x29_HOMG.write(w);
x29_HOMG.write(w);
w.leaveSubRecord();
}
if (x2a_AP11) if (x2a_AP11)
{ if (auto rec = w.enterSubRecord("AP11"))
w.enterSubRecord("AP11"); x2a_AP11.write(w);
x2a_AP11.write(w);
w.leaveSubRecord();
}
if (x2b_AP21) if (x2b_AP21)
{ if (auto rec = w.enterSubRecord("AP21"))
w.enterSubRecord("AP21"); x2b_AP21.write(w);
x2b_AP21.write(w);
w.leaveSubRecord();
}
if (x2c_AS11) if (x2c_AS11)
{ if (auto rec = w.enterSubRecord("AS11"))
w.enterSubRecord("AS11"); x2c_AS11.write(w);
x2c_AS11.write(w);
w.leaveSubRecord();
}
if (x2d_AS12) if (x2d_AS12)
{ if (auto rec = w.enterSubRecord("AS12"))
w.enterSubRecord("AS12"); x2d_AS12.write(w);
x2d_AS12.write(w);
w.leaveSubRecord();
}
if (x2e_AS13) if (x2e_AS13)
{ if (auto rec = w.enterSubRecord("AS13"))
w.enterSubRecord("AS13"); x2e_AS13.write(w);
x2e_AS13.write(w);
w.leaveSubRecord();
}
if (x30_TRAT) if (x30_TRAT)
{ if (auto rec = w.enterSubRecord("TRAT"))
w.enterSubRecord("TRAT"); x30_TRAT.write(w);
x30_TRAT.write(w);
w.leaveSubRecord();
}
if (x34_APSM) if (x34_APSM)
{ if (auto rec = w.enterSubRecord("APSM"))
w.enterSubRecord("APSM"); x34_APSM.write(w);
x34_APSM.write(w);
w.leaveSubRecord();
}
if (x44_APS2) if (x44_APS2)
{ if (auto rec = w.enterSubRecord("APS2"))
w.enterSubRecord("APS2"); x44_APS2.write(w);
x44_APS2.write(w);
w.leaveSubRecord();
}
if (x54_ASW1) if (x54_ASW1)
{ if (auto rec = w.enterSubRecord("ASW1"))
w.enterSubRecord("ASW1"); x54_ASW1.write(w);
x54_ASW1.write(w);
w.leaveSubRecord();
}
if (x64_ASW2) if (x64_ASW2)
{ if (auto rec = w.enterSubRecord("ASW2"))
w.enterSubRecord("ASW2"); x64_ASW2.write(w);
x64_ASW2.write(w);
w.leaveSubRecord();
}
if (x74_ASW3) if (x74_ASW3)
{ if (auto rec = w.enterSubRecord("ASW3"))
w.enterSubRecord("ASW3"); x74_ASW3.write(w);
x74_ASW3.write(w);
w.leaveSubRecord();
}
if (x84_OHEF) if (x84_OHEF)
{ if (auto rec = w.enterSubRecord("OHEF"))
w.enterSubRecord("OHEF"); x84_OHEF.write(w);
x84_OHEF.write(w);
w.leaveSubRecord();
}
if (x94_COLR) if (x94_COLR)
{ if (auto rec = w.enterSubRecord("COLR"))
w.enterSubRecord("COLR"); x94_COLR.write(w);
x94_COLR.write(w);
w.leaveSubRecord();
}
if (!xa4_EWTR) if (!xa4_EWTR)
{ if (auto rec = w.enterSubRecord("EWTR"))
w.enterSubRecord("EWTR"); xa4_EWTR.write(w);
xa4_EWTR.write(w);
w.leaveSubRecord();
}
if (!xa5_LWTR) if (!xa5_LWTR)
{ if (auto rec = w.enterSubRecord("LWTR"))
w.enterSubRecord("LWTR"); xa5_LWTR.write(w);
xa5_LWTR.write(w);
w.leaveSubRecord();
}
if (!xa6_SWTR) if (!xa6_SWTR)
{ if (auto rec = w.enterSubRecord("SWTR"))
w.enterSubRecord("SWTR"); xa6_SWTR.write(w);
xa6_SWTR.write(w);
w.leaveSubRecord();
}
if (xa8_PJFX != ~0) if (xa8_PJFX != ~0)
w.writeUint32("PJFX", xa8_PJFX); w.writeUint32("PJFX", xa8_PJFX);
if (xac_RNGE) if (xac_RNGE)
{ if (auto rec = w.enterSubRecord("RNGE"))
w.enterSubRecord("RNGE"); xac_RNGE.write(w);
xac_RNGE.write(w);
w.leaveSubRecord();
}
if (xb0_FOFF) if (xb0_FOFF)
{ if (auto rec = w.enterSubRecord("FOFF"))
w.enterSubRecord("FOFF"); xb0_FOFF.write(w);
xb0_FOFF.write(w);
w.leaveSubRecord();
}
if (xunk_FC60) if (xunk_FC60)
{ if (auto rec = w.enterSubRecord("FC60"))
w.enterSubRecord("FC60"); xunk_FC60.write(w);
xunk_FC60.write(w);
w.leaveSubRecord();
}
if (xunk_SPS1) if (xunk_SPS1)
{ if (auto rec = w.enterSubRecord("SPS1"))
w.enterSubRecord("SPS1"); xunk_SPS1.write(w);
xunk_SPS1.write(w);
w.leaveSubRecord();
}
if (xunk_SPS1) if (xunk_SPS1)
{ if (auto rec = w.enterSubRecord("SPS2"))
w.enterSubRecord("SPS2"); xunk_SPS2.write(w);
xunk_SPS2.write(w);
w.leaveSubRecord();
}
} }
template <class IDType> template <class IDType>

View File

@ -86,29 +86,30 @@ void ANCS::CharacterSet::CharacterInfo::PASDatabase::AnimState::ParmInfo::read(a
unk1 = reader.readUint32("unk1"); unk1 = reader.readUint32("unk1");
unk2 = reader.readFloat("unk2"); unk2 = reader.readFloat("unk2");
size_t parmValCount; size_t parmValCount;
reader.enterSubVector("parmVals", parmValCount); if (auto v = reader.enterSubVector("parmVals", parmValCount))
switch (DataType(parmType))
{ {
case DataType::Int32: switch (DataType(parmType))
parmVals[0].int32 = reader.readInt32(nullptr); {
parmVals[1].int32 = reader.readInt32(nullptr); case DataType::Int32:
break; parmVals[0].int32 = reader.readInt32(nullptr);
case DataType::UInt32: parmVals[1].int32 = reader.readInt32(nullptr);
case DataType::Enum: break;
parmVals[0].uint32 = reader.readUint32(nullptr); case DataType::UInt32:
parmVals[1].uint32 = reader.readUint32(nullptr); case DataType::Enum:
break; parmVals[0].uint32 = reader.readUint32(nullptr);
case DataType::Float: parmVals[1].uint32 = reader.readUint32(nullptr);
parmVals[0].float32 = reader.readFloat(nullptr); break;
parmVals[1].float32 = reader.readFloat(nullptr); case DataType::Float:
break; parmVals[0].float32 = reader.readFloat(nullptr);
case DataType::Bool: parmVals[1].float32 = reader.readFloat(nullptr);
parmVals[0].bool1 = reader.readBool(nullptr); break;
parmVals[1].bool1 = reader.readBool(nullptr); case DataType::Bool:
break; parmVals[0].bool1 = reader.readBool(nullptr);
default: break; parmVals[1].bool1 = reader.readBool(nullptr);
break;
default: break;
}
} }
reader.leaveSubVector();
} }
void ANCS::CharacterSet::CharacterInfo::PASDatabase::AnimState::ParmInfo::write(athena::io::YAMLDocWriter& writer) const void ANCS::CharacterSet::CharacterInfo::PASDatabase::AnimState::ParmInfo::write(athena::io::YAMLDocWriter& writer) const
@ -116,28 +117,29 @@ void ANCS::CharacterSet::CharacterInfo::PASDatabase::AnimState::ParmInfo::write(
writer.writeUint32("parmType", parmType); writer.writeUint32("parmType", parmType);
writer.writeUint32("unk1", unk1); writer.writeUint32("unk1", unk1);
writer.writeFloat("unk2", unk2); writer.writeFloat("unk2", unk2);
writer.enterSubVector("parmVals"); if (auto v = writer.enterSubVector("parmVals"))
switch (DataType(parmType))
{ {
case DataType::Int32: switch (DataType(parmType))
writer.writeInt32(nullptr, parmVals[0].int32); {
writer.writeInt32(nullptr, parmVals[1].int32); case DataType::Int32:
break; writer.writeInt32(nullptr, parmVals[0].int32);
case DataType::UInt32: writer.writeInt32(nullptr, parmVals[1].int32);
case DataType::Enum: break;
writer.writeUint32(nullptr, parmVals[0].uint32); case DataType::UInt32:
writer.writeUint32(nullptr, parmVals[0].uint32); case DataType::Enum:
break; writer.writeUint32(nullptr, parmVals[0].uint32);
case DataType::Float: writer.writeUint32(nullptr, parmVals[0].uint32);
writer.writeFloat(nullptr, parmVals[0].float32); break;
writer.writeFloat(nullptr, parmVals[0].float32); case DataType::Float:
break; writer.writeFloat(nullptr, parmVals[0].float32);
case DataType::Bool: writer.writeFloat(nullptr, parmVals[0].float32);
writer.writeBool(nullptr, parmVals[0].bool1); break;
writer.writeBool(nullptr, parmVals[0].bool1); case DataType::Bool:
break; writer.writeBool(nullptr, parmVals[0].bool1);
writer.writeBool(nullptr, parmVals[0].bool1);
break;
}
} }
writer.leaveSubVector();
} }
const char* ANCS::CharacterSet::CharacterInfo::PASDatabase::AnimState::ParmInfo::DNAType() const char* ANCS::CharacterSet::CharacterInfo::PASDatabase::AnimState::ParmInfo::DNAType()
@ -260,28 +262,29 @@ void ANCS::CharacterSet::CharacterInfo::PASDatabase::AnimState::read(athena::io:
ai.id = reader.readUint32("id"); ai.id = reader.readUint32("id");
ai.parmVals.reserve(parmInfoCount); ai.parmVals.reserve(parmInfoCount);
size_t parmValCount; size_t parmValCount;
reader.enterSubVector("parmVals", parmValCount); if (auto v = reader.enterSubVector("parms", parmValCount))
for (const ParmInfo& pi : parmInfos)
{ {
switch (ParmInfo::DataType(pi.parmType)) for (const ParmInfo& pi : parmInfos)
{ {
case ParmInfo::DataType::Int32: switch (ParmInfo::DataType(pi.parmType))
ai.parmVals.emplace_back(reader.readInt32(nullptr)); {
break; case ParmInfo::DataType::Int32:
case ParmInfo::DataType::UInt32: ai.parmVals.emplace_back(reader.readInt32(nullptr));
case ParmInfo::DataType::Enum: break;
ai.parmVals.emplace_back(reader.readUint32(nullptr)); case ParmInfo::DataType::UInt32:
break; case ParmInfo::DataType::Enum:
case ParmInfo::DataType::Float: ai.parmVals.emplace_back(reader.readUint32(nullptr));
ai.parmVals.emplace_back(reader.readFloat(nullptr)); break;
break; case ParmInfo::DataType::Float:
case ParmInfo::DataType::Bool: ai.parmVals.emplace_back(reader.readFloat(nullptr));
ai.parmVals.emplace_back(reader.readBool(nullptr)); break;
break; case ParmInfo::DataType::Bool:
default: break; ai.parmVals.emplace_back(reader.readBool(nullptr));
break;
default: break;
}
} }
} }
reader.leaveSubVector();
}); });
} }
@ -296,31 +299,32 @@ void ANCS::CharacterSet::CharacterInfo::PASDatabase::AnimState::write(athena::io
{ {
writer.writeUint32("id", ai.id); writer.writeUint32("id", ai.id);
auto it = ai.parmVals.begin(); auto it = ai.parmVals.begin();
writer.enterSubVector("parms"); if (auto v = writer.enterSubVector("parms"))
for (const ParmInfo& pi : parmInfos)
{ {
ParmInfo::Parm pVal; for (const ParmInfo& pi : parmInfos)
if (it != ai.parmVals.end())
pVal = *it++;
switch (ParmInfo::DataType(pi.parmType))
{ {
case ParmInfo::DataType::Int32: ParmInfo::Parm pVal;
writer.writeInt32(nullptr, pVal.int32); if (it != ai.parmVals.end())
break; pVal = *it++;
case ParmInfo::DataType::UInt32: switch (ParmInfo::DataType(pi.parmType))
case ParmInfo::DataType::Enum: {
writer.writeUint32(nullptr, pVal.uint32); case ParmInfo::DataType::Int32:
break; writer.writeInt32(nullptr, pVal.int32);
case ParmInfo::DataType::Float: break;
writer.writeFloat(nullptr, pVal.float32); case ParmInfo::DataType::UInt32:
break; case ParmInfo::DataType::Enum:
case ParmInfo::DataType::Bool: writer.writeUint32(nullptr, pVal.uint32);
writer.writeBool(nullptr, pVal.bool1); break;
break; case ParmInfo::DataType::Float:
default: break; writer.writeFloat(nullptr, pVal.float32);
break;
case ParmInfo::DataType::Bool:
writer.writeBool(nullptr, pVal.bool1);
break;
default: break;
}
} }
} }
writer.leaveSubVector();
}); });
} }

View File

@ -499,12 +499,13 @@ struct ANCS : BigYAML
{ {
out.clear(); out.clear();
for (const AnimationSet::Animation& ai : animationSet.animations) for (const AnimationSet::Animation& ai : animationSet.animations)
ai.metaAnim.m_anim->gatherPrimitives(out); if (AnimationSet::IMetaAnim* anim = ai.metaAnim.m_anim.get())
anim->gatherPrimitives(out);
for (const AnimationSet::Transition& ti : animationSet.transitions) for (const AnimationSet::Transition& ti : animationSet.transitions)
if (ti.metaTrans.m_trans) if (AnimationSet::IMetaTrans* trans = ti.metaTrans.m_trans.get())
ti.metaTrans.m_trans->gatherPrimitives(out); trans->gatherPrimitives(out);
if (animationSet.defaultTransition.m_trans) if (AnimationSet::IMetaTrans* trans = animationSet.defaultTransition.m_trans.get())
animationSet.defaultTransition.m_trans->gatherPrimitives(out); trans->gatherPrimitives(out);
for (auto& anim : out) for (auto& anim : out)
{ {
for (const AnimationSet::AnimationResources& res : animationSet.animResources) for (const AnimationSet::AnimationResources& res : animationSet.animResources)
@ -521,10 +522,13 @@ struct ANCS : BigYAML
void enumeratePrimitives(const std::function<bool(AnimationSet::MetaAnimPrimitive& prim)>& func) void enumeratePrimitives(const std::function<bool(AnimationSet::MetaAnimPrimitive& prim)>& func)
{ {
for (const AnimationSet::Animation& ai : animationSet.animations) for (const AnimationSet::Animation& ai : animationSet.animations)
ai.metaAnim.m_anim->enumeratePrimitives(func); if (AnimationSet::IMetaAnim* anim = ai.metaAnim.m_anim.get())
anim->enumeratePrimitives(func);
for (const AnimationSet::Transition& ti : animationSet.transitions) for (const AnimationSet::Transition& ti : animationSet.transitions)
ti.metaTrans.m_trans->enumeratePrimitives(func); if (AnimationSet::IMetaTrans* trans = ti.metaTrans.m_trans.get())
animationSet.defaultTransition.m_trans->enumeratePrimitives(func); trans->enumeratePrimitives(func);
if (AnimationSet::IMetaTrans* trans = animationSet.defaultTransition.m_trans.get())
trans->enumeratePrimitives(func);
} }
static bool Extract(const SpecBase& dataSpec, static bool Extract(const SpecBase& dataSpec,

View File

@ -18,9 +18,8 @@ bool CSNG::Extract(PAKEntryReadStream& rs, const hecl::ProjectPath& outPath)
athena::io::YAMLDocWriter dw("CSNG"); athena::io::YAMLDocWriter dw("CSNG");
dw.writeUint32("midiSetupId", head.midiSetupId); dw.writeUint32("midiSetupId", head.midiSetupId);
dw.writeUint32("songGroupId", head.songGroupId); dw.writeUint32("songGroupId", head.songGroupId);
dw.enterSubRecord("agscId"); if (auto rec = dw.enterSubRecord("agscId"))
head.agscId.write(dw); head.agscId.write(dw);
dw.leaveSubRecord();
athena::io::FileWriter w(yamlPath.getAbsolutePath()); athena::io::FileWriter w(yamlPath.getAbsolutePath());
if (w.hasError()) if (w.hasError())
@ -76,9 +75,8 @@ bool CSNG::Cook(const hecl::ProjectPath& inPath, const hecl::ProjectPath& outPat
Header head; Header head;
head.midiSetupId = dr.readUint32("midiSetupId"); head.midiSetupId = dr.readUint32("midiSetupId");
head.songGroupId = dr.readUint32("songGroupId"); head.songGroupId = dr.readUint32("songGroupId");
dr.enterSubRecord("agscId"); if (auto rec = dr.enterSubRecord("agscId"))
head.agscId.read(dr); head.agscId.read(dr);
dr.leaveSubRecord();
head.sngLength = sngData.size(); head.sngLength = sngData.size();
head.write(w); head.write(w);
} }

View File

@ -143,30 +143,29 @@ void SCLY::ScriptLayer::read(athena::io::YAMLDocReader& rs)
unknown = rs.readUByte("unknown"); unknown = rs.readUByte("unknown");
size_t objCount; size_t objCount;
objects.clear(); objects.clear();
if (rs.enterSubVector("objects", objCount)) if (auto v = rs.enterSubVector("objects", objCount))
{ {
objectCount = objCount; objectCount = objCount;
objects.reserve(objCount); objects.reserve(objCount);
for (atUint32 i = 0; i < objectCount; i++) for (atUint32 i = 0; i < objectCount; i++)
{ {
rs.enterSubRecord(nullptr); if (auto rec = rs.enterSubRecord(nullptr))
atUint8 type = rs.readUByte("type");
auto iter = std::find_if(SCRIPT_OBJECT_DB.begin(), SCRIPT_OBJECT_DB.end(), [&type](const ScriptObjectSpec* obj) -> bool
{ return obj->type == type; });
if (iter != SCRIPT_OBJECT_DB.end())
{ {
std::unique_ptr<IScriptObject> obj((*iter)->a()); atUint8 type = rs.readUByte("type");
obj->read(rs); auto iter = std::find_if(SCRIPT_OBJECT_DB.begin(), SCRIPT_OBJECT_DB.end(), [&type](const ScriptObjectSpec* obj) -> bool
obj->type = type; { return obj->type == type; });
objects.push_back(std::move(obj));
}
else
Log.report(logvisor::Fatal, _S("Unable to find type 0x%X in object database"), (atUint32)type);
rs.leaveSubRecord(); if (iter != SCRIPT_OBJECT_DB.end())
{
std::unique_ptr<IScriptObject> obj((*iter)->a());
obj->read(rs);
obj->type = type;
objects.push_back(std::move(obj));
}
else
Log.report(logvisor::Fatal, _S("Unable to find type 0x%X in object database"), (atUint32)type);
}
} }
rs.leaveSubVector();
} }
else else
objectCount = 0; objectCount = 0;
@ -203,15 +202,17 @@ size_t SCLY::ScriptLayer::binarySize(size_t __isz) const
void SCLY::ScriptLayer::write(athena::io::YAMLDocWriter& ws) const void SCLY::ScriptLayer::write(athena::io::YAMLDocWriter& ws) const
{ {
ws.writeUByte("unknown", unknown); ws.writeUByte("unknown", unknown);
ws.enterSubVector("objects"); if (auto v = ws.enterSubVector("objects"))
for (const std::unique_ptr<IScriptObject>& obj : objects)
{ {
ws.enterSubRecord(nullptr); for (const std::unique_ptr<IScriptObject>& obj : objects)
ws.writeUByte("type", obj->type); {
obj->write(ws); if (auto rec = ws.enterSubRecord(nullptr))
ws.leaveSubRecord(); {
}; ws.writeUByte("type", obj->type);
ws.leaveSubVector(); obj->write(ws);
}
}
}
} }
const char* SCLY::ScriptLayer::DNAType() const char* SCLY::ScriptLayer::DNAType()

View File

@ -562,10 +562,9 @@ void STRG::write(athena::io::YAMLDocWriter& writer) const
{ {
for (const auto& lang : langs) for (const auto& lang : langs)
{ {
writer.enterSubVector(lang.first.toString().c_str()); if (auto v = writer.enterSubVector(lang.first.toString().c_str()))
for (const std::u16string& str : lang.second) for (const std::u16string& str : lang.second)
writer.writeU16String(nullptr, str); writer.writeU16String(nullptr, str);
writer.leaveSubVector();
} }
} }

View File

@ -449,7 +449,8 @@ void CTweakBall::read(athena::io::YAMLDocReader& __dna_docin)
{ {
/* x4_ */ /* x4_ */
size_t __x4_Count; size_t __x4_Count;
__dna_docin.enterSubVector("x4_", __x4_Count); if (auto v = __dna_docin.enterSubVector("x4_", __x4_Count))
{
/* x4_[0] */ /* x4_[0] */
x4_[0] = __dna_docin.readFloat("x4_"); x4_[0] = __dna_docin.readFloat("x4_");
/* x4_[1] */ /* x4_[1] */
@ -466,11 +467,11 @@ void CTweakBall::read(athena::io::YAMLDocReader& __dna_docin)
x4_[6] = __dna_docin.readFloat("x4_"); x4_[6] = __dna_docin.readFloat("x4_");
/* x4_[7] */ /* x4_[7] */
x4_[7] = __dna_docin.readFloat("x4_"); x4_[7] = __dna_docin.readFloat("x4_");
/* */ }
__dna_docin.leaveSubVector();
/* x24_ */ /* x24_ */
size_t __x24_Count; size_t __x24_Count;
__dna_docin.enterSubVector("x24_", __x24_Count); if (auto v = __dna_docin.enterSubVector("x24_", __x24_Count))
{
/* x24_[0] */ /* x24_[0] */
x24_[0] = __dna_docin.readFloat("x24_"); x24_[0] = __dna_docin.readFloat("x24_");
/* x24_[1] */ /* x24_[1] */
@ -487,11 +488,11 @@ void CTweakBall::read(athena::io::YAMLDocReader& __dna_docin)
x24_[6] = __dna_docin.readFloat("x24_"); x24_[6] = __dna_docin.readFloat("x24_");
/* x24_[7] */ /* x24_[7] */
x24_[7] = __dna_docin.readFloat("x24_"); x24_[7] = __dna_docin.readFloat("x24_");
/* */ }
__dna_docin.leaveSubVector();
/* x44_ */ /* x44_ */
size_t __x44_Count; size_t __x44_Count;
__dna_docin.enterSubVector("x44_", __x44_Count); if (auto v = __dna_docin.enterSubVector("x44_", __x44_Count))
{
/* x44_[0] */ /* x44_[0] */
x44_[0] = __dna_docin.readFloat("x44_"); x44_[0] = __dna_docin.readFloat("x44_");
/* x44_[1] */ /* x44_[1] */
@ -508,8 +509,7 @@ void CTweakBall::read(athena::io::YAMLDocReader& __dna_docin)
x44_[6] = __dna_docin.readFloat("x44_"); x44_[6] = __dna_docin.readFloat("x44_");
/* x44_[7] */ /* x44_[7] */
x44_[7] = __dna_docin.readFloat("x44_"); x44_[7] = __dna_docin.readFloat("x44_");
/* */ }
__dna_docin.leaveSubVector();
/* x64_ */ /* x64_ */
x64_ = __dna_docin.readFloat("x64_"); x64_ = __dna_docin.readFloat("x64_");
/* x68_ */ /* x68_ */
@ -520,7 +520,8 @@ void CTweakBall::read(athena::io::YAMLDocReader& __dna_docin)
x70_ = __dna_docin.readFloat("x70_"); x70_ = __dna_docin.readFloat("x70_");
/* xc4_ */ /* xc4_ */
size_t __xc4_Count; size_t __xc4_Count;
__dna_docin.enterSubVector("xc4_", __xc4_Count); if (auto v = __dna_docin.enterSubVector("xc4_", __xc4_Count))
{
/* xc4_[0] */ /* xc4_[0] */
xc4_[0] = __dna_docin.readFloat("xc4_"); xc4_[0] = __dna_docin.readFloat("xc4_");
/* xc4_[1] */ /* xc4_[1] */
@ -537,8 +538,7 @@ void CTweakBall::read(athena::io::YAMLDocReader& __dna_docin)
xc4_[6] = __dna_docin.readFloat("xc4_"); xc4_[6] = __dna_docin.readFloat("xc4_");
/* xc4_[7] */ /* xc4_[7] */
xc4_[7] = __dna_docin.readFloat("xc4_"); xc4_[7] = __dna_docin.readFloat("xc4_");
/* */ }
__dna_docin.leaveSubVector();
/* xe4_ */ /* xe4_ */
xe4_ = __dna_docin.readFloat("xe4_"); xe4_ = __dna_docin.readFloat("xe4_");
/* xe8_ */ /* xe8_ */
@ -688,7 +688,8 @@ void CTweakBall::read(athena::io::YAMLDocReader& __dna_docin)
void CTweakBall::write(athena::io::YAMLDocWriter& __dna_docout) const void CTweakBall::write(athena::io::YAMLDocWriter& __dna_docout) const
{ {
/* x4_ */ /* x4_ */
__dna_docout.enterSubVector("x4_"); if (auto v = __dna_docout.enterSubVector("x4_"))
{
/* x4_[0] */ /* x4_[0] */
__dna_docout.writeFloat("x4_", x4_[0]); __dna_docout.writeFloat("x4_", x4_[0]);
/* x4_[1] */ /* x4_[1] */
@ -705,10 +706,10 @@ void CTweakBall::write(athena::io::YAMLDocWriter& __dna_docout) const
__dna_docout.writeFloat("x4_", x4_[6]); __dna_docout.writeFloat("x4_", x4_[6]);
/* x4_[7] */ /* x4_[7] */
__dna_docout.writeFloat("x4_", x4_[7]); __dna_docout.writeFloat("x4_", x4_[7]);
/* */ }
__dna_docout.leaveSubVector();
/* x24_ */ /* x24_ */
__dna_docout.enterSubVector("x24_"); if (auto v = __dna_docout.enterSubVector("x24_"))
{
/* x24_[0] */ /* x24_[0] */
__dna_docout.writeFloat("x24_", x24_[0]); __dna_docout.writeFloat("x24_", x24_[0]);
/* x24_[1] */ /* x24_[1] */
@ -725,10 +726,10 @@ void CTweakBall::write(athena::io::YAMLDocWriter& __dna_docout) const
__dna_docout.writeFloat("x24_", x24_[6]); __dna_docout.writeFloat("x24_", x24_[6]);
/* x24_[7] */ /* x24_[7] */
__dna_docout.writeFloat("x24_", x24_[7]); __dna_docout.writeFloat("x24_", x24_[7]);
/* */ }
__dna_docout.leaveSubVector();
/* x44_ */ /* x44_ */
__dna_docout.enterSubVector("x44_"); if (auto v = __dna_docout.enterSubVector("x44_"))
{
/* x44_[0] */ /* x44_[0] */
__dna_docout.writeFloat("x44_", x44_[0]); __dna_docout.writeFloat("x44_", x44_[0]);
/* x44_[1] */ /* x44_[1] */
@ -745,8 +746,7 @@ void CTweakBall::write(athena::io::YAMLDocWriter& __dna_docout) const
__dna_docout.writeFloat("x44_", x44_[6]); __dna_docout.writeFloat("x44_", x44_[6]);
/* x44_[7] */ /* x44_[7] */
__dna_docout.writeFloat("x44_", x44_[7]); __dna_docout.writeFloat("x44_", x44_[7]);
/* */ }
__dna_docout.leaveSubVector();
/* x64_ */ /* x64_ */
__dna_docout.writeFloat("x64_", x64_); __dna_docout.writeFloat("x64_", x64_);
/* x68_ */ /* x68_ */
@ -756,7 +756,8 @@ void CTweakBall::write(athena::io::YAMLDocWriter& __dna_docout) const
/* x70_ */ /* x70_ */
__dna_docout.writeFloat("x70_", x70_); __dna_docout.writeFloat("x70_", x70_);
/* xc4_ */ /* xc4_ */
__dna_docout.enterSubVector("xc4_"); if (auto v = __dna_docout.enterSubVector("xc4_"))
{
/* xc4_[0] */ /* xc4_[0] */
__dna_docout.writeFloat("xc4_", xc4_[0]); __dna_docout.writeFloat("xc4_", xc4_[0]);
/* xc4_[1] */ /* xc4_[1] */
@ -773,8 +774,7 @@ void CTweakBall::write(athena::io::YAMLDocWriter& __dna_docout) const
__dna_docout.writeFloat("xc4_", xc4_[6]); __dna_docout.writeFloat("xc4_", xc4_[6]);
/* xc4_[7] */ /* xc4_[7] */
__dna_docout.writeFloat("xc4_", xc4_[7]); __dna_docout.writeFloat("xc4_", xc4_[7]);
/* */ }
__dna_docout.leaveSubVector();
/* xe4_ */ /* xe4_ */
__dna_docout.writeFloat("xe4_", xe4_); __dna_docout.writeFloat("xe4_", xe4_);
/* xe8_ */ /* xe8_ */

View File

@ -889,7 +889,8 @@ void CTweakPlayer::read(athena::io::YAMLDocReader& __dna_docin)
{ {
/* x4_ */ /* x4_ */
size_t __x4_Count; size_t __x4_Count;
__dna_docin.enterSubVector("x4_", __x4_Count); if (auto v = __dna_docin.enterSubVector("x4_", __x4_Count))
{
/* x4_[0] */ /* x4_[0] */
x4_[0] = __dna_docin.readFloat("x4_"); x4_[0] = __dna_docin.readFloat("x4_");
/* x4_[1] */ /* x4_[1] */
@ -906,11 +907,11 @@ void CTweakPlayer::read(athena::io::YAMLDocReader& __dna_docin)
x4_[6] = __dna_docin.readFloat("x4_"); x4_[6] = __dna_docin.readFloat("x4_");
/* x4_[7] */ /* x4_[7] */
x4_[7] = __dna_docin.readFloat("x4_"); x4_[7] = __dna_docin.readFloat("x4_");
/* */ }
__dna_docin.leaveSubVector();
/* x24_ */ /* x24_ */
size_t __x24_Count; size_t __x24_Count;
__dna_docin.enterSubVector("x24_", __x24_Count); if (auto v = __dna_docin.enterSubVector("x24_", __x24_Count))
{
/* x24_[0] */ /* x24_[0] */
x24_[0] = __dna_docin.readFloat("x24_"); x24_[0] = __dna_docin.readFloat("x24_");
/* x24_[1] */ /* x24_[1] */
@ -927,11 +928,11 @@ void CTweakPlayer::read(athena::io::YAMLDocReader& __dna_docin)
x24_[6] = __dna_docin.readFloat("x24_"); x24_[6] = __dna_docin.readFloat("x24_");
/* x24_[7] */ /* x24_[7] */
x24_[7] = __dna_docin.readFloat("x24_"); x24_[7] = __dna_docin.readFloat("x24_");
/* */ }
__dna_docin.leaveSubVector();
/* x44_ */ /* x44_ */
size_t __x44_Count; size_t __x44_Count;
__dna_docin.enterSubVector("x44_", __x44_Count); if (auto v = __dna_docin.enterSubVector("x44_", __x44_Count))
{
/* x44_[0] */ /* x44_[0] */
x44_[0] = __dna_docin.readFloat("x44_"); x44_[0] = __dna_docin.readFloat("x44_");
/* x44_[1] */ /* x44_[1] */
@ -948,11 +949,11 @@ void CTweakPlayer::read(athena::io::YAMLDocReader& __dna_docin)
x44_[6] = __dna_docin.readFloat("x44_"); x44_[6] = __dna_docin.readFloat("x44_");
/* x44_[7] */ /* x44_[7] */
x44_[7] = __dna_docin.readFloat("x44_"); x44_[7] = __dna_docin.readFloat("x44_");
/* */ }
__dna_docin.leaveSubVector();
/* x64_ */ /* x64_ */
size_t __x64_Count; size_t __x64_Count;
__dna_docin.enterSubVector("x64_", __x64_Count); if (auto v = __dna_docin.enterSubVector("x64_", __x64_Count))
{
/* x64_[0] */ /* x64_[0] */
x64_[0] = __dna_docin.readFloat("x64_"); x64_[0] = __dna_docin.readFloat("x64_");
/* x64_[1] */ /* x64_[1] */
@ -969,11 +970,11 @@ void CTweakPlayer::read(athena::io::YAMLDocReader& __dna_docin)
x64_[6] = __dna_docin.readFloat("x64_"); x64_[6] = __dna_docin.readFloat("x64_");
/* x64_[7] */ /* x64_[7] */
x64_[7] = __dna_docin.readFloat("x64_"); x64_[7] = __dna_docin.readFloat("x64_");
/* */ }
__dna_docin.leaveSubVector();
/* x84_ */ /* x84_ */
size_t __x84_Count; size_t __x84_Count;
__dna_docin.enterSubVector("x84_", __x84_Count); if (auto v = __dna_docin.enterSubVector("x84_", __x84_Count))
{
/* x84_[0] */ /* x84_[0] */
x84_[0] = __dna_docin.readFloat("x84_"); x84_[0] = __dna_docin.readFloat("x84_");
/* x84_[1] */ /* x84_[1] */
@ -990,11 +991,11 @@ void CTweakPlayer::read(athena::io::YAMLDocReader& __dna_docin)
x84_[6] = __dna_docin.readFloat("x84_"); x84_[6] = __dna_docin.readFloat("x84_");
/* x84_[7] */ /* x84_[7] */
x84_[7] = __dna_docin.readFloat("x84_"); x84_[7] = __dna_docin.readFloat("x84_");
/* */ }
__dna_docin.leaveSubVector();
/* xa4_ */ /* xa4_ */
size_t __xa4_Count; size_t __xa4_Count;
__dna_docin.enterSubVector("xa4_", __xa4_Count); if (auto v = __dna_docin.enterSubVector("xa4_", __xa4_Count))
{
/* xa4_[0] */ /* xa4_[0] */
xa4_[0] = __dna_docin.readFloat("xa4_"); xa4_[0] = __dna_docin.readFloat("xa4_");
/* xa4_[1] */ /* xa4_[1] */
@ -1011,8 +1012,7 @@ void CTweakPlayer::read(athena::io::YAMLDocReader& __dna_docin)
xa4_[6] = __dna_docin.readFloat("xa4_"); xa4_[6] = __dna_docin.readFloat("xa4_");
/* xa4_[7] */ /* xa4_[7] */
xa4_[7] = __dna_docin.readFloat("xa4_"); xa4_[7] = __dna_docin.readFloat("xa4_");
/* */ }
__dna_docin.leaveSubVector();
/* xc4_ */ /* xc4_ */
xc4_ = __dna_docin.readFloat("xc4_"); xc4_ = __dna_docin.readFloat("xc4_");
/* xc8_ */ /* xc8_ */
@ -1163,37 +1163,37 @@ void CTweakPlayer::read(athena::io::YAMLDocReader& __dna_docin)
x268_ = __dna_docin.readFloat("x268_"); x268_ = __dna_docin.readFloat("x268_");
/* x158_ */ /* x158_ */
size_t __x158_Count; size_t __x158_Count;
__dna_docin.enterSubVector("x158_", __x158_Count); if (auto v = __dna_docin.enterSubVector("x158_", __x158_Count))
{
/* x158_[0] */ /* x158_[0] */
x158_[0] = __dna_docin.readFloat("x158_"); x158_[0] = __dna_docin.readFloat("x158_");
/* x158_[1] */ /* x158_[1] */
x158_[1] = __dna_docin.readFloat("x158_"); x158_[1] = __dna_docin.readFloat("x158_");
/* x158_[2] */ /* x158_[2] */
x158_[2] = __dna_docin.readFloat("x158_"); x158_[2] = __dna_docin.readFloat("x158_");
/* */ }
__dna_docin.leaveSubVector();
/* x164_ */ /* x164_ */
size_t __x164_Count; size_t __x164_Count;
__dna_docin.enterSubVector("x164_", __x164_Count); if (auto v = __dna_docin.enterSubVector("x164_", __x164_Count))
{
/* x164_[0] */ /* x164_[0] */
x164_[0] = __dna_docin.readFloat("x164_"); x164_[0] = __dna_docin.readFloat("x164_");
/* x164_[1] */ /* x164_[1] */
x164_[1] = __dna_docin.readFloat("x164_"); x164_[1] = __dna_docin.readFloat("x164_");
/* x164_[2] */ /* x164_[2] */
x164_[2] = __dna_docin.readFloat("x164_"); x164_[2] = __dna_docin.readFloat("x164_");
/* */ }
__dna_docin.leaveSubVector();
/* x170_ */ /* x170_ */
size_t __x170_Count; size_t __x170_Count;
__dna_docin.enterSubVector("x170_", __x170_Count); if (auto v = __dna_docin.enterSubVector("x170_", __x170_Count))
{
/* x170_[0] */ /* x170_[0] */
x170_[0] = __dna_docin.readFloat("x170_"); x170_[0] = __dna_docin.readFloat("x170_");
/* x170_[1] */ /* x170_[1] */
x170_[1] = __dna_docin.readFloat("x170_"); x170_[1] = __dna_docin.readFloat("x170_");
/* x170_[2] */ /* x170_[2] */
x170_[2] = __dna_docin.readFloat("x170_"); x170_[2] = __dna_docin.readFloat("x170_");
/* */ }
__dna_docin.leaveSubVector();
/* x17c_ */ /* x17c_ */
x17c_ = __dna_docin.readFloat("x17c_"); x17c_ = __dna_docin.readFloat("x17c_");
/* x180_ */ /* x180_ */
@ -1218,58 +1218,58 @@ void CTweakPlayer::read(athena::io::YAMLDocReader& __dna_docin)
x1a4_ = __dna_docin.readFloat("x1a4_"); x1a4_ = __dna_docin.readFloat("x1a4_");
/* x1a8_ */ /* x1a8_ */
size_t __x1a8_Count; size_t __x1a8_Count;
__dna_docin.enterSubVector("x1a8_", __x1a8_Count); if (auto v = __dna_docin.enterSubVector("x1a8_", __x1a8_Count))
{
/* x1a8_[0] */ /* x1a8_[0] */
x1a8_[0] = __dna_docin.readUint32("x1a8_"); x1a8_[0] = __dna_docin.readUint32("x1a8_");
/* x1a8_[1] */ /* x1a8_[1] */
x1a8_[1] = __dna_docin.readUint32("x1a8_"); x1a8_[1] = __dna_docin.readUint32("x1a8_");
/* */ }
__dna_docin.leaveSubVector();
/* x1b0_ */ /* x1b0_ */
size_t __x1b0_Count; size_t __x1b0_Count;
__dna_docin.enterSubVector("x1b0_", __x1b0_Count); if (auto v = __dna_docin.enterSubVector("x1b0_", __x1b0_Count))
{
/* x1b0_[0] */ /* x1b0_[0] */
x1b0_[0] = __dna_docin.readUint32("x1b0_"); x1b0_[0] = __dna_docin.readUint32("x1b0_");
/* x1b0_[1] */ /* x1b0_[1] */
x1b0_[1] = __dna_docin.readUint32("x1b0_"); x1b0_[1] = __dna_docin.readUint32("x1b0_");
/* */ }
__dna_docin.leaveSubVector();
/* x1b8_ */ /* x1b8_ */
size_t __x1b8_Count; size_t __x1b8_Count;
__dna_docin.enterSubVector("x1b8_", __x1b8_Count); if (auto v = __dna_docin.enterSubVector("x1b8_", __x1b8_Count))
{
/* x1b8_[0] */ /* x1b8_[0] */
x1b8_[0] = __dna_docin.readUint32("x1b8_"); x1b8_[0] = __dna_docin.readUint32("x1b8_");
/* x1b8_[1] */ /* x1b8_[1] */
x1b8_[1] = __dna_docin.readUint32("x1b8_"); x1b8_[1] = __dna_docin.readUint32("x1b8_");
/* */ }
__dna_docin.leaveSubVector();
/* x1c0_ */ /* x1c0_ */
size_t __x1c0_Count; size_t __x1c0_Count;
__dna_docin.enterSubVector("x1c0_", __x1c0_Count); if (auto v = __dna_docin.enterSubVector("x1c0_", __x1c0_Count))
{
/* x1c0_[0] */ /* x1c0_[0] */
x1c0_[0] = __dna_docin.readUint32("x1c0_"); x1c0_[0] = __dna_docin.readUint32("x1c0_");
/* x1c0_[1] */ /* x1c0_[1] */
x1c0_[1] = __dna_docin.readUint32("x1c0_"); x1c0_[1] = __dna_docin.readUint32("x1c0_");
/* */ }
__dna_docin.leaveSubVector();
/* x1c8_ */ /* x1c8_ */
size_t __x1c8_Count; size_t __x1c8_Count;
__dna_docin.enterSubVector("x1c8_", __x1c8_Count); if (auto v = __dna_docin.enterSubVector("x1c8_", __x1c8_Count))
{
/* x1c8_[0] */ /* x1c8_[0] */
x1c8_[0] = __dna_docin.readUint32("x1c8_"); x1c8_[0] = __dna_docin.readUint32("x1c8_");
/* x1c8_[1] */ /* x1c8_[1] */
x1c8_[1] = __dna_docin.readUint32("x1c8_"); x1c8_[1] = __dna_docin.readUint32("x1c8_");
/* */ }
__dna_docin.leaveSubVector();
/* x1d0_ */ /* x1d0_ */
size_t __x1d0_Count; size_t __x1d0_Count;
__dna_docin.enterSubVector("x1d0_", __x1d0_Count); if (auto v = __dna_docin.enterSubVector("x1d0_", __x1d0_Count))
{
/* x1d0_[0] */ /* x1d0_[0] */
x1d0_[0] = __dna_docin.readUint32("x1d0_"); x1d0_[0] = __dna_docin.readUint32("x1d0_");
/* x1d0_[1] */ /* x1d0_[1] */
x1d0_[1] = __dna_docin.readUint32("x1d0_"); x1d0_[1] = __dna_docin.readUint32("x1d0_");
/* */ }
__dna_docin.leaveSubVector();
/* x1d8_ */ /* x1d8_ */
x1d8_ = __dna_docin.readFloat("x1d8_"); x1d8_ = __dna_docin.readFloat("x1d8_");
/* x1dc_ */ /* x1dc_ */
@ -1403,7 +1403,8 @@ void CTweakPlayer::read(athena::io::YAMLDocReader& __dna_docin)
void CTweakPlayer::CTweakPlayer::write(athena::io::YAMLDocWriter& __dna_docout) const void CTweakPlayer::CTweakPlayer::write(athena::io::YAMLDocWriter& __dna_docout) const
{ {
/* x4_ */ /* x4_ */
__dna_docout.enterSubVector("x4_"); if (auto v = __dna_docout.enterSubVector("x4_"))
{
/* x4_[0] */ /* x4_[0] */
__dna_docout.writeFloat("x4_", x4_[0]); __dna_docout.writeFloat("x4_", x4_[0]);
/* x4_[1] */ /* x4_[1] */
@ -1420,10 +1421,10 @@ void CTweakPlayer::CTweakPlayer::write(athena::io::YAMLDocWriter& __dna_docout)
__dna_docout.writeFloat("x4_", x4_[6]); __dna_docout.writeFloat("x4_", x4_[6]);
/* x4_[7] */ /* x4_[7] */
__dna_docout.writeFloat("x4_", x4_[7]); __dna_docout.writeFloat("x4_", x4_[7]);
/* */ }
__dna_docout.leaveSubVector();
/* x24_ */ /* x24_ */
__dna_docout.enterSubVector("x24_"); if (auto v = __dna_docout.enterSubVector("x24_"))
{
/* x24_[0] */ /* x24_[0] */
__dna_docout.writeFloat("x24_", x24_[0]); __dna_docout.writeFloat("x24_", x24_[0]);
/* x24_[1] */ /* x24_[1] */
@ -1440,10 +1441,10 @@ void CTweakPlayer::CTweakPlayer::write(athena::io::YAMLDocWriter& __dna_docout)
__dna_docout.writeFloat("x24_", x24_[6]); __dna_docout.writeFloat("x24_", x24_[6]);
/* x24_[7] */ /* x24_[7] */
__dna_docout.writeFloat("x24_", x24_[7]); __dna_docout.writeFloat("x24_", x24_[7]);
/* */ }
__dna_docout.leaveSubVector();
/* x44_ */ /* x44_ */
__dna_docout.enterSubVector("x44_"); if (auto v = __dna_docout.enterSubVector("x44_"))
{
/* x44_[0] */ /* x44_[0] */
__dna_docout.writeFloat("x44_", x44_[0]); __dna_docout.writeFloat("x44_", x44_[0]);
/* x44_[1] */ /* x44_[1] */
@ -1460,10 +1461,10 @@ void CTweakPlayer::CTweakPlayer::write(athena::io::YAMLDocWriter& __dna_docout)
__dna_docout.writeFloat("x44_", x44_[6]); __dna_docout.writeFloat("x44_", x44_[6]);
/* x44_[7] */ /* x44_[7] */
__dna_docout.writeFloat("x44_", x44_[7]); __dna_docout.writeFloat("x44_", x44_[7]);
/* */ }
__dna_docout.leaveSubVector();
/* x64_ */ /* x64_ */
__dna_docout.enterSubVector("x64_"); if (auto v = __dna_docout.enterSubVector("x64_"))
{
/* x64_[0] */ /* x64_[0] */
__dna_docout.writeFloat("x64_", x64_[0]); __dna_docout.writeFloat("x64_", x64_[0]);
/* x64_[1] */ /* x64_[1] */
@ -1480,10 +1481,10 @@ void CTweakPlayer::CTweakPlayer::write(athena::io::YAMLDocWriter& __dna_docout)
__dna_docout.writeFloat("x64_", x64_[6]); __dna_docout.writeFloat("x64_", x64_[6]);
/* x64_[7] */ /* x64_[7] */
__dna_docout.writeFloat("x64_", x64_[7]); __dna_docout.writeFloat("x64_", x64_[7]);
/* */ }
__dna_docout.leaveSubVector();
/* x84_ */ /* x84_ */
__dna_docout.enterSubVector("x84_"); if (auto v = __dna_docout.enterSubVector("x84_"))
{
/* x84_[0] */ /* x84_[0] */
__dna_docout.writeFloat("x84_", x84_[0]); __dna_docout.writeFloat("x84_", x84_[0]);
/* x84_[1] */ /* x84_[1] */
@ -1500,10 +1501,10 @@ void CTweakPlayer::CTweakPlayer::write(athena::io::YAMLDocWriter& __dna_docout)
__dna_docout.writeFloat("x84_", x84_[6]); __dna_docout.writeFloat("x84_", x84_[6]);
/* x84_[7] */ /* x84_[7] */
__dna_docout.writeFloat("x84_", x84_[7]); __dna_docout.writeFloat("x84_", x84_[7]);
/* */ }
__dna_docout.leaveSubVector();
/* xa4_ */ /* xa4_ */
__dna_docout.enterSubVector("xa4_"); if (auto v = __dna_docout.enterSubVector("xa4_"))
{
/* xa4_[0] */ /* xa4_[0] */
__dna_docout.writeFloat("xa4_", xa4_[0]); __dna_docout.writeFloat("xa4_", xa4_[0]);
/* xa4_[1] */ /* xa4_[1] */
@ -1520,8 +1521,7 @@ void CTweakPlayer::CTweakPlayer::write(athena::io::YAMLDocWriter& __dna_docout)
__dna_docout.writeFloat("xa4_", xa4_[6]); __dna_docout.writeFloat("xa4_", xa4_[6]);
/* xa4_[7] */ /* xa4_[7] */
__dna_docout.writeFloat("xa4_", xa4_[7]); __dna_docout.writeFloat("xa4_", xa4_[7]);
/* */ }
__dna_docout.leaveSubVector();
/* xc4_ */ /* xc4_ */
__dna_docout.writeFloat("xc4_", xc4_); __dna_docout.writeFloat("xc4_", xc4_);
/* xc8_ */ /* xc8_ */
@ -1671,35 +1671,35 @@ void CTweakPlayer::CTweakPlayer::write(athena::io::YAMLDocWriter& __dna_docout)
/* x268_ */ /* x268_ */
__dna_docout.writeFloat("x268_", x268_); __dna_docout.writeFloat("x268_", x268_);
/* x158_ */ /* x158_ */
__dna_docout.enterSubVector("x158_"); if (auto v = __dna_docout.enterSubVector("x158_"))
{
/* x158_[0] */ /* x158_[0] */
__dna_docout.writeFloat("x158_", x158_[0]); __dna_docout.writeFloat("x158_", x158_[0]);
/* x158_[1] */ /* x158_[1] */
__dna_docout.writeFloat("x158_", x158_[1]); __dna_docout.writeFloat("x158_", x158_[1]);
/* x158_[2] */ /* x158_[2] */
__dna_docout.writeFloat("x158_", x158_[2]); __dna_docout.writeFloat("x158_", x158_[2]);
/* */ }
__dna_docout.leaveSubVector();
/* x164_ */ /* x164_ */
__dna_docout.enterSubVector("x164_"); if (auto v = __dna_docout.enterSubVector("x164_"))
{
/* x164_[0] */ /* x164_[0] */
__dna_docout.writeFloat("x164_", x164_[0]); __dna_docout.writeFloat("x164_", x164_[0]);
/* x164_[1] */ /* x164_[1] */
__dna_docout.writeFloat("x164_", x164_[1]); __dna_docout.writeFloat("x164_", x164_[1]);
/* x164_[2] */ /* x164_[2] */
__dna_docout.writeFloat("x164_", x164_[2]); __dna_docout.writeFloat("x164_", x164_[2]);
/* */ }
__dna_docout.leaveSubVector();
/* x170_ */ /* x170_ */
__dna_docout.enterSubVector("x170_"); if (auto v = __dna_docout.enterSubVector("x170_"))
{
/* x170_[0] */ /* x170_[0] */
__dna_docout.writeFloat("x170_", x170_[0]); __dna_docout.writeFloat("x170_", x170_[0]);
/* x170_[1] */ /* x170_[1] */
__dna_docout.writeFloat("x170_", x170_[1]); __dna_docout.writeFloat("x170_", x170_[1]);
/* x170_[2] */ /* x170_[2] */
__dna_docout.writeFloat("x170_", x170_[2]); __dna_docout.writeFloat("x170_", x170_[2]);
/* */ }
__dna_docout.leaveSubVector();
/* x17c_ */ /* x17c_ */
__dna_docout.writeFloat("x17c_", x17c_); __dna_docout.writeFloat("x17c_", x17c_);
/* x180_ */ /* x180_ */
@ -1723,53 +1723,53 @@ void CTweakPlayer::CTweakPlayer::write(athena::io::YAMLDocWriter& __dna_docout)
/* x1a4_ */ /* x1a4_ */
__dna_docout.writeFloat("x1a4_", x1a4_); __dna_docout.writeFloat("x1a4_", x1a4_);
/* x1a8_ */ /* x1a8_ */
__dna_docout.enterSubVector("x1a8_"); if (auto v = __dna_docout.enterSubVector("x1a8_"))
{
/* x1a8_[0] */ /* x1a8_[0] */
__dna_docout.writeUint32("x1a8_", x1a8_[0]); __dna_docout.writeUint32("x1a8_", x1a8_[0]);
/* x1a8_[1] */ /* x1a8_[1] */
__dna_docout.writeUint32("x1a8_", x1a8_[1]); __dna_docout.writeUint32("x1a8_", x1a8_[1]);
/* */ }
__dna_docout.leaveSubVector();
/* x1b0_ */ /* x1b0_ */
__dna_docout.enterSubVector("x1b0_"); if (auto v = __dna_docout.enterSubVector("x1b0_"))
{
/* x1b0_[0] */ /* x1b0_[0] */
__dna_docout.writeUint32("x1b0_", x1b0_[0]); __dna_docout.writeUint32("x1b0_", x1b0_[0]);
/* x1b0_[1] */ /* x1b0_[1] */
__dna_docout.writeUint32("x1b0_", x1b0_[1]); __dna_docout.writeUint32("x1b0_", x1b0_[1]);
/* */ }
__dna_docout.leaveSubVector();
/* x1b8_ */ /* x1b8_ */
__dna_docout.enterSubVector("x1b8_"); if (auto v = __dna_docout.enterSubVector("x1b8_"))
{
/* x1b8_[0] */ /* x1b8_[0] */
__dna_docout.writeUint32("x1b8_", x1b8_[0]); __dna_docout.writeUint32("x1b8_", x1b8_[0]);
/* x1b8_[1] */ /* x1b8_[1] */
__dna_docout.writeUint32("x1b8_", x1b8_[1]); __dna_docout.writeUint32("x1b8_", x1b8_[1]);
/* */ }
__dna_docout.leaveSubVector();
/* x1c0_ */ /* x1c0_ */
__dna_docout.enterSubVector("x1c0_"); if (auto v = __dna_docout.enterSubVector("x1c0_"))
{
/* x1c0_[0] */ /* x1c0_[0] */
__dna_docout.writeUint32("x1c0_", x1c0_[0]); __dna_docout.writeUint32("x1c0_", x1c0_[0]);
/* x1c0_[1] */ /* x1c0_[1] */
__dna_docout.writeUint32("x1c0_", x1c0_[1]); __dna_docout.writeUint32("x1c0_", x1c0_[1]);
/* */ }
__dna_docout.leaveSubVector();
/* x1c8_ */ /* x1c8_ */
__dna_docout.enterSubVector("x1c8_"); if (auto v = __dna_docout.enterSubVector("x1c8_"))
{
/* x1c8_[0] */ /* x1c8_[0] */
__dna_docout.writeUint32("x1c8_", x1c8_[0]); __dna_docout.writeUint32("x1c8_", x1c8_[0]);
/* x1c8_[1] */ /* x1c8_[1] */
__dna_docout.writeUint32("x1c8_", x1c8_[1]); __dna_docout.writeUint32("x1c8_", x1c8_[1]);
/* */ }
__dna_docout.leaveSubVector();
/* x1d0_ */ /* x1d0_ */
__dna_docout.enterSubVector("x1d0_"); if (auto v = __dna_docout.enterSubVector("x1d0_"))
{
/* x1d0_[0] */ /* x1d0_[0] */
__dna_docout.writeUint32("x1d0_", x1d0_[0]); __dna_docout.writeUint32("x1d0_", x1d0_[0]);
/* x1d0_[1] */ /* x1d0_[1] */
__dna_docout.writeUint32("x1d0_", x1d0_[1]); __dna_docout.writeUint32("x1d0_", x1d0_[1]);
/* */ }
__dna_docout.leaveSubVector();
/* x1d8_ */ /* x1d8_ */
__dna_docout.writeFloat("x1d8_", x1d8_); __dna_docout.writeFloat("x1d8_", x1d8_);
/* x1dc_ */ /* x1dc_ */

View File

@ -229,21 +229,16 @@ void STRG::write(athena::io::YAMLDocWriter& writer) const
{ {
for (const auto& lang : langs) for (const auto& lang : langs)
{ {
writer.enterSubVector(lang.first.toString().c_str()); if (auto v = writer.enterSubVector(lang.first.toString().c_str()))
for (const std::u16string& str : lang.second) for (const std::u16string& str : lang.second)
writer.writeU16String(nullptr, str); writer.writeU16String(nullptr, str);
writer.leaveSubVector();
} }
if (names.size()) if (names.size())
{ {
writer.enterSubRecord("names"); if (auto rec = writer.enterSubRecord("names"))
for (const auto& name : names) for (const auto& name : names)
{ if (auto rec = writer.enterSubRecord(name.first.c_str()))
writer.enterSubRecord(name.first.c_str()); writer.writeInt32(nullptr, name.second);
writer.writeInt32(nullptr, name.second);
writer.leaveSubRecord();
}
writer.leaveSubRecord();
} }
} }

View File

@ -247,22 +247,17 @@ void STRG::write(athena::io::YAMLDocWriter& writer) const
{ {
for (const auto& item : langs) for (const auto& item : langs)
{ {
writer.enterSubVector(item.first.toString().c_str()); if (auto v = writer.enterSubVector(item.first.toString().c_str()))
for (const std::string& str : item.second) for (const std::string& str : item.second)
writer.writeString(nullptr, str); writer.writeString(nullptr, str);
writer.leaveSubVector();
} }
if (names.size()) if (names.size())
{ {
writer.enterSubRecord("names"); if (auto rec = writer.enterSubRecord("names"))
for (const auto& item : names) for (const auto& item : names)
{ if (auto rec = writer.enterSubRecord(item.first.c_str()))
writer.enterSubRecord(item.first.c_str()); writer.writeInt32(nullptr, item.second);
writer.writeInt32(nullptr, item.second);
writer.leaveSubRecord();
}
writer.leaveSubRecord();
} }
} }

View File

@ -676,6 +676,15 @@ struct SpecMP1 : SpecBase
void cookActor(const hecl::ProjectPath& out, const hecl::ProjectPath& in, BlendStream& ds, bool fast, void cookActor(const hecl::ProjectPath& out, const hecl::ProjectPath& in, BlendStream& ds, bool fast,
hecl::BlenderToken& btok, FCookProgress progress) hecl::BlenderToken& btok, FCookProgress progress)
{ {
/*
if (hecl::StringUtils::EndsWith(in.getAuxInfo(), _S(".CINF")))
return {SBIG('CINF'), path.hash().val32()};
else if (hecl::StringUtils::EndsWith(in.getAuxInfo(), _S(".CSKR")))
return {SBIG('CSKR'), path.hash().val32()};
else if (hecl::StringUtils::EndsWith(in.getAuxInfo(), _S(".ANIM")))
return {SBIG('ANIM'), path.hash().val32()};
*/
Actor actor = ds.compileActor(); Actor actor = ds.compileActor();
DNAMP1::ANCS::Cook(out, in, actor, ds, m_pc, [&](const hecl::ProjectPath& modelPath) -> bool { DNAMP1::ANCS::Cook(out, in, actor, ds, m_pc, [&](const hecl::ProjectPath& modelPath) -> bool {
hecl::ProjectPath cooked; hecl::ProjectPath cooked;

View File

@ -12,12 +12,13 @@ static void WriteTag(athena::io::YAMLDocWriter& cacheWriter,
{ {
char idStr[9]; char idStr[9];
snprintf(idStr, 9, "%08X", uint32_t(pathTag.id)); snprintf(idStr, 9, "%08X", uint32_t(pathTag.id));
cacheWriter.enterSubVector(idStr); if (auto v = cacheWriter.enterSubVector(idStr))
cacheWriter.writeString(nullptr, pathTag.type.toString().c_str()); {
cacheWriter.writeString(nullptr, path.getAuxInfo().size() ? cacheWriter.writeString(nullptr, pathTag.type.toString().c_str());
(path.getRelativePathUTF8() + '|' + path.getAuxInfoUTF8()) : cacheWriter.writeString(nullptr, path.getAuxInfo().size() ?
path.getRelativePathUTF8()); (path.getRelativePathUTF8() + '|' + path.getAuxInfoUTF8()) :
cacheWriter.leaveSubVector(); path.getRelativePathUTF8());
}
} }
static void WriteNameTag(athena::io::YAMLDocWriter& nameWriter, static void WriteNameTag(athena::io::YAMLDocWriter& nameWriter,

View File

@ -118,6 +118,19 @@ void ProjectResourceFactoryMP1::IndexMP1Resources(hecl::Database::Project& proj,
m_origIds = sp.GetObj("MP1OriginalIDs"); m_origIds = sp.GetObj("MP1OriginalIDs");
} }
void ProjectResourceFactoryMP1::GetTagListForFile(const char* pakName, std::vector<SObjectTag>& out) const
{
std::string pathPrefix("MP1/");
pathPrefix += pakName;
pathPrefix += '/';
std::unique_lock<std::mutex> lk(
const_cast<ProjectResourceFactoryMP1&>(*this).m_backgroundIndexMutex);
for (const auto& tag : m_tagToPath)
if (!tag.second.getRelativePathUTF8().compare(0, pathPrefix.size(), pathPrefix))
out.push_back(tag.first);
}
void ProjectResourceFactoryMP1::Shutdown() void ProjectResourceFactoryMP1::Shutdown()
{ {
m_origIds = TLockedToken<MP1OriginalIDs>(); m_origIds = TLockedToken<MP1OriginalIDs>();

View File

@ -15,6 +15,7 @@ class ProjectResourceFactoryMP1 : public ProjectResourceFactoryBase
public: public:
ProjectResourceFactoryMP1(hecl::ClientProcess& clientProc); ProjectResourceFactoryMP1(hecl::ClientProcess& clientProc);
void IndexMP1Resources(hecl::Database::Project& proj, CSimplePool& sp); void IndexMP1Resources(hecl::Database::Project& proj, CSimplePool& sp);
void GetTagListForFile(const char* pakName, std::vector<SObjectTag>& out) const;
void Shutdown(); void Shutdown();
ResId TranslateOriginalToNew(ResId id) const; ResId TranslateOriginalToNew(ResId id) const;

View File

@ -173,9 +173,8 @@ public:
: RootSpace(vm) : RootSpace(vm)
{ {
m_state.read(r); m_state.read(r);
r.enterSubRecord("spaceTree"); if (auto rec = r.enterSubRecord("spaceTree"))
m_spaceTree.reset(NewSpaceFromConfigStream(vm, this, r)); m_spaceTree.reset(NewSpaceFromConfigStream(vm, this, r));
r.leaveSubRecord();
} }
void think() void think()
@ -200,12 +199,13 @@ public:
w.writeUint32("class", atUint32(m_class)); w.writeUint32("class", atUint32(m_class));
m_state.write(w); m_state.write(w);
w.enterSubRecord("spaceTree"); if (auto rec = w.enterSubRecord("spaceTree"))
if (m_spaceTree) {
m_spaceTree->saveState(w); if (m_spaceTree)
else m_spaceTree->saveState(w);
w.writeUint32("class", 0); else
w.leaveSubRecord(); w.writeUint32("class", 0);
}
} }
void setChild(std::unique_ptr<Space>&& space) void setChild(std::unique_ptr<Space>&& space)
@ -248,12 +248,10 @@ public:
: SplitSpace(vm, parent, specter::SplitView::Axis::Horizontal) : SplitSpace(vm, parent, specter::SplitView::Axis::Horizontal)
{ {
m_state.read(r); m_state.read(r);
r.enterSubRecord("slot0"); if (auto rec = r.enterSubRecord("slot0"))
m_slots[0].reset(NewSpaceFromConfigStream(vm, this, r)); m_slots[0].reset(NewSpaceFromConfigStream(vm, this, r));
r.leaveSubRecord(); if (auto rec = r.enterSubRecord("slot1"))
r.enterSubRecord("slot1"); m_slots[1].reset(NewSpaceFromConfigStream(vm, this, r));
m_slots[1].reset(NewSpaceFromConfigStream(vm, this, r));
r.leaveSubRecord();
reloadState(); reloadState();
} }
@ -300,19 +298,21 @@ public:
w.writeUint32("class", atUint32(m_class)); w.writeUint32("class", atUint32(m_class));
m_state.write(w); m_state.write(w);
w.enterSubRecord("slot0"); if (auto rec = w.enterSubRecord("slot0"))
if (m_slots[0]) {
m_slots[0]->saveState(w); if (m_slots[0])
else m_slots[0]->saveState(w);
w.writeUint32("class", 0); else
w.leaveSubRecord(); w.writeUint32("class", 0);
}
w.enterSubRecord("slot1"); if (auto rec = w.enterSubRecord("slot1"))
if (m_slots[1]) {
m_slots[1]->saveState(w); if (m_slots[1])
else m_slots[1]->saveState(w);
w.writeUint32("class", 0); else
w.leaveSubRecord(); w.writeUint32("class", 0);
}
} }
void setChildSlot(unsigned slot, std::unique_ptr<Space>&& space); void setChildSlot(unsigned slot, std::unique_ptr<Space>&& space);

View File

@ -41,6 +41,8 @@ public:
virtual std::unique_ptr<u8[]> LoadResourceSync(const urde::SObjectTag& tag)=0; virtual std::unique_ptr<u8[]> LoadResourceSync(const urde::SObjectTag& tag)=0;
virtual std::unique_ptr<u8[]> LoadResourcePartSync(const urde::SObjectTag& tag, u32 size, u32 off)=0; virtual std::unique_ptr<u8[]> LoadResourcePartSync(const urde::SObjectTag& tag, u32 size, u32 off)=0;
virtual void GetTagListForFile(const char* pakName, std::vector<SObjectTag>& out) const {}
virtual ResId TranslateOriginalToNew(ResId id) const { return -1; } virtual ResId TranslateOriginalToNew(ResId id) const { return -1; }
virtual ResId TranslateNewToOriginal(ResId id) const { return -1; } virtual ResId TranslateNewToOriginal(ResId id) const { return -1; }
}; };

View File

@ -65,9 +65,23 @@ CMFGameLoader::CMFGameLoader() : CMFGameLoaderBase("CMFGameLoader")
} }
} }
static const char* LoadDepPAKs[] =
{
"TestAnim",
"SamusGun",
"SamGunFx",
nullptr
};
void CMFGameLoader::MakeLoadDependencyList() void CMFGameLoader::MakeLoadDependencyList()
{ {
std::vector<SObjectTag> tags;
for (int i=0 ; LoadDepPAKs[i] ; ++i)
g_ResFactory->GetTagListForFile(LoadDepPAKs[i], tags);
x1c_loadList.reserve(tags.size());
for (const SObjectTag& tag : tags)
x1c_loadList.push_back(g_SimplePool->GetObj(tag));
} }
CIOWin::EMessageReturn CMFGameLoader::OnMessage(const CArchitectureMessage& msg, CArchitectureQueue& queue) CIOWin::EMessageReturn CMFGameLoader::OnMessage(const CArchitectureMessage& msg, CArchitectureQueue& queue)
@ -124,12 +138,26 @@ CIOWin::EMessageReturn CMFGameLoader::OnMessage(const CArchitectureMessage& msg,
wldState.GetDesiredAreaAssetId()); wldState.GetDesiredAreaAssetId());
return EMessageReturn::Exit; return EMessageReturn::Exit;
} }
else
if (!x18_guiMgr)
x18_guiMgr = std::make_shared<CInGameGuiManager>(*x14_stateMgr, queue);
if (!x18_guiMgr->CheckLoadComplete(*x14_stateMgr))
return EMessageReturn::Exit;
x1c_loadList.clear();
wtMgr->StartTextFadeOut();
x2c_25_transitionFinished = wtMgr->IsTransitionFinished();
return EMessageReturn::Exit;
}
case EArchMsgType::FrameBegin:
{
if (x2c_25_transitionFinished)
{ {
if (!x18_guiMgr) queue.Push(
{ MakeMsg::CreateCreateIOWin(EArchMsgTarget::IOWinManager, 10, 1000,
x18_guiMgr = std::make_shared<CInGameGuiManager>(*x14_stateMgr, queue); std::make_shared<CMFGame>(x14_stateMgr, x18_guiMgr, queue)));
} return EMessageReturn::RemoveIOWinAndExit;
} }
} }
default: default:

View File

@ -47,7 +47,7 @@ class CMFGameLoader : public CMFGameLoaderBase
struct struct
{ {
bool x2c_24_initialized : 1; bool x2c_24_initialized : 1;
bool x2c_25_ : 1; bool x2c_25_transitionFinished : 1;
}; };
u8 _dummy = 0; u8 _dummy = 0;
}; };

2
hecl

@ -1 +1 @@
Subproject commit e86501e66a219e5370b82be6379da449cb23381a Subproject commit bcffcf3105090648ba44b3aa69a5d906986be531