submission_package: Invert conditionals within NSP's constructor to reduce nesting
We can use early continues here to reduce the amount of nesting.
This commit is contained in:
parent
bc679c9b8c
commit
0d83f8f255
|
@ -45,7 +45,10 @@ NSP::NSP(VirtualFile file_)
|
||||||
|
|
||||||
Core::Crypto::KeyManager keys;
|
Core::Crypto::KeyManager keys;
|
||||||
for (const auto& ticket_file : files) {
|
for (const auto& ticket_file : files) {
|
||||||
if (ticket_file->GetExtension() == "tik") {
|
if (ticket_file->GetExtension() != "tik") {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
if (ticket_file == nullptr ||
|
if (ticket_file == nullptr ||
|
||||||
ticket_file->GetSize() <
|
ticket_file->GetSize() <
|
||||||
Core::Crypto::TICKET_FILE_TITLEKEY_OFFSET + sizeof(Core::Crypto::Key128)) {
|
Core::Crypto::TICKET_FILE_TITLEKEY_OFFSET + sizeof(Core::Crypto::Key128)) {
|
||||||
|
@ -61,10 +64,12 @@ NSP::NSP(VirtualFile file_)
|
||||||
std::memcpy(rights_id.data(), rights_id_raw.data(), sizeof(u128));
|
std::memcpy(rights_id.data(), rights_id_raw.data(), sizeof(u128));
|
||||||
keys.SetKey(Core::Crypto::S128KeyType::Titlekey, key, rights_id[1], rights_id[0]);
|
keys.SetKey(Core::Crypto::S128KeyType::Titlekey, key, rights_id[1], rights_id[0]);
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
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") {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
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();
|
program_status[nca->GetTitleId()] = nca->GetStatus();
|
||||||
|
@ -103,7 +108,6 @@ NSP::NSP(VirtualFile file_)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
NSP::~NSP() = default;
|
NSP::~NSP() = default;
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue