diff options
| author | 2019-07-01 22:27:24 -0500 | |
|---|---|---|
| committer | 2019-07-01 22:27:24 -0500 | |
| commit | 6be79bab37a3ed8d9d1c194e85a112fff02d9150 (patch) | |
| tree | 3590623336f83ebc96878703e4e52f34a05d6a58 /src | |
| parent | Merge pull request #2583 from FernandoS27/core-timing-safe (diff) | |
| parent | file_sys: Rename other ContentRecordType members (diff) | |
| download | yuzu-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')
| -rw-r--r-- | src/core/file_sys/nca_metadata.h | 6 | ||||
| -rw-r--r-- | src/core/file_sys/registered_cache.cpp | 9 | ||||
| -rw-r--r-- | src/core/file_sys/submission_package.cpp | 11 | ||||
| -rw-r--r-- | src/core/hle/service/am/applets/web_browser.cpp | 4 | ||||
| -rw-r--r-- | src/core/loader/nsp.cpp | 3 | ||||
| -rw-r--r-- | src/core/loader/xci.cpp | 2 |
6 files changed, 21 insertions, 14 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 | ||
| 43 | struct ContentRecord { | 43 | struct 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 | ||
diff --git a/src/core/hle/service/am/applets/web_browser.cpp b/src/core/hle/service/am/applets/web_browser.cpp index 2762e0653..f3c9fef0e 100644 --- a/src/core/hle/service/am/applets/web_browser.cpp +++ b/src/core/hle/service/am/applets/web_browser.cpp | |||
| @@ -459,10 +459,10 @@ void WebBrowser::InitializeOffline() { | |||
| 459 | case OfflineWebSource::OfflineHtmlPage: | 459 | case OfflineWebSource::OfflineHtmlPage: |
| 460 | // While there is an AppID TLV field, in official SW this is always ignored. | 460 | // While there is an AppID TLV field, in official SW this is always ignored. |
| 461 | title_id = 0; | 461 | title_id = 0; |
| 462 | type = FileSys::ContentRecordType::Manual; | 462 | type = FileSys::ContentRecordType::HtmlDocument; |
| 463 | break; | 463 | break; |
| 464 | case OfflineWebSource::ApplicationLegalInformation: | 464 | case OfflineWebSource::ApplicationLegalInformation: |
| 465 | type = FileSys::ContentRecordType::Legal; | 465 | type = FileSys::ContentRecordType::LegalInformation; |
| 466 | break; | 466 | break; |
| 467 | case OfflineWebSource::SystemDataPage: | 467 | case OfflineWebSource::SystemDataPage: |
| 468 | type = FileSys::ContentRecordType::Data; | 468 | type = FileSys::ContentRecordType::Data; |
diff --git a/src/core/loader/nsp.cpp b/src/core/loader/nsp.cpp index 3a22ec2c6..b1171ce65 100644 --- a/src/core/loader/nsp.cpp +++ b/src/core/loader/nsp.cpp | |||
| @@ -168,7 +168,8 @@ ResultStatus AppLoader_NSP::ReadControlData(FileSys::NACP& nacp) { | |||
| 168 | } | 168 | } |
| 169 | 169 | ||
| 170 | ResultStatus AppLoader_NSP::ReadManualRomFS(FileSys::VirtualFile& file) { | 170 | ResultStatus AppLoader_NSP::ReadManualRomFS(FileSys::VirtualFile& file) { |
| 171 | const auto nca = nsp->GetNCA(nsp->GetProgramTitleID(), FileSys::ContentRecordType::Manual); | 171 | const auto nca = |
| 172 | nsp->GetNCA(nsp->GetProgramTitleID(), FileSys::ContentRecordType::HtmlDocument); | ||
| 172 | if (nsp->GetStatus() != ResultStatus::Success || nca == nullptr) | 173 | if (nsp->GetStatus() != ResultStatus::Success || nca == nullptr) |
| 173 | return ResultStatus::ErrorNoRomFS; | 174 | return ResultStatus::ErrorNoRomFS; |
| 174 | file = nca->GetRomFS(); | 175 | file = nca->GetRomFS(); |
diff --git a/src/core/loader/xci.cpp b/src/core/loader/xci.cpp index a5c4d3688..5e8553db9 100644 --- a/src/core/loader/xci.cpp +++ b/src/core/loader/xci.cpp | |||
| @@ -134,7 +134,7 @@ ResultStatus AppLoader_XCI::ReadControlData(FileSys::NACP& control) { | |||
| 134 | 134 | ||
| 135 | ResultStatus AppLoader_XCI::ReadManualRomFS(FileSys::VirtualFile& file) { | 135 | ResultStatus AppLoader_XCI::ReadManualRomFS(FileSys::VirtualFile& file) { |
| 136 | const auto nca = xci->GetSecurePartitionNSP()->GetNCA(xci->GetProgramTitleID(), | 136 | const auto nca = xci->GetSecurePartitionNSP()->GetNCA(xci->GetProgramTitleID(), |
| 137 | FileSys::ContentRecordType::Manual); | 137 | FileSys::ContentRecordType::HtmlDocument); |
| 138 | if (xci->GetStatus() != ResultStatus::Success || nca == nullptr) | 138 | if (xci->GetStatus() != ResultStatus::Success || nca == nullptr) |
| 139 | return ResultStatus::ErrorXCIMissingPartition; | 139 | return ResultStatus::ErrorXCIMissingPartition; |
| 140 | file = nca->GetRomFS(); | 140 | file = nca->GetRomFS(); |