summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorZach Hilman <zachhilman@gmail.com>2018-09-27 04:15:05 +0200
committerZach Hilman <zachhilman@gmail.com>2018-10-01 03:01:35 +0200
commit32fc31fb13d4381dc4b2124df4f13cbcbde7fb8b (patch)
treeda85deeafc220fa40ae5b42bc3ac6fff2a9a5a3a /src
parentMerge pull request #1338 from raven02/service_vi (diff)
downloadyuzu-32fc31fb13d4381dc4b2124df4f13cbcbde7fb8b.tar
yuzu-32fc31fb13d4381dc4b2124df4f13cbcbde7fb8b.tar.gz
yuzu-32fc31fb13d4381dc4b2124df4f13cbcbde7fb8b.tar.bz2
yuzu-32fc31fb13d4381dc4b2124df4f13cbcbde7fb8b.tar.lz
yuzu-32fc31fb13d4381dc4b2124df4f13cbcbde7fb8b.tar.xz
yuzu-32fc31fb13d4381dc4b2124df4f13cbcbde7fb8b.tar.zst
yuzu-32fc31fb13d4381dc4b2124df4f13cbcbde7fb8b.zip
Diffstat (limited to 'src')
-rw-r--r--src/core/file_sys/patch_manager.cpp26
-rw-r--r--src/core/file_sys/patch_manager.h1
2 files changed, 27 insertions, 0 deletions
diff --git a/src/core/file_sys/patch_manager.cpp b/src/core/file_sys/patch_manager.cpp
index 4b3b5e665..5ac2b987e 100644
--- a/src/core/file_sys/patch_manager.cpp
+++ b/src/core/file_sys/patch_manager.cpp
@@ -18,6 +18,7 @@
namespace FileSys {
constexpr u64 SINGLE_BYTE_MODULUS = 0x100;
+constexpr u64 DLC_BASE_TITLE_ID_MASK = 0xFFFFFFFFFFFFE000;
std::string FormatTitleVersion(u32 version, TitleVersionFormat format) {
std::array<u8, sizeof(u32)> bytes{};
@@ -35,6 +36,7 @@ std::string FormatTitleVersion(u32 version, TitleVersionFormat format) {
constexpr std::array<const char*, 2> PATCH_TYPE_NAMES{
"Update",
"LayeredFS",
+ "DLC",
};
std::string FormatPatchTypeName(PatchType type) {
@@ -139,6 +141,7 @@ std::map<PatchType, std::string> PatchManager::GetPatchVersionNames() const {
std::map<PatchType, std::string> out;
const auto installed = Service::FileSystem::GetUnionContents();
+ // Update
const auto update_tid = GetUpdateTitleID(title_id);
PatchManager update{update_tid};
auto [nacp, discard_icon_file] = update.GetControlMetadata();
@@ -161,6 +164,29 @@ std::map<PatchType, std::string> PatchManager::GetPatchVersionNames() const {
if (lfs_dir != nullptr && lfs_dir->GetSize() > 0)
out.insert_or_assign(PatchType::LayeredFS, "");
+ // DLC
+ const auto dlc_entries = installed->ListEntriesFilter(TitleType::AOC, ContentRecordType::Data);
+ std::vector<RegisteredCacheEntry> dlc_match;
+ dlc_match.reserve(dlc_entries.size());
+ std::copy_if(dlc_entries.begin(), dlc_entries.end(), std::back_inserter(dlc_match),
+ [this, &installed](const RegisteredCacheEntry& entry) {
+ return (entry.title_id & DLC_BASE_TITLE_ID_MASK) == title_id &&
+ installed->GetEntry(entry)->GetStatus() ==
+ Loader::ResultStatus::Success;
+ });
+ if (!dlc_match.empty()) {
+ // Ensure sorted so DLC IDs show in order.
+ std::sort(dlc_match.begin(), dlc_match.end());
+
+ std::string list;
+ for (size_t i = 0; i < dlc_match.size() - 1; ++i)
+ list += fmt::format("{}, ", dlc_match[i].title_id & 0x7FF);
+
+ list += fmt::format("{}", dlc_match.back().title_id & 0x7FF);
+
+ out[PatchType::DLC] = list;
+ }
+
return out;
}
diff --git a/src/core/file_sys/patch_manager.h b/src/core/file_sys/patch_manager.h
index 464f17515..3a2a9d212 100644
--- a/src/core/file_sys/patch_manager.h
+++ b/src/core/file_sys/patch_manager.h
@@ -27,6 +27,7 @@ std::string FormatTitleVersion(u32 version,
enum class PatchType {
Update,
LayeredFS,
+ DLC,
};
std::string FormatPatchTypeName(PatchType type);