2018-10-07 03:42:33 +00:00
|
|
|
#pragma once
|
2016-02-04 02:04:05 +00:00
|
|
|
|
2016-03-04 23:04:53 +00:00
|
|
|
#include <athena/FileWriter.hpp>
|
2018-06-29 20:21:36 +00:00
|
|
|
#include "DataSpec/DNACommon/DNACommon.hpp"
|
2016-02-04 02:04:05 +00:00
|
|
|
#include "DNAMP1.hpp"
|
|
|
|
|
2017-12-29 08:08:12 +00:00
|
|
|
namespace DataSpec::DNAMP1
|
2016-02-04 02:04:05 +00:00
|
|
|
{
|
2018-02-22 07:24:51 +00:00
|
|
|
struct AFSM : public BigDNA
|
2016-02-04 02:04:05 +00:00
|
|
|
{
|
2018-02-22 07:24:51 +00:00
|
|
|
AT_DECL_DNA_YAML
|
2016-02-04 02:04:05 +00:00
|
|
|
Value<atUint32> stateCount;
|
2018-02-25 08:23:27 +00:00
|
|
|
Vector<String<-1>, AT_DNA_COUNT(stateCount)> stateNames;
|
2016-02-04 02:04:05 +00:00
|
|
|
Value<atUint32> triggerCount;
|
|
|
|
|
2018-02-22 07:24:51 +00:00
|
|
|
struct State : public BigDNA
|
2016-02-04 02:04:05 +00:00
|
|
|
{
|
2018-02-22 07:24:51 +00:00
|
|
|
AT_DECL_DNA_YAML
|
2016-02-04 02:04:05 +00:00
|
|
|
Value<atUint32> transitionCount;
|
2018-02-22 07:24:51 +00:00
|
|
|
struct Transition : public BigDNA
|
2016-02-04 02:04:05 +00:00
|
|
|
{
|
2018-02-22 07:24:51 +00:00
|
|
|
AT_DECL_EXPLICIT_DNA_YAML
|
2016-02-04 02:04:05 +00:00
|
|
|
Value<atUint32> triggerCount;
|
|
|
|
|
2018-02-22 07:24:51 +00:00
|
|
|
struct Trigger : public BigDNA
|
2016-02-04 02:04:05 +00:00
|
|
|
{
|
2018-02-22 07:24:51 +00:00
|
|
|
AT_DECL_EXPLICIT_DNA_YAML
|
2016-02-04 02:04:05 +00:00
|
|
|
bool first = false;
|
|
|
|
String<-1> name;
|
|
|
|
Value<float> parameter;
|
|
|
|
Value<atUint32> targetState;
|
|
|
|
};
|
2018-02-25 08:23:27 +00:00
|
|
|
Vector<Trigger, AT_DNA_COUNT(triggerCount)> triggers;
|
2016-02-04 02:04:05 +00:00
|
|
|
};
|
2018-02-25 08:23:27 +00:00
|
|
|
Vector<Transition, AT_DNA_COUNT(transitionCount)> transitions;
|
2016-02-04 02:04:05 +00:00
|
|
|
};
|
2018-02-25 08:23:27 +00:00
|
|
|
Vector<State, AT_DNA_COUNT(stateCount)> states;
|
2016-02-04 02:04:05 +00:00
|
|
|
|
2016-03-04 23:04:53 +00:00
|
|
|
static bool Extract(PAKEntryReadStream& rs, const hecl::ProjectPath& outPath)
|
2016-02-04 02:04:05 +00:00
|
|
|
{
|
|
|
|
AFSM afsm;
|
|
|
|
afsm.read(rs);
|
2016-08-22 03:47:48 +00:00
|
|
|
athena::io::FileWriter writer(outPath.getAbsolutePath());
|
2018-02-22 07:24:51 +00:00
|
|
|
athena::io::ToYAMLStream(afsm, writer);
|
2016-02-04 02:04:05 +00:00
|
|
|
return true;
|
|
|
|
}
|
2018-04-07 20:55:57 +00:00
|
|
|
|
|
|
|
static bool Cook(const hecl::ProjectPath& inPath, const hecl::ProjectPath& outPath)
|
|
|
|
{
|
|
|
|
AFSM afsm;
|
|
|
|
athena::io::FileReader reader(inPath.getAbsolutePath());
|
|
|
|
athena::io::FromYAMLStream(afsm, reader);
|
|
|
|
athena::io::FileWriter ws(outPath.getAbsolutePath());
|
|
|
|
afsm.write(ws);
|
|
|
|
return true;
|
|
|
|
}
|
2016-02-04 02:04:05 +00:00
|
|
|
};
|
|
|
|
}
|
|
|
|
|