fssystem: fix support for parsing newer-format BKTR NCAs

Apparently, at some point they started allowing maxlayers=3, which caused this code to not work.

Looking at latest FS, they always reference DataStorage instead of level+2 for the final level.

This fixes parsing update romfs for newer games, e.g. Super Mario Galaxy 2.
This commit is contained in:
Michael Scire 2025-10-07 17:30:12 -07:00
parent efd3d931a4
commit 583ae0fbf3

View File

@ -220,7 +220,7 @@ namespace ams::fssystem {
/* Initialize the verification storage. */
fs::SubStorage buffer_storage(std::addressof(m_buffer_storages[level]), 0, info.info[level].size);
m_verify_storages[level + 1].Initialize(buffer_storage, storage[level + 2], static_cast<s64>(1) << info.info[level + 1].block_order, static_cast<s64>(1) << info.info[level].block_order, m_buffers->buffers[m_max_layers - 2], hgf, hash_salt, true, is_writable, allow_cleared_blocks);
m_verify_storages[level + 1].Initialize(buffer_storage, storage[HierarchicalStorageInformation::DataStorage], static_cast<s64>(1) << info.info[level + 1].block_order, static_cast<s64>(1) << info.info[level].block_order, m_buffers->buffers[m_max_layers - 2], hgf, hash_salt, true, is_writable, allow_cleared_blocks);
/* Initialize the buffer storage. */
R_TRY(m_buffer_storages[level + 1].Initialize(m_buffers->buffers[level + 1], m_mutex, std::addressof(m_verify_storages[level + 1]), info.info[level + 1].size, static_cast<s64>(1) << info.info[level + 1].block_order, max_data_cache_entries, true, buffer_level, true, is_writable));