From b188c4892ac1639afacd514674abbbdf3f5605ef Mon Sep 17 00:00:00 2001 From: Phillip Stephens Date: Sat, 23 Jul 2016 18:51:15 -0700 Subject: [PATCH] Add SAVW DNAs --- DataSpec/DNACommon/CMakeLists.txt | 1 + DataSpec/DNACommon/SAVWCommon.hpp | 44 +++++++++++++++++++++ DataSpec/DNAMP1/CMakeLists.txt | 1 + DataSpec/DNAMP1/DNAMP1.cpp | 3 ++ DataSpec/DNAMP1/SAVW.hpp | 46 ++++++++++++++++++++++ DataSpec/DNAMP2/CMakeLists.txt | 1 + DataSpec/DNAMP2/DNAMP2.cpp | 3 ++ DataSpec/DNAMP2/PTLA.hpp | 6 +-- DataSpec/DNAMP2/SAVW.hpp | 34 ++++++++++++++++ DataSpec/DNAMP3/CMakeLists.txt | 3 +- DataSpec/DNAMP3/DNAMP3.cpp | 3 ++ DataSpec/DNAMP3/SAVW.hpp | 64 +++++++++++++++++++++++++++++++ Runtime/CSaveWorld.cpp | 9 +++++ Runtime/CSaveWorld.hpp | 2 + hecl | 2 +- 15 files changed, 217 insertions(+), 5 deletions(-) create mode 100644 DataSpec/DNACommon/SAVWCommon.hpp create mode 100644 DataSpec/DNAMP1/SAVW.hpp create mode 100644 DataSpec/DNAMP2/SAVW.hpp create mode 100644 DataSpec/DNAMP3/SAVW.hpp diff --git a/DataSpec/DNACommon/CMakeLists.txt b/DataSpec/DNACommon/CMakeLists.txt index ed045deeb..7eabf12a0 100644 --- a/DataSpec/DNACommon/CMakeLists.txt +++ b/DataSpec/DNACommon/CMakeLists.txt @@ -2,6 +2,7 @@ make_dnalist(liblist CMDL MAPA EGMC + SAVWCommon ParticleCommon) add_library(DNACommon diff --git a/DataSpec/DNACommon/SAVWCommon.hpp b/DataSpec/DNACommon/SAVWCommon.hpp new file mode 100644 index 000000000..4c2ae00d6 --- /dev/null +++ b/DataSpec/DNACommon/SAVWCommon.hpp @@ -0,0 +1,44 @@ +#ifndef __COMMON_SAVWCOMMON_HPP__ +#define __COMMON_SAVWCOMMON_HPP__ +#include "DNACommon.hpp" + +namespace DataSpec +{ +namespace SAVWCommon +{ +enum class EScanCategory +{ + None, + Data, + Lore, + Creature, + Research +}; + +struct Header : BigYAML +{ + DECL_YAML + Value magic; + Value version; + Value areaCount; +}; + +struct EnvironmentVariable : BigYAML +{ + DECL_YAML + String<-1> name; + Value unk1; + Value unk2; + Value unk3; +}; + +struct Layer : BigYAML +{ + DECL_YAML + Value areaId; + Value layer; +}; +} +} + +#endif // __COMMON_SAVWCOMMON_HPP__ diff --git a/DataSpec/DNAMP1/CMakeLists.txt b/DataSpec/DNAMP1/CMakeLists.txt index 9eb6b4f27..8cfc1bc09 100644 --- a/DataSpec/DNAMP1/CMakeLists.txt +++ b/DataSpec/DNAMP1/CMakeLists.txt @@ -14,6 +14,7 @@ make_dnalist(liblist DeafBabe SCAN FRME + SAVW Tweaks/CTweakGame Tweaks/CTweakParticle Tweaks/CTweakPlayer diff --git a/DataSpec/DNAMP1/DNAMP1.cpp b/DataSpec/DNAMP1/DNAMP1.cpp index 15c239c5a..57ef6892c 100644 --- a/DataSpec/DNAMP1/DNAMP1.cpp +++ b/DataSpec/DNAMP1/DNAMP1.cpp @@ -16,6 +16,7 @@ #include "../DNACommon/DGRP.hpp" #include "CMDL.hpp" #include "AFSM.hpp" +#include "SAVW.hpp" #include "ANCS.hpp" #include "MREA.hpp" #include "MAPA.hpp" @@ -277,6 +278,8 @@ ResExtractor PAKBridge::LookupExtractor(const PAK::Entry& entry) return {STRG::Extract, nullptr, {_S(".yaml")}}; case SBIG('SCAN'): return {SCAN::Extract, nullptr, {_S(".yaml")}, 0, SCAN::Name}; + case SBIG('SAVW'): + return {DNAMP1::ExtractSAVW, nullptr, {_S(".yaml")}}; case SBIG('TXTR'): return {TXTR::Extract, nullptr, {_S(".png")}}; case SBIG('AFSM'): diff --git a/DataSpec/DNAMP1/SAVW.hpp b/DataSpec/DNAMP1/SAVW.hpp new file mode 100644 index 000000000..ac2e8a65c --- /dev/null +++ b/DataSpec/DNAMP1/SAVW.hpp @@ -0,0 +1,46 @@ +#ifndef __DNAMP1_SAVW_HPP__ +#define __DNAMP1_SAVW_HPP__ + +#include "../DNACommon/SAVWCommon.hpp" +#include "DNAMP1.hpp" + +namespace DataSpec +{ +namespace DNAMP1 +{ +struct Scan : BigYAML +{ + DECL_YAML + UniqueID32 scanId; + Value category; +}; + +struct SAVW : BigYAML +{ + DECL_YAML + SAVWCommon::Header header; + Value skippableCutsceneCount; + Vector skippableCutscenes; + Value relayCount; + Vector relays; + Value layerCount; + Vector layers; + Value doorCount; + Vector doors; + Value scanCount; + Vector scans; +}; + +static bool ExtractSAVW(PAKEntryReadStream& rs, const hecl::ProjectPath& outPath) +{ + SAVW savw; + savw.read(rs); + FILE* fp = hecl::Fopen(outPath.getAbsolutePath().c_str(), _S("wb")); + savw.toYAMLFile(fp); + fclose(fp); + return true; +} +} +} + +#endif // __DNAMP1_SAVW_HPP__ diff --git a/DataSpec/DNAMP2/CMakeLists.txt b/DataSpec/DNAMP2/CMakeLists.txt index e236c2be8..1fbeda8a6 100644 --- a/DataSpec/DNAMP2/CMakeLists.txt +++ b/DataSpec/DNAMP2/CMakeLists.txt @@ -7,6 +7,7 @@ make_dnalist(liblist CSKR MREA PTLA + SAVW DeafBabe) add_library(DNAMP2 DNAMP2.hpp DNAMP2.cpp diff --git a/DataSpec/DNAMP2/DNAMP2.cpp b/DataSpec/DNAMP2/DNAMP2.cpp index b81a59256..e448a6301 100644 --- a/DataSpec/DNAMP2/DNAMP2.cpp +++ b/DataSpec/DNAMP2/DNAMP2.cpp @@ -7,6 +7,7 @@ #include "MREA.hpp" #include "MAPA.hpp" #include "AFSM.hpp" +#include "SAVW.hpp" #include "../DNACommon/FSM2.hpp" #include "../DNACommon/TXTR.hpp" #include "../DNACommon/FONT.hpp" @@ -222,6 +223,8 @@ ResExtractor PAKBridge::LookupExtractor(const DNAMP1::PAK::Entry& ent return {TXTR::Extract, nullptr, {_S(".png")}}; case SBIG('AFSM'): return {AFSM::Extract, nullptr, {_S(".yaml")}}; + case SBIG('SAVW'): + return {DNAMP2::ExtractSAVW, nullptr, {_S(".yaml")}}; case SBIG('CMDL'): return {nullptr, CMDL::Extract, {_S(".blend")}, 1}; case SBIG('ANCS'): diff --git a/DataSpec/DNAMP2/PTLA.hpp b/DataSpec/DNAMP2/PTLA.hpp index 2e59e74c8..465a0f0e9 100644 --- a/DataSpec/DNAMP2/PTLA.hpp +++ b/DataSpec/DNAMP2/PTLA.hpp @@ -1,5 +1,5 @@ -#ifndef PTLA_HPP -#define PTLA_HPP +#ifndef __DNAMP2_PTLA_HPP__ +#define __DNAMP2_PTLA_HPP__ #include "../DNACommon/DNACommon.hpp" @@ -69,4 +69,4 @@ struct PTLA : BigDNA }; } } -#endif // PTLA_HPP +#endif // __DNAMP2_PTLA_HPP__ diff --git a/DataSpec/DNAMP2/SAVW.hpp b/DataSpec/DNAMP2/SAVW.hpp new file mode 100644 index 000000000..3d9883cf9 --- /dev/null +++ b/DataSpec/DNAMP2/SAVW.hpp @@ -0,0 +1,34 @@ +#ifndef __DNAMP2_SAVW_HPP__ +#define __DNAMP2_SAVW_HPP__ + +#include "../DNAMP1/SAVW.hpp" +#include "DNAMP2.hpp" + +namespace DataSpec +{ +namespace DNAMP2 +{ +struct SAVW : DNAMP1::SAVW +{ + DECL_YAML + Value systemVarCount; + Vector systemVars; + Value gameVarCount; + Vector gameVars; + Value gameObjectCount; + Vector gameObjects; +}; + +static bool ExtractSAVW(PAKEntryReadStream& rs, const hecl::ProjectPath& outPath) +{ + SAVW savw; + savw.read(rs); + FILE* fp = hecl::Fopen(outPath.getAbsolutePath().c_str(), _S("wb")); + savw.toYAMLFile(fp); + fclose(fp); + return true; +} +} +} + +#endif // __DNAMP2_SAVW_HPP__ diff --git a/DataSpec/DNAMP3/CMakeLists.txt b/DataSpec/DNAMP3/CMakeLists.txt index 531091fdf..b8c761a8d 100644 --- a/DataSpec/DNAMP3/CMakeLists.txt +++ b/DataSpec/DNAMP3/CMakeLists.txt @@ -6,7 +6,8 @@ make_dnalist(liblist CMDLMaterials CINF CSKR - MREA) + MREA + SAVW) add_library(DNAMP3 DNAMP3.hpp DNAMP3.cpp ${liblist} diff --git a/DataSpec/DNAMP3/DNAMP3.cpp b/DataSpec/DNAMP3/DNAMP3.cpp index 533c1f5a7..91ea489fe 100644 --- a/DataSpec/DNAMP3/DNAMP3.cpp +++ b/DataSpec/DNAMP3/DNAMP3.cpp @@ -8,6 +8,7 @@ #include "CHAR.hpp" #include "MREA.hpp" #include "MAPA.hpp" +#include "SAVW.hpp" #include "../DNACommon/TXTR.hpp" #include "../DNACommon/FONT.hpp" #include "../DNACommon/FSM2.hpp" @@ -230,6 +231,8 @@ ResExtractor PAKBridge::LookupExtractor(const PAK::Entry& entry) return {STRG::Extract, nullptr, {_S(".yaml")}}; case SBIG('TXTR'): return {TXTR::Extract, nullptr, {_S(".png")}}; + case SBIG('SAVW'): + return {DNAMP3::ExtractSAVW, nullptr, {_S(".yaml")}}; case SBIG('CMDL'): return {nullptr, CMDL::Extract, {_S(".blend")}, 1}; case SBIG('CHAR'): diff --git a/DataSpec/DNAMP3/SAVW.hpp b/DataSpec/DNAMP3/SAVW.hpp new file mode 100644 index 000000000..007701099 --- /dev/null +++ b/DataSpec/DNAMP3/SAVW.hpp @@ -0,0 +1,64 @@ +#ifndef __DNAMP3_SAVW_HPP__ +#define __DNAMP3_SAVW_HPP__ + +#include "../DNACommon/SAVWCommon.hpp" +#include "DNAMP3.hpp" + +namespace DataSpec +{ +namespace DNAMP3 +{ +struct Scan : BigYAML +{ + DECL_YAML + UniqueID64 scanId; + Value category; +}; + +struct SavedState : BigYAML +{ + DECL_YAML + struct ID : BigYAML + { + DECL_YAML + Value id[2]; + }; + ID id; + Value instance; +}; + +struct SAVW : BigYAML +{ + DECL_YAML + SAVWCommon::Header header; + Value skippableCutsceneCount; + Vector skippableCutscenes; + Value relayCount; + Vector relays; + Value layerCount; + Vector layers; + Value doorCount; + Vector doors; + Value scanCount; + Vector scans; + Value systemVarCount; + Vector systemVars; + Value gameVarCount; + Vector gameVars; + Value gameObjectCount; + Vector gameObjects; +}; + +static bool ExtractSAVW(PAKEntryReadStream& rs, const hecl::ProjectPath& outPath) +{ + SAVW savw; + savw.read(rs); + FILE* fp = hecl::Fopen(outPath.getAbsolutePath().c_str(), _S("wb")); + savw.toYAMLFile(fp); + fclose(fp); + return true; +} +} +} + +#endif // __DNAMP3_SAVW_HPP__ diff --git a/Runtime/CSaveWorld.cpp b/Runtime/CSaveWorld.cpp index e69de29bb..ac8f03bd2 100644 --- a/Runtime/CSaveWorld.cpp +++ b/Runtime/CSaveWorld.cpp @@ -0,0 +1,9 @@ +#include "CSaveWorld.hpp" + +namespace urde +{ +CSaveWorld::CSaveWorld(CInputStream &in) +{ +} + +} diff --git a/Runtime/CSaveWorld.hpp b/Runtime/CSaveWorld.hpp index ae154e5e2..4e2b68dcb 100644 --- a/Runtime/CSaveWorld.hpp +++ b/Runtime/CSaveWorld.hpp @@ -1,6 +1,8 @@ #ifndef __URDE_CSAVEWORLD_HPP__ #define __URDE_CSAVEWORLD_HPP__ +#include "RetroTypes.hpp" + namespace urde { class CSaveWorld diff --git a/hecl b/hecl index 778dfaad0..c4bdd9213 160000 --- a/hecl +++ b/hecl @@ -1 +1 @@ -Subproject commit 778dfaad0e133fe3126910204e97f7157c7a0492 +Subproject commit c4bdd92138ccc5de801bb109f9761605e3b81f74