2
0
mirror of https://github.com/AxioDL/metaforce.git synced 2025-12-16 01:37:03 +00:00

MP3 DEPS support

This commit is contained in:
Jack Andersen
2015-09-22 20:35:07 -10:00
parent 7f5eebdaeb
commit b1f55c2733
8 changed files with 332 additions and 29 deletions

View File

@@ -315,5 +315,40 @@ bool MREA::Extract(const SpecBase& dataSpec,
return conn.saveBlend();
}
bool MREA::ExtractLayerDeps(PAKEntryReadStream& rs, PAKBridge::Area& areaOut)
{
/* Do extract */
Header head;
head.read(rs);
rs.seekAlign32();
/* MREA decompression stream */
StreamReader drs(rs, head.compressedBlockCount, head.secIndexCount);
for (const std::pair<DNAFourCC, atUint32>& idx : drs.m_secIdxs)
{
if (idx.first == FOURCC('DEPS'))
{
drs.seek(head.getSecOffset(idx.second), Athena::Begin);
DEPS deps;
deps.read(drs);
unsigned r=0;
for (unsigned l=1 ; l<deps.depLayerCount ; ++l)
{
PAKBridge::Area::Layer& layer = areaOut.layers.at(l-1);
layer.resources.reserve(deps.depLayers[l] - r);
for (; r<deps.depLayers[l] ; ++r)
layer.resources.emplace(deps.deps[r].id);
}
areaOut.resources.reserve(deps.depCount - r);
for (; r<deps.depCount ; ++r)
areaOut.resources.emplace(deps.deps[r].id);
return true;
}
}
return false;
}
}
}