summaryrefslogtreecommitdiffstats
path: root/src/core/loader
diff options
context:
space:
mode:
authorLioncash <mathew1800@gmail.com>2018-09-19 20:13:00 +0200
committerLioncash <mathew1800@gmail.com>2018-09-19 20:22:37 +0200
commit45195a51a76b3000e028234f619a4d15bff443eb (patch)
tree5261c2ea094b4022505cd8e6f64911f877304ebd /src/core/loader
parentnax: Avoid unnecessary calls to AsNCA() in IdentifyType() (diff)
downloadyuzu-45195a51a76b3000e028234f619a4d15bff443eb.tar
yuzu-45195a51a76b3000e028234f619a4d15bff443eb.tar.gz
yuzu-45195a51a76b3000e028234f619a4d15bff443eb.tar.bz2
yuzu-45195a51a76b3000e028234f619a4d15bff443eb.tar.lz
yuzu-45195a51a76b3000e028234f619a4d15bff443eb.tar.xz
yuzu-45195a51a76b3000e028234f619a4d15bff443eb.tar.zst
yuzu-45195a51a76b3000e028234f619a4d15bff443eb.zip
Diffstat (limited to 'src/core/loader')
-rw-r--r--src/core/loader/nax.cpp28
-rw-r--r--src/core/loader/nax.h4
2 files changed, 19 insertions, 13 deletions
diff --git a/src/core/loader/nax.cpp b/src/core/loader/nax.cpp
index 02a0d5ba7..5d4380684 100644
--- a/src/core/loader/nax.cpp
+++ b/src/core/loader/nax.cpp
@@ -11,16 +11,8 @@
#include "core/loader/nca.h"
namespace Loader {
-
-AppLoader_NAX::AppLoader_NAX(FileSys::VirtualFile file)
- : AppLoader(file), nax(std::make_unique<FileSys::NAX>(file)),
- nca_loader(std::make_unique<AppLoader_NCA>(nax->GetDecrypted())) {}
-
-AppLoader_NAX::~AppLoader_NAX() = default;
-
-FileType AppLoader_NAX::IdentifyType(const FileSys::VirtualFile& file) {
- FileSys::NAX nax(file);
-
+namespace {
+FileType IdentifyTypeImpl(const FileSys::NAX& nax) {
if (nax.GetStatus() != ResultStatus::Success) {
return FileType::Error;
}
@@ -32,6 +24,22 @@ FileType AppLoader_NAX::IdentifyType(const FileSys::VirtualFile& file) {
return FileType::NAX;
}
+} // Anonymous namespace
+
+AppLoader_NAX::AppLoader_NAX(FileSys::VirtualFile file)
+ : AppLoader(file), nax(std::make_unique<FileSys::NAX>(file)),
+ nca_loader(std::make_unique<AppLoader_NCA>(nax->GetDecrypted())) {}
+
+AppLoader_NAX::~AppLoader_NAX() = default;
+
+FileType AppLoader_NAX::IdentifyType(const FileSys::VirtualFile& file) {
+ const FileSys::NAX nax(file);
+ return IdentifyTypeImpl(nax);
+}
+
+FileType AppLoader_NAX::GetFileType() {
+ return IdentifyTypeImpl(*nax);
+}
ResultStatus AppLoader_NAX::Load(Kernel::SharedPtr<Kernel::Process>& process) {
if (is_loaded) {
diff --git a/src/core/loader/nax.h b/src/core/loader/nax.h
index 4dbae2918..56605fe45 100644
--- a/src/core/loader/nax.h
+++ b/src/core/loader/nax.h
@@ -31,9 +31,7 @@ public:
*/
static FileType IdentifyType(const FileSys::VirtualFile& file);
- FileType GetFileType() override {
- return IdentifyType(file);
- }
+ FileType GetFileType() override;
ResultStatus Load(Kernel::SharedPtr<Kernel::Process>& process) override;