metaforce/DataSpec/DNACommon/PART.hpp

1681 lines
45 KiB
C++
Raw Normal View History

2016-02-02 04:29:58 +00:00
#ifndef __COMMON_PART_HPP__
#define __COMMON_PART_HPP__
#include "ParticleCommon.hpp"
#include "PAK.hpp"
2016-02-04 00:55:39 +00:00
#include "Athena/FileWriter.hpp"
2016-02-02 04:29:58 +00:00
namespace Retro
{
namespace DNAParticle
{
template <class IDType>
struct GPSM : BigYAML
{
static const char* DNAType() {return "Retro::GPSM";}
const char* DNATypeV() const {return DNAType();}
2016-02-02 23:12:55 +00:00
VectorElementFactory x0_PSIV;
ModVectorElementFactory x4_PSVM;
VectorElementFactory x8_PSOV;
IntElementFactory xc_PSLT;
IntElementFactory x10_PSWT;
RealElementFactory x14_PSTS;
2016-02-02 19:11:17 +00:00
VectorElementFactory x18_POFS;
IntElementFactory x1c_PMED;
RealElementFactory x20_LENG;
RealElementFactory x24_WIDT;
IntElementFactory x28_MAXP;
RealElementFactory x2c_GRTE;
ColorElementFactory x30_COLR;
IntElementFactory x34_LTME;
VectorElementFactory x38_ILOC;
VectorElementFactory x3c_IVEC;
EmitterElementFactory x40_EMTR;
2016-02-04 00:55:39 +00:00
union
{
struct
{
bool x44_28_SORT : 1; bool x44_30_MBLR : 1; bool x44_24_LINE : 1; bool x44_29_LIT_ : 1;
bool x44_26_AAPH : 1; bool x44_27_ZBUF : 1; bool x44_25_FXLL : 1; bool x44_31_PMAB : 1;
bool x45_29_VMD4 : 1; bool x45_28_VMD3 : 1; bool x45_27_VMD2 : 1; bool x45_26_VMD1 : 1;
bool x45_31_OPTS : 1; bool x45_24_PMUS : 1; bool x45_25_PMOO : 1; bool x45_30_CIND : 1;
};
uint16_t dummy1 = 0;
};
2016-02-02 19:11:17 +00:00
IntElementFactory x48_MBSP;
RealElementFactory x4c_SIZE;
RealElementFactory x50_ROTA;
UVElementFactory<IDType> x54_TEXR;
UVElementFactory<IDType> x58_TIND;
ChildResourceFactory<IDType> x5c_PMDL;
2016-02-02 19:11:17 +00:00
VectorElementFactory x6c_PMOP;
VectorElementFactory x70_PMRT;
VectorElementFactory x74_PMSC;
ColorElementFactory x78_PMCL;
ModVectorElementFactory x7c_VEL1;
ModVectorElementFactory x80_VEL2;
ModVectorElementFactory x84_VEL3;
ModVectorElementFactory x88_VEL4;
ChildResourceFactory<IDType> x8c_ICTS;
2016-02-02 19:11:17 +00:00
IntElementFactory x9c_NCSY;
IntElementFactory xa0_CSSD;
ChildResourceFactory<IDType> xa4_IDTS;
2016-02-04 00:55:39 +00:00
IntElementFactory xb4_NDSY;
ChildResourceFactory<IDType> xb8_IITS;
2016-02-02 19:11:17 +00:00
IntElementFactory xc8_PISY;
IntElementFactory xcc_SISY;
SpawnSystemKeyframeData<IDType> xd0_KSSM;
ChildResourceFactory<IDType> xd4_SSWH;
2016-02-02 19:11:17 +00:00
IntElementFactory xe4_SSSD;
VectorElementFactory xe8_SSPO;
2016-02-02 23:12:55 +00:00
IntElementFactory xf8_SESD;
VectorElementFactory xfc_SEPO;
ChildResourceFactory<IDType> xec_PMLC;
2016-02-02 19:11:17 +00:00
IntElementFactory x100_LTYP;
ColorElementFactory x104_LCLR;
RealElementFactory x108_LINT;
VectorElementFactory x10c_LOFF;
VectorElementFactory x110_LDIR;
2016-02-02 19:11:17 +00:00
IntElementFactory x114_LFOT;
RealElementFactory x118_LFOR;
RealElementFactory x11c_LSLA;
2016-02-02 04:29:58 +00:00
/* 0-00 additions */
2016-02-04 00:55:39 +00:00
IntElementFactory x10_SEED;
ChildResourceFactory<IDType> xd8_SELC;
union
{
struct
{
bool x30_30_ORNT : 1;
bool x30_31_RSOP : 1;
};
uint16_t dummy2 = 0;
};
RealElementFactory x10c_ADV1;
RealElementFactory x110_ADV2;
RealElementFactory x114_ADV3;
RealElementFactory x118_ADV4;
RealElementFactory x11c_ADV5;
RealElementFactory x120_ADV6;
RealElementFactory x124_ADV7;
RealElementFactory x128_ADV8;
GPSM()
{
x45_25_PMOO = true;
}
2016-02-02 04:29:58 +00:00
void read(Athena::io::YAMLDocReader& r)
{
for (const auto& elem : r.getCurNode()->m_mapChildren)
2016-02-02 04:29:58 +00:00
{
if (elem.first.size() < 4)
{
LogModule.report(LogVisor::Warning, "short FourCC in element '%s'", elem.first.c_str());
continue;
}
r.enterSubRecord(elem.first.c_str());
switch (*reinterpret_cast<const uint32_t*>(elem.first.data()))
{
case SBIG('PMCL'):
x78_PMCL.read(r);
break;
case SBIG('LFOR'):
x118_LFOR.read(r);
break;
case SBIG('IDTS'):
xa4_IDTS.read(r);
break;
case SBIG('EMTR'):
x40_EMTR.read(r);
break;
case SBIG('COLR'):
x30_COLR.read(r);
break;
case SBIG('CIND'):
2016-02-04 00:55:39 +00:00
x45_30_CIND = r.readBool(nullptr);
break;
case SBIG('AAPH'):
2016-02-04 00:55:39 +00:00
x44_26_AAPH = r.readBool(nullptr);
break;
case SBIG('CSSD'):
xa0_CSSD.read(r);
break;
case SBIG('GRTE'):
x2c_GRTE.read(r);
break;
case SBIG('FXLL'):
2016-02-04 00:55:39 +00:00
x44_25_FXLL = r.readBool(nullptr);
break;
case SBIG('ICTS'):
x8c_ICTS.read(r);
break;
case SBIG('KSSM'):
xd0_KSSM.read(r);
break;
case SBIG('ILOC'):
x38_ILOC.read(r);
break;
case SBIG('IITS'):
2016-02-04 00:55:39 +00:00
xb8_IITS.read(r);
break;
case SBIG('IVEC'):
x3c_IVEC.read(r);
break;
case SBIG('LDIR'):
x110_LDIR.read(r);
break;
case SBIG('LCLR'):
x104_LCLR.read(r);
break;
case SBIG('LENG'):
x20_LENG.read(r);
break;
case SBIG('MAXP'):
x28_MAXP.read(r);
break;
case SBIG('LOFF'):
x10c_LOFF.read(r);
break;
case SBIG('LINT'):
x108_LINT.read(r);
break;
case SBIG('LINE'):
2016-02-04 00:55:39 +00:00
x44_24_LINE = r.readBool(nullptr);
break;
case SBIG('LFOT'):
x114_LFOT.read(r);
break;
case SBIG('LIT_'):
2016-02-04 00:55:39 +00:00
x44_29_LIT_ = r.readBool(nullptr);
break;
case SBIG('LTME'):
x34_LTME.read(r);
break;
case SBIG('LSLA'):
x11c_LSLA.read(r);
break;
case SBIG('LTYP'):
x100_LTYP.read(r);
break;
case SBIG('NDSY'):
xb4_NDSY.read(r);
break;
case SBIG('MBSP'):
x48_MBSP.read(r);
break;
case SBIG('MBLR'):
2016-02-04 00:55:39 +00:00
x44_30_MBLR = r.readBool(nullptr);
break;
case SBIG('NCSY'):
x9c_NCSY.read(r);
break;
case SBIG('PISY'):
xc8_PISY.read(r);
break;
case SBIG('OPTS'):
2016-02-04 00:55:39 +00:00
x45_31_OPTS = r.readBool(nullptr);
break;
case SBIG('PMAB'):
2016-02-04 00:55:39 +00:00
x44_31_PMAB = r.readBool(nullptr);
break;
case SBIG('SESD'):
xf8_SESD.read(r);
break;
case SBIG('SEPO'):
xfc_SEPO.read(r);
break;
case SBIG('PSLT'):
xc_PSLT.read(r);
break;
case SBIG('PMSC'):
x74_PMSC.read(r);
break;
case SBIG('PMOP'):
x6c_PMOP.read(r);
break;
case SBIG('PMDL'):
x5c_PMDL.read(r);
break;
case SBIG('PMRT'):
x70_PMRT.read(r);
break;
case SBIG('POFS'):
x18_POFS.read(r);
break;
case SBIG('PMUS'):
2016-02-04 00:55:39 +00:00
x45_24_PMUS = r.readBool(nullptr);
break;
case SBIG('PSIV'):
x0_PSIV.read(r);
break;
case SBIG('ROTA'):
x50_ROTA.read(r);
break;
case SBIG('PSVM'):
x4_PSVM.read(r);
break;
case SBIG('PSTS'):
x14_PSTS.read(r);
break;
case SBIG('PSOV'):
x8_PSOV.read(r);
break;
case SBIG('PSWT'):
x10_PSWT.read(r);
break;
case SBIG('PMLC'):
xec_PMLC.read(r);
break;
case SBIG('PMED'):
x1c_PMED.read(r);
break;
case SBIG('PMOO'):
2016-02-04 00:55:39 +00:00
x45_25_PMOO = r.readBool(nullptr);
break;
case SBIG('SSSD'):
xe4_SSSD.read(r);
break;
case SBIG('SORT'):
2016-02-04 00:55:39 +00:00
x44_28_SORT = r.readBool(nullptr);
break;
case SBIG('SIZE'):
x4c_SIZE.read(r);
break;
case SBIG('SISY'):
xcc_SISY.read(r);
break;
case SBIG('SSPO'):
xe8_SSPO.read(r);
break;
case SBIG('TEXR'):
x54_TEXR.read(r);
break;
case SBIG('SSWH'):
xd4_SSWH.read(r);
break;
case SBIG('TIND'):
x58_TIND.read(r);
break;
case SBIG('VMD4'):
2016-02-04 00:55:39 +00:00
x45_29_VMD4 = r.readBool(nullptr);
break;
case SBIG('VMD3'):
2016-02-04 00:55:39 +00:00
x45_28_VMD3 = r.readBool(nullptr);
break;
case SBIG('VMD2'):
2016-02-04 00:55:39 +00:00
x45_27_VMD2 = r.readBool(nullptr);
break;
case SBIG('VMD1'):
2016-02-04 00:55:39 +00:00
x45_26_VMD1 = r.readBool(nullptr);
break;
case SBIG('VEL4'):
x88_VEL4.read(r);
break;
case SBIG('VEL3'):
x84_VEL3.read(r);
break;
case SBIG('VEL2'):
x80_VEL2.read(r);
break;
case SBIG('VEL1'):
x7c_VEL1.read(r);
break;
case SBIG('ZBUF'):
2016-02-04 00:55:39 +00:00
x44_27_ZBUF = r.readBool(nullptr);
break;
case SBIG('WIDT'):
x24_WIDT.read(r);
break;
case SBIG('ORNT'):
x30_30_ORNT = r.readBool(nullptr);
break;
case SBIG('RSOP'):
2016-02-04 00:55:39 +00:00
x30_31_RSOP = r.readBool(nullptr);
break;
case SBIG('SEED'):
x10_SEED.read(r);
break;
case SBIG('ADV1'):
x10c_ADV1.read(r);
break;
case SBIG('ADV2'):
x110_ADV2.read(r);
break;
case SBIG('ADV3'):
x114_ADV3.read(r);
break;
case SBIG('ADV4'):
x118_ADV4.read(r);
break;
case SBIG('ADV5'):
x11c_ADV5.read(r);
break;
case SBIG('ADV6'):
x120_ADV6.read(r);
break;
case SBIG('ADV7'):
x124_ADV7.read(r);
break;
case SBIG('SELC'):
xd8_SELC.read(r);
break;
default:
break;
}
2016-02-02 04:29:58 +00:00
r.leaveSubRecord();
}
}
void write(Athena::io::YAMLDocWriter& w) const
{
2016-02-04 00:55:39 +00:00
if (x0_PSIV)
{
w.enterSubRecord("PSIV");
x0_PSIV.write(w);
w.leaveSubRecord();
}
if (x4_PSVM)
{
w.enterSubRecord("PSVM");
x4_PSVM.write(w);
w.leaveSubRecord();
}
if (x8_PSOV)
{
w.enterSubRecord("PSOV");
x8_PSOV.write(w);
w.leaveSubRecord();
}
if (xc_PSLT)
{
w.enterSubRecord("PSLT");
xc_PSLT.write(w);
w.leaveSubRecord();
}
if (x10_SEED)
{
w.enterSubRecord("SEED");
x10_SEED.write(w);
w.leaveSubRecord();
}
if (x10_PSWT)
{
w.enterSubRecord("PSWT");
x10_PSWT.write(w);
w.leaveSubRecord();
}
if (x14_PSTS)
{
w.enterSubRecord("PSTS");
x14_PSTS.write(w);
w.leaveSubRecord();
}
if (x18_POFS)
{
w.enterSubRecord("POFS");
x18_POFS.write(w);
w.leaveSubRecord();
}
if (x1c_PMED)
{
w.enterSubRecord("PMED");
x1c_PMED.write(w);
w.leaveSubRecord();
}
if (x20_LENG)
{
w.enterSubRecord("LENG");
x20_LENG.write(w);
w.leaveSubRecord();
}
if (x24_WIDT)
{
w.enterSubRecord("WIDT");
x24_WIDT.write(w);
w.leaveSubRecord();
}
if (x28_MAXP)
{
w.enterSubRecord("MAXP");
x28_MAXP.write(w);
w.leaveSubRecord();
}
if (x2c_GRTE)
{
w.enterSubRecord("GRTE");
x2c_GRTE.write(w);
w.leaveSubRecord();
}
if (x30_COLR)
{
w.enterSubRecord("COLR");
x30_COLR.write(w);
w.leaveSubRecord();
}
if (x34_LTME)
{
w.enterSubRecord("LTME");
x34_LTME.write(w);
w.leaveSubRecord();
}
if (x38_ILOC)
{
w.enterSubRecord("ILOC");
x38_ILOC.write(w);
w.leaveSubRecord();
}
if (x3c_IVEC)
{
w.enterSubRecord("IVEC");
x3c_IVEC.write(w);
w.leaveSubRecord();
}
if (x40_EMTR)
{
w.enterSubRecord("EMTR");
x40_EMTR.write(w);
w.leaveSubRecord();
}
if (x44_24_LINE)
w.writeBool("LINE", true);
if (x44_25_FXLL)
w.writeBool("FXLL", true);
if (x44_26_AAPH)
w.writeBool("AAPH", true);
if (x44_27_ZBUF)
w.writeBool("ZBUF", true);
if (x44_28_SORT)
w.writeBool("SORT", true);
if (x44_29_LIT_)
w.writeBool("LIT_", true);
if (x44_30_MBLR)
w.writeBool("MBLR", true);
if (x44_31_PMAB)
w.writeBool("PMAB", true);
if (x45_24_PMUS)
w.writeBool("PMUS", true);
if (!x45_25_PMOO)
w.writeBool("PMOO", false);
if (x45_26_VMD1)
w.writeBool("VMD1", true);
if (x45_27_VMD2)
w.writeBool("VMD2", true);
if (x45_28_VMD3)
w.writeBool("VMD3", true);
if (x45_29_VMD4)
w.writeBool("VMD4", true);
if (x45_30_CIND)
w.writeBool("CIND", true);
if (x45_31_OPTS)
w.writeBool("OPTS", true);
if (x30_30_ORNT)
w.writeBool("ORNT", true);
if (x30_31_RSOP)
w.writeBool("RSOP", true);
if (x48_MBSP)
{
w.enterSubRecord("MPSB");
x48_MBSP.write(w);
w.leaveSubRecord();
}
if (x4c_SIZE)
{
w.enterSubRecord("SIZE");
x4c_SIZE.write(w);
w.leaveSubRecord();
}
if (x50_ROTA)
{
w.enterSubRecord("ROTA");
x50_ROTA.write(w);
w.leaveSubRecord();
}
if (x54_TEXR)
{
w.enterSubRecord("TEXR");
x54_TEXR.write(w);
w.leaveSubRecord();
}
if (x58_TIND)
{
w.enterSubRecord("TIND");
x58_TIND.write(w);
w.leaveSubRecord();
}
if (x5c_PMDL)
{
w.enterSubRecord("PMDL");
x5c_PMDL.write(w);
w.leaveSubRecord();
}
if (x6c_PMOP)
{
w.enterSubRecord("PMOP");
x6c_PMOP.write(w);
w.leaveSubRecord();
}
if (x70_PMRT)
{
w.enterSubRecord("PMRT");
x70_PMRT.write(w);
w.leaveSubRecord();
}
if (x74_PMSC)
{
w.enterSubRecord("PMSC");
x74_PMSC.write(w);
w.leaveSubRecord();
}
if (x78_PMCL)
{
w.enterSubRecord("PMCL");
x78_PMCL.write(w);
w.leaveSubRecord();
}
if (x7c_VEL1)
{
w.enterSubRecord("VEL1");
x7c_VEL1.write(w);
w.leaveSubRecord();
}
if (x80_VEL2)
{
w.enterSubRecord("VEL2");
x80_VEL2.write(w);
w.leaveSubRecord();
}
if (x84_VEL3)
{
w.enterSubRecord("VEL3");
x84_VEL3.write(w);
w.leaveSubRecord();
}
if (x88_VEL4)
{
w.enterSubRecord("VEL4");
x88_VEL4.write(w);
w.leaveSubRecord();
}
if (x8c_ICTS)
{
w.enterSubRecord("ICTS");
x8c_ICTS.write(w);
w.leaveSubRecord();
}
if (x9c_NCSY)
{
w.enterSubRecord("NCSY");
x9c_NCSY.write(w);
w.leaveSubRecord();
}
if (xa0_CSSD)
{
w.enterSubRecord("CSSD");
xa0_CSSD.write(w);
w.leaveSubRecord();
}
if (xa4_IDTS)
{
w.enterSubRecord("IDTS");
xa4_IDTS.write(w);
w.leaveSubRecord();
}
if (xb4_NDSY)
{
w.enterSubRecord("NDSY");
xb4_NDSY.write(w);
w.leaveSubRecord();
}
if (xb8_IITS)
{
w.enterSubRecord("IITS");
xb8_IITS.write(w);
w.leaveSubRecord();
}
if (xc8_PISY)
{
w.enterSubRecord("PISY");
xc8_PISY.write(w);
w.leaveSubRecord();
}
if (xcc_SISY)
{
w.enterSubRecord("SISY");
xcc_SISY.write(w);
w.leaveSubRecord();
}
if (xd0_KSSM)
{
w.enterSubRecord("KSSM");
xd0_KSSM.write(w);
w.leaveSubRecord();
}
if (xd4_SSWH)
{
w.enterSubRecord("SSWH");
xd4_SSWH.write(w);
w.leaveSubRecord();
}
if (xd8_SELC)
{
w.enterSubRecord("SELC");
xd8_SELC.write(w);
w.leaveSubRecord();
}
if (xe4_SSSD)
{
w.enterSubRecord("SSSD");
xe4_SSSD.write(w);
w.leaveSubRecord();
}
if (xe8_SSPO)
{
w.enterSubRecord("SSPO");
xe8_SSPO.write(w);
w.leaveSubRecord();
}
if (xf8_SESD)
{
w.enterSubRecord("SESD");
xf8_SESD.write(w);
w.leaveSubRecord();
}
if (xfc_SEPO)
{
w.enterSubRecord("SEPO");
xfc_SEPO.write(w);
w.leaveSubRecord();
}
if (xec_PMLC)
{
w.enterSubRecord("PMLC");
xec_PMLC.write(w);
w.leaveSubRecord();
}
if (x100_LTYP)
{
w.enterSubRecord("LTYP");
x100_LTYP.write(w);
w.leaveSubRecord();
}
if (x104_LCLR)
{
w.enterSubRecord("LCLR");
x104_LCLR.write(w);
w.leaveSubRecord();
}
if (x108_LINT)
{
w.enterSubRecord("LINT");
x108_LINT.write(w);
w.leaveSubRecord();
}
if (x10c_LOFF)
{
w.enterSubRecord("LOFF");
x10c_LOFF.write(w);
w.leaveSubRecord();
}
if (x110_LDIR)
{
w.enterSubRecord("LDIR");
x110_LDIR.write(w);
w.leaveSubRecord();
}
if (x114_LFOT)
{
w.enterSubRecord("LFOT");
x114_LFOT.write(w);
w.leaveSubRecord();
}
if (x118_LFOR)
{
w.enterSubRecord("LFOR");
x118_LFOR.write(w);
w.leaveSubRecord();
}
if (x11c_LSLA)
{
w.enterSubRecord("LSLA");
x11c_LSLA.write(w);
w.leaveSubRecord();
}
if (x10c_ADV1)
{
w.enterSubRecord("ADV1");
x10c_ADV1.write(w);
w.leaveSubRecord();
}
if (x110_ADV2)
{
w.enterSubRecord("ADV2");
x110_ADV2.write(w);
w.leaveSubRecord();
}
if (x114_ADV3)
{
w.enterSubRecord("ADV3");
x114_ADV3.write(w);
w.leaveSubRecord();
}
if (x118_ADV4)
{
w.enterSubRecord("ADV4");
x118_ADV4.write(w);
w.leaveSubRecord();
}
if (x11c_ADV5)
{
w.enterSubRecord("ADV5");
x11c_ADV5.write(w);
w.leaveSubRecord();
}
if (x120_ADV6)
{
w.enterSubRecord("ADV6");
x120_ADV6.write(w);
w.leaveSubRecord();
}
if (x124_ADV7)
{
w.enterSubRecord("ADV7");
x124_ADV7.write(w);
w.leaveSubRecord();
}
if (x128_ADV8)
{
w.enterSubRecord("ADV8");
x128_ADV8.write(w);
w.leaveSubRecord();
}
2016-02-02 04:29:58 +00:00
}
size_t binarySize(size_t __isz) const
{
2016-02-04 00:55:39 +00:00
__isz += 4;
if (x0_PSIV)
__isz = x0_PSIV.binarySize(__isz + 4);
if (x4_PSVM)
__isz = x4_PSVM.binarySize(__isz + 4);
if (x8_PSOV)
__isz = x8_PSOV.binarySize(__isz + 4);
if (xc_PSLT)
__isz = xc_PSLT.binarySize(__isz + 4);
if (x10_SEED)
__isz = x10_SEED.binarySize(__isz + 4);
if (x10_PSWT)
__isz = x10_PSWT.binarySize(__isz + 4);
if (x14_PSTS)
__isz = x14_PSTS.binarySize(__isz + 4);
if (x18_POFS)
__isz = x18_POFS.binarySize(__isz + 4);
if (x1c_PMED)
__isz = x1c_PMED.binarySize(__isz + 4);
if (x20_LENG)
__isz = x20_LENG.binarySize(__isz + 4);
if (x24_WIDT)
__isz = x24_WIDT.binarySize(__isz + 4);
if (x28_MAXP)
__isz = x28_MAXP.binarySize(__isz + 4);
if (x2c_GRTE)
__isz = x2c_GRTE.binarySize(__isz + 4);
if (x30_COLR)
__isz = x30_COLR.binarySize(__isz + 4);
if (x34_LTME)
__isz = x34_LTME.binarySize(__isz + 4);
if (x38_ILOC)
__isz = x38_ILOC.binarySize(__isz + 4);
if (x3c_IVEC)
__isz = x3c_IVEC.binarySize(__isz + 4);
if (x40_EMTR)
__isz = x40_EMTR.binarySize(__isz + 4);
if (x44_24_LINE)
__isz += 9;
if (x44_25_FXLL)
__isz += 9;
if (x44_26_AAPH)
__isz += 9;
if (x44_27_ZBUF)
__isz += 9;
if (x44_28_SORT)
__isz += 9;
if (x44_29_LIT_)
__isz += 9;
if (x44_30_MBLR)
__isz += 9;
if (x44_31_PMAB)
__isz += 9;
if (x45_24_PMUS)
__isz += 9;
if (!x45_25_PMOO)
__isz += 9;
if (x45_26_VMD1)
__isz += 9;
if (x45_27_VMD2)
__isz += 9;
if (x45_28_VMD3)
__isz += 9;
if (x45_29_VMD4)
__isz += 9;
if (x45_30_CIND)
__isz += 9;
if (x45_31_OPTS)
__isz += 9;
if (x30_30_ORNT)
__isz += 9;
if (x30_31_RSOP)
__isz += 9;
if (x48_MBSP)
__isz = x48_MBSP.binarySize(__isz + 4);
if (x4c_SIZE)
__isz = x4c_SIZE.binarySize(__isz + 4);
if (x50_ROTA)
__isz = x50_ROTA.binarySize(__isz + 4);
if (x54_TEXR)
__isz = x54_TEXR.binarySize(__isz + 4);
if (x58_TIND)
__isz = x58_TIND.binarySize(__isz + 4);
if (x5c_PMDL)
__isz = x5c_PMDL.binarySize(__isz + 4);
if (x6c_PMOP)
__isz = x6c_PMOP.binarySize(__isz + 4);
if (x70_PMRT)
__isz = x70_PMRT.binarySize(__isz + 4);
if (x74_PMSC)
__isz = x74_PMSC.binarySize(__isz + 4);
if (x78_PMCL)
__isz = x78_PMCL.binarySize(__isz + 4);
if (x7c_VEL1)
__isz = x7c_VEL1.binarySize(__isz + 4);
if (x80_VEL2)
__isz = x80_VEL2.binarySize(__isz + 4);
if (x84_VEL3)
__isz = x84_VEL3.binarySize(__isz + 4);
if (x88_VEL4)
__isz = x88_VEL4.binarySize(__isz + 4);
if (x8c_ICTS)
__isz = x8c_ICTS.binarySize(__isz + 4);
if (x9c_NCSY)
__isz = x9c_NCSY.binarySize(__isz + 4);
if (xa0_CSSD)
__isz = xa0_CSSD.binarySize(__isz + 4);
if (xa4_IDTS)
__isz = xa4_IDTS.binarySize(__isz + 4);
if (xb4_NDSY)
__isz = xb4_NDSY.binarySize(__isz + 4);
if (xb8_IITS)
__isz = xb8_IITS.binarySize(__isz + 4);
if (xc8_PISY)
__isz = xc8_PISY.binarySize(__isz + 4);
if (xcc_SISY)
__isz = xcc_SISY.binarySize(__isz + 4);
if (xd0_KSSM)
__isz = xd0_KSSM.binarySize(__isz + 4);
if (xd4_SSWH)
__isz = xd4_SSWH.binarySize(__isz + 4);
if (xd8_SELC)
__isz = xd8_SELC.binarySize(__isz + 4);
if (xe4_SSSD)
__isz = xe4_SSSD.binarySize(__isz + 4);
if (xe8_SSPO)
__isz = xe8_SSPO.binarySize(__isz + 4);
if (xf8_SESD)
__isz = xf8_SESD.binarySize(__isz + 4);
if (xfc_SEPO)
__isz = xfc_SEPO.binarySize(__isz + 4);
if (xec_PMLC)
__isz = xec_PMLC.binarySize(__isz + 4);
if (x100_LTYP)
__isz = x100_LTYP.binarySize(__isz + 4);
if (x104_LCLR)
__isz = x104_LCLR.binarySize(__isz + 4);
if (x108_LINT)
__isz = x108_LINT.binarySize(__isz + 4);
if (x10c_LOFF)
__isz = x10c_LOFF.binarySize(__isz + 4);
if (x110_LDIR)
__isz = x110_LDIR.binarySize(__isz + 4);
if (x114_LFOT)
__isz = x114_LFOT.binarySize(__isz + 4);
if (x118_LFOR)
__isz = x118_LFOR.binarySize(__isz + 4);
if (x11c_LSLA)
__isz = x11c_LSLA.binarySize(__isz + 4);
if (x10c_ADV1)
__isz = x10c_ADV1.binarySize(__isz + 4);
if (x110_ADV2)
__isz = x110_ADV2.binarySize(__isz + 4);
if (x114_ADV3)
__isz = x114_ADV3.binarySize(__isz + 4);
if (x118_ADV4)
__isz = x118_ADV4.binarySize(__isz + 4);
if (x11c_ADV5)
__isz = x11c_ADV5.binarySize(__isz + 4);
if (x120_ADV6)
__isz = x120_ADV6.binarySize(__isz + 4);
if (x124_ADV7)
__isz = x124_ADV7.binarySize(__isz + 4);
if (x128_ADV8)
__isz = x128_ADV8.binarySize(__isz + 4);
return __isz;
2016-02-02 04:29:58 +00:00
}
void read(Athena::io::IStreamReader& r)
{
uint32_t clsId;
r.readBytesToBuf(&clsId, 4);
if (clsId != SBIG('GPSM'))
{
LogModule.report(LogVisor::Warning, "non GPSM provided to GPSM parser");
return;
}
r.readBytesToBuf(&clsId, 4);
while (clsId != SBIG('_END'))
{
switch (clsId)
{
case SBIG('PMCL'):
x78_PMCL.read(r);
break;
case SBIG('LFOR'):
x118_LFOR.read(r);
break;
case SBIG('IDTS'):
xa4_IDTS.read(r);
break;
case SBIG('EMTR'):
x40_EMTR.read(r);
break;
case SBIG('COLR'):
x30_COLR.read(r);
break;
case SBIG('CIND'):
r.readUint32Big();
2016-02-04 00:55:39 +00:00
x45_30_CIND = r.readBool();
break;
case SBIG('AAPH'):
r.readUint32Big();
2016-02-04 00:55:39 +00:00
x44_26_AAPH = r.readBool();
break;
case SBIG('CSSD'):
xa0_CSSD.read(r);
break;
case SBIG('GRTE'):
x2c_GRTE.read(r);
break;
case SBIG('FXLL'):
r.readUint32Big();
2016-02-04 00:55:39 +00:00
x44_25_FXLL = r.readBool();
break;
case SBIG('ICTS'):
x8c_ICTS.read(r);
break;
case SBIG('KSSM'):
xd0_KSSM.read(r);
break;
case SBIG('ILOC'):
x38_ILOC.read(r);
break;
case SBIG('IITS'):
2016-02-04 00:55:39 +00:00
xb8_IITS.read(r);
break;
case SBIG('IVEC'):
x3c_IVEC.read(r);
break;
case SBIG('LDIR'):
x110_LDIR.read(r);
break;
case SBIG('LCLR'):
x104_LCLR.read(r);
break;
case SBIG('LENG'):
x20_LENG.read(r);
break;
case SBIG('MAXP'):
x28_MAXP.read(r);
break;
case SBIG('LOFF'):
x10c_LOFF.read(r);
break;
case SBIG('LINT'):
x108_LINT.read(r);
break;
case SBIG('LINE'):
r.readUint32Big();
2016-02-04 00:55:39 +00:00
x44_24_LINE = r.readBool();
break;
case SBIG('LFOT'):
x114_LFOT.read(r);
break;
case SBIG('LIT_'):
r.readUint32Big();
2016-02-04 00:55:39 +00:00
x44_29_LIT_ = r.readBool();
break;
case SBIG('LTME'):
x34_LTME.read(r);
break;
case SBIG('LSLA'):
x11c_LSLA.read(r);
break;
case SBIG('LTYP'):
x100_LTYP.read(r);
break;
case SBIG('NDSY'):
xb4_NDSY.read(r);
break;
case SBIG('MBSP'):
x48_MBSP.read(r);
break;
case SBIG('MBLR'):
r.readUint32Big();
2016-02-04 00:55:39 +00:00
x44_30_MBLR = r.readBool();
break;
case SBIG('NCSY'):
x9c_NCSY.read(r);
break;
case SBIG('PISY'):
xc8_PISY.read(r);
break;
case SBIG('OPTS'):
r.readUint32Big();
2016-02-04 00:55:39 +00:00
x45_31_OPTS = r.readBool();
break;
case SBIG('PMAB'):
r.readUint32Big();
2016-02-04 00:55:39 +00:00
x44_31_PMAB = r.readBool();
break;
case SBIG('SESD'):
xf8_SESD.read(r);
break;
case SBIG('SEPO'):
xfc_SEPO.read(r);
break;
case SBIG('PSLT'):
xc_PSLT.read(r);
break;
case SBIG('PMSC'):
x74_PMSC.read(r);
break;
case SBIG('PMOP'):
x6c_PMOP.read(r);
break;
case SBIG('PMDL'):
x5c_PMDL.read(r);
break;
case SBIG('PMRT'):
x70_PMRT.read(r);
break;
case SBIG('POFS'):
x18_POFS.read(r);
break;
case SBIG('PMUS'):
r.readUint32Big();
2016-02-04 00:55:39 +00:00
x45_24_PMUS = r.readBool();
break;
case SBIG('PSIV'):
x0_PSIV.read(r);
break;
case SBIG('ROTA'):
x50_ROTA.read(r);
break;
case SBIG('PSVM'):
x4_PSVM.read(r);
break;
case SBIG('PSTS'):
x14_PSTS.read(r);
break;
case SBIG('PSOV'):
x8_PSOV.read(r);
break;
case SBIG('PSWT'):
x10_PSWT.read(r);
break;
case SBIG('PMLC'):
xec_PMLC.read(r);
break;
case SBIG('PMED'):
x1c_PMED.read(r);
break;
case SBIG('PMOO'):
r.readUint32Big();
2016-02-04 00:55:39 +00:00
x45_25_PMOO = r.readBool();
break;
case SBIG('SSSD'):
xe4_SSSD.read(r);
break;
case SBIG('SORT'):
r.readUint32Big();
2016-02-04 00:55:39 +00:00
x44_28_SORT = r.readBool();
break;
case SBIG('SIZE'):
x4c_SIZE.read(r);
break;
case SBIG('SISY'):
xcc_SISY.read(r);
break;
case SBIG('SSPO'):
xe8_SSPO.read(r);
break;
case SBIG('TEXR'):
x54_TEXR.read(r);
break;
case SBIG('SSWH'):
xd4_SSWH.read(r);
break;
case SBIG('TIND'):
x58_TIND.read(r);
break;
case SBIG('VMD4'):
r.readUint32Big();
2016-02-04 00:55:39 +00:00
x45_29_VMD4 = r.readBool();
break;
case SBIG('VMD3'):
r.readUint32Big();
2016-02-04 00:55:39 +00:00
x45_28_VMD3 = r.readBool();
break;
case SBIG('VMD2'):
r.readUint32Big();
2016-02-04 00:55:39 +00:00
x45_27_VMD2 = r.readBool();
break;
case SBIG('VMD1'):
r.readUint32Big();
2016-02-04 00:55:39 +00:00
x45_26_VMD1 = r.readBool();
break;
case SBIG('VEL4'):
x88_VEL4.read(r);
break;
case SBIG('VEL3'):
x84_VEL3.read(r);
break;
case SBIG('VEL2'):
x80_VEL2.read(r);
break;
case SBIG('VEL1'):
x7c_VEL1.read(r);
break;
case SBIG('ZBUF'):
r.readUint32Big();
2016-02-04 00:55:39 +00:00
x44_27_ZBUF = r.readBool();
break;
case SBIG('WIDT'):
x24_WIDT.read(r);
break;
case SBIG('ORNT'):
r.readUint32Big();
x30_30_ORNT = r.readBool();
break;
case SBIG('RSOP'):
r.readUint32Big();
2016-02-04 00:55:39 +00:00
x30_31_RSOP = r.readBool();
break;
case SBIG('SEED'):
x10_SEED.read(r);
break;
case SBIG('ADV1'):
x10c_ADV1.read(r);
break;
case SBIG('ADV2'):
x110_ADV2.read(r);
break;
case SBIG('ADV3'):
x114_ADV3.read(r);
break;
case SBIG('ADV4'):
x118_ADV4.read(r);
break;
case SBIG('ADV5'):
x11c_ADV5.read(r);
break;
case SBIG('ADV6'):
x120_ADV6.read(r);
break;
case SBIG('ADV7'):
x124_ADV7.read(r);
break;
case SBIG('ADV8'):
x128_ADV8.read(r);
break;
case SBIG('SELC'):
xd8_SELC.read(r);
break;
default:
2016-02-04 00:55:39 +00:00
LogModule.report(LogVisor::FatalError, "Unknown GPSM class %.4s @%" PRIi64, &clsId, r.position());
break;
}
r.readBytesToBuf(&clsId, 4);
}
2016-02-02 04:29:58 +00:00
}
void write(Athena::io::IStreamWriter& w) const
{
2016-02-04 00:55:39 +00:00
w.writeBytes((atInt8*)"GPSM", 4);
if (x0_PSIV)
{
w.writeBytes((atInt8*)"PSIV", 4);
x0_PSIV.write(w);
}
if (x4_PSVM)
{
w.writeBytes((atInt8*)"PSVM", 4);
x4_PSVM.write(w);
}
if (x8_PSOV)
{
w.writeBytes((atInt8*)"PSOV", 4);
x8_PSOV.write(w);
}
if (xc_PSLT)
{
w.writeBytes((atInt8*)"PSLT", 4);
xc_PSLT.write(w);
}
if (x10_SEED)
{
w.writeBytes((atInt8*)"SEED", 4);
x10_SEED.write(w);
}
if (x10_PSWT)
{
w.writeBytes((atInt8*)"PSWT", 4);
x10_PSWT.write(w);
}
if (x14_PSTS)
{
w.writeBytes((atInt8*)"PSTS", 4);
x14_PSTS.write(w);
}
if (x18_POFS)
{
w.writeBytes((atInt8*)"POFS", 4);
x18_POFS.write(w);
}
if (x1c_PMED)
{
w.writeBytes((atInt8*)"PMED", 4);
x1c_PMED.write(w);
}
if (x20_LENG)
{
w.writeBytes((atInt8*)"LENG", 4);
x20_LENG.write(w);
}
if (x24_WIDT)
{
w.writeBytes((atInt8*)"WIDT", 4);
x24_WIDT.write(w);
}
if (x28_MAXP)
{
w.writeBytes((atInt8*)"MAXP", 4);
x28_MAXP.write(w);
}
if (x2c_GRTE)
{
w.writeBytes((atInt8*)"GRTE", 4);
x2c_GRTE.write(w);
}
if (x30_COLR)
{
w.writeBytes((atInt8*)"COLR", 4);
x30_COLR.write(w);
}
if (x34_LTME)
{
w.writeBytes((atInt8*)"LTME", 4);
x34_LTME.write(w);
}
if (x38_ILOC)
{
w.writeBytes((atInt8*)"ILOC", 4);
x38_ILOC.write(w);
}
if (x3c_IVEC)
{
w.writeBytes((atInt8*)"IVEC", 4);
x3c_IVEC.write(w);
}
if (x40_EMTR)
{
w.writeBytes((atInt8*)"EMTR", 4);
x40_EMTR.write(w);
}
if (x44_24_LINE)
{
w.writeBytes((atInt8*)"LINECNST\x01", 9);
}
if (x44_25_FXLL)
{
w.writeBytes((atInt8*)"FXLLCNST\x01", 9);
}
if (x44_26_AAPH)
{
w.writeBytes((atInt8*)"AAPHCNST\x01", 9);
}
if (x44_27_ZBUF)
{
w.writeBytes((atInt8*)"ZBUFCNST\x01", 9);
}
if (x44_28_SORT)
{
w.writeBytes((atInt8*)"SORTCNST\x01", 9);
}
if (x44_29_LIT_)
{
w.writeBytes((atInt8*)"LIT_CNST\x01", 9);
}
if (x44_30_MBLR)
{
w.writeBytes((atInt8*)"MBLRCNST\x01", 9);
}
if (x44_31_PMAB)
{
w.writeBytes((atInt8*)"PMABCNST\x01", 9);
}
if (x45_24_PMUS)
{
w.writeBytes((atInt8*)"PMUSCNST\x01", 9);
}
if (!x45_25_PMOO)
{
w.writeBytes((atInt8*)"PMOOCNST\x00", 9);
}
if (x45_26_VMD1)
{
w.writeBytes((atInt8*)"VMD1CNST\x01", 9);
}
if (x45_27_VMD2)
{
w.writeBytes((atInt8*)"VMD2CNST\x01", 9);
}
if (x45_28_VMD3)
{
w.writeBytes((atInt8*)"VMD3CNST\x01", 9);
}
if (x45_29_VMD4)
{
w.writeBytes((atInt8*)"VMD4CNST\x01", 9);
}
if (x45_30_CIND)
{
w.writeBytes((atInt8*)"CINDCNST\x01", 9);
}
if (x45_31_OPTS)
{
w.writeBytes((atInt8*)"OPTSCNST\x01", 9);
}
if (x30_30_ORNT)
{
w.writeBytes((atInt8*)"ORNTCNST\x01", 9);
}
if (x30_31_RSOP)
{
w.writeBytes((atInt8*)"RSOPCNST\x01", 9);
}
if (x48_MBSP)
{
w.writeBytes((atInt8*)"MBSP", 4);
x48_MBSP.write(w);
}
if (x4c_SIZE)
{
w.writeBytes((atInt8*)"SIZE", 4);
x4c_SIZE.write(w);
}
if (x50_ROTA)
{
w.writeBytes((atInt8*)"ROTA", 4);
x50_ROTA.write(w);
}
if (x54_TEXR)
{
w.writeBytes((atInt8*)"TEXR", 4);
x54_TEXR.write(w);
}
if (x58_TIND)
{
w.writeBytes((atInt8*)"TIND", 4);
x58_TIND.write(w);
}
if (x5c_PMDL)
{
w.writeBytes((atInt8*)"PMDL", 4);
x5c_PMDL.write(w);
}
if (x6c_PMOP)
{
w.writeBytes((atInt8*)"PMOP", 4);
x6c_PMOP.write(w);
}
if (x70_PMRT)
{
w.writeBytes((atInt8*)"PMRT", 4);
x70_PMRT.write(w);
}
if (x74_PMSC)
{
w.writeBytes((atInt8*)"PMSC", 4);
x74_PMSC.write(w);
}
if (x78_PMCL)
{
w.writeBytes((atInt8*)"PMCL", 4);
x78_PMCL.write(w);
}
if (x7c_VEL1)
{
w.writeBytes((atInt8*)"VEL1", 4);
x7c_VEL1.write(w);
}
if (x80_VEL2)
{
w.writeBytes((atInt8*)"VEL2", 4);
x80_VEL2.write(w);
}
if (x84_VEL3)
{
w.writeBytes((atInt8*)"VEL3", 4);
x84_VEL3.write(w);
}
if (x88_VEL4)
{
w.writeBytes((atInt8*)"VEL4", 4);
x88_VEL4.write(w);
}
if (x8c_ICTS)
{
w.writeBytes((atInt8*)"ICTS", 4);
x8c_ICTS.write(w);
}
if (x9c_NCSY)
{
w.writeBytes((atInt8*)"NCSY", 4);
x9c_NCSY.write(w);
}
if (xa0_CSSD)
{
w.writeBytes((atInt8*)"CSSD", 4);
xa0_CSSD.write(w);
}
if (xa4_IDTS)
{
w.writeBytes((atInt8*)"IDTS", 4);
xa4_IDTS.write(w);
}
if (xb4_NDSY)
{
w.writeBytes((atInt8*)"NDSY", 4);
xb4_NDSY.write(w);
}
if (xb8_IITS)
{
w.writeBytes((atInt8*)"IITS", 4);
xb8_IITS.write(w);
}
if (xc8_PISY)
{
w.writeBytes((atInt8*)"PISY", 4);
xc8_PISY.write(w);
}
if (xcc_SISY)
{
w.writeBytes((atInt8*)"SISY", 4);
xcc_SISY.write(w);
}
if (xd0_KSSM)
{
w.writeBytes((atInt8*)"KSSM", 4);
xd0_KSSM.write(w);
}
if (xd4_SSWH)
{
w.writeBytes((atInt8*)"SSWH", 4);
xd4_SSWH.write(w);
}
if (xd8_SELC)
{
w.writeBytes((atInt8*)"SELC", 4);
xd8_SELC.write(w);
}
if (xe4_SSSD)
{
w.writeBytes((atInt8*)"SSSD", 4);
xe4_SSSD.write(w);
}
if (xe8_SSPO)
{
w.writeBytes((atInt8*)"SSPO", 4);
xe8_SSPO.write(w);
}
if (xf8_SESD)
{
w.writeBytes((atInt8*)"SESD", 4);
xf8_SESD.write(w);
}
if (xfc_SEPO)
{
w.writeBytes((atInt8*)"SEPO", 4);
xfc_SEPO.write(w);
}
if (xec_PMLC)
{
w.writeBytes((atInt8*)"PMLC", 4);
xec_PMLC.write(w);
}
if (x100_LTYP)
{
w.writeBytes((atInt8*)"LTYP", 4);
x100_LTYP.write(w);
}
if (x104_LCLR)
{
w.writeBytes((atInt8*)"LCLR", 4);
x104_LCLR.write(w);
}
if (x108_LINT)
{
w.writeBytes((atInt8*)"LINT", 4);
x108_LINT.write(w);
}
if (x10c_LOFF)
{
w.writeBytes((atInt8*)"LOFF", 4);
x10c_LOFF.write(w);
}
if (x110_LDIR)
{
w.writeBytes((atInt8*)"LDIR", 4);
x110_LDIR.write(w);
}
if (x114_LFOT)
{
w.writeBytes((atInt8*)"LFOT", 4);
x114_LFOT.write(w);
}
if (x118_LFOR)
{
w.writeBytes((atInt8*)"LFOR", 4);
x118_LFOR.write(w);
}
if (x11c_LSLA)
{
w.writeBytes((atInt8*)"LSLA", 4);
x11c_LSLA.write(w);
}
if (x10c_ADV1)
{
w.writeBytes((atInt8*)"ADV1", 4);
x10c_ADV1.write(w);
}
if (x110_ADV2)
{
w.writeBytes((atInt8*)"ADV2", 4);
x110_ADV2.write(w);
}
if (x114_ADV3)
{
w.writeBytes((atInt8*)"ADV3", 4);
x114_ADV3.write(w);
}
if (x118_ADV4)
{
w.writeBytes((atInt8*)"ADV4", 4);
x118_ADV4.write(w);
}
if (x11c_ADV5)
{
w.writeBytes((atInt8*)"ADV5", 4);
x11c_ADV5.write(w);
}
if (x120_ADV6)
{
w.writeBytes((atInt8*)"ADV6", 4);
x120_ADV6.write(w);
}
if (x124_ADV7)
{
w.writeBytes((atInt8*)"ADV7", 4);
x124_ADV7.write(w);
}
if (x128_ADV8)
{
w.writeBytes((atInt8*)"ADV8", 4);
x128_ADV8.write(w);
}
2016-02-02 04:29:58 +00:00
}
};
template <class IDType>
bool ExtractGPSM(PAKEntryReadStream& rs, const HECL::ProjectPath& outPath)
{
FILE* fp = HECL::Fopen(outPath.getAbsolutePath().c_str(), _S("w"));
if (fp)
{
GPSM<IDType> gpsm;
gpsm.read(rs);
gpsm.toYAMLFile(fp);
fclose(fp);
return true;
}
return false;
}
2016-02-04 00:55:39 +00:00
template <class IDType>
bool WriteGPSM(const GPSM<IDType>& gpsm, const HECL::ProjectPath& outPath)
{
Athena::io::FileWriter w(outPath.getAbsolutePath(), true, false);
if (w.hasError())
return false;
gpsm.write(w);
int64_t rem = w.position() % 32;
if (rem)
for (int64_t i=0 ; i<32-rem ; ++i)
w.writeBytes((atInt8*)"\xff", 1);
return true;
}
2016-02-02 04:29:58 +00:00
}
}
#endif // __COMMON_PART_HPP__