diff options
author | Zach Hilman <zachhilman@gmail.com> | 2018-09-01 19:11:30 +0200 |
---|---|---|
committer | Zach Hilman <zachhilman@gmail.com> | 2018-09-04 22:24:02 +0200 |
commit | c91b60a421a3bd0dc85d80e0a5a2d261370df340 (patch) | |
tree | cc4867bcef325b7e7b4d268f29705e38fd3ca180 /src/core/file_sys/patch_manager.cpp | |
parent | bktr: Add logging on successful patch (diff) | |
download | yuzu-c91b60a421a3bd0dc85d80e0a5a2d261370df340.tar yuzu-c91b60a421a3bd0dc85d80e0a5a2d261370df340.tar.gz yuzu-c91b60a421a3bd0dc85d80e0a5a2d261370df340.tar.bz2 yuzu-c91b60a421a3bd0dc85d80e0a5a2d261370df340.tar.lz yuzu-c91b60a421a3bd0dc85d80e0a5a2d261370df340.tar.xz yuzu-c91b60a421a3bd0dc85d80e0a5a2d261370df340.tar.zst yuzu-c91b60a421a3bd0dc85d80e0a5a2d261370df340.zip |
Diffstat (limited to '')
-rw-r--r-- | src/core/file_sys/patch_manager.cpp | 28 |
1 files changed, 22 insertions, 6 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, return romfs; } -std::map<PatchType, u32> PatchManager::GetPatchVersionNames() const { - std::map<PatchType, u32> out; +std::map<PatchType, std::string> PatchManager::GetPatchVersionNames() const { + std::map<PatchType, std::string> out; const auto installed = Service::FileSystem::GetUnionContents(); const auto update_tid = GetUpdateTitleID(title_id); - const auto update_version = installed->GetEntryVersion(update_tid); - if (update_version != boost::none && - installed->HasEntry(update_tid, ContentRecordType::Program)) { - out[PatchType::Update] = update_version.get(); + const auto update_control = installed->GetEntry(title_id, ContentRecordType::Control); + if (update_control != nullptr) { + do { + const auto romfs = + PatchRomFS(update_control->GetRomFS(), update_control->GetBaseIVFCOffset(), + FileSys::ContentRecordType::Control); + if (romfs == nullptr) + break; + + const auto control_dir = FileSys::ExtractRomFS(romfs); + if (control_dir == nullptr) + break; + + const auto nacp_file = control_dir->GetFile("control.nacp"); + if (nacp_file == nullptr) + break; + + FileSys::NACP nacp(nacp_file); + out[PatchType::Update] = nacp.GetVersionString(); + } while (false); } return out; |