Mac: Prevent centering analog stick from affecting hat values

This commit is contained in:
Michael Buckley 2020-02-06 06:21:22 -08:00
parent 0a9d83654b
commit 4d0b99ef12
1 changed files with 15 additions and 3 deletions

View File

@ -194,14 +194,26 @@ void gamepadAction(void *inContext, IOReturn inResult, void *inSender, IOHIDValu
if (buttonCodeByJoypadInput.find(inputStruct) != buttonCodeByJoypadInput.end())
{
pressedGamepadButtons[playerNum][buttonCodeByJoypadInput[inputStruct]] = true;
pressedGamepadButtons[playerNum][buttonCodeByJoypadInput[oppositeInputStruct]] = false;
if ( buttonCodeByJoypadInput.find(oppositeInputStruct) != buttonCodeByJoypadInput.end() )
{
pressedGamepadButtons[playerNum][buttonCodeByJoypadInput[oppositeInputStruct]] = false;
}
}
else
{
oppositeInputStruct.value = info.min;
pressedGamepadButtons[playerNum][buttonCodeByJoypadInput[oppositeInputStruct]] = false;
if ( buttonCodeByJoypadInput.find(oppositeInputStruct) != buttonCodeByJoypadInput.end() )
{
pressedGamepadButtons[playerNum][buttonCodeByJoypadInput[oppositeInputStruct]] = false;
}
oppositeInputStruct.value = info.max;
pressedGamepadButtons[playerNum][buttonCodeByJoypadInput[oppositeInputStruct]] = false;
if ( buttonCodeByJoypadInput.find(oppositeInputStruct) != buttonCodeByJoypadInput.end() )
{
pressedGamepadButtons[playerNum][buttonCodeByJoypadInput[oppositeInputStruct]] = false;
}
}
}
else if (info.usage == kHIDUsage_GD_Hatswitch)