equal
deleted
inserted
replaced
358 { |
358 { |
359 /* Initialize LED and effect state */ |
359 /* Initialize LED and effect state */ |
360 HIDAPI_DriverPS4_Rumble(context, joystick, 0, 0, 0); |
360 HIDAPI_DriverPS4_Rumble(context, joystick, 0, 0, 0); |
361 |
361 |
362 /* Initialize the joystick capabilities */ |
362 /* Initialize the joystick capabilities */ |
363 joystick->nbuttons = SDL_CONTROLLER_BUTTON_MAX; |
363 joystick->nbuttons = 16; |
364 joystick->naxes = SDL_CONTROLLER_AXIS_MAX; |
364 joystick->naxes = SDL_CONTROLLER_AXIS_MAX; |
365 joystick->epowerlevel = SDL_JOYSTICK_POWER_WIRED; |
365 joystick->epowerlevel = SDL_JOYSTICK_POWER_WIRED; |
366 |
366 |
367 return SDL_TRUE; |
367 return SDL_TRUE; |
368 } |
368 } |
513 |
513 |
514 if (ctx->last_state.rgucButtonsHatAndCounter[2] != packet->rgucButtonsHatAndCounter[2]) { |
514 if (ctx->last_state.rgucButtonsHatAndCounter[2] != packet->rgucButtonsHatAndCounter[2]) { |
515 Uint8 data = (packet->rgucButtonsHatAndCounter[2] & 0x03); |
515 Uint8 data = (packet->rgucButtonsHatAndCounter[2] & 0x03); |
516 |
516 |
517 SDL_PrivateJoystickButton(joystick, SDL_CONTROLLER_BUTTON_GUIDE, (data & 0x01) ? SDL_PRESSED : SDL_RELEASED); |
517 SDL_PrivateJoystickButton(joystick, SDL_CONTROLLER_BUTTON_GUIDE, (data & 0x01) ? SDL_PRESSED : SDL_RELEASED); |
|
518 SDL_PrivateJoystickButton(joystick, 15, (data & 0x02) ? SDL_PRESSED : SDL_RELEASED); |
518 } |
519 } |
519 |
520 |
520 axis = ((int)packet->ucTriggerLeft * 257) - 32768; |
521 axis = ((int)packet->ucTriggerLeft * 257) - 32768; |
521 SDL_PrivateJoystickAxis(joystick, SDL_CONTROLLER_AXIS_TRIGGERLEFT, axis); |
522 SDL_PrivateJoystickAxis(joystick, SDL_CONTROLLER_AXIS_TRIGGERLEFT, axis); |
522 axis = ((int)packet->ucTriggerRight * 257) - 32768; |
523 axis = ((int)packet->ucTriggerRight * 257) - 32768; |