From 306a24aad77b9e359b858676a9549cb70f35bf22 Mon Sep 17 00:00:00 2001 From: Bakugo Date: Mon, 1 Jul 2019 06:32:13 +0100 Subject: file_sys: Rename ContentRecordType::Patch to DeltaFragment Avoids potential confusion, since patches and DeltaFragments are not the same thing. Actual full patches are listed under the Program type. --- src/core/file_sys/nca_metadata.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/core/file_sys') diff --git a/src/core/file_sys/nca_metadata.h b/src/core/file_sys/nca_metadata.h index 84d5cd1e0..53ea3709b 100644 --- a/src/core/file_sys/nca_metadata.h +++ b/src/core/file_sys/nca_metadata.h @@ -37,7 +37,7 @@ enum class ContentRecordType : u8 { Control = 3, Manual = 4, Legal = 5, - Patch = 6, + DeltaFragment = 6, }; struct ContentRecord { -- cgit v1.2.3 From 79163fca80385b11c72dab286041c16e59cd1dd8 Mon Sep 17 00:00:00 2001 From: Bakugo Date: Mon, 1 Jul 2019 06:37:22 +0100 Subject: file_sys/registered_cache: Ignore DeltaFragment NCAs during installation DeltaFragments are only used to download and apply partial patches on a real console, and are not useful to us at all. Most patch NSPs do not include them, and when they do, it's a waste of space to install them. --- src/core/file_sys/registered_cache.cpp | 3 +++ 1 file changed, 3 insertions(+) (limited to 'src/core/file_sys') diff --git a/src/core/file_sys/registered_cache.cpp b/src/core/file_sys/registered_cache.cpp index 4608490e0..46f9314d0 100644 --- a/src/core/file_sys/registered_cache.cpp +++ b/src/core/file_sys/registered_cache.cpp @@ -415,6 +415,9 @@ InstallResult RegisteredCache::InstallEntry(const NSP& nsp, bool overwrite_if_ex const auto cnmt_file = section0->GetFiles()[0]; const CNMT cnmt(cnmt_file); for (const auto& record : cnmt.GetContentRecords()) { + // Ignore DeltaFragments, they are not useful to us + if (record.type == ContentRecordType::DeltaFragment) + continue; const auto nca = GetNCAFromNSPForID(nsp, record.nca_id); if (nca == nullptr) return InstallResult::ErrorCopyFailed; -- cgit v1.2.3 From 9968c0883af49a760c6f5c1b63fef9493d32008a Mon Sep 17 00:00:00 2001 From: Bakugo Date: Mon, 1 Jul 2019 06:46:05 +0100 Subject: file_sys/submission_package: Don't warn about missing DeltaFragment NCAs DeltaFragments are not useful to us and are often not included in patch NSPs. --- src/core/file_sys/submission_package.cpp | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) (limited to 'src/core/file_sys') diff --git a/src/core/file_sys/submission_package.cpp b/src/core/file_sys/submission_package.cpp index d0428a457..8b3b14e25 100644 --- a/src/core/file_sys/submission_package.cpp +++ b/src/core/file_sys/submission_package.cpp @@ -248,10 +248,13 @@ void NSP::ReadNCAs(const std::vector& files) { auto next_file = pfs->GetFile(fmt::format("{}.nca", id_string)); if (next_file == nullptr) { - LOG_WARNING(Service_FS, - "NCA with ID {}.nca is listed in content metadata, but cannot " - "be found in PFS. NSP appears to be corrupted.", - id_string); + if (rec.type != ContentRecordType::DeltaFragment) { + LOG_WARNING(Service_FS, + "NCA with ID {}.nca is listed in content metadata, but cannot " + "be found in PFS. NSP appears to be corrupted.", + id_string); + } + continue; } -- cgit v1.2.3 From c72ef5f405bd7fc3c7980590457a9368671d553d Mon Sep 17 00:00:00 2001 From: Bakugo Date: Mon, 1 Jul 2019 07:31:32 +0100 Subject: file_sys/registered_cache: Improve missing metadata error This can happen when installing NSPs too, not just XCIs. --- src/core/file_sys/registered_cache.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'src/core/file_sys') diff --git a/src/core/file_sys/registered_cache.cpp b/src/core/file_sys/registered_cache.cpp index 46f9314d0..dfde04dd6 100644 --- a/src/core/file_sys/registered_cache.cpp +++ b/src/core/file_sys/registered_cache.cpp @@ -397,8 +397,8 @@ InstallResult RegisteredCache::InstallEntry(const NSP& nsp, bool overwrite_if_ex }); if (meta_iter == ncas.end()) { - LOG_ERROR(Loader, "The XCI you are attempting to install does not have a metadata NCA and " - "is therefore malformed. Double check your encryption keys."); + LOG_ERROR(Loader, "The file you are attempting to install does not have a metadata NCA and " + "is therefore malformed. Check your encryption keys."); return InstallResult::ErrorMetaFailed; } -- cgit v1.2.3 From b50557d1f02d2784dbda733b4cf21c769d1cae4d Mon Sep 17 00:00:00 2001 From: Bakugo Date: Tue, 2 Jul 2019 00:57:23 +0100 Subject: file_sys: Rename other ContentRecordType members --- src/core/file_sys/nca_metadata.h | 4 ++-- src/core/file_sys/registered_cache.cpp | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) (limited to 'src/core/file_sys') diff --git a/src/core/file_sys/nca_metadata.h b/src/core/file_sys/nca_metadata.h index 53ea3709b..1f82fff0a 100644 --- a/src/core/file_sys/nca_metadata.h +++ b/src/core/file_sys/nca_metadata.h @@ -35,8 +35,8 @@ enum class ContentRecordType : u8 { Program = 1, Data = 2, Control = 3, - Manual = 4, - Legal = 5, + HtmlDocument = 4, + LegalInformation = 5, DeltaFragment = 6, }; diff --git a/src/core/file_sys/registered_cache.cpp b/src/core/file_sys/registered_cache.cpp index dfde04dd6..3725b10f7 100644 --- a/src/core/file_sys/registered_cache.cpp +++ b/src/core/file_sys/registered_cache.cpp @@ -99,7 +99,7 @@ ContentRecordType GetCRTypeFromNCAType(NCAContentType type) { return ContentRecordType::Data; case NCAContentType::Manual: // TODO(DarkLordZach): Peek at NCA contents to differentiate Manual and Legal. - return ContentRecordType::Manual; + return ContentRecordType::HtmlDocument; default: UNREACHABLE_MSG("Invalid NCAContentType={:02X}", static_cast(type)); } -- cgit v1.2.3