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/xci.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/xci.cpp')
| -rw-r--r-- | src/core/loader/xci.cpp | 21 |
1 files changed, 3 insertions, 18 deletions
diff --git a/src/core/loader/xci.cpp b/src/core/loader/xci.cpp index b01d51abb..16509229f 100644 --- a/src/core/loader/xci.cpp +++ b/src/core/loader/xci.cpp | |||
| @@ -10,6 +10,7 @@ | |||
| 10 | #include "core/file_sys/control_metadata.h" | 10 | #include "core/file_sys/control_metadata.h" |
| 11 | #include "core/file_sys/patch_manager.h" | 11 | #include "core/file_sys/patch_manager.h" |
| 12 | #include "core/file_sys/romfs.h" | 12 | #include "core/file_sys/romfs.h" |
| 13 | #include "core/file_sys/submission_package.h" | ||
| 13 | #include "core/hle/kernel/process.h" | 14 | #include "core/hle/kernel/process.h" |
| 14 | #include "core/loader/nca.h" | 15 | #include "core/loader/nca.h" |
| 15 | #include "core/loader/xci.h" | 16 | #include "core/loader/xci.h" |
| @@ -23,27 +24,11 @@ AppLoader_XCI::AppLoader_XCI(FileSys::VirtualFile file) | |||
| 23 | return; | 24 | return; |
| 24 | 25 | ||
| 25 | const auto control_nca = xci->GetNCAByType(FileSys::NCAContentType::Control); | 26 | const auto control_nca = xci->GetNCAByType(FileSys::NCAContentType::Control); |
| 26 | |||
| 27 | if (control_nca == nullptr || control_nca->GetStatus() != ResultStatus::Success) | 27 | if (control_nca == nullptr || control_nca->GetStatus() != ResultStatus::Success) |
| 28 | return; | 28 | return; |
| 29 | 29 | ||
| 30 | auto romfs_raw = control_nca->GetRomFS(); | 30 | std::tie(nacp_file, icon_file) = |
| 31 | FileSys::PatchManager patch{xci->GetNCAByType(FileSys::NCAContentType::Program)->GetTitleId()}; | 31 | FileSys::PatchManager(xci->GetProgramTitleID()).ParseControlNCA(control_nca); |
| 32 | romfs_raw = patch.PatchRomFS(romfs_raw, control_nca->GetBaseIVFCOffset(), | ||
| 33 | FileSys::ContentRecordType::Control); | ||
| 34 | |||
| 35 | const auto romfs = FileSys::ExtractRomFS(romfs_raw); | ||
| 36 | if (romfs == nullptr) | ||
| 37 | return; | ||
| 38 | for (const auto& language : FileSys::LANGUAGE_NAMES) { | ||
| 39 | icon_file = romfs->GetFile("icon_" + std::string(language) + ".dat"); | ||
| 40 | if (icon_file != nullptr) | ||
| 41 | break; | ||
| 42 | } | ||
| 43 | const auto nacp_raw = romfs->GetFile("control.nacp"); | ||
| 44 | if (nacp_raw == nullptr) | ||
| 45 | return; | ||
| 46 | nacp_file = std::make_shared<FileSys::NACP>(nacp_raw); | ||
| 47 | } | 32 | } |
| 48 | 33 | ||
| 49 | AppLoader_XCI::~AppLoader_XCI() = default; | 34 | AppLoader_XCI::~AppLoader_XCI() = default; |