mirror of
https://github.com/AxioDL/metaforce.git
synced 2025-12-08 13:44:56 +00:00
Actually implement AssetNameMap in DNAMP1
This commit is contained in:
@@ -66,7 +66,7 @@ void InitAssetNameMap() {
|
||||
}
|
||||
|
||||
const std::string* TranslateIdToName(const UniqueID32& id) {
|
||||
if (g_AssetNameMap.find(id.toUint64()) == g_AssetNameMap.end())
|
||||
if (g_AssetNameMap.find(id.toUint64()) == g_AssetNameMap.cend())
|
||||
return nullptr;
|
||||
|
||||
return &g_AssetNameMap[id.toUint64()].name;
|
||||
|
||||
@@ -145,14 +145,14 @@ public:
|
||||
atUint32 addedVerts = 0;
|
||||
atUint32 nextVert = 1;
|
||||
while (nextVert < m_nextOverPos) {
|
||||
for (const std::pair<atUint16, std::vector<std::pair<atInt16, atUint16>>>& ev : m_extraVerts) {
|
||||
for (const std::pair<atInt16, atUint16>& se : ev.second) {
|
||||
for (const auto& [ev, evVec] : m_extraVerts) {
|
||||
for (const std::pair<atInt16, atUint16>& se : evVec) {
|
||||
if (se.second == nextVert) {
|
||||
os.format(FMT_STRING(
|
||||
"bm.verts.ensure_lookup_table()\n"
|
||||
"orig_vert = bm.verts[{}]\n"
|
||||
"vert = bm.verts.new(orig_vert.co)\n"),
|
||||
ev.first + baseVert);
|
||||
ev + baseVert);
|
||||
rp.first.second->weightVertex(os, *rp.second.second, se.first);
|
||||
++nextVert;
|
||||
++addedVerts;
|
||||
|
||||
@@ -3,6 +3,7 @@
|
||||
#include "DNAMP1.hpp"
|
||||
#include "PAK.hpp"
|
||||
#include "AGSC.hpp"
|
||||
#include "DataSpec/AssetNameMap.hpp"
|
||||
|
||||
namespace DataSpec::DNAMP1 {
|
||||
|
||||
@@ -31,6 +32,7 @@ void PAK::Enumerate<BigDNA::Read>(typename Read::StreamT& reader) {
|
||||
for (atUint32 e = 0; e < count; ++e) {
|
||||
entries.emplace_back();
|
||||
entries.back().read(reader);
|
||||
const auto& ent = entries.back();
|
||||
}
|
||||
for (atUint32 e = 0; e < count; ++e) {
|
||||
Entry& entry = entries[e];
|
||||
@@ -176,6 +178,11 @@ std::string PAK::bestEntryName(const nod::Node& pakNode, const Entry& entry, std
|
||||
}
|
||||
}
|
||||
|
||||
/* Prefer asset name map second */
|
||||
if (const auto* name = AssetNameMap::TranslateIdToName(entry.id)) {
|
||||
return fmt::format(FMT_STRING("{}_{}"), *name, entry.id);
|
||||
}
|
||||
|
||||
/* Otherwise return ID format string */
|
||||
return fmt::format(FMT_STRING("{}_{}"), entry.type, entry.id);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user