mirror of
https://git.suyu.dev/suyu/suyu
synced 2024-12-24 18:32:49 -06:00
nax: Avoid unnecessary calls to AsNCA() in IdentifyType()
AsNCA() allocates an NCA instance every time it's called. In the current manner it's used, it's quite inefficient as it's making a redundant allocation. We can just amend the order of the conditionals to make it easier to just call it once.
This commit is contained in:
parent
f272261c21
commit
c8c4105659
1 changed files with 8 additions and 4 deletions
|
@ -21,12 +21,16 @@ AppLoader_NAX::~AppLoader_NAX() = default;
|
||||||
FileType AppLoader_NAX::IdentifyType(const FileSys::VirtualFile& file) {
|
FileType AppLoader_NAX::IdentifyType(const FileSys::VirtualFile& file) {
|
||||||
FileSys::NAX nax(file);
|
FileSys::NAX nax(file);
|
||||||
|
|
||||||
if (nax.GetStatus() == ResultStatus::Success && nax.AsNCA() != nullptr &&
|
if (nax.GetStatus() != ResultStatus::Success) {
|
||||||
nax.AsNCA()->GetStatus() == ResultStatus::Success) {
|
return FileType::Error;
|
||||||
return FileType::NAX;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const auto nca = nax.AsNCA();
|
||||||
|
if (nca == nullptr || nca->GetStatus() != ResultStatus::Success) {
|
||||||
return FileType::Error;
|
return FileType::Error;
|
||||||
|
}
|
||||||
|
|
||||||
|
return FileType::NAX;
|
||||||
}
|
}
|
||||||
|
|
||||||
ResultStatus AppLoader_NAX::Load(Kernel::SharedPtr<Kernel::Process>& process) {
|
ResultStatus AppLoader_NAX::Load(Kernel::SharedPtr<Kernel::Process>& process) {
|
||||||
|
|
Loading…
Reference in a new issue