summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-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)
}
void IHidSystemServer::GetLastActiveNpad(HLERequestContext& ctx) {
- LOG_DEBUG(Service_HID, "(STUBBED) called"); // Spams a lot when controller applet is running
+ Core::HID::NpadIdType npad_id{};
+ const Result result = GetResourceManager()->GetNpad()->GetLastActiveNpad(npad_id);
+
+ LOG_DEBUG(Service_HID, "called, npad_id={}", npad_id);
IPC::ResponseBuilder rb{ctx, 3};
- rb.Push(ResultSuccess);
- rb.Push(0); // Dont forget to fix this
+ rb.Push(result);
+ rb.PushEnum(npad_id);
}
void 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) {
return result;
}
+Result NPad::GetLastActiveNpad(Core::HID::NpadIdType& out_npad_id) const {
+ std::scoped_lock lock{mutex};
+ out_npad_id = hid_core.GetLastActiveController();
+ return ResultSuccess;
+}
+
} // 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:
Result AssigningSingleOnSlSrPress(u64 aruid, bool is_enabled);
+ Result GetLastActiveNpad(Core::HID::NpadIdType& out_npad_id) const;
+
private:
struct VibrationData {
bool device_mounted{};