diff options
author | Lioncash <mathew1800@gmail.com> | 2020-11-18 07:53:10 -0500 |
---|---|---|
committer | Lioncash <mathew1800@gmail.com> | 2020-11-18 09:36:48 -0500 |
commit | 6f8a06bac58790d20dae3c1adb4de3b441f07b30 (patch) | |
tree | ef5e2942aa0aacbebb683da91ee6d4bd19ec15e9 /src/core/loader/nsp.cpp | |
parent | abda36636245c416a75774165d2a5b49610952fc (diff) |
patch_manager: Remove usages of the global system instance
With this, only 19 usages of the global system instance remain within
the core library.
We're almost there.
Diffstat (limited to 'src/core/loader/nsp.cpp')
-rw-r--r-- | src/core/loader/nsp.cpp | 19 |
1 files changed, 13 insertions, 6 deletions
diff --git a/src/core/loader/nsp.cpp b/src/core/loader/nsp.cpp index 15e528fa8b..e821937fd3 100644 --- a/src/core/loader/nsp.cpp +++ b/src/core/loader/nsp.cpp @@ -21,26 +21,33 @@ namespace Loader { -AppLoader_NSP::AppLoader_NSP(FileSys::VirtualFile file) +AppLoader_NSP::AppLoader_NSP(FileSys::VirtualFile file, + const Service::FileSystem::FileSystemController& fsc, + const FileSys::ContentProvider& content_provider) : AppLoader(file), nsp(std::make_unique<FileSys::NSP>(file)), title_id(nsp->GetProgramTitleID()) { - if (nsp->GetStatus() != ResultStatus::Success) + if (nsp->GetStatus() != ResultStatus::Success) { return; + } 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) + if (control_nca == nullptr || control_nca->GetStatus() != ResultStatus::Success) { return; + } - std::tie(nacp_file, icon_file) = - FileSys::PatchManager(nsp->GetProgramTitleID()).ParseControlNCA(*control_nca); + std::tie(nacp_file, icon_file) = [this, &content_provider, &control_nca, &fsc] { + const FileSys::PatchManager pm{nsp->GetProgramTitleID(), fsc, content_provider}; + return pm.ParseControlNCA(*control_nca); + }(); - if (title_id == 0) + if (title_id == 0) { return; + } secondary_loader = std::make_unique<AppLoader_NCA>( nsp->GetNCAFile(title_id, FileSys::ContentRecordType::Program)); |