summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorgerman77 <juangerman-13@hotmail.com>2024-01-07 04:17:57 +0100
committergerman77 <juangerman-13@hotmail.com>2024-01-07 04:18:44 +0100
commita36f4d0a9f2c0fee837856e4db3e4ca10bfed25b (patch)
treee13147afa84aaba79e36bbee59b0aa86f81ccf38
parentMerge pull request #12596 from german77/hid_qlaunch (diff)
downloadyuzu-a36f4d0a9f2c0fee837856e4db3e4ca10bfed25b.tar
yuzu-a36f4d0a9f2c0fee837856e4db3e4ca10bfed25b.tar.gz
yuzu-a36f4d0a9f2c0fee837856e4db3e4ca10bfed25b.tar.bz2
yuzu-a36f4d0a9f2c0fee837856e4db3e4ca10bfed25b.tar.lz
yuzu-a36f4d0a9f2c0fee837856e4db3e4ca10bfed25b.tar.xz
yuzu-a36f4d0a9f2c0fee837856e4db3e4ca10bfed25b.tar.zst
yuzu-a36f4d0a9f2c0fee837856e4db3e4ca10bfed25b.zip
-rw-r--r--src/core/hle/service/hid/hid_server.cpp18
-rw-r--r--src/core/hle/service/hid/hid_system_server.cpp23
-rw-r--r--src/core/hle/service/hid/hid_system_server.h1
-rw-r--r--src/hid_core/resources/npad/npad.cpp17
-rw-r--r--src/hid_core/resources/npad/npad.h6
5 files changed, 57 insertions, 8 deletions
diff --git a/src/core/hle/service/hid/hid_server.cpp b/src/core/hle/service/hid/hid_server.cpp
index 2ff00d30d..75bf3e682 100644
--- a/src/core/hle/service/hid/hid_server.cpp
+++ b/src/core/hle/service/hid/hid_server.cpp
@@ -1466,23 +1466,27 @@ void IHidServer::SetNpadCaptureButtonAssignment(HLERequestContext& ctx) {
const auto parameters{rp.PopRaw<Parameters>()};
- LOG_WARNING(Service_HID,
- "(STUBBED) called, npad_styleset={}, applet_resource_user_id={}, button={}",
- parameters.npad_styleset, parameters.applet_resource_user_id, parameters.button);
+ LOG_INFO(Service_HID, "called, npad_styleset={}, applet_resource_user_id={}, button={}",
+ parameters.npad_styleset, parameters.applet_resource_user_id, parameters.button);
+
+ const auto result = GetResourceManager()->GetNpad()->SetNpadCaptureButtonAssignment(
+ parameters.applet_resource_user_id, parameters.npad_styleset, parameters.button);
IPC::ResponseBuilder rb{ctx, 2};
- rb.Push(ResultSuccess);
+ rb.Push(result);
}
void IHidServer::ClearNpadCaptureButtonAssignment(HLERequestContext& ctx) {
IPC::RequestParser rp{ctx};
const auto applet_resource_user_id{rp.Pop<u64>()};
- LOG_WARNING(Service_HID, "(STUBBED) called, applet_resource_user_id={}",
- applet_resource_user_id);
+ LOG_INFO(Service_HID, "called, applet_resource_user_id={}", applet_resource_user_id);
+
+ const auto result =
+ GetResourceManager()->GetNpad()->ClearNpadCaptureButtonAssignment(applet_resource_user_id);
IPC::ResponseBuilder rb{ctx, 2};
- rb.Push(ResultSuccess);
+ rb.Push(result);
}
void IHidServer::GetVibrationDeviceInfo(HLERequestContext& ctx) {
diff --git a/src/core/hle/service/hid/hid_system_server.cpp b/src/core/hle/service/hid/hid_system_server.cpp
index 2a65615e8..ac0d8bd5d 100644
--- a/src/core/hle/service/hid/hid_system_server.cpp
+++ b/src/core/hle/service/hid/hid_system_server.cpp
@@ -46,7 +46,7 @@ IHidSystemServer::IHidSystemServer(Core::System& system_, std::shared_ptr<Resour
{310, &IHidSystemServer::GetMaskedSupportedNpadStyleSet, "GetMaskedSupportedNpadStyleSet"},
{311, nullptr, "SetNpadPlayerLedBlinkingDevice"},
{312, &IHidSystemServer::SetSupportedNpadStyleSetAll, "SetSupportedNpadStyleSetAll"},
- {313, nullptr, "GetNpadCaptureButtonAssignment"},
+ {313, &IHidSystemServer::GetNpadCaptureButtonAssignment, "GetNpadCaptureButtonAssignment"},
{314, nullptr, "GetAppletFooterUiType"},
{315, &IHidSystemServer::GetAppletDetailedUiType, "GetAppletDetailedUiType"},
{316, &IHidSystemServer::GetNpadInterfaceType, "GetNpadInterfaceType"},
@@ -331,6 +331,27 @@ void IHidSystemServer::SetSupportedNpadStyleSetAll(HLERequestContext& ctx) {
rb.Push(result);
}
+void IHidSystemServer::GetNpadCaptureButtonAssignment(HLERequestContext& ctx) {
+ IPC::RequestParser rp{ctx};
+ const auto applet_resource_user_id{rp.Pop<u64>()};
+ const auto capture_button_list_size{ctx.GetWriteBufferNumElements<Core::HID::NpadButton>()};
+
+ LOG_DEBUG(Service_HID, "called, applet_resource_user_id={}", applet_resource_user_id);
+
+ std::vector<Core::HID::NpadButton> capture_button_list(capture_button_list_size);
+ const auto& npad = GetResourceManager()->GetNpad();
+ const u64 list_size =
+ npad->GetNpadCaptureButtonAssignment(capture_button_list, applet_resource_user_id);
+
+ if (list_size != 0) {
+ ctx.WriteBuffer(capture_button_list);
+ }
+
+ IPC::ResponseBuilder rb{ctx, 4};
+ rb.Push(ResultSuccess);
+ rb.Push(list_size);
+}
+
void IHidSystemServer::GetAppletDetailedUiType(HLERequestContext& ctx) {
IPC::RequestParser rp{ctx};
const auto npad_id_type{rp.PopEnum<Core::HID::NpadIdType>()};
diff --git a/src/core/hle/service/hid/hid_system_server.h b/src/core/hle/service/hid/hid_system_server.h
index f467e2aa8..53091cf53 100644
--- a/src/core/hle/service/hid/hid_system_server.h
+++ b/src/core/hle/service/hid/hid_system_server.h
@@ -31,6 +31,7 @@ private:
void GetNpadFullKeyGripColor(HLERequestContext& ctx);
void GetMaskedSupportedNpadStyleSet(HLERequestContext& ctx);
void SetSupportedNpadStyleSetAll(HLERequestContext& ctx);
+ void GetNpadCaptureButtonAssignment(HLERequestContext& ctx);
void GetAppletDetailedUiType(HLERequestContext& ctx);
void GetNpadInterfaceType(HLERequestContext& ctx);
void GetNpadLeftRightInterfaceType(HLERequestContext& ctx);
diff --git a/src/hid_core/resources/npad/npad.cpp b/src/hid_core/resources/npad/npad.cpp
index e6c035628..ea035d759 100644
--- a/src/hid_core/resources/npad/npad.cpp
+++ b/src/hid_core/resources/npad/npad.cpp
@@ -1339,4 +1339,21 @@ AppletDetailedUiType NPad::GetAppletDetailedUiType(Core::HID::NpadIdType npad_id
};
}
+Result NPad::SetNpadCaptureButtonAssignment(u64 aruid, Core::HID::NpadStyleSet npad_style_set,
+ Core::HID::NpadButton button_assignment) {
+ std::scoped_lock lock{mutex};
+ return npad_resource.SetNpadCaptureButtonAssignment(aruid, npad_style_set, button_assignment);
+}
+
+Result NPad::ClearNpadCaptureButtonAssignment(u64 aruid) {
+ std::scoped_lock lock{mutex};
+ return npad_resource.ClearNpadCaptureButtonAssignment(aruid);
+}
+
+std::size_t NPad::GetNpadCaptureButtonAssignment(std::span<Core::HID::NpadButton> out_list,
+ u64 aruid) const {
+ std::scoped_lock lock{mutex};
+ return npad_resource.GetNpadCaptureButtonAssignment(out_list, aruid);
+}
+
} // namespace Service::HID
diff --git a/src/hid_core/resources/npad/npad.h b/src/hid_core/resources/npad/npad.h
index 58f8c7acf..e602ddaea 100644
--- a/src/hid_core/resources/npad/npad.h
+++ b/src/hid_core/resources/npad/npad.h
@@ -149,6 +149,12 @@ public:
AppletDetailedUiType GetAppletDetailedUiType(Core::HID::NpadIdType npad_id);
+ Result SetNpadCaptureButtonAssignment(u64 aruid, Core::HID::NpadStyleSet npad_style_set,
+ Core::HID::NpadButton button_assignment);
+ Result ClearNpadCaptureButtonAssignment(u64 aruid);
+ std::size_t GetNpadCaptureButtonAssignment(std::span<Core::HID::NpadButton> out_list,
+ u64 aruid) const;
+
private:
struct VibrationData {
bool device_mounted{};