Merge pull request #7334 from m4xw/libnx

[LIBNX] Add Split Joycon support
This commit is contained in:
Twinaphex 2018-10-01 00:13:16 +02:00 committed by GitHub
commit c8a764177e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -154,21 +154,24 @@ static void switch_joypad_destroy(void)
#ifdef HAVE_LIBNX #ifdef HAVE_LIBNX
int lastMode = 0; // 0 = handheld, 1 = whatever int lastMode = 0; // 0 = handheld, 1 = whatever
static void switch_joypad_poll(void) static void switch_joypad_poll(void)
{ {
settings_t *settings = config_get_ptr(); settings_t *settings = config_get_ptr();
hidScanInput(); hidScanInput();
// TODO: Options via menu if (!hidGetHandheldMode())
/*if (settings->bools.split_joycon && !hidGetHandheldMode())
{ {
if (lastMode != 1) if (lastMode != 1)
{ {
RARCH_LOG("[HID] Enable Split Joycon!\n"); int i = 0;
hidSetNpadJoyAssignmentModeSingleByDefault(CONTROLLER_PLAYER_1); for(i = 0; i < MAX_USERS; i += 2){
hidSetNpadJoyAssignmentModeSingleByDefault(CONTROLLER_PLAYER_2); if(settings->uints.input_split_joycon[i]) // CONTROLLER_PLAYER_X, X == i++
{
hidSetNpadJoyAssignmentModeSingleByDefault(i);
hidSetNpadJoyAssignmentModeSingleByDefault(i + 1);
}
}
lastMode = 1; lastMode = 1;
} }
} }
@ -176,12 +179,17 @@ static void switch_joypad_poll(void)
{ {
if (lastMode != 0) if (lastMode != 0)
{ {
RARCH_LOG("[HID] Disable Split Joycon!\n"); int i = 0;
hidSetNpadJoyAssignmentModeDual(CONTROLLER_PLAYER_1); for(i = 0; i < MAX_USERS; i += 2){
hidSetNpadJoyAssignmentModeDual(CONTROLLER_PLAYER_2); if(settings->uints.input_split_joycon[i]) // CONTROLLER_PLAYER_X, X == i++
{
hidSetNpadJoyAssignmentModeDual(i);
hidSetNpadJoyAssignmentModeDual(i + 1);
}
}
lastMode = 0; lastMode = 0;
} }
}*/ }
for (int i = 0; i < MAX_PADS; i++) for (int i = 0; i < MAX_PADS; i++)
{ {