mirror of
https://git.h3cjp.net/H3cJP/yuzu.git
synced 2024-12-14 14:55:39 +00: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
|
@ -21,12 +21,16 @@ AppLoader_NAX::~AppLoader_NAX() = default;
|
|||
FileType AppLoader_NAX::IdentifyType(const FileSys::VirtualFile& file) {
|
||||
FileSys::NAX nax(file);
|
||||
|
||||
if (nax.GetStatus() == ResultStatus::Success && nax.AsNCA() != nullptr &&
|
||||
nax.AsNCA()->GetStatus() == ResultStatus::Success) {
|
||||
return FileType::NAX;
|
||||
if (nax.GetStatus() != ResultStatus::Success) {
|
||||
return FileType::Error;
|
||||
}
|
||||
|
||||
return FileType::Error;
|
||||
const auto nca = nax.AsNCA();
|
||||
if (nca == nullptr || nca->GetStatus() != ResultStatus::Success) {
|
||||
return FileType::Error;
|
||||
}
|
||||
|
||||
return FileType::NAX;
|
||||
}
|
||||
|
||||
ResultStatus AppLoader_NAX::Load(Kernel::SharedPtr<Kernel::Process>& process) {
|
||||
|
|
Loading…
Reference in a new issue