From f7eaea424d07e971d0279257d20d408b64ef05b6 Mon Sep 17 00:00:00 2001 From: Zach Hilman Date: Sat, 25 Aug 2018 11:50:04 -0400 Subject: registration: Add support for installing NSP files --- src/yuzu/main.cpp | 24 ++++++++++++++++++------ 1 file changed, 18 insertions(+), 6 deletions(-) (limited to 'src/yuzu/main.cpp') diff --git a/src/yuzu/main.cpp b/src/yuzu/main.cpp index 262e33487..c4eda4bab 100644 --- a/src/yuzu/main.cpp +++ b/src/yuzu/main.cpp @@ -806,22 +806,34 @@ void GMainWindow::OnMenuInstallToNAND() { QMessageBox::Yes; }; - if (filename.endsWith("xci", Qt::CaseInsensitive)) { - const auto xci = std::make_shared( - vfs->OpenFile(filename.toStdString(), FileSys::Mode::Read)); - if (xci->GetStatus() != Loader::ResultStatus::Success) { + if (filename.endsWith("xci", Qt::CaseInsensitive) || + filename.endsWith("nsp", Qt::CaseInsensitive)) { + + std::shared_ptr nsp; + if (filename.endsWith("nsp", Qt::CaseInsensitive)) { + nsp = std::make_shared( + vfs->OpenFile(filename.toStdString(), FileSys::Mode::Read)); + if (!nsp->IsExtractedType()) + failed(); + } else { + const auto xci = std::make_shared( + vfs->OpenFile(filename.toStdString(), FileSys::Mode::Read)); + nsp = xci->GetSecurePartitionNSP(); + } + + if (nsp->GetStatus() != Loader::ResultStatus::Success) { failed(); return; } const auto res = - Service::FileSystem::GetUserNANDContents()->InstallEntry(xci, false, qt_raw_copy); + Service::FileSystem::GetUserNANDContents()->InstallEntry(nsp, false, qt_raw_copy); if (res == FileSys::InstallResult::Success) { success(); } else { if (res == FileSys::InstallResult::ErrorAlreadyExists) { if (overwrite()) { const auto res2 = Service::FileSystem::GetUserNANDContents()->InstallEntry( - xci, true, qt_raw_copy); + nsp, true, qt_raw_copy); if (res2 == FileSys::InstallResult::Success) { success(); } else { -- cgit v1.2.3