mirror of https://github.com/AxioDL/metaforce.git
Catalog now encodes aux paths
This commit is contained in:
parent
e9a173c680
commit
796394c54f
|
@ -190,7 +190,7 @@ void PAKRouter<BRIDGETYPE>::build(std::vector<BRIDGETYPE>& bridges, std::functio
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Add RigPairs to global map */
|
/* Add RigPairs to global map */
|
||||||
bridge.addCMDLRigPairs(*this, m_cmdlRigs);
|
bridge.addCMDLRigPairs(*this, m_cmdlRigs, m_cskrCinfToCharacter);
|
||||||
|
|
||||||
progress(++count / bridgesSz);
|
progress(++count / bridgesSz);
|
||||||
++bridgeIdx;
|
++bridgeIdx;
|
||||||
|
@ -205,8 +205,19 @@ void PAKRouter<BRIDGETYPE>::build(std::vector<BRIDGETYPE>& bridges, std::functio
|
||||||
const typename BRIDGETYPE::PAKType& pak = bridge.getPAK();
|
const typename BRIDGETYPE::PAKType& pak = bridge.getPAK();
|
||||||
for (const auto& namedEntry : pak.m_nameEntries)
|
for (const auto& namedEntry : pak.m_nameEntries)
|
||||||
{
|
{
|
||||||
|
if (namedEntry.name == "holo_cinf")
|
||||||
|
continue; /* Problematic corner case */
|
||||||
catalogWriter.enterSubRecord(namedEntry.name.c_str());
|
catalogWriter.enterSubRecord(namedEntry.name.c_str());
|
||||||
catalogWriter.writeString(nullptr, getWorking(namedEntry.id).getRelativePathUTF8().c_str());
|
hecl::ProjectPath working = getWorking(namedEntry.id);
|
||||||
|
if (working.getAuxInfoUTF8().size())
|
||||||
|
{
|
||||||
|
catalogWriter.enterSubVector(nullptr);
|
||||||
|
catalogWriter.writeString(nullptr, working.getRelativePathUTF8().c_str());
|
||||||
|
catalogWriter.writeString(nullptr, working.getAuxInfoUTF8().c_str());
|
||||||
|
catalogWriter.leaveSubVector();
|
||||||
|
}
|
||||||
|
else
|
||||||
|
catalogWriter.writeString(nullptr, working.getRelativePathUTF8().c_str());
|
||||||
catalogWriter.leaveSubRecord();
|
catalogWriter.leaveSubRecord();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -243,6 +254,23 @@ void PAKRouter<BRIDGETYPE>::enterPAKBridge(const BRIDGETYPE& pakBridge)
|
||||||
"PAKBridge provided to PAKRouter::enterPAKBridge() was not part of build()");
|
"PAKBridge provided to PAKRouter::enterPAKBridge() was not part of build()");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
template <class BRIDGETYPE>
|
||||||
|
hecl::ProjectPath PAKRouter<BRIDGETYPE>::getCharacterWorking(const EntryType* entry,
|
||||||
|
const hecl::SystemString& entName) const
|
||||||
|
{
|
||||||
|
if (entry->type == FOURCC('CINF') || entry->type == FOURCC('CSKR'))
|
||||||
|
{
|
||||||
|
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")));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return {};
|
||||||
|
}
|
||||||
|
|
||||||
template <class BRIDGETYPE>
|
template <class BRIDGETYPE>
|
||||||
hecl::ProjectPath PAKRouter<BRIDGETYPE>::getWorking(const EntryType* entry,
|
hecl::ProjectPath PAKRouter<BRIDGETYPE>::getWorking(const EntryType* entry,
|
||||||
const ResExtractor<BRIDGETYPE>& extractor) const
|
const ResExtractor<BRIDGETYPE>& extractor) const
|
||||||
|
@ -266,11 +294,17 @@ hecl::ProjectPath PAKRouter<BRIDGETYPE>::getWorking(const EntryType* entry,
|
||||||
#else
|
#else
|
||||||
hecl::SystemString entName = getBestEntryName(*entry);
|
hecl::SystemString entName = getBestEntryName(*entry);
|
||||||
#endif
|
#endif
|
||||||
|
hecl::SystemString auxInfo;
|
||||||
if (extractor.fileExts[0] && !extractor.fileExts[1])
|
if (extractor.fileExts[0] && !extractor.fileExts[1])
|
||||||
entName += extractor.fileExts[0];
|
entName += extractor.fileExts[0];
|
||||||
else if (extractor.fileExts[0])
|
else if (extractor.fileExts[0])
|
||||||
entName += _S(".*");
|
entName += _S(".*");
|
||||||
return hecl::ProjectPath(pakPath, entName);
|
else if (hecl::ProjectPath chWork = getCharacterWorking(entry, entName))
|
||||||
|
{
|
||||||
|
entName = chWork.getLastComponent();
|
||||||
|
auxInfo = chWork.getAuxInfo();
|
||||||
|
}
|
||||||
|
return hecl::ProjectPath(pakPath, entName).ensureAuxInfo(auxInfo);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -285,18 +319,24 @@ hecl::ProjectPath PAKRouter<BRIDGETYPE>::getWorking(const EntryType* entry,
|
||||||
#else
|
#else
|
||||||
hecl::SystemString entName = getBestEntryName(*entry);
|
hecl::SystemString entName = getBestEntryName(*entry);
|
||||||
#endif
|
#endif
|
||||||
|
hecl::SystemString auxInfo;
|
||||||
if (extractor.fileExts[0] && !extractor.fileExts[1])
|
if (extractor.fileExts[0] && !extractor.fileExts[1])
|
||||||
entName += extractor.fileExts[0];
|
entName += extractor.fileExts[0];
|
||||||
else if (extractor.fileExts[0])
|
else if (extractor.fileExts[0])
|
||||||
entName += _S(".*");
|
entName += _S(".*");
|
||||||
|
else if (hecl::ProjectPath chWork = getCharacterWorking(entry, entName))
|
||||||
|
{
|
||||||
|
entName = chWork.getLastComponent();
|
||||||
|
auxInfo = chWork.getAuxInfo();
|
||||||
|
}
|
||||||
if (bridge.getPAK().m_noShare)
|
if (bridge.getPAK().m_noShare)
|
||||||
{
|
{
|
||||||
return hecl::ProjectPath(pakPath, entName);
|
return hecl::ProjectPath(pakPath, entName).ensureAuxInfo(auxInfo);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
hecl::ProjectPath uniquePath = entry->unique.uniquePath(pakPath);
|
hecl::ProjectPath uniquePath = entry->unique.uniquePath(pakPath);
|
||||||
return hecl::ProjectPath(uniquePath, entName);
|
return hecl::ProjectPath(uniquePath, entName).ensureAuxInfo(auxInfo);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -308,14 +348,20 @@ hecl::ProjectPath PAKRouter<BRIDGETYPE>::getWorking(const EntryType* entry,
|
||||||
#else
|
#else
|
||||||
hecl::SystemString entBase = getBestEntryName(*entry);
|
hecl::SystemString entBase = getBestEntryName(*entry);
|
||||||
#endif
|
#endif
|
||||||
|
hecl::SystemString auxInfo;
|
||||||
hecl::SystemString entName = entBase;
|
hecl::SystemString entName = entBase;
|
||||||
if (extractor.fileExts[0] && !extractor.fileExts[1])
|
if (extractor.fileExts[0] && !extractor.fileExts[1])
|
||||||
entName += extractor.fileExts[0];
|
entName += extractor.fileExts[0];
|
||||||
else if (extractor.fileExts[0])
|
else if (extractor.fileExts[0])
|
||||||
entName += _S(".*");
|
entName += _S(".*");
|
||||||
|
else if (hecl::ProjectPath chWork = getCharacterWorking(entry, entName))
|
||||||
|
{
|
||||||
|
entName = chWork.getLastComponent();
|
||||||
|
auxInfo = chWork.getAuxInfo();
|
||||||
|
}
|
||||||
hecl::ProjectPath sharedPath(m_sharedWorking, entName);
|
hecl::ProjectPath sharedPath(m_sharedWorking, entName);
|
||||||
m_sharedWorking.makeDir();
|
m_sharedWorking.makeDir();
|
||||||
return sharedPath;
|
return sharedPath.ensureAuxInfo(auxInfo);
|
||||||
}
|
}
|
||||||
|
|
||||||
LogDNACommon.report(logvisor::Fatal, "Unable to find entry %s", entry->id.toString().c_str());
|
LogDNACommon.report(logvisor::Fatal, "Unable to find entry %s", entry->id.toString().c_str());
|
||||||
|
|
|
@ -136,6 +136,7 @@ public:
|
||||||
using IDType = typename PAKType::IDType;
|
using IDType = typename PAKType::IDType;
|
||||||
using EntryType = typename PAKType::Entry;
|
using EntryType = typename PAKType::Entry;
|
||||||
using RigPair = std::pair<IDType, IDType>;
|
using RigPair = std::pair<IDType, IDType>;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
const std::vector<BRIDGETYPE>* m_bridges = nullptr;
|
const std::vector<BRIDGETYPE>* m_bridges = nullptr;
|
||||||
std::vector<std::pair<hecl::ProjectPath,hecl::ProjectPath>> m_bridgePaths;
|
std::vector<std::pair<hecl::ProjectPath,hecl::ProjectPath>> m_bridgePaths;
|
||||||
|
@ -149,6 +150,11 @@ private:
|
||||||
std::unordered_map<IDType, std::pair<size_t, EntryType*>> m_uniqueEntries;
|
std::unordered_map<IDType, std::pair<size_t, EntryType*>> m_uniqueEntries;
|
||||||
std::unordered_map<IDType, std::pair<size_t, EntryType*>> m_sharedEntries;
|
std::unordered_map<IDType, std::pair<size_t, EntryType*>> m_sharedEntries;
|
||||||
std::unordered_map<IDType, RigPair> m_cmdlRigs;
|
std::unordered_map<IDType, RigPair> m_cmdlRigs;
|
||||||
|
std::unordered_map<IDType, IDType> m_cskrCinfToCharacter;
|
||||||
|
|
||||||
|
hecl::ProjectPath getCharacterWorking(const EntryType* entry,
|
||||||
|
const hecl::SystemString& entName) const;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
PAKRouter(const SpecBase& dataSpec, const hecl::ProjectPath& working, const hecl::ProjectPath& cooked)
|
PAKRouter(const SpecBase& dataSpec, const hecl::ProjectPath& working, const hecl::ProjectPath& cooked)
|
||||||
: PAKRouterBase(dataSpec),
|
: PAKRouterBase(dataSpec),
|
||||||
|
|
|
@ -219,7 +219,8 @@ void PAKBridge::build()
|
||||||
}
|
}
|
||||||
|
|
||||||
void PAKBridge::addCMDLRigPairs(PAKRouter<PAKBridge>& pakRouter,
|
void PAKBridge::addCMDLRigPairs(PAKRouter<PAKBridge>& pakRouter,
|
||||||
std::unordered_map<UniqueID32, std::pair<UniqueID32, UniqueID32>>& addTo) const
|
std::unordered_map<UniqueID32, std::pair<UniqueID32, UniqueID32>>& addTo,
|
||||||
|
std::unordered_map<UniqueID32, UniqueID32>& cskrCinfToAncs) const
|
||||||
{
|
{
|
||||||
for (const std::pair<UniqueID32, PAK::Entry*>& entry : m_pak.m_idMap)
|
for (const std::pair<UniqueID32, PAK::Entry*>& entry : m_pak.m_idMap)
|
||||||
{
|
{
|
||||||
|
@ -231,6 +232,8 @@ void PAKBridge::addCMDLRigPairs(PAKRouter<PAKBridge>& pakRouter,
|
||||||
for (const ANCS::CharacterSet::CharacterInfo& ci : ancs.characterSet.characters)
|
for (const ANCS::CharacterSet::CharacterInfo& ci : ancs.characterSet.characters)
|
||||||
{
|
{
|
||||||
addTo[ci.cmdl] = std::make_pair(ci.cskr, ci.cinf);
|
addTo[ci.cmdl] = std::make_pair(ci.cskr, ci.cinf);
|
||||||
|
cskrCinfToAncs[ci.cskr] = entry.second->id;
|
||||||
|
cskrCinfToAncs[ci.cinf] = entry.second->id;
|
||||||
PAK::Entry* cmdlEnt = (PAK::Entry*)m_pak.lookupEntry(ci.cmdl);
|
PAK::Entry* cmdlEnt = (PAK::Entry*)m_pak.lookupEntry(ci.cmdl);
|
||||||
PAK::Entry* cskrEnt = (PAK::Entry*)m_pak.lookupEntry(ci.cskr);
|
PAK::Entry* cskrEnt = (PAK::Entry*)m_pak.lookupEntry(ci.cskr);
|
||||||
PAK::Entry* cinfEnt = (PAK::Entry*)m_pak.lookupEntry(ci.cinf);
|
PAK::Entry* cinfEnt = (PAK::Entry*)m_pak.lookupEntry(ci.cinf);
|
||||||
|
@ -240,6 +243,7 @@ void PAKBridge::addCMDLRigPairs(PAKRouter<PAKBridge>& pakRouter,
|
||||||
if (ci.cmdlOverlay && ci.cskrOverlay)
|
if (ci.cmdlOverlay && ci.cskrOverlay)
|
||||||
{
|
{
|
||||||
addTo[ci.cmdlOverlay] = std::make_pair(ci.cskrOverlay, ci.cinf);
|
addTo[ci.cmdlOverlay] = std::make_pair(ci.cskrOverlay, ci.cinf);
|
||||||
|
cskrCinfToAncs[ci.cskrOverlay] = entry.second->id;
|
||||||
PAK::Entry* cmdlEnt = (PAK::Entry*)m_pak.lookupEntry(ci.cmdlOverlay);
|
PAK::Entry* cmdlEnt = (PAK::Entry*)m_pak.lookupEntry(ci.cmdlOverlay);
|
||||||
PAK::Entry* cskrEnt = (PAK::Entry*)m_pak.lookupEntry(ci.cskrOverlay);
|
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());
|
cmdlEnt->name = hecl::Format("ANCS_%08X_%s_overmodel", entry.first.toUint32(), ci.name.c_str());
|
||||||
|
|
|
@ -35,7 +35,8 @@ public:
|
||||||
const nod::Node& getNode() const {return m_node;}
|
const nod::Node& getNode() const {return m_node;}
|
||||||
|
|
||||||
void addCMDLRigPairs(PAKRouter<PAKBridge>& pakRouter,
|
void addCMDLRigPairs(PAKRouter<PAKBridge>& pakRouter,
|
||||||
std::unordered_map<UniqueID32, std::pair<UniqueID32, UniqueID32>>& addTo) const;
|
std::unordered_map<UniqueID32, std::pair<UniqueID32, UniqueID32>>& addTo,
|
||||||
|
std::unordered_map<UniqueID32, UniqueID32>& cskrCinfToAncs) const;
|
||||||
};
|
};
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -184,7 +184,8 @@ void PAKBridge::build()
|
||||||
}
|
}
|
||||||
|
|
||||||
void PAKBridge::addCMDLRigPairs(PAKRouter<PAKBridge>& pakRouter,
|
void PAKBridge::addCMDLRigPairs(PAKRouter<PAKBridge>& pakRouter,
|
||||||
std::unordered_map<UniqueID32, std::pair<UniqueID32, UniqueID32>>& addTo) const
|
std::unordered_map<UniqueID32, std::pair<UniqueID32, UniqueID32>>& addTo,
|
||||||
|
std::unordered_map<UniqueID32, UniqueID32>& cskrCinfToAncs) const
|
||||||
{
|
{
|
||||||
for (const std::pair<UniqueID32, DNAMP1::PAK::Entry*>& entry : m_pak.m_idMap)
|
for (const std::pair<UniqueID32, DNAMP1::PAK::Entry*>& entry : m_pak.m_idMap)
|
||||||
{
|
{
|
||||||
|
@ -196,8 +197,13 @@ void PAKBridge::addCMDLRigPairs(PAKRouter<PAKBridge>& pakRouter,
|
||||||
for (const ANCS::CharacterSet::CharacterInfo& ci : ancs.characterSet.characters)
|
for (const ANCS::CharacterSet::CharacterInfo& ci : ancs.characterSet.characters)
|
||||||
{
|
{
|
||||||
addTo[ci.cmdl] = std::make_pair(ci.cskr, ci.cinf);
|
addTo[ci.cmdl] = std::make_pair(ci.cskr, ci.cinf);
|
||||||
|
cskrCinfToAncs[ci.cskr] = entry.second->id;
|
||||||
|
cskrCinfToAncs[ci.cinf] = entry.second->id;
|
||||||
if (ci.cmdlOverlay)
|
if (ci.cmdlOverlay)
|
||||||
|
{
|
||||||
addTo[ci.cmdlOverlay] = std::make_pair(ci.cskrOverlay, ci.cinf);
|
addTo[ci.cmdlOverlay] = std::make_pair(ci.cskrOverlay, ci.cinf);
|
||||||
|
cskrCinfToAncs[ci.cskrOverlay] = entry.second->id;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -36,7 +36,8 @@ public:
|
||||||
const nod::Node& getNode() const {return m_node;}
|
const nod::Node& getNode() const {return m_node;}
|
||||||
|
|
||||||
void addCMDLRigPairs(PAKRouter<PAKBridge>& pakRouter,
|
void addCMDLRigPairs(PAKRouter<PAKBridge>& pakRouter,
|
||||||
std::unordered_map<UniqueID32, std::pair<UniqueID32, UniqueID32>>& addTo) const;
|
std::unordered_map<UniqueID32, std::pair<UniqueID32, UniqueID32>>& addTo,
|
||||||
|
std::unordered_map<UniqueID32, UniqueID32>& cskrCinfToAncs) const;
|
||||||
};
|
};
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -194,7 +194,8 @@ void PAKBridge::build()
|
||||||
}
|
}
|
||||||
|
|
||||||
void PAKBridge::addCMDLRigPairs(PAKRouter<PAKBridge>& pakRouter,
|
void PAKBridge::addCMDLRigPairs(PAKRouter<PAKBridge>& pakRouter,
|
||||||
std::unordered_map<UniqueID64, std::pair<UniqueID64, UniqueID64>>& addTo) const
|
std::unordered_map<UniqueID64, std::pair<UniqueID64, UniqueID64>>& addTo,
|
||||||
|
std::unordered_map<UniqueID64, UniqueID64>& cskrCinfToChar) const
|
||||||
{
|
{
|
||||||
for (const std::pair<UniqueID64, PAK::Entry*>& entry : m_pak.m_idMap)
|
for (const std::pair<UniqueID64, PAK::Entry*>& entry : m_pak.m_idMap)
|
||||||
{
|
{
|
||||||
|
@ -205,8 +206,13 @@ void PAKBridge::addCMDLRigPairs(PAKRouter<PAKBridge>& pakRouter,
|
||||||
aChar.read(rs);
|
aChar.read(rs);
|
||||||
const CHAR::CharacterInfo& ci = aChar.characterInfo;
|
const CHAR::CharacterInfo& ci = aChar.characterInfo;
|
||||||
addTo[ci.cmdl] = std::make_pair(ci.cskr, ci.cinf);
|
addTo[ci.cmdl] = std::make_pair(ci.cskr, ci.cinf);
|
||||||
|
cskrCinfToChar[ci.cskr] = entry.second->id;
|
||||||
|
cskrCinfToChar[ci.cinf] = entry.second->id;
|
||||||
for (const CHAR::CharacterInfo::Overlay& overlay : ci.overlays)
|
for (const CHAR::CharacterInfo::Overlay& overlay : ci.overlays)
|
||||||
|
{
|
||||||
addTo[overlay.cmdl] = std::make_pair(overlay.cskr, ci.cinf);
|
addTo[overlay.cmdl] = std::make_pair(overlay.cskr, ci.cinf);
|
||||||
|
cskrCinfToChar[overlay.cskr] = entry.second->id;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -36,7 +36,8 @@ public:
|
||||||
inline const nod::Node& getNode() const {return m_node;}
|
inline const nod::Node& getNode() const {return m_node;}
|
||||||
|
|
||||||
void addCMDLRigPairs(PAKRouter<PAKBridge>& pakRouter,
|
void addCMDLRigPairs(PAKRouter<PAKBridge>& pakRouter,
|
||||||
std::unordered_map<UniqueID64, std::pair<UniqueID64, UniqueID64>>& addTo) const;
|
std::unordered_map<UniqueID64, std::pair<UniqueID64, UniqueID64>>& addTo,
|
||||||
|
std::unordered_map<UniqueID64, UniqueID64>& cskrCinfToChar) const;
|
||||||
};
|
};
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue