mirror of
				https://github.com/Ryujinx/SDL.git
				synced 2025-11-04 10:34:56 +00:00 
			
		
		
		
	Fixed analog triggers on the DualSense controller
(cherry picked from commit a67d41050164e447048fa55179cc31b23be9d9b7)
This commit is contained in:
		
							parent
							
								
									eb0d214c17
								
							
						
					
					
						commit
						f444eac557
					
				| 
						 | 
				
			
			@ -1088,9 +1088,17 @@ static void HIDAPI_DriverPS5_HandleSimpleStatePacket(SDL_Joystick *joystick, SDL
 | 
			
		|||
        SDL_PrivateJoystickButton(joystick, SDL_CONTROLLER_BUTTON_MISC1, (data & 0x02) ? SDL_PRESSED : SDL_RELEASED);
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    if (packet->ucTriggerLeft == 0 && (packet->rgucButtonsHatAndCounter[1] & 0x04)) {
 | 
			
		||||
        axis = SDL_JOYSTICK_AXIS_MAX;
 | 
			
		||||
    } else {
 | 
			
		||||
        axis = ((int)packet->ucTriggerLeft * 257) - 32768;
 | 
			
		||||
    }
 | 
			
		||||
    SDL_PrivateJoystickAxis(joystick, SDL_CONTROLLER_AXIS_TRIGGERLEFT, axis);
 | 
			
		||||
    if (packet->ucTriggerRight == 0 && (packet->rgucButtonsHatAndCounter[1] & 0x08)) {
 | 
			
		||||
        axis = SDL_JOYSTICK_AXIS_MAX;
 | 
			
		||||
    } else {
 | 
			
		||||
        axis = ((int)packet->ucTriggerRight * 257) - 32768;
 | 
			
		||||
    }
 | 
			
		||||
    SDL_PrivateJoystickAxis(joystick, SDL_CONTROLLER_AXIS_TRIGGERRIGHT, axis);
 | 
			
		||||
    axis = ((int)packet->ucLeftJoystickX * 257) - 32768;
 | 
			
		||||
    SDL_PrivateJoystickAxis(joystick, SDL_CONTROLLER_AXIS_LEFTX, axis);
 | 
			
		||||
| 
						 | 
				
			
			@ -1186,13 +1194,13 @@ static void HIDAPI_DriverPS5_HandleStatePacketCommon(SDL_Joystick *joystick, SDL
 | 
			
		|||
        SDL_PrivateJoystickButton(joystick, SDL_CONTROLLER_BUTTON_PS5_RIGHT_PADDLE, (data & 0x80) ? SDL_PRESSED : SDL_RELEASED);
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    if (packet->rgucButtonsAndHat[1] & 0x04) {
 | 
			
		||||
    if (packet->ucTriggerLeft == 0 && (packet->rgucButtonsAndHat[1] & 0x04)) {
 | 
			
		||||
        axis = SDL_JOYSTICK_AXIS_MAX;
 | 
			
		||||
    } else {
 | 
			
		||||
        axis = ((int)packet->ucTriggerLeft * 257) - 32768;
 | 
			
		||||
    }
 | 
			
		||||
    SDL_PrivateJoystickAxis(joystick, SDL_CONTROLLER_AXIS_TRIGGERLEFT, axis);
 | 
			
		||||
    if (packet->rgucButtonsAndHat[1] & 0x08) {
 | 
			
		||||
    if (packet->ucTriggerRight == 0 && (packet->rgucButtonsAndHat[1] & 0x08)) {
 | 
			
		||||
        axis = SDL_JOYSTICK_AXIS_MAX;
 | 
			
		||||
    } else {
 | 
			
		||||
        axis = ((int)packet->ucTriggerRight * 257) - 32768;
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
		Reference in a new issue