summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGravatar Lioncash2018-10-16 11:36:55 -0400
committerGravatar Lioncash2018-10-16 11:36:58 -0400
commit73e1e929a2aecdb26b9db8ea9a418a3f4e9c1365 (patch)
tree56438cca62e87575958db23380e557143151675d
parentMerge pull request #1443 from DarkLordZach/lower-loader-logs-1 (diff)
downloadyuzu-73e1e929a2aecdb26b9db8ea9a418a3f4e9c1365.tar.gz
yuzu-73e1e929a2aecdb26b9db8ea9a418a3f4e9c1365.tar.xz
yuzu-73e1e929a2aecdb26b9db8ea9a418a3f4e9c1365.zip
XCI: Add function for checking the existence of the program NCA
The only reason the getter existed was to check whether or not the program NCA was null. Instead, we can just provide a function to query for the existence of it, instead of exposing it entirely.
-rw-r--r--src/core/file_sys/card_image.cpp10
-rw-r--r--src/core/file_sys/card_image.h2
-rw-r--r--src/core/loader/xci.cpp3
3 files changed, 8 insertions, 7 deletions
diff --git a/src/core/file_sys/card_image.cpp b/src/core/file_sys/card_image.cpp
index 8f5142a07..ecdd7505b 100644
--- a/src/core/file_sys/card_image.cpp
+++ b/src/core/file_sys/card_image.cpp
@@ -122,14 +122,16 @@ u64 XCI::GetProgramTitleID() const {
122 return secure_partition->GetProgramTitleID(); 122 return secure_partition->GetProgramTitleID();
123} 123}
124 124
125std::shared_ptr<NCA> XCI::GetProgramNCA() const { 125bool XCI::HasProgramNCA() const {
126 return program; 126 return program != nullptr;
127} 127}
128 128
129VirtualFile XCI::GetProgramNCAFile() const { 129VirtualFile XCI::GetProgramNCAFile() const {
130 if (GetProgramNCA() == nullptr) 130 if (!HasProgramNCA()) {
131 return nullptr; 131 return nullptr;
132 return GetProgramNCA()->GetBaseFile(); 132 }
133
134 return program->GetBaseFile();
133} 135}
134 136
135const std::vector<std::shared_ptr<NCA>>& XCI::GetNCAs() const { 137const std::vector<std::shared_ptr<NCA>>& XCI::GetNCAs() const {
diff --git a/src/core/file_sys/card_image.h b/src/core/file_sys/card_image.h
index ce514dfa0..48cbef666 100644
--- a/src/core/file_sys/card_image.h
+++ b/src/core/file_sys/card_image.h
@@ -80,7 +80,7 @@ public:
80 80
81 u64 GetProgramTitleID() const; 81 u64 GetProgramTitleID() const;
82 82
83 std::shared_ptr<NCA> GetProgramNCA() const; 83 bool HasProgramNCA() const;
84 VirtualFile GetProgramNCAFile() const; 84 VirtualFile GetProgramNCAFile() const;
85 const std::vector<std::shared_ptr<NCA>>& GetNCAs() const; 85 const std::vector<std::shared_ptr<NCA>>& GetNCAs() const;
86 std::shared_ptr<NCA> GetNCAByType(NCAContentType type) const; 86 std::shared_ptr<NCA> GetNCAByType(NCAContentType type) const;
diff --git a/src/core/loader/xci.cpp b/src/core/loader/xci.cpp
index 7a619acb4..461607c95 100644
--- a/src/core/loader/xci.cpp
+++ b/src/core/loader/xci.cpp
@@ -59,8 +59,7 @@ ResultStatus AppLoader_XCI::Load(Kernel::Process& process) {
59 if (xci->GetProgramNCAStatus() != ResultStatus::Success) 59 if (xci->GetProgramNCAStatus() != ResultStatus::Success)
60 return xci->GetProgramNCAStatus(); 60 return xci->GetProgramNCAStatus();
61 61
62 const auto nca = xci->GetProgramNCA(); 62 if (!xci->HasProgramNCA() && !Core::Crypto::KeyManager::KeyFileExists(false))
63 if (nca == nullptr && !Core::Crypto::KeyManager::KeyFileExists(false))
64 return ResultStatus::ErrorMissingProductionKeyFile; 63 return ResultStatus::ErrorMissingProductionKeyFile;
65 64
66 const auto result = nca_loader->Load(process); 65 const auto result = nca_loader->Load(process);