diff --git a/src/core/file_sys/content_archive.cpp b/src/core/file_sys/content_archive.cpp index 50303fe42c..e334d0da7a 100644 --- a/src/core/file_sys/content_archive.cpp +++ b/src/core/file_sys/content_archive.cpp @@ -57,11 +57,21 @@ struct NCASectionHeaderBlock { }; static_assert(sizeof(NCASectionHeaderBlock) == 0x8, "NCASectionHeaderBlock has incorrect size."); +struct NCACompressionInfo { + u64 table_offset; + u64 table_size; + std::array table_header; + INSERT_PADDING_BYTES_NOINIT(0x8); +}; +static_assert(sizeof(NCACompressionInfo) == 0x28, "NCACompressionInfo has incorrect size."); + struct NCASectionRaw { NCASectionHeaderBlock header; std::array block_data; std::array section_ctr; - INSERT_PADDING_BYTES_NOINIT(0xB8); + INSERT_PADDING_BYTES_NOINIT(0x30); + NCACompressionInfo compression; + INSERT_PADDING_BYTES_NOINIT(0x60); }; static_assert(sizeof(NCASectionRaw) == 0x200, "NCASectionRaw has incorrect size."); @@ -225,6 +235,12 @@ bool NCA::ReadSections(const std::vector& sections, u64 bktr_b for (std::size_t i = 0; i < sections.size(); ++i) { const auto& section = sections[i]; + if (section.raw.compression.table_offset != 0 && section.raw.compression.table_size != 0) { + LOG_ERROR(Loader, "Compressed NCAs are not supported."); + status = Loader::ResultStatus::ErrorCompressedNCA; + return false; + } + if (section.raw.header.filesystem_type == NCASectionFilesystemType::ROMFS) { if (!ReadRomFSSection(section, header.section_tables[i], bktr_base_ivfc_offset)) { return false; diff --git a/src/core/loader/loader.h b/src/core/loader/loader.h index 7b43f70ed9..df106b5dc0 100644 --- a/src/core/loader/loader.h +++ b/src/core/loader/loader.h @@ -79,6 +79,7 @@ enum class ResultStatus : u16 { ErrorBadPFSHeader, ErrorIncorrectPFSFileSize, ErrorBadNCAHeader, + ErrorCompressedNCA, ErrorMissingProductionKeyFile, ErrorMissingHeaderKey, ErrorIncorrectHeaderKey,