Additional catalog corner cases

This commit is contained in:
Jack Andersen 2016-09-18 20:08:18 -10:00
parent 796394c54f
commit d440c0ff43
8 changed files with 30 additions and 31 deletions

View File

@ -255,18 +255,15 @@ void PAKRouter<BRIDGETYPE>::enterPAKBridge(const BRIDGETYPE& pakBridge)
}
template <class BRIDGETYPE>
hecl::ProjectPath PAKRouter<BRIDGETYPE>::getCharacterWorking(const EntryType* entry,
const hecl::SystemString& entName) const
hecl::ProjectPath PAKRouter<BRIDGETYPE>::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<BRIDGETYPE>::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<BRIDGETYPE>::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<BRIDGETYPE>::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();

View File

@ -150,10 +150,9 @@ private:
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, RigPair> m_cmdlRigs;
std::unordered_map<IDType, IDType> m_cskrCinfToCharacter;
std::unordered_map<IDType, std::pair<IDType, std::string>> 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)

View File

@ -220,7 +220,7 @@ void PAKBridge::build()
void PAKBridge::addCMDLRigPairs(PAKRouter<PAKBridge>& pakRouter,
std::unordered_map<UniqueID32, std::pair<UniqueID32, UniqueID32>>& addTo,
std::unordered_map<UniqueID32, UniqueID32>& cskrCinfToAncs) const
std::unordered_map<UniqueID32, std::pair<UniqueID32, std::string>>& cskrCinfToAncs) const
{
for (const std::pair<UniqueID32, PAK::Entry*>& entry : m_pak.m_idMap)
{
@ -232,8 +232,8 @@ void PAKBridge::addCMDLRigPairs(PAKRouter<PAKBridge>& 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<PAKBridge>& 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<PAKBridge>& 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()));
}
}
}

View File

@ -36,7 +36,7 @@ public:
void addCMDLRigPairs(PAKRouter<PAKBridge>& pakRouter,
std::unordered_map<UniqueID32, std::pair<UniqueID32, UniqueID32>>& addTo,
std::unordered_map<UniqueID32, UniqueID32>& cskrCinfToAncs) const;
std::unordered_map<UniqueID32, std::pair<UniqueID32, std::string>>& cskrCinfToAncs) const;
};
}

View File

@ -185,7 +185,7 @@ void PAKBridge::build()
void PAKBridge::addCMDLRigPairs(PAKRouter<PAKBridge>& pakRouter,
std::unordered_map<UniqueID32, std::pair<UniqueID32, UniqueID32>>& addTo,
std::unordered_map<UniqueID32, UniqueID32>& cskrCinfToAncs) const
std::unordered_map<UniqueID32, std::pair<UniqueID32, std::string>>& cskrCinfToAncs) const
{
for (const std::pair<UniqueID32, DNAMP1::PAK::Entry*>& entry : m_pak.m_idMap)
{
@ -197,12 +197,12 @@ void PAKBridge::addCMDLRigPairs(PAKRouter<PAKBridge>& 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()));
}
}
}

View File

@ -37,7 +37,7 @@ public:
void addCMDLRigPairs(PAKRouter<PAKBridge>& pakRouter,
std::unordered_map<UniqueID32, std::pair<UniqueID32, UniqueID32>>& addTo,
std::unordered_map<UniqueID32, UniqueID32>& cskrCinfToAncs) const;
std::unordered_map<UniqueID32, std::pair<UniqueID32, std::string>>& cskrCinfToAncs) const;
};
}

View File

@ -195,7 +195,7 @@ void PAKBridge::build()
void PAKBridge::addCMDLRigPairs(PAKRouter<PAKBridge>& pakRouter,
std::unordered_map<UniqueID64, std::pair<UniqueID64, UniqueID64>>& addTo,
std::unordered_map<UniqueID64, UniqueID64>& cskrCinfToChar) const
std::unordered_map<UniqueID64, std::pair<UniqueID64, std::string>>& cskrCinfToChar) const
{
for (const std::pair<UniqueID64, PAK::Entry*>& entry : m_pak.m_idMap)
{
@ -206,12 +206,13 @@ void PAKBridge::addCMDLRigPairs(PAKRouter<PAKBridge>& 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()));
}
}
}

View File

@ -37,7 +37,7 @@ public:
void addCMDLRigPairs(PAKRouter<PAKBridge>& pakRouter,
std::unordered_map<UniqueID64, std::pair<UniqueID64, UniqueID64>>& addTo,
std::unordered_map<UniqueID64, UniqueID64>& cskrCinfToChar) const;
std::unordered_map<UniqueID64, std::pair<UniqueID64, std::string>>& cskrCinfToChar) const;
};
}