From 2b6197a51ad35c70305eafb0827ed67887881ed9 Mon Sep 17 00:00:00 2001 From: yellows8 Date: Mon, 18 Nov 2019 12:38:12 -0500 Subject: [PATCH] hid: Use _hidActivateConsoleSixAxisSensor instead of _hidActivateSevenSixAxisSensor, and moved the code using this to near the start of hidInitializeSevenSixAxisSensor. --- nx/source/services/hid.c | 13 +++++-------- 1 file changed, 5 insertions(+), 8 deletions(-) diff --git a/nx/source/services/hid.c b/nx/source/services/hid.c index 069cd1d9..74046d1a 100644 --- a/nx/source/services/hid.c +++ b/nx/source/services/hid.c @@ -1078,8 +1078,8 @@ Result hidStopSixAxisSensor(u32 SixAxisSensorHandle) { return rc; } -static Result _hidActivateSevenSixAxisSensor(void) { - if (hosversionBefore(5,0,0)) +static Result _hidActivateConsoleSixAxisSensor(void) { + if (hosversionBefore(3,0,0)) return MAKERESULT(Module_Libnx, LibnxError_IncompatSysVer); return _hidCmdWithNoInput(303); @@ -1129,6 +1129,9 @@ Result hidInitializeSevenSixAxisSensor(void) { if (g_sevenSixAxisSensorBuffer != NULL) return MAKERESULT(Module_Libnx, LibnxError_AlreadyInitialized); + rc = _hidActivateConsoleSixAxisSensor(); + if (R_FAILED(rc)) return rc; + g_sevenSixAxisSensorBuffer = (u8*)memalign(0x1000, bufsize); if (g_sevenSixAxisSensorBuffer == NULL) return MAKERESULT(Module_Libnx, LibnxError_OutOfMemory); @@ -1139,12 +1142,6 @@ Result hidInitializeSevenSixAxisSensor(void) { if (R_SUCCEEDED(rc)) rc = _hidInitializeSevenSixAxisSensor(&g_sevenSixAxisSensorTmem0, &g_sevenSixAxisSensorTmem1); - if (R_SUCCEEDED(rc)) { - rc = _hidActivateSevenSixAxisSensor(); - if (R_FAILED(rc)) hidFinalizeSevenSixAxisSensor(); - return rc; - } - if (R_FAILED(rc)) { tmemClose(&g_sevenSixAxisSensorTmem0); tmemClose(&g_sevenSixAxisSensorTmem1);