diff options
Diffstat (limited to 'src/core')
| -rw-r--r-- | src/core/hle/service/aoc/aoc_u.cpp | 69 |
1 files changed, 50 insertions, 19 deletions
diff --git a/src/core/hle/service/aoc/aoc_u.cpp b/src/core/hle/service/aoc/aoc_u.cpp index bd4e38461..d3e97776b 100644 --- a/src/core/hle/service/aoc/aoc_u.cpp +++ b/src/core/hle/service/aoc/aoc_u.cpp | |||
| @@ -9,7 +9,6 @@ | |||
| 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/nca_metadata.h" | 11 | #include "core/file_sys/nca_metadata.h" |
| 12 | #include "core/file_sys/partition_filesystem.h" | ||
| 13 | #include "core/file_sys/patch_manager.h" | 12 | #include "core/file_sys/patch_manager.h" |
| 14 | #include "core/file_sys/registered_cache.h" | 13 | #include "core/file_sys/registered_cache.h" |
| 15 | #include "core/hle/ipc_helpers.h" | 14 | #include "core/hle/ipc_helpers.h" |
| @@ -18,7 +17,6 @@ | |||
| 18 | #include "core/hle/kernel/readable_event.h" | 17 | #include "core/hle/kernel/readable_event.h" |
| 19 | #include "core/hle/kernel/writable_event.h" | 18 | #include "core/hle/kernel/writable_event.h" |
| 20 | #include "core/hle/service/aoc/aoc_u.h" | 19 | #include "core/hle/service/aoc/aoc_u.h" |
| 21 | #include "core/hle/service/filesystem/filesystem.h" | ||
| 22 | #include "core/loader/loader.h" | 20 | #include "core/loader/loader.h" |
| 23 | #include "core/settings.h" | 21 | #include "core/settings.h" |
| 24 | 22 | ||
| @@ -75,7 +73,15 @@ AOC_U::AOC_U() : ServiceFramework("aoc:u"), add_on_content(AccumulateAOCTitleIDs | |||
| 75 | AOC_U::~AOC_U() = default; | 73 | AOC_U::~AOC_U() = default; |
| 76 | 74 | ||
| 77 | void AOC_U::CountAddOnContent(Kernel::HLERequestContext& ctx) { | 75 | void AOC_U::CountAddOnContent(Kernel::HLERequestContext& ctx) { |
| 78 | LOG_DEBUG(Service_AOC, "called"); | 76 | struct Parameters { |
| 77 | u64 process_id; | ||
| 78 | }; | ||
| 79 | static_assert(sizeof(Parameters) == 8); | ||
| 80 | |||
| 81 | IPC::RequestParser rp{ctx}; | ||
| 82 | const auto params = rp.PopRaw<Parameters>(); | ||
| 83 | |||
| 84 | LOG_DEBUG(Service_AOC, "called. process_id={}", params.process_id); | ||
| 79 | 85 | ||
| 80 | IPC::ResponseBuilder rb{ctx, 3}; | 86 | IPC::ResponseBuilder rb{ctx, 3}; |
| 81 | rb.Push(RESULT_SUCCESS); | 87 | rb.Push(RESULT_SUCCESS); |
| @@ -94,23 +100,32 @@ void AOC_U::CountAddOnContent(Kernel::HLERequestContext& ctx) { | |||
| 94 | } | 100 | } |
| 95 | 101 | ||
| 96 | void AOC_U::ListAddOnContent(Kernel::HLERequestContext& ctx) { | 102 | void AOC_U::ListAddOnContent(Kernel::HLERequestContext& ctx) { |
| 103 | struct Parameters { | ||
| 104 | u32 offset; | ||
| 105 | u32 count; | ||
| 106 | u64 process_id; | ||
| 107 | }; | ||
| 108 | static_assert(sizeof(Parameters) == 16); | ||
| 109 | |||
| 97 | IPC::RequestParser rp{ctx}; | 110 | IPC::RequestParser rp{ctx}; |
| 111 | const auto [offset, count, process_id] = rp.PopRaw<Parameters>(); | ||
| 98 | 112 | ||
| 99 | const auto offset = rp.PopRaw<u32>(); | 113 | LOG_DEBUG(Service_AOC, "called with offset={}, count={}, process_id={}", offset, count, |
| 100 | auto count = rp.PopRaw<u32>(); | 114 | process_id); |
| 101 | LOG_DEBUG(Service_AOC, "called with offset={}, count={}", offset, count); | ||
| 102 | 115 | ||
| 103 | const auto current = Core::System::GetInstance().CurrentProcess()->GetTitleID(); | 116 | const auto current = Core::System::GetInstance().CurrentProcess()->GetTitleID(); |
| 104 | 117 | ||
| 105 | std::vector<u32> out; | 118 | std::vector<u32> out; |
| 106 | for (size_t i = 0; i < add_on_content.size(); ++i) { | ||
| 107 | if ((add_on_content[i] & DLC_BASE_TITLE_ID_MASK) == current) | ||
| 108 | out.push_back(static_cast<u32>(add_on_content[i] & 0x7FF)); | ||
| 109 | } | ||
| 110 | |||
| 111 | const auto& disabled = Settings::values.disabled_addons[current]; | 119 | const auto& disabled = Settings::values.disabled_addons[current]; |
| 112 | if (std::find(disabled.begin(), disabled.end(), "DLC") != disabled.end()) | 120 | if (std::find(disabled.begin(), disabled.end(), "DLC") == disabled.end()) { |
| 113 | out = {}; | 121 | for (u64 content_id : add_on_content) { |
| 122 | if ((content_id & DLC_BASE_TITLE_ID_MASK) != current) { | ||
| 123 | continue; | ||
| 124 | } | ||
| 125 | |||
| 126 | out.push_back(static_cast<u32>(content_id & 0x7FF)); | ||
| 127 | } | ||
| 128 | } | ||
| 114 | 129 | ||
| 115 | if (out.size() < offset) { | 130 | if (out.size() < offset) { |
| 116 | IPC::ResponseBuilder rb{ctx, 2}; | 131 | IPC::ResponseBuilder rb{ctx, 2}; |
| @@ -119,22 +134,31 @@ void AOC_U::ListAddOnContent(Kernel::HLERequestContext& ctx) { | |||
| 119 | return; | 134 | return; |
| 120 | } | 135 | } |
| 121 | 136 | ||
| 122 | count = static_cast<u32>(std::min<size_t>(out.size() - offset, count)); | 137 | const auto out_count = static_cast<u32>(std::min<size_t>(out.size() - offset, count)); |
| 123 | std::rotate(out.begin(), out.begin() + offset, out.end()); | 138 | std::rotate(out.begin(), out.begin() + offset, out.end()); |
| 124 | out.resize(count); | 139 | out.resize(out_count); |
| 125 | 140 | ||
| 126 | ctx.WriteBuffer(out); | 141 | ctx.WriteBuffer(out); |
| 127 | 142 | ||
| 128 | IPC::ResponseBuilder rb{ctx, 3}; | 143 | IPC::ResponseBuilder rb{ctx, 3}; |
| 129 | rb.Push(RESULT_SUCCESS); | 144 | rb.Push(RESULT_SUCCESS); |
| 130 | rb.Push(count); | 145 | rb.Push(out_count); |
| 131 | } | 146 | } |
| 132 | 147 | ||
| 133 | void AOC_U::GetAddOnContentBaseId(Kernel::HLERequestContext& ctx) { | 148 | void AOC_U::GetAddOnContentBaseId(Kernel::HLERequestContext& ctx) { |
| 134 | LOG_DEBUG(Service_AOC, "called"); | 149 | struct Parameters { |
| 150 | u64 process_id; | ||
| 151 | }; | ||
| 152 | static_assert(sizeof(Parameters) == 8); | ||
| 153 | |||
| 154 | IPC::RequestParser rp{ctx}; | ||
| 155 | const auto params = rp.PopRaw<Parameters>(); | ||
| 156 | |||
| 157 | LOG_DEBUG(Service_AOC, "called. process_id={}", params.process_id); | ||
| 135 | 158 | ||
| 136 | IPC::ResponseBuilder rb{ctx, 4}; | 159 | IPC::ResponseBuilder rb{ctx, 4}; |
| 137 | rb.Push(RESULT_SUCCESS); | 160 | rb.Push(RESULT_SUCCESS); |
| 161 | |||
| 138 | const auto title_id = Core::System::GetInstance().CurrentProcess()->GetTitleID(); | 162 | const auto title_id = Core::System::GetInstance().CurrentProcess()->GetTitleID(); |
| 139 | FileSys::PatchManager pm{title_id}; | 163 | FileSys::PatchManager pm{title_id}; |
| 140 | 164 | ||
| @@ -148,10 +172,17 @@ void AOC_U::GetAddOnContentBaseId(Kernel::HLERequestContext& ctx) { | |||
| 148 | } | 172 | } |
| 149 | 173 | ||
| 150 | void AOC_U::PrepareAddOnContent(Kernel::HLERequestContext& ctx) { | 174 | void AOC_U::PrepareAddOnContent(Kernel::HLERequestContext& ctx) { |
| 175 | struct Parameters { | ||
| 176 | s32 addon_index; | ||
| 177 | u64 process_id; | ||
| 178 | }; | ||
| 179 | static_assert(sizeof(Parameters) == 16); | ||
| 180 | |||
| 151 | IPC::RequestParser rp{ctx}; | 181 | IPC::RequestParser rp{ctx}; |
| 182 | const auto [addon_index, process_id] = rp.PopRaw<Parameters>(); | ||
| 152 | 183 | ||
| 153 | const auto aoc_id = rp.PopRaw<u32>(); | 184 | LOG_WARNING(Service_AOC, "(STUBBED) called with addon_index={}, process_id={}", addon_index, |
| 154 | LOG_WARNING(Service_AOC, "(STUBBED) called with aoc_id={:08X}", aoc_id); | 185 | process_id); |
| 155 | 186 | ||
| 156 | IPC::ResponseBuilder rb{ctx, 2}; | 187 | IPC::ResponseBuilder rb{ctx, 2}; |
| 157 | rb.Push(RESULT_SUCCESS); | 188 | rb.Push(RESULT_SUCCESS); |