hid: Call SetSupportedNpadStyleSet to enable additional Npad features

This commit is contained in:
Vicki Pfau 2018-09-27 12:14:48 -07:00
parent 1cc3547990
commit 5c30cf09d5
2 changed files with 10 additions and 0 deletions

View File

@ -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. /// Returns 0 when CONTROLLER_PLAYER_1 is connected, otherwise returns 1 for handheld-mode.
bool hidGetHandheldMode(void); 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_*. /// 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). /// 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_*. /// id must be CONTROLLER_PLAYER_*.

View File

@ -72,6 +72,9 @@ Result hidInitialize(void)
rc = shmemMap(&g_hidSharedmem); 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)) if (R_SUCCEEDED(rc))
rc = _hidSetDualModeAll(); rc = _hidSetDualModeAll();
@ -525,6 +528,10 @@ static Result _hidCmdWithInputU32(u64 cmd_id, u32 inputval) {
return rc; return rc;
} }
Result hidSetSupportedNpadStyleSet(HidControllerType type) {
return _hidCmdWithInputU32(100, type);
}
Result hidSetNpadJoyAssignmentModeSingleByDefault(HidControllerID id) { Result hidSetNpadJoyAssignmentModeSingleByDefault(HidControllerID id) {
return _hidCmdWithInputU32(122, id); return _hidCmdWithInputU32(122, id);
} }