mirror of
https://github.com/AxioDL/metaforce.git
synced 2025-12-09 21:47:59 +00:00
YAML read/write refactor
This commit is contained in:
@@ -77,7 +77,7 @@ size_t ANCS::CharacterSet::CharacterInfo::PASDatabase::AnimState::ParmInfo::bina
|
||||
return __isz;
|
||||
}
|
||||
|
||||
void ANCS::CharacterSet::CharacterInfo::PASDatabase::AnimState::ParmInfo::fromYAML(Athena::io::YAMLDocReader& reader)
|
||||
void ANCS::CharacterSet::CharacterInfo::PASDatabase::AnimState::ParmInfo::read(Athena::io::YAMLDocReader& reader)
|
||||
{
|
||||
parmType = reader.readUint32("parmType");
|
||||
unk1 = reader.readUint32("unk1");
|
||||
@@ -107,7 +107,7 @@ void ANCS::CharacterSet::CharacterInfo::PASDatabase::AnimState::ParmInfo::fromYA
|
||||
reader.leaveSubVector();
|
||||
}
|
||||
|
||||
void ANCS::CharacterSet::CharacterInfo::PASDatabase::AnimState::ParmInfo::toYAML(Athena::io::YAMLDocWriter& writer) const
|
||||
void ANCS::CharacterSet::CharacterInfo::PASDatabase::AnimState::ParmInfo::write(Athena::io::YAMLDocWriter& writer) const
|
||||
{
|
||||
writer.writeUint32("parmType", parmType);
|
||||
writer.writeUint32("unk1", unk1);
|
||||
@@ -244,7 +244,7 @@ size_t ANCS::CharacterSet::CharacterInfo::PASDatabase::AnimState::binarySize(siz
|
||||
return __isz;
|
||||
}
|
||||
|
||||
void ANCS::CharacterSet::CharacterInfo::PASDatabase::AnimState::fromYAML(Athena::io::YAMLDocReader& reader)
|
||||
void ANCS::CharacterSet::CharacterInfo::PASDatabase::AnimState::read(Athena::io::YAMLDocReader& reader)
|
||||
{
|
||||
id = reader.readUint32("id");
|
||||
atUint32 parmInfoCount = reader.readUint32("parmInfoCount");
|
||||
@@ -282,7 +282,7 @@ void ANCS::CharacterSet::CharacterInfo::PASDatabase::AnimState::fromYAML(Athena:
|
||||
});
|
||||
}
|
||||
|
||||
void ANCS::CharacterSet::CharacterInfo::PASDatabase::AnimState::toYAML(Athena::io::YAMLDocWriter& writer) const
|
||||
void ANCS::CharacterSet::CharacterInfo::PASDatabase::AnimState::write(Athena::io::YAMLDocWriter& writer) const
|
||||
{
|
||||
writer.writeUint32("id", id);
|
||||
writer.writeUint32("parmInfoCount", parmInfos.size());
|
||||
@@ -524,7 +524,7 @@ size_t ANCS::CharacterSet::CharacterInfo::binarySize(size_t __isz) const
|
||||
return __isz;
|
||||
}
|
||||
|
||||
void ANCS::CharacterSet::CharacterInfo::fromYAML(Athena::io::YAMLDocReader& reader)
|
||||
void ANCS::CharacterSet::CharacterInfo::read(Athena::io::YAMLDocReader& reader)
|
||||
{
|
||||
idx = reader.readUint32("idx");
|
||||
atUint16 sectionCount = reader.readUint16("sectionCount");
|
||||
@@ -584,7 +584,7 @@ void ANCS::CharacterSet::CharacterInfo::fromYAML(Athena::io::YAMLDocReader& read
|
||||
}
|
||||
}
|
||||
|
||||
void ANCS::CharacterSet::CharacterInfo::toYAML(Athena::io::YAMLDocWriter& writer) const
|
||||
void ANCS::CharacterSet::CharacterInfo::write(Athena::io::YAMLDocWriter& writer) const
|
||||
{
|
||||
writer.writeUint32("idx", idx);
|
||||
|
||||
@@ -706,34 +706,34 @@ size_t ANCS::AnimationSet::MetaAnimFactory::binarySize(size_t __isz) const
|
||||
return m_anim->binarySize(__isz + 4);
|
||||
}
|
||||
|
||||
void ANCS::AnimationSet::MetaAnimFactory::fromYAML(Athena::io::YAMLDocReader& reader)
|
||||
void ANCS::AnimationSet::MetaAnimFactory::read(Athena::io::YAMLDocReader& reader)
|
||||
{
|
||||
std::string type = reader.readString("type");
|
||||
std::transform(type.begin(), type.end(), type.begin(), tolower);
|
||||
if (!type.compare("primitive"))
|
||||
{
|
||||
m_anim.reset(new struct MetaAnimPrimitive);
|
||||
m_anim->fromYAML(reader);
|
||||
m_anim->read(reader);
|
||||
}
|
||||
else if (!type.compare("blend"))
|
||||
{
|
||||
m_anim.reset(new struct MetaAnimBlend);
|
||||
m_anim->fromYAML(reader);
|
||||
m_anim->read(reader);
|
||||
}
|
||||
else if (!type.compare("phaseblend"))
|
||||
{
|
||||
m_anim.reset(new struct MetaAnimPhaseBlend);
|
||||
m_anim->fromYAML(reader);
|
||||
m_anim->read(reader);
|
||||
}
|
||||
else if (!type.compare("random"))
|
||||
{
|
||||
m_anim.reset(new struct MetaAnimRandom);
|
||||
m_anim->fromYAML(reader);
|
||||
m_anim->read(reader);
|
||||
}
|
||||
else if (!type.compare("sequence"))
|
||||
{
|
||||
m_anim.reset(new struct MetaAnimSequence);
|
||||
m_anim->fromYAML(reader);
|
||||
m_anim->read(reader);
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -742,12 +742,12 @@ void ANCS::AnimationSet::MetaAnimFactory::fromYAML(Athena::io::YAMLDocReader& re
|
||||
|
||||
}
|
||||
|
||||
void ANCS::AnimationSet::MetaAnimFactory::toYAML(Athena::io::YAMLDocWriter& writer) const
|
||||
void ANCS::AnimationSet::MetaAnimFactory::write(Athena::io::YAMLDocWriter& writer) const
|
||||
{
|
||||
if (!m_anim)
|
||||
return;
|
||||
writer.writeString("type", m_anim->m_typeStr);
|
||||
m_anim->toYAML(writer);
|
||||
m_anim->write(writer);
|
||||
}
|
||||
|
||||
const char* ANCS::AnimationSet::MetaAnimFactory::DNAType()
|
||||
@@ -797,24 +797,24 @@ size_t ANCS::AnimationSet::MetaTransFactory::binarySize(size_t __isz) const
|
||||
return m_trans->binarySize(__isz + 4);
|
||||
}
|
||||
|
||||
void ANCS::AnimationSet::MetaTransFactory::fromYAML(Athena::io::YAMLDocReader& reader)
|
||||
void ANCS::AnimationSet::MetaTransFactory::read(Athena::io::YAMLDocReader& reader)
|
||||
{
|
||||
std::string type = reader.readString("type");
|
||||
std::transform(type.begin(), type.end(), type.begin(), tolower);
|
||||
if (!type.compare("metaanim"))
|
||||
{
|
||||
m_trans.reset(new struct MetaTransMetaAnim);
|
||||
m_trans->fromYAML(reader);
|
||||
m_trans->read(reader);
|
||||
}
|
||||
else if (!type.compare("trans"))
|
||||
{
|
||||
m_trans.reset(new struct MetaTransTrans);
|
||||
m_trans->fromYAML(reader);
|
||||
m_trans->read(reader);
|
||||
}
|
||||
else if (!type.compare("phasetrans"))
|
||||
{
|
||||
m_trans.reset(new struct MetaTransPhaseTrans);
|
||||
m_trans->fromYAML(reader);
|
||||
m_trans->read(reader);
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -823,7 +823,7 @@ void ANCS::AnimationSet::MetaTransFactory::fromYAML(Athena::io::YAMLDocReader& r
|
||||
|
||||
}
|
||||
|
||||
void ANCS::AnimationSet::MetaTransFactory::toYAML(Athena::io::YAMLDocWriter& writer) const
|
||||
void ANCS::AnimationSet::MetaTransFactory::write(Athena::io::YAMLDocWriter& writer) const
|
||||
{
|
||||
if (!m_trans)
|
||||
{
|
||||
@@ -831,7 +831,7 @@ void ANCS::AnimationSet::MetaTransFactory::toYAML(Athena::io::YAMLDocWriter& wri
|
||||
return;
|
||||
}
|
||||
writer.writeString("type", m_trans->m_typeStr?m_trans->m_typeStr:"NoTrans");
|
||||
m_trans->toYAML(writer);
|
||||
m_trans->write(writer);
|
||||
}
|
||||
|
||||
const char* ANCS::AnimationSet::MetaTransFactory::DNAType()
|
||||
@@ -957,7 +957,7 @@ size_t ANCS::AnimationSet::binarySize(size_t __isz) const
|
||||
return __isz;
|
||||
}
|
||||
|
||||
void ANCS::AnimationSet::fromYAML(Athena::io::YAMLDocReader& reader)
|
||||
void ANCS::AnimationSet::read(Athena::io::YAMLDocReader& reader)
|
||||
{
|
||||
atUint16 sectionCount = reader.readUint16("sectionCount");
|
||||
|
||||
@@ -992,7 +992,7 @@ void ANCS::AnimationSet::fromYAML(Athena::io::YAMLDocReader& reader)
|
||||
}
|
||||
}
|
||||
|
||||
void ANCS::AnimationSet::toYAML(Athena::io::YAMLDocWriter& writer) const
|
||||
void ANCS::AnimationSet::write(Athena::io::YAMLDocWriter& writer) const
|
||||
{
|
||||
atUint16 sectionCount;
|
||||
if (animResources.size())
|
||||
|
||||
@@ -46,7 +46,7 @@ void EVNT::write(Athena::io::IStreamWriter& writer) const
|
||||
writer.enumerate(sfxEvents);
|
||||
}
|
||||
|
||||
void EVNT::fromYAML(Athena::io::YAMLDocReader& reader)
|
||||
void EVNT::read(Athena::io::YAMLDocReader& reader)
|
||||
{
|
||||
version = reader.readUint32("version");
|
||||
|
||||
@@ -67,7 +67,7 @@ void EVNT::fromYAML(Athena::io::YAMLDocReader& reader)
|
||||
reader.enumerate("sfxEvents", sfxEvents, sfxCount);
|
||||
}
|
||||
|
||||
void EVNT::toYAML(Athena::io::YAMLDocWriter& writer) const
|
||||
void EVNT::write(Athena::io::YAMLDocWriter& writer) const
|
||||
{
|
||||
writer.writeUint32("version", version);
|
||||
|
||||
|
||||
@@ -128,7 +128,7 @@ struct SCAN : BigYAML
|
||||
__dna_writer.writeFloatBig(fadeDuration);
|
||||
}
|
||||
|
||||
void fromYAML(Athena::io::YAMLDocReader& __dna_docin)
|
||||
void read(Athena::io::YAMLDocReader& __dna_docin)
|
||||
{
|
||||
/* texture */
|
||||
__dna_docin.enumerate("texture", texture);
|
||||
@@ -153,7 +153,7 @@ struct SCAN : BigYAML
|
||||
fadeDuration = __dna_docin.readFloat("fadeDuration");
|
||||
}
|
||||
|
||||
void toYAML(Athena::io::YAMLDocWriter& __dna_docout) const
|
||||
void write(Athena::io::YAMLDocWriter& __dna_docout) const
|
||||
{
|
||||
/* texture */
|
||||
__dna_docout.enumerate("texture", texture);
|
||||
|
||||
@@ -80,7 +80,7 @@ void SCLY::ScriptLayer::nameIDs(PAKRouter<PAKBridge>& pakRouter) const
|
||||
obj->nameIDs(pakRouter);
|
||||
}
|
||||
|
||||
void SCLY::fromYAML(Athena::io::YAMLDocReader& docin)
|
||||
void SCLY::read(Athena::io::YAMLDocReader& docin)
|
||||
{
|
||||
fourCC = docin.readUint32("fourCC");
|
||||
version = docin.readUint32("version");
|
||||
@@ -89,7 +89,7 @@ void SCLY::fromYAML(Athena::io::YAMLDocReader& docin)
|
||||
docin.enumerate("layers", layers, layerCount);
|
||||
}
|
||||
|
||||
void SCLY::toYAML(Athena::io::YAMLDocWriter& docout) const
|
||||
void SCLY::write(Athena::io::YAMLDocWriter& docout) const
|
||||
{
|
||||
docout.writeUint32("fourCC", fourCC);
|
||||
docout.writeUint32("version", version);
|
||||
@@ -133,7 +133,7 @@ void SCLY::ScriptLayer::read(Athena::io::IStreamReader& rs)
|
||||
}
|
||||
}
|
||||
|
||||
void SCLY::ScriptLayer::fromYAML(Athena::io::YAMLDocReader& rs)
|
||||
void SCLY::ScriptLayer::read(Athena::io::YAMLDocReader& rs)
|
||||
{
|
||||
unknown = rs.readUByte("unknown");
|
||||
objectCount = rs.readUint32("objectCount");
|
||||
@@ -149,7 +149,7 @@ void SCLY::ScriptLayer::fromYAML(Athena::io::YAMLDocReader& rs)
|
||||
if (iter != SCRIPT_OBJECT_DB.end())
|
||||
{
|
||||
std::unique_ptr<IScriptObject> obj((*iter)->a());
|
||||
obj->fromYAML(rs);
|
||||
obj->read(rs);
|
||||
obj->type = type;
|
||||
objects.push_back(std::move(obj));
|
||||
}
|
||||
@@ -183,7 +183,7 @@ size_t SCLY::ScriptLayer::binarySize(size_t __isz) const
|
||||
return __isz;
|
||||
}
|
||||
|
||||
void SCLY::ScriptLayer::toYAML(Athena::io::YAMLDocWriter& ws) const
|
||||
void SCLY::ScriptLayer::write(Athena::io::YAMLDocWriter& ws) const
|
||||
{
|
||||
ws.writeUByte("unknown", unknown);
|
||||
ws.writeUint32("objectCount", objectCount);
|
||||
@@ -192,7 +192,7 @@ void SCLY::ScriptLayer::toYAML(Athena::io::YAMLDocWriter& ws) const
|
||||
{
|
||||
ws.enterSubRecord(nullptr);
|
||||
ws.writeUByte("type", obj->type);
|
||||
obj->toYAML(ws);
|
||||
obj->write(ws);
|
||||
ws.leaveSubRecord();
|
||||
};
|
||||
ws.leaveSubVector();
|
||||
|
||||
@@ -131,7 +131,7 @@ size_t STRG::binarySize(size_t __isz) const
|
||||
return __isz;
|
||||
}
|
||||
|
||||
void STRG::fromYAML(Athena::io::YAMLDocReader& reader)
|
||||
void STRG::read(Athena::io::YAMLDocReader& reader)
|
||||
{
|
||||
const Athena::io::YAMLNode* root = reader.getRootNode();
|
||||
|
||||
@@ -182,7 +182,7 @@ void STRG::fromYAML(Athena::io::YAMLDocReader& reader)
|
||||
langMap.emplace(item.first, &item.second);
|
||||
}
|
||||
|
||||
void STRG::toYAML(Athena::io::YAMLDocWriter& writer) const
|
||||
void STRG::write(Athena::io::YAMLDocWriter& writer) const
|
||||
{
|
||||
for (const auto& lang : langs)
|
||||
{
|
||||
|
||||
@@ -109,9 +109,9 @@ struct Oculus : IScriptObject
|
||||
__dna_writer.writeFloatBig(unknown8);
|
||||
}
|
||||
|
||||
void fromYAML(Athena::io::YAMLDocReader& __dna_docin)
|
||||
void read(Athena::io::YAMLDocReader& __dna_docin)
|
||||
{
|
||||
IScriptObject::fromYAML(__dna_docin);
|
||||
IScriptObject::read(__dna_docin);
|
||||
/* name */
|
||||
name = __dna_docin.readString("name");
|
||||
/* location */
|
||||
@@ -149,9 +149,9 @@ struct Oculus : IScriptObject
|
||||
unknown8 = 0.0;
|
||||
}
|
||||
|
||||
void toYAML(Athena::io::YAMLDocWriter& __dna_docout) const
|
||||
void write(Athena::io::YAMLDocWriter& __dna_docout) const
|
||||
{
|
||||
IScriptObject::toYAML(__dna_docout);
|
||||
IScriptObject::write(__dna_docout);
|
||||
/* name */
|
||||
__dna_docout.writeString("name", name);
|
||||
/* location */
|
||||
|
||||
@@ -344,9 +344,9 @@ struct Ridley : IScriptObject
|
||||
damageInfo9.write(__dna_writer);
|
||||
}
|
||||
|
||||
void fromYAML(Athena::io::YAMLDocReader& __dna_docin)
|
||||
void read(Athena::io::YAMLDocReader& __dna_docin)
|
||||
{
|
||||
IScriptObject::fromYAML(__dna_docin);
|
||||
IScriptObject::read(__dna_docin);
|
||||
/* name */
|
||||
name = __dna_docin.readString("name");
|
||||
/* location */
|
||||
@@ -454,9 +454,9 @@ struct Ridley : IScriptObject
|
||||
__dna_docin.enumerate("damageInfo9", damageInfo9);
|
||||
}
|
||||
|
||||
void toYAML(Athena::io::YAMLDocWriter& __dna_docout) const
|
||||
void write(Athena::io::YAMLDocWriter& __dna_docout) const
|
||||
{
|
||||
IScriptObject::toYAML(__dna_docout);
|
||||
IScriptObject::write(__dna_docout);
|
||||
/* name */
|
||||
__dna_docout.writeString("name", name);
|
||||
/* location */
|
||||
|
||||
@@ -160,9 +160,9 @@ struct WorldTeleporter : IScriptObject
|
||||
}
|
||||
}
|
||||
|
||||
void fromYAML(Athena::io::YAMLDocReader& __dna_docin)
|
||||
void read(Athena::io::YAMLDocReader& __dna_docin)
|
||||
{
|
||||
IScriptObject::fromYAML(__dna_docin);
|
||||
IScriptObject::read(__dna_docin);
|
||||
/* name */
|
||||
name = __dna_docin.readString("name");
|
||||
/* unknown1 */
|
||||
@@ -223,9 +223,9 @@ struct WorldTeleporter : IScriptObject
|
||||
}
|
||||
}
|
||||
|
||||
void toYAML(Athena::io::YAMLDocWriter& __dna_docout) const
|
||||
void write(Athena::io::YAMLDocWriter& __dna_docout) const
|
||||
{
|
||||
IScriptObject::toYAML(__dna_docout);
|
||||
IScriptObject::write(__dna_docout);
|
||||
/* name */
|
||||
__dna_docout.writeString("name", name);
|
||||
/* unknown1 */
|
||||
|
||||
Reference in New Issue
Block a user