summaryrefslogtreecommitdiffstats
path: root/src/core
diff options
context:
space:
mode:
authorZach Hilman <zachhilman@gmail.com>2019-06-10 06:21:41 +0200
committerZach Hilman <zachhilman@gmail.com>2019-06-10 06:21:41 +0200
commitb957a4862ff370f7f8c213159eb49c3743dd93f5 (patch)
tree745ae07dba82dc4e6de3294c67acf1b3418b77fa /src/core
parentnsp: Use title ID from NPDM metadata for extracted type NSPs (diff)
downloadyuzu-b957a4862ff370f7f8c213159eb49c3743dd93f5.tar
yuzu-b957a4862ff370f7f8c213159eb49c3743dd93f5.tar.gz
yuzu-b957a4862ff370f7f8c213159eb49c3743dd93f5.tar.bz2
yuzu-b957a4862ff370f7f8c213159eb49c3743dd93f5.tar.lz
yuzu-b957a4862ff370f7f8c213159eb49c3743dd93f5.tar.xz
yuzu-b957a4862ff370f7f8c213159eb49c3743dd93f5.tar.zst
yuzu-b957a4862ff370f7f8c213159eb49c3743dd93f5.zip
Diffstat (limited to 'src/core')
-rw-r--r--src/core/file_sys/submission_package.cpp5
-rw-r--r--src/core/loader/nsp.cpp25
2 files changed, 17 insertions, 13 deletions
diff --git a/src/core/file_sys/submission_package.cpp b/src/core/file_sys/submission_package.cpp
index 753d2f58a..691ca90c8 100644
--- a/src/core/file_sys/submission_package.cpp
+++ b/src/core/file_sys/submission_package.cpp
@@ -14,6 +14,7 @@
#include "core/file_sys/content_archive.h"
#include "core/file_sys/nca_metadata.h"
#include "core/file_sys/partition_filesystem.h"
+#include "core/file_sys/program_metadata.h"
#include "core/file_sys/submission_package.h"
#include "core/loader/loader.h"
@@ -78,6 +79,10 @@ Loader::ResultStatus NSP::GetStatus() const {
}
Loader::ResultStatus NSP::GetProgramStatus(u64 title_id) const {
+ if (IsExtractedType() && GetExeFS() != nullptr && FileSys::IsDirectoryExeFS(GetExeFS())) {
+ return Loader::ResultStatus::Success;
+ }
+
const auto iter = program_status.find(title_id);
if (iter == program_status.end())
return Loader::ResultStatus::ErrorNSPMissingProgramNCA;
diff --git a/src/core/loader/nsp.cpp b/src/core/loader/nsp.cpp
index 8b90bbd30..9035dc3f9 100644
--- a/src/core/loader/nsp.cpp
+++ b/src/core/loader/nsp.cpp
@@ -26,20 +26,18 @@ AppLoader_NSP::AppLoader_NSP(FileSys::VirtualFile file)
if (nsp->GetStatus() != ResultStatus::Success)
return;
- if (nsp->IsExtractedType())
- return;
-
- const auto control_nca =
- nsp->GetNCA(nsp->GetProgramTitleID(), FileSys::ContentRecordType::Control);
- if (control_nca == nullptr || control_nca->GetStatus() != ResultStatus::Success)
- return;
-
- std::tie(nacp_file, icon_file) =
- FileSys::PatchManager(nsp->GetProgramTitleID()).ParseControlNCA(*control_nca);
if (nsp->IsExtractedType()) {
secondary_loader = std::make_unique<AppLoader_DeconstructedRomDirectory>(nsp->GetExeFS());
} else {
+ const auto control_nca =
+ nsp->GetNCA(nsp->GetProgramTitleID(), FileSys::ContentRecordType::Control);
+ if (control_nca == nullptr || control_nca->GetStatus() != ResultStatus::Success)
+ return;
+
+ std::tie(nacp_file, icon_file) =
+ FileSys::PatchManager(nsp->GetProgramTitleID()).ParseControlNCA(*control_nca);
+
if (title_id == 0)
return;
@@ -56,11 +54,11 @@ FileType AppLoader_NSP::IdentifyType(const FileSys::VirtualFile& file) {
if (nsp.GetStatus() == ResultStatus::Success) {
// Extracted Type case
if (nsp.IsExtractedType() && nsp.GetExeFS() != nullptr &&
- FileSys::IsDirectoryExeFS(nsp.GetExeFS()) && nsp.GetRomFS() != nullptr) {
+ FileSys::IsDirectoryExeFS(nsp.GetExeFS())) {
return FileType::NSP;
}
- // Non-Ectracted Type case
+ // Non-Extracted Type case
if (!nsp.IsExtractedType() &&
nsp.GetNCA(nsp.GetFirstTitleID(), FileSys::ContentRecordType::Program) != nullptr &&
AppLoader_NCA::IdentifyType(nsp.GetNCAFile(
@@ -91,7 +89,8 @@ AppLoader_NSP::LoadResult AppLoader_NSP::Load(Kernel::Process& process) {
return {nsp_program_status, {}};
}
- if (nsp->GetNCA(title_id, FileSys::ContentRecordType::Program) == nullptr) {
+ if (!nsp->IsExtractedType() &&
+ nsp->GetNCA(title_id, FileSys::ContentRecordType::Program) == nullptr) {
if (!Core::Crypto::KeyManager::KeyFileExists(false)) {
return {ResultStatus::ErrorMissingProductionKeyFile, {}};
}