Add FSM2 DNA

This commit is contained in:
Phillip Stephens 2016-04-10 22:13:16 -07:00
parent 4eb1da2772
commit 476e515622
5 changed files with 1189 additions and 1 deletions

View File

@ -9,6 +9,7 @@ add_library(DNACommon
${liblist}
PAK.hpp PAK.cpp
GX.hpp
FSM2.hpp FSM2.cpp
MLVL.hpp MLVL.cpp
CMDL.cpp
MAPA.cpp
@ -25,7 +26,7 @@ add_library(DNACommon
ParticleCommon.cpp
FONT.hpp FONT.cpp
DeafBabe.hpp
BabeDead.hpp
BabeDead.hpp
RigInverter.hpp RigInverter.cpp
Tweaks/ITweakGame.hpp
Tweaks/ITweakParticle.hpp

1018
DataSpec/DNACommon/FSM2.cpp Normal file

File diff suppressed because it is too large Load Diff

163
DataSpec/DNACommon/FSM2.hpp Normal file
View File

@ -0,0 +1,163 @@
#ifndef __COMMON_FSM2_HPP__
#define __COMMON_FSM2_HPP__
#include "PAK.hpp"
#include "DNACommon.hpp"
#include "athena/FileWriter.hpp"
namespace DataSpec
{
namespace DNAFSM2
{
struct IFSM : BigYAML
{
Delete _d;
};
template <class IDType>
struct FSM2 : BigYAML
{
struct Header : BigYAML
{
DECL_YAML
DNAFourCC magic;
Value<atUint32> version;
} header;
struct CommonStruct : BigYAML
{
DECL_YAML
String<-1> name;
Value<atUint32> unknown;
};
struct FSMV1 : IFSM
{
DECL_YAML
Value<atUint32> stateCount;
Value<atUint32> unknown1Count;
Value<atUint32> unknown2Count;
Value<atUint32> unknown3Count;
struct State : BigYAML
{
DECL_YAML
String<-1> name;
Value<atUint32> unknownCount;
Vector<CommonStruct, DNA_COUNT(unknownCount)> unknown;
};
struct Unknown1 : BigYAML
{
DECL_YAML
String<-1> name;
Value<float> unknown1;
Value<atUint32> unknown2Count;
Vector<CommonStruct, DNA_COUNT(unknown2Count)> unknown2;
Value<atUint8> unknown3;
};
struct Unknown2 : BigYAML
{
DECL_YAML
String<-1> name;
Value<atUint32> unknownCount;
Vector<CommonStruct, DNA_COUNT(unknownCount)> unknown;
};
struct Unknown3 : BigYAML
{
DECL_YAML
String<-1> name;
Value<atUint32> unknownCount;
Vector<CommonStruct, DNA_COUNT(unknownCount)> unknown;
IDType fsmId;
};
Vector<State, DNA_COUNT(stateCount)> states;
Vector<Unknown1, DNA_COUNT(unknown1Count)> unknown1;
Vector<Unknown2, DNA_COUNT(unknown2Count)> unknown2;
Vector<Unknown3, DNA_COUNT(unknown3Count)> unknown3;
};
struct FSMV2 : IFSM
{
DECL_YAML
Value<atUint32> stateCount;
Value<atUint32> unknown1Count;
Value<atUint32> unknown2Count;
Value<atUint32> unknown3Count;
struct State : BigYAML
{
DECL_YAML
String<-1> name;
Value<atUint32> unknown1;
Value<atUint32> unknown2;
Value<atUint32> unknown3;
Value<atUint32> unknown4;
Value<atUint32> unknown5Count;
Vector<CommonStruct, DNA_COUNT(unknown5Count)> unknown5;
};
struct Unknown1 : BigYAML
{
DECL_YAML
String<-1> name;
Value<atUint32> unknown1;
Value<atUint32> unknown2;
Value<atUint32> unknown3;
Value<atUint32> unknown4;
Value<float> unknown5;
Value<atUint32> unknown6Count;
Vector<CommonStruct, DNA_COUNT(unknown6Count)> unknown6;
Value<atUint8> unknown7;
};
struct Unknown2 : BigYAML
{
DECL_YAML
String<-1> name;
Value<atUint32> unknown1;
Value<atUint32> unknown2;
Value<atUint32> unknown3;
Value<atUint32> unknown4;
Value<atUint32> unknown5Count;
Vector<CommonStruct, DNA_COUNT(unknown5Count)> unknown5;
};
struct Unknown3 : BigYAML
{
DECL_YAML
String<-1> name;
Value<atUint32> unknown1;
Value<atUint32> unknown2;
Value<atUint32> unknown3;
Value<atUint32> unknown4;
Value<atUint32> unknown5Count;
Vector<CommonStruct, DNA_COUNT(unknown5Count)> unknown5;
IDType fsmId;
};
Vector<State, DNA_COUNT(stateCount)> states;
Vector<Unknown1, DNA_COUNT(unknown1Count)> unknown1;
Vector<Unknown2, DNA_COUNT(unknown2Count)> unknown2;
Vector<Unknown3, DNA_COUNT(unknown3Count)> unknown3;
};
void read(athena::io::IStreamReader& in);
void write(athena::io::IStreamWriter& out) const;
void read(athena::io::YAMLDocReader& in);
void write(athena::io::YAMLDocWriter& out) const;
std::unique_ptr<IFSM> detail;
size_t binarySize(size_t __isz) const;
static const char* DNAType();
const char* DNATypeV() const;
};
template <class IDType>
bool ExtractFSM2(PAKEntryReadStream& rs, const hecl::ProjectPath& outPath);
template <class IDType>
bool WriteFSM2(const FSM2<IDType>& fsm2, const hecl::ProjectPath& outPath);
}
}
#endif // __COMMON_FSM2_HPP__

View File

@ -7,6 +7,7 @@
#include "MREA.hpp"
#include "MAPA.hpp"
#include "AFSM.hpp"
#include "../DNACommon/FSM2.hpp"
#include "../DNACommon/TXTR.hpp"
#include "../DNACommon/FONT.hpp"
@ -230,6 +231,8 @@ ResExtractor<PAKBridge> PAKBridge::LookupExtractor(const DNAMP1::PAK::Entry& ent
return {nullptr, MREA::Extract, {_S(".blend")}, 4};
case SBIG('MAPA'):
return {nullptr, MAPA::Extract, {_S(".blend")}, 4};
case SBIG('FSM2'):
return {DNAFSM2::ExtractFSM2<UniqueID32>, nullptr, {_S(".yaml")}};
case SBIG('FONT'):
return {DNAFont::ExtractFONT<UniqueID32>, nullptr, {_S(".yaml")}};
}

View File

@ -10,6 +10,7 @@
#include "MAPA.hpp"
#include "../DNACommon/TXTR.hpp"
#include "../DNACommon/FONT.hpp"
#include "../DNACommon/FSM2.hpp"
namespace DataSpec
{
@ -238,6 +239,8 @@ ResExtractor<PAKBridge> PAKBridge::LookupExtractor(const PAK::Entry& entry)
return {nullptr, MREA::Extract, {_S(".blend")}, 4};
case SBIG('MAPA'):
return {nullptr, MAPA::Extract, {_S(".blend")}, 4};
case SBIG('FSM2'):
return {DNAFSM2::ExtractFSM2<UniqueID64>, nullptr, {_S(".yaml")}};
case SBIG('FONT'):
return {DNAFont::ExtractFONT<UniqueID64>, nullptr, {_S(".yaml")}};
}