From 009bdb3558a1b4c0b08d532b61fc2b34076cc824 Mon Sep 17 00:00:00 2001 From: Morph <39850852+Morph1984@users.noreply.github.com> Date: Tue, 8 Dec 2020 09:10:31 -0500 Subject: [PATCH 1/3] aoc_u: Stub Create(Permanent)EcPurchasedEventManager MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - Used by Pokémon Café Mix - Used by DOOM: Eternal --- src/core/hle/service/aoc/aoc_u.cpp | 38 ++++++++++++++++++++++++++++-- src/core/hle/service/aoc/aoc_u.h | 2 ++ 2 files changed, 38 insertions(+), 2 deletions(-) diff --git a/src/core/hle/service/aoc/aoc_u.cpp b/src/core/hle/service/aoc/aoc_u.cpp index 6abac3f78..4e668d062 100644 --- a/src/core/hle/service/aoc/aoc_u.cpp +++ b/src/core/hle/service/aoc/aoc_u.cpp @@ -48,6 +48,24 @@ static std::vector AccumulateAOCTitleIDs(Core::System& system) { return add_on_content; } +class IPurchaseEventManager final : public ServiceFramework { +public: + explicit IPurchaseEventManager(Core::System& system_) + : ServiceFramework{system_, "IPurchaseEventManager"} { + // clang-format off + static const FunctionInfo functions[] = { + {0, nullptr, "SetDefaultDeliveryTarget"}, + {1, nullptr, "SetDeliveryTarget"}, + {2, nullptr, "GetPurchasedEventReadableHandle"}, + {3, nullptr, "PopPurchasedProductInfo"}, + {4, nullptr, "PopPurchasedProductInfoWithUid"}, + }; + // clang-format on + + RegisterHandlers(functions); + } +}; + AOC_U::AOC_U(Core::System& system_) : ServiceFramework{system_, "aoc:u"}, add_on_content{AccumulateAOCTitleIDs(system)} { // clang-format off @@ -62,8 +80,8 @@ AOC_U::AOC_U(Core::System& system_) {7, &AOC_U::PrepareAddOnContent, "PrepareAddOnContent"}, {8, &AOC_U::GetAddOnContentListChangedEvent, "GetAddOnContentListChangedEvent"}, {9, nullptr, "GetAddOnContentLostErrorCode"}, - {100, nullptr, "CreateEcPurchasedEventManager"}, - {101, nullptr, "CreatePermanentEcPurchasedEventManager"}, + {100, &AOC_U::CreateEcPurchasedEventManager, "CreateEcPurchasedEventManager"}, + {101, &AOC_U::CreatePermanentEcPurchasedEventManager, "CreatePermanentEcPurchasedEventManager"}, }; // clang-format on @@ -201,6 +219,22 @@ void AOC_U::GetAddOnContentListChangedEvent(Kernel::HLERequestContext& ctx) { rb.PushCopyObjects(aoc_change_event.readable); } +void AOC_U::CreateEcPurchasedEventManager(Kernel::HLERequestContext& ctx) { + LOG_WARNING(Service_AOC, "(STUBBED) called"); + + IPC::ResponseBuilder rb{ctx, 2, 0, 1}; + rb.Push(RESULT_SUCCESS); + rb.PushIpcInterface(system); +} + +void AOC_U::CreatePermanentEcPurchasedEventManager(Kernel::HLERequestContext& ctx) { + LOG_WARNING(Service_AOC, "(STUBBED) called"); + + IPC::ResponseBuilder rb{ctx, 2, 0, 1}; + rb.Push(RESULT_SUCCESS); + rb.PushIpcInterface(system); +} + void InstallInterfaces(SM::ServiceManager& service_manager, Core::System& system) { std::make_shared(system)->InstallAsService(service_manager); } diff --git a/src/core/hle/service/aoc/aoc_u.h b/src/core/hle/service/aoc/aoc_u.h index 7628f4568..26ee51be0 100644 --- a/src/core/hle/service/aoc/aoc_u.h +++ b/src/core/hle/service/aoc/aoc_u.h @@ -27,6 +27,8 @@ private: void GetAddOnContentBaseId(Kernel::HLERequestContext& ctx); void PrepareAddOnContent(Kernel::HLERequestContext& ctx); void GetAddOnContentListChangedEvent(Kernel::HLERequestContext& ctx); + void CreateEcPurchasedEventManager(Kernel::HLERequestContext& ctx); + void CreatePermanentEcPurchasedEventManager(Kernel::HLERequestContext& ctx); std::vector add_on_content; Kernel::EventPair aoc_change_event; From a9cfe06aaf3fbaf7e16c31f80a75115a07f0af80 Mon Sep 17 00:00:00 2001 From: Morph <39850852+Morph1984@users.noreply.github.com> Date: Tue, 8 Dec 2020 10:55:44 -0500 Subject: [PATCH 2/3] IPurchaseEventManager: Stub Set(Default)DeliveryTarget MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - Used by Pokémon Café Mix - Used by DOOM: Eternal --- src/core/hle/service/aoc/aoc_u.cpp | 29 +++++++++++++++++++++++++++-- 1 file changed, 27 insertions(+), 2 deletions(-) diff --git a/src/core/hle/service/aoc/aoc_u.cpp b/src/core/hle/service/aoc/aoc_u.cpp index 4e668d062..6223e8fb2 100644 --- a/src/core/hle/service/aoc/aoc_u.cpp +++ b/src/core/hle/service/aoc/aoc_u.cpp @@ -54,8 +54,8 @@ public: : ServiceFramework{system_, "IPurchaseEventManager"} { // clang-format off static const FunctionInfo functions[] = { - {0, nullptr, "SetDefaultDeliveryTarget"}, - {1, nullptr, "SetDeliveryTarget"}, + {0, &IPurchaseEventManager::SetDefaultDeliveryTarget, "SetDefaultDeliveryTarget"}, + {1, &IPurchaseEventManager::SetDeliveryTarget, "SetDeliveryTarget"}, {2, nullptr, "GetPurchasedEventReadableHandle"}, {3, nullptr, "PopPurchasedProductInfo"}, {4, nullptr, "PopPurchasedProductInfoWithUid"}, @@ -64,6 +64,31 @@ public: RegisterHandlers(functions); } + +private: + void SetDefaultDeliveryTarget(Kernel::HLERequestContext& ctx) { + IPC::RequestParser rp{ctx}; + + const auto unknown_1 = rp.Pop(); + [[maybe_unused]] const auto unknown_2 = ctx.ReadBuffer(); + + LOG_WARNING(Service_AOC, "(STUBBED) called, unknown_1={}", unknown_1); + + IPC::ResponseBuilder rb{ctx, 2}; + rb.Push(RESULT_SUCCESS); + } + + void SetDeliveryTarget(Kernel::HLERequestContext& ctx) { + IPC::RequestParser rp{ctx}; + + const auto unknown_1 = rp.Pop(); + [[maybe_unused]] const auto unknown_2 = ctx.ReadBuffer(); + + LOG_WARNING(Service_AOC, "(STUBBED) called, unknown_1={}", unknown_1); + + IPC::ResponseBuilder rb{ctx, 2}; + rb.Push(RESULT_SUCCESS); + } }; AOC_U::AOC_U(Core::System& system_) From deff708cbea0409ba6487b3c7a326a436d821924 Mon Sep 17 00:00:00 2001 From: Morph <39850852+Morph1984@users.noreply.github.com> Date: Tue, 8 Dec 2020 10:56:13 -0500 Subject: [PATCH 3/3] IPurchaseEventManager: Implement GetPurchasedEventReadableHandle MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - Used by Pokémon Café Mix - Used by DOOM: Eternal --- src/core/hle/service/aoc/aoc_u.cpp | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/src/core/hle/service/aoc/aoc_u.cpp b/src/core/hle/service/aoc/aoc_u.cpp index 6223e8fb2..9c404db96 100644 --- a/src/core/hle/service/aoc/aoc_u.cpp +++ b/src/core/hle/service/aoc/aoc_u.cpp @@ -56,13 +56,16 @@ public: static const FunctionInfo functions[] = { {0, &IPurchaseEventManager::SetDefaultDeliveryTarget, "SetDefaultDeliveryTarget"}, {1, &IPurchaseEventManager::SetDeliveryTarget, "SetDeliveryTarget"}, - {2, nullptr, "GetPurchasedEventReadableHandle"}, + {2, &IPurchaseEventManager::GetPurchasedEventReadableHandle, "GetPurchasedEventReadableHandle"}, {3, nullptr, "PopPurchasedProductInfo"}, {4, nullptr, "PopPurchasedProductInfoWithUid"}, }; // clang-format on RegisterHandlers(functions); + + purchased_event = Kernel::WritableEvent::CreateEventPair( + system.Kernel(), "IPurchaseEventManager:PurchasedEvent"); } private: @@ -89,6 +92,16 @@ private: IPC::ResponseBuilder rb{ctx, 2}; rb.Push(RESULT_SUCCESS); } + + void GetPurchasedEventReadableHandle(Kernel::HLERequestContext& ctx) { + LOG_WARNING(Service_AOC, "called"); + + IPC::ResponseBuilder rb{ctx, 2, 1}; + rb.Push(RESULT_SUCCESS); + rb.PushCopyObjects(purchased_event.readable); + } + + Kernel::EventPair purchased_event; }; AOC_U::AOC_U(Core::System& system_)