nsp: Fix error masking issue with XCI files
Now display correct error instead of catch-all MissingProgramNCA
This commit is contained in:
parent
c91b60a421
commit
92e26df00f
|
@ -52,11 +52,11 @@ XCI::XCI(VirtualFile file_) : file(std::move(file_)), partitions(0x4) {
|
||||||
const auto secure_ncas = secure_partition->GetNCAsCollapsed();
|
const auto secure_ncas = secure_partition->GetNCAsCollapsed();
|
||||||
std::copy(secure_ncas.begin(), secure_ncas.end(), std::back_inserter(ncas));
|
std::copy(secure_ncas.begin(), secure_ncas.end(), std::back_inserter(ncas));
|
||||||
|
|
||||||
program_nca_status = Loader::ResultStatus::ErrorXCIMissingProgramNCA;
|
|
||||||
program =
|
program =
|
||||||
secure_partition->GetNCA(secure_partition->GetProgramTitleID(), ContentRecordType::Program);
|
secure_partition->GetNCA(secure_partition->GetProgramTitleID(), ContentRecordType::Program);
|
||||||
if (program != nullptr)
|
program_nca_status = secure_partition->GetProgramStatus(secure_partition->GetProgramTitleID());
|
||||||
program_nca_status = program->GetStatus();
|
if (program_nca_status == Loader::ResultStatus::ErrorNSPMissingProgramNCA)
|
||||||
|
program_nca_status = Loader::ResultStatus::ErrorXCIMissingProgramNCA;
|
||||||
|
|
||||||
auto result = AddNCAFromPartition(XCIPartition::Update);
|
auto result = AddNCAFromPartition(XCIPartition::Update);
|
||||||
if (result != Loader::ResultStatus::Success) {
|
if (result != Loader::ResultStatus::Success) {
|
||||||
|
|
|
@ -444,6 +444,12 @@ NCA::NCA(VirtualFile file_, VirtualFile bktr_base_romfs_, u64 bktr_base_ivfc_off
|
||||||
dirs.push_back(std::move(npfs));
|
dirs.push_back(std::move(npfs));
|
||||||
if (IsDirectoryExeFS(dirs.back()))
|
if (IsDirectoryExeFS(dirs.back()))
|
||||||
exefs = dirs.back();
|
exefs = dirs.back();
|
||||||
|
} else {
|
||||||
|
if (has_rights_id)
|
||||||
|
status = Loader::ResultStatus::ErrorIncorrectTitlekeyOrTitlekek;
|
||||||
|
else
|
||||||
|
status = Loader::ResultStatus::ErrorIncorrectKeyAreaKey;
|
||||||
|
return;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
if (status != Loader::ResultStatus::Success)
|
if (status != Loader::ResultStatus::Success)
|
||||||
|
@ -491,8 +497,6 @@ NCAContentType NCA::GetType() const {
|
||||||
u64 NCA::GetTitleId() const {
|
u64 NCA::GetTitleId() const {
|
||||||
if (is_update || status == Loader::ResultStatus::ErrorMissingBKTRBaseRomFS)
|
if (is_update || status == Loader::ResultStatus::ErrorMissingBKTRBaseRomFS)
|
||||||
return header.title_id | 0x800;
|
return header.title_id | 0x800;
|
||||||
if (status != Loader::ResultStatus::Success)
|
|
||||||
return {};
|
|
||||||
return header.title_id;
|
return header.title_id;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -60,8 +60,11 @@ NSP::NSP(VirtualFile file_)
|
||||||
for (const auto& outer_file : files) {
|
for (const auto& outer_file : files) {
|
||||||
if (outer_file->GetName().substr(outer_file->GetName().size() - 9) == ".cnmt.nca") {
|
if (outer_file->GetName().substr(outer_file->GetName().size() - 9) == ".cnmt.nca") {
|
||||||
const auto nca = std::make_shared<NCA>(outer_file);
|
const auto nca = std::make_shared<NCA>(outer_file);
|
||||||
if (nca->GetStatus() != Loader::ResultStatus::Success)
|
if (nca->GetStatus() != Loader::ResultStatus::Success) {
|
||||||
|
program_status[nca->GetTitleId()] = nca->GetStatus();
|
||||||
continue;
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
const auto section0 = nca->GetSubdirectories()[0];
|
const auto section0 = nca->GetSubdirectories()[0];
|
||||||
|
|
||||||
for (const auto& inner_file : section0->GetFiles()) {
|
for (const auto& inner_file : section0->GetFiles()) {
|
||||||
|
|
Loading…
Reference in New Issue