diff --git a/DataSpec/DNACommon/PAK.cpp b/DataSpec/DNACommon/PAK.cpp index f0c48db88..cd12d62f3 100644 --- a/DataSpec/DNACommon/PAK.cpp +++ b/DataSpec/DNACommon/PAK.cpp @@ -255,18 +255,15 @@ void PAKRouter::enterPAKBridge(const BRIDGETYPE& pakBridge) } template -hecl::ProjectPath PAKRouter::getCharacterWorking(const EntryType* entry, - const hecl::SystemString& entName) const +hecl::ProjectPath PAKRouter::getCharacterWorking(const EntryType* entry) const { - if (entry->type == FOURCC('CINF') || entry->type == FOURCC('CSKR')) + auto characterSearch = m_cskrCinfToCharacter.find(entry->id); + if (characterSearch != m_cskrCinfToCharacter.cend()) { - auto characterSearch = m_cskrCinfToCharacter.find(entry->id); - if (characterSearch != m_cskrCinfToCharacter.cend()) - { - hecl::ProjectPath characterPath = getWorking(characterSearch->second); - return characterPath.ensureAuxInfo(entName + - ((entry->type == FOURCC('CINF')) ? _S(".CINF") : _S(".CSKR"))); - } + hecl::ProjectPath characterPath = getWorking(characterSearch->second.first); + if (entry->type == FOURCC('EVNT')) + return characterPath.getWithExtension((_S(".") + characterSearch->second.second).c_str(), true); + return characterPath.ensureAuxInfo(characterSearch->second.second); } return {}; } @@ -299,7 +296,7 @@ hecl::ProjectPath PAKRouter::getWorking(const EntryType* entry, entName += extractor.fileExts[0]; else if (extractor.fileExts[0]) entName += _S(".*"); - else if (hecl::ProjectPath chWork = getCharacterWorking(entry, entName)) + else if (hecl::ProjectPath chWork = getCharacterWorking(entry)) { entName = chWork.getLastComponent(); auxInfo = chWork.getAuxInfo(); @@ -324,7 +321,7 @@ hecl::ProjectPath PAKRouter::getWorking(const EntryType* entry, entName += extractor.fileExts[0]; else if (extractor.fileExts[0]) entName += _S(".*"); - else if (hecl::ProjectPath chWork = getCharacterWorking(entry, entName)) + else if (hecl::ProjectPath chWork = getCharacterWorking(entry)) { entName = chWork.getLastComponent(); auxInfo = chWork.getAuxInfo(); @@ -354,7 +351,7 @@ hecl::ProjectPath PAKRouter::getWorking(const EntryType* entry, entName += extractor.fileExts[0]; else if (extractor.fileExts[0]) entName += _S(".*"); - else if (hecl::ProjectPath chWork = getCharacterWorking(entry, entName)) + else if (hecl::ProjectPath chWork = getCharacterWorking(entry)) { entName = chWork.getLastComponent(); auxInfo = chWork.getAuxInfo(); diff --git a/DataSpec/DNACommon/PAK.hpp b/DataSpec/DNACommon/PAK.hpp index 6ce51ff23..ad64ed971 100644 --- a/DataSpec/DNACommon/PAK.hpp +++ b/DataSpec/DNACommon/PAK.hpp @@ -150,10 +150,9 @@ private: std::unordered_map> m_uniqueEntries; std::unordered_map> m_sharedEntries; std::unordered_map m_cmdlRigs; - std::unordered_map m_cskrCinfToCharacter; + std::unordered_map> m_cskrCinfToCharacter; - hecl::ProjectPath getCharacterWorking(const EntryType* entry, - const hecl::SystemString& entName) const; + hecl::ProjectPath getCharacterWorking(const EntryType* entry) const; public: PAKRouter(const SpecBase& dataSpec, const hecl::ProjectPath& working, const hecl::ProjectPath& cooked) diff --git a/DataSpec/DNAMP1/DNAMP1.cpp b/DataSpec/DNAMP1/DNAMP1.cpp index 00219d968..8370ea302 100644 --- a/DataSpec/DNAMP1/DNAMP1.cpp +++ b/DataSpec/DNAMP1/DNAMP1.cpp @@ -220,7 +220,7 @@ void PAKBridge::build() void PAKBridge::addCMDLRigPairs(PAKRouter& pakRouter, std::unordered_map>& addTo, - std::unordered_map& cskrCinfToAncs) const + std::unordered_map>& cskrCinfToAncs) const { for (const std::pair& entry : m_pak.m_idMap) { @@ -232,8 +232,8 @@ void PAKBridge::addCMDLRigPairs(PAKRouter& pakRouter, for (const ANCS::CharacterSet::CharacterInfo& ci : ancs.characterSet.characters) { addTo[ci.cmdl] = std::make_pair(ci.cskr, ci.cinf); - cskrCinfToAncs[ci.cskr] = entry.second->id; - cskrCinfToAncs[ci.cinf] = entry.second->id; + cskrCinfToAncs[ci.cskr] = std::make_pair(entry.second->id, hecl::Format("%s.CSKR", ci.name.c_str())); + cskrCinfToAncs[ci.cinf] = std::make_pair(entry.second->id, hecl::Format("CINF_%08X.CINF", ci.cinf.toUint32())); PAK::Entry* cmdlEnt = (PAK::Entry*)m_pak.lookupEntry(ci.cmdl); PAK::Entry* cskrEnt = (PAK::Entry*)m_pak.lookupEntry(ci.cskr); PAK::Entry* cinfEnt = (PAK::Entry*)m_pak.lookupEntry(ci.cinf); @@ -243,7 +243,7 @@ void PAKBridge::addCMDLRigPairs(PAKRouter& pakRouter, if (ci.cmdlOverlay && ci.cskrOverlay) { addTo[ci.cmdlOverlay] = std::make_pair(ci.cskrOverlay, ci.cinf); - cskrCinfToAncs[ci.cskrOverlay] = entry.second->id; + cskrCinfToAncs[ci.cskrOverlay] = std::make_pair(entry.second->id, hecl::Format("%s.over.CSKR", ci.name.c_str())); PAK::Entry* cmdlEnt = (PAK::Entry*)m_pak.lookupEntry(ci.cmdlOverlay); PAK::Entry* cskrEnt = (PAK::Entry*)m_pak.lookupEntry(ci.cskrOverlay); cmdlEnt->name = hecl::Format("ANCS_%08X_%s_overmodel", entry.first.toUint32(), ci.name.c_str()); @@ -256,10 +256,12 @@ void PAKBridge::addCMDLRigPairs(PAKRouter& pakRouter, { PAK::Entry* animEnt = (PAK::Entry*)m_pak.lookupEntry(ae.second.animId); animEnt->name = hecl::Format("ANCS_%08X_%s", entry.first.toUint32(), ae.second.name.c_str()); + cskrCinfToAncs[ae.second.animId] = std::make_pair(entry.second->id, hecl::Format("%s.ANIM", ae.second.name.c_str())); if (ae.second.evntId) { PAK::Entry* evntEnt = (PAK::Entry*)m_pak.lookupEntry(ae.second.evntId); evntEnt->name = hecl::Format("ANCS_%08X_%s_evnt", entry.first.toUint32(), ae.second.name.c_str()); + cskrCinfToAncs[ae.second.evntId] = std::make_pair(entry.second->id, hecl::Format("%s.evnt.yaml", ae.second.name.c_str())); } } } diff --git a/DataSpec/DNAMP1/DNAMP1.hpp b/DataSpec/DNAMP1/DNAMP1.hpp index 94921ec8a..60b675ecb 100644 --- a/DataSpec/DNAMP1/DNAMP1.hpp +++ b/DataSpec/DNAMP1/DNAMP1.hpp @@ -36,7 +36,7 @@ public: void addCMDLRigPairs(PAKRouter& pakRouter, std::unordered_map>& addTo, - std::unordered_map& cskrCinfToAncs) const; + std::unordered_map>& cskrCinfToAncs) const; }; } diff --git a/DataSpec/DNAMP2/DNAMP2.cpp b/DataSpec/DNAMP2/DNAMP2.cpp index 13c28bd05..e63cd54a4 100644 --- a/DataSpec/DNAMP2/DNAMP2.cpp +++ b/DataSpec/DNAMP2/DNAMP2.cpp @@ -185,7 +185,7 @@ void PAKBridge::build() void PAKBridge::addCMDLRigPairs(PAKRouter& pakRouter, std::unordered_map>& addTo, - std::unordered_map& cskrCinfToAncs) const + std::unordered_map>& cskrCinfToAncs) const { for (const std::pair& entry : m_pak.m_idMap) { @@ -197,12 +197,12 @@ void PAKBridge::addCMDLRigPairs(PAKRouter& pakRouter, for (const ANCS::CharacterSet::CharacterInfo& ci : ancs.characterSet.characters) { addTo[ci.cmdl] = std::make_pair(ci.cskr, ci.cinf); - cskrCinfToAncs[ci.cskr] = entry.second->id; - cskrCinfToAncs[ci.cinf] = entry.second->id; + cskrCinfToAncs[ci.cskr] = std::make_pair(entry.second->id, hecl::Format("%s.CSKR", ci.name.c_str())); + cskrCinfToAncs[ci.cinf] = std::make_pair(entry.second->id, hecl::Format("CINF_%08X.CINF", ci.cinf.toUint32())); if (ci.cmdlOverlay) { addTo[ci.cmdlOverlay] = std::make_pair(ci.cskrOverlay, ci.cinf); - cskrCinfToAncs[ci.cskrOverlay] = entry.second->id; + cskrCinfToAncs[ci.cskrOverlay] = std::make_pair(entry.second->id, hecl::Format("%s.over.CSKR", ci.name.c_str())); } } } diff --git a/DataSpec/DNAMP2/DNAMP2.hpp b/DataSpec/DNAMP2/DNAMP2.hpp index e8d6cb66e..b7ae189a9 100644 --- a/DataSpec/DNAMP2/DNAMP2.hpp +++ b/DataSpec/DNAMP2/DNAMP2.hpp @@ -37,7 +37,7 @@ public: void addCMDLRigPairs(PAKRouter& pakRouter, std::unordered_map>& addTo, - std::unordered_map& cskrCinfToAncs) const; + std::unordered_map>& cskrCinfToAncs) const; }; } diff --git a/DataSpec/DNAMP3/DNAMP3.cpp b/DataSpec/DNAMP3/DNAMP3.cpp index 79d46cc51..9714e51b6 100644 --- a/DataSpec/DNAMP3/DNAMP3.cpp +++ b/DataSpec/DNAMP3/DNAMP3.cpp @@ -195,7 +195,7 @@ void PAKBridge::build() void PAKBridge::addCMDLRigPairs(PAKRouter& pakRouter, std::unordered_map>& addTo, - std::unordered_map& cskrCinfToChar) const + std::unordered_map>& cskrCinfToChar) const { for (const std::pair& entry : m_pak.m_idMap) { @@ -206,12 +206,13 @@ void PAKBridge::addCMDLRigPairs(PAKRouter& pakRouter, aChar.read(rs); const CHAR::CharacterInfo& ci = aChar.characterInfo; addTo[ci.cmdl] = std::make_pair(ci.cskr, ci.cinf); - cskrCinfToChar[ci.cskr] = entry.second->id; - cskrCinfToChar[ci.cinf] = entry.second->id; + cskrCinfToChar[ci.cskr] = std::make_pair(entry.second->id, hecl::Format("%s.CSKR", ci.name.c_str())); + cskrCinfToChar[ci.cinf] = std::make_pair(entry.second->id, hecl::Format("CINF_%" PRIX64 ".CINF", ci.cinf.toUint64())); for (const CHAR::CharacterInfo::Overlay& overlay : ci.overlays) { addTo[overlay.cmdl] = std::make_pair(overlay.cskr, ci.cinf); - cskrCinfToChar[overlay.cskr] = entry.second->id; + cskrCinfToChar[overlay.cskr] = std::make_pair(entry.second->id, + hecl::Format("%s.%s.CSKR", ci.name.c_str(), overlay.type.toString().c_str())); } } } diff --git a/DataSpec/DNAMP3/DNAMP3.hpp b/DataSpec/DNAMP3/DNAMP3.hpp index c2a8d7fab..32c68259c 100644 --- a/DataSpec/DNAMP3/DNAMP3.hpp +++ b/DataSpec/DNAMP3/DNAMP3.hpp @@ -37,7 +37,7 @@ public: void addCMDLRigPairs(PAKRouter& pakRouter, std::unordered_map>& addTo, - std::unordered_map& cskrCinfToChar) const; + std::unordered_map>& cskrCinfToChar) const; }; }