2
0
mirror of https://github.com/AxioDL/metaforce.git synced 2025-12-09 00:27:42 +00:00

Various space-saving cook optimizations and fixes

This commit is contained in:
Jack Andersen
2018-05-05 10:56:42 -10:00
parent 54d2759ace
commit 70657efa82
12 changed files with 259 additions and 105 deletions

View File

@@ -90,8 +90,10 @@ struct OriginalIDs
std::unordered_set<UniqueID32> addedIDs;
std::vector<UniqueID32> originalIDs;
pakRouter.enumerateResources([&](const DNAMP1::PAK::Entry* ent) -> bool {
if (ent->type == FOURCC('MLVL') || ent->type == FOURCC('SCAN') ||
pakRouter.enumerateResources([&](const DNAMP1::PAK::Entry* ent) {
if (ent->type == FOURCC('MLVL') ||
ent->type == FOURCC('SCAN') ||
ent->type == FOURCC('MREA') ||
IndividualOrigIDs.find(ent->id.toUint32()) != IndividualOrigIDs.end())
{
if (addedIDs.find(ent->id) == addedIDs.cend())
@@ -1281,6 +1283,14 @@ struct SpecMP1 : SpecBase
std::unordered_set<urde::CAssetId> addedTags;
for (auto& area : mlvl.areas)
{
FILE* fp = nullptr;
if (addedTags.empty())
{
char path[256];
snprintf(path, 256, "/Users/jacko/Desktop/res/new_%08X.txt", nameEnt.id.toUint32());
fp = fopen(path, "w");
}
urde::SObjectTag areaTag(FOURCC('MREA'), originalToNew(area.areaMREAId));
bool dupeRes = false;
@@ -1328,6 +1338,23 @@ struct SpecMP1 : SpecBase
area.deps = std::move(strippedDeps);
area.depLayerCount = strippedDepLayers.size();
area.depLayers = std::move(strippedDepLayers);
if (fp)
{
//std::unordered_set<urde::CAssetId> tmpAddedTags;
for (const auto& dep : area.deps)
{
urde::CAssetId newId = originalToNew(dep.id);
//if (tmpAddedTags.find(newId) == tmpAddedTags.end())
//{
urde::SObjectTag tag(dep.type, originalToNew(dep.id));
hecl::ProjectPath depPath = pathFromTag(tag);
fprintf(fp, "%s\n", depPath.getRelativePathUTF8().data());
//tmpAddedTags.insert(newId);
//}
}
fclose(fp);
}
}
urde::SObjectTag nameTag(FOURCC('STRG'), originalToNew(mlvl.worldNameId));