2
0
mirror of https://github.com/AxioDL/metaforce.git synced 2025-12-10 01:47:43 +00:00

Code cleanup and add NamedResourceCatalog

This commit is contained in:
2016-02-20 00:31:11 -08:00
parent 5229f95fb7
commit 8af98fb2f3
5 changed files with 154 additions and 14 deletions

View File

@@ -2,6 +2,7 @@
#define __DNACOMMON_PAK_HPP__
#include "DNACommon.hpp"
#include "NamedResourceCatalog.hpp"
namespace DataSpec
{
@@ -240,6 +241,7 @@ public:
using EntryType = typename PAKType::Entry;
using RigPair = std::pair<IDType, IDType>;
private:
NamedResourceCatalog<IDType> m_catalog;
const SpecBase& m_dataSpec;
const std::vector<BRIDGETYPE>* m_bridges = nullptr;
std::vector<std::pair<HECL::ProjectPath,HECL::ProjectPath>> m_bridgePaths;
@@ -309,9 +311,21 @@ public:
/* Add RigPairs to global map */
bridge.addCMDLRigPairs(*this, m_cmdlRigs);
/* Add named resources to catalog */
for (const auto& namedEntry : pak.m_nameEntries)
m_catalog.addNamedResource(namedEntry.name, namedEntry.id, namedEntry.type);
progress(++count / bridgesSz);
++bridgeIdx;
}
HECL::SystemString catalogPath = m_gameCooked.getAbsolutePath() + _S("/catalog.yaml");
FILE* catalog = HECL::Fopen(catalogPath.c_str(), _S("wb"));
if (catalog)
{
m_catalog.toYAMLFile(catalog);
fclose(catalog);
}
}
void enterPAKBridge(const BRIDGETYPE& pakBridge)