From 213676c5f8013526338894bc5f42681570bb9cbd Mon Sep 17 00:00:00 2001 From: yellows8 Date: Thu, 15 Mar 2018 22:24:52 -0400 Subject: [PATCH] Added hidGetHandheldMode(). --- nx/include/switch/services/hid.h | 4 ++++ nx/source/services/hid.c | 4 ++++ 2 files changed, 8 insertions(+) diff --git a/nx/include/switch/services/hid.h b/nx/include/switch/services/hid.h index 51c66137..29a3124e 100644 --- a/nx/include/switch/services/hid.h +++ b/nx/include/switch/services/hid.h @@ -581,6 +581,10 @@ void hidTouchRead(touchPosition *pos, u32 point_id); void hidJoystickRead(JoystickPosition *pos, HidControllerID id, HidControllerJoystick stick); +/// This can be used to check what CONTROLLER_P1_AUTO uses. +/// Returns 0 when CONTROLLER_PLAYER_1 is connected, otherwise returns 1 for handheld-mode. +bool hidGetHandheldMode(void); + /// 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 70aca4b6..81dda643 100644 --- a/nx/source/services/hid.c +++ b/nx/source/services/hid.c @@ -370,6 +370,10 @@ void hidJoystickRead(JoystickPosition *pos, HidControllerID id, HidControllerJoy } } +bool hidGetHandheldMode(void) { + return g_controllerP1AutoID == CONTROLLER_HANDHELD; +} + static Result _hidSetDualModeAll(void) { Result rc; int i;