From 652519da2eb7ccb2a113aa5883e4e405e00e2b1c Mon Sep 17 00:00:00 2001 From: Michael Scire Date: Tue, 7 Oct 2025 17:30:12 -0700 Subject: [PATCH] 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. --- .../fssystem_hierarchical_integrity_verification_storage.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libraries/libstratosphere/source/fssystem/fssystem_hierarchical_integrity_verification_storage.cpp b/libraries/libstratosphere/source/fssystem/fssystem_hierarchical_integrity_verification_storage.cpp index a9c5533f4..3a96d547b 100644 --- a/libraries/libstratosphere/source/fssystem/fssystem_hierarchical_integrity_verification_storage.cpp +++ b/libraries/libstratosphere/source/fssystem/fssystem_hierarchical_integrity_verification_storage.cpp @@ -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(1) << info.info[level + 1].block_order, static_cast(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(1) << info.info[level + 1].block_order, static_cast(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(1) << info.info[level + 1].block_order, max_data_cache_entries, true, buffer_level, true, is_writable));