mirror of
https://github.com/switchbrew/libnx.git
synced 2025-06-21 20:42:44 +02:00
hid: Read SystemExt/System first in hidScanInput for compatibility with old homebrew
This commit is contained in:
parent
676f254be1
commit
ab71d6033a
@ -206,7 +206,23 @@ void hidScanInput(void) {
|
||||
u32 style_set = hidGetNpadStyleSet(id);
|
||||
size_t total_out=0;
|
||||
|
||||
if (style_set & HidNpadStyleTag_NpadFullKey) {
|
||||
if (style_set & HidNpadStyleTag_NpadSystemExt) {
|
||||
HidNpadSystemExtState state={0};
|
||||
total_out = hidGetNpadStatesSystemExt(id, &state, 1);
|
||||
if (total_out) {
|
||||
g_controllerHeld[i] |= state.buttons;
|
||||
memcpy(&g_controllerEntries[i], &state, sizeof(state));
|
||||
}
|
||||
}
|
||||
else if (style_set & HidNpadStyleTag_NpadSystem) {
|
||||
HidNpadSystemState state={0};
|
||||
total_out = hidGetNpadStatesSystem(id, &state, 1);
|
||||
if (total_out) {
|
||||
g_controllerHeld[i] |= state.buttons;
|
||||
memcpy(&g_controllerEntries[i], &state, sizeof(state));
|
||||
}
|
||||
}
|
||||
else if (style_set & HidNpadStyleTag_NpadFullKey) {
|
||||
HidNpadFullKeyState state={0};
|
||||
total_out = hidGetNpadStatesFullKey(id, &state, 1);
|
||||
if (total_out) {
|
||||
@ -246,22 +262,6 @@ void hidScanInput(void) {
|
||||
memcpy(&g_controllerEntries[i], &state, sizeof(state));
|
||||
}
|
||||
}
|
||||
else if (style_set & HidNpadStyleTag_NpadSystemExt) {
|
||||
HidNpadSystemExtState state={0};
|
||||
total_out = hidGetNpadStatesSystemExt(id, &state, 1);
|
||||
if (total_out) {
|
||||
g_controllerHeld[i] |= state.buttons;
|
||||
memcpy(&g_controllerEntries[i], &state, sizeof(state));
|
||||
}
|
||||
}
|
||||
else if (style_set & HidNpadStyleTag_NpadSystem) {
|
||||
HidNpadSystemState state={0};
|
||||
total_out = hidGetNpadStatesSystem(id, &state, 1);
|
||||
if (total_out) {
|
||||
g_controllerHeld[i] |= state.buttons;
|
||||
memcpy(&g_controllerEntries[i], &state, sizeof(state));
|
||||
}
|
||||
}
|
||||
|
||||
g_controllerDown[i] = (~g_controllerOld[i]) & g_controllerHeld[i];
|
||||
g_controllerUp[i] = g_controllerOld[i] & (~g_controllerHeld[i]);
|
||||
|
Loading…
Reference in New Issue
Block a user