Call XInputGetState only when XInputGetExtended is not

This commit is contained in:
Silent 2018-10-30 00:15:21 +01:00 committed by Jonathan Li
parent a3c6ad636b
commit c280d69d6f
1 changed files with 6 additions and 5 deletions

View File

@ -161,13 +161,14 @@ public:
{
if (!active)
return 0;
XINPUT_STATE state;
if (ERROR_SUCCESS != pXInputGetStateEx(index, &state)) {
Deactivate();
return 0;
}
SCP_EXTN pressure;
if (!pXInputGetExtended || (ERROR_SUCCESS != pXInputGetExtended(index, &pressure))) {
XINPUT_STATE state;
if (ERROR_SUCCESS != pXInputGetStateEx(index, &state)) {
Deactivate();
return 0;
}
int buttons = state.Gamepad.wButtons;
for (int i = 0; i < 15; i++) {
physicalControlState[i] = ((buttons >> physicalControls[i].id) & 1) << 16;