summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/core/CMakeLists.txt2
-rw-r--r--src/core/hle/service/aoc/aoc_u.cpp79
-rw-r--r--src/core/hle/service/aoc/purchase_event_manager.cpp79
-rw-r--r--src/core/hle/service/aoc/purchase_event_manager.h28
4 files changed, 110 insertions, 78 deletions
diff --git a/src/core/CMakeLists.txt b/src/core/CMakeLists.txt
index fa5c4de37..d923a9a55 100644
--- a/src/core/CMakeLists.txt
+++ b/src/core/CMakeLists.txt
@@ -483,6 +483,8 @@ add_library(core STATIC
483 hle/service/am/service/window_controller.h 483 hle/service/am/service/window_controller.h
484 hle/service/aoc/aoc_u.cpp 484 hle/service/aoc/aoc_u.cpp
485 hle/service/aoc/aoc_u.h 485 hle/service/aoc/aoc_u.h
486 hle/service/aoc/purchase_event_manager.cpp
487 hle/service/aoc/purchase_event_manager.h
486 hle/service/apm/apm.cpp 488 hle/service/apm/apm.cpp
487 hle/service/apm/apm.h 489 hle/service/apm/apm.h
488 hle/service/apm/apm_controller.cpp 490 hle/service/apm/apm_controller.cpp
diff --git a/src/core/hle/service/aoc/aoc_u.cpp b/src/core/hle/service/aoc/aoc_u.cpp
index 486719cc0..31c7385ee 100644
--- a/src/core/hle/service/aoc/aoc_u.cpp
+++ b/src/core/hle/service/aoc/aoc_u.cpp
@@ -16,14 +16,13 @@
16#include "core/file_sys/registered_cache.h" 16#include "core/file_sys/registered_cache.h"
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/ipc_helpers.h" 20#include "core/hle/service/ipc_helpers.h"
20#include "core/hle/service/server_manager.h" 21#include "core/hle/service/server_manager.h"
21#include "core/loader/loader.h" 22#include "core/loader/loader.h"
22 23
23namespace Service::AOC { 24namespace Service::AOC {
24 25
25constexpr Result ResultNoPurchasedProductInfoAvailable{ErrorModule::NIMShop, 400};
26
27static bool CheckAOCTitleIDMatchesBase(u64 title_id, u64 base) { 26static bool CheckAOCTitleIDMatchesBase(u64 title_id, u64 base) {
28 return FileSys::GetBaseTitleID(title_id) == base; 27 return FileSys::GetBaseTitleID(title_id) == base;
29} 28}
@@ -46,82 +45,6 @@ static std::vector<u64> AccumulateAOCTitleIDs(Core::System& system) {
46 return add_on_content; 45 return add_on_content;
47} 46}
48 47
49class IPurchaseEventManager final : public ServiceFramework<IPurchaseEventManager> {
50public:
51 explicit IPurchaseEventManager(Core::System& system_)
52 : ServiceFramework{system_, "IPurchaseEventManager"}, service_context{
53 system, "IPurchaseEventManager"} {
54 // clang-format off
55 static const FunctionInfo functions[] = {
56 {0, &IPurchaseEventManager::SetDefaultDeliveryTarget, "SetDefaultDeliveryTarget"},
57 {1, &IPurchaseEventManager::SetDeliveryTarget, "SetDeliveryTarget"},
58 {2, &IPurchaseEventManager::GetPurchasedEventReadableHandle, "GetPurchasedEventReadableHandle"},
59 {3, &IPurchaseEventManager::PopPurchasedProductInfo, "PopPurchasedProductInfo"},
60 {4, &IPurchaseEventManager::PopPurchasedProductInfoWithUid, "PopPurchasedProductInfoWithUid"},
61 };
62 // clang-format on
63
64 RegisterHandlers(functions);
65
66 purchased_event = service_context.CreateEvent("IPurchaseEventManager:PurchasedEvent");
67 }
68
69 ~IPurchaseEventManager() override {
70 service_context.CloseEvent(purchased_event);
71 }
72
73private:
74 void SetDefaultDeliveryTarget(HLERequestContext& ctx) {
75 IPC::RequestParser rp{ctx};
76
77 const auto unknown_1 = rp.Pop<u64>();
78 [[maybe_unused]] const auto unknown_2 = ctx.ReadBuffer();
79
80 LOG_WARNING(Service_AOC, "(STUBBED) called, unknown_1={}", unknown_1);
81
82 IPC::ResponseBuilder rb{ctx, 2};
83 rb.Push(ResultSuccess);
84 }
85
86 void SetDeliveryTarget(HLERequestContext& ctx) {
87 IPC::RequestParser rp{ctx};
88
89 const auto unknown_1 = rp.Pop<u64>();
90 [[maybe_unused]] const auto unknown_2 = ctx.ReadBuffer();
91
92 LOG_WARNING(Service_AOC, "(STUBBED) called, unknown_1={}", unknown_1);
93
94 IPC::ResponseBuilder rb{ctx, 2};
95 rb.Push(ResultSuccess);
96 }
97
98 void GetPurchasedEventReadableHandle(HLERequestContext& ctx) {
99 LOG_WARNING(Service_AOC, "called");
100
101 IPC::ResponseBuilder rb{ctx, 2, 1};
102 rb.Push(ResultSuccess);
103 rb.PushCopyObjects(purchased_event->GetReadableEvent());
104 }
105
106 void PopPurchasedProductInfo(HLERequestContext& ctx) {
107 LOG_DEBUG(Service_AOC, "(STUBBED) called");
108
109 IPC::ResponseBuilder rb{ctx, 2};
110 rb.Push(ResultNoPurchasedProductInfoAvailable);
111 }
112
113 void PopPurchasedProductInfoWithUid(HLERequestContext& ctx) {
114 LOG_DEBUG(Service_AOC, "(STUBBED) called");
115
116 IPC::ResponseBuilder rb{ctx, 2};
117 rb.Push(ResultNoPurchasedProductInfoAvailable);
118 }
119
120 KernelHelpers::ServiceContext service_context;
121
122 Kernel::KEvent* purchased_event;
123};
124
125AOC_U::AOC_U(Core::System& system_) 48AOC_U::AOC_U(Core::System& system_)
126 : ServiceFramework{system_, "aoc:u"}, add_on_content{AccumulateAOCTitleIDs(system)}, 49 : ServiceFramework{system_, "aoc:u"}, add_on_content{AccumulateAOCTitleIDs(system)},
127 service_context{system_, "aoc:u"} { 50 service_context{system_, "aoc:u"} {
diff --git a/src/core/hle/service/aoc/purchase_event_manager.cpp b/src/core/hle/service/aoc/purchase_event_manager.cpp
new file mode 100644
index 000000000..83124cd21
--- /dev/null
+++ b/src/core/hle/service/aoc/purchase_event_manager.cpp
@@ -0,0 +1,79 @@
1// SPDX-FileCopyrightText: Copyright 2018 yuzu Emulator Project
2// SPDX-License-Identifier: GPL-2.0-or-later
3
4#include "core/hle/service/aoc/purchase_event_manager.h"
5#include "core/hle/service/ipc_helpers.h"
6
7namespace Service::AOC {
8
9constexpr Result ResultNoPurchasedProductInfoAvailable{ErrorModule::NIMShop, 400};
10
11IPurchaseEventManager::IPurchaseEventManager(Core::System& system_)
12 : ServiceFramework{system_, "IPurchaseEventManager"},
13 service_context{system, "IPurchaseEventManager"} {
14 // clang-format off
15 static const FunctionInfo functions[] = {
16 {0, &IPurchaseEventManager::SetDefaultDeliveryTarget, "SetDefaultDeliveryTarget"},
17 {1, &IPurchaseEventManager::SetDeliveryTarget, "SetDeliveryTarget"},
18 {2, &IPurchaseEventManager::GetPurchasedEventReadableHandle, "GetPurchasedEventReadableHandle"},
19 {3, &IPurchaseEventManager::PopPurchasedProductInfo, "PopPurchasedProductInfo"},
20 {4, &IPurchaseEventManager::PopPurchasedProductInfoWithUid, "PopPurchasedProductInfoWithUid"},
21 };
22 // clang-format on
23
24 RegisterHandlers(functions);
25
26 purchased_event = service_context.CreateEvent("IPurchaseEventManager:PurchasedEvent");
27}
28
29IPurchaseEventManager::~IPurchaseEventManager() {
30 service_context.CloseEvent(purchased_event);
31}
32
33void IPurchaseEventManager::SetDefaultDeliveryTarget(HLERequestContext& ctx) {
34 IPC::RequestParser rp{ctx};
35
36 const auto unknown_1 = rp.Pop<u64>();
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}
44
45void IPurchaseEventManager::SetDeliveryTarget(HLERequestContext& ctx) {
46 IPC::RequestParser rp{ctx};
47
48 const auto unknown_1 = rp.Pop<u64>();
49 [[maybe_unused]] const auto unknown_2 = ctx.ReadBuffer();
50
51 LOG_WARNING(Service_AOC, "(STUBBED) called, unknown_1={}", unknown_1);
52
53 IPC::ResponseBuilder rb{ctx, 2};
54 rb.Push(ResultSuccess);
55}
56
57void IPurchaseEventManager::GetPurchasedEventReadableHandle(HLERequestContext& ctx) {
58 LOG_WARNING(Service_AOC, "called");
59
60 IPC::ResponseBuilder rb{ctx, 2, 1};
61 rb.Push(ResultSuccess);
62 rb.PushCopyObjects(purchased_event->GetReadableEvent());
63}
64
65void IPurchaseEventManager::PopPurchasedProductInfo(HLERequestContext& ctx) {
66 LOG_DEBUG(Service_AOC, "(STUBBED) called");
67
68 IPC::ResponseBuilder rb{ctx, 2};
69 rb.Push(ResultNoPurchasedProductInfoAvailable);
70}
71
72void IPurchaseEventManager::PopPurchasedProductInfoWithUid(HLERequestContext& ctx) {
73 LOG_DEBUG(Service_AOC, "(STUBBED) called");
74
75 IPC::ResponseBuilder rb{ctx, 2};
76 rb.Push(ResultNoPurchasedProductInfoAvailable);
77}
78
79} // 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
new file mode 100644
index 000000000..efde3c8f3
--- /dev/null
+++ b/src/core/hle/service/aoc/purchase_event_manager.h
@@ -0,0 +1,28 @@
1// SPDX-FileCopyrightText: Copyright 2018 yuzu Emulator Project
2// SPDX-License-Identifier: GPL-2.0-or-later
3
4#pragma once
5
6#include "core/hle/service/kernel_helpers.h"
7#include "core/hle/service/os/event.h"
8#include "core/hle/service/service.h"
9
10namespace Service::AOC {
11
12class IPurchaseEventManager final : public ServiceFramework<IPurchaseEventManager> {
13public:
14 explicit IPurchaseEventManager(Core::System& system_);
15 ~IPurchaseEventManager() override;
16
17 void SetDefaultDeliveryTarget(HLERequestContext& ctx);
18 void SetDeliveryTarget(HLERequestContext& ctx);
19 void GetPurchasedEventReadableHandle(HLERequestContext& ctx);
20 void PopPurchasedProductInfo(HLERequestContext& ctx);
21 void PopPurchasedProductInfoWithUid(HLERequestContext& ctx);
22
23private:
24 KernelHelpers::ServiceContext service_context;
25 Kernel::KEvent* purchased_event;
26};
27
28} // namespace Service::AOC