summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/core/hle/service/aoc/aoc_u.cpp19
-rw-r--r--src/core/hle/service/aoc/aoc_u.h5
2 files changed, 13 insertions, 11 deletions
diff --git a/src/core/hle/service/aoc/aoc_u.cpp b/src/core/hle/service/aoc/aoc_u.cpp
index d3e97776b..e9cf1e840 100644
--- a/src/core/hle/service/aoc/aoc_u.cpp
+++ b/src/core/hle/service/aoc/aoc_u.cpp
@@ -29,9 +29,9 @@ static bool CheckAOCTitleIDMatchesBase(u64 title_id, u64 base) {
29 return (title_id & DLC_BASE_TITLE_ID_MASK) == base; 29 return (title_id & DLC_BASE_TITLE_ID_MASK) == base;
30} 30}
31 31
32static std::vector<u64> AccumulateAOCTitleIDs() { 32static std::vector<u64> AccumulateAOCTitleIDs(Core::System& system) {
33 std::vector<u64> add_on_content; 33 std::vector<u64> add_on_content;
34 const auto& rcu = Core::System::GetInstance().GetContentProvider(); 34 const auto& rcu = system.GetContentProvider();
35 const auto list = 35 const auto list =
36 rcu.ListEntriesFilter(FileSys::TitleType::AOC, FileSys::ContentRecordType::Data); 36 rcu.ListEntriesFilter(FileSys::TitleType::AOC, FileSys::ContentRecordType::Data);
37 std::transform(list.begin(), list.end(), std::back_inserter(add_on_content), 37 std::transform(list.begin(), list.end(), std::back_inserter(add_on_content),
@@ -47,7 +47,8 @@ static std::vector<u64> AccumulateAOCTitleIDs() {
47 return add_on_content; 47 return add_on_content;
48} 48}
49 49
50AOC_U::AOC_U() : ServiceFramework("aoc:u"), add_on_content(AccumulateAOCTitleIDs()) { 50AOC_U::AOC_U(Core::System& system)
51 : ServiceFramework("aoc:u"), add_on_content(AccumulateAOCTitleIDs(system)), system(system) {
51 // clang-format off 52 // clang-format off
52 static const FunctionInfo functions[] = { 53 static const FunctionInfo functions[] = {
53 {0, nullptr, "CountAddOnContentByApplicationId"}, 54 {0, nullptr, "CountAddOnContentByApplicationId"},
@@ -65,7 +66,7 @@ AOC_U::AOC_U() : ServiceFramework("aoc:u"), add_on_content(AccumulateAOCTitleIDs
65 66
66 RegisterHandlers(functions); 67 RegisterHandlers(functions);
67 68
68 auto& kernel = Core::System::GetInstance().Kernel(); 69 auto& kernel = system.Kernel();
69 aoc_change_event = Kernel::WritableEvent::CreateEventPair(kernel, Kernel::ResetType::Manual, 70 aoc_change_event = Kernel::WritableEvent::CreateEventPair(kernel, Kernel::ResetType::Manual,
70 "GetAddOnContentListChanged:Event"); 71 "GetAddOnContentListChanged:Event");
71} 72}
@@ -86,7 +87,7 @@ void AOC_U::CountAddOnContent(Kernel::HLERequestContext& ctx) {
86 IPC::ResponseBuilder rb{ctx, 3}; 87 IPC::ResponseBuilder rb{ctx, 3};
87 rb.Push(RESULT_SUCCESS); 88 rb.Push(RESULT_SUCCESS);
88 89
89 const auto current = Core::System::GetInstance().CurrentProcess()->GetTitleID(); 90 const auto current = system.CurrentProcess()->GetTitleID();
90 91
91 const auto& disabled = Settings::values.disabled_addons[current]; 92 const auto& disabled = Settings::values.disabled_addons[current];
92 if (std::find(disabled.begin(), disabled.end(), "DLC") != disabled.end()) { 93 if (std::find(disabled.begin(), disabled.end(), "DLC") != disabled.end()) {
@@ -113,7 +114,7 @@ void AOC_U::ListAddOnContent(Kernel::HLERequestContext& ctx) {
113 LOG_DEBUG(Service_AOC, "called with offset={}, count={}, process_id={}", offset, count, 114 LOG_DEBUG(Service_AOC, "called with offset={}, count={}, process_id={}", offset, count,
114 process_id); 115 process_id);
115 116
116 const auto current = Core::System::GetInstance().CurrentProcess()->GetTitleID(); 117 const auto current = system.CurrentProcess()->GetTitleID();
117 118
118 std::vector<u32> out; 119 std::vector<u32> out;
119 const auto& disabled = Settings::values.disabled_addons[current]; 120 const auto& disabled = Settings::values.disabled_addons[current];
@@ -159,7 +160,7 @@ void AOC_U::GetAddOnContentBaseId(Kernel::HLERequestContext& ctx) {
159 IPC::ResponseBuilder rb{ctx, 4}; 160 IPC::ResponseBuilder rb{ctx, 4};
160 rb.Push(RESULT_SUCCESS); 161 rb.Push(RESULT_SUCCESS);
161 162
162 const auto title_id = Core::System::GetInstance().CurrentProcess()->GetTitleID(); 163 const auto title_id = system.CurrentProcess()->GetTitleID();
163 FileSys::PatchManager pm{title_id}; 164 FileSys::PatchManager pm{title_id};
164 165
165 const auto res = pm.GetControlMetadata(); 166 const auto res = pm.GetControlMetadata();
@@ -196,8 +197,8 @@ void AOC_U::GetAddOnContentListChangedEvent(Kernel::HLERequestContext& ctx) {
196 rb.PushCopyObjects(aoc_change_event.readable); 197 rb.PushCopyObjects(aoc_change_event.readable);
197} 198}
198 199
199void InstallInterfaces(SM::ServiceManager& service_manager) { 200void InstallInterfaces(SM::ServiceManager& service_manager, Core::System& system) {
200 std::make_shared<AOC_U>()->InstallAsService(service_manager); 201 std::make_shared<AOC_U>(system)->InstallAsService(service_manager);
201} 202}
202 203
203} // namespace Service::AOC 204} // namespace Service::AOC
diff --git a/src/core/hle/service/aoc/aoc_u.h b/src/core/hle/service/aoc/aoc_u.h
index 5effea730..e20f90a76 100644
--- a/src/core/hle/service/aoc/aoc_u.h
+++ b/src/core/hle/service/aoc/aoc_u.h
@@ -14,7 +14,7 @@ namespace Service::AOC {
14 14
15class AOC_U final : public ServiceFramework<AOC_U> { 15class AOC_U final : public ServiceFramework<AOC_U> {
16public: 16public:
17 AOC_U(); 17 AOC_U(Core::System& system);
18 ~AOC_U() override; 18 ~AOC_U() override;
19 19
20private: 20private:
@@ -26,9 +26,10 @@ private:
26 26
27 std::vector<u64> add_on_content; 27 std::vector<u64> add_on_content;
28 Kernel::EventPair aoc_change_event; 28 Kernel::EventPair aoc_change_event;
29 Core::System& system;
29}; 30};
30 31
31/// Registers all AOC services with the specified service manager. 32/// Registers all AOC services with the specified service manager.
32void InstallInterfaces(SM::ServiceManager& service_manager); 33void InstallInterfaces(SM::ServiceManager& service_manager, Core::System& system);
33 34
34} // namespace Service::AOC 35} // namespace Service::AOC