diff options
| author | 2018-09-03 18:57:52 -0400 | |
|---|---|---|
| committer | 2018-09-04 16:25:10 -0400 | |
| commit | 23a16c1720ee522f6ac7d1f426a2d4a918ce41c9 (patch) | |
| tree | 43a69cb7046a768760e5ae20eddfe3b53d3ca7f8 /src/core/loader/nsp.cpp | |
| parent | nsp: Fix error masking issue with XCI files (diff) | |
| download | yuzu-23a16c1720ee522f6ac7d1f426a2d4a918ce41c9.tar.gz yuzu-23a16c1720ee522f6ac7d1f426a2d4a918ce41c9.tar.xz yuzu-23a16c1720ee522f6ac7d1f426a2d4a918ce41c9.zip | |
patch_manager: Centralize Control-type NCA parsing
Diffstat (limited to 'src/core/loader/nsp.cpp')
| -rw-r--r-- | src/core/loader/nsp.cpp | 20 |
1 files changed, 5 insertions, 15 deletions
diff --git a/src/core/loader/nsp.cpp b/src/core/loader/nsp.cpp index 7c06239f2..291a9876d 100644 --- a/src/core/loader/nsp.cpp +++ b/src/core/loader/nsp.cpp | |||
| @@ -9,6 +9,8 @@ | |||
| 9 | #include "core/file_sys/content_archive.h" | 9 | #include "core/file_sys/content_archive.h" |
| 10 | #include "core/file_sys/control_metadata.h" | 10 | #include "core/file_sys/control_metadata.h" |
| 11 | #include "core/file_sys/nca_metadata.h" | 11 | #include "core/file_sys/nca_metadata.h" |
| 12 | #include "core/file_sys/patch_manager.h" | ||
| 13 | #include "core/file_sys/registered_cache.h" | ||
| 12 | #include "core/file_sys/romfs.h" | 14 | #include "core/file_sys/romfs.h" |
| 13 | #include "core/file_sys/submission_package.h" | 15 | #include "core/file_sys/submission_package.h" |
| 14 | #include "core/hle/kernel/process.h" | 16 | #include "core/hle/kernel/process.h" |
| @@ -28,24 +30,12 @@ AppLoader_NSP::AppLoader_NSP(FileSys::VirtualFile file) | |||
| 28 | return; | 30 | return; |
| 29 | 31 | ||
| 30 | const auto control_nca = | 32 | const auto control_nca = |
| 31 | nsp->GetNCA(nsp->GetFirstTitleID(), FileSys::ContentRecordType::Control); | 33 | nsp->GetNCA(nsp->GetProgramTitleID(), FileSys::ContentRecordType::Control); |
| 32 | if (control_nca == nullptr || control_nca->GetStatus() != ResultStatus::Success) | 34 | if (control_nca == nullptr || control_nca->GetStatus() != ResultStatus::Success) |
| 33 | return; | 35 | return; |
| 34 | 36 | ||
| 35 | const auto romfs = FileSys::ExtractRomFS(control_nca->GetRomFS()); | 37 | std::tie(nacp_file, icon_file) = |
| 36 | if (romfs == nullptr) | 38 | FileSys::PatchManager(nsp->GetProgramTitleID()).ParseControlNCA(control_nca); |
| 37 | return; | ||
| 38 | |||
| 39 | for (const auto& language : FileSys::LANGUAGE_NAMES) { | ||
| 40 | icon_file = romfs->GetFile("icon_" + std::string(language) + ".dat"); | ||
| 41 | if (icon_file != nullptr) | ||
| 42 | break; | ||
| 43 | } | ||
| 44 | |||
| 45 | const auto nacp_raw = romfs->GetFile("control.nacp"); | ||
| 46 | if (nacp_raw == nullptr) | ||
| 47 | return; | ||
| 48 | nacp_file = std::make_shared<FileSys::NACP>(nacp_raw); | ||
| 49 | } | 39 | } |
| 50 | 40 | ||
| 51 | AppLoader_NSP::~AppLoader_NSP() = default; | 41 | AppLoader_NSP::~AppLoader_NSP() = default; |