summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorGravatar bunnei2016-11-05 00:26:24 -0400
committerGravatar GitHub2016-11-05 00:26:24 -0400
commit37fe84c51225a4a45af2280cb6ac47d2a79dc5d9 (patch)
tree2785c5c5dff0cdba2043deb817ca61ad173caa6a /src
parentMerge pull request #2147 from Pringo/readme-donate (diff)
parentStyle fix (diff)
downloadyuzu-37fe84c51225a4a45af2280cb6ac47d2a79dc5d9.tar.gz
yuzu-37fe84c51225a4a45af2280cb6ac47d2a79dc5d9.tar.xz
yuzu-37fe84c51225a4a45af2280cb6ac47d2a79dc5d9.zip
Merge pull request #2142 from mailwl/acu-update
AC_U: Stub functions, used if EULA agreed
Diffstat (limited to 'src')
-rw-r--r--src/core/hle/service/ac_u.cpp207
-rw-r--r--src/core/hle/service/ac_u.h1
2 files changed, 194 insertions, 14 deletions
diff --git a/src/core/hle/service/ac_u.cpp b/src/core/hle/service/ac_u.cpp
index 12d94f37a..18026975f 100644
--- a/src/core/hle/service/ac_u.cpp
+++ b/src/core/hle/service/ac_u.cpp
@@ -11,11 +11,85 @@
11 11
12namespace AC_U { 12namespace AC_U {
13 13
14struct ACConfig {
15 std::array<u8, 0x200> data;
16};
17
18static ACConfig default_config{};
19
20static bool ac_connected = false;
21
22static Kernel::SharedPtr<Kernel::Event> close_event;
23static Kernel::SharedPtr<Kernel::Event> connect_event;
24static Kernel::SharedPtr<Kernel::Event> disconnect_event;
25
26/**
27 * AC_U::CreateDefaultConfig service function
28 * Inputs:
29 * 64 : ACConfig size << 14 | 2
30 * 65 : pointer to ACConfig struct
31 * Outputs:
32 * 1 : Result of function, 0 on success, otherwise error code
33 */
34static void CreateDefaultConfig(Service::Interface* self) {
35 u32* cmd_buff = Kernel::GetCommandBuffer();
36
37 u32 ac_config_addr = cmd_buff[65];
38
39 ASSERT_MSG(cmd_buff[64] == (sizeof(ACConfig) << 14 | 2),
40 "Output buffer size not equal ACConfig size");
41
42 Memory::WriteBlock(ac_config_addr, &default_config, sizeof(ACConfig));
43 cmd_buff[1] = RESULT_SUCCESS.raw; // No error
44
45 LOG_WARNING(Service_AC, "(STUBBED) called");
46}
47
48/**
49 * AC_U::ConnectAsync service function
50 * Inputs:
51 * 1 : ProcessId Header
52 * 3 : Copy Handle Header
53 * 4 : Connection Event handle
54 * 5 : ACConfig size << 14 | 2
55 * 6 : pointer to ACConfig struct
56 * Outputs:
57 * 1 : Result of function, 0 on success, otherwise error code
58 */
59static void ConnectAsync(Service::Interface* self) {
60 u32* cmd_buff = Kernel::GetCommandBuffer();
61
62 connect_event = Kernel::g_handle_table.Get<Kernel::Event>(cmd_buff[4]);
63 if (connect_event) {
64 connect_event->name = "AC_U:connect_event";
65 connect_event->Signal();
66 ac_connected = true;
67 }
68 cmd_buff[1] = RESULT_SUCCESS.raw; // No error
69
70 LOG_WARNING(Service_AC, "(STUBBED) called");
71}
72
73/**
74 * AC_U::GetConnectResult service function
75 * Inputs:
76 * 1 : ProcessId Header
77 * Outputs:
78 * 1 : Result of function, 0 on success, otherwise error code
79 */
80static void GetConnectResult(Service::Interface* self) {
81 u32* cmd_buff = Kernel::GetCommandBuffer();
82
83 cmd_buff[1] = RESULT_SUCCESS.raw; // No error
84
85 LOG_WARNING(Service_AC, "(STUBBED) called");
86}
87
14/** 88/**
15 * AC_U::CloseAsync service function 89 * AC_U::CloseAsync service function
16 * Inputs: 90 * Inputs:
17 * 1 : Always 0x20 91 * 1 : ProcessId Header
18 * 3 : Always 0 92 * 3 : Copy Handle Header
19 * 4 : Event handle, should be signaled when AC connection is closed 93 * 4 : Event handle, should be signaled when AC connection is closed
20 * Outputs: 94 * Outputs:
21 * 1 : Result of function, 0 on success, otherwise error code 95 * 1 : Result of function, 0 on success, otherwise error code
@@ -23,16 +97,37 @@ namespace AC_U {
23static void CloseAsync(Service::Interface* self) { 97static void CloseAsync(Service::Interface* self) {
24 u32* cmd_buff = Kernel::GetCommandBuffer(); 98 u32* cmd_buff = Kernel::GetCommandBuffer();
25 99
26 auto evt = Kernel::g_handle_table.Get<Kernel::Event>(cmd_buff[4]); 100 if (ac_connected && disconnect_event) {
101 disconnect_event->Signal();
102 }
27 103
28 if (evt) { 104 close_event = Kernel::g_handle_table.Get<Kernel::Event>(cmd_buff[4]);
29 evt->name = "AC_U:close_event"; 105 if (close_event) {
30 evt->Signal(); 106 close_event->name = "AC_U:close_event";
107 close_event->Signal();
31 } 108 }
109
110 ac_connected = false;
111
112 cmd_buff[1] = RESULT_SUCCESS.raw; // No error
113 LOG_WARNING(Service_AC, "(STUBBED) called");
114}
115
116/**
117 * AC_U::GetCloseResult service function
118 * Inputs:
119 * 1 : ProcessId Header
120 * Outputs:
121 * 1 : Result of function, 0 on success, otherwise error code
122 */
123static void GetCloseResult(Service::Interface* self) {
124 u32* cmd_buff = Kernel::GetCommandBuffer();
125
32 cmd_buff[1] = RESULT_SUCCESS.raw; // No error 126 cmd_buff[1] = RESULT_SUCCESS.raw; // No error
33 127
34 LOG_WARNING(Service_AC, "(STUBBED) called"); 128 LOG_WARNING(Service_AC, "(STUBBED) called");
35} 129}
130
36/** 131/**
37 * AC_U::GetWifiStatus service function 132 * AC_U::GetWifiStatus service function
38 * Outputs: 133 * Outputs:
@@ -52,6 +147,75 @@ static void GetWifiStatus(Service::Interface* self) {
52} 147}
53 148
54/** 149/**
150 * AC_U::GetInfraPriority service function
151 * Inputs:
152 * 1 : ACConfig size << 14 | 2
153 * 2 : pointer to ACConfig struct
154 * Outputs:
155 * 1 : Result of function, 0 on success, otherwise error code
156 * 2 : Infra Priority
157 */
158static void GetInfraPriority(Service::Interface* self) {
159 u32* cmd_buff = Kernel::GetCommandBuffer();
160
161 cmd_buff[1] = RESULT_SUCCESS.raw; // No error
162 cmd_buff[2] = 0; // Infra Priority, default 0
163
164 LOG_WARNING(Service_AC, "(STUBBED) called");
165}
166
167/**
168 * AC_U::SetRequestEulaVersion service function
169 * Inputs:
170 * 1 : Eula Version major
171 * 2 : Eula Version minor
172 * 3 : ACConfig size << 14 | 2
173 * 4 : Input pointer to ACConfig struct
174 * 64 : ACConfig size << 14 | 2
175 * 65 : Output pointer to ACConfig struct
176 * Outputs:
177 * 1 : Result of function, 0 on success, otherwise error code
178 * 2 : Infra Priority
179 */
180static void SetRequestEulaVersion(Service::Interface* self) {
181 u32* cmd_buff = Kernel::GetCommandBuffer();
182
183 u32 major = cmd_buff[1] & 0xFF;
184 u32 minor = cmd_buff[2] & 0xFF;
185
186 ASSERT_MSG(cmd_buff[3] == (sizeof(ACConfig) << 14 | 2),
187 "Input buffer size not equal ACConfig size");
188 ASSERT_MSG(cmd_buff[64] == (sizeof(ACConfig) << 14 | 2),
189 "Output buffer size not equal ACConfig size");
190
191 cmd_buff[1] = RESULT_SUCCESS.raw; // No error
192 cmd_buff[2] = 0; // Infra Priority
193
194 LOG_WARNING(Service_AC, "(STUBBED) called, major=%u, minor=%u", major, minor);
195}
196
197/**
198 * AC_U::RegisterDisconnectEvent service function
199 * Inputs:
200 * 1 : ProcessId Header
201 * 3 : Copy Handle Header
202 * 4 : Event handle, should be signaled when AC connection is closed
203 * Outputs:
204 * 1 : Result of function, 0 on success, otherwise error code
205 */
206static void RegisterDisconnectEvent(Service::Interface* self) {
207 u32* cmd_buff = Kernel::GetCommandBuffer();
208
209 disconnect_event = Kernel::g_handle_table.Get<Kernel::Event>(cmd_buff[4]);
210 if (disconnect_event) {
211 disconnect_event->name = "AC_U:disconnect_event";
212 }
213 cmd_buff[1] = RESULT_SUCCESS.raw; // No error
214
215 LOG_WARNING(Service_AC, "(STUBBED) called");
216}
217
218/**
55 * AC_U::IsConnected service function 219 * AC_U::IsConnected service function
56 * Outputs: 220 * Outputs:
57 * 1 : Result of function, 0 on success, otherwise error code 221 * 1 : Result of function, 0 on success, otherwise error code
@@ -61,26 +225,29 @@ static void IsConnected(Service::Interface* self) {
61 u32* cmd_buff = Kernel::GetCommandBuffer(); 225 u32* cmd_buff = Kernel::GetCommandBuffer();
62 226
63 cmd_buff[1] = RESULT_SUCCESS.raw; // No error 227 cmd_buff[1] = RESULT_SUCCESS.raw; // No error
64 cmd_buff[2] = false; // Not connected to ac:u service 228 cmd_buff[2] = ac_connected;
65 229
66 LOG_WARNING(Service_AC, "(STUBBED) called"); 230 LOG_WARNING(Service_AC, "(STUBBED) called");
67} 231}
68 232
69const Interface::FunctionInfo FunctionTable[] = { 233const Interface::FunctionInfo FunctionTable[] = {
70 {0x00010000, nullptr, "CreateDefaultConfig"}, 234 {0x00010000, CreateDefaultConfig, "CreateDefaultConfig"},
71 {0x00040006, nullptr, "ConnectAsync"}, 235 {0x00040006, ConnectAsync, "ConnectAsync"},
72 {0x00050002, nullptr, "GetConnectResult"}, 236 {0x00050002, GetConnectResult, "GetConnectResult"},
237 {0x00070002, nullptr, "CancelConnectAsync"},
73 {0x00080004, CloseAsync, "CloseAsync"}, 238 {0x00080004, CloseAsync, "CloseAsync"},
74 {0x00090002, nullptr, "GetCloseResult"}, 239 {0x00090002, GetCloseResult, "GetCloseResult"},
75 {0x000A0000, nullptr, "GetLastErrorCode"}, 240 {0x000A0000, nullptr, "GetLastErrorCode"},
241 {0x000C0000, nullptr, "GetStatus"},
76 {0x000D0000, GetWifiStatus, "GetWifiStatus"}, 242 {0x000D0000, GetWifiStatus, "GetWifiStatus"},
77 {0x000E0042, nullptr, "GetCurrentAPInfo"}, 243 {0x000E0042, nullptr, "GetCurrentAPInfo"},
78 {0x00100042, nullptr, "GetCurrentNZoneInfo"}, 244 {0x00100042, nullptr, "GetCurrentNZoneInfo"},
79 {0x00110042, nullptr, "GetNZoneApNumService"}, 245 {0x00110042, nullptr, "GetNZoneApNumService"},
246 {0x001D0042, nullptr, "ScanAPs"},
80 {0x00240042, nullptr, "AddDenyApType"}, 247 {0x00240042, nullptr, "AddDenyApType"},
81 {0x00270002, nullptr, "GetInfraPriority"}, 248 {0x00270002, GetInfraPriority, "GetInfraPriority"},
82 {0x002D0082, nullptr, "SetRequestEulaVersion"}, 249 {0x002D0082, SetRequestEulaVersion, "SetRequestEulaVersion"},
83 {0x00300004, nullptr, "RegisterDisconnectEvent"}, 250 {0x00300004, RegisterDisconnectEvent, "RegisterDisconnectEvent"},
84 {0x003C0042, nullptr, "GetAPSSIDList"}, 251 {0x003C0042, nullptr, "GetAPSSIDList"},
85 {0x003E0042, IsConnected, "IsConnected"}, 252 {0x003E0042, IsConnected, "IsConnected"},
86 {0x00400042, nullptr, "SetClientVersion"}, 253 {0x00400042, nullptr, "SetClientVersion"},
@@ -91,6 +258,18 @@ const Interface::FunctionInfo FunctionTable[] = {
91 258
92Interface::Interface() { 259Interface::Interface() {
93 Register(FunctionTable); 260 Register(FunctionTable);
261
262 ac_connected = false;
263
264 close_event = nullptr;
265 connect_event = nullptr;
266 disconnect_event = nullptr;
267}
268
269Interface::~Interface() {
270 close_event = nullptr;
271 connect_event = nullptr;
272 disconnect_event = nullptr;
94} 273}
95 274
96} // namespace 275} // namespace
diff --git a/src/core/hle/service/ac_u.h b/src/core/hle/service/ac_u.h
index f1d26ebe8..6592b21c9 100644
--- a/src/core/hle/service/ac_u.h
+++ b/src/core/hle/service/ac_u.h
@@ -16,6 +16,7 @@ namespace AC_U {
16class Interface : public Service::Interface { 16class Interface : public Service::Interface {
17public: 17public:
18 Interface(); 18 Interface();
19 ~Interface();
19 20
20 std::string GetPortName() const override { 21 std::string GetPortName() const override {
21 return "ac:u"; 22 return "ac:u";