diff options
| author | 2018-09-01 13:11:30 -0400 | |
|---|---|---|
| committer | 2018-09-04 16:24:02 -0400 | |
| commit | c91b60a421a3bd0dc85d80e0a5a2d261370df340 (patch) | |
| tree | cc4867bcef325b7e7b4d268f29705e38fd3ca180 /src/core | |
| parent | bktr: Add logging on successful patch (diff) | |
| download | yuzu-c91b60a421a3bd0dc85d80e0a5a2d261370df340.tar.gz yuzu-c91b60a421a3bd0dc85d80e0a5a2d261370df340.tar.xz yuzu-c91b60a421a3bd0dc85d80e0a5a2d261370df340.zip | |
game_list: Fix version display on non-NAND titles
Diffstat (limited to 'src/core')
| -rw-r--r-- | src/core/file_sys/patch_manager.cpp | 28 | ||||
| -rw-r--r-- | src/core/file_sys/patch_manager.h | 2 | ||||
| -rw-r--r-- | src/core/loader/xci.cpp | 11 |
3 files changed, 33 insertions, 8 deletions
diff --git a/src/core/file_sys/patch_manager.cpp b/src/core/file_sys/patch_manager.cpp index 8b7d79773..b6e25f7eb 100644 --- a/src/core/file_sys/patch_manager.cpp +++ b/src/core/file_sys/patch_manager.cpp | |||
| @@ -82,15 +82,31 @@ VirtualFile PatchManager::PatchRomFS(VirtualFile romfs, u64 ivfc_offset, | |||
| 82 | return romfs; | 82 | return romfs; |
| 83 | } | 83 | } |
| 84 | 84 | ||
| 85 | std::map<PatchType, u32> PatchManager::GetPatchVersionNames() const { | 85 | std::map<PatchType, std::string> PatchManager::GetPatchVersionNames() const { |
| 86 | std::map<PatchType, u32> out; | 86 | std::map<PatchType, std::string> out; |
| 87 | const auto installed = Service::FileSystem::GetUnionContents(); | 87 | const auto installed = Service::FileSystem::GetUnionContents(); |
| 88 | 88 | ||
| 89 | const auto update_tid = GetUpdateTitleID(title_id); | 89 | const auto update_tid = GetUpdateTitleID(title_id); |
| 90 | const auto update_version = installed->GetEntryVersion(update_tid); | 90 | const auto update_control = installed->GetEntry(title_id, ContentRecordType::Control); |
| 91 | if (update_version != boost::none && | 91 | if (update_control != nullptr) { |
| 92 | installed->HasEntry(update_tid, ContentRecordType::Program)) { | 92 | do { |
| 93 | out[PatchType::Update] = update_version.get(); | 93 | const auto romfs = |
| 94 | PatchRomFS(update_control->GetRomFS(), update_control->GetBaseIVFCOffset(), | ||
| 95 | FileSys::ContentRecordType::Control); | ||
| 96 | if (romfs == nullptr) | ||
| 97 | break; | ||
| 98 | |||
| 99 | const auto control_dir = FileSys::ExtractRomFS(romfs); | ||
| 100 | if (control_dir == nullptr) | ||
| 101 | break; | ||
| 102 | |||
| 103 | const auto nacp_file = control_dir->GetFile("control.nacp"); | ||
| 104 | if (nacp_file == nullptr) | ||
| 105 | break; | ||
| 106 | |||
| 107 | FileSys::NACP nacp(nacp_file); | ||
| 108 | out[PatchType::Update] = nacp.GetVersionString(); | ||
| 109 | } while (false); | ||
| 94 | } | 110 | } |
| 95 | 111 | ||
| 96 | return out; | 112 | return out; |
diff --git a/src/core/file_sys/patch_manager.h b/src/core/file_sys/patch_manager.h index 021bc3366..b6bf86222 100644 --- a/src/core/file_sys/patch_manager.h +++ b/src/core/file_sys/patch_manager.h | |||
| @@ -45,7 +45,7 @@ public: | |||
| 45 | 45 | ||
| 46 | // Returns a vector of pairs between patch names and patch versions. | 46 | // Returns a vector of pairs between patch names and patch versions. |
| 47 | // i.e. Update v80 will return {Update, 80} | 47 | // i.e. Update v80 will return {Update, 80} |
| 48 | std::map<PatchType, u32> GetPatchVersionNames() const; | 48 | std::map<PatchType, std::string> GetPatchVersionNames() const; |
| 49 | 49 | ||
| 50 | private: | 50 | private: |
| 51 | u64 title_id; | 51 | u64 title_id; |
diff --git a/src/core/loader/xci.cpp b/src/core/loader/xci.cpp index 75b998faa..b01d51abb 100644 --- a/src/core/loader/xci.cpp +++ b/src/core/loader/xci.cpp | |||
| @@ -8,6 +8,7 @@ | |||
| 8 | #include "core/file_sys/card_image.h" | 8 | #include "core/file_sys/card_image.h" |
| 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/patch_manager.h" | ||
| 11 | #include "core/file_sys/romfs.h" | 12 | #include "core/file_sys/romfs.h" |
| 12 | #include "core/hle/kernel/process.h" | 13 | #include "core/hle/kernel/process.h" |
| 13 | #include "core/loader/nca.h" | 14 | #include "core/loader/nca.h" |
| @@ -20,10 +21,18 @@ AppLoader_XCI::AppLoader_XCI(FileSys::VirtualFile file) | |||
| 20 | nca_loader(std::make_unique<AppLoader_NCA>(xci->GetProgramNCAFile())) { | 21 | nca_loader(std::make_unique<AppLoader_NCA>(xci->GetProgramNCAFile())) { |
| 21 | if (xci->GetStatus() != ResultStatus::Success) | 22 | if (xci->GetStatus() != ResultStatus::Success) |
| 22 | return; | 23 | return; |
| 24 | |||
| 23 | const auto control_nca = xci->GetNCAByType(FileSys::NCAContentType::Control); | 25 | const auto control_nca = xci->GetNCAByType(FileSys::NCAContentType::Control); |
| 26 | |||
| 24 | if (control_nca == nullptr || control_nca->GetStatus() != ResultStatus::Success) | 27 | if (control_nca == nullptr || control_nca->GetStatus() != ResultStatus::Success) |
| 25 | return; | 28 | return; |
| 26 | const auto romfs = FileSys::ExtractRomFS(control_nca->GetRomFS()); | 29 | |
| 30 | auto romfs_raw = control_nca->GetRomFS(); | ||
| 31 | FileSys::PatchManager patch{xci->GetNCAByType(FileSys::NCAContentType::Program)->GetTitleId()}; | ||
| 32 | romfs_raw = patch.PatchRomFS(romfs_raw, control_nca->GetBaseIVFCOffset(), | ||
| 33 | FileSys::ContentRecordType::Control); | ||
| 34 | |||
| 35 | const auto romfs = FileSys::ExtractRomFS(romfs_raw); | ||
| 27 | if (romfs == nullptr) | 36 | if (romfs == nullptr) |
| 28 | return; | 37 | return; |
| 29 | for (const auto& language : FileSys::LANGUAGE_NAMES) { | 38 | for (const auto& language : FileSys::LANGUAGE_NAMES) { |