mirror of
https://github.com/switchbrew/libnx.git
synced 2025-06-22 21:02:39 +02:00
hid: Use _hidActivateConsoleSixAxisSensor instead of _hidActivateSevenSixAxisSensor, and moved the code using this to near the start of hidInitializeSevenSixAxisSensor.
This commit is contained in:
parent
167bd9e110
commit
2b6197a51a
@ -1078,8 +1078,8 @@ Result hidStopSixAxisSensor(u32 SixAxisSensorHandle) {
|
|||||||
return rc;
|
return rc;
|
||||||
}
|
}
|
||||||
|
|
||||||
static Result _hidActivateSevenSixAxisSensor(void) {
|
static Result _hidActivateConsoleSixAxisSensor(void) {
|
||||||
if (hosversionBefore(5,0,0))
|
if (hosversionBefore(3,0,0))
|
||||||
return MAKERESULT(Module_Libnx, LibnxError_IncompatSysVer);
|
return MAKERESULT(Module_Libnx, LibnxError_IncompatSysVer);
|
||||||
|
|
||||||
return _hidCmdWithNoInput(303);
|
return _hidCmdWithNoInput(303);
|
||||||
@ -1129,6 +1129,9 @@ Result hidInitializeSevenSixAxisSensor(void) {
|
|||||||
if (g_sevenSixAxisSensorBuffer != NULL)
|
if (g_sevenSixAxisSensorBuffer != NULL)
|
||||||
return MAKERESULT(Module_Libnx, LibnxError_AlreadyInitialized);
|
return MAKERESULT(Module_Libnx, LibnxError_AlreadyInitialized);
|
||||||
|
|
||||||
|
rc = _hidActivateConsoleSixAxisSensor();
|
||||||
|
if (R_FAILED(rc)) return rc;
|
||||||
|
|
||||||
g_sevenSixAxisSensorBuffer = (u8*)memalign(0x1000, bufsize);
|
g_sevenSixAxisSensorBuffer = (u8*)memalign(0x1000, bufsize);
|
||||||
if (g_sevenSixAxisSensorBuffer == NULL)
|
if (g_sevenSixAxisSensorBuffer == NULL)
|
||||||
return MAKERESULT(Module_Libnx, LibnxError_OutOfMemory);
|
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 = _hidInitializeSevenSixAxisSensor(&g_sevenSixAxisSensorTmem0, &g_sevenSixAxisSensorTmem1);
|
||||||
|
|
||||||
if (R_SUCCEEDED(rc)) {
|
|
||||||
rc = _hidActivateSevenSixAxisSensor();
|
|
||||||
if (R_FAILED(rc)) hidFinalizeSevenSixAxisSensor();
|
|
||||||
return rc;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (R_FAILED(rc)) {
|
if (R_FAILED(rc)) {
|
||||||
tmemClose(&g_sevenSixAxisSensorTmem0);
|
tmemClose(&g_sevenSixAxisSensorTmem0);
|
||||||
tmemClose(&g_sevenSixAxisSensorTmem1);
|
tmemClose(&g_sevenSixAxisSensorTmem1);
|
||||||
|
Loading…
Reference in New Issue
Block a user