Generalized the XInput user index into a player index

This commit is contained in:
Sam Lantinga
2018-10-25 16:53:14 -07:00
parent 545febcf21
commit 14329256cb
18 changed files with 138 additions and 18 deletions

View File

@@ -312,6 +312,8 @@ SDL_XINPUT_JoystickOpen(SDL_Joystick * joystick, JoyStick_DeviceData *joystickde
SDL_assert(XINPUTSETSTATE);
SDL_assert(userId < XUSER_MAX_COUNT);
joystick->player_index = userId;
joystick->hwdata->bXInputDevice = SDL_TRUE;
if (XINPUTGETCAPABILITIES(userId, XINPUT_FLAG_GAMEPAD, &capabilities) != ERROR_SUCCESS) {
@@ -322,7 +324,6 @@ SDL_XINPUT_JoystickOpen(SDL_Joystick * joystick, JoyStick_DeviceData *joystickde
SDL_zero(state);
joystick->hwdata->bXInputHaptic = (XINPUTSETSTATE(userId, &state) == ERROR_SUCCESS);
joystick->hwdata->userid = userId;
joystick->userid = userId;
/* The XInput API has a hard coded button/axis mapping, so we just match it */
if (SDL_XInputUseOldJoystickMapping()) {