mirror of
https://github.com/AxioDL/metaforce.git
synced 2025-12-16 15:37:01 +00:00
Explicit Asset ID refactor
This commit is contained in:
@@ -156,27 +156,27 @@ const PAK::Entry* PAK::lookupEntry(std::string_view name) const {
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
std::string PAK::bestEntryName(const nod::Node& pakNode, const Entry& entry, bool& named) const {
|
||||
std::string PAK::bestEntryName(const nod::Node& pakNode, const Entry& entry, std::string& catalogueName) const {
|
||||
std::unordered_map<UniqueID32, Entry>::const_iterator search;
|
||||
if (entry.type == FOURCC('AGSC') && (search = m_entries.find(entry.id)) != m_entries.cend()) {
|
||||
/* Use internal AGSC name for entry */
|
||||
auto rs = search->second.beginReadStream(pakNode);
|
||||
AGSC::Header header;
|
||||
header.read(rs);
|
||||
named = true;
|
||||
return header.groupName;
|
||||
catalogueName = header.groupName;
|
||||
return fmt::format(fmt("{}_{}"), header.groupName, entry.id);
|
||||
}
|
||||
|
||||
/* Prefer named entries first */
|
||||
for (const NameEntry& nentry : m_nameEntries)
|
||||
for (const NameEntry& nentry : m_nameEntries) {
|
||||
if (nentry.id == entry.id) {
|
||||
named = true;
|
||||
return nentry.name;
|
||||
catalogueName = nentry.name;
|
||||
return fmt::format(fmt("{}_{}"), nentry.name, entry.id);
|
||||
}
|
||||
}
|
||||
|
||||
/* Otherwise return ID format string */
|
||||
named = false;
|
||||
return entry.type.toString() + '_' + entry.id.toString();
|
||||
return fmt::format(fmt("{}_{}"), entry.type, entry.id);
|
||||
}
|
||||
|
||||
} // namespace DataSpec::DNAMP1
|
||||
|
||||
Reference in New Issue
Block a user