From da98329eb437aac5ad1a7ae380ae013196013030 Mon Sep 17 00:00:00 2001 From: Jack Andersen Date: Wed, 24 Jun 2015 10:56:23 -1000 Subject: [PATCH] initial MP1 MLVL DNA structure --- .gitmodules | 3 + DNA/DNA.pri | 2 + DNA/DNA_common/DNA_common.pri | 2 + DNA/DNA_common/common.hpp | 55 +++++++++++++++++ DNA/DNA_mp1/DNA_mp1.pri | 2 + DNA/DNA_mp1/MLVL.hpp | 108 ++++++++++++++++++++++++++++++++++ PakLib | 1 + RetroCommon.pri | 5 +- 8 files changed, 177 insertions(+), 1 deletion(-) create mode 100644 .gitmodules create mode 100644 DNA/DNA.pri create mode 100644 DNA/DNA_common/DNA_common.pri create mode 100644 DNA/DNA_common/common.hpp create mode 100644 DNA/DNA_mp1/DNA_mp1.pri create mode 100644 DNA/DNA_mp1/MLVL.hpp create mode 160000 PakLib diff --git a/.gitmodules b/.gitmodules new file mode 100644 index 000000000..9465ae8aa --- /dev/null +++ b/.gitmodules @@ -0,0 +1,3 @@ +[submodule "PakLib"] + path = PakLib + url = https://github.com/RetroView/PakLib.git diff --git a/DNA/DNA.pri b/DNA/DNA.pri new file mode 100644 index 000000000..dc14cf4d9 --- /dev/null +++ b/DNA/DNA.pri @@ -0,0 +1,2 @@ +include(DNA_common/DNA_common.pri) +include(DNA_mp1/DNA_mp1.pri) diff --git a/DNA/DNA_common/DNA_common.pri b/DNA/DNA_common/DNA_common.pri new file mode 100644 index 000000000..50ac9cb37 --- /dev/null +++ b/DNA/DNA_common/DNA_common.pri @@ -0,0 +1,2 @@ +HEADERS += \ + $$PWD/common.hpp diff --git a/DNA/DNA_common/common.hpp b/DNA/DNA_common/common.hpp new file mode 100644 index 000000000..1272cde7d --- /dev/null +++ b/DNA/DNA_common/common.hpp @@ -0,0 +1,55 @@ +#ifndef __DNA_COMMON_HPP__ +#define __DNA_COMMON_HPP__ + +#include +#include +#include + +/* This comes up a great deal */ +typedef Athena::io::DNA BigDNA; + +/* FourCC DNA */ +class DNAFourCC : public BigDNA, public CFourCC +{ +public: + Delete expl; + void read(Athena::io::IStreamReader& reader) + {_read(reader);} + void write(Athena::io::IStreamWriter& writer) const + {_write(writer);} +}; + +/* PAK 32-bit Unique ID DNA */ +class DNAUniqueID32 : public BigDNA, public CUniqueID +{ +public: + Delete expl; + void read(Athena::io::IStreamReader& reader) + {_read(reader, E_32Bits);} + void write(Athena::io::IStreamWriter& writer) const + {_write(writer);} +}; + +/* PAK 64-bit Unique ID DNA */ +class DNAUniqueID64 : public BigDNA, public CUniqueID +{ +public: + Delete expl; + void read(Athena::io::IStreamReader& reader) + {_read(reader, E_64Bits);} + void write(Athena::io::IStreamWriter& writer) const + {_write(writer);} +}; + +/* PAK 128-bit Unique ID DNA */ +class DNAUniqueID128 : public BigDNA, public CUniqueID +{ +public: + Delete expl; + void read(Athena::io::IStreamReader& reader) + {_read(reader, E_128Bits);} + void write(Athena::io::IStreamWriter& writer) const + {_write(writer);} +}; + +#endif // __DNA_COMMON_HPP__ diff --git a/DNA/DNA_mp1/DNA_mp1.pri b/DNA/DNA_mp1/DNA_mp1.pri new file mode 100644 index 000000000..dcba9810b --- /dev/null +++ b/DNA/DNA_mp1/DNA_mp1.pri @@ -0,0 +1,2 @@ +HEADERS += \ + $$PWD/MLVL.hpp diff --git a/DNA/DNA_mp1/MLVL.hpp b/DNA/DNA_mp1/MLVL.hpp new file mode 100644 index 000000000..c888d208f --- /dev/null +++ b/DNA/DNA_mp1/MLVL.hpp @@ -0,0 +1,108 @@ +#include "../DNA_common/common.hpp" + +namespace MP1 +{ + +struct MLVL : public BigDNA +{ + DECL_DNA + DNAFourCC magic; + Value version; + DNAUniqueID32 worldNameId; + DNAUniqueID32 saveWorldId; + DNAUniqueID32 worldSkyboxId; + + Value memRelayLinkCount; + struct MemRelayLink : public BigDNA + { + DECL_DNA + Value memRelayId; + Value targetId; + Value msg; + Value unk; + }; + Vector memRelayLinks; + + Value areaCount; + Value unknown1; + struct Area : public BigDNA + { + DECL_DNA + DNAUniqueID32 areaNameId; + Value transformMtx[3]; + Value aabb[2]; + DNAUniqueID32 areaMREAId; + Value areaId; + + Value attachedAreaCount; + Vector attachedAreas; + Value padding; + + Value depCount; + struct Dependency : public BigDNA + { + DECL_DNA + DNAUniqueID32 id; + DNAFourCC type; + }; + Vector deps; + + Value depLayerCount; + Vector depLayers; + + Value dockCount; + struct Dock : public BigDNA + { + DECL_DNA + Value endpointCount; + struct Endpoint : public BigDNA + { + DECL_DNA + Value areaIdx; + Value dockIdx; + }; + DNAFourCC type; + Vector endpoints; + + Value planeVertCount; + Vector planeVerts; + }; + Vector docks; + }; + + DNAUniqueID32 worldMap; + Value unknown2; + Value unknown3; + + Value audioGroupCount; + struct AudioGroup : public BigDNA + { + DECL_DNA + Value unknown; + DNAUniqueID32 agscId; + }; + Vector audioGroups; + String<-1> unkString; + + Value layerFlagCount; + struct LayerFlags : public BigDNA + { + DECL_DNA + Value layerCount; + Value flags; + }; + Vector layerFlags; + + Value layerNameCount; + struct LayerName : public BigDNA + { + DECL_DNA + String<-1> name; + }; + Vector layerNames; + + Value layerNameOffsetCount; + Vector layerNameOffsets; +}; + +} diff --git a/PakLib b/PakLib new file mode 160000 index 000000000..6a71c1fdc --- /dev/null +++ b/PakLib @@ -0,0 +1 @@ +Subproject commit 6a71c1fdc4b176f1b14d83b87b57a519f8ba534a diff --git a/RetroCommon.pri b/RetroCommon.pri index 49fbd2452..bd76566a6 100644 --- a/RetroCommon.pri +++ b/RetroCommon.pri @@ -1,6 +1,7 @@ -INCLUDEPATH += $$PWD/include +INCLUDEPATH += $$PWD/DNA $$PWD/include include(../libSquish/libSquish.pri) +include(PakLib/PakLib.pri) HEADERS += \ $$PWD/include/RetroCommon.hpp @@ -8,3 +9,5 @@ HEADERS += \ SOURCES += \ $$PWD/src/RetroCommon.cpp \ $$PWD/src/MREADecompress.cpp + +include(DNA/DNA.pri)