diff --git a/DataSpec/DNACommon/CRSC.cpp b/DataSpec/DNACommon/CRSC.cpp index 31deac0b5..076bef247 100644 --- a/DataSpec/DNACommon/CRSC.cpp +++ b/DataSpec/DNACommon/CRSC.cpp @@ -290,6 +290,15 @@ void CRSM::write(athena::io::IStreamWriter& w) const w.writeBytes("_END", 4); } +template +void CRSM::gatherDependencies(std::vector& pathsOut) const +{ + for (const auto& p : x0_generators) + g_curSpec->flattenDependencies(p.second.id, pathsOut); + for (const auto& p : x20_decals) + g_curSpec->flattenDependencies(p.second.id, pathsOut); +} + template CRSM::CRSM() : x30_RNGE(50.f), diff --git a/DataSpec/DNACommon/CRSC.hpp b/DataSpec/DNACommon/CRSC.hpp index 360f95154..901aec6b9 100644 --- a/DataSpec/DNACommon/CRSC.hpp +++ b/DataSpec/DNACommon/CRSC.hpp @@ -29,6 +29,8 @@ struct CRSM : BigYAML void write(athena::io::IStreamWriter& w) const; CRSM(); + + void gatherDependencies(std::vector&) const; }; template bool ExtractCRSM(PAKEntryReadStream& rs, const hecl::ProjectPath& outPath); diff --git a/DataSpec/DNACommon/DNACommon.hpp b/DataSpec/DNACommon/DNACommon.hpp index 3f8f9c65c..f9d5cbda1 100644 --- a/DataSpec/DNACommon/DNACommon.hpp +++ b/DataSpec/DNACommon/DNACommon.hpp @@ -127,19 +127,42 @@ public: template static hecl::ProjectPath TranslatePakIdToPath(const IDType& id, bool silenceWarnings=false) { + /* Try PAKRouter first (only available at extract) */ PAKRouterBase* pakRouter = g_PakRouter.get(); - if (!pakRouter) + if (pakRouter) + { + hecl::ProjectPath path = pakRouter->getWorking(id, silenceWarnings); + if (path) + return path; + } + + /* Try project cache second (populated with paths read from YAML resources) */ + hecl::Database::Project* project = s_Project.get(); + if (!project) LogDNACommon.report(logvisor::Fatal, - "g_PakRouter must be set to non-null before calling UniqueIDBridge::TranslatePakIdToPath"); - return pakRouter->getWorking(id, silenceWarnings); + "g_PakRouter or s_Project must be set to non-null before " + "calling UniqueIDBridge::TranslatePakIdToPath"); + + const hecl::ProjectPath* search = project->lookupBridgePath(id.toUint64()); + if (!search) + { + if (!silenceWarnings) + LogDNACommon.report(logvisor::Warning, + "unable to translate %s to path", id.toString().c_str()); + return {}; + } + return *search; } + template static hecl::ProjectPath MakePathFromString(const std::string& str) { hecl::Database::Project* project = s_Project.get(); if (!project) LogDNACommon.report(logvisor::Fatal, "UniqueIDBridge::setGlobalProject must be called before MakePathFromString"); - return hecl::ProjectPath(*project, str); + hecl::ProjectPath path = hecl::ProjectPath(*project, str); + project->addBridgePathToCache(IDType(path), path); + return path; } template static void TransformOldHashToNewHash(IDType& id) @@ -168,7 +191,7 @@ public: {writer.writeUint32Big(m_id);} void read(athena::io::YAMLDocReader& reader) { - *this = UniqueIDBridge::MakePathFromString(reader.readString(nullptr)); + *this = UniqueIDBridge::MakePathFromString(reader.readString(nullptr)); } void write(athena::io::YAMLDocWriter& writer) const { @@ -198,6 +221,7 @@ public: void clear() {m_id = 0xffffffff;} UniqueID32() = default; + UniqueID32(uint32_t idin) : m_id(idin) {} UniqueID32(athena::io::IStreamReader& reader) {read(reader);} UniqueID32(const hecl::ProjectPath& path) {*this = path;} UniqueID32(const char* hexStr) @@ -260,7 +284,7 @@ public: void read(athena::io::YAMLDocReader& reader) { - hecl::ProjectPath readPath = UniqueIDBridge::MakePathFromString(reader.readString(nullptr)); + hecl::ProjectPath readPath = UniqueIDBridge::MakePathFromString(reader.readString(nullptr)); *this = readPath.ensureAuxInfo(m_auxStr); } @@ -295,7 +319,7 @@ public: {writer.writeUint64Big(m_id);} void read(athena::io::YAMLDocReader& reader) { - *this = UniqueIDBridge::MakePathFromString(reader.readString(nullptr)); + *this = UniqueIDBridge::MakePathFromString(reader.readString(nullptr)); } void write(athena::io::YAMLDocWriter& writer) const { @@ -324,6 +348,7 @@ public: void clear() {m_id = 0xffffffffffffffff;} UniqueID64() = default; + UniqueID64(uint64_t idin) : m_id(idin) {} UniqueID64(athena::io::IStreamReader& reader) {read(reader);} UniqueID64(const hecl::ProjectPath& path) {*this = path;} UniqueID64(const char* hexStr) @@ -379,7 +404,7 @@ public: } void read(athena::io::YAMLDocReader& reader) { - *this = UniqueIDBridge::MakePathFromString(reader.readString(nullptr)); + *this = UniqueIDBridge::MakePathFromString(reader.readString(nullptr)); } void write(athena::io::YAMLDocWriter& writer) const { @@ -399,6 +424,7 @@ public: m_id[1] = 0; return *this; } + UniqueID128(const hecl::ProjectPath& path) {*this = path;} bool operator!=(const UniqueID128& other) const { @@ -421,6 +447,7 @@ public: #endif } void clear() {m_id[0] = 0xffffffffffffffff; m_id[1] = 0xffffffffffffffff;} + uint64_t toUint64() const {return m_id[0];} uint64_t toHighUint64() const {return m_id[0];} uint64_t toLowUint64() const {return m_id[1];} std::string toString() const diff --git a/DataSpec/DNACommon/DPSC.cpp b/DataSpec/DNACommon/DPSC.cpp index b2b8bfcc3..4fb04b146 100644 --- a/DataSpec/DNACommon/DPSC.cpp +++ b/DataSpec/DNACommon/DPSC.cpp @@ -404,6 +404,16 @@ void DPSM::writeQuadDecalInfo(athena::io::IStreamWriter& w, } } +template +void DPSM::gatherDependencies(std::vector& pathsOut) const +{ + if (x0_quad.x14_TEX.m_elem) + x0_quad.x14_TEX.m_elem->gatherDependencies(pathsOut); + if (x1c_quad.x14_TEX.m_elem) + x1c_quad.x14_TEX.m_elem->gatherDependencies(pathsOut); + g_curSpec->flattenDependencies(x38_DMDL.id, pathsOut); +} + template struct DPSM; template struct DPSM; diff --git a/DataSpec/DNACommon/DPSC.hpp b/DataSpec/DNACommon/DPSC.hpp index 3cbe91396..7729426b8 100644 --- a/DataSpec/DNACommon/DPSC.hpp +++ b/DataSpec/DNACommon/DPSC.hpp @@ -50,6 +50,8 @@ struct DPSM : BigYAML void read(athena::io::IStreamReader& r); void write(athena::io::IStreamWriter& w) const; void writeQuadDecalInfo(athena::io::IStreamWriter& w, const SQuadDescr& quad, bool first) const; + + void gatherDependencies(std::vector&) const; }; template diff --git a/DataSpec/DNACommon/ELSC.cpp b/DataSpec/DNACommon/ELSC.cpp index cb3852fd7..629714e50 100644 --- a/DataSpec/DNACommon/ELSC.cpp +++ b/DataSpec/DNACommon/ELSC.cpp @@ -444,6 +444,14 @@ void ELSM::write(athena::io::IStreamWriter& w) const w.writeBytes("_END", 4); } +template +void ELSM::gatherDependencies(std::vector& pathsOut) const +{ + g_curSpec->flattenDependencies(x40_SSWH.id, pathsOut); + g_curSpec->flattenDependencies(x50_GPSM.id, pathsOut); + g_curSpec->flattenDependencies(x60_EPSM.id, pathsOut); +} + template struct ELSM; template struct ELSM; diff --git a/DataSpec/DNACommon/ELSC.hpp b/DataSpec/DNACommon/ELSC.hpp index 826056b85..403ff34bb 100644 --- a/DataSpec/DNACommon/ELSC.hpp +++ b/DataSpec/DNACommon/ELSC.hpp @@ -40,6 +40,8 @@ struct ELSM : BigYAML size_t binarySize(size_t __isz) const; void read(athena::io::IStreamReader& r); void write(athena::io::IStreamWriter& w) const; + + void gatherDependencies(std::vector&) const; }; template diff --git a/DataSpec/DNACommon/FONT.hpp b/DataSpec/DNACommon/FONT.hpp index 69764a64a..7b4df5d3f 100644 --- a/DataSpec/DNACommon/FONT.hpp +++ b/DataSpec/DNACommon/FONT.hpp @@ -109,6 +109,11 @@ struct FONT : BigYAML std::vector> glyphs; Value kerningInfoCount; Vector kerningInfo; + + void gatherDependencies(std::vector& pathsOut) const + { + g_curSpec->flattenDependencies(textureId, pathsOut); + } }; template diff --git a/DataSpec/DNACommon/PART.cpp b/DataSpec/DNACommon/PART.cpp index 2c5c9d977..e0efb4a35 100644 --- a/DataSpec/DNACommon/PART.cpp +++ b/DataSpec/DNACommon/PART.cpp @@ -1532,6 +1532,23 @@ void GPSM::write(athena::io::IStreamWriter& w) const w.writeBytes("_END", 4); } +template +void GPSM::gatherDependencies(std::vector& pathsOut) const +{ + if (x54_TEXR.m_elem) + x54_TEXR.m_elem->gatherDependencies(pathsOut); + if (x58_TIND.m_elem) + x58_TIND.m_elem->gatherDependencies(pathsOut); + g_curSpec->flattenDependencies(x5c_PMDL.id, pathsOut); + g_curSpec->flattenDependencies(x8c_ICTS.id, pathsOut); + g_curSpec->flattenDependencies(xa4_IDTS.id, pathsOut); + g_curSpec->flattenDependencies(xb8_IITS.id, pathsOut); + xd0_KSSM.gatherDependencies(pathsOut); + g_curSpec->flattenDependencies(xd4_SSWH.id, pathsOut); + g_curSpec->flattenDependencies(xec_PMLC.id, pathsOut); + g_curSpec->flattenDependencies(xd8_SELC.id, pathsOut); +} + template struct GPSM; template struct GPSM; diff --git a/DataSpec/DNACommon/PART.hpp b/DataSpec/DNACommon/PART.hpp index 37ac9d859..4a424078a 100644 --- a/DataSpec/DNACommon/PART.hpp +++ b/DataSpec/DNACommon/PART.hpp @@ -112,6 +112,8 @@ struct GPSM : BigYAML size_t binarySize(size_t __isz) const; void read(athena::io::IStreamReader& r); void write(athena::io::IStreamWriter& w) const; + + void gatherDependencies(std::vector&) const; }; template diff --git a/DataSpec/DNACommon/ParticleCommon.hpp b/DataSpec/DNACommon/ParticleCommon.hpp index 138a3a257..dca952350 100644 --- a/DataSpec/DNACommon/ParticleCommon.hpp +++ b/DataSpec/DNACommon/ParticleCommon.hpp @@ -100,7 +100,11 @@ struct EmitterElementFactory : BigYAML void write(athena::io::IStreamWriter& w) const; }; -struct IUVElement : IElement {Delete _d;}; +struct IUVElement : IElement +{ + Delete _d; + virtual void gatherDependencies(std::vector& pathsOut) const=0; +}; struct BoolHelper : IElement { @@ -1135,6 +1139,11 @@ struct UVEConstant : IUVElement tex.write(w); } const char* ClassID() const {return "CNST";} + + void gatherDependencies(std::vector& pathsOut) const + { + g_curSpec->flattenDependencies(tex, pathsOut); + } }; template @@ -1249,6 +1258,11 @@ struct UVEAnimTexture : IUVElement w.writeBool(loop); } const char* ClassID() const {return "ATEX";} + + void gatherDependencies(std::vector& pathsOut) const + { + g_curSpec->flattenDependencies(tex, pathsOut); + } }; template @@ -1535,6 +1549,13 @@ struct SpawnSystemKeyframeData : BigYAML } operator bool() const {return spawns.size() != 0;} + + void gatherDependencies(std::vector& pathsOut) const + { + for (const auto& p : spawns) + for (const SpawnSystemKeyframeInfo& info : p.second) + g_curSpec->flattenDependencies(info.id, pathsOut); + } }; template diff --git a/DataSpec/DNACommon/STRG.cpp b/DataSpec/DNACommon/STRG.cpp index 7b187c3b4..ae8fb5353 100644 --- a/DataSpec/DNACommon/STRG.cpp +++ b/DataSpec/DNACommon/STRG.cpp @@ -6,6 +6,11 @@ namespace DataSpec { +void ISTRG::gatherDependencies(std::vector& pathsOut) const +{ + /* TODO: parse out resource tokens */ +} + std::unique_ptr LoadSTRG(athena::io::IStreamReader& reader) { uint32_t magic = reader.readUint32Big(); diff --git a/DataSpec/DNACommon/STRG.hpp b/DataSpec/DNACommon/STRG.hpp index bd1ef08fe..10dc74075 100644 --- a/DataSpec/DNACommon/STRG.hpp +++ b/DataSpec/DNACommon/STRG.hpp @@ -19,6 +19,8 @@ struct ISTRG : BigYAML virtual std::wstring getUTF16(const FourCC& lang, size_t idx) const=0; virtual hecl::SystemString getSystemString(const FourCC& lang, size_t idx) const=0; virtual int32_t lookupIdx(const std::string& name) const=0; + + void gatherDependencies(std::vector& pathsOut) const; }; std::unique_ptr LoadSTRG(athena::io::IStreamReader& reader); diff --git a/DataSpec/DNACommon/SWHC.cpp b/DataSpec/DNACommon/SWHC.cpp index 6588c3fa7..b46f62a12 100644 --- a/DataSpec/DNACommon/SWHC.cpp +++ b/DataSpec/DNACommon/SWHC.cpp @@ -538,6 +538,13 @@ void SWSH::write(athena::io::IStreamWriter& w) const w.writeBytes("_END", 4); } +template +void SWSH::gatherDependencies(std::vector& pathsOut) const +{ + if (x3c_TEXR.m_elem) + x3c_TEXR.m_elem->gatherDependencies(pathsOut); +} + template struct SWSH; template struct SWSH; diff --git a/DataSpec/DNACommon/SWHC.hpp b/DataSpec/DNACommon/SWHC.hpp index 880c371f3..be681614d 100644 --- a/DataSpec/DNACommon/SWHC.hpp +++ b/DataSpec/DNACommon/SWHC.hpp @@ -55,6 +55,8 @@ struct SWSH : public BigYAML { x44_25_CROS = true; } + + void gatherDependencies(std::vector&) const; }; template diff --git a/DataSpec/DNACommon/WPSC.cpp b/DataSpec/DNACommon/WPSC.cpp index 1e87b7adc..4dbb8f6f9 100644 --- a/DataSpec/DNACommon/WPSC.cpp +++ b/DataSpec/DNACommon/WPSC.cpp @@ -719,6 +719,18 @@ void WPSM::write(athena::io::IStreamWriter &w) const w.writeBytes("_END", 4); } +template +void WPSM::gatherDependencies(std::vector& pathsOut) const +{ + g_curSpec->flattenDependencies(x34_APSM.id, pathsOut); + g_curSpec->flattenDependencies(x44_APS2.id, pathsOut); + g_curSpec->flattenDependencies(x54_ASW1.id, pathsOut); + g_curSpec->flattenDependencies(x64_ASW2.id, pathsOut); + g_curSpec->flattenDependencies(x74_ASW3.id, pathsOut); + g_curSpec->flattenDependencies(x84_OHEF.id, pathsOut); + g_curSpec->flattenDependencies(x94_COLR.id, pathsOut); +} + template struct WPSM; template struct WPSM; diff --git a/DataSpec/DNACommon/WPSC.hpp b/DataSpec/DNACommon/WPSC.hpp index 520b8b228..b2c847b0c 100644 --- a/DataSpec/DNACommon/WPSC.hpp +++ b/DataSpec/DNACommon/WPSC.hpp @@ -59,6 +59,8 @@ struct WPSM : BigYAML { xa4_EWTR = true; xa5_LWTR = true; xa6_SWTR = true; } + + void gatherDependencies(std::vector&) const; }; template diff --git a/DataSpec/DNAMP1/DNAMP1.cpp b/DataSpec/DNAMP1/DNAMP1.cpp index 2be4d091b..47936d64b 100644 --- a/DataSpec/DNAMP1/DNAMP1.cpp +++ b/DataSpec/DNAMP1/DNAMP1.cpp @@ -145,8 +145,6 @@ void PAKBridge::build() areaName.read(rs); } areaDeps.name = areaName.getSystemString(FOURCC('ENGL'), 0); - - /* Trim possible trailing whitespace */ areaDeps.name = hecl::StringUtils::TrimWhitespace(areaDeps.name); } if (areaDeps.name.empty()) @@ -179,14 +177,8 @@ void PAKBridge::build() Level::Area::Layer& layer = areaDeps.layers.back(); layer.name = LayerName(mlvl.layerNames[layerIdx++]); layer.active = layerFlags.flags >> (l-1) & 0x1; - /* Trim possible trailing whitespace */ -#if HECL_UCS2 - while (layer.name.size() && iswspace(layer.name.back())) - layer.name.pop_back(); -#else - while (layer.name.size() && isspace(layer.name.back())) - layer.name.pop_back(); -#endif + layer.name = hecl::StringUtils::TrimWhitespace(layer.name); + hecl::SNPrintf(num, 16, _S("%02u "), l-1); layer.name = num + layer.name; diff --git a/DataSpec/DNAMP1/MLVL.cpp b/DataSpec/DNAMP1/MLVL.cpp index da5dbff4d..124742b40 100644 --- a/DataSpec/DNAMP1/MLVL.cpp +++ b/DataSpec/DNAMP1/MLVL.cpp @@ -1,5 +1,11 @@ #include "MLVL.hpp" #include "SCLY.hpp" +#include "SAVW.hpp" +#include "SCAN.hpp" +#include "ScriptObjects/MemoryRelay.hpp" +#include "ScriptObjects/SpecialFunction.hpp" +#include "ScriptObjects/DoorArea.hpp" +#include "Runtime/RetroTypes.hpp" namespace DataSpec { @@ -17,6 +23,16 @@ bool MLVL::Extract(const SpecBase& dataSpec, { MLVL mlvl; mlvl.read(rs); + + for (const MLVL::Area& area : mlvl.areas) + { + hecl::ProjectPath areaDir = pakRouter.getWorking(area.areaMREAId).getParentPath(); + athena::io::FileWriter fw(hecl::ProjectPath(areaDir, _S("!memoryid.yaml")).getAbsolutePath()); + athena::io::YAMLDocWriter w(nullptr); + w.writeUint32("memoryid", area.areaId); + w.finish(&fw); + } + athena::io::FileWriter writer(outPath.getWithExtension(_S(".yaml"), true).getAbsolutePath()); mlvl.toYAMLStream(writer, static_cast(&MLVL::writeMeta)); hecl::BlenderConnection& conn = btok.getBlenderConnection(); @@ -32,24 +48,41 @@ bool MLVL::Cook(const hecl::ProjectPath& outPath, const hecl::ProjectPath& inPat mlvl.magic = 0xDEAFBABE; mlvl.version = 0x11; - mlvl.saveWorldId = inPath.ensureAuxInfo(_S(".SAVW")); + hecl::ProjectPath savwPath = inPath.ensureAuxInfo(_S(".SAVW")); + mlvl.saveWorldId = savwPath; + hecl::ProjectPath mapwPath = inPath.ensureAuxInfo(_S(".MAPW")); + mlvl.worldMap = mapwPath; + + std::vector mapaTags; + mapaTags.reserve(wld.areas.size()); + + SAVW savw = {}; + savw.header.magic = 0xC001D00D; + savw.header.version = 0x3; size_t areaIdx = 0; + size_t nameOffset = 0; for (const World::Area& area : wld.areas) { if (area.path.getPathType() != hecl::ProjectPath::Type::Directory) continue; + + hecl::ProjectPath areaPath(area.path, _S("/!area.blend")); + if (!areaPath.isFile()) + continue; + hecl::DirectoryEnumerator dEnum(area.path.getAbsolutePath(), hecl::DirectoryEnumerator::Mode::DirsSorted); bool areaInit = false; + size_t layerIdx = 0; for (const hecl::DirectoryEnumerator::Entry& e : dEnum) { hecl::SystemString layerName; hecl::SystemChar* endCh = nullptr; hecl::StrToUl(e.m_name.c_str(), &endCh, 0); if (!endCh) - layerName = e.m_name; + layerName = hecl::StringUtils::TrimWhitespace(e.m_name); else layerName = hecl::StringUtils::TrimWhitespace(hecl::SystemString(endCh)); @@ -72,21 +105,219 @@ bool MLVL::Cook(const hecl::ProjectPath& outPath, const hecl::ProjectPath& inPat layer.read(reader); } + /* Set active flag state */ hecl::ProjectPath defActivePath(area.path, e.m_name + _S("/!defaultactive")); bool active = defActivePath.isNone() ? false : true; if (!areaInit) { + /* Finish last area */ + if (mlvl.areas.size()) + { + MLVL::Area& areaLast = mlvl.areas.back(); + areaLast.attachedAreaCount = areaLast.attachedAreas.size(); + areaLast.depCount = areaLast.deps.size(); + areaLast.depLayerCount = areaLast.depLayers.size(); + areaLast.dockCount = areaLast.docks.size(); + } + + /* Area map */ + hecl::ProjectPath mapPath(area.path, _S("/!map.blend")); + if (mapPath.isFile()) + mapaTags.push_back(g_curSpec->BuildTagFromPath(mapPath, hecl::SharedBlenderToken)); + + /* Populate area record */ mlvl.areas.emplace_back(); MLVL::Area& areaOut = mlvl.areas.back(); + + hecl::ProjectPath namePath(area.path, _S("/!name.yaml")); + if (namePath.isFile()) + areaOut.areaNameId = namePath; + + areaOut.transformMtx[0] = area.transform[0]; + areaOut.transformMtx[1] = area.transform[1]; + areaOut.transformMtx[2] = area.transform[2]; + areaOut.aabb[0] = area.aabb[0]; + areaOut.aabb[1] = area.aabb[1]; + areaOut.areaMREAId = areaPath; + areaOut.areaId = 0xffffffff; + + hecl::ProjectPath memIdPath(area.path, _S("/!memoryid.yaml")); + if (namePath.isFile()) + { + athena::io::FileReader fr(memIdPath.getAbsolutePath()); + athena::io::YAMLDocReader r; + if (r.parse(&fr)) + areaOut.areaId = r.readUint32("memoryid"); + } + + /* Attached Areas and Docks */ + { + std::unordered_set addedAreas; + areaOut.dockCount = area.docks.size(); + for (const World::Area::Dock& dock : area.docks) + { + areaOut.docks.emplace_back(); + MLVL::Area::Dock& dockOut = areaOut.docks.back(); + dockOut.endpointCount = 1; + dockOut.endpoints.emplace_back(); + MLVL::Area::Dock::Endpoint& ep = dockOut.endpoints.back(); + ep.areaIdx = dock.targetArea; + ep.dockIdx = dock.targetDock; + dockOut.planeVertCount = 4; + dockOut.planeVerts.push_back(dock.verts[0]); + dockOut.planeVerts.push_back(dock.verts[1]); + dockOut.planeVerts.push_back(dock.verts[2]); + dockOut.planeVerts.push_back(dock.verts[3]); + + if (addedAreas.find(dock.targetArea) == addedAreas.cend()) + { + addedAreas.insert(dock.targetArea); + areaOut.attachedAreas.push_back(dock.targetArea); + } + } + areaOut.attachedAreaCount = areaOut.attachedAreas.size(); + } + + /* Layer flags */ + mlvl.layerFlags.emplace_back(); + mlvl.layerFlags.back().layerCount = 0; + mlvl.layerFlags.back().flags = ~0; + + /* Layer name offset */ + mlvl.layerNameOffsets.push_back(nameOffset); + areaInit = true; } + + MLVL::Area& areaOut = mlvl.areas.back(); + areaOut.depLayers.push_back(areaOut.deps.size()); + + /* Gather memory relays, scans, and dependencies */ + { + std::vector depPaths; + std::vector scans; + for (std::unique_ptr& obj : layer.objects) + { + if (obj->type == 0x13) + { + MemoryRelay& memRelay = static_cast(*obj); + for (IScriptObject::Connection& conn : memRelay.connections) + { + mlvl.memRelayLinks.emplace_back(); + MemRelayLink& linkOut = mlvl.memRelayLinks.back(); + linkOut.memRelayId = memRelay.id; + linkOut.targetId = conn.target; + linkOut.msg = conn.msg; + linkOut.active = memRelay.active; + } + savw.relays.push_back(memRelay.id); + } + else if (obj->type == 0x3A) + { + SpecialFunction& specialFunc = static_cast(*obj); + if (specialFunc.type == ESpecialFunctionType::CinematicSkip) + savw.skippableCutscenes.push_back(specialFunc.id); + else if (specialFunc.type == ESpecialFunctionType::ScriptLayerController) + { + savw.layers.emplace_back(); + SAVWCommon::Layer& layer = savw.layers.back(); + layer.areaId = specialFunc.layerSwitch.area; + layer.layer = specialFunc.layerSwitch.layerIdx; + } + } + else if (obj->type == 0x3) + { + DoorArea& doorArea = static_cast(*obj); + savw.doors.push_back(doorArea.id); + } + + obj->gatherDependencies(depPaths); + obj->gatherScans(scans); + } + + /* Cull duplicate paths and add typed hash to list */ + std::unordered_set addedPaths; + for (const hecl::ProjectPath& path : depPaths) + { + if (addedPaths.find(path.hash()) == addedPaths.cend()) + { + addedPaths.insert(path.hash()); + urde::SObjectTag tag = g_curSpec->BuildTagFromPath(path, hecl::SharedBlenderToken); + areaOut.deps.emplace_back(tag.id, tag.type); + } + } + + /* Cull duplicate scans and add to list */ + std::unordered_set addedScans; + for (const Scan& scan : scans) + { + if (addedScans.find(scan.scanId) == addedScans.cend()) + { + addedScans.insert(scan.scanId); + hecl::ProjectPath scanPath = UniqueIDBridge::TranslatePakIdToPath(scan.scanId); + savw.scans.emplace_back(); + Scan& scanOut = savw.scans.back(); + scanOut.scanId = scan.scanId; + scanOut.category = SAVWCommon::EScanCategory(SCAN::GetCategory(scanPath)); + } + } + } + + hecl::SystemUTF8View layerU8(layerName); + mlvl.layerNames.push_back(layerU8.str()); + nameOffset += layerName.size() + 1; + + MLVL::LayerFlags& thisLayFlags = mlvl.layerFlags.back(); + ++thisLayFlags.layerCount; + if (!active) + thisLayFlags.flags &= ~(1 << layerIdx); + + ++layerIdx; } ++areaIdx; } + mlvl.memRelayLinkCount = mlvl.memRelayLinks.size(); mlvl.areaCount = mlvl.areas.size(); + mlvl.layerFlagCount = mlvl.layerFlags.size(); + mlvl.layerNameCount = mlvl.layerNames.size(); + mlvl.layerNameOffsetCount = mlvl.layerNameOffsets.size(); + /* Write out */ + { + athena::io::FileWriter fo(outPath.getAbsolutePath()); + mlvl.write(fo); + } + + /* Write out MAPW */ + { + hecl::ProjectPath mapwCooked = + mapwPath.getCookedPath(*g_curSpec->overrideDataSpec(mapwPath, nullptr, hecl::SharedBlenderToken)); + athena::io::FileWriter fo(mapwCooked.getAbsolutePath()); + fo.writeUint32Big(0xDEADF00D); + fo.writeUint32Big(1); + fo.writeUint32Big(mapaTags.size()); + for (const urde::SObjectTag& mapa : mapaTags) + fo.writeUint32Big(mapa.id); + } + + /* Write out SAVW */ + { + savw.header.areaCount = mlvl.areaCount; + savw.skippableCutsceneCount = savw.skippableCutscenes.size(); + savw.relayCount = savw.relays.size(); + savw.layerCount = savw.layers.size(); + savw.doorCount = savw.doors.size(); + savw.scanCount = savw.scans.size(); + + hecl::ProjectPath savwCooked = + savwPath.getCookedPath(*g_curSpec->overrideDataSpec(savwPath, nullptr, hecl::SharedBlenderToken)); + athena::io::FileWriter fo(savwCooked.getAbsolutePath()); + savw.write(fo); + } + + return true; } } diff --git a/DataSpec/DNAMP1/MLVL.hpp b/DataSpec/DNAMP1/MLVL.hpp index 16510fb48..042dcfc54 100644 --- a/DataSpec/DNAMP1/MLVL.hpp +++ b/DataSpec/DNAMP1/MLVL.hpp @@ -51,6 +51,10 @@ struct MLVL : BigYAML DECL_YAML UniqueID32 id; DNAFourCC type; + + Dependency() = default; + Dependency(const UniqueID32& idin, const hecl::FourCC& fcc) + : id(idin), type(fcc) {} }; Vector deps; diff --git a/DataSpec/DNAMP1/SAVW.hpp b/DataSpec/DNAMP1/SAVW.hpp index b251edfe3..5bd68d94c 100644 --- a/DataSpec/DNAMP1/SAVW.hpp +++ b/DataSpec/DNAMP1/SAVW.hpp @@ -13,6 +13,9 @@ struct Scan : BigYAML DECL_YAML UniqueID32 scanId; Value category; + + Scan() = default; + Scan(const UniqueID32& id) : scanId(id), category(SAVWCommon::EScanCategory::None) {} }; struct SAVW : BigYAML diff --git a/DataSpec/DNAMP1/SCAN.hpp b/DataSpec/DNAMP1/SCAN.hpp index 47c377010..068f1bd38 100644 --- a/DataSpec/DNAMP1/SCAN.hpp +++ b/DataSpec/DNAMP1/SCAN.hpp @@ -171,6 +171,17 @@ struct SCAN : BigYAML return true; } + static Category GetCategory(const hecl::ProjectPath& inPath) + { + SCAN scan; + athena::io::FileReader reader(inPath.getAbsolutePath()); + if (reader.hasError()) + return Category::None; + if (!scan.fromYAMLStream(reader)) + return Category::None; + return scan.category; + } + static void Name(const SpecBase& dataSpec, PAKEntryReadStream& rs, PAKRouter& pakRouter, diff --git a/DataSpec/DNAMP1/ScriptObjects/Actor.hpp b/DataSpec/DNAMP1/ScriptObjects/Actor.hpp index 49ffcbbec..f34c0eab9 100644 --- a/DataSpec/DNAMP1/ScriptObjects/Actor.hpp +++ b/DataSpec/DNAMP1/ScriptObjects/Actor.hpp @@ -52,6 +52,18 @@ struct Actor : IScriptObject animationParameters.nameANCS(pakRouter, name + "_animp"); actorParameters.nameIDs(pakRouter, name + "_actp"); } + + void gatherDependencies(std::vector& pathsOut) const + { + g_curSpec->flattenDependencies(model, pathsOut); + animationParameters.depANCS(pathsOut); + actorParameters.depIDs(pathsOut); + } + + void gatherScans(std::vector& scansOut) const + { + actorParameters.scanIDs(scansOut); + } }; } } diff --git a/DataSpec/DNAMP1/ScriptObjects/ActorContraption.hpp b/DataSpec/DNAMP1/ScriptObjects/ActorContraption.hpp index d7980e108..7d520b398 100644 --- a/DataSpec/DNAMP1/ScriptObjects/ActorContraption.hpp +++ b/DataSpec/DNAMP1/ScriptObjects/ActorContraption.hpp @@ -44,6 +44,18 @@ struct ActorContraption : IScriptObject animationParameters.nameANCS(pakRouter, name + "_animp"); actorParameters.nameIDs(pakRouter, name + "_actp"); } + + void gatherDependencies(std::vector& pathsOut) const + { + g_curSpec->flattenDependencies(particle, pathsOut); + animationParameters.depANCS(pathsOut); + actorParameters.depIDs(pathsOut); + } + + void gatherScans(std::vector& scansOut) const + { + actorParameters.scanIDs(scansOut); + } }; } } diff --git a/DataSpec/DNAMP1/ScriptObjects/AmbientAI.hpp b/DataSpec/DNAMP1/ScriptObjects/AmbientAI.hpp index 025e828b4..8fb55c11d 100644 --- a/DataSpec/DNAMP1/ScriptObjects/AmbientAI.hpp +++ b/DataSpec/DNAMP1/ScriptObjects/AmbientAI.hpp @@ -40,6 +40,17 @@ struct AmbientAI : IScriptObject animationParameters.nameANCS(pakRouter, name + "_animp"); actorParameters.nameIDs(pakRouter, name + "_actp"); } + + void gatherDependencies(std::vector& pathsOut) const + { + animationParameters.depANCS(pathsOut); + actorParameters.depIDs(pathsOut); + } + + void gatherScans(std::vector& scansOut) const + { + actorParameters.scanIDs(scansOut); + } }; } } diff --git a/DataSpec/DNAMP1/ScriptObjects/AreaAttributes.hpp b/DataSpec/DNAMP1/ScriptObjects/AreaAttributes.hpp index ea145b260..d898351a8 100644 --- a/DataSpec/DNAMP1/ScriptObjects/AreaAttributes.hpp +++ b/DataSpec/DNAMP1/ScriptObjects/AreaAttributes.hpp @@ -28,6 +28,11 @@ struct AreaAttributes : IScriptObject Value unknown5; UniqueID32 skybox; Value unknown6; + + void gatherDependencies(std::vector& pathsOut) const + { + g_curSpec->flattenDependencies(skybox, pathsOut); + } }; } } diff --git a/DataSpec/DNAMP1/ScriptObjects/AtomicAlpha.hpp b/DataSpec/DNAMP1/ScriptObjects/AtomicAlpha.hpp index ee60db4f7..2af16299e 100644 --- a/DataSpec/DNAMP1/ScriptObjects/AtomicAlpha.hpp +++ b/DataSpec/DNAMP1/ScriptObjects/AtomicAlpha.hpp @@ -48,6 +48,19 @@ struct AtomicAlpha : IScriptObject patternedInfo.nameIDs(pakRouter, name + "_patterned"); actorParameters.nameIDs(pakRouter, name + "_actp"); } + + void gatherDependencies(std::vector& pathsOut) const + { + g_curSpec->flattenDependencies(wpsc, pathsOut); + g_curSpec->flattenDependencies(model, pathsOut); + patternedInfo.depIDs(pathsOut); + actorParameters.depIDs(pathsOut); + } + + void gatherScans(std::vector& scansOut) const + { + actorParameters.scanIDs(scansOut); + } }; } } diff --git a/DataSpec/DNAMP1/ScriptObjects/AtomicBeta.hpp b/DataSpec/DNAMP1/ScriptObjects/AtomicBeta.hpp index 17086a8c7..f2faae872 100644 --- a/DataSpec/DNAMP1/ScriptObjects/AtomicBeta.hpp +++ b/DataSpec/DNAMP1/ScriptObjects/AtomicBeta.hpp @@ -60,6 +60,20 @@ struct AtomicBeta : IScriptObject patternedInfo.nameIDs(pakRouter, name + "_patterned"); actorParameters.nameIDs(pakRouter, name + "_actp"); } + + void gatherDependencies(std::vector& pathsOut) const + { + g_curSpec->flattenDependencies(elsc, pathsOut); + g_curSpec->flattenDependencies(wpsc, pathsOut); + g_curSpec->flattenDependencies(part, pathsOut); + patternedInfo.depIDs(pathsOut); + actorParameters.depIDs(pathsOut); + } + + void gatherScans(std::vector& scansOut) const + { + actorParameters.scanIDs(scansOut); + } }; } } diff --git a/DataSpec/DNAMP1/ScriptObjects/Babygoth.hpp b/DataSpec/DNAMP1/ScriptObjects/Babygoth.hpp index f8302ff08..34087903e 100644 --- a/DataSpec/DNAMP1/ScriptObjects/Babygoth.hpp +++ b/DataSpec/DNAMP1/ScriptObjects/Babygoth.hpp @@ -115,6 +115,28 @@ struct Babygoth : IScriptObject patternedInfo.nameIDs(pakRouter, name + "_patterned"); actorParameters.nameIDs(pakRouter, name + "_actp"); } + + void gatherDependencies(std::vector& pathsOut) const + { + g_curSpec->flattenDependencies(wpsc1, pathsOut); + g_curSpec->flattenDependencies(wpsc2, pathsOut); + g_curSpec->flattenDependencies(particle1, pathsOut); + g_curSpec->flattenDependencies(model, pathsOut); + g_curSpec->flattenDependencies(skin, pathsOut); + g_curSpec->flattenDependencies(particle2, pathsOut); + g_curSpec->flattenDependencies(particle3, pathsOut); + g_curSpec->flattenDependencies(particle4, pathsOut); + g_curSpec->flattenDependencies(particle5, pathsOut); + g_curSpec->flattenDependencies(texture, pathsOut); + g_curSpec->flattenDependencies(particle6, pathsOut); + patternedInfo.depIDs(pathsOut); + actorParameters.depIDs(pathsOut); + } + + void gatherScans(std::vector& scansOut) const + { + actorParameters.scanIDs(scansOut); + } }; } } diff --git a/DataSpec/DNAMP1/ScriptObjects/Beetle.hpp b/DataSpec/DNAMP1/ScriptObjects/Beetle.hpp index 844c67a57..26560f1c0 100644 --- a/DataSpec/DNAMP1/ScriptObjects/Beetle.hpp +++ b/DataSpec/DNAMP1/ScriptObjects/Beetle.hpp @@ -45,6 +45,18 @@ struct Beetle : IScriptObject patternedInfo.nameIDs(pakRouter, name + "_patterned"); actorParameters.nameIDs(pakRouter, name + "_actp"); } + + void gatherDependencies(std::vector& pathsOut) const + { + g_curSpec->flattenDependencies(model, pathsOut); + patternedInfo.depIDs(pathsOut); + actorParameters.depIDs(pathsOut); + } + + void gatherScans(std::vector& scansOut) const + { + actorParameters.scanIDs(scansOut); + } }; } } diff --git a/DataSpec/DNAMP1/ScriptObjects/BloodFlower.hpp b/DataSpec/DNAMP1/ScriptObjects/BloodFlower.hpp index 95f685e25..f566d367d 100644 --- a/DataSpec/DNAMP1/ScriptObjects/BloodFlower.hpp +++ b/DataSpec/DNAMP1/ScriptObjects/BloodFlower.hpp @@ -77,6 +77,24 @@ struct BloodFlower : IScriptObject patternedInfo.nameIDs(pakRouter, name + "_patterned"); actorParameters.nameIDs(pakRouter, name + "_actp"); } + + void gatherDependencies(std::vector& pathsOut) const + { + g_curSpec->flattenDependencies(wpsc1, pathsOut); + g_curSpec->flattenDependencies(wpsc2, pathsOut); + g_curSpec->flattenDependencies(particle1, pathsOut); + g_curSpec->flattenDependencies(particle2, pathsOut); + g_curSpec->flattenDependencies(particle3, pathsOut); + g_curSpec->flattenDependencies(particle4, pathsOut); + g_curSpec->flattenDependencies(particle5, pathsOut); + patternedInfo.depIDs(pathsOut); + actorParameters.depIDs(pathsOut); + } + + void gatherScans(std::vector& scansOut) const + { + actorParameters.scanIDs(scansOut); + } }; } } diff --git a/DataSpec/DNAMP1/ScriptObjects/Burrower.hpp b/DataSpec/DNAMP1/ScriptObjects/Burrower.hpp index b8b3a3cec..182f6d8ad 100644 --- a/DataSpec/DNAMP1/ScriptObjects/Burrower.hpp +++ b/DataSpec/DNAMP1/ScriptObjects/Burrower.hpp @@ -62,6 +62,22 @@ struct Burrower : IScriptObject patternedInfo.nameIDs(pakRouter, name + "_patterned"); actorParameters.nameIDs(pakRouter, name + "_actp"); } + + void gatherDependencies(std::vector& pathsOut) const + { + g_curSpec->flattenDependencies(wpsc, pathsOut); + g_curSpec->flattenDependencies(particle1, pathsOut); + g_curSpec->flattenDependencies(particle2, pathsOut); + g_curSpec->flattenDependencies(particle3, pathsOut); + g_curSpec->flattenDependencies(particle4, pathsOut); + patternedInfo.depIDs(pathsOut); + actorParameters.depIDs(pathsOut); + } + + void gatherScans(std::vector& scansOut) const + { + actorParameters.scanIDs(scansOut); + } }; } } diff --git a/DataSpec/DNAMP1/ScriptObjects/CameraFilterKeyframe.hpp b/DataSpec/DNAMP1/ScriptObjects/CameraFilterKeyframe.hpp index 9192e5620..ee8ac4b25 100644 --- a/DataSpec/DNAMP1/ScriptObjects/CameraFilterKeyframe.hpp +++ b/DataSpec/DNAMP1/ScriptObjects/CameraFilterKeyframe.hpp @@ -31,6 +31,11 @@ struct CameraFilterKeyframe : IScriptObject ent->name = name + "_texture"; } } + + void gatherDependencies(std::vector& pathsOut) const + { + g_curSpec->flattenDependencies(texture, pathsOut); + } }; } } diff --git a/DataSpec/DNAMP1/ScriptObjects/ChozoGhost.hpp b/DataSpec/DNAMP1/ScriptObjects/ChozoGhost.hpp index 5a3f955ac..09e9490b9 100644 --- a/DataSpec/DNAMP1/ScriptObjects/ChozoGhost.hpp +++ b/DataSpec/DNAMP1/ScriptObjects/ChozoGhost.hpp @@ -70,6 +70,20 @@ struct ChozoGhost : IScriptObject patternedInfo.nameIDs(pakRouter, name + "_patterned"); actorParameters.nameIDs(pakRouter, name + "_actp"); } + + void gatherDependencies(std::vector& pathsOut) const + { + g_curSpec->flattenDependencies(wpsc1, pathsOut); + g_curSpec->flattenDependencies(wpsc2, pathsOut); + g_curSpec->flattenDependencies(particle, pathsOut); + patternedInfo.depIDs(pathsOut); + actorParameters.depIDs(pathsOut); + } + + void gatherScans(std::vector& scansOut) const + { + actorParameters.scanIDs(scansOut); + } }; } } diff --git a/DataSpec/DNAMP1/ScriptObjects/DamageableTrigger.hpp b/DataSpec/DNAMP1/ScriptObjects/DamageableTrigger.hpp index 297c8f183..5838d5161 100644 --- a/DataSpec/DNAMP1/ScriptObjects/DamageableTrigger.hpp +++ b/DataSpec/DNAMP1/ScriptObjects/DamageableTrigger.hpp @@ -43,6 +43,13 @@ struct DamageableTrigger : IScriptObject ent->name = name + "_texture3"; } } + + void gatherDependencies(std::vector& pathsOut) const + { + g_curSpec->flattenDependencies(texture1, pathsOut); + g_curSpec->flattenDependencies(texture2, pathsOut); + g_curSpec->flattenDependencies(texture3, pathsOut); + } }; } } diff --git a/DataSpec/DNAMP1/ScriptObjects/Debris.hpp b/DataSpec/DNAMP1/ScriptObjects/Debris.hpp index 874a52a76..fa360509f 100644 --- a/DataSpec/DNAMP1/ScriptObjects/Debris.hpp +++ b/DataSpec/DNAMP1/ScriptObjects/Debris.hpp @@ -45,6 +45,18 @@ struct Debris : IScriptObject } actorParameters.nameIDs(pakRouter, name + "_actp"); } + + void gatherDependencies(std::vector& pathsOut) const + { + g_curSpec->flattenDependencies(model, pathsOut); + g_curSpec->flattenDependencies(particle, pathsOut); + actorParameters.depIDs(pathsOut); + } + + void gatherScans(std::vector& scansOut) const + { + actorParameters.scanIDs(scansOut); + } }; } } diff --git a/DataSpec/DNAMP1/ScriptObjects/DebrisExtended.hpp b/DataSpec/DNAMP1/ScriptObjects/DebrisExtended.hpp index 6ffc7770f..6cdc210db 100644 --- a/DataSpec/DNAMP1/ScriptObjects/DebrisExtended.hpp +++ b/DataSpec/DNAMP1/ScriptObjects/DebrisExtended.hpp @@ -76,6 +76,20 @@ struct DebrisExtended : IScriptObject } actorParameters.nameIDs(pakRouter, name + "_actp"); } + + void gatherDependencies(std::vector& pathsOut) const + { + g_curSpec->flattenDependencies(model, pathsOut); + g_curSpec->flattenDependencies(particle1, pathsOut); + g_curSpec->flattenDependencies(particle2, pathsOut); + g_curSpec->flattenDependencies(particle3, pathsOut); + actorParameters.depIDs(pathsOut); + } + + void gatherScans(std::vector& scansOut) const + { + actorParameters.scanIDs(scansOut); + } }; } } diff --git a/DataSpec/DNAMP1/ScriptObjects/DoorArea.hpp b/DataSpec/DNAMP1/ScriptObjects/DoorArea.hpp index fc567d3dc..597241438 100644 --- a/DataSpec/DNAMP1/ScriptObjects/DoorArea.hpp +++ b/DataSpec/DNAMP1/ScriptObjects/DoorArea.hpp @@ -38,6 +38,17 @@ struct DoorArea : IScriptObject animationParameters.nameANCS(pakRouter, name + "_animp"); actorParameters.nameIDs(pakRouter, name + "_actp"); } + + void gatherDependencies(std::vector& pathsOut) const + { + animationParameters.depANCS(pathsOut); + actorParameters.depIDs(pathsOut); + } + + void gatherScans(std::vector& scansOut) const + { + actorParameters.scanIDs(scansOut); + } }; } } diff --git a/DataSpec/DNAMP1/ScriptObjects/Drone.hpp b/DataSpec/DNAMP1/ScriptObjects/Drone.hpp index 15fd9559f..0ae2535a2 100644 --- a/DataSpec/DNAMP1/ScriptObjects/Drone.hpp +++ b/DataSpec/DNAMP1/ScriptObjects/Drone.hpp @@ -79,6 +79,23 @@ struct Drone : IScriptObject patternedInfo.nameIDs(pakRouter, name + "_patterned"); actorParameters.nameIDs(pakRouter, name + "_actp"); } + + void gatherDependencies(std::vector& pathsOut) const + { + g_curSpec->flattenDependencies(crsc, pathsOut); + flareDefinition1.depIDs(pathsOut); + flareDefinition2.depIDs(pathsOut); + flareDefinition3.depIDs(pathsOut); + flareDefinition4.depIDs(pathsOut); + flareDefinition5.depIDs(pathsOut); + patternedInfo.depIDs(pathsOut); + actorParameters.depIDs(pathsOut); + } + + void gatherScans(std::vector& scansOut) const + { + actorParameters.scanIDs(scansOut); + } }; } } diff --git a/DataSpec/DNAMP1/ScriptObjects/Effect.hpp b/DataSpec/DNAMP1/ScriptObjects/Effect.hpp index c2489587f..e139d0e00 100644 --- a/DataSpec/DNAMP1/ScriptObjects/Effect.hpp +++ b/DataSpec/DNAMP1/ScriptObjects/Effect.hpp @@ -50,6 +50,12 @@ struct Effect : IScriptObject ent->name = name + "_elsc"; } } + + void gatherDependencies(std::vector& pathsOut) const + { + g_curSpec->flattenDependencies(part, pathsOut); + g_curSpec->flattenDependencies(elsc, pathsOut); + } }; } } diff --git a/DataSpec/DNAMP1/ScriptObjects/ElectroMagneticPulse.hpp b/DataSpec/DNAMP1/ScriptObjects/ElectroMagneticPulse.hpp index 52bac3984..0ae27c5a3 100644 --- a/DataSpec/DNAMP1/ScriptObjects/ElectroMagneticPulse.hpp +++ b/DataSpec/DNAMP1/ScriptObjects/ElectroMagneticPulse.hpp @@ -33,6 +33,11 @@ struct ElectroMagneticPulse : IScriptObject ent->name = name + "_part"; } } + + void gatherDependencies(std::vector& pathsOut) const + { + g_curSpec->flattenDependencies(particle, pathsOut); + } }; } } diff --git a/DataSpec/DNAMP1/ScriptObjects/ElitePirate.hpp b/DataSpec/DNAMP1/ScriptObjects/ElitePirate.hpp index 221d23dd3..2181be980 100644 --- a/DataSpec/DNAMP1/ScriptObjects/ElitePirate.hpp +++ b/DataSpec/DNAMP1/ScriptObjects/ElitePirate.hpp @@ -114,6 +114,29 @@ struct ElitePirate : IScriptObject actorParameters2.nameIDs(pakRouter, name + "_actp2"); animationParameters.nameANCS(pakRouter, name + "_animp"); } + + void gatherDependencies(std::vector& pathsOut) const + { + g_curSpec->flattenDependencies(particle1, pathsOut); + g_curSpec->flattenDependencies(particle2, pathsOut); + g_curSpec->flattenDependencies(model, pathsOut); + g_curSpec->flattenDependencies(particle3, pathsOut); + g_curSpec->flattenDependencies(particle4, pathsOut); + g_curSpec->flattenDependencies(particle5, pathsOut); + g_curSpec->flattenDependencies(particle6, pathsOut); + g_curSpec->flattenDependencies(particle7, pathsOut); + g_curSpec->flattenDependencies(elsc, pathsOut); + patternedInfo.depIDs(pathsOut); + actorParameters1.depIDs(pathsOut); + actorParameters2.depIDs(pathsOut); + animationParameters.depANCS(pathsOut); + } + + void gatherScans(std::vector& scansOut) const + { + actorParameters1.scanIDs(scansOut); + actorParameters2.scanIDs(scansOut); + } }; } } diff --git a/DataSpec/DNAMP1/ScriptObjects/EnergyBall.hpp b/DataSpec/DNAMP1/ScriptObjects/EnergyBall.hpp index bb447e6f0..3a1e381ad 100644 --- a/DataSpec/DNAMP1/ScriptObjects/EnergyBall.hpp +++ b/DataSpec/DNAMP1/ScriptObjects/EnergyBall.hpp @@ -64,6 +64,21 @@ struct EnergyBall : IScriptObject patternedInfo.nameIDs(pakRouter, name + "_patterned"); actorParameters.nameIDs(pakRouter, name + "_actp"); } + + void gatherDependencies(std::vector& pathsOut) const + { + g_curSpec->flattenDependencies(texture, pathsOut); + g_curSpec->flattenDependencies(particle1, pathsOut); + g_curSpec->flattenDependencies(particle2, pathsOut); + g_curSpec->flattenDependencies(elsc, pathsOut); + patternedInfo.depIDs(pathsOut); + actorParameters.depIDs(pathsOut); + } + + void gatherScans(std::vector& scansOut) const + { + actorParameters.scanIDs(scansOut); + } }; } } diff --git a/DataSpec/DNAMP1/ScriptObjects/Eyeball.hpp b/DataSpec/DNAMP1/ScriptObjects/Eyeball.hpp index be9bee9c5..37c97e139 100644 --- a/DataSpec/DNAMP1/ScriptObjects/Eyeball.hpp +++ b/DataSpec/DNAMP1/ScriptObjects/Eyeball.hpp @@ -70,6 +70,22 @@ struct Eyeball : IScriptObject patternedInfo.nameIDs(pakRouter, name + "_patterned"); actorParameters.nameIDs(pakRouter, name + "_actp"); } + + void gatherDependencies(std::vector& pathsOut) const + { + g_curSpec->flattenDependencies(wpsc, pathsOut); + g_curSpec->flattenDependencies(particle1, pathsOut); + g_curSpec->flattenDependencies(particle2, pathsOut); + g_curSpec->flattenDependencies(texture1, pathsOut); + g_curSpec->flattenDependencies(texture2, pathsOut); + patternedInfo.depIDs(pathsOut); + actorParameters.depIDs(pathsOut); + } + + void gatherScans(std::vector& scansOut) const + { + actorParameters.scanIDs(scansOut); + } }; } } diff --git a/DataSpec/DNAMP1/ScriptObjects/FireFlea.hpp b/DataSpec/DNAMP1/ScriptObjects/FireFlea.hpp index 45b59460f..c8b921702 100644 --- a/DataSpec/DNAMP1/ScriptObjects/FireFlea.hpp +++ b/DataSpec/DNAMP1/ScriptObjects/FireFlea.hpp @@ -33,6 +33,17 @@ struct FireFlea : IScriptObject patternedInfo.nameIDs(pakRouter, name + "_patterned"); actorParameters.nameIDs(pakRouter, name + "_actp"); } + + void gatherDependencies(std::vector& pathsOut) const + { + patternedInfo.depIDs(pathsOut); + actorParameters.depIDs(pathsOut); + } + + void gatherScans(std::vector& scansOut) const + { + actorParameters.scanIDs(scansOut); + } }; } } diff --git a/DataSpec/DNAMP1/ScriptObjects/FishCloud.hpp b/DataSpec/DNAMP1/ScriptObjects/FishCloud.hpp index 401f212da..3319b52ed 100644 --- a/DataSpec/DNAMP1/ScriptObjects/FishCloud.hpp +++ b/DataSpec/DNAMP1/ScriptObjects/FishCloud.hpp @@ -58,6 +58,12 @@ struct FishCloud : IScriptObject } animationParameters.nameANCS(pakRouter, name + "_animp"); } + + void gatherDependencies(std::vector& pathsOut) const + { + g_curSpec->flattenDependencies(model, pathsOut); + animationParameters.depANCS(pathsOut); + } }; } } diff --git a/DataSpec/DNAMP1/ScriptObjects/Flaahgra.hpp b/DataSpec/DNAMP1/ScriptObjects/Flaahgra.hpp index f99336396..f007e97a5 100644 --- a/DataSpec/DNAMP1/ScriptObjects/Flaahgra.hpp +++ b/DataSpec/DNAMP1/ScriptObjects/Flaahgra.hpp @@ -70,6 +70,24 @@ struct Flaahgra : IScriptObject actorParameters2.nameIDs(pakRouter, name + "_actp2"); animationParameters.nameANCS(pakRouter, name + "_animp"); } + + void gatherDependencies(std::vector& pathsOut) const + { + g_curSpec->flattenDependencies(wpsc1, pathsOut); + g_curSpec->flattenDependencies(wpsc2, pathsOut); + g_curSpec->flattenDependencies(particle, pathsOut); + g_curSpec->flattenDependencies(dependencyGroup, pathsOut); + patternedInfo.depIDs(pathsOut); + actorParameters1.depIDs(pathsOut); + actorParameters2.depIDs(pathsOut); + animationParameters.depANCS(pathsOut); + } + + void gatherScans(std::vector& scansOut) const + { + actorParameters1.scanIDs(scansOut); + actorParameters2.scanIDs(scansOut); + } }; } } diff --git a/DataSpec/DNAMP1/ScriptObjects/FlaahgraTentacle.hpp b/DataSpec/DNAMP1/ScriptObjects/FlaahgraTentacle.hpp index 1f49733a0..7d6ffdab0 100644 --- a/DataSpec/DNAMP1/ScriptObjects/FlaahgraTentacle.hpp +++ b/DataSpec/DNAMP1/ScriptObjects/FlaahgraTentacle.hpp @@ -30,6 +30,17 @@ struct FlaahgraTentacle : IScriptObject patternedInfo.nameIDs(pakRouter, name + "_patterned"); actorParameters.nameIDs(pakRouter, name + "_actp"); } + + void gatherDependencies(std::vector& pathsOut) const + { + patternedInfo.depIDs(pathsOut); + actorParameters.depIDs(pathsOut); + } + + void gatherScans(std::vector& scansOut) const + { + actorParameters.scanIDs(scansOut); + } }; } } diff --git a/DataSpec/DNAMP1/ScriptObjects/FlickerBat.hpp b/DataSpec/DNAMP1/ScriptObjects/FlickerBat.hpp index 977b7de11..92c3ef7c8 100644 --- a/DataSpec/DNAMP1/ScriptObjects/FlickerBat.hpp +++ b/DataSpec/DNAMP1/ScriptObjects/FlickerBat.hpp @@ -34,6 +34,17 @@ struct FlickerBat : IScriptObject patternedInfo.nameIDs(pakRouter, name + "_patterned"); actorParameters.nameIDs(pakRouter, name + "_actp"); } + + void gatherDependencies(std::vector& pathsOut) const + { + patternedInfo.depIDs(pathsOut); + actorParameters.depIDs(pathsOut); + } + + void gatherScans(std::vector& scansOut) const + { + actorParameters.scanIDs(scansOut); + } }; } } diff --git a/DataSpec/DNAMP1/ScriptObjects/FlyingPirate.hpp b/DataSpec/DNAMP1/ScriptObjects/FlyingPirate.hpp index b1cc593af..76f9ceb46 100644 --- a/DataSpec/DNAMP1/ScriptObjects/FlyingPirate.hpp +++ b/DataSpec/DNAMP1/ScriptObjects/FlyingPirate.hpp @@ -95,6 +95,24 @@ struct FlyingPirate : IScriptObject patternedInfo.nameIDs(pakRouter, name + "_patterned"); actorParameters.nameIDs(pakRouter, name + "_actp"); } + + void gatherDependencies(std::vector& pathsOut) const + { + g_curSpec->flattenDependencies(wpsc1, pathsOut); + g_curSpec->flattenDependencies(wpsc2, pathsOut); + g_curSpec->flattenDependencies(wpsc3, pathsOut); + g_curSpec->flattenDependencies(particle1, pathsOut); + g_curSpec->flattenDependencies(particle2, pathsOut); + g_curSpec->flattenDependencies(particle3, pathsOut); + g_curSpec->flattenDependencies(particle4, pathsOut); + patternedInfo.depIDs(pathsOut); + actorParameters.depIDs(pathsOut); + } + + void gatherScans(std::vector& scansOut) const + { + actorParameters.scanIDs(scansOut); + } }; } } diff --git a/DataSpec/DNAMP1/ScriptObjects/Geemer.hpp b/DataSpec/DNAMP1/ScriptObjects/Geemer.hpp index 4190bad14..c12fc9aef 100644 --- a/DataSpec/DNAMP1/ScriptObjects/Geemer.hpp +++ b/DataSpec/DNAMP1/ScriptObjects/Geemer.hpp @@ -40,6 +40,17 @@ struct Geemer : IScriptObject patternedInfo.nameIDs(pakRouter, name + "_patterned"); actorParameters.nameIDs(pakRouter, name + "_actp"); } + + void gatherDependencies(std::vector& pathsOut) const + { + patternedInfo.depIDs(pathsOut); + actorParameters.depIDs(pathsOut); + } + + void gatherScans(std::vector& scansOut) const + { + actorParameters.scanIDs(scansOut); + } }; } } diff --git a/DataSpec/DNAMP1/ScriptObjects/GunTurret.hpp b/DataSpec/DNAMP1/ScriptObjects/GunTurret.hpp index 95f0db042..824f67370 100644 --- a/DataSpec/DNAMP1/ScriptObjects/GunTurret.hpp +++ b/DataSpec/DNAMP1/ScriptObjects/GunTurret.hpp @@ -117,6 +117,26 @@ struct GunTurret : IScriptObject animationParameters.nameANCS(pakRouter, name + "_animp"); actorParameters.nameIDs(pakRouter, name + "_actp"); } + + void gatherDependencies(std::vector &pathsOut) const + { + g_curSpec->flattenDependencies(unknown18, pathsOut); + g_curSpec->flattenDependencies(model, pathsOut); + g_curSpec->flattenDependencies(particle1, pathsOut); + g_curSpec->flattenDependencies(particle2, pathsOut); + g_curSpec->flattenDependencies(particle3, pathsOut); + g_curSpec->flattenDependencies(particle4, pathsOut); + g_curSpec->flattenDependencies(particle5, pathsOut); + g_curSpec->flattenDependencies(particle6, pathsOut); + g_curSpec->flattenDependencies(particle7, pathsOut); + animationParameters.depANCS(pathsOut); + actorParameters.depIDs(pathsOut); + } + + void gatherScans(std::vector& scansOut) const + { + actorParameters.scanIDs(scansOut); + } }; } } diff --git a/DataSpec/DNAMP1/ScriptObjects/HUDMemo.hpp b/DataSpec/DNAMP1/ScriptObjects/HUDMemo.hpp index b1a629fa6..ab247d63b 100644 --- a/DataSpec/DNAMP1/ScriptObjects/HUDMemo.hpp +++ b/DataSpec/DNAMP1/ScriptObjects/HUDMemo.hpp @@ -27,6 +27,11 @@ struct HUDMemo : IScriptObject ent->name = name + "_message"; } } + + void gatherDependencies(std::vector &pathsOut) const + { + g_curSpec->flattenDependencies(message, pathsOut); + } }; } } diff --git a/DataSpec/DNAMP1/ScriptObjects/IScriptObject.hpp b/DataSpec/DNAMP1/ScriptObjects/IScriptObject.hpp index db008e9d9..4a42ab67d 100644 --- a/DataSpec/DNAMP1/ScriptObjects/IScriptObject.hpp +++ b/DataSpec/DNAMP1/ScriptObjects/IScriptObject.hpp @@ -2,6 +2,7 @@ #define __DNAMP1_SCRIPTOBJECT_HPP #include "../../DNACommon/DNACommon.hpp" #include "../DNAMP1.hpp" +#include "../SAVW.hpp" #include namespace DataSpec @@ -27,10 +28,10 @@ struct IScriptObject : BigYAML virtual ~IScriptObject() = default; virtual void addCMDLRigPairs(PAKRouter&, - std::unordered_map>&) const - { - } + std::unordered_map>&) const {} virtual void nameIDs(PAKRouter& pakRouter) const {} + virtual void gatherDependencies(std::vector& pathsOut) const {} + virtual void gatherScans(std::vector& scansOut) const {} }; } } diff --git a/DataSpec/DNAMP1/ScriptObjects/IceSheegoth.hpp b/DataSpec/DNAMP1/ScriptObjects/IceSheegoth.hpp index f290b71bb..f559ceef1 100644 --- a/DataSpec/DNAMP1/ScriptObjects/IceSheegoth.hpp +++ b/DataSpec/DNAMP1/ScriptObjects/IceSheegoth.hpp @@ -111,6 +111,27 @@ struct IceSheegoth : IScriptObject patternedInfo.nameIDs(pakRouter, name + "_patterned"); actorParameters.nameIDs(pakRouter, name + "_actp"); } + + void gatherDependencies(std::vector &pathsOut) const + { + g_curSpec->flattenDependencies(wpsc1, pathsOut); + g_curSpec->flattenDependencies(wpsc2, pathsOut); + g_curSpec->flattenDependencies(particle1, pathsOut); + g_curSpec->flattenDependencies(particle2, pathsOut); + g_curSpec->flattenDependencies(particle3, pathsOut); + g_curSpec->flattenDependencies(particle4, pathsOut); + g_curSpec->flattenDependencies(particle5, pathsOut); + g_curSpec->flattenDependencies(elsc, pathsOut); + g_curSpec->flattenDependencies(texture, pathsOut); + g_curSpec->flattenDependencies(particle6, pathsOut); + patternedInfo.depIDs(pathsOut); + actorParameters.depIDs(pathsOut); + } + + void gatherScans(std::vector& scansOut) const + { + actorParameters.scanIDs(scansOut); + } }; } } diff --git a/DataSpec/DNAMP1/ScriptObjects/IceZoomer.hpp b/DataSpec/DNAMP1/ScriptObjects/IceZoomer.hpp index 9e8b48cd1..2b70aee56 100644 --- a/DataSpec/DNAMP1/ScriptObjects/IceZoomer.hpp +++ b/DataSpec/DNAMP1/ScriptObjects/IceZoomer.hpp @@ -40,6 +40,17 @@ struct IceZoomer : IScriptObject patternedInfo.nameIDs(pakRouter, name + "_patterned"); actorParameters.nameIDs(pakRouter, name + "_actp"); } + + void gatherDependencies(std::vector &pathsOut) const + { + patternedInfo.depIDs(pathsOut); + actorParameters.depIDs(pathsOut); + } + + void gatherScans(std::vector& scansOut) const + { + actorParameters.scanIDs(scansOut); + } }; } } diff --git a/DataSpec/DNAMP1/ScriptObjects/JellyZap.hpp b/DataSpec/DNAMP1/ScriptObjects/JellyZap.hpp index fec02b80a..24d707324 100644 --- a/DataSpec/DNAMP1/ScriptObjects/JellyZap.hpp +++ b/DataSpec/DNAMP1/ScriptObjects/JellyZap.hpp @@ -44,6 +44,17 @@ struct JellyZap : IScriptObject patternedInfo.nameIDs(pakRouter, name + "_patterned"); actorParameters.nameIDs(pakRouter, name + "_actp"); } + + void gatherDependencies(std::vector &pathsOut) const + { + patternedInfo.depIDs(pathsOut); + actorParameters.depIDs(pathsOut); + } + + void gatherScans(std::vector& scansOut) const + { + actorParameters.scanIDs(scansOut); + } }; } } diff --git a/DataSpec/DNAMP1/ScriptObjects/Magdolite.hpp b/DataSpec/DNAMP1/ScriptObjects/Magdolite.hpp index 885190ba2..e2a91faba 100644 --- a/DataSpec/DNAMP1/ScriptObjects/Magdolite.hpp +++ b/DataSpec/DNAMP1/ScriptObjects/Magdolite.hpp @@ -74,6 +74,20 @@ struct Magdolite : IScriptObject patternedInfo.nameIDs(pakRouter, name + "_patterned"); actorParameters.nameIDs(pakRouter, name + "_actp"); } + + void gatherDependencies(std::vector &pathsOut) const + { + g_curSpec->flattenDependencies(model, pathsOut); + g_curSpec->flattenDependencies(skin, pathsOut); + g_curSpec->flattenDependencies(magdoliteParameters.particle, pathsOut); + patternedInfo.depIDs(pathsOut); + actorParameters.depIDs(pathsOut); + } + + void gatherScans(std::vector& scansOut) const + { + actorParameters.scanIDs(scansOut); + } }; } } diff --git a/DataSpec/DNAMP1/ScriptObjects/MetareeAlpha.hpp b/DataSpec/DNAMP1/ScriptObjects/MetareeAlpha.hpp index 6ff0c7804..56b6f24fe 100644 --- a/DataSpec/DNAMP1/ScriptObjects/MetareeAlpha.hpp +++ b/DataSpec/DNAMP1/ScriptObjects/MetareeAlpha.hpp @@ -36,6 +36,17 @@ struct MetareeAlpha : IScriptObject patternedInfo.nameIDs(pakRouter, name + "_patterned"); actorParameters.nameIDs(pakRouter, name + "_actp"); } + + void gatherDependencies(std::vector &pathsOut) const + { + patternedInfo.depIDs(pathsOut); + actorParameters.depIDs(pathsOut); + } + + void gatherScans(std::vector& scansOut) const + { + actorParameters.scanIDs(scansOut); + } }; } } diff --git a/DataSpec/DNAMP1/ScriptObjects/MetroidAlpha.hpp b/DataSpec/DNAMP1/ScriptObjects/MetroidAlpha.hpp index 0623bcde6..55b349b5d 100644 --- a/DataSpec/DNAMP1/ScriptObjects/MetroidAlpha.hpp +++ b/DataSpec/DNAMP1/ScriptObjects/MetroidAlpha.hpp @@ -48,6 +48,21 @@ struct MetroidAlpha : IScriptObject animationParameters3.nameANCS(pakRouter, name + "_animp3"); animationParameters4.nameANCS(pakRouter, name + "_animp4"); } + + void gatherDependencies(std::vector &pathsOut) const + { + patternedInfo.depIDs(pathsOut); + actorParameters.depIDs(pathsOut); + animationParameters1.depANCS(pathsOut); + animationParameters2.depANCS(pathsOut); + animationParameters3.depANCS(pathsOut); + animationParameters4.depANCS(pathsOut); + } + + void gatherScans(std::vector& scansOut) const + { + actorParameters.scanIDs(scansOut); + } }; } } diff --git a/DataSpec/DNAMP1/ScriptObjects/MetroidBeta.hpp b/DataSpec/DNAMP1/ScriptObjects/MetroidBeta.hpp index 0ca382a76..3c02bee4e 100644 --- a/DataSpec/DNAMP1/ScriptObjects/MetroidBeta.hpp +++ b/DataSpec/DNAMP1/ScriptObjects/MetroidBeta.hpp @@ -72,6 +72,22 @@ struct MetroidBeta : IScriptObject patternedInfo.nameIDs(pakRouter, name + "_patterned"); actorParameters.nameIDs(pakRouter, name + "_actp"); } + + void gatherDependencies(std::vector &pathsOut) const + { + g_curSpec->flattenDependencies(particle1, pathsOut); + g_curSpec->flattenDependencies(particle2, pathsOut); + g_curSpec->flattenDependencies(particle3, pathsOut); + g_curSpec->flattenDependencies(particle4, pathsOut); + g_curSpec->flattenDependencies(swhc, pathsOut); + patternedInfo.depIDs(pathsOut); + actorParameters.depIDs(pathsOut); + } + + void gatherScans(std::vector& scansOut) const + { + actorParameters.scanIDs(scansOut); + } }; } } diff --git a/DataSpec/DNAMP1/ScriptObjects/MetroidPrimeStage1.hpp b/DataSpec/DNAMP1/ScriptObjects/MetroidPrimeStage1.hpp index aeb01f72a..a2cfed78d 100644 --- a/DataSpec/DNAMP1/ScriptObjects/MetroidPrimeStage1.hpp +++ b/DataSpec/DNAMP1/ScriptObjects/MetroidPrimeStage1.hpp @@ -144,6 +144,13 @@ struct MetroidPrimeStage1 : IScriptObject ent->name = name + "_unk4"; } } + + void depIDs(std::vector& pathsOut) const + { + g_curSpec->flattenDependencies(unknown1, pathsOut); + g_curSpec->flattenDependencies(unknown3, pathsOut); + g_curSpec->flattenDependencies(unknown4, pathsOut); + } } primeStruct5; Value unknown14; DamageInfo damageInfo2; @@ -177,6 +184,16 @@ struct MetroidPrimeStage1 : IScriptObject } primeStruct5.nameIDs(pakRouter, name + "_prime5"); } + + void depIDs(std::vector& pathsOut) const + { + g_curSpec->flattenDependencies(particle1, pathsOut); + g_curSpec->flattenDependencies(particle2, pathsOut); + g_curSpec->flattenDependencies(texture1, pathsOut); + g_curSpec->flattenDependencies(texture2, pathsOut); + g_curSpec->flattenDependencies(wpsc, pathsOut); + primeStruct5.depIDs(pathsOut); + } } primeStruct4_1, primeStruct4_2, primeStruct4_3, primeStruct4_4; UniqueID32 wpsc1; @@ -287,6 +304,34 @@ struct MetroidPrimeStage1 : IScriptObject primeStruct4_3.nameIDs(pakRouter, name + "_prime43"); primeStruct4_4.nameIDs(pakRouter, name + "_prime44"); } + + void depIDs(std::vector& pathsOut) const + { + g_curSpec->flattenDependencies(particle1, pathsOut); + g_curSpec->flattenDependencies(particle2, pathsOut); + g_curSpec->flattenDependencies(particle3, pathsOut); + g_curSpec->flattenDependencies(particle4, pathsOut); + g_curSpec->flattenDependencies(particle5, pathsOut); + g_curSpec->flattenDependencies(particle6, pathsOut); + g_curSpec->flattenDependencies(particle7, pathsOut); + g_curSpec->flattenDependencies(particle8, pathsOut); + g_curSpec->flattenDependencies(swhc, pathsOut); + g_curSpec->flattenDependencies(texture1, pathsOut); + g_curSpec->flattenDependencies(texture2, pathsOut); + g_curSpec->flattenDependencies(wpsc1, pathsOut); + g_curSpec->flattenDependencies(wpsc2, pathsOut); + patternedInfo.depIDs(pathsOut); + actorParameters.depIDs(pathsOut); + primeStruct4_1.depIDs(pathsOut); + primeStruct4_2.depIDs(pathsOut); + primeStruct4_3.depIDs(pathsOut); + primeStruct4_4.depIDs(pathsOut); + } + + void scanIDs(std::vector& scansOut) const + { + actorParameters.scanIDs(scansOut); + } } massivePrimeStruct; void addCMDLRigPairs(PAKRouter& pakRouter, @@ -300,6 +345,16 @@ struct MetroidPrimeStage1 : IScriptObject { massivePrimeStruct.nameIDs(pakRouter, name + "_massiveStruct"); } + + void gatherDependencies(std::vector &pathsOut) const + { + massivePrimeStruct.depIDs(pathsOut); + } + + void gatherScans(std::vector& scansOut) const + { + massivePrimeStruct.scanIDs(scansOut); + } }; } } diff --git a/DataSpec/DNAMP1/ScriptObjects/MetroidPrimeStage2.hpp b/DataSpec/DNAMP1/ScriptObjects/MetroidPrimeStage2.hpp index 572defcfe..d1ef2ff82 100644 --- a/DataSpec/DNAMP1/ScriptObjects/MetroidPrimeStage2.hpp +++ b/DataSpec/DNAMP1/ScriptObjects/MetroidPrimeStage2.hpp @@ -50,6 +50,20 @@ struct MetroidPrimeStage2 : IScriptObject patternedInfo.nameIDs(pakRouter, name + "_patterned"); actorParameters.nameIDs(pakRouter, name + "_actp"); } + + void gatherDependencies(std::vector &pathsOut) const + { + g_curSpec->flattenDependencies(particle1, pathsOut); + g_curSpec->flattenDependencies(particle2, pathsOut); + g_curSpec->flattenDependencies(elsc, pathsOut); + patternedInfo.depIDs(pathsOut); + actorParameters.depIDs(pathsOut); + } + + void gatherScans(std::vector& scansOut) const + { + actorParameters.scanIDs(scansOut); + } }; } } diff --git a/DataSpec/DNAMP1/ScriptObjects/Midi.hpp b/DataSpec/DNAMP1/ScriptObjects/Midi.hpp index a13dbdfc5..83eebf202 100644 --- a/DataSpec/DNAMP1/ScriptObjects/Midi.hpp +++ b/DataSpec/DNAMP1/ScriptObjects/Midi.hpp @@ -27,6 +27,11 @@ struct Midi : IScriptObject ent->name = name + "_song"; } } + + void gatherDependencies(std::vector &pathsOut) const + { + g_curSpec->flattenDependencies(song, pathsOut); + } }; } } diff --git a/DataSpec/DNAMP1/ScriptObjects/NewIntroBoss.hpp b/DataSpec/DNAMP1/ScriptObjects/NewIntroBoss.hpp index 35dfc2334..0913dd2ac 100644 --- a/DataSpec/DNAMP1/ScriptObjects/NewIntroBoss.hpp +++ b/DataSpec/DNAMP1/ScriptObjects/NewIntroBoss.hpp @@ -57,6 +57,21 @@ struct NewIntroBoss : IScriptObject patternedInfo.nameIDs(pakRouter, name + "_patterned"); actorParameters.nameIDs(pakRouter, name + "_actp"); } + + void gatherDependencies(std::vector &pathsOut) const + { + g_curSpec->flattenDependencies(particle1, pathsOut); + g_curSpec->flattenDependencies(particle2, pathsOut); + g_curSpec->flattenDependencies(texture1, pathsOut); + g_curSpec->flattenDependencies(texture2, pathsOut); + patternedInfo.depIDs(pathsOut); + actorParameters.depIDs(pathsOut); + } + + void gatherScans(std::vector& scansOut) const + { + actorParameters.scanIDs(scansOut); + } }; } } diff --git a/DataSpec/DNAMP1/ScriptObjects/Oculus.hpp b/DataSpec/DNAMP1/ScriptObjects/Oculus.hpp index ea3d9a484..8e77d2c32 100644 --- a/DataSpec/DNAMP1/ScriptObjects/Oculus.hpp +++ b/DataSpec/DNAMP1/ScriptObjects/Oculus.hpp @@ -216,6 +216,17 @@ struct Oculus : IScriptObject patternedInfo.nameIDs(pakRouter, name + "_patterned"); actorParameters.nameIDs(pakRouter, name + "_actp"); } + + void gatherDependencies(std::vector &pathsOut) const + { + patternedInfo.depIDs(pathsOut); + actorParameters.depIDs(pathsOut); + } + + void gatherScans(std::vector& scansOut) const + { + actorParameters.scanIDs(scansOut); + } }; } } diff --git a/DataSpec/DNAMP1/ScriptObjects/OmegaPirate.hpp b/DataSpec/DNAMP1/ScriptObjects/OmegaPirate.hpp index 2cd9971d8..95ea271e6 100644 --- a/DataSpec/DNAMP1/ScriptObjects/OmegaPirate.hpp +++ b/DataSpec/DNAMP1/ScriptObjects/OmegaPirate.hpp @@ -134,6 +134,32 @@ struct OmegaPirate : IScriptObject actorParameters2.nameIDs(pakRouter, name + "_actp2"); animationParameters.nameANCS(pakRouter, name + "_animp"); } + + void gatherDependencies(std::vector &pathsOut) const + { + g_curSpec->flattenDependencies(particle1, pathsOut); + g_curSpec->flattenDependencies(particle2, pathsOut); + g_curSpec->flattenDependencies(particle3, pathsOut); + g_curSpec->flattenDependencies(particle4, pathsOut); + g_curSpec->flattenDependencies(particle5, pathsOut); + g_curSpec->flattenDependencies(particle6, pathsOut); + g_curSpec->flattenDependencies(particle7, pathsOut); + g_curSpec->flattenDependencies(elsc, pathsOut); + g_curSpec->flattenDependencies(model1, pathsOut); + g_curSpec->flattenDependencies(model2, pathsOut); + g_curSpec->flattenDependencies(skin, pathsOut); + g_curSpec->flattenDependencies(rig, pathsOut); + patternedInfo.depIDs(pathsOut); + actorParameters1.depIDs(pathsOut); + actorParameters2.depIDs(pathsOut); + animationParameters.depANCS(pathsOut); + } + + void gatherScans(std::vector& scansOut) const + { + actorParameters1.scanIDs(scansOut); + actorParameters2.scanIDs(scansOut); + } }; } } diff --git a/DataSpec/DNAMP1/ScriptObjects/Parameters.hpp b/DataSpec/DNAMP1/ScriptObjects/Parameters.hpp index 340c077b3..05da47569 100644 --- a/DataSpec/DNAMP1/ScriptObjects/Parameters.hpp +++ b/DataSpec/DNAMP1/ScriptObjects/Parameters.hpp @@ -3,6 +3,7 @@ #include "../../DNACommon/DNACommon.hpp" #include "../DNAMP1.hpp" +#include "../SAVW.hpp" namespace DataSpec { @@ -68,7 +69,7 @@ enum class ESpecialFunctionType : atUint32 EndGame, HUDFadeIn, CinematicSkip, - ScriptLyaerController, + ScriptLayerController, RainSimulator, AreaDamage, ObjectFollowObject, @@ -104,6 +105,11 @@ struct AnimationParameters : BigYAML if (ancsEnt->name.empty()) ancsEnt->name = name; } + + void depANCS(std::vector& pathsOut) const + { + g_curSpec->flattenDependencies(animationCharacterSet, pathsOut); + } }; struct BehaveChance : BigYAML @@ -189,6 +195,11 @@ struct FlareDefinition : BigYAML ent->name = name + "_texture"; } } + + void depIDs(std::vector& pathsOut) const + { + g_curSpec->flattenDependencies(texture, pathsOut); + } }; struct GrappleParameters : BigYAML @@ -299,6 +310,14 @@ struct PatternedInfo : BigYAML ent->name = name + "_part2"; } } + + void depIDs(std::vector& pathsOut) const + { + animationParameters.depANCS(pathsOut); + g_curSpec->flattenDependencies(stateMachine, pathsOut); + g_curSpec->flattenDependencies(particle1, pathsOut); + g_curSpec->flattenDependencies(particle2, pathsOut); + } }; struct PlayerHintParameters : BigYAML @@ -336,6 +355,16 @@ struct ScannableParameters : BigYAML scanEnt->name = name + "_scan"; } } + + void depIDs(std::vector& pathsOut) const + { + g_curSpec->flattenDependencies(scanId, pathsOut); + } + + void scanIDs(std::vector& scansOut) const + { + scansOut.emplace_back(scanId); + } }; struct VisorParameters : BigYAML @@ -407,6 +436,20 @@ struct ActorParameters : BigYAML xsEnt->name = name + "_thermalskin"; } } + + void depIDs(std::vector& pathsOut) const + { + scannableParameters.depIDs(pathsOut); + g_curSpec->flattenDependencies(xrayModel, pathsOut); + g_curSpec->flattenDependencies(xraySkin, pathsOut); + g_curSpec->flattenDependencies(thermalModel, pathsOut); + g_curSpec->flattenDependencies(thermalSkin, pathsOut); + } + + void scanIDs(std::vector& scansOut) const + { + scannableParameters.scanIDs(scansOut); + } }; } } diff --git a/DataSpec/DNAMP1/ScriptObjects/Parasite.hpp b/DataSpec/DNAMP1/ScriptObjects/Parasite.hpp index 79484e1a1..9c6ef5548 100644 --- a/DataSpec/DNAMP1/ScriptObjects/Parasite.hpp +++ b/DataSpec/DNAMP1/ScriptObjects/Parasite.hpp @@ -49,6 +49,17 @@ struct Parasite : IScriptObject patternedInfo.nameIDs(pakRouter, name + "_patterned"); actorParameters.nameIDs(pakRouter, name + "_actp"); } + + void gatherDependencies(std::vector& pathsOut) const + { + patternedInfo.depIDs(pathsOut); + actorParameters.depIDs(pathsOut); + } + + void gatherScans(std::vector& scansOut) const + { + actorParameters.scanIDs(scansOut); + } }; } } diff --git a/DataSpec/DNAMP1/ScriptObjects/PhazonHealingNodule.hpp b/DataSpec/DNAMP1/ScriptObjects/PhazonHealingNodule.hpp index 9040cd624..543a150cc 100644 --- a/DataSpec/DNAMP1/ScriptObjects/PhazonHealingNodule.hpp +++ b/DataSpec/DNAMP1/ScriptObjects/PhazonHealingNodule.hpp @@ -38,6 +38,18 @@ struct PhazonHealingNodule : IScriptObject patternedInfo.nameIDs(pakRouter, name + "_patterned"); actorParameters.nameIDs(pakRouter, name + "_actp"); } + + void gatherDependencies(std::vector& pathsOut) const + { + g_curSpec->flattenDependencies(elsc, pathsOut); + patternedInfo.depIDs(pathsOut); + actorParameters.depIDs(pathsOut); + } + + void gatherScans(std::vector& scansOut) const + { + actorParameters.scanIDs(scansOut); + } }; } } diff --git a/DataSpec/DNAMP1/ScriptObjects/PhazonPool.hpp b/DataSpec/DNAMP1/ScriptObjects/PhazonPool.hpp index b9cc271dd..c4c935d7b 100644 --- a/DataSpec/DNAMP1/ScriptObjects/PhazonPool.hpp +++ b/DataSpec/DNAMP1/ScriptObjects/PhazonPool.hpp @@ -54,6 +54,14 @@ struct PhazonPool : IScriptObject ent->name = name + "_model2"; } } + + void gatherDependencies(std::vector& pathsOut) const + { + g_curSpec->flattenDependencies(particle1, pathsOut); + g_curSpec->flattenDependencies(particle2, pathsOut); + g_curSpec->flattenDependencies(model1, pathsOut); + g_curSpec->flattenDependencies(model2, pathsOut); + } }; } } diff --git a/DataSpec/DNAMP1/ScriptObjects/Pickup.hpp b/DataSpec/DNAMP1/ScriptObjects/Pickup.hpp index d6bfb1ee1..80ea75762 100644 --- a/DataSpec/DNAMP1/ScriptObjects/Pickup.hpp +++ b/DataSpec/DNAMP1/ScriptObjects/Pickup.hpp @@ -52,6 +52,19 @@ struct Pickup : IScriptObject animationParameters.nameANCS(pakRouter, name + "_animp"); actorParameters.nameIDs(pakRouter, name + "_actp"); } + + void gatherDependencies(std::vector& pathsOut) const + { + g_curSpec->flattenDependencies(particle, pathsOut); + g_curSpec->flattenDependencies(model, pathsOut); + animationParameters.depANCS(pathsOut); + actorParameters.depIDs(pathsOut); + } + + void gatherScans(std::vector& scansOut) const + { + actorParameters.scanIDs(scansOut); + } }; } } diff --git a/DataSpec/DNAMP1/ScriptObjects/Platform.hpp b/DataSpec/DNAMP1/ScriptObjects/Platform.hpp index 58a1ba893..abac02808 100644 --- a/DataSpec/DNAMP1/ScriptObjects/Platform.hpp +++ b/DataSpec/DNAMP1/ScriptObjects/Platform.hpp @@ -53,6 +53,19 @@ struct Platform : IScriptObject animationParameters.nameANCS(pakRouter, name + "_animp"); actorParameters.nameIDs(pakRouter, name + "_actp"); } + + void gatherDependencies(std::vector& pathsOut) const + { + g_curSpec->flattenDependencies(dcln, pathsOut); + g_curSpec->flattenDependencies(model, pathsOut); + animationParameters.depANCS(pathsOut); + actorParameters.depIDs(pathsOut); + } + + void gatherScans(std::vector& scansOut) const + { + actorParameters.scanIDs(scansOut); + } }; } } diff --git a/DataSpec/DNAMP1/ScriptObjects/PlayerActor.hpp b/DataSpec/DNAMP1/ScriptObjects/PlayerActor.hpp index e66203b6a..b18616fe0 100644 --- a/DataSpec/DNAMP1/ScriptObjects/PlayerActor.hpp +++ b/DataSpec/DNAMP1/ScriptObjects/PlayerActor.hpp @@ -48,6 +48,18 @@ struct PlayerActor : IScriptObject animationParameters.nameANCS(pakRouter, name + "_animp"); actorParameters.nameIDs(pakRouter, name + "_actp"); } + + void gatherDependencies(std::vector& pathsOut) const + { + g_curSpec->flattenDependencies(model, pathsOut); + animationParameters.depANCS(pathsOut); + actorParameters.depIDs(pathsOut); + } + + void gatherScans(std::vector& scansOut) const + { + actorParameters.scanIDs(scansOut); + } }; } } diff --git a/DataSpec/DNAMP1/ScriptObjects/PointOfInterest.hpp b/DataSpec/DNAMP1/ScriptObjects/PointOfInterest.hpp index 060df7d56..3cebe5a3d 100644 --- a/DataSpec/DNAMP1/ScriptObjects/PointOfInterest.hpp +++ b/DataSpec/DNAMP1/ScriptObjects/PointOfInterest.hpp @@ -23,6 +23,16 @@ struct PointOfInterest : IScriptObject { scannableParameters.nameIDs(pakRouter, name + "_scanp"); } + + void gatherDependencies(std::vector& pathsOut) const + { + scannableParameters.depIDs(pathsOut); + } + + void gatherScans(std::vector& scansOut) const + { + scannableParameters.scanIDs(scansOut); + } }; } } diff --git a/DataSpec/DNAMP1/ScriptObjects/PuddleSpore.hpp b/DataSpec/DNAMP1/ScriptObjects/PuddleSpore.hpp index 14031a525..fbf6c7379 100644 --- a/DataSpec/DNAMP1/ScriptObjects/PuddleSpore.hpp +++ b/DataSpec/DNAMP1/ScriptObjects/PuddleSpore.hpp @@ -50,6 +50,19 @@ struct PuddleSpore : IScriptObject patternedInfo.nameIDs(pakRouter, name + "_patterned"); actorParameters.nameIDs(pakRouter, name + "_actp"); } + + void gatherDependencies(std::vector& pathsOut) const + { + g_curSpec->flattenDependencies(particle, pathsOut); + g_curSpec->flattenDependencies(wpsc, pathsOut); + patternedInfo.depIDs(pathsOut); + actorParameters.depIDs(pathsOut); + } + + void gatherScans(std::vector& scansOut) const + { + actorParameters.scanIDs(scansOut); + } }; } } diff --git a/DataSpec/DNAMP1/ScriptObjects/PuddleToadGamma.hpp b/DataSpec/DNAMP1/ScriptObjects/PuddleToadGamma.hpp index ead986d34..6e3d691fb 100644 --- a/DataSpec/DNAMP1/ScriptObjects/PuddleToadGamma.hpp +++ b/DataSpec/DNAMP1/ScriptObjects/PuddleToadGamma.hpp @@ -46,6 +46,18 @@ struct PuddleToadGamma : IScriptObject patternedInfo.nameIDs(pakRouter, name + "_patterned"); actorParameters.nameIDs(pakRouter, name + "_actp"); } + + void gatherDependencies(std::vector& pathsOut) const + { + g_curSpec->flattenDependencies(dcln, pathsOut); + patternedInfo.depIDs(pathsOut); + actorParameters.depIDs(pathsOut); + } + + void gatherScans(std::vector& scansOut) const + { + actorParameters.scanIDs(scansOut); + } }; } } diff --git a/DataSpec/DNAMP1/ScriptObjects/Puffer.hpp b/DataSpec/DNAMP1/ScriptObjects/Puffer.hpp index b6aa2f317..e12b36476 100644 --- a/DataSpec/DNAMP1/ScriptObjects/Puffer.hpp +++ b/DataSpec/DNAMP1/ScriptObjects/Puffer.hpp @@ -50,6 +50,19 @@ struct Puffer : IScriptObject patternedInfo.nameIDs(pakRouter, name + "_patterned"); actorParameters.nameIDs(pakRouter, name + "_actp"); } + + void gatherDependencies(std::vector& pathsOut) const + { + g_curSpec->flattenDependencies(particle, pathsOut); + g_curSpec->flattenDependencies(texture, pathsOut); + patternedInfo.depIDs(pathsOut); + actorParameters.depIDs(pathsOut); + } + + void gatherScans(std::vector& scansOut) const + { + actorParameters.scanIDs(scansOut); + } }; } } diff --git a/DataSpec/DNAMP1/ScriptObjects/Ridley.hpp b/DataSpec/DNAMP1/ScriptObjects/Ridley.hpp index c965fcca1..1da341c16 100644 --- a/DataSpec/DNAMP1/ScriptObjects/Ridley.hpp +++ b/DataSpec/DNAMP1/ScriptObjects/Ridley.hpp @@ -81,6 +81,14 @@ struct Ridley : IScriptObject ent->name = name + "_tex2"; } } + + void depIDs(std::vector& pathsOut) const + { + g_curSpec->flattenDependencies(particle1, pathsOut); + g_curSpec->flattenDependencies(particle2, pathsOut); + g_curSpec->flattenDependencies(texture1, pathsOut); + g_curSpec->flattenDependencies(texture2, pathsOut); + } } ridleyStruct1; Value soundID1; @@ -716,6 +724,36 @@ struct Ridley : IScriptObject actorParameters.nameIDs(pakRouter, name + "_actp"); ridleyStruct1.nameIDs(pakRouter, name + "_ridley1"); } + + void gatherDependencies(std::vector& pathsOut) const + { + g_curSpec->flattenDependencies(particle, pathsOut); + g_curSpec->flattenDependencies(model1, pathsOut); + g_curSpec->flattenDependencies(model2, pathsOut); + g_curSpec->flattenDependencies(model3, pathsOut); + g_curSpec->flattenDependencies(model4, pathsOut); + g_curSpec->flattenDependencies(model5, pathsOut); + g_curSpec->flattenDependencies(model6, pathsOut); + g_curSpec->flattenDependencies(model7, pathsOut); + g_curSpec->flattenDependencies(model8, pathsOut); + g_curSpec->flattenDependencies(model9, pathsOut); + g_curSpec->flattenDependencies(model10, pathsOut); + g_curSpec->flattenDependencies(model11, pathsOut); + g_curSpec->flattenDependencies(model12, pathsOut); + g_curSpec->flattenDependencies(wpsc1, pathsOut); + g_curSpec->flattenDependencies(wpsc2, pathsOut); + g_curSpec->flattenDependencies(wpsc3, pathsOut); + g_curSpec->flattenDependencies(wpsc4, pathsOut); + g_curSpec->flattenDependencies(elsc, pathsOut); + patternedInfo.depIDs(pathsOut); + actorParameters.depIDs(pathsOut); + ridleyStruct1.depIDs(pathsOut); + } + + void gatherScans(std::vector& scansOut) const + { + actorParameters.scanIDs(scansOut); + } }; } } diff --git a/DataSpec/DNAMP1/ScriptObjects/Ripper.hpp b/DataSpec/DNAMP1/ScriptObjects/Ripper.hpp index 811b80ef6..b35b11f8a 100644 --- a/DataSpec/DNAMP1/ScriptObjects/Ripper.hpp +++ b/DataSpec/DNAMP1/ScriptObjects/Ripper.hpp @@ -32,6 +32,17 @@ struct Ripper : IScriptObject patternedInfo.nameIDs(pakRouter, name + "_patterned"); actorParameters.nameIDs(pakRouter, name + "_actp"); } + + void gatherDependencies(std::vector& pathsOut) const + { + patternedInfo.depIDs(pathsOut); + actorParameters.depIDs(pathsOut); + } + + void gatherScans(std::vector& scansOut) const + { + actorParameters.scanIDs(scansOut); + } }; } } diff --git a/DataSpec/DNAMP1/ScriptObjects/ScriptBeam.hpp b/DataSpec/DNAMP1/ScriptObjects/ScriptBeam.hpp index 7c51dfb10..4a139501d 100644 --- a/DataSpec/DNAMP1/ScriptObjects/ScriptBeam.hpp +++ b/DataSpec/DNAMP1/ScriptObjects/ScriptBeam.hpp @@ -61,6 +61,14 @@ struct ScriptBeam : IScriptObject ent->name = name + "_tex2"; } } + + void depIDs(std::vector& pathsOut) const + { + g_curSpec->flattenDependencies(particle1, pathsOut); + g_curSpec->flattenDependencies(particle2, pathsOut); + g_curSpec->flattenDependencies(texture1, pathsOut); + g_curSpec->flattenDependencies(texture2, pathsOut); + } } beamParametrs; DamageInfo damageInfo; @@ -73,6 +81,12 @@ struct ScriptBeam : IScriptObject } beamParametrs.nameIDs(pakRouter, name + "_beamp"); } + + void gatherDependencies(std::vector& pathsOut) const + { + g_curSpec->flattenDependencies(wpsc, pathsOut); + beamParametrs.depIDs(pathsOut); + } }; } } diff --git a/DataSpec/DNAMP1/ScriptObjects/Seedling.hpp b/DataSpec/DNAMP1/ScriptObjects/Seedling.hpp index 7af1db294..584949c25 100644 --- a/DataSpec/DNAMP1/ScriptObjects/Seedling.hpp +++ b/DataSpec/DNAMP1/ScriptObjects/Seedling.hpp @@ -48,6 +48,19 @@ struct Seedling : IScriptObject patternedInfo.nameIDs(pakRouter, name + "_patterned"); actorParameters.nameIDs(pakRouter, name + "_actp"); } + + void gatherDependencies(std::vector& pathsOut) const + { + g_curSpec->flattenDependencies(unknown1, pathsOut); + g_curSpec->flattenDependencies(unknown2, pathsOut); + patternedInfo.depIDs(pathsOut); + actorParameters.depIDs(pathsOut); + } + + void gatherScans(std::vector& scansOut) const + { + actorParameters.scanIDs(scansOut); + } }; } } diff --git a/DataSpec/DNAMP1/ScriptObjects/SnakeWeedSwarm.hpp b/DataSpec/DNAMP1/ScriptObjects/SnakeWeedSwarm.hpp index 29f601bed..1b6e241a1 100644 --- a/DataSpec/DNAMP1/ScriptObjects/SnakeWeedSwarm.hpp +++ b/DataSpec/DNAMP1/ScriptObjects/SnakeWeedSwarm.hpp @@ -49,6 +49,17 @@ struct SnakeWeedSwarm : IScriptObject animationParameters.nameANCS(pakRouter, name + "_animp"); actorParameters.nameIDs(pakRouter, name + "_actp"); } + + void gatherDependencies(std::vector& pathsOut) const + { + animationParameters.depANCS(pathsOut); + actorParameters.depIDs(pathsOut); + } + + void gatherScans(std::vector& scansOut) const + { + actorParameters.scanIDs(scansOut); + } }; } } diff --git a/DataSpec/DNAMP1/ScriptObjects/SpacePirate.hpp b/DataSpec/DNAMP1/ScriptObjects/SpacePirate.hpp index b7900bbdb..bf9c0dcfa 100644 --- a/DataSpec/DNAMP1/ScriptObjects/SpacePirate.hpp +++ b/DataSpec/DNAMP1/ScriptObjects/SpacePirate.hpp @@ -70,6 +70,19 @@ struct SpacePirate : IScriptObject patternedInfo.nameIDs(pakRouter, name + "_patterned"); actorParameters.nameIDs(pakRouter, name + "_actp"); } + + void gatherDependencies(std::vector& pathsOut) const + { + g_curSpec->flattenDependencies(wpsc1, pathsOut); + g_curSpec->flattenDependencies(wpsc2, pathsOut); + patternedInfo.depIDs(pathsOut); + actorParameters.depIDs(pathsOut); + } + + void gatherScans(std::vector& scansOut) const + { + actorParameters.scanIDs(scansOut); + } }; } } diff --git a/DataSpec/DNAMP1/ScriptObjects/SpankWeed.hpp b/DataSpec/DNAMP1/ScriptObjects/SpankWeed.hpp index 8e887ae64..70eb3a45d 100644 --- a/DataSpec/DNAMP1/ScriptObjects/SpankWeed.hpp +++ b/DataSpec/DNAMP1/ScriptObjects/SpankWeed.hpp @@ -35,6 +35,17 @@ struct SpankWeed : IScriptObject patternedInfo.nameIDs(pakRouter, name + "_patterned"); actorParameters.nameIDs(pakRouter, name + "_actp"); } + + void gatherDependencies(std::vector& pathsOut) const + { + patternedInfo.depIDs(pathsOut); + actorParameters.depIDs(pathsOut); + } + + void gatherScans(std::vector& scansOut) const + { + actorParameters.scanIDs(scansOut); + } }; } } diff --git a/DataSpec/DNAMP1/ScriptObjects/Steam.hpp b/DataSpec/DNAMP1/ScriptObjects/Steam.hpp index 480e8dcbe..5903dd13a 100644 --- a/DataSpec/DNAMP1/ScriptObjects/Steam.hpp +++ b/DataSpec/DNAMP1/ScriptObjects/Steam.hpp @@ -34,6 +34,11 @@ struct Steam : IScriptObject ent->name = name + "_texture"; } } + + void gatherDependencies(std::vector& pathsOut) const + { + g_curSpec->flattenDependencies(texture, pathsOut); + } }; } } diff --git a/DataSpec/DNAMP1/ScriptObjects/Thardus.hpp b/DataSpec/DNAMP1/ScriptObjects/Thardus.hpp index 97dcb005d..99c2c751d 100644 --- a/DataSpec/DNAMP1/ScriptObjects/Thardus.hpp +++ b/DataSpec/DNAMP1/ScriptObjects/Thardus.hpp @@ -178,6 +178,26 @@ struct Thardus : IScriptObject patternedInfo.nameIDs(pakRouter, name + "_patterned"); actorParameters.nameIDs(pakRouter, name + "_actp"); } + + void gatherDependencies(std::vector& pathsOut) const + { + for (int i=0 ; i<14 ; ++i) + g_curSpec->flattenDependencies(models[i], pathsOut); + for (int i=0 ; i<3 ; ++i) + g_curSpec->flattenDependencies(particles1[i], pathsOut); + g_curSpec->flattenDependencies(stateMachine, pathsOut); + for (int i=0 ; i<6 ; ++i) + g_curSpec->flattenDependencies(particles2[i], pathsOut); + g_curSpec->flattenDependencies(particle, pathsOut); + g_curSpec->flattenDependencies(texture, pathsOut); + patternedInfo.depIDs(pathsOut); + actorParameters.depIDs(pathsOut); + } + + void gatherScans(std::vector& scansOut) const + { + actorParameters.scanIDs(scansOut); + } }; } } diff --git a/DataSpec/DNAMP1/ScriptObjects/ThardusRockProjectile.hpp b/DataSpec/DNAMP1/ScriptObjects/ThardusRockProjectile.hpp index 1618a4cd1..4dbb549c4 100644 --- a/DataSpec/DNAMP1/ScriptObjects/ThardusRockProjectile.hpp +++ b/DataSpec/DNAMP1/ScriptObjects/ThardusRockProjectile.hpp @@ -45,6 +45,19 @@ struct ThardusRockProjectile : IScriptObject patternedInfo.nameIDs(pakRouter, name + "_patterned"); actorParameters.nameIDs(pakRouter, name + "_actp"); } + + void gatherDependencies(std::vector& pathsOut) const + { + g_curSpec->flattenDependencies(model, pathsOut); + g_curSpec->flattenDependencies(stateMachine, pathsOut); + patternedInfo.depIDs(pathsOut); + actorParameters.depIDs(pathsOut); + } + + void gatherScans(std::vector& scansOut) const + { + actorParameters.scanIDs(scansOut); + } }; } } diff --git a/DataSpec/DNAMP1/ScriptObjects/Tryclops.hpp b/DataSpec/DNAMP1/ScriptObjects/Tryclops.hpp index 1e1803b33..6269adc49 100644 --- a/DataSpec/DNAMP1/ScriptObjects/Tryclops.hpp +++ b/DataSpec/DNAMP1/ScriptObjects/Tryclops.hpp @@ -34,6 +34,17 @@ struct Tryclops : IScriptObject patternedInfo.nameIDs(pakRouter, name + "_patterned"); actorParameters.nameIDs(pakRouter, name + "_actp"); } + + void gatherDependencies(std::vector& pathsOut) const + { + patternedInfo.depIDs(pathsOut); + actorParameters.depIDs(pathsOut); + } + + void gatherScans(std::vector& scansOut) const + { + actorParameters.scanIDs(scansOut); + } }; } } diff --git a/DataSpec/DNAMP1/ScriptObjects/VisorFlare.hpp b/DataSpec/DNAMP1/ScriptObjects/VisorFlare.hpp index 28ad689d6..2aa9f67b3 100644 --- a/DataSpec/DNAMP1/ScriptObjects/VisorFlare.hpp +++ b/DataSpec/DNAMP1/ScriptObjects/VisorFlare.hpp @@ -31,6 +31,12 @@ struct VisorFlare : IScriptObject flareDefinitions[3].nameIDs(pakRouter, name + "_flare4"); flareDefinitions[4].nameIDs(pakRouter, name + "_flare5"); } + + void gatherDependencies(std::vector& pathsOut) const + { + for (int i=0 ; i<5 ; ++i) + flareDefinitions[i].depIDs(pathsOut); + } }; } } diff --git a/DataSpec/DNAMP1/ScriptObjects/VisorGoo.hpp b/DataSpec/DNAMP1/ScriptObjects/VisorGoo.hpp index 09d35349d..ba078cdaa 100644 --- a/DataSpec/DNAMP1/ScriptObjects/VisorGoo.hpp +++ b/DataSpec/DNAMP1/ScriptObjects/VisorGoo.hpp @@ -32,6 +32,11 @@ struct VisorGoo : IScriptObject ent->name = name + "_part"; } } + + void gatherDependencies(std::vector& pathsOut) const + { + g_curSpec->flattenDependencies(particle, pathsOut); + } }; } } diff --git a/DataSpec/DNAMP1/ScriptObjects/WallCrawlerSwarm.hpp b/DataSpec/DNAMP1/ScriptObjects/WallCrawlerSwarm.hpp index 2dac72098..da5c67308 100644 --- a/DataSpec/DNAMP1/ScriptObjects/WallCrawlerSwarm.hpp +++ b/DataSpec/DNAMP1/ScriptObjects/WallCrawlerSwarm.hpp @@ -73,6 +73,19 @@ struct WallCrawlerSwarm : IScriptObject animationParameters.nameANCS(pakRouter, name + "_animp"); actorParameters.nameIDs(pakRouter, name + "_actp"); } + + void gatherDependencies(std::vector& pathsOut) const + { + g_curSpec->flattenDependencies(particle1, pathsOut); + g_curSpec->flattenDependencies(particle2, pathsOut); + animationParameters.depANCS(pathsOut); + actorParameters.depIDs(pathsOut); + } + + void gatherScans(std::vector& scansOut) const + { + actorParameters.scanIDs(scansOut); + } }; } } diff --git a/DataSpec/DNAMP1/ScriptObjects/Warwasp.hpp b/DataSpec/DNAMP1/ScriptObjects/Warwasp.hpp index 75627aead..fbf7393b2 100644 --- a/DataSpec/DNAMP1/ScriptObjects/Warwasp.hpp +++ b/DataSpec/DNAMP1/ScriptObjects/Warwasp.hpp @@ -47,6 +47,19 @@ struct Warwasp : IScriptObject patternedInfo.nameIDs(pakRouter, name + "_patterned"); actorParameters.nameIDs(pakRouter, name + "_actp"); } + + void gatherDependencies(std::vector& pathsOut) const + { + g_curSpec->flattenDependencies(wpsc1, pathsOut); + g_curSpec->flattenDependencies(particle, pathsOut); + patternedInfo.depIDs(pathsOut); + actorParameters.depIDs(pathsOut); + } + + void gatherScans(std::vector& scansOut) const + { + actorParameters.scanIDs(scansOut); + } }; } } diff --git a/DataSpec/DNAMP1/ScriptObjects/Water.hpp b/DataSpec/DNAMP1/ScriptObjects/Water.hpp index 52f52d6b9..eab8f5ca0 100644 --- a/DataSpec/DNAMP1/ScriptObjects/Water.hpp +++ b/DataSpec/DNAMP1/ScriptObjects/Water.hpp @@ -157,6 +157,22 @@ struct Water : IScriptObject ent->name = name + "_part5"; } } + + void gatherDependencies(std::vector& pathsOut) const + { + g_curSpec->flattenDependencies(texture1, pathsOut); + g_curSpec->flattenDependencies(texture2, pathsOut); + g_curSpec->flattenDependencies(texture3, pathsOut); + g_curSpec->flattenDependencies(texture4, pathsOut); + g_curSpec->flattenDependencies(texture5, pathsOut); + g_curSpec->flattenDependencies(texture6, pathsOut); + g_curSpec->flattenDependencies(texture34, pathsOut); + g_curSpec->flattenDependencies(particle1, pathsOut); + g_curSpec->flattenDependencies(particle2, pathsOut); + g_curSpec->flattenDependencies(particle3, pathsOut); + g_curSpec->flattenDependencies(particle4, pathsOut); + g_curSpec->flattenDependencies(particle5, pathsOut); + } }; } } diff --git a/DataSpec/DNAMP1/ScriptObjects/WorldTeleporter.hpp b/DataSpec/DNAMP1/ScriptObjects/WorldTeleporter.hpp index dc7c0cdc2..a4f945744 100644 --- a/DataSpec/DNAMP1/ScriptObjects/WorldTeleporter.hpp +++ b/DataSpec/DNAMP1/ScriptObjects/WorldTeleporter.hpp @@ -321,6 +321,13 @@ struct WorldTeleporter : IScriptObject ent->name = name + "_strg"; } } + + void gatherDependencies(std::vector& pathsOut) const + { + g_curSpec->flattenDependencies(model1, pathsOut); + g_curSpec->flattenDependencies(model2, pathsOut); + g_curSpec->flattenDependencies(strg, pathsOut); + } }; } diff --git a/DataSpec/DNAMP2/DNAMP2.cpp b/DataSpec/DNAMP2/DNAMP2.cpp index 480c687c4..440882e50 100644 --- a/DataSpec/DNAMP2/DNAMP2.cpp +++ b/DataSpec/DNAMP2/DNAMP2.cpp @@ -120,8 +120,6 @@ void PAKBridge::build() areaName.read(rs); } areaDeps.name = areaName.getSystemString(FOURCC('ENGL'), 0); - - /* Trim possible trailing whitespace */ areaDeps.name = hecl::StringUtils::TrimWhitespace(areaDeps.name); } if (areaDeps.name.empty()) @@ -145,14 +143,7 @@ void PAKBridge::build() Level::Area::Layer& layer = areaDeps.layers.back(); layer.name = LayerName(mlvl.layerNames[layerIdx++]); layer.active = layerFlags.flags >> (l-1) & 0x1; - /* Trim possible trailing whitespace */ -#if HECL_UCS2 - while (layer.name.size() && iswspace(layer.name.back())) - layer.name.pop_back(); -#else - while (layer.name.size() && isspace(layer.name.back())) - layer.name.pop_back(); -#endif + layer.name = hecl::StringUtils::TrimWhitespace(layer.name); hecl::SNPrintf(num, 16, _S("%02u "), l-1); layer.name = num + layer.name; diff --git a/DataSpec/DNAMP3/DNAMP3.cpp b/DataSpec/DNAMP3/DNAMP3.cpp index f6b0548bf..073e6f5f0 100644 --- a/DataSpec/DNAMP3/DNAMP3.cpp +++ b/DataSpec/DNAMP3/DNAMP3.cpp @@ -126,8 +126,6 @@ void PAKBridge::build() areaName.read(rs); } areaDeps.name = areaName.getSystemString(FOURCC('ENGL'), 0); - - /* Trim possible trailing whitespace */ areaDeps.name = hecl::StringUtils::TrimWhitespace(areaDeps.name); } if (areaDeps.name.empty()) @@ -153,14 +151,7 @@ void PAKBridge::build() Level::Area::Layer& layer = areaDeps.layers.back(); layer.name = LayerName(mlvl.layerNames[layerIdx++]); layer.active = layerFlags.flags >> (l-1) & 0x1; - /* Trim possible trailing whitespace */ -#if HECL_UCS2 - while (layer.name.size() && iswspace(layer.name.back())) - layer.name.pop_back(); -#else - while (layer.name.size() && isspace(layer.name.back())) - layer.name.pop_back(); -#endif + layer.name = hecl::StringUtils::TrimWhitespace(layer.name); hecl::SNPrintf(num, 16, _S("%02u "), l-1); layer.name = num + layer.name; } diff --git a/DataSpec/SpecBase.cpp b/DataSpec/SpecBase.cpp index 4848fe083..eb3c69f16 100644 --- a/DataSpec/SpecBase.cpp +++ b/DataSpec/SpecBase.cpp @@ -288,16 +288,97 @@ void SpecBase::doCook(const hecl::ProjectPath& path, const hecl::ProjectPath& co } } +void SpecBase::flattenDependencies(const hecl::ProjectPath& path, + std::vector& pathsOut, + hecl::BlenderToken& btok) +{ + DataSpec::g_curSpec.reset(this); + + hecl::ProjectPath asBlend; + if (path.getPathType() == hecl::ProjectPath::Type::Glob) + asBlend = path.getWithExtension(_S(".blend"), true); + else + asBlend = path; + + if (hecl::IsPathBlend(asBlend)) + { + hecl::BlenderConnection& conn = btok.getBlenderConnection(); + if (!conn.openBlend(asBlend)) + return; + switch (conn.getBlendType()) + { + case hecl::BlenderConnection::BlendType::Mesh: + { + hecl::BlenderConnection::DataStream ds = conn.beginData(); + std::vector texs = ds.getTextures(); + for (const hecl::ProjectPath& tex : texs) + pathsOut.push_back(tex); + break; + } + case hecl::BlenderConnection::BlendType::Actor: + { + hecl::BlenderConnection::DataStream ds = conn.beginData(); + hecl::BlenderConnection::DataStream::Actor actor = ds.compileActor(); + for (auto& sub : actor.subtypes) + { + if (sub.armature >= 0) + { + pathsOut.push_back(sub.mesh); + + hecl::SystemStringView chSysName(sub.name); + pathsOut.push_back(path.ensureAuxInfo(chSysName.sys_str() + _S(".CSKR"))); + + const auto& arm = actor.armatures[sub.armature]; + hecl::SystemStringView armSysName(arm.name); + pathsOut.push_back(path.ensureAuxInfo(armSysName.sys_str() + _S(".CINF"))); + if (sub.overlayMeshes.size()) + { + pathsOut.push_back(sub.overlayMeshes[0].second); + pathsOut.push_back(path.ensureAuxInfo(chSysName.sys_str() + _S(".over.CSKR"))); + } + } + } + break; + } + case hecl::BlenderConnection::BlendType::Area: + { + hecl::BlenderConnection::DataStream ds = conn.beginData(); + std::vector texs = ds.getTextures(); + for (const hecl::ProjectPath& tex : texs) + pathsOut.push_back(tex); + break; + } + default: break; + } + } + else if (hecl::IsPathYAML(path)) + { + athena::io::FileReader reader(path.getAbsolutePath()); + flattenDependenciesYAML(reader, pathsOut); + } + + pathsOut.push_back(path); +} + +void SpecBase::flattenDependencies(const UniqueID32& id, std::vector& pathsOut) +{ + hecl::ProjectPath path = UniqueIDBridge::TranslatePakIdToPath(id); + if (path) + flattenDependencies(path, pathsOut, hecl::SharedBlenderToken); +} + +void SpecBase::flattenDependencies(const UniqueID64& id, std::vector& pathsOut) +{ + hecl::ProjectPath path = UniqueIDBridge::TranslatePakIdToPath(id); + if (path) + flattenDependencies(path, pathsOut, hecl::SharedBlenderToken); +} + bool SpecBase::canPackage(const PackagePassInfo& info) { return false; } -void SpecBase::gatherDependencies(const PackagePassInfo& info, - std::unordered_set& implicitsOut) -{ -} - void SpecBase::doPackage(const PackagePassInfo& info) { } diff --git a/DataSpec/SpecBase.hpp b/DataSpec/SpecBase.hpp index ea526010e..0ea8b4aee 100644 --- a/DataSpec/SpecBase.hpp +++ b/DataSpec/SpecBase.hpp @@ -7,6 +7,11 @@ #include #include "hecl/Blender/BlenderConnection.hpp" +namespace urde +{ +struct SObjectTag; +} + namespace DataSpec { @@ -25,8 +30,6 @@ struct SpecBase : hecl::Database::IDataSpec bool fast, hecl::BlenderToken& btok, FCookProgress progress); bool canPackage(const PackagePassInfo& info); - void gatherDependencies(const PackagePassInfo& info, - std::unordered_set& implicitsOut); void doPackage(const PackagePassInfo& info); /* Extract handlers */ @@ -42,6 +45,10 @@ struct SpecBase : hecl::Database::IDataSpec virtual bool extractFromDisc(nod::DiscBase& disc, bool force, FProgress progress)=0; + /* Convert path to object tag */ + virtual urde::SObjectTag BuildTagFromPath(const hecl::ProjectPath& path, + hecl::BlenderToken& btok) const=0; + /* Even if PC spec is being cooked, this will return the vanilla GCN spec */ virtual const hecl::Database::DataSpecEntry* getOriginalSpec() const=0; @@ -77,6 +84,14 @@ struct SpecBase : hecl::Database::IDataSpec virtual void cookSong(const hecl::ProjectPath& out, const hecl::ProjectPath& in, FCookProgress progress)=0; + /* Dependency flatteners */ + void flattenDependencies(const hecl::ProjectPath& in, + std::vector& pathsOut, + hecl::BlenderToken& btok); + void flattenDependencies(const class UniqueID32& id, std::vector& pathsOut); + void flattenDependencies(const class UniqueID64& id, std::vector& pathsOut); + virtual void flattenDependenciesYAML(athena::io::IStreamReader& fin, std::vector& pathsOut)=0; + const hecl::ProjectPath& getMasterShaderPath() const {return m_masterShader;} /* Support functions for resolving paths from IDs */ diff --git a/DataSpec/SpecMP1.cpp b/DataSpec/SpecMP1.cpp index 6f36ed04e..0e1916c11 100644 --- a/DataSpec/SpecMP1.cpp +++ b/DataSpec/SpecMP1.cpp @@ -373,6 +373,158 @@ struct SpecMP1 : SpecBase }); } + urde::SObjectTag BuildTagFromPath(const hecl::ProjectPath& path, hecl::BlenderToken& btok) const + { + if (hecl::StringUtils::EndsWith(path.getAuxInfo(), _S(".CINF"))) + return {SBIG('CINF'), path.hash().val32()}; + else if (hecl::StringUtils::EndsWith(path.getAuxInfo(), _S(".CSKR"))) + return {SBIG('CSKR'), path.hash().val32()}; + else if (hecl::StringUtils::EndsWith(path.getAuxInfo(), _S(".ANIM"))) + return {SBIG('ANIM'), path.hash().val32()}; + + hecl::ProjectPath asBlend; + if (path.getPathType() == hecl::ProjectPath::Type::Glob) + asBlend = path.getWithExtension(_S(".blend"), true); + else + asBlend = path; + + if (hecl::IsPathBlend(asBlend)) + { + hecl::BlenderConnection& conn = btok.getBlenderConnection(); + if (!conn.openBlend(asBlend)) + return {}; + + switch (conn.getBlendType()) + { + case hecl::BlenderConnection::BlendType::Mesh: + return {SBIG('CMDL'), path.hash().val32()}; + case hecl::BlenderConnection::BlendType::Actor: + if (path.getAuxInfo().size()) + { + if (hecl::StringUtils::EndsWith(path.getAuxInfo(), _S(".CINF"))) + return {SBIG('CINF'), path.hash().val32()}; + else if (hecl::StringUtils::EndsWith(path.getAuxInfo(), _S(".CSKR"))) + return {SBIG('CSKR'), path.hash().val32()}; + else if (hecl::StringUtils::EndsWith(path.getAuxInfo(), _S(".ANIM"))) + return {SBIG('ANIM'), path.hash().val32()}; + } + return {SBIG('ANCS'), path.hash().val32()}; + case hecl::BlenderConnection::BlendType::Area: + return {SBIG('MREA'), path.hash().val32()}; + case hecl::BlenderConnection::BlendType::World: + { + if (path.getAuxInfo().size()) + { + if (hecl::StringUtils::EndsWith(path.getAuxInfo(), _S(".MAPW"))) + return {SBIG('MAPW'), path.hash().val32()}; + else if (hecl::StringUtils::EndsWith(path.getAuxInfo(), _S(".SAVW"))) + return {SBIG('SAVW'), path.hash().val32()}; + } + return {SBIG('MLVL'), path.hash().val32()}; + } + case hecl::BlenderConnection::BlendType::MapArea: + return {SBIG('MAPA'), path.hash().val32()}; + case hecl::BlenderConnection::BlendType::MapUniverse: + return {SBIG('MAPU'), path.hash().val32()}; + case hecl::BlenderConnection::BlendType::Frame: + return {SBIG('FRME'), path.hash().val32()}; + default: + return {}; + } + } + else if (hecl::IsPathPNG(path)) + { + return {SBIG('TXTR'), path.hash().val32()}; + } + else if (hecl::IsPathYAML(path)) + { + FILE* fp = hecl::Fopen(path.getAbsolutePath().c_str(), _S("r")); + if (!fp) + return {}; + + athena::io::YAMLDocReader reader; + yaml_parser_set_input_file(reader.getParser(), fp); + + urde::SObjectTag resTag; + if (reader.ClassTypeOperation([&](const char* className) -> bool + { + if (!strcmp(className, "GPSM")) + { + resTag.type = SBIG('PART'); + return true; + } + if (!strcmp(className, "SWSH")) + { + resTag.type = SBIG('SWHC'); + return true; + } + if (!strcmp(className, "ELSM")) + { + resTag.type = SBIG('ELSC'); + return true; + } + if (!strcmp(className, "WPSM")) + { + resTag.type = SBIG('WPSC'); + return true; + } + if (!strcmp(className, "CRSM")) + { + resTag.type = SBIG('CRSC'); + return true; + } + if (!strcmp(className, "DPSM")) + { + resTag.type = SBIG('DPSC'); + return true; + } + else if (!strcmp(className, "FONT")) + { + resTag.type = SBIG('FONT'); + return true; + } + else if (!strcmp(className, "urde::DNAMP1::EVNT")) + { + resTag.type = SBIG('EVNT'); + return true; + } + else if (!strcmp(className, "urde::DGRP")) + { + resTag.type = SBIG('DGRP'); + return true; + } + else if (!strcmp(className, "urde::DNAMP1::STRG")) + { + resTag.type = SBIG('STRG'); + return true; + } + else if (!strcmp(className, "DataSpec::DNAMP1::CTweakPlayerRes") || + !strcmp(className, "DataSpec::DNAMP1::CTweakGunRes") || + !strcmp(className, "DataSpec::DNAMP1::CTweakSlideShow") || + !strcmp(className, "DataSpec::DNAMP1::CTweakPlayer") || + !strcmp(className, "DataSpec::DNAMP1::CTweakCameraBob")) + { + resTag.type = SBIG('CTWK'); + return true; + } + else if (!strcmp(className, "DataSpec::DNAMP1::HINT")) + { + resTag.type = SBIG('HINT'); + return true; + } + + return false; + })) + { + resTag.id = path.hash().val32(); + fclose(fp); + return resTag; + } + fclose(fp); + } + return {}; + } + void cookMesh(const hecl::ProjectPath& out, const hecl::ProjectPath& in, BlendStream& ds, bool fast, hecl::BlenderToken& btok, FCookProgress progress) @@ -554,6 +706,66 @@ struct SpecMP1 : SpecBase progress(_S("Done")); } + void flattenDependenciesYAML(athena::io::IStreamReader& fin, std::vector& pathsOut) + { + athena::io::YAMLDocReader reader; + if (reader.parse(&fin)) + { + std::string classStr = reader.readString("DNAType"); + if (classStr.empty()) + return; + + if (!classStr.compare(DNAMP1::STRG::DNAType())) + { + DNAMP1::STRG strg; + strg.read(reader); + strg.gatherDependencies(pathsOut); + } + else if (!classStr.compare(DNAParticle::GPSM::DNAType())) + { + DNAParticle::GPSM gpsm; + gpsm.read(reader); + gpsm.gatherDependencies(pathsOut); + } + else if (!classStr.compare(DNAParticle::SWSH::DNAType())) + { + DNAParticle::SWSH swsh; + swsh.read(reader); + swsh.gatherDependencies(pathsOut); + } + else if (!classStr.compare(DNAParticle::ELSM::DNAType())) + { + DNAParticle::ELSM elsm; + elsm.read(reader); + elsm.gatherDependencies(pathsOut); + } + else if (!classStr.compare(DNAParticle::WPSM::DNAType())) + { + DNAParticle::WPSM wpsm; + wpsm.read(reader); + wpsm.gatherDependencies(pathsOut); + } + else if (!classStr.compare(DNAParticle::CRSM::DNAType())) + { + DNAParticle::CRSM crsm; + crsm.read(reader); + crsm.gatherDependencies(pathsOut); + } + else if (!classStr.compare(DNAParticle::DPSM::DNAType())) + { + DNAParticle::DPSM dpsm; + dpsm.read(reader); + dpsm.gatherDependencies(pathsOut); + } + else if (!classStr.compare(DNAFont::FONT::DNAType())) + { + DNAFont::FONT font; + font.read(reader); + font.gatherDependencies(pathsOut); + } + } + } + void cookAudioGroup(const hecl::ProjectPath& out, const hecl::ProjectPath& in, FCookProgress progress) { diff --git a/DataSpec/SpecMP2.cpp b/DataSpec/SpecMP2.cpp index 42fdc9a42..3d8761144 100644 --- a/DataSpec/SpecMP2.cpp +++ b/DataSpec/SpecMP2.cpp @@ -10,6 +10,8 @@ #include "hecl/ClientProcess.hpp" +#include "Runtime/RetroTypes.hpp" + namespace DataSpec { @@ -303,6 +305,11 @@ struct SpecMP2 : SpecBase }); } + urde::SObjectTag BuildTagFromPath(const hecl::ProjectPath& path, hecl::BlenderToken& btok) const + { + return {}; + } + void cookMesh(const hecl::ProjectPath& out, const hecl::ProjectPath& in, BlendStream& ds, bool fast, hecl::BlenderToken& btok, FCookProgress progress) @@ -332,6 +339,10 @@ struct SpecMP2 : SpecBase { } + void flattenDependenciesYAML(athena::io::IStreamReader& fin, std::vector& pathsOut) + { + } + void cookAudioGroup(const hecl::ProjectPath& out, const hecl::ProjectPath& in, FCookProgress progress) { diff --git a/DataSpec/SpecMP3.cpp b/DataSpec/SpecMP3.cpp index 2f2a96883..62b09874e 100644 --- a/DataSpec/SpecMP3.cpp +++ b/DataSpec/SpecMP3.cpp @@ -10,6 +10,8 @@ #include "hecl/ClientProcess.hpp" +#include "Runtime/RetroTypes.hpp" + namespace DataSpec { @@ -489,6 +491,11 @@ struct SpecMP3 : SpecBase return false; } + urde::SObjectTag BuildTagFromPath(const hecl::ProjectPath& path, hecl::BlenderToken& btok) const + { + return {}; + } + void cookMesh(const hecl::ProjectPath& out, const hecl::ProjectPath& in, BlendStream& ds, bool fast, hecl::BlenderToken& btok, FCookProgress progress) @@ -518,6 +525,10 @@ struct SpecMP3 : SpecBase { } + void flattenDependenciesYAML(athena::io::IStreamReader& fin, std::vector& pathsOut) + { + } + void cookAudioGroup(const hecl::ProjectPath& out, const hecl::ProjectPath& in, FCookProgress progress) { diff --git a/Editor/ProjectResourceFactoryBase.hpp b/Editor/ProjectResourceFactoryBase.hpp index 2db448887..27b1d5739 100644 --- a/Editor/ProjectResourceFactoryBase.hpp +++ b/Editor/ProjectResourceFactoryBase.hpp @@ -86,8 +86,11 @@ protected: const hecl::ProjectPath& path, std::experimental::optional& fr); - SObjectTag TagFromPath(const hecl::ProjectPath& path, hecl::BlenderToken& btok) const; - virtual SObjectTag BuildTagFromPath(const hecl::ProjectPath& path, hecl::BlenderToken& btok) const=0; + SObjectTag TagFromPath(const hecl::ProjectPath& path, hecl::BlenderToken& btok) const; + SObjectTag BuildTagFromPath(const hecl::ProjectPath& path, hecl::BlenderToken& btok) const + { + return static_cast(*m_cookSpec).BuildTagFromPath(path, btok); + } void ReadCatalog(const hecl::ProjectPath& catalogPath, athena::io::YAMLDocWriter& nameWriter); diff --git a/Editor/ProjectResourceFactoryMP1.cpp b/Editor/ProjectResourceFactoryMP1.cpp index 5862639eb..7094ff95f 100644 --- a/Editor/ProjectResourceFactoryMP1.cpp +++ b/Editor/ProjectResourceFactoryMP1.cpp @@ -55,155 +55,4 @@ void ProjectResourceFactoryMP1::IndexMP1Resources(hecl::Database::Project& proj) BeginBackgroundIndex(proj, DataSpec::SpecEntMP1, DataSpec::SpecEntMP1PC); } -SObjectTag ProjectResourceFactoryMP1::BuildTagFromPath(const hecl::ProjectPath& path, hecl::BlenderToken& btok) const -{ - if (hecl::StringUtils::EndsWith(path.getAuxInfo(), _S(".CINF"))) - return SObjectTag(SBIG('CINF'), path.hash().val32()); - else if (hecl::StringUtils::EndsWith(path.getAuxInfo(), _S(".CSKR"))) - return SObjectTag(SBIG('CSKR'), path.hash().val32()); - else if (hecl::StringUtils::EndsWith(path.getAuxInfo(), _S(".ANIM"))) - return SObjectTag(SBIG('ANIM'), path.hash().val32()); - - hecl::ProjectPath asBlend; - if (path.getPathType() == hecl::ProjectPath::Type::Glob) - asBlend = path.getWithExtension(_S(".blend"), true); - else - asBlend = path; - - if (hecl::IsPathBlend(asBlend)) - { - hecl::BlenderConnection& conn = btok.getBlenderConnection(); - if (!conn.openBlend(asBlend)) - return {}; - - switch (conn.getBlendType()) - { - case hecl::BlenderConnection::BlendType::Mesh: - return {SBIG('CMDL'), path.hash().val32()}; - case hecl::BlenderConnection::BlendType::Actor: - if (path.getAuxInfo().size()) - { - if (hecl::StringUtils::EndsWith(path.getAuxInfo(), _S(".CINF"))) - return {SBIG('CINF'), path.hash().val32()}; - else if (hecl::StringUtils::EndsWith(path.getAuxInfo(), _S(".CSKR"))) - return {SBIG('CSKR'), path.hash().val32()}; - else if (hecl::StringUtils::EndsWith(path.getAuxInfo(), _S(".ANIM"))) - return {SBIG('ANIM'), path.hash().val32()}; - } - return {SBIG('ANCS'), path.hash().val32()}; - case hecl::BlenderConnection::BlendType::Area: - return {SBIG('MREA'), path.hash().val32()}; - case hecl::BlenderConnection::BlendType::World: - { - if (path.getAuxInfo().size()) - { - if (hecl::StringUtils::EndsWith(path.getAuxInfo(), _S(".MAPW"))) - return {SBIG('MAPW'), path.hash().val32()}; - else if (hecl::StringUtils::EndsWith(path.getAuxInfo(), _S(".SAVW"))) - return {SBIG('SAVW'), path.hash().val32()}; - } - return {SBIG('MLVL'), path.hash().val32()}; - } - case hecl::BlenderConnection::BlendType::MapArea: - return {SBIG('MAPA'), path.hash().val32()}; - case hecl::BlenderConnection::BlendType::MapUniverse: - return {SBIG('MAPU'), path.hash().val32()}; - case hecl::BlenderConnection::BlendType::Frame: - return {SBIG('FRME'), path.hash().val32()}; - default: - return {}; - } - } - else if (hecl::IsPathPNG(path)) - { - return {SBIG('TXTR'), path.hash().val32()}; - } - else if (hecl::IsPathYAML(path)) - { - FILE* fp = hecl::Fopen(path.getAbsolutePath().c_str(), _S("r")); - if (!fp) - return {}; - - athena::io::YAMLDocReader reader; - yaml_parser_set_input_file(reader.getParser(), fp); - - SObjectTag resTag; - if (reader.ClassTypeOperation([&](const char* className) -> bool - { - if (!strcmp(className, "GPSM")) - { - resTag.type = SBIG('PART'); - return true; - } - if (!strcmp(className, "SWSH")) - { - resTag.type = SBIG('SWHC'); - return true; - } - if (!strcmp(className, "ELSM")) - { - resTag.type = SBIG('ELSC'); - return true; - } - if (!strcmp(className, "WPSM")) - { - resTag.type = SBIG('WPSC'); - return true; - } - if (!strcmp(className, "CRSM")) - { - resTag.type = SBIG('CRSC'); - return true; - } - if (!strcmp(className, "DPSM")) - { - resTag.type = SBIG('DPSC'); - return true; - } - else if (!strcmp(className, "FONT")) - { - resTag.type = SBIG('FONT'); - return true; - } - else if (!strcmp(className, "urde::DNAMP1::EVNT")) - { - resTag.type = SBIG('EVNT'); - return true; - } - else if (!strcmp(className, "urde::DGRP")) - { - resTag.type = SBIG('DGRP'); - return true; - } - else if (!strcmp(className, "urde::DNAMP1::STRG")) - { - resTag.type = SBIG('STRG'); - return true; - } - else if (!strcmp(className, "DataSpec::DNAMP1::CTweakPlayerRes") || - !strcmp(className, "DataSpec::DNAMP1::CTweakGunRes") || - !strcmp(className, "DataSpec::DNAMP1::CTweakSlideShow") || - !strcmp(className, "DataSpec::DNAMP1::CTweakPlayer") || - !strcmp(className, "DataSpec::DNAMP1::CTweakCameraBob")) - { - resTag.type = SBIG('CTWK'); - return true; - } - else if (!strcmp(className, "DataSpec::DNAMP1::HINT")) - { - resTag.type = SBIG('HINT'); - return true; - } - - return false; - })) - { - resTag.id = path.hash().val32(); - fclose(fp); - return resTag; - } - fclose(fp); - } - return {}; -} } diff --git a/Editor/ProjectResourceFactoryMP1.hpp b/Editor/ProjectResourceFactoryMP1.hpp index 7bd160d56..cbae1ed2e 100644 --- a/Editor/ProjectResourceFactoryMP1.hpp +++ b/Editor/ProjectResourceFactoryMP1.hpp @@ -11,7 +11,6 @@ class ProjectResourceFactoryMP1 : public ProjectResourceFactoryBase public: ProjectResourceFactoryMP1(hecl::ClientProcess& clientProc); void IndexMP1Resources(hecl::Database::Project& proj); - SObjectTag BuildTagFromPath(const hecl::ProjectPath& path, hecl::BlenderToken& btok) const; }; } diff --git a/hecl b/hecl index 471385dd4..9d1f23410 160000 --- a/hecl +++ b/hecl @@ -1 +1 @@ -Subproject commit 471385dd4a8cad60bd65211f7b17f118d961ef94 +Subproject commit 9d1f234108059b06525f42e1b1d1e85bb418a70e