summaryrefslogtreecommitdiff
path: root/src/core/hle/service/aoc
diff options
context:
space:
mode:
authorGravatar Morph2020-12-04 01:41:21 -0500
committerGravatar Morph2020-12-08 08:19:05 -0500
commit0eb6c6cd836028a94260321e460871c228deee50 (patch)
tree1f32afb694eae681c5d5936efe751f0f0d3cb972 /src/core/hle/service/aoc
parentMerge pull request #5165 from lioncash/copy-controller (diff)
downloadyuzu-0eb6c6cd836028a94260321e460871c228deee50.tar.gz
yuzu-0eb6c6cd836028a94260321e460871c228deee50.tar.xz
yuzu-0eb6c6cd836028a94260321e460871c228deee50.zip
file_sys: Consolidate common Title ID operations
Diffstat (limited to 'src/core/hle/service/aoc')
-rw-r--r--src/core/hle/service/aoc/aoc_u.cpp12
1 files changed, 5 insertions, 7 deletions
diff --git a/src/core/hle/service/aoc/aoc_u.cpp b/src/core/hle/service/aoc/aoc_u.cpp
index 6abac3f78..17ba21496 100644
--- a/src/core/hle/service/aoc/aoc_u.cpp
+++ b/src/core/hle/service/aoc/aoc_u.cpp
@@ -7,6 +7,7 @@
7#include <vector> 7#include <vector>
8#include "common/logging/log.h" 8#include "common/logging/log.h"
9#include "core/core.h" 9#include "core/core.h"
10#include "core/file_sys/common_funcs.h"
10#include "core/file_sys/content_archive.h" 11#include "core/file_sys/content_archive.h"
11#include "core/file_sys/control_metadata.h" 12#include "core/file_sys/control_metadata.h"
12#include "core/file_sys/nca_metadata.h" 13#include "core/file_sys/nca_metadata.h"
@@ -23,11 +24,8 @@
23 24
24namespace Service::AOC { 25namespace Service::AOC {
25 26
26constexpr u64 DLC_BASE_TITLE_ID_MASK = 0xFFFFFFFFFFFFE000;
27constexpr u64 DLC_BASE_TO_AOC_ID = 0x1000;
28
29static bool CheckAOCTitleIDMatchesBase(u64 title_id, u64 base) { 27static bool CheckAOCTitleIDMatchesBase(u64 title_id, u64 base) {
30 return (title_id & DLC_BASE_TITLE_ID_MASK) == base; 28 return FileSys::GetBaseTitleID(title_id) == base;
31} 29}
32 30
33static std::vector<u64> AccumulateAOCTitleIDs(Core::System& system) { 31static std::vector<u64> AccumulateAOCTitleIDs(Core::System& system) {
@@ -123,11 +121,11 @@ void AOC_U::ListAddOnContent(Kernel::HLERequestContext& ctx) {
123 const auto& disabled = Settings::values.disabled_addons[current]; 121 const auto& disabled = Settings::values.disabled_addons[current];
124 if (std::find(disabled.begin(), disabled.end(), "DLC") == disabled.end()) { 122 if (std::find(disabled.begin(), disabled.end(), "DLC") == disabled.end()) {
125 for (u64 content_id : add_on_content) { 123 for (u64 content_id : add_on_content) {
126 if ((content_id & DLC_BASE_TITLE_ID_MASK) != current) { 124 if (FileSys::GetBaseTitleID(content_id) != current) {
127 continue; 125 continue;
128 } 126 }
129 127
130 out.push_back(static_cast<u32>(content_id & 0x7FF)); 128 out.push_back(static_cast<u32>(FileSys::GetAOCID(content_id)));
131 } 129 }
132 } 130 }
133 131
@@ -169,7 +167,7 @@ void AOC_U::GetAddOnContentBaseId(Kernel::HLERequestContext& ctx) {
169 167
170 const auto res = pm.GetControlMetadata(); 168 const auto res = pm.GetControlMetadata();
171 if (res.first == nullptr) { 169 if (res.first == nullptr) {
172 rb.Push(title_id + DLC_BASE_TO_AOC_ID); 170 rb.Push(FileSys::GetAOCBaseTitleID(title_id));
173 return; 171 return;
174 } 172 }
175 173