From 5c30cf09d548d96a011cb860d458a00dd2bd584d Mon Sep 17 00:00:00 2001 From: Vicki Pfau Date: Thu, 27 Sep 2018 12:14:48 -0700 Subject: [PATCH] hid: Call SetSupportedNpadStyleSet to enable additional Npad features --- nx/include/switch/services/hid.h | 3 +++ nx/source/services/hid.c | 7 +++++++ 2 files changed, 10 insertions(+) diff --git a/nx/include/switch/services/hid.h b/nx/include/switch/services/hid.h index 4ad9656f..7280ea61 100644 --- a/nx/include/switch/services/hid.h +++ b/nx/include/switch/services/hid.h @@ -592,6 +592,9 @@ void hidJoystickRead(JoystickPosition *pos, HidControllerID id, HidControllerJoy /// Returns 0 when CONTROLLER_PLAYER_1 is connected, otherwise returns 1 for handheld-mode. bool hidGetHandheldMode(void); +/// Sets which controller types are supported. This is automatically called with all types in \ref hidInitialize. +Result hidSetSupportedNpadStyleSet(HidControllerType type); + /// Use this if you want to use a single joy-con as a dedicated CONTROLLER_PLAYER_*. /// When used, both joy-cons in a pair should be used with this (CONTROLLER_PLAYER_1 and CONTROLLER_PLAYER_2 for example). /// id must be CONTROLLER_PLAYER_*. diff --git a/nx/source/services/hid.c b/nx/source/services/hid.c index 1bc3c40e..321c8361 100644 --- a/nx/source/services/hid.c +++ b/nx/source/services/hid.c @@ -72,6 +72,9 @@ Result hidInitialize(void) rc = shmemMap(&g_hidSharedmem); } + if (R_SUCCEEDED(rc)) + rc = hidSetSupportedNpadStyleSet(TYPE_PROCONTROLLER | TYPE_HANDHELD | TYPE_JOYCON_PAIR | TYPE_JOYCON_LEFT | TYPE_JOYCON_RIGHT); + if (R_SUCCEEDED(rc)) rc = _hidSetDualModeAll(); @@ -525,6 +528,10 @@ static Result _hidCmdWithInputU32(u64 cmd_id, u32 inputval) { return rc; } +Result hidSetSupportedNpadStyleSet(HidControllerType type) { + return _hidCmdWithInputU32(100, type); +} + Result hidSetNpadJoyAssignmentModeSingleByDefault(HidControllerID id) { return _hidCmdWithInputU32(122, id); }