From 42573456dbd39d563de4759c6f455da286105ab3 Mon Sep 17 00:00:00 2001 From: Zephyron Date: Mon, 12 May 2025 16:10:57 +1000 Subject: [PATCH] hid: Add SetGestureOutputRanges function Add an implementation for function 92 (SetGestureOutputRanges) in the HID service. This fixes a crash in Donkey Kong Country Returns HD which occurs when the game attempts to access this unimplemented function. The function is now properly registered and returns success while logging the call. The specific error that was occurring: "Unknown / unimplemented function '92': port='hid'" According to the official Switch documentation, this function was introduced in firmware 18.0.0+ and is used for setting gesture output ranges for touch/gesture controls. Signed-off-by: Zephyron --- src/core/hle/service/hid/hid_server.cpp | 7 +++++++ src/core/hle/service/hid/hid_server.h | 2 ++ 2 files changed, 9 insertions(+) diff --git a/src/core/hle/service/hid/hid_server.cpp b/src/core/hle/service/hid/hid_server.cpp index 926a3bfe9..12c0a541b 100644 --- a/src/core/hle/service/hid/hid_server.cpp +++ b/src/core/hle/service/hid/hid_server.cpp @@ -1,4 +1,5 @@ // SPDX-FileCopyrightText: Copyright 2023 yuzu Emulator Project +// SPDX-FileCopyrightText: Copyright 2025 citron Emulator Project // SPDX-License-Identifier: GPL-3.0-or-later #include @@ -89,6 +90,7 @@ IHidServer::IHidServer(Core::System& system_, std::shared_ptr r {88, C<&IHidServer::GetSixAxisSensorIcInformation>, "GetSixAxisSensorIcInformation"}, {89, C<&IHidServer::ResetIsSixAxisSensorDeviceNewlyAssigned>, "ResetIsSixAxisSensorDeviceNewlyAssigned"}, {91, C<&IHidServer::ActivateGesture>, "ActivateGesture"}, + {92, C<&IHidServer::SetGestureOutputRanges>, "SetGestureOutputRanges"}, {100, C<&IHidServer::SetSupportedNpadStyleSet>, "SetSupportedNpadStyleSet"}, {101, C<&IHidServer::GetSupportedNpadStyleSet>, "GetSupportedNpadStyleSet"}, {102, C<&IHidServer::SetSupportedNpadIdType>, "SetSupportedNpadIdType"}, @@ -1431,6 +1433,11 @@ Result IHidServer::SetTouchScreenResolution(u32 width, u32 height, R_SUCCEED(); } +Result IHidServer::SetGestureOutputRanges(ClientAppletResourceUserId aruid) { + LOG_WARNING(Service_HID, "(STUBBED) called, applet_resource_user_id={}", aruid.pid); + R_SUCCEED(); +} + std::shared_ptr IHidServer::GetResourceManager() { resource_manager->Initialize(); return resource_manager; diff --git a/src/core/hle/service/hid/hid_server.h b/src/core/hle/service/hid/hid_server.h index cfa31c2de..c7685a634 100644 --- a/src/core/hle/service/hid/hid_server.h +++ b/src/core/hle/service/hid/hid_server.h @@ -1,4 +1,5 @@ // SPDX-FileCopyrightText: Copyright 2023 yuzu Emulator Project +// SPDX-FileCopyrightText: Copyright 2025 citron Emulator Project // SPDX-License-Identifier: GPL-3.0-or-later #pragma once @@ -104,6 +105,7 @@ private: Result ResetIsSixAxisSensorDeviceNewlyAssigned(Core::HID::SixAxisSensorHandle sixaxis_handle, ClientAppletResourceUserId aruid); Result ActivateGesture(u32 basic_gesture_id, ClientAppletResourceUserId aruid); + Result SetGestureOutputRanges(ClientAppletResourceUserId aruid); Result SetSupportedNpadStyleSet(Core::HID::NpadStyleSet supported_style_set, ClientAppletResourceUserId aruid); Result GetSupportedNpadStyleSet(Out out_supported_style_set,