diff --git a/src/NcaProcess.cpp b/src/NcaProcess.cpp index 0c897a2..a45ff83 100644 --- a/src/NcaProcess.cpp +++ b/src/NcaProcess.cpp @@ -239,6 +239,21 @@ void nstool::NcaProcess::generatePartitionConfiguration() throw tc::Exception(mModuleName, fmt::format("NCA FS Header [{:d}] Version({:d}): UNSUPPORTED", partition.header_index, fs_header.version.unwrap())); } + // detect sparse + if (fs_header.sparse_info.generation.unwrap() != 0) + { + fmt::print("[IsSparse]\n"); + fmt::print(" bucket:\n"); + fmt::print(" offset: 0x{:x}\n", fs_header.sparse_info.bucket.offset.unwrap()); + fmt::print(" size: 0x{:x}\n", fs_header.sparse_info.bucket.offset.unwrap()); + fmt::print(" header:\n"); + fmt::print(" st_magic: {:s}\n", ((tc::bn::string<4>*)&fs_header.sparse_info.bucket.header.st_magic)->str()); + fmt::print(" version: 0x{:x}\n", fs_header.sparse_info.bucket.header.version.unwrap()); + fmt::print(" entry_count: {:d}\n", fs_header.sparse_info.bucket.header.entry_count.unwrap()); + fmt::print(" physical_offset: 0x{:x}\n", fs_header.sparse_info.physical_offset.unwrap()); + fmt::print(" generation: 0x{:x}\n", fs_header.sparse_info.generation.unwrap()); + } + // setup AES-CTR nn::hac::ContentArchiveUtil::getNcaPartitionAesCtr(&fs_header, info.aes_ctr.data()); diff --git a/src/NcaProcess.h b/src/NcaProcess.h index fe3303e..535a0d8 100644 --- a/src/NcaProcess.h +++ b/src/NcaProcess.h @@ -84,7 +84,12 @@ private: tc::Optional aes_ctr; } mContentKey; - + + struct SparseInfo + { + + }; + // raw partition data struct sPartitionInfo { @@ -106,6 +111,9 @@ private: // crypto metadata nn::hac::detail::aes_iv_t aes_ctr; + + // sparse metadata + SparseInfo sparse_info; }; std::array mPartitions;