mirror of
https://github.com/AxioDL/metaforce.git
synced 2025-12-10 04:27:42 +00:00
Fixes for MP3
This commit is contained in:
@@ -14,16 +14,14 @@ MREA::StreamReader::StreamReader(athena::io::IStreamReader& source, atUint32 blk
|
||||
m_blkCount = blkCount;
|
||||
m_blockInfos.reserve(blkCount);
|
||||
for (atUint32 i = 0; i < blkCount; ++i) {
|
||||
m_blockInfos.emplace_back();
|
||||
BlockInfo& info = m_blockInfos.back();
|
||||
BlockInfo& info = m_blockInfos.emplace_back();
|
||||
info.read(source);
|
||||
m_totalDecompLen += info.decompSize;
|
||||
}
|
||||
source.seekAlign32();
|
||||
m_secIdxs.reserve(secIdxCount);
|
||||
for (atUint32 i = 0; i < secIdxCount; ++i) {
|
||||
m_secIdxs.emplace_back();
|
||||
std::pair<DNAFourCC, atUint32>& idx = m_secIdxs.back();
|
||||
std::pair<DNAFourCC, atUint32>& idx = m_secIdxs.emplace_back();
|
||||
idx.first.read(source);
|
||||
idx.second = source.readUint32Big();
|
||||
}
|
||||
@@ -39,6 +37,15 @@ void MREA::StreamReader::writeSecIdxs(athena::io::IStreamWriter& writer) const {
|
||||
}
|
||||
}
|
||||
|
||||
bool MREA::StreamReader::seekToSection(FourCC sec, const std::vector<atUint32>& secSizes) {
|
||||
auto search = std::find_if(m_secIdxs.begin(), m_secIdxs.end(), [sec](const auto& s) { return s.first == sec; });
|
||||
if (search != m_secIdxs.end()) {
|
||||
DNAMP2::MREA::StreamReader::seekToSection(search->second, secSizes);
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
void MREA::ReadBabeDeadToBlender_3(hecl::blender::PyOutStream& os, athena::io::IStreamReader& rs) {
|
||||
atUint32 bdMagic = rs.readUint32Big();
|
||||
if (bdMagic != 0xBABEDEAD)
|
||||
@@ -254,5 +261,20 @@ bool MREA::ExtractLayerDeps(PAKEntryReadStream& rs, PAKBridge::Level::Area& area
|
||||
return false;
|
||||
}
|
||||
|
||||
UniqueID64 MREA::GetPATHId(PAKEntryReadStream& rs) {
|
||||
/* Do extract */
|
||||
Header head;
|
||||
head.read(rs);
|
||||
rs.seekAlign32();
|
||||
|
||||
/* MREA decompression stream */
|
||||
StreamReader drs(rs, head.compressedBlockCount, head.secIndexCount);
|
||||
|
||||
/* Skip to PATH */
|
||||
if (drs.seekToSection(FOURCC('PFL2'), head.secSizes))
|
||||
return {drs};
|
||||
return {};
|
||||
}
|
||||
|
||||
} // namespace DNAMP3
|
||||
} // namespace DataSpec
|
||||
|
||||
Reference in New Issue
Block a user