summaryrefslogtreecommitdiff
path: root/src/core/file_sys
diff options
context:
space:
mode:
authorGravatar Zach Hilman2019-07-01 22:27:24 -0500
committerGravatar GitHub2019-07-01 22:27:24 -0500
commit6be79bab37a3ed8d9d1c194e85a112fff02d9150 (patch)
tree3590623336f83ebc96878703e4e52f34a05d6a58 /src/core/file_sys
parentMerge pull request #2583 from FernandoS27/core-timing-safe (diff)
parentfile_sys: Rename other ContentRecordType members (diff)
downloadyuzu-6be79bab37a3ed8d9d1c194e85a112fff02d9150.tar.gz
yuzu-6be79bab37a3ed8d9d1c194e85a112fff02d9150.tar.xz
yuzu-6be79bab37a3ed8d9d1c194e85a112fff02d9150.zip
Merge pull request #2660 from bakugo/deltafragments
file_sys: Ignore DeltaFragment NCAs during installation
Diffstat (limited to 'src/core/file_sys')
-rw-r--r--src/core/file_sys/nca_metadata.h6
-rw-r--r--src/core/file_sys/registered_cache.cpp9
-rw-r--r--src/core/file_sys/submission_package.cpp11
3 files changed, 16 insertions, 10 deletions
diff --git a/src/core/file_sys/nca_metadata.h b/src/core/file_sys/nca_metadata.h
index 84d5cd1e0..1f82fff0a 100644
--- a/src/core/file_sys/nca_metadata.h
+++ b/src/core/file_sys/nca_metadata.h
@@ -35,9 +35,9 @@ enum class ContentRecordType : u8 {
35 Program = 1, 35 Program = 1,
36 Data = 2, 36 Data = 2,
37 Control = 3, 37 Control = 3,
38 Manual = 4, 38 HtmlDocument = 4,
39 Legal = 5, 39 LegalInformation = 5,
40 Patch = 6, 40 DeltaFragment = 6,
41}; 41};
42 42
43struct ContentRecord { 43struct ContentRecord {
diff --git a/src/core/file_sys/registered_cache.cpp b/src/core/file_sys/registered_cache.cpp
index 4608490e0..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) {
99 return ContentRecordType::Data; 99 return ContentRecordType::Data;
100 case NCAContentType::Manual: 100 case NCAContentType::Manual:
101 // TODO(DarkLordZach): Peek at NCA contents to differentiate Manual and Legal. 101 // TODO(DarkLordZach): Peek at NCA contents to differentiate Manual and Legal.
102 return ContentRecordType::Manual; 102 return ContentRecordType::HtmlDocument;
103 default: 103 default:
104 UNREACHABLE_MSG("Invalid NCAContentType={:02X}", static_cast<u8>(type)); 104 UNREACHABLE_MSG("Invalid NCAContentType={:02X}", static_cast<u8>(type));
105 } 105 }
@@ -397,8 +397,8 @@ InstallResult RegisteredCache::InstallEntry(const NSP& nsp, bool overwrite_if_ex
397 }); 397 });
398 398
399 if (meta_iter == ncas.end()) { 399 if (meta_iter == ncas.end()) {
400 LOG_ERROR(Loader, "The XCI you are attempting to install does not have a metadata NCA and " 400 LOG_ERROR(Loader, "The file you are attempting to install does not have a metadata NCA and "
401 "is therefore malformed. Double check your encryption keys."); 401 "is therefore malformed. Check your encryption keys.");
402 return InstallResult::ErrorMetaFailed; 402 return InstallResult::ErrorMetaFailed;
403 } 403 }
404 404
@@ -415,6 +415,9 @@ InstallResult RegisteredCache::InstallEntry(const NSP& nsp, bool overwrite_if_ex
415 const auto cnmt_file = section0->GetFiles()[0]; 415 const auto cnmt_file = section0->GetFiles()[0];
416 const CNMT cnmt(cnmt_file); 416 const CNMT cnmt(cnmt_file);
417 for (const auto& record : cnmt.GetContentRecords()) { 417 for (const auto& record : cnmt.GetContentRecords()) {
418 // Ignore DeltaFragments, they are not useful to us
419 if (record.type == ContentRecordType::DeltaFragment)
420 continue;
418 const auto nca = GetNCAFromNSPForID(nsp, record.nca_id); 421 const auto nca = GetNCAFromNSPForID(nsp, record.nca_id);
419 if (nca == nullptr) 422 if (nca == nullptr)
420 return InstallResult::ErrorCopyFailed; 423 return InstallResult::ErrorCopyFailed;
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<VirtualFile>& files) {
248 auto next_file = pfs->GetFile(fmt::format("{}.nca", id_string)); 248 auto next_file = pfs->GetFile(fmt::format("{}.nca", id_string));
249 249
250 if (next_file == nullptr) { 250 if (next_file == nullptr) {
251 LOG_WARNING(Service_FS, 251 if (rec.type != ContentRecordType::DeltaFragment) {
252 "NCA with ID {}.nca is listed in content metadata, but cannot " 252 LOG_WARNING(Service_FS,
253 "be found in PFS. NSP appears to be corrupted.", 253 "NCA with ID {}.nca is listed in content metadata, but cannot "
254 id_string); 254 "be found in PFS. NSP appears to be corrupted.",
255 id_string);
256 }
257
255 continue; 258 continue;
256 } 259 }
257 260