Skip to content
Draft
Show file tree
Hide file tree
Changes from 11 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions VisualC-GDK/SDL/SDL.vcxproj
Original file line number Diff line number Diff line change
Expand Up @@ -729,6 +729,7 @@
<ClCompile Include="..\..\src\joystick\hidapi\SDL_hidapi_ps3.c" />
<ClCompile Include="..\..\src\joystick\hidapi\SDL_hidapi_ps4.c" />
<ClCompile Include="..\..\src\joystick\hidapi\SDL_hidapi_ps5.c" />
<ClCompile Include="..\..\src\joystick\hidapi\SDL_hidapi_psmove.c" />
<ClCompile Include="..\..\src\joystick\hidapi\SDL_hidapi_rumble.c" />
<ClCompile Include="..\..\src\joystick\hidapi\SDL_hidapi_shield.c" />
<ClCompile Include="..\..\src\joystick\hidapi\SDL_hidapi_sinput.c" />
Expand Down
1 change: 1 addition & 0 deletions VisualC-GDK/SDL/SDL.vcxproj.filters
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,7 @@
<ClCompile Include="..\..\src\joystick\hidapi\SDL_hidapi_ps3.c" />
<ClCompile Include="..\..\src\joystick\hidapi\SDL_hidapi_ps4.c" />
<ClCompile Include="..\..\src\joystick\hidapi\SDL_hidapi_ps5.c" />
<ClCompile Include="..\..\src\joystick\hidapi\SDL_hidapi_psmove.c" />
<ClCompile Include="..\..\src\joystick\hidapi\SDL_hidapi_rumble.c" />
<ClCompile Include="..\..\src\joystick\hidapi\SDL_hidapi_shield.c" />
<ClCompile Include="..\..\src\joystick\hidapi\SDL_hidapi_sinput.c" />
Expand Down
1 change: 1 addition & 0 deletions VisualC/SDL/SDL.vcxproj
Original file line number Diff line number Diff line change
Expand Up @@ -620,6 +620,7 @@
<ClCompile Include="..\..\src\joystick\hidapi\SDL_hidapi_ps3.c" />
<ClCompile Include="..\..\src\joystick\hidapi\SDL_hidapi_ps4.c" />
<ClCompile Include="..\..\src\joystick\hidapi\SDL_hidapi_ps5.c" />
<ClCompile Include="..\..\src\joystick\hidapi\SDL_hidapi_psmove.c" />
<ClCompile Include="..\..\src\joystick\hidapi\SDL_hidapi_rumble.c" />
<ClCompile Include="..\..\src\joystick\hidapi\SDL_hidapi_shield.c" />
<ClCompile Include="..\..\src\joystick\hidapi\SDL_hidapi_sinput.c" />
Expand Down
3 changes: 3 additions & 0 deletions VisualC/SDL/SDL.vcxproj.filters
Original file line number Diff line number Diff line change
Expand Up @@ -1260,6 +1260,9 @@
<ClCompile Include="..\..\src\joystick\hidapi\SDL_hidapi_ps5.c">
<Filter>joystick\hidapi</Filter>
</ClCompile>
<ClCompile Include="..\..\src\joystick\hidapi\SDL_hidapi_psmove.c">
<Filter>joystick\hidapi</Filter>
</ClCompile>
<ClCompile Include="..\..\src\joystick\hidapi\SDL_hidapi_rumble.c">
<Filter>joystick\hidapi</Filter>
</ClCompile>
Expand Down
2 changes: 1 addition & 1 deletion include/SDL3/SDL_gamepad.h
Original file line number Diff line number Diff line change
Expand Up @@ -167,7 +167,7 @@ typedef enum SDL_GamepadButton
SDL_GAMEPAD_BUTTON_DPAD_DOWN,
SDL_GAMEPAD_BUTTON_DPAD_LEFT,
SDL_GAMEPAD_BUTTON_DPAD_RIGHT,
SDL_GAMEPAD_BUTTON_MISC1, /**< Additional button (e.g. Xbox Series X share button, PS5 microphone button, Nintendo Switch Pro capture button, Amazon Luna microphone button, Google Stadia capture button) */
SDL_GAMEPAD_BUTTON_MISC1, /**< Additional button (e.g. Xbox Series X share button, PS5 microphone button, Nintendo Switch Pro capture button, Amazon Luna microphone button, Google Stadia capture button, PSMove Move Button) */
SDL_GAMEPAD_BUTTON_RIGHT_PADDLE1, /**< Upper or primary paddle, under your right hand (e.g. Xbox Elite paddle P1, DualSense Edge RB button, Right Joy-Con SR button) */
SDL_GAMEPAD_BUTTON_LEFT_PADDLE1, /**< Upper or primary paddle, under your left hand (e.g. Xbox Elite paddle P3, DualSense Edge LB button, Left Joy-Con SL button) */
SDL_GAMEPAD_BUTTON_RIGHT_PADDLE2, /**< Lower or secondary paddle, under your right hand (e.g. Xbox Elite paddle P2, DualSense Edge right Fn button, Right Joy-Con SL button) */
Expand Down
17 changes: 17 additions & 0 deletions include/SDL3/SDL_hints.h
Original file line number Diff line number Diff line change
Expand Up @@ -1674,6 +1674,23 @@ extern "C" {
*/
#define SDL_HINT_JOYSTICK_HIDAPI_PS5_PLAYER_LED "SDL_JOYSTICK_HIDAPI_PS5_PLAYER_LED"

/**
* A variable controlling whether the HIDAPI driver for PSMove controllers should
* be used.
*
* The variable can be set to the following values:
*
* - "0": HIDAPI driver is not used.
* - "1": HIDAPI driver is used.
*
* The default is the value of SDL_HINT_JOYSTICK_HIDAPI.
*
* This hint should be set before initializing joysticks and gamepads.
*
* \since This hint is available since SDL 3.4.0.
*/
#define SDL_HINT_JOYSTICK_HIDAPI_PSMOVE "SDL_JOYSTICK_HIDAPI_PSMOVE"

/**
* A variable controlling whether the HIDAPI driver for NVIDIA SHIELD
* controllers should be used.
Expand Down
4 changes: 4 additions & 0 deletions src/joystick/SDL_gamepad.c
Original file line number Diff line number Diff line change
Expand Up @@ -1209,6 +1209,10 @@ static GamepadMapping_t *SDL_CreateMappingForHIDAPIGamepad(SDL_GUID guid)
product == USB_PRODUCT_8BITDO_SF30_PRO_BT)) {
// This controller has no guide button
SDL_strlcat(mapping_string, "a:b1,b:b0,back:b4,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,leftshoulder:b9,leftstick:b7,lefttrigger:a4,leftx:a0,lefty:a1,rightshoulder:b10,rightstick:b8,righttrigger:a5,rightx:a2,righty:a3,start:b6,x:b3,y:b2,hint:!SDL_GAMECONTROLLER_USE_BUTTON_LABELS:=1,", sizeof(mapping_string));
} else if (vendor == USB_VENDOR_SONY &&
(product == USB_PRODUCT_SONY_PSMOVE ||
product == USB_PRODUCT_SONY_PSMOVE_V2)) {
SDL_strlcat(mapping_string, "a:b0,b:b1,back:b4,guide:b5,misc1:b7,righttrigger:a0,start:b6,x:b2,y:b3,", sizeof(mapping_string));
} else if (SDL_IsJoystickSInputController(vendor, product)) {

Uint8 face_style = (guid.data[15] & 0xE0) >> 5;
Expand Down
11 changes: 11 additions & 0 deletions src/joystick/SDL_joystick.c
Original file line number Diff line number Diff line change
Expand Up @@ -3191,6 +3191,17 @@ bool SDL_IsJoystickDualSenseEdge(Uint16 vendor_id, Uint16 product_id)
return false;
}

bool SDL_IsJoystickPSMove(Uint16 vendor_id, Uint16 product_id)
{
if (vendor_id == USB_VENDOR_SONY && product_id == USB_PRODUCT_SONY_PSMOVE) {
return true;
}
if (vendor_id == USB_VENDOR_SONY && product_id == USB_PRODUCT_SONY_PSMOVE_V2) {
return true;
}
return false;
}

bool SDL_IsJoystickNintendoSwitchPro(Uint16 vendor_id, Uint16 product_id)
{
EControllerType eType = GuessControllerType(vendor_id, product_id);
Expand Down
3 changes: 3 additions & 0 deletions src/joystick/SDL_joystick_c.h
Original file line number Diff line number Diff line change
Expand Up @@ -105,6 +105,9 @@ extern bool SDL_IsJoystickPS4(Uint16 vendor_id, Uint16 product_id);
extern bool SDL_IsJoystickPS5(Uint16 vendor_id, Uint16 product_id);
extern bool SDL_IsJoystickDualSenseEdge(Uint16 vendor_id, Uint16 product_id);

// Function to return whether a joystick is a PSMove controller
extern bool SDL_IsJoystickPSMove(Uint16 vendor_id, Uint16 product_id);

// Function to return whether a joystick is a Nintendo Switch Pro controller
extern bool SDL_IsJoystickNintendoSwitchPro(Uint16 vendor_id, Uint16 product_id);
extern bool SDL_IsJoystickNintendoSwitchProInputOnly(Uint16 vendor_id, Uint16 product_id);
Expand Down
2 changes: 1 addition & 1 deletion src/joystick/controller_type.h
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@
#endif

//-----------------------------------------------------------------------------
// Purpose: Steam Controller models
// Purpose: Steam Controller models
// WARNING: DO NOT RENUMBER EXISTING VALUES - STORED IN A DATABASE
//-----------------------------------------------------------------------------
typedef enum
Expand Down
Loading
Loading