libsdl-org / SDL

Simple Directmedia Layer
https://libsdl.org
zlib License
9.98k stars 1.84k forks source link

PS3 controller visible on windows 10 devices but not seen by SDL2? #9935

Open paulvirtuel opened 5 months ago

paulvirtuel commented 5 months ago

I can see those controllers on my Windows 10 PC "bluetooth and other devices" list: PLAYSTATION(R)3 Controller Xbox Series X Controller

I am calling these functions to enable the joystick/controller events: if (SDL_Init(... | SDL_INIT_JOYSTICK | SDL_INIT_GAMECONTROLLER | ...) != 0) { ... SDL_JoystickEventState(SDL_ENABLE); SDL_GameControllerEventState(SDL_ENABLE); }

I am processing the events SDL_JOYDEVICEADDED and only getting one device, an XBOX one controller.

The function SDL_NumJoysticks() returns 1, which, when I use the functions (SDL_JoystickOpen, SDL_JoystickName) or (SDL_JoystickNameForIndex), returns the string "Controller (Xbox One For Windows)".

I am wondering if there is something special to do for that PS3 controller?

slouken commented 5 months ago

Does the PS3 controller work if you open the Windows game controller settings? Usually you need a special driver to use a PS3 controller on Windows.

paulvirtuel commented 5 months ago

Thanks for helping. Yes, it works in the Windows game controller settings. I see the joystick cursor moving and the button press too. I am using the Nefarius drivers.

slouken commented 5 months ago

@nefarius, do you have any insight here?

nefarius commented 5 months ago

Thanks for helping. Yes, it works in the Windows game controller settings. I see the joystick cursor moving and the button press too. I am using the Nefarius drivers.

What's your configuration, what mode are you using? Wired? Wireless?

paulvirtuel commented 5 months ago

Thanks for helping.

I am on a Windows 10 PC. The game controller is an original Sony PS3 sixaxis that came with my PS3. I am using a USB wire to connect. The HID device mode is set to Xinput.

Not sure how it impacts the driver, but I am using it remotely. Meaning I have the PS3 controller connected to my laptop USB port. I am using a remote desktop feature that allows USB devices to connect remotely. This guide explains how to set it up: https://www.gavpugh.com/2018/10/03/using-game-controllers-over-a-remote-desktop-session/

After a bit more investigation, it seems to work ok when I plug it directly on the computer running my game. But when connected remotely, SDL does not see it. The DsHIDmini on the laptop and on the remote computer do show the PS3 controller though. It also works in the Windows game controller settings of the remotely accessed computer. I see the joystick cursor moving and the button press too.

nefarius commented 5 months ago

Well as per documentation you need to use SXS mode, not XInput, no wonder it doesn't work.

paulvirtuel commented 5 months ago

Thanks @nefarius, I have set both the laptop and the remote computer to SXS mode "SXS, Steam, RPCS3" and tried again but I did not see any difference. I am still able to see it in the Windows game controller settings, but SDL only reports the other game controller.

If it helps, the Nefarius drivers are version 2.2.282.0

paulvirtuel commented 5 months ago

Is there some way to figure out why SDL is not seeing the PS3 controller?

nefarius commented 5 months ago

Can you share a build-able demo project? I haven't set up anything with SDL in ages, would help trying to reproduce it.