summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGravatar german772024-01-06 22:04:14 -0600
committerGravatar Narr the Reg2024-01-06 23:30:43 -0600
commit5105b900179e639a766c8013e7d24551e6a58a95 (patch)
treef4830e36817e18511b6fbdaeb97bc1aa7f009581
parentservice: hid: Implement AssigningSingleOnSlSrPress (diff)
downloadyuzu-5105b900179e639a766c8013e7d24551e6a58a95.tar.gz
yuzu-5105b900179e639a766c8013e7d24551e6a58a95.tar.xz
yuzu-5105b900179e639a766c8013e7d24551e6a58a95.zip
service: hid: Implement GetLastActiveNpad
-rw-r--r--src/core/hle/service/hid/hid_system_server.cpp9
-rw-r--r--src/hid_core/resources/npad/npad.cpp6
-rw-r--r--src/hid_core/resources/npad/npad.h2
3 files changed, 14 insertions, 3 deletions
diff --git a/src/core/hle/service/hid/hid_system_server.cpp b/src/core/hle/service/hid/hid_system_server.cpp
index 94d566650..3a0cb3cb1 100644
--- a/src/core/hle/service/hid/hid_system_server.cpp
+++ b/src/core/hle/service/hid/hid_system_server.cpp
@@ -275,11 +275,14 @@ void IHidSystemServer::DisableAssigningSingleOnSlSrPress(HLERequestContext& ctx)
275} 275}
276 276
277void IHidSystemServer::GetLastActiveNpad(HLERequestContext& ctx) { 277void IHidSystemServer::GetLastActiveNpad(HLERequestContext& ctx) {
278 LOG_DEBUG(Service_HID, "(STUBBED) called"); // Spams a lot when controller applet is running 278 Core::HID::NpadIdType npad_id{};
279 const Result result = GetResourceManager()->GetNpad()->GetLastActiveNpad(npad_id);
280
281 LOG_DEBUG(Service_HID, "called, npad_id={}", npad_id);
279 282
280 IPC::ResponseBuilder rb{ctx, 3}; 283 IPC::ResponseBuilder rb{ctx, 3};
281 rb.Push(ResultSuccess); 284 rb.Push(result);
282 rb.Push(0); // Dont forget to fix this 285 rb.PushEnum(npad_id);
283} 286}
284 287
285void IHidSystemServer::ApplyNpadSystemCommonPolicyFull(HLERequestContext& ctx) { 288void IHidSystemServer::ApplyNpadSystemCommonPolicyFull(HLERequestContext& ctx) {
diff --git a/src/hid_core/resources/npad/npad.cpp b/src/hid_core/resources/npad/npad.cpp
index 2995634c5..14871ebee 100644
--- a/src/hid_core/resources/npad/npad.cpp
+++ b/src/hid_core/resources/npad/npad.cpp
@@ -1378,4 +1378,10 @@ Result NPad::AssigningSingleOnSlSrPress(u64 aruid, bool is_enabled) {
1378 return result; 1378 return result;
1379} 1379}
1380 1380
1381Result NPad::GetLastActiveNpad(Core::HID::NpadIdType& out_npad_id) const {
1382 std::scoped_lock lock{mutex};
1383 out_npad_id = hid_core.GetLastActiveController();
1384 return ResultSuccess;
1385}
1386
1381} // namespace Service::HID 1387} // namespace Service::HID
diff --git a/src/hid_core/resources/npad/npad.h b/src/hid_core/resources/npad/npad.h
index 91bc59afd..01f3dabb1 100644
--- a/src/hid_core/resources/npad/npad.h
+++ b/src/hid_core/resources/npad/npad.h
@@ -159,6 +159,8 @@ public:
159 159
160 Result AssigningSingleOnSlSrPress(u64 aruid, bool is_enabled); 160 Result AssigningSingleOnSlSrPress(u64 aruid, bool is_enabled);
161 161
162 Result GetLastActiveNpad(Core::HID::NpadIdType& out_npad_id) const;
163
162private: 164private:
163 struct VibrationData { 165 struct VibrationData {
164 bool device_mounted{}; 166 bool device_mounted{};