diff options
| author | 2024-02-19 17:20:02 +0100 | |
|---|---|---|
| committer | 2024-02-19 17:20:02 +0100 | |
| commit | a2a0be424638365c9348bbe16d1db9706b690f8c (patch) | |
| tree | f81fc557c2e00364ea1fe47b35277e03f4f43ba8 /src/core/hle/service | |
| parent | core/aoc: Move IPurchaseEventManager to separate file (diff) | |
| download | yuzu-a2a0be424638365c9348bbe16d1db9706b690f8c.tar.gz yuzu-a2a0be424638365c9348bbe16d1db9706b690f8c.tar.xz yuzu-a2a0be424638365c9348bbe16d1db9706b690f8c.zip | |
aoc: Migrate to use cmif serialization
Diffstat (limited to 'src/core/hle/service')
| -rw-r--r-- | src/core/hle/service/aoc/aoc_u.cpp | 168 | ||||
| -rw-r--r-- | src/core/hle/service/aoc/aoc_u.h | 30 | ||||
| -rw-r--r-- | src/core/hle/service/aoc/purchase_event_manager.cpp | 56 | ||||
| -rw-r--r-- | src/core/hle/service/aoc/purchase_event_manager.h | 12 |
4 files changed, 109 insertions, 157 deletions
diff --git a/src/core/hle/service/aoc/aoc_u.cpp b/src/core/hle/service/aoc/aoc_u.cpp index 31c7385ee..82b95b704 100644 --- a/src/core/hle/service/aoc/aoc_u.cpp +++ b/src/core/hle/service/aoc/aoc_u.cpp | |||
| @@ -17,6 +17,7 @@ | |||
| 17 | #include "core/hle/kernel/k_event.h" | 17 | #include "core/hle/kernel/k_event.h" |
| 18 | #include "core/hle/service/aoc/aoc_u.h" | 18 | #include "core/hle/service/aoc/aoc_u.h" |
| 19 | #include "core/hle/service/aoc/purchase_event_manager.h" | 19 | #include "core/hle/service/aoc/purchase_event_manager.h" |
| 20 | #include "core/hle/service/cmif_serialization.h" | ||
| 20 | #include "core/hle/service/ipc_helpers.h" | 21 | #include "core/hle/service/ipc_helpers.h" |
| 21 | #include "core/hle/service/server_manager.h" | 22 | #include "core/hle/service/server_manager.h" |
| 22 | #include "core/loader/loader.h" | 23 | #include "core/loader/loader.h" |
| @@ -52,21 +53,21 @@ AOC_U::AOC_U(Core::System& system_) | |||
| 52 | static const FunctionInfo functions[] = { | 53 | static const FunctionInfo functions[] = { |
| 53 | {0, nullptr, "CountAddOnContentByApplicationId"}, | 54 | {0, nullptr, "CountAddOnContentByApplicationId"}, |
| 54 | {1, nullptr, "ListAddOnContentByApplicationId"}, | 55 | {1, nullptr, "ListAddOnContentByApplicationId"}, |
| 55 | {2, &AOC_U::CountAddOnContent, "CountAddOnContent"}, | 56 | {2, D<&AOC_U::CountAddOnContent>, "CountAddOnContent"}, |
| 56 | {3, &AOC_U::ListAddOnContent, "ListAddOnContent"}, | 57 | {3, D<&AOC_U::ListAddOnContent>, "ListAddOnContent"}, |
| 57 | {4, nullptr, "GetAddOnContentBaseIdByApplicationId"}, | 58 | {4, nullptr, "GetAddOnContentBaseIdByApplicationId"}, |
| 58 | {5, &AOC_U::GetAddOnContentBaseId, "GetAddOnContentBaseId"}, | 59 | {5, D<&AOC_U::GetAddOnContentBaseId>, "GetAddOnContentBaseId"}, |
| 59 | {6, nullptr, "PrepareAddOnContentByApplicationId"}, | 60 | {6, nullptr, "PrepareAddOnContentByApplicationId"}, |
| 60 | {7, &AOC_U::PrepareAddOnContent, "PrepareAddOnContent"}, | 61 | {7, D<&AOC_U::PrepareAddOnContent>, "PrepareAddOnContent"}, |
| 61 | {8, &AOC_U::GetAddOnContentListChangedEvent, "GetAddOnContentListChangedEvent"}, | 62 | {8, D<&AOC_U::GetAddOnContentListChangedEvent>, "GetAddOnContentListChangedEvent"}, |
| 62 | {9, nullptr, "GetAddOnContentLostErrorCode"}, | 63 | {9, nullptr, "GetAddOnContentLostErrorCode"}, |
| 63 | {10, &AOC_U::GetAddOnContentListChangedEventWithProcessId, "GetAddOnContentListChangedEventWithProcessId"}, | 64 | {10, D<&AOC_U::GetAddOnContentListChangedEventWithProcessId>, "GetAddOnContentListChangedEventWithProcessId"}, |
| 64 | {11, &AOC_U::NotifyMountAddOnContent, "NotifyMountAddOnContent"}, | 65 | {11, D<&AOC_U::NotifyMountAddOnContent>, "NotifyMountAddOnContent"}, |
| 65 | {12, &AOC_U::NotifyUnmountAddOnContent, "NotifyUnmountAddOnContent"}, | 66 | {12, D<&AOC_U::NotifyUnmountAddOnContent>, "NotifyUnmountAddOnContent"}, |
| 66 | {13, nullptr, "IsAddOnContentMountedForDebug"}, | 67 | {13, nullptr, "IsAddOnContentMountedForDebug"}, |
| 67 | {50, &AOC_U::CheckAddOnContentMountStatus, "CheckAddOnContentMountStatus"}, | 68 | {50, D<&AOC_U::CheckAddOnContentMountStatus>, "CheckAddOnContentMountStatus"}, |
| 68 | {100, &AOC_U::CreateEcPurchasedEventManager, "CreateEcPurchasedEventManager"}, | 69 | {100, D<&AOC_U::CreateEcPurchasedEventManager>, "CreateEcPurchasedEventManager"}, |
| 69 | {101, &AOC_U::CreatePermanentEcPurchasedEventManager, "CreatePermanentEcPurchasedEventManager"}, | 70 | {101, D<&AOC_U::CreatePermanentEcPurchasedEventManager>, "CreatePermanentEcPurchasedEventManager"}, |
| 70 | {110, nullptr, "CreateContentsServiceManager"}, | 71 | {110, nullptr, "CreateContentsServiceManager"}, |
| 71 | {200, nullptr, "SetRequiredAddOnContentsOnContentsAvailabilityTransition"}, | 72 | {200, nullptr, "SetRequiredAddOnContentsOnContentsAvailabilityTransition"}, |
| 72 | {300, nullptr, "SetupHostAddOnContent"}, | 73 | {300, nullptr, "SetupHostAddOnContent"}, |
| @@ -84,46 +85,28 @@ AOC_U::~AOC_U() { | |||
| 84 | service_context.CloseEvent(aoc_change_event); | 85 | service_context.CloseEvent(aoc_change_event); |
| 85 | } | 86 | } |
| 86 | 87 | ||
| 87 | void AOC_U::CountAddOnContent(HLERequestContext& ctx) { | 88 | Result AOC_U::CountAddOnContent(Out<u32> out_count, ClientProcessId process_id) { |
| 88 | struct Parameters { | 89 | LOG_DEBUG(Service_AOC, "called. process_id={}", process_id.pid); |
| 89 | u64 process_id; | ||
| 90 | }; | ||
| 91 | static_assert(sizeof(Parameters) == 8); | ||
| 92 | |||
| 93 | IPC::RequestParser rp{ctx}; | ||
| 94 | const auto params = rp.PopRaw<Parameters>(); | ||
| 95 | |||
| 96 | LOG_DEBUG(Service_AOC, "called. process_id={}", params.process_id); | ||
| 97 | |||
| 98 | IPC::ResponseBuilder rb{ctx, 3}; | ||
| 99 | rb.Push(ResultSuccess); | ||
| 100 | 90 | ||
| 101 | const auto current = system.GetApplicationProcessProgramID(); | 91 | const auto current = system.GetApplicationProcessProgramID(); |
| 102 | 92 | ||
| 103 | const auto& disabled = Settings::values.disabled_addons[current]; | 93 | const auto& disabled = Settings::values.disabled_addons[current]; |
| 104 | if (std::find(disabled.begin(), disabled.end(), "DLC") != disabled.end()) { | 94 | if (std::find(disabled.begin(), disabled.end(), "DLC") != disabled.end()) { |
| 105 | rb.Push<u32>(0); | 95 | *out_count = 0; |
| 106 | return; | 96 | R_SUCCEED(); |
| 107 | } | 97 | } |
| 108 | 98 | ||
| 109 | rb.Push<u32>(static_cast<u32>( | 99 | *out_count = static_cast<u32>( |
| 110 | std::count_if(add_on_content.begin(), add_on_content.end(), | 100 | std::count_if(add_on_content.begin(), add_on_content.end(), |
| 111 | [current](u64 tid) { return CheckAOCTitleIDMatchesBase(tid, current); }))); | 101 | [current](u64 tid) { return CheckAOCTitleIDMatchesBase(tid, current); })); |
| 112 | } | ||
| 113 | 102 | ||
| 114 | void AOC_U::ListAddOnContent(HLERequestContext& ctx) { | 103 | R_SUCCEED(); |
| 115 | struct Parameters { | 104 | } |
| 116 | u32 offset; | ||
| 117 | u32 count; | ||
| 118 | u64 process_id; | ||
| 119 | }; | ||
| 120 | static_assert(sizeof(Parameters) == 16); | ||
| 121 | |||
| 122 | IPC::RequestParser rp{ctx}; | ||
| 123 | const auto [offset, count, process_id] = rp.PopRaw<Parameters>(); | ||
| 124 | 105 | ||
| 106 | Result AOC_U::ListAddOnContent(Out<u32> out_count, OutBuffer<BufferAttr_HipcMapAlias> out_addons, | ||
| 107 | u32 offset, u32 count, ClientProcessId process_id) { | ||
| 125 | LOG_DEBUG(Service_AOC, "called with offset={}, count={}, process_id={}", offset, count, | 108 | LOG_DEBUG(Service_AOC, "called with offset={}, count={}, process_id={}", offset, count, |
| 126 | process_id); | 109 | process_id.pid); |
| 127 | 110 | ||
| 128 | const auto current = FileSys::GetBaseTitleID(system.GetApplicationProcessProgramID()); | 111 | const auto current = FileSys::GetBaseTitleID(system.GetApplicationProcessProgramID()); |
| 129 | 112 | ||
| @@ -139,37 +122,19 @@ void AOC_U::ListAddOnContent(HLERequestContext& ctx) { | |||
| 139 | } | 122 | } |
| 140 | } | 123 | } |
| 141 | 124 | ||
| 142 | if (out.size() < offset) { | 125 | // TODO(DarkLordZach): Find the correct error code. |
| 143 | IPC::ResponseBuilder rb{ctx, 2}; | 126 | R_UNLESS(out.size() >= offset, ResultUnknown); |
| 144 | // TODO(DarkLordZach): Find the correct error code. | ||
| 145 | rb.Push(ResultUnknown); | ||
| 146 | return; | ||
| 147 | } | ||
| 148 | 127 | ||
| 149 | const auto out_count = static_cast<u32>(std::min<size_t>(out.size() - offset, count)); | 128 | *out_count = static_cast<u32>(std::min<size_t>(out.size() - offset, count)); |
| 150 | std::rotate(out.begin(), out.begin() + offset, out.end()); | 129 | std::rotate(out.begin(), out.begin() + offset, out.end()); |
| 151 | out.resize(out_count); | ||
| 152 | 130 | ||
| 153 | ctx.WriteBuffer(out); | 131 | std::memcpy(out_addons.data(), out.data(), *out_count); |
| 154 | 132 | ||
| 155 | IPC::ResponseBuilder rb{ctx, 3}; | 133 | R_SUCCEED(); |
| 156 | rb.Push(ResultSuccess); | ||
| 157 | rb.Push(out_count); | ||
| 158 | } | 134 | } |
| 159 | 135 | ||
| 160 | void AOC_U::GetAddOnContentBaseId(HLERequestContext& ctx) { | 136 | Result AOC_U::GetAddOnContentBaseId(Out<u64> out_title_id, ClientProcessId process_id) { |
| 161 | struct Parameters { | 137 | LOG_DEBUG(Service_AOC, "called. process_id={}", process_id.pid); |
| 162 | u64 process_id; | ||
| 163 | }; | ||
| 164 | static_assert(sizeof(Parameters) == 8); | ||
| 165 | |||
| 166 | IPC::RequestParser rp{ctx}; | ||
| 167 | const auto params = rp.PopRaw<Parameters>(); | ||
| 168 | |||
| 169 | LOG_DEBUG(Service_AOC, "called. process_id={}", params.process_id); | ||
| 170 | |||
| 171 | IPC::ResponseBuilder rb{ctx, 4}; | ||
| 172 | rb.Push(ResultSuccess); | ||
| 173 | 138 | ||
| 174 | const auto title_id = system.GetApplicationProcessProgramID(); | 139 | const auto title_id = system.GetApplicationProcessProgramID(); |
| 175 | const FileSys::PatchManager pm{title_id, system.GetFileSystemController(), | 140 | const FileSys::PatchManager pm{title_id, system.GetFileSystemController(), |
| @@ -177,81 +142,72 @@ void AOC_U::GetAddOnContentBaseId(HLERequestContext& ctx) { | |||
| 177 | 142 | ||
| 178 | const auto res = pm.GetControlMetadata(); | 143 | const auto res = pm.GetControlMetadata(); |
| 179 | if (res.first == nullptr) { | 144 | if (res.first == nullptr) { |
| 180 | rb.Push(FileSys::GetAOCBaseTitleID(title_id)); | 145 | *out_title_id = FileSys::GetAOCBaseTitleID(title_id); |
| 181 | return; | 146 | R_SUCCEED(); |
| 182 | } | 147 | } |
| 183 | 148 | ||
| 184 | rb.Push(res.first->GetDLCBaseTitleId()); | 149 | *out_title_id = res.first->GetDLCBaseTitleId(); |
| 185 | } | ||
| 186 | |||
| 187 | void AOC_U::PrepareAddOnContent(HLERequestContext& ctx) { | ||
| 188 | struct Parameters { | ||
| 189 | s32 addon_index; | ||
| 190 | u64 process_id; | ||
| 191 | }; | ||
| 192 | static_assert(sizeof(Parameters) == 16); | ||
| 193 | 150 | ||
| 194 | IPC::RequestParser rp{ctx}; | 151 | R_SUCCEED(); |
| 195 | const auto [addon_index, process_id] = rp.PopRaw<Parameters>(); | 152 | } |
| 196 | 153 | ||
| 154 | Result AOC_U::PrepareAddOnContent(s32 addon_index, ClientProcessId process_id) { | ||
| 197 | LOG_WARNING(Service_AOC, "(STUBBED) called with addon_index={}, process_id={}", addon_index, | 155 | LOG_WARNING(Service_AOC, "(STUBBED) called with addon_index={}, process_id={}", addon_index, |
| 198 | process_id); | 156 | process_id.pid); |
| 199 | 157 | ||
| 200 | IPC::ResponseBuilder rb{ctx, 2}; | 158 | R_SUCCEED(); |
| 201 | rb.Push(ResultSuccess); | ||
| 202 | } | 159 | } |
| 203 | 160 | ||
| 204 | void AOC_U::GetAddOnContentListChangedEvent(HLERequestContext& ctx) { | 161 | Result AOC_U::GetAddOnContentListChangedEvent(OutCopyHandle<Kernel::KReadableEvent> out_event) { |
| 205 | LOG_WARNING(Service_AOC, "(STUBBED) called"); | 162 | LOG_WARNING(Service_AOC, "(STUBBED) called"); |
| 206 | 163 | ||
| 207 | IPC::ResponseBuilder rb{ctx, 2, 1}; | 164 | *out_event = &aoc_change_event->GetReadableEvent(); |
| 208 | rb.Push(ResultSuccess); | 165 | |
| 209 | rb.PushCopyObjects(aoc_change_event->GetReadableEvent()); | 166 | R_SUCCEED(); |
| 210 | } | 167 | } |
| 211 | 168 | ||
| 212 | void AOC_U::GetAddOnContentListChangedEventWithProcessId(HLERequestContext& ctx) { | 169 | Result AOC_U::GetAddOnContentListChangedEventWithProcessId( |
| 170 | OutCopyHandle<Kernel::KReadableEvent> out_event, ClientProcessId process_id) { | ||
| 213 | LOG_WARNING(Service_AOC, "(STUBBED) called"); | 171 | LOG_WARNING(Service_AOC, "(STUBBED) called"); |
| 214 | 172 | ||
| 215 | IPC::ResponseBuilder rb{ctx, 2, 1}; | 173 | *out_event = &aoc_change_event->GetReadableEvent(); |
| 216 | rb.Push(ResultSuccess); | 174 | |
| 217 | rb.PushCopyObjects(aoc_change_event->GetReadableEvent()); | 175 | R_SUCCEED(); |
| 218 | } | 176 | } |
| 219 | 177 | ||
| 220 | void AOC_U::NotifyMountAddOnContent(HLERequestContext& ctx) { | 178 | Result AOC_U::NotifyMountAddOnContent() { |
| 221 | LOG_WARNING(Service_AOC, "(STUBBED) called"); | 179 | LOG_WARNING(Service_AOC, "(STUBBED) called"); |
| 222 | 180 | ||
| 223 | IPC::ResponseBuilder rb{ctx, 2}; | 181 | R_SUCCEED(); |
| 224 | rb.Push(ResultSuccess); | ||
| 225 | } | 182 | } |
| 226 | 183 | ||
| 227 | void AOC_U::NotifyUnmountAddOnContent(HLERequestContext& ctx) { | 184 | Result AOC_U::NotifyUnmountAddOnContent() { |
| 228 | LOG_WARNING(Service_AOC, "(STUBBED) called"); | 185 | LOG_WARNING(Service_AOC, "(STUBBED) called"); |
| 229 | 186 | ||
| 230 | IPC::ResponseBuilder rb{ctx, 2}; | 187 | R_SUCCEED(); |
| 231 | rb.Push(ResultSuccess); | ||
| 232 | } | 188 | } |
| 233 | 189 | ||
| 234 | void AOC_U::CheckAddOnContentMountStatus(HLERequestContext& ctx) { | 190 | Result AOC_U::CheckAddOnContentMountStatus() { |
| 235 | LOG_WARNING(Service_AOC, "(STUBBED) called"); | 191 | LOG_WARNING(Service_AOC, "(STUBBED) called"); |
| 236 | 192 | ||
| 237 | IPC::ResponseBuilder rb{ctx, 2}; | 193 | R_SUCCEED(); |
| 238 | rb.Push(ResultSuccess); | ||
| 239 | } | 194 | } |
| 240 | 195 | ||
| 241 | void AOC_U::CreateEcPurchasedEventManager(HLERequestContext& ctx) { | 196 | Result AOC_U::CreateEcPurchasedEventManager(OutInterface<IPurchaseEventManager> out_interface) { |
| 242 | LOG_WARNING(Service_AOC, "(STUBBED) called"); | 197 | LOG_WARNING(Service_AOC, "(STUBBED) called"); |
| 243 | 198 | ||
| 244 | IPC::ResponseBuilder rb{ctx, 2, 0, 1}; | 199 | *out_interface = std::make_shared<IPurchaseEventManager>(system); |
| 245 | rb.Push(ResultSuccess); | 200 | |
| 246 | rb.PushIpcInterface<IPurchaseEventManager>(system); | 201 | R_SUCCEED(); |
| 247 | } | 202 | } |
| 248 | 203 | ||
| 249 | void AOC_U::CreatePermanentEcPurchasedEventManager(HLERequestContext& ctx) { | 204 | Result AOC_U::CreatePermanentEcPurchasedEventManager( |
| 205 | OutInterface<IPurchaseEventManager> out_interface) { | ||
| 250 | LOG_WARNING(Service_AOC, "(STUBBED) called"); | 206 | LOG_WARNING(Service_AOC, "(STUBBED) called"); |
| 251 | 207 | ||
| 252 | IPC::ResponseBuilder rb{ctx, 2, 0, 1}; | 208 | *out_interface = std::make_shared<IPurchaseEventManager>(system); |
| 253 | rb.Push(ResultSuccess); | 209 | |
| 254 | rb.PushIpcInterface<IPurchaseEventManager>(system); | 210 | R_SUCCEED(); |
| 255 | } | 211 | } |
| 256 | 212 | ||
| 257 | void LoopProcess(Core::System& system) { | 213 | void LoopProcess(Core::System& system) { |
diff --git a/src/core/hle/service/aoc/aoc_u.h b/src/core/hle/service/aoc/aoc_u.h index 12ccfeb6a..c7b94a933 100644 --- a/src/core/hle/service/aoc/aoc_u.h +++ b/src/core/hle/service/aoc/aoc_u.h | |||
| @@ -3,6 +3,7 @@ | |||
| 3 | 3 | ||
| 4 | #pragma once | 4 | #pragma once |
| 5 | 5 | ||
| 6 | #include "core/hle/service/cmif_types.h" | ||
| 6 | #include "core/hle/service/kernel_helpers.h" | 7 | #include "core/hle/service/kernel_helpers.h" |
| 7 | #include "core/hle/service/service.h" | 8 | #include "core/hle/service/service.h" |
| 8 | 9 | ||
| @@ -16,24 +17,29 @@ class KEvent; | |||
| 16 | 17 | ||
| 17 | namespace Service::AOC { | 18 | namespace Service::AOC { |
| 18 | 19 | ||
| 20 | class IPurchaseEventManager; | ||
| 21 | |||
| 19 | class AOC_U final : public ServiceFramework<AOC_U> { | 22 | class AOC_U final : public ServiceFramework<AOC_U> { |
| 20 | public: | 23 | public: |
| 21 | explicit AOC_U(Core::System& system); | 24 | explicit AOC_U(Core::System& system); |
| 22 | ~AOC_U() override; | 25 | ~AOC_U() override; |
| 23 | 26 | ||
| 24 | private: | 27 | Result CountAddOnContent(Out<u32> out_count, ClientProcessId process_id); |
| 25 | void CountAddOnContent(HLERequestContext& ctx); | 28 | Result ListAddOnContent(Out<u32> out_count, OutBuffer<BufferAttr_HipcMapAlias> out_addons, |
| 26 | void ListAddOnContent(HLERequestContext& ctx); | 29 | u32 offset, u32 count, ClientProcessId process_id); |
| 27 | void GetAddOnContentBaseId(HLERequestContext& ctx); | 30 | Result GetAddOnContentBaseId(Out<u64> out_title_id, ClientProcessId process_id); |
| 28 | void PrepareAddOnContent(HLERequestContext& ctx); | 31 | Result PrepareAddOnContent(s32 addon_index, ClientProcessId process_id); |
| 29 | void GetAddOnContentListChangedEvent(HLERequestContext& ctx); | 32 | Result GetAddOnContentListChangedEvent(OutCopyHandle<Kernel::KReadableEvent> out_event); |
| 30 | void GetAddOnContentListChangedEventWithProcessId(HLERequestContext& ctx); | 33 | Result GetAddOnContentListChangedEventWithProcessId( |
| 31 | void NotifyMountAddOnContent(HLERequestContext& ctx); | 34 | OutCopyHandle<Kernel::KReadableEvent> out_event, ClientProcessId process_id); |
| 32 | void NotifyUnmountAddOnContent(HLERequestContext& ctx); | 35 | Result NotifyMountAddOnContent(); |
| 33 | void CheckAddOnContentMountStatus(HLERequestContext& ctx); | 36 | Result NotifyUnmountAddOnContent(); |
| 34 | void CreateEcPurchasedEventManager(HLERequestContext& ctx); | 37 | Result CheckAddOnContentMountStatus(); |
| 35 | void CreatePermanentEcPurchasedEventManager(HLERequestContext& ctx); | 38 | Result CreateEcPurchasedEventManager(OutInterface<IPurchaseEventManager> out_interface); |
| 39 | Result CreatePermanentEcPurchasedEventManager( | ||
| 40 | OutInterface<IPurchaseEventManager> out_interface); | ||
| 36 | 41 | ||
| 42 | private: | ||
| 37 | std::vector<u64> add_on_content; | 43 | std::vector<u64> add_on_content; |
| 38 | KernelHelpers::ServiceContext service_context; | 44 | KernelHelpers::ServiceContext service_context; |
| 39 | 45 | ||
diff --git a/src/core/hle/service/aoc/purchase_event_manager.cpp b/src/core/hle/service/aoc/purchase_event_manager.cpp index 83124cd21..1192263f8 100644 --- a/src/core/hle/service/aoc/purchase_event_manager.cpp +++ b/src/core/hle/service/aoc/purchase_event_manager.cpp | |||
| @@ -2,7 +2,7 @@ | |||
| 2 | // SPDX-License-Identifier: GPL-2.0-or-later | 2 | // SPDX-License-Identifier: GPL-2.0-or-later |
| 3 | 3 | ||
| 4 | #include "core/hle/service/aoc/purchase_event_manager.h" | 4 | #include "core/hle/service/aoc/purchase_event_manager.h" |
| 5 | #include "core/hle/service/ipc_helpers.h" | 5 | #include "core/hle/service/cmif_serialization.h" |
| 6 | 6 | ||
| 7 | namespace Service::AOC { | 7 | namespace Service::AOC { |
| 8 | 8 | ||
| @@ -13,11 +13,11 @@ IPurchaseEventManager::IPurchaseEventManager(Core::System& system_) | |||
| 13 | service_context{system, "IPurchaseEventManager"} { | 13 | service_context{system, "IPurchaseEventManager"} { |
| 14 | // clang-format off | 14 | // clang-format off |
| 15 | static const FunctionInfo functions[] = { | 15 | static const FunctionInfo functions[] = { |
| 16 | {0, &IPurchaseEventManager::SetDefaultDeliveryTarget, "SetDefaultDeliveryTarget"}, | 16 | {0, D<&IPurchaseEventManager::SetDefaultDeliveryTarget>, "SetDefaultDeliveryTarget"}, |
| 17 | {1, &IPurchaseEventManager::SetDeliveryTarget, "SetDeliveryTarget"}, | 17 | {1, D<&IPurchaseEventManager::SetDeliveryTarget>, "SetDeliveryTarget"}, |
| 18 | {2, &IPurchaseEventManager::GetPurchasedEventReadableHandle, "GetPurchasedEventReadableHandle"}, | 18 | {2, D<&IPurchaseEventManager::GetPurchasedEvent>, "GetPurchasedEvent"}, |
| 19 | {3, &IPurchaseEventManager::PopPurchasedProductInfo, "PopPurchasedProductInfo"}, | 19 | {3, D<&IPurchaseEventManager::PopPurchasedProductInfo>, "PopPurchasedProductInfo"}, |
| 20 | {4, &IPurchaseEventManager::PopPurchasedProductInfoWithUid, "PopPurchasedProductInfoWithUid"}, | 20 | {4, D<&IPurchaseEventManager::PopPurchasedProductInfoWithUid>, "PopPurchasedProductInfoWithUid"}, |
| 21 | }; | 21 | }; |
| 22 | // clang-format on | 22 | // clang-format on |
| 23 | 23 | ||
| @@ -30,50 +30,38 @@ IPurchaseEventManager::~IPurchaseEventManager() { | |||
| 30 | service_context.CloseEvent(purchased_event); | 30 | service_context.CloseEvent(purchased_event); |
| 31 | } | 31 | } |
| 32 | 32 | ||
| 33 | void IPurchaseEventManager::SetDefaultDeliveryTarget(HLERequestContext& ctx) { | 33 | Result IPurchaseEventManager::SetDefaultDeliveryTarget( |
| 34 | IPC::RequestParser rp{ctx}; | 34 | ClientProcessId process_id, InBuffer<BufferAttr_HipcMapAlias> in_buffer) { |
| 35 | LOG_WARNING(Service_AOC, "(STUBBED) called, process_id={}", process_id.pid); | ||
| 35 | 36 | ||
| 36 | const auto unknown_1 = rp.Pop<u64>(); | 37 | R_SUCCEED(); |
| 37 | [[maybe_unused]] const auto unknown_2 = ctx.ReadBuffer(); | ||
| 38 | |||
| 39 | LOG_WARNING(Service_AOC, "(STUBBED) called, unknown_1={}", unknown_1); | ||
| 40 | |||
| 41 | IPC::ResponseBuilder rb{ctx, 2}; | ||
| 42 | rb.Push(ResultSuccess); | ||
| 43 | } | 38 | } |
| 44 | 39 | ||
| 45 | void IPurchaseEventManager::SetDeliveryTarget(HLERequestContext& ctx) { | 40 | Result IPurchaseEventManager::SetDeliveryTarget(u64 unknown, |
| 46 | IPC::RequestParser rp{ctx}; | 41 | InBuffer<BufferAttr_HipcMapAlias> in_buffer) { |
| 47 | 42 | LOG_WARNING(Service_AOC, "(STUBBED) called, unknown={}", unknown); | |
| 48 | const auto unknown_1 = rp.Pop<u64>(); | ||
| 49 | [[maybe_unused]] const auto unknown_2 = ctx.ReadBuffer(); | ||
| 50 | 43 | ||
| 51 | LOG_WARNING(Service_AOC, "(STUBBED) called, unknown_1={}", unknown_1); | 44 | R_SUCCEED(); |
| 52 | |||
| 53 | IPC::ResponseBuilder rb{ctx, 2}; | ||
| 54 | rb.Push(ResultSuccess); | ||
| 55 | } | 45 | } |
| 56 | 46 | ||
| 57 | void IPurchaseEventManager::GetPurchasedEventReadableHandle(HLERequestContext& ctx) { | 47 | Result IPurchaseEventManager::GetPurchasedEvent(OutCopyHandle<Kernel::KReadableEvent> out_event) { |
| 58 | LOG_WARNING(Service_AOC, "called"); | 48 | LOG_WARNING(Service_AOC, "called"); |
| 59 | 49 | ||
| 60 | IPC::ResponseBuilder rb{ctx, 2, 1}; | 50 | *out_event = &purchased_event->GetReadableEvent(); |
| 61 | rb.Push(ResultSuccess); | 51 | |
| 62 | rb.PushCopyObjects(purchased_event->GetReadableEvent()); | 52 | R_SUCCEED(); |
| 63 | } | 53 | } |
| 64 | 54 | ||
| 65 | void IPurchaseEventManager::PopPurchasedProductInfo(HLERequestContext& ctx) { | 55 | Result IPurchaseEventManager::PopPurchasedProductInfo() { |
| 66 | LOG_DEBUG(Service_AOC, "(STUBBED) called"); | 56 | LOG_DEBUG(Service_AOC, "(STUBBED) called"); |
| 67 | 57 | ||
| 68 | IPC::ResponseBuilder rb{ctx, 2}; | 58 | R_RETURN(ResultNoPurchasedProductInfoAvailable); |
| 69 | rb.Push(ResultNoPurchasedProductInfoAvailable); | ||
| 70 | } | 59 | } |
| 71 | 60 | ||
| 72 | void IPurchaseEventManager::PopPurchasedProductInfoWithUid(HLERequestContext& ctx) { | 61 | Result IPurchaseEventManager::PopPurchasedProductInfoWithUid() { |
| 73 | LOG_DEBUG(Service_AOC, "(STUBBED) called"); | 62 | LOG_DEBUG(Service_AOC, "(STUBBED) called"); |
| 74 | 63 | ||
| 75 | IPC::ResponseBuilder rb{ctx, 2}; | 64 | R_RETURN(ResultNoPurchasedProductInfoAvailable); |
| 76 | rb.Push(ResultNoPurchasedProductInfoAvailable); | ||
| 77 | } | 65 | } |
| 78 | 66 | ||
| 79 | } // namespace Service::AOC | 67 | } // namespace Service::AOC |
diff --git a/src/core/hle/service/aoc/purchase_event_manager.h b/src/core/hle/service/aoc/purchase_event_manager.h index efde3c8f3..ea3836bc9 100644 --- a/src/core/hle/service/aoc/purchase_event_manager.h +++ b/src/core/hle/service/aoc/purchase_event_manager.h | |||
| @@ -3,6 +3,7 @@ | |||
| 3 | 3 | ||
| 4 | #pragma once | 4 | #pragma once |
| 5 | 5 | ||
| 6 | #include "core/hle/service/cmif_types.h" | ||
| 6 | #include "core/hle/service/kernel_helpers.h" | 7 | #include "core/hle/service/kernel_helpers.h" |
| 7 | #include "core/hle/service/os/event.h" | 8 | #include "core/hle/service/os/event.h" |
| 8 | #include "core/hle/service/service.h" | 9 | #include "core/hle/service/service.h" |
| @@ -14,11 +15,12 @@ public: | |||
| 14 | explicit IPurchaseEventManager(Core::System& system_); | 15 | explicit IPurchaseEventManager(Core::System& system_); |
| 15 | ~IPurchaseEventManager() override; | 16 | ~IPurchaseEventManager() override; |
| 16 | 17 | ||
| 17 | void SetDefaultDeliveryTarget(HLERequestContext& ctx); | 18 | Result SetDefaultDeliveryTarget(ClientProcessId process_id, |
| 18 | void SetDeliveryTarget(HLERequestContext& ctx); | 19 | InBuffer<BufferAttr_HipcMapAlias> in_buffer); |
| 19 | void GetPurchasedEventReadableHandle(HLERequestContext& ctx); | 20 | Result SetDeliveryTarget(u64 unknown, InBuffer<BufferAttr_HipcMapAlias> in_buffer); |
| 20 | void PopPurchasedProductInfo(HLERequestContext& ctx); | 21 | Result GetPurchasedEvent(OutCopyHandle<Kernel::KReadableEvent> out_event); |
| 21 | void PopPurchasedProductInfoWithUid(HLERequestContext& ctx); | 22 | Result PopPurchasedProductInfo(); |
| 23 | Result PopPurchasedProductInfoWithUid(); | ||
| 22 | 24 | ||
| 23 | private: | 25 | private: |
| 24 | KernelHelpers::ServiceContext service_context; | 26 | KernelHelpers::ServiceContext service_context; |