diff options
Diffstat (limited to 'src')
| -rw-r--r-- | src/core/file_sys/content_archive.cpp | 39 | ||||
| -rw-r--r-- | src/core/loader/loader.h | 2 |
2 files changed, 40 insertions, 1 deletions
diff --git a/src/core/file_sys/content_archive.cpp b/src/core/file_sys/content_archive.cpp index 50303fe42..06efab46d 100644 --- a/src/core/file_sys/content_archive.cpp +++ b/src/core/file_sys/content_archive.cpp | |||
| @@ -57,11 +57,34 @@ struct NCASectionHeaderBlock { | |||
| 57 | }; | 57 | }; |
| 58 | static_assert(sizeof(NCASectionHeaderBlock) == 0x8, "NCASectionHeaderBlock has incorrect size."); | 58 | static_assert(sizeof(NCASectionHeaderBlock) == 0x8, "NCASectionHeaderBlock has incorrect size."); |
| 59 | 59 | ||
| 60 | struct NCABucketInfo { | ||
| 61 | u64 table_offset; | ||
| 62 | u64 table_size; | ||
| 63 | std::array<u8, 0x10> table_header; | ||
| 64 | }; | ||
| 65 | static_assert(sizeof(NCABucketInfo) == 0x20, "NCABucketInfo has incorrect size."); | ||
| 66 | |||
| 67 | struct NCASparseInfo { | ||
| 68 | NCABucketInfo bucket; | ||
| 69 | u64 physical_offset; | ||
| 70 | u16 generation; | ||
| 71 | INSERT_PADDING_BYTES_NOINIT(0x6); | ||
| 72 | }; | ||
| 73 | static_assert(sizeof(NCASparseInfo) == 0x30, "NCASparseInfo has incorrect size."); | ||
| 74 | |||
| 75 | struct NCACompressionInfo { | ||
| 76 | NCABucketInfo bucket; | ||
| 77 | INSERT_PADDING_BYTES_NOINIT(0x8); | ||
| 78 | }; | ||
| 79 | static_assert(sizeof(NCACompressionInfo) == 0x28, "NCACompressionInfo has incorrect size."); | ||
| 80 | |||
| 60 | struct NCASectionRaw { | 81 | struct NCASectionRaw { |
| 61 | NCASectionHeaderBlock header; | 82 | NCASectionHeaderBlock header; |
| 62 | std::array<u8, 0x138> block_data; | 83 | std::array<u8, 0x138> block_data; |
| 63 | std::array<u8, 0x8> section_ctr; | 84 | std::array<u8, 0x8> section_ctr; |
| 64 | INSERT_PADDING_BYTES_NOINIT(0xB8); | 85 | NCASparseInfo sparse_info; |
| 86 | NCACompressionInfo compression_info; | ||
| 87 | INSERT_PADDING_BYTES_NOINIT(0x60); | ||
| 65 | }; | 88 | }; |
| 66 | static_assert(sizeof(NCASectionRaw) == 0x200, "NCASectionRaw has incorrect size."); | 89 | static_assert(sizeof(NCASectionRaw) == 0x200, "NCASectionRaw has incorrect size."); |
| 67 | 90 | ||
| @@ -225,6 +248,20 @@ bool NCA::ReadSections(const std::vector<NCASectionHeader>& sections, u64 bktr_b | |||
| 225 | for (std::size_t i = 0; i < sections.size(); ++i) { | 248 | for (std::size_t i = 0; i < sections.size(); ++i) { |
| 226 | const auto& section = sections[i]; | 249 | const auto& section = sections[i]; |
| 227 | 250 | ||
| 251 | if (section.raw.sparse_info.bucket.table_offset != 0 && | ||
| 252 | section.raw.sparse_info.bucket.table_size != 0) { | ||
| 253 | LOG_ERROR(Loader, "Sparse NCAs are not supported."); | ||
| 254 | status = Loader::ResultStatus::ErrorSparseNCA; | ||
| 255 | return false; | ||
| 256 | } | ||
| 257 | |||
| 258 | if (section.raw.compression_info.bucket.table_offset != 0 && | ||
| 259 | section.raw.compression_info.bucket.table_size != 0) { | ||
| 260 | LOG_ERROR(Loader, "Compressed NCAs are not supported."); | ||
| 261 | status = Loader::ResultStatus::ErrorCompressedNCA; | ||
| 262 | return false; | ||
| 263 | } | ||
| 264 | |||
| 228 | if (section.raw.header.filesystem_type == NCASectionFilesystemType::ROMFS) { | 265 | if (section.raw.header.filesystem_type == NCASectionFilesystemType::ROMFS) { |
| 229 | if (!ReadRomFSSection(section, header.section_tables[i], bktr_base_ivfc_offset)) { | 266 | if (!ReadRomFSSection(section, header.section_tables[i], bktr_base_ivfc_offset)) { |
| 230 | return false; | 267 | return false; |
diff --git a/src/core/loader/loader.h b/src/core/loader/loader.h index 7b43f70ed..7a2a52fd4 100644 --- a/src/core/loader/loader.h +++ b/src/core/loader/loader.h | |||
| @@ -79,6 +79,8 @@ enum class ResultStatus : u16 { | |||
| 79 | ErrorBadPFSHeader, | 79 | ErrorBadPFSHeader, |
| 80 | ErrorIncorrectPFSFileSize, | 80 | ErrorIncorrectPFSFileSize, |
| 81 | ErrorBadNCAHeader, | 81 | ErrorBadNCAHeader, |
| 82 | ErrorCompressedNCA, | ||
| 83 | ErrorSparseNCA, | ||
| 82 | ErrorMissingProductionKeyFile, | 84 | ErrorMissingProductionKeyFile, |
| 83 | ErrorMissingHeaderKey, | 85 | ErrorMissingHeaderKey, |
| 84 | ErrorIncorrectHeaderKey, | 86 | ErrorIncorrectHeaderKey, |