Merge pull request #2660 from bakugo/deltafragments
file_sys: Ignore DeltaFragment NCAs during installation
This commit is contained in:
commit
6be79bab37
@ -35,9 +35,9 @@ enum class ContentRecordType : u8 {
|
|||||||
Program = 1,
|
Program = 1,
|
||||||
Data = 2,
|
Data = 2,
|
||||||
Control = 3,
|
Control = 3,
|
||||||
Manual = 4,
|
HtmlDocument = 4,
|
||||||
Legal = 5,
|
LegalInformation = 5,
|
||||||
Patch = 6,
|
DeltaFragment = 6,
|
||||||
};
|
};
|
||||||
|
|
||||||
struct ContentRecord {
|
struct ContentRecord {
|
||||||
|
@ -99,7 +99,7 @@ ContentRecordType GetCRTypeFromNCAType(NCAContentType type) {
|
|||||||
return ContentRecordType::Data;
|
return ContentRecordType::Data;
|
||||||
case NCAContentType::Manual:
|
case NCAContentType::Manual:
|
||||||
// TODO(DarkLordZach): Peek at NCA contents to differentiate Manual and Legal.
|
// TODO(DarkLordZach): Peek at NCA contents to differentiate Manual and Legal.
|
||||||
return ContentRecordType::Manual;
|
return ContentRecordType::HtmlDocument;
|
||||||
default:
|
default:
|
||||||
UNREACHABLE_MSG("Invalid NCAContentType={:02X}", static_cast<u8>(type));
|
UNREACHABLE_MSG("Invalid NCAContentType={:02X}", static_cast<u8>(type));
|
||||||
}
|
}
|
||||||
@ -397,8 +397,8 @@ InstallResult RegisteredCache::InstallEntry(const NSP& nsp, bool overwrite_if_ex
|
|||||||
});
|
});
|
||||||
|
|
||||||
if (meta_iter == ncas.end()) {
|
if (meta_iter == ncas.end()) {
|
||||||
LOG_ERROR(Loader, "The XCI you are attempting to install does not have a metadata NCA and "
|
LOG_ERROR(Loader, "The file you are attempting to install does not have a metadata NCA and "
|
||||||
"is therefore malformed. Double check your encryption keys.");
|
"is therefore malformed. Check your encryption keys.");
|
||||||
return InstallResult::ErrorMetaFailed;
|
return InstallResult::ErrorMetaFailed;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -415,6 +415,9 @@ InstallResult RegisteredCache::InstallEntry(const NSP& nsp, bool overwrite_if_ex
|
|||||||
const auto cnmt_file = section0->GetFiles()[0];
|
const auto cnmt_file = section0->GetFiles()[0];
|
||||||
const CNMT cnmt(cnmt_file);
|
const CNMT cnmt(cnmt_file);
|
||||||
for (const auto& record : cnmt.GetContentRecords()) {
|
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);
|
const auto nca = GetNCAFromNSPForID(nsp, record.nca_id);
|
||||||
if (nca == nullptr)
|
if (nca == nullptr)
|
||||||
return InstallResult::ErrorCopyFailed;
|
return InstallResult::ErrorCopyFailed;
|
||||||
|
@ -248,10 +248,13 @@ void NSP::ReadNCAs(const std::vector<VirtualFile>& files) {
|
|||||||
auto next_file = pfs->GetFile(fmt::format("{}.nca", id_string));
|
auto next_file = pfs->GetFile(fmt::format("{}.nca", id_string));
|
||||||
|
|
||||||
if (next_file == nullptr) {
|
if (next_file == nullptr) {
|
||||||
LOG_WARNING(Service_FS,
|
if (rec.type != ContentRecordType::DeltaFragment) {
|
||||||
"NCA with ID {}.nca is listed in content metadata, but cannot "
|
LOG_WARNING(Service_FS,
|
||||||
"be found in PFS. NSP appears to be corrupted.",
|
"NCA with ID {}.nca is listed in content metadata, but cannot "
|
||||||
id_string);
|
"be found in PFS. NSP appears to be corrupted.",
|
||||||
|
id_string);
|
||||||
|
}
|
||||||
|
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -459,10 +459,10 @@ void WebBrowser::InitializeOffline() {
|
|||||||
case OfflineWebSource::OfflineHtmlPage:
|
case OfflineWebSource::OfflineHtmlPage:
|
||||||
// While there is an AppID TLV field, in official SW this is always ignored.
|
// While there is an AppID TLV field, in official SW this is always ignored.
|
||||||
title_id = 0;
|
title_id = 0;
|
||||||
type = FileSys::ContentRecordType::Manual;
|
type = FileSys::ContentRecordType::HtmlDocument;
|
||||||
break;
|
break;
|
||||||
case OfflineWebSource::ApplicationLegalInformation:
|
case OfflineWebSource::ApplicationLegalInformation:
|
||||||
type = FileSys::ContentRecordType::Legal;
|
type = FileSys::ContentRecordType::LegalInformation;
|
||||||
break;
|
break;
|
||||||
case OfflineWebSource::SystemDataPage:
|
case OfflineWebSource::SystemDataPage:
|
||||||
type = FileSys::ContentRecordType::Data;
|
type = FileSys::ContentRecordType::Data;
|
||||||
|
@ -168,7 +168,8 @@ ResultStatus AppLoader_NSP::ReadControlData(FileSys::NACP& nacp) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
ResultStatus AppLoader_NSP::ReadManualRomFS(FileSys::VirtualFile& file) {
|
ResultStatus AppLoader_NSP::ReadManualRomFS(FileSys::VirtualFile& file) {
|
||||||
const auto nca = nsp->GetNCA(nsp->GetProgramTitleID(), FileSys::ContentRecordType::Manual);
|
const auto nca =
|
||||||
|
nsp->GetNCA(nsp->GetProgramTitleID(), FileSys::ContentRecordType::HtmlDocument);
|
||||||
if (nsp->GetStatus() != ResultStatus::Success || nca == nullptr)
|
if (nsp->GetStatus() != ResultStatus::Success || nca == nullptr)
|
||||||
return ResultStatus::ErrorNoRomFS;
|
return ResultStatus::ErrorNoRomFS;
|
||||||
file = nca->GetRomFS();
|
file = nca->GetRomFS();
|
||||||
|
@ -134,7 +134,7 @@ ResultStatus AppLoader_XCI::ReadControlData(FileSys::NACP& control) {
|
|||||||
|
|
||||||
ResultStatus AppLoader_XCI::ReadManualRomFS(FileSys::VirtualFile& file) {
|
ResultStatus AppLoader_XCI::ReadManualRomFS(FileSys::VirtualFile& file) {
|
||||||
const auto nca = xci->GetSecurePartitionNSP()->GetNCA(xci->GetProgramTitleID(),
|
const auto nca = xci->GetSecurePartitionNSP()->GetNCA(xci->GetProgramTitleID(),
|
||||||
FileSys::ContentRecordType::Manual);
|
FileSys::ContentRecordType::HtmlDocument);
|
||||||
if (xci->GetStatus() != ResultStatus::Success || nca == nullptr)
|
if (xci->GetStatus() != ResultStatus::Success || nca == nullptr)
|
||||||
return ResultStatus::ErrorXCIMissingPartition;
|
return ResultStatus::ErrorXCIMissingPartition;
|
||||||
file = nca->GetRomFS();
|
file = nca->GetRomFS();
|
||||||
|
Loading…
Reference in New Issue
Block a user