From a6ed8ae247e818b0366cd8503737818f5ec003bb Mon Sep 17 00:00:00 2001 From: Jack Andersen Date: Wed, 3 Feb 2016 14:55:39 -1000 Subject: [PATCH] All MP1 PARTs reading --- DataSpec/DNACommon/PART.hpp | 1171 ++++++++++++++++++++++++- DataSpec/DNACommon/ParticleCommon.cpp | 210 +++++ DataSpec/DNACommon/ParticleCommon.hpp | 433 ++++++++- DataSpec/DNAMP1/DNAMP1.cpp | 4 +- hecl | 2 +- 5 files changed, 1755 insertions(+), 65 deletions(-) diff --git a/DataSpec/DNACommon/PART.hpp b/DataSpec/DNACommon/PART.hpp index 62467a0d0..660ea6f77 100644 --- a/DataSpec/DNACommon/PART.hpp +++ b/DataSpec/DNACommon/PART.hpp @@ -3,6 +3,7 @@ #include "ParticleCommon.hpp" #include "PAK.hpp" +#include "Athena/FileWriter.hpp" namespace Retro { @@ -32,10 +33,17 @@ struct GPSM : BigYAML VectorElementFactory x38_ILOC; VectorElementFactory x3c_IVEC; EmitterElementFactory x40_EMTR; - bool x44_0_SORT : 1; bool x44_1_MBLR : 1; bool x44_2_LINE : 1; bool x44_3_LIT_ : 1; - bool x44_4_AAPH : 1; bool x44_5_ZBUF : 1; bool x44_6_FXLL : 1; bool x44_7_PMAB : 1; - bool x45_0_VMD4 : 1; bool x45_1_VMD3 : 1; bool x45_2_VMD2 : 1; bool x45_3_VMD1 : 1; - bool x45_4_OPTS : 1; bool x45_5_PMUS : 1; bool x45_6_PMOO : 1; bool x45_7_CIND : 1; + 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; + }; IntElementFactory x48_MBSP; RealElementFactory x4c_SIZE; RealElementFactory x50_ROTA; @@ -52,10 +60,10 @@ struct GPSM : BigYAML ModVectorElementFactory x88_VEL4; ChildResourceFactory x8c_ICTS; IntElementFactory x9c_NCSY; - IntElementFactory xb4_NDSY; - ChildResourceFactory xb8_IITS; IntElementFactory xa0_CSSD; ChildResourceFactory xa4_IDTS; + IntElementFactory xb4_NDSY; + ChildResourceFactory xb8_IITS; IntElementFactory xc8_PISY; IntElementFactory xcc_SISY; SpawnSystemKeyframeData xd0_KSSM; @@ -75,8 +83,30 @@ struct GPSM : BigYAML RealElementFactory x11c_LSLA; /* 0-00 additions */ - bool x30_30_ORNT : 1; - bool xUNK_RSOP : 1; + IntElementFactory x10_SEED; + ChildResourceFactory 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; + } void read(Athena::io::YAMLDocReader& r) { @@ -107,10 +137,10 @@ struct GPSM : BigYAML x30_COLR.read(r); break; case SBIG('CIND'): - x45_7_CIND = r.readBool(nullptr); + x45_30_CIND = r.readBool(nullptr); break; case SBIG('AAPH'): - x44_4_AAPH = r.readBool(nullptr); + x44_26_AAPH = r.readBool(nullptr); break; case SBIG('CSSD'): xa0_CSSD.read(r); @@ -119,7 +149,7 @@ struct GPSM : BigYAML x2c_GRTE.read(r); break; case SBIG('FXLL'): - x44_6_FXLL = r.readBool(nullptr); + x44_25_FXLL = r.readBool(nullptr); break; case SBIG('ICTS'): x8c_ICTS.read(r); @@ -131,6 +161,7 @@ struct GPSM : BigYAML x38_ILOC.read(r); break; case SBIG('IITS'): + xb8_IITS.read(r); break; case SBIG('IVEC'): x3c_IVEC.read(r); @@ -154,13 +185,13 @@ struct GPSM : BigYAML x108_LINT.read(r); break; case SBIG('LINE'): - x44_2_LINE = r.readBool(nullptr); + x44_24_LINE = r.readBool(nullptr); break; case SBIG('LFOT'): x114_LFOT.read(r); break; case SBIG('LIT_'): - x44_3_LIT_ = r.readBool(nullptr); + x44_29_LIT_ = r.readBool(nullptr); break; case SBIG('LTME'): x34_LTME.read(r); @@ -178,7 +209,7 @@ struct GPSM : BigYAML x48_MBSP.read(r); break; case SBIG('MBLR'): - x44_1_MBLR = r.readBool(nullptr); + x44_30_MBLR = r.readBool(nullptr); break; case SBIG('NCSY'): x9c_NCSY.read(r); @@ -187,10 +218,10 @@ struct GPSM : BigYAML xc8_PISY.read(r); break; case SBIG('OPTS'): - x45_4_OPTS = r.readBool(nullptr); + x45_31_OPTS = r.readBool(nullptr); break; case SBIG('PMAB'): - x44_7_PMAB = r.readBool(nullptr); + x44_31_PMAB = r.readBool(nullptr); break; case SBIG('SESD'): xf8_SESD.read(r); @@ -217,7 +248,7 @@ struct GPSM : BigYAML x18_POFS.read(r); break; case SBIG('PMUS'): - x45_5_PMUS = r.readBool(nullptr); + x45_24_PMUS = r.readBool(nullptr); break; case SBIG('PSIV'): x0_PSIV.read(r); @@ -244,13 +275,13 @@ struct GPSM : BigYAML x1c_PMED.read(r); break; case SBIG('PMOO'): - x45_6_PMOO = r.readBool(nullptr); + x45_25_PMOO = r.readBool(nullptr); break; case SBIG('SSSD'): xe4_SSSD.read(r); break; case SBIG('SORT'): - x44_0_SORT = r.readBool(nullptr); + x44_28_SORT = r.readBool(nullptr); break; case SBIG('SIZE'): x4c_SIZE.read(r); @@ -271,16 +302,16 @@ struct GPSM : BigYAML x58_TIND.read(r); break; case SBIG('VMD4'): - x45_0_VMD4 = r.readBool(nullptr); + x45_29_VMD4 = r.readBool(nullptr); break; case SBIG('VMD3'): - x45_1_VMD3 = r.readBool(nullptr); + x45_28_VMD3 = r.readBool(nullptr); break; case SBIG('VMD2'): - x45_2_VMD2 = r.readBool(nullptr); + x45_27_VMD2 = r.readBool(nullptr); break; case SBIG('VMD1'): - x45_3_VMD1 = r.readBool(nullptr); + x45_26_VMD1 = r.readBool(nullptr); break; case SBIG('VEL4'): x88_VEL4.read(r); @@ -295,7 +326,7 @@ struct GPSM : BigYAML x7c_VEL1.read(r); break; case SBIG('ZBUF'): - x44_5_ZBUF = r.readBool(nullptr); + x44_27_ZBUF = r.readBool(nullptr); break; case SBIG('WIDT'): x24_WIDT.read(r); @@ -304,7 +335,34 @@ struct GPSM : BigYAML x30_30_ORNT = r.readBool(nullptr); break; case SBIG('RSOP'): - xUNK_RSOP = r.readBool(nullptr); + 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; @@ -314,11 +372,594 @@ struct GPSM : BigYAML } void write(Athena::io::YAMLDocWriter& w) const { - + 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(); + } } size_t binarySize(size_t __isz) const { - /* TODO: Figure out order of emitting */ + __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; } void read(Athena::io::IStreamReader& r) @@ -352,11 +993,11 @@ struct GPSM : BigYAML break; case SBIG('CIND'): r.readUint32Big(); - x45_7_CIND = r.readBool(); + x45_30_CIND = r.readBool(); break; case SBIG('AAPH'): r.readUint32Big(); - x44_4_AAPH = r.readBool(); + x44_26_AAPH = r.readBool(); break; case SBIG('CSSD'): xa0_CSSD.read(r); @@ -366,7 +1007,7 @@ struct GPSM : BigYAML break; case SBIG('FXLL'): r.readUint32Big(); - x44_6_FXLL = r.readBool(); + x44_25_FXLL = r.readBool(); break; case SBIG('ICTS'): x8c_ICTS.read(r); @@ -378,6 +1019,7 @@ struct GPSM : BigYAML x38_ILOC.read(r); break; case SBIG('IITS'): + xb8_IITS.read(r); break; case SBIG('IVEC'): x3c_IVEC.read(r); @@ -402,14 +1044,14 @@ struct GPSM : BigYAML break; case SBIG('LINE'): r.readUint32Big(); - x44_2_LINE = r.readBool(); + x44_24_LINE = r.readBool(); break; case SBIG('LFOT'): x114_LFOT.read(r); break; case SBIG('LIT_'): r.readUint32Big(); - x44_3_LIT_ = r.readBool(); + x44_29_LIT_ = r.readBool(); break; case SBIG('LTME'): x34_LTME.read(r); @@ -428,7 +1070,7 @@ struct GPSM : BigYAML break; case SBIG('MBLR'): r.readUint32Big(); - x44_1_MBLR = r.readBool(); + x44_30_MBLR = r.readBool(); break; case SBIG('NCSY'): x9c_NCSY.read(r); @@ -438,11 +1080,11 @@ struct GPSM : BigYAML break; case SBIG('OPTS'): r.readUint32Big(); - x45_4_OPTS = r.readBool(); + x45_31_OPTS = r.readBool(); break; case SBIG('PMAB'): r.readUint32Big(); - x44_7_PMAB = r.readBool(); + x44_31_PMAB = r.readBool(); break; case SBIG('SESD'): xf8_SESD.read(r); @@ -470,7 +1112,7 @@ struct GPSM : BigYAML break; case SBIG('PMUS'): r.readUint32Big(); - x45_5_PMUS = r.readBool(); + x45_24_PMUS = r.readBool(); break; case SBIG('PSIV'): x0_PSIV.read(r); @@ -498,14 +1140,14 @@ struct GPSM : BigYAML break; case SBIG('PMOO'): r.readUint32Big(); - x45_6_PMOO = r.readBool(); + x45_25_PMOO = r.readBool(); break; case SBIG('SSSD'): xe4_SSSD.read(r); break; case SBIG('SORT'): r.readUint32Big(); - x44_0_SORT = r.readBool(); + x44_28_SORT = r.readBool(); break; case SBIG('SIZE'): x4c_SIZE.read(r); @@ -527,19 +1169,19 @@ struct GPSM : BigYAML break; case SBIG('VMD4'): r.readUint32Big(); - x45_0_VMD4 = r.readBool(); + x45_29_VMD4 = r.readBool(); break; case SBIG('VMD3'): r.readUint32Big(); - x45_1_VMD3 = r.readBool(); + x45_28_VMD3 = r.readBool(); break; case SBIG('VMD2'): r.readUint32Big(); - x45_2_VMD2 = r.readBool(); + x45_27_VMD2 = r.readBool(); break; case SBIG('VMD1'): r.readUint32Big(); - x45_3_VMD1 = r.readBool(); + x45_26_VMD1 = r.readBool(); break; case SBIG('VEL4'): x88_VEL4.read(r); @@ -555,7 +1197,7 @@ struct GPSM : BigYAML break; case SBIG('ZBUF'): r.readUint32Big(); - x44_5_ZBUF = r.readBool(); + x44_27_ZBUF = r.readBool(); break; case SBIG('WIDT'): x24_WIDT.read(r); @@ -566,11 +1208,40 @@ struct GPSM : BigYAML break; case SBIG('RSOP'): r.readUint32Big(); - xUNK_RSOP = r.readBool(); + 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: - LogModule.report(LogVisor::Warning, "Unknown GPSM class %.4s @%" PRIi64, &clsId, r.position()); - printf(""); + LogModule.report(LogVisor::FatalError, "Unknown GPSM class %.4s @%" PRIi64, &clsId, r.position()); break; } r.readBytesToBuf(&clsId, 4); @@ -578,7 +1249,399 @@ struct GPSM : BigYAML } void write(Athena::io::IStreamWriter& w) const { - + 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); + } } }; @@ -597,6 +1660,20 @@ bool ExtractGPSM(PAKEntryReadStream& rs, const HECL::ProjectPath& outPath) return false; } +template +bool WriteGPSM(const GPSM& 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; +} + } } diff --git a/DataSpec/DNACommon/ParticleCommon.cpp b/DataSpec/DNACommon/ParticleCommon.cpp index e4f142858..a6afb1150 100644 --- a/DataSpec/DNACommon/ParticleCommon.cpp +++ b/DataSpec/DNACommon/ParticleCommon.cpp @@ -61,6 +61,69 @@ void RealElementFactory::read(Athena::io::YAMLDocReader& r) case SBIG('SINE'): m_elem.reset(new struct RESineWave); break; + case SBIG('ISWT'): + m_elem.reset(new struct REISWT); + break; + case SBIG('CLTN'): + m_elem.reset(new struct RECompareLessThan); + break; + case SBIG('CEQL'): + m_elem.reset(new struct RECompareEquals); + break; + case SBIG('PAP1'): + m_elem.reset(new struct REParticleAccessParam1); + break; + case SBIG('PAP2'): + m_elem.reset(new struct REParticleAccessParam2); + break; + case SBIG('PAP3'): + m_elem.reset(new struct REParticleAccessParam3); + break; + case SBIG('PAP4'): + m_elem.reset(new struct REParticleAccessParam4); + break; + case SBIG('PAP5'): + m_elem.reset(new struct REParticleAccessParam5); + break; + case SBIG('PAP6'): + m_elem.reset(new struct REParticleAccessParam6); + break; + case SBIG('PAP7'): + m_elem.reset(new struct REParticleAccessParam7); + break; + case SBIG('PAP8'): + m_elem.reset(new struct REParticleAccessParam8); + break; + case SBIG('PSLL'): + m_elem.reset(new struct REPSLL); + break; + case SBIG('PRLW'): + m_elem.reset(new struct REPRLW); + break; + case SBIG('PSOF'): + m_elem.reset(new struct REPSOF); + break; + case SBIG('SUB_'): + m_elem.reset(new struct RESubtract); + break; + case SBIG('VMAG'): + m_elem.reset(new struct REVectorMagnitude); + break; + case SBIG('VXTR'): + m_elem.reset(new struct REVectorXToReal); + break; + case SBIG('VYTR'): + m_elem.reset(new struct REVectorYToReal); + break; + case SBIG('VZTR'): + m_elem.reset(new struct REVectorZToReal); + break; + case SBIG('CEXT'): + m_elem.reset(new struct RECEXT); + break; + case SBIG('ITRL'): + m_elem.reset(new struct REITRL); + break; default: m_elem.reset(); return; @@ -134,8 +197,75 @@ void RealElementFactory::read(Athena::io::IStreamReader& r) case SBIG('SINE'): m_elem.reset(new struct RESineWave); break; + case SBIG('ISWT'): + m_elem.reset(new struct REISWT); + break; + case SBIG('CLTN'): + m_elem.reset(new struct RECompareLessThan); + break; + case SBIG('CEQL'): + m_elem.reset(new struct RECompareEquals); + break; + case SBIG('PAP1'): + m_elem.reset(new struct REParticleAccessParam1); + break; + case SBIG('PAP2'): + m_elem.reset(new struct REParticleAccessParam2); + break; + case SBIG('PAP3'): + m_elem.reset(new struct REParticleAccessParam3); + break; + case SBIG('PAP4'): + m_elem.reset(new struct REParticleAccessParam4); + break; + case SBIG('PAP5'): + m_elem.reset(new struct REParticleAccessParam5); + break; + case SBIG('PAP6'): + m_elem.reset(new struct REParticleAccessParam6); + break; + case SBIG('PAP7'): + m_elem.reset(new struct REParticleAccessParam7); + break; + case SBIG('PAP8'): + m_elem.reset(new struct REParticleAccessParam8); + break; + case SBIG('PSLL'): + m_elem.reset(new struct REPSLL); + break; + case SBIG('PRLW'): + m_elem.reset(new struct REPRLW); + break; + case SBIG('PSOF'): + m_elem.reset(new struct REPSOF); + break; + case SBIG('SUB_'): + m_elem.reset(new struct RESubtract); + break; + case SBIG('VMAG'): + m_elem.reset(new struct REVectorMagnitude); + break; + case SBIG('VXTR'): + m_elem.reset(new struct REVectorXToReal); + break; + case SBIG('VYTR'): + m_elem.reset(new struct REVectorYToReal); + break; + case SBIG('VZTR'): + m_elem.reset(new struct REVectorZToReal); + break; + case SBIG('CEXT'): + m_elem.reset(new struct RECEXT); + break; + case SBIG('ITRL'): + m_elem.reset(new struct REITRL); + break; + case SBIG('NONE'): + m_elem.reset(); + return; default: m_elem.reset(); + LogModule.report(LogVisor::FatalError, "Unknown RealElement class %.4s @%" PRIi64, &clsId, r.position()); return; } m_elem->read(r); @@ -211,6 +341,15 @@ void IntElementFactory::read(Athena::io::YAMLDocReader& r) case SBIG('TSCL'): m_elem.reset(new struct IETimeScale); break; + case SBIG('GTCP'): + m_elem.reset(new struct IEGTCP); + break; + case SBIG('MODU'): + m_elem.reset(new struct IEModulo); + break; + case SBIG('SUB_'): + m_elem.reset(new struct IESubtract); + break; default: m_elem.reset(); return; @@ -287,8 +426,21 @@ void IntElementFactory::read(Athena::io::IStreamReader& r) case SBIG('TSCL'): m_elem.reset(new struct IETimeScale); break; + case SBIG('GTCP'): + m_elem.reset(new struct IEGTCP); + break; + case SBIG('MODU'): + m_elem.reset(new struct IEModulo); + break; + case SBIG('SUB_'): + m_elem.reset(new struct IESubtract); + break; + case SBIG('NONE'): + m_elem.reset(); + return; default: m_elem.reset(); + LogModule.report(LogVisor::FatalError, "Unknown IntElement class %.4s @%" PRIi64, &clsId, r.position()); return; } m_elem->read(r); @@ -354,6 +506,24 @@ void VectorElementFactory::read(Athena::io::YAMLDocReader& r) case SBIG('PULS'): m_elem.reset(new struct VEPulse); break; + case SBIG('PVEL'): + m_elem.reset(new struct VEParticleVelocity); + break; + case SBIG('SPOS'): + m_elem.reset(new struct VESPOS); + break; + case SBIG('PLCO'): + m_elem.reset(new struct VEPLCO); + break; + case SBIG('PLOC'): + m_elem.reset(new struct VEPLOC); + break; + case SBIG('PSOR'): + m_elem.reset(new struct VEPSOR); + break; + case SBIG('PSOF'): + m_elem.reset(new struct VEPSOF); + break; default: m_elem.reset(); return; @@ -421,8 +591,30 @@ void VectorElementFactory::read(Athena::io::IStreamReader& r) case SBIG('PULS'): m_elem.reset(new struct VEPulse); break; + case SBIG('PVEL'): + m_elem.reset(new struct VEParticleVelocity); + break; + case SBIG('SPOS'): + m_elem.reset(new struct VESPOS); + break; + case SBIG('PLCO'): + m_elem.reset(new struct VEPLCO); + break; + case SBIG('PLOC'): + m_elem.reset(new struct VEPLOC); + break; + case SBIG('PSOR'): + m_elem.reset(new struct VEPSOR); + break; + case SBIG('PSOF'): + m_elem.reset(new struct VEPSOF); + break; + case SBIG('NONE'): + m_elem.reset(); + return; default: m_elem.reset(); + LogModule.report(LogVisor::FatalError, "Unknown VectorElement class %.4s @%" PRIi64, &clsId, r.position()); return; } m_elem->read(r); @@ -526,8 +718,12 @@ void ColorElementFactory::read(Athena::io::IStreamReader& r) case SBIG('PULS'): m_elem.reset(new struct CEPulse); break; + case SBIG('NONE'): + m_elem.reset(); + return; default: m_elem.reset(); + LogModule.report(LogVisor::FatalError, "Unknown ColorElement class %.4s @%" PRIi64, &clsId, r.position()); return; } m_elem->read(r); @@ -665,8 +861,12 @@ void ModVectorElementFactory::read(Athena::io::IStreamReader& r) case SBIG('SWRL'): m_elem.reset(new struct MVESwirl); break; + case SBIG('NONE'): + m_elem.reset(); + return; default: m_elem.reset(); + LogModule.report(LogVisor::FatalError, "Unknown ModVectorElement class %.4s @%" PRIi64, &clsId, r.position()); return; } m_elem->read(r); @@ -708,6 +908,9 @@ void EmitterElementFactory::read(Athena::io::YAMLDocReader& r) case SBIG('SPHE'): m_elem.reset(new struct VESphere); break; + case SBIG('ASPH'): + m_elem.reset(new struct VEAngularSphere); + break; default: m_elem.reset(); return; @@ -750,8 +953,15 @@ void EmitterElementFactory::read(Athena::io::IStreamReader& r) case SBIG('SPHE'): m_elem.reset(new struct VESphere); break; + case SBIG('ASPH'): + m_elem.reset(new struct VEAngularSphere); + break; + case SBIG('NONE'): + m_elem.reset(); + return; default: m_elem.reset(); + LogModule.report(LogVisor::FatalError, "Unknown EmitterElement class %.4s @%" PRIi64, &clsId, r.position()); return; } m_elem->read(r); diff --git a/DataSpec/DNACommon/ParticleCommon.hpp b/DataSpec/DNACommon/ParticleCommon.hpp index 9f46e0060..13d8d2160 100644 --- a/DataSpec/DNACommon/ParticleCommon.hpp +++ b/DataSpec/DNACommon/ParticleCommon.hpp @@ -26,6 +26,7 @@ struct RealElementFactory : BigYAML { Delete _d; std::unique_ptr m_elem; + operator bool() const {return m_elem.operator bool();} void read(Athena::io::YAMLDocReader& r); void write(Athena::io::YAMLDocWriter& w) const; @@ -39,6 +40,7 @@ struct IntElementFactory : BigYAML { Delete _d; std::unique_ptr m_elem; + operator bool() const {return m_elem.operator bool();} void read(Athena::io::YAMLDocReader& r); void write(Athena::io::YAMLDocWriter& w) const; @@ -52,6 +54,7 @@ struct VectorElementFactory : BigYAML { Delete _d; std::unique_ptr m_elem; + operator bool() const {return m_elem.operator bool();} void read(Athena::io::YAMLDocReader& r); void write(Athena::io::YAMLDocWriter& w) const; @@ -65,6 +68,7 @@ struct ColorElementFactory : BigYAML { Delete _d; std::unique_ptr m_elem; + operator bool() const {return m_elem.operator bool();} void read(Athena::io::YAMLDocReader& r); void write(Athena::io::YAMLDocWriter& w) const; @@ -78,6 +82,7 @@ struct ModVectorElementFactory : BigYAML { Delete _d; std::unique_ptr m_elem; + operator bool() const {return m_elem.operator bool();} void read(Athena::io::YAMLDocReader& r); void write(Athena::io::YAMLDocWriter& w) const; @@ -91,6 +96,7 @@ struct EmitterElementFactory : BigYAML { Delete _d; std::unique_ptr m_elem; + operator bool() const {return m_elem.operator bool();} void read(Athena::io::YAMLDocReader& r); void write(Athena::io::YAMLDocWriter& w) const; @@ -111,8 +117,30 @@ struct RELifetimeTween : IRealElement struct REConstant : IRealElement { - DECL_YAML + Delete _d; Value val; + + void read(Athena::io::YAMLDocReader& r) + { + val = r.readFloat(nullptr); + } + void write(Athena::io::YAMLDocWriter& w) const + { + w.writeFloat(nullptr, val); + } + size_t binarySize(size_t __isz) const + { + return __isz + 4; + } + void read(Athena::io::IStreamReader& r) + { + val = r.readFloatBig(); + } + void write(Athena::io::IStreamWriter& w) const + { + w.writeFloatBig(val); + } + const char* ClassID() const {return "CNST";} }; @@ -213,6 +241,151 @@ struct RESineWave : IRealElement const char* ClassID() const {return "SINE";} }; +struct REISWT : IRealElement +{ + DECL_YAML + RealElementFactory a; + RealElementFactory b; + const char* ClassID() const {return "ISWT";} +}; + +struct RECompareLessThan : IRealElement +{ + DECL_YAML + RealElementFactory a; + RealElementFactory b; + RealElementFactory c; + RealElementFactory d; + const char* ClassID() const {return "CLTN";} +}; + +struct RECompareEquals : IRealElement +{ + DECL_YAML + RealElementFactory a; + RealElementFactory b; + RealElementFactory c; + RealElementFactory d; + const char* ClassID() const {return "CEQL";} +}; + +struct REParticleAccessParam1 : IRealElement +{ + DECL_YAML + const char* ClassID() const {return "PAP1";} +}; + +struct REParticleAccessParam2 : IRealElement +{ + DECL_YAML + const char* ClassID() const {return "PAP2";} +}; + +struct REParticleAccessParam3 : IRealElement +{ + DECL_YAML + const char* ClassID() const {return "PAP3";} +}; + +struct REParticleAccessParam4 : IRealElement +{ + DECL_YAML + const char* ClassID() const {return "PAP4";} +}; + +struct REParticleAccessParam5 : IRealElement +{ + DECL_YAML + const char* ClassID() const {return "PAP5";} +}; + +struct REParticleAccessParam6 : IRealElement +{ + DECL_YAML + const char* ClassID() const {return "PAP6";} +}; + +struct REParticleAccessParam7 : IRealElement +{ + DECL_YAML + const char* ClassID() const {return "PAP7";} +}; + +struct REParticleAccessParam8 : IRealElement +{ + DECL_YAML + const char* ClassID() const {return "PAP8";} +}; + +struct REPSLL : IRealElement +{ + DECL_YAML + const char* ClassID() const {return "PSLL";} +}; + +struct REPRLW : IRealElement +{ + DECL_YAML + const char* ClassID() const {return "PRLW";} +}; + +struct REPSOF : IRealElement +{ + DECL_YAML + const char* ClassID() const {return "PSOF";} +}; + +struct RESubtract : IRealElement +{ + DECL_YAML + RealElementFactory a; + RealElementFactory b; + const char* ClassID() const {return "SUB_";} +}; + +struct REVectorMagnitude : IRealElement +{ + DECL_YAML + VectorElementFactory a; + const char* ClassID() const {return "VMAG";} +}; + +struct REVectorXToReal : IRealElement +{ + DECL_YAML + VectorElementFactory a; + const char* ClassID() const {return "VXTR";} +}; + +struct REVectorYToReal : IRealElement +{ + DECL_YAML + VectorElementFactory a; + const char* ClassID() const {return "VYTR";} +}; + +struct REVectorZToReal : IRealElement +{ + DECL_YAML + VectorElementFactory a; + const char* ClassID() const {return "VZTR";} +}; + +struct RECEXT : IRealElement +{ + DECL_YAML + IntElementFactory a; + const char* ClassID() const {return "CEXT";} +}; + +struct REITRL : IRealElement +{ + DECL_YAML + IntElementFactory a; + RealElementFactory b; + const char* ClassID() const {return "ITRL";} +}; + struct IEKeyframeEmitter : IIntElement { DECL_YAML @@ -263,8 +436,30 @@ struct IEAdd : IIntElement struct IEConstant : IIntElement { - DECL_YAML + Delete _d; Value val; + + void read(Athena::io::YAMLDocReader& r) + { + val = r.readUint32(nullptr); + } + void write(Athena::io::YAMLDocWriter& w) const + { + w.writeUint32(nullptr, val); + } + size_t binarySize(size_t __isz) const + { + return __isz + 4; + } + void read(Athena::io::IStreamReader& r) + { + val = r.readUint32Big(); + } + void write(Athena::io::IStreamWriter& w) const + { + w.writeUint32Big(val); + } + const char* ClassID() const {return "CNST";} }; @@ -332,6 +527,28 @@ struct IETimeScale : IIntElement const char* ClassID() const {return "TSCL";} }; +struct IEGTCP : IIntElement +{ + DECL_YAML + const char* ClassID() const {return "GTCP";} +}; + +struct IEModulo : IIntElement +{ + DECL_YAML + IntElementFactory a; + IntElementFactory b; + const char* ClassID() const {return "MODU";} +}; + +struct IESubtract : IIntElement +{ + DECL_YAML + IntElementFactory a; + IntElementFactory b; + const char* ClassID() const {return "SUB_";} +}; + struct VECone : IVectorElement { DECL_YAML @@ -380,10 +597,48 @@ struct VECircleCluster : IVectorElement struct VEConstant : IVectorElement { - DECL_YAML - RealElementFactory a; - RealElementFactory b; - RealElementFactory c; + Delete _d; + RealElementFactory comps[3]; + + void read(Athena::io::YAMLDocReader& r) + { + for (int i=0 ; i<3 ; ++i) + { + r.enterSubRecord(nullptr); + comps[i].read(r); + r.leaveSubRecord(); + } + } + void write(Athena::io::YAMLDocWriter& w) const + { + w.enterSubVector(nullptr); + for (int i=0 ; i<3 ; ++i) + { + w.enterSubRecord(nullptr); + comps[i].write(w); + w.leaveSubRecord(); + } + w.leaveSubVector(); + } + size_t binarySize(size_t __isz) const + { + __isz = comps[0].binarySize(__isz); + __isz = comps[1].binarySize(__isz); + return comps[2].binarySize(__isz); + } + void read(Athena::io::IStreamReader& r) + { + comps[0].read(r); + comps[1].read(r); + comps[2].read(r); + } + void write(Athena::io::IStreamWriter& w) const + { + comps[0].write(w); + comps[1].write(w); + comps[2].write(w); + } + const char* ClassID() const {return "CNST";} }; @@ -437,6 +692,43 @@ struct VEPulse : IVectorElement const char* ClassID() const {return "PULS";} }; +struct VEParticleVelocity : IVectorElement +{ + DECL_YAML + const char* ClassID() const {return "PVEL";} +}; + +struct VESPOS : IVectorElement +{ + DECL_YAML + VectorElementFactory a; + const char* ClassID() const {return "SPOS";} +}; + +struct VEPLCO : IVectorElement +{ + DECL_YAML + const char* ClassID() const {return "PLCO";} +}; + +struct VEPLOC : IVectorElement +{ + DECL_YAML + const char* ClassID() const {return "PLOC";} +}; + +struct VEPSOR : IVectorElement +{ + DECL_YAML + const char* ClassID() const {return "PSOR";} +}; + +struct VEPSOF : IVectorElement +{ + DECL_YAML + const char* ClassID() const {return "PSOF";} +}; + struct CEKeyframeEmitter : IColorElement { DECL_YAML @@ -453,11 +745,51 @@ struct CEKeyframeEmitter : IColorElement struct CEConstant : IColorElement { - DECL_YAML - RealElementFactory a; - RealElementFactory b; - RealElementFactory c; - RealElementFactory d; + Delete _d; + RealElementFactory comps[4]; + + void read(Athena::io::YAMLDocReader& r) + { + for (int i=0 ; i<4 ; ++i) + { + r.enterSubRecord(nullptr); + comps[i].read(r); + r.leaveSubRecord(); + } + } + void write(Athena::io::YAMLDocWriter& w) const + { + w.enterSubVector(nullptr); + for (int i=0 ; i<4 ; ++i) + { + w.enterSubRecord(nullptr); + comps[i].write(w); + w.leaveSubRecord(); + } + w.leaveSubVector(); + } + size_t binarySize(size_t __isz) const + { + __isz = comps[0].binarySize(__isz); + __isz = comps[1].binarySize(__isz); + __isz = comps[2].binarySize(__isz); + return comps[3].binarySize(__isz); + } + void read(Athena::io::IStreamReader& r) + { + comps[0].read(r); + comps[1].read(r); + comps[2].read(r); + comps[3].read(r); + } + void write(Athena::io::IStreamWriter& w) const + { + comps[0].write(w); + comps[1].write(w); + comps[2].write(w); + comps[3].write(w); + } + const char* ClassID() const {return "CNST";} }; @@ -546,10 +878,48 @@ struct MVEBounce : IModVectorElement struct MVEConstant : IModVectorElement { - DECL_YAML - RealElementFactory a; - RealElementFactory b; - RealElementFactory c; + Delete _d; + RealElementFactory comps[3]; + + void read(Athena::io::YAMLDocReader& r) + { + for (int i=0 ; i<3 ; ++i) + { + r.enterSubRecord(nullptr); + comps[i].read(r); + r.leaveSubRecord(); + } + } + void write(Athena::io::YAMLDocWriter& w) const + { + w.enterSubVector(nullptr); + for (int i=0 ; i<3 ; ++i) + { + w.enterSubRecord(nullptr); + comps[i].write(w); + w.leaveSubRecord(); + } + w.leaveSubVector(); + } + size_t binarySize(size_t __isz) const + { + __isz = comps[0].binarySize(__isz); + __isz = comps[1].binarySize(__isz); + return comps[2].binarySize(__isz); + } + void read(Athena::io::IStreamReader& r) + { + comps[0].read(r); + comps[1].read(r); + comps[2].read(r); + } + void write(Athena::io::IStreamWriter& w) const + { + comps[0].write(w); + comps[1].write(w); + comps[2].write(w); + } + const char* ClassID() const {return "CNST";} }; @@ -632,6 +1002,19 @@ struct VESphere : IEmitterElement const char* ClassID() const {return "SPHE";} }; +struct VEAngularSphere : IEmitterElement +{ + DECL_YAML + VectorElementFactory a; + RealElementFactory b; + RealElementFactory c; + RealElementFactory d; + RealElementFactory e; + RealElementFactory f; + RealElementFactory g; + const char* ClassID() const {return "ASPH";} +}; + struct EESimpleEmitterTR : EESimpleEmitter { Delete _d; @@ -893,6 +1276,7 @@ struct UVElementFactory : BigYAML { Delete _d; std::unique_ptr m_elem; + operator bool() const {return m_elem.operator bool();} void read(Athena::io::YAMLDocReader& r) { @@ -1085,6 +1469,8 @@ struct SpawnSystemKeyframeData : BigYAML } void write(Athena::io::YAMLDocWriter& w) const { + if (spawns.empty()) + return; w.writeUint32("a", a); w.writeUint32("b", b); w.writeUint32("c", c); @@ -1092,6 +1478,7 @@ struct SpawnSystemKeyframeData : BigYAML w.enterSubVector("spawns"); for (const auto& spawn : spawns) { + w.enterSubRecord(nullptr); w.writeUint32("first", spawn.first); w.enterSubVector("second"); for (const auto& info : spawn.second) @@ -1101,6 +1488,7 @@ struct SpawnSystemKeyframeData : BigYAML w.leaveSubRecord(); } w.leaveSubVector(); + w.leaveSubRecord(); } w.leaveSubVector(); } @@ -1117,6 +1505,11 @@ struct SpawnSystemKeyframeData : BigYAML } void read(Athena::io::IStreamReader& r) { + uint32_t clsId; + r.readBytesToBuf(&clsId, 4); + if (clsId != SBIG('CNST')) + return; + a = r.readUint32Big(); b = r.readUint32Big(); c = r.readUint32Big(); @@ -1139,6 +1532,12 @@ struct SpawnSystemKeyframeData : BigYAML } void write(Athena::io::IStreamWriter& w) const { + if (spawns.empty()) + { + w.writeBytes((atInt8*)"NONE", 4); + return; + } + w.writeBytes((atInt8*)"CNST", 4); w.writeUint32Big(a); w.writeUint32Big(b); w.writeUint32Big(c); @@ -1152,6 +1551,8 @@ struct SpawnSystemKeyframeData : BigYAML info.write(w); } } + + operator bool() const {return spawns.size() != 0;} }; template @@ -1202,6 +1603,8 @@ struct ChildResourceFactory : BigYAML else w.writeBytes((atInt8*)"NONE", 4); } + + operator bool() const {return id.operator bool();} }; } diff --git a/DataSpec/DNAMP1/DNAMP1.cpp b/DataSpec/DNAMP1/DNAMP1.cpp index dcc555c3d..9a1db6a3f 100644 --- a/DataSpec/DNAMP1/DNAMP1.cpp +++ b/DataSpec/DNAMP1/DNAMP1.cpp @@ -282,8 +282,8 @@ ResExtractor PAKBridge::LookupExtractor(const PAK::Entry& entry) return {nullptr, MREA::Extract, {_S(".blend")}, 4, MREA::Name}; case SBIG('MAPA'): return {nullptr, MAPA::Extract, {_S(".blend")}, 4}; - //case SBIG('PART'): - // return {DNAParticle::ExtractGPSM, nullptr, {_S(".yaml")}}; + case SBIG('PART'): + return {DNAParticle::ExtractGPSM, nullptr, {_S(".yaml")}}; } return {}; } diff --git a/hecl b/hecl index ee25e81af..2c5df80a5 160000 --- a/hecl +++ b/hecl @@ -1 +1 @@ -Subproject commit ee25e81af5b7b2d125808960d1c430f6bc722e75 +Subproject commit 2c5df80a56a07f9147e82a5981dcd311304f3b1d