diff options
Diffstat (limited to 'src/core/loader/nsp.cpp')
-rw-r--r-- | src/core/loader/nsp.cpp | 11 |
1 files changed, 9 insertions, 2 deletions
diff --git a/src/core/loader/nsp.cpp b/src/core/loader/nsp.cpp index 75d9fc1bc..b59d40052 100644 --- a/src/core/loader/nsp.cpp +++ b/src/core/loader/nsp.cpp @@ -21,22 +21,27 @@ namespace Loader { AppLoader_NSP::AppLoader_NSP(FileSys::VirtualFile file) : AppLoader(file), nsp(std::make_unique<FileSys::NSP>(file)), title_id(nsp->GetProgramTitleID()) { + if (nsp->GetStatus() != ResultStatus::Success) return; if (nsp->IsExtractedType()) return; + const auto control_nca = nsp->GetNCA(nsp->GetFirstTitleID(), FileSys::ContentRecordType::Control); if (control_nca == nullptr || control_nca->GetStatus() != ResultStatus::Success) return; + const auto romfs = FileSys::ExtractRomFS(control_nca->GetRomFS()); if (romfs == nullptr) return; + for (const auto& language : FileSys::LANGUAGE_NAMES) { icon_file = romfs->GetFile("icon_" + std::string(language) + ".dat"); if (icon_file != nullptr) break; } + const auto nacp_raw = romfs->GetFile("control.nacp"); if (nacp_raw == nullptr) return; @@ -51,15 +56,17 @@ 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()) && nsp.GetRomFS() != nullptr) { return FileType::NSP; + } // Non-Ectracted Type case if (!nsp.IsExtractedType() && nsp.GetNCA(nsp.GetFirstTitleID(), FileSys::ContentRecordType::Program) != nullptr && AppLoader_NCA::IdentifyType(nsp.GetNCAFile( - nsp.GetFirstTitleID(), FileSys::ContentRecordType::Program)) == FileType::NCA) + nsp.GetFirstTitleID(), FileSys::ContentRecordType::Program)) == FileType::NCA) { return FileType::NSP; + } } return FileType::Error; |