From 583ae0fbf32b99fa97c879d2cfc598bf494e3c0e 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/libstratosphere/source/fssystem/fssystem_hierarchical_integrity_verification_storage.cpp b/libstratosphere/source/fssystem/fssystem_hierarchical_integrity_verification_storage.cpp index a9c5533f..3a96d547 100644 --- a/libstratosphere/source/fssystem/fssystem_hierarchical_integrity_verification_storage.cpp +++ b/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));