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

Tons of save-related fixes

This commit is contained in:
Jack Andersen
2017-02-07 20:48:43 -10:00
parent 356788fb9e
commit b8613d61f8
17 changed files with 219 additions and 95 deletions

View File

@@ -83,18 +83,29 @@ CMemoryCardSys::CMemoryCardSys()
xc_memoryWorlds.reserve(16);
x1c_worldInter.emplace();
x1c_worldInter->reserve(16);
std::vector<std::pair<ResId, ResId>> orderedMLVLs;
orderedMLVLs.reserve(16);
g_ResFactory->EnumerateNamedResources([&](const std::string& name, const SObjectTag& tag) -> bool
{
if (tag.type == FOURCC('MLVL'))
{
if (!HasSaveWorldMemory(tag.id))
{
xc_memoryWorlds.emplace_back(tag.id, CSaveWorldMemory{});
x1c_worldInter->emplace_back(tag.id, -1);
}
ResId origId = g_ResFactory->TranslateNewToOriginal(tag.id);
orderedMLVLs.emplace_back(origId, tag.id);
}
return true;
});
std::sort(orderedMLVLs.begin(), orderedMLVLs.end(),
[](const auto& a, const auto& b) -> bool { return a.first < b.first; });
for (const auto& mlvl : orderedMLVLs)
{
if (!HasSaveWorldMemory(mlvl.second))
{
xc_memoryWorlds.emplace_back(mlvl.second, CSaveWorldMemory{});
x1c_worldInter->emplace_back(mlvl.second, -1);
}
}
}
bool CMemoryCardSys::InitializePump()