Closed TaaTT4 closed 2 years ago
How high is the priority for this bug? I can't use newer versions than 2.0.12 without Rumble.
A colleague has confirmed this still occurs for 2.0.16.
I have been dealing with this for months and discovered that this only occurs when using the autoconf ./configure script. If I build with CMake it works as expected. Which is extremely strange.
I also have the problem and I used Visual Studio to compile it.
Update: Disregard this comment. It appears that CMake (-G "Visual Studio 16 2019" -A "x64") using the release-2.0.16 commit still has this issue. Though if anybody else can test that would be appreciated.
Colleague has spotted this in the CMake, which may be the cause of CMake builds working. CMake builds appear to intentionally disable whatever is causing issues. https://github.com/libsdl-org/SDL/blob/77c8d111370b1dd0d62371c484c95468e645f3d7/CMakeLists.txt#L166-L177
Not sure if using CMake still fixes the issue for 2.0.16 though. The above may be a red herring.
2.0.16 does not seem to work with CMake either, but rolling back to 2.0.14 does. This leads me to believe it's an issue with SDL_JOYSTICK_RAWINPUT.
FYI, for gamepads the haptic interfaces are deprecated in favor of SDL_GameControllerRumble(), which is implemented on more platforms for game controllers. The haptic API in general is moving towards just supporting wheels and flightsticks.
And SDL_GameControllerRumble also works with the Xbox controllers on windows?
And SDL_GameControllerRumble also works with the Xbox controllers on windows?
Yes, it does.
I have tried the SDL_GameControllerRumble function in 2.0.16. It always works with my X360 gamepad with the wireless adapter. My Xbox One (Bluetooth) gamepad sometimes works. Sometimes not. Sometimes a few times and then it stops working. But the function always returns 0.
After many tests on 2.0.16 I noticed that Rumble works when the controller is turned on before SDL_Init. It does not work if the controller is turned on after. Also, all joystick events are fired 3 times on my Xbox 360 gamepad and 2 times on my Xbox One gamepad with different deviceIndex and InstanceID. As if the gamepads exist multiple times. SDL_NumJoysticks also shows too many joysticks to match. This does not happen with 2.0.12. My code is the same. Should I open a ticket? But you should have noticed it.
After many tests on 2.0.16 I noticed that Rumble works when the controller is turned on before SDL_Init. It does not work if the controller is turned on after. Also, all joystick events are fired 3 times on my Xbox 360 gamepad and 2 times on my Xbox One gamepad with different deviceIndex and InstanceID. As if the gamepads exist multiple times. SDL_NumJoysticks also shows too many joysticks to match. This does not happen with 2.0.12. My code is the same. Should I open a ticket? But you should have noticed it.
We haven't seen these issues here. Can you please open another bug to track this?
So I looked into this a bit more by adding SDL_GameController support to my code, and it A) crashes in SDL_GameControllerRumble if I unconditionally open my first party wireless Xbox One S controller as one, and B) does not appear to be recognized as a controller by SDL_IsGameController. This is using 2.0.16, and I'm unsure if I'm doing something wrong on my end, as it is a custom build of SDL (but it shouldn't have any patches). Let me know what information I should provide, as I don't know how to debug this deeper.
What platform are you running? I can do a video call and interactively debug with you, just send a meeting invite to slouken@libsdl.org and reference this issue so I know the context.
It's running on Windows 10 x64, but it's built with mingw-w64 in a Docker image I maintain. I don't tend to do video calls so I don't even have a platform of preference there...
I can try making a debug build of SDL and putting it in gdb to start with I suppose. Mostly I just wanted to record this information for later when I have more time.
Can you attach your include/SDL_config.h?
Do you get the same problem from the official SDL release? https://www.libsdl.org/release/SDL2-2.0.16-win32-x64.zip
I'll try the official release sometime later (I'm pretty busy today).
It should work with that config. In theory it'll hit the rawinput driver and use XInput for the actual rumbling. Can you build and debug with gdb to find out what's actually happening?
Is this still active? I can't reproduce it here, and if nobody else can debug it we'll have to move it out of the 2.0.18 milestone.
@cgutman, have you seen anything like this in your testing?
Sorry, I've been in the middle of a move and haven't had time to test this. I can try and do this in the coming days.
@cgutman may have fixed this recently. Can you try this with the latest snapshot? http://www.libsdl.org/tmp/SDL-2.0.zip
I'm not getting any rumble from PS4 controllers, or LEDs. I am using SDL_HINT_JOYSTICK_HIDAPI_PS4_RUMBLE
.
When I use SDL_SetHint(SDL_HINT_JOYSTICK_RAWINPUT, "0");
I am getting a load of "Passed a NULL mutex" errors. I don't know what triggers the error without digging deeper, but I don't get this error unless RAWINPUT is disabled.
I am very keen to see what everyone else is experiencing since the recent changes?
This bug is extremely general, and I'm not sure what's still an issue and what isn't, so I'm going to close it in favor or more specific bugs that can be triaged and fixed.
Please enter new bugs for each issue you're seeing in the latest SDL snapshot: http://www.libsdl.org/tmp/SDL-2.0.zip
Thanks!
This bug is extremely general, and I'm not sure what's still an issue and what isn't, so I'm going to close it in favor or more specific bugs that can be triaged and fixed.
Have more specific bugs been reported that cover the scope of this issue? I don't mean to sound entitled but it would be a real nuisance if these issues are still present for 2.0.18 when previously this had been marked for something that should be resolved by its release.
Nope, please feel free to report them. I don't have repro steps for anything that is still active.
Both valid points guys. The issues still persist. The best way to fix them is to focus on describing them accurately and reproducing them. Slouken is being reasonable.
I'm having problems pin-pointing issues because I don't real PS4 controller - I've already bought way too many controllers and need to quell my addiction to it, lol.
I need others to compare my experiences with the issues, but nobody has come forward in spite of me posting about it for weeks now
I finally got time to debug the issue; it appears that the RAWINPUT driver does not create an SDL_Haptic device, so my attempt to pull one out of the joystick failed. Using SDL_JoystickRumble works however. If you think this constitutes a bug or functional regression I can open a new bug @slouken
@AntTheAlchemist I have not seen the behavior you've described here with my PS4 controller (either the NULL mutex error or lack of rumble/LED controls). It may well be due to the fact that it's not an official PS4 controller, but we will need more details to attempt to reproduce it.
Specifically we need at least:
testgamecontroller
is a good place to start to see if you can reproduce it with known good code.If you can still reproduce it with the latest code, please open a new issue with the above information. Don't worry too much about trying to corroborate your issue with someone else. We'd rather you file it and discover it's something to do with your code or controller vs. not filing it and releasing 2.0.18 with a real bug.
@endrift That's correct. We've informally discussed backwards compatibility with SDL_Haptic already, so I filed #4970 to track that work.
@cgutman thank-you for giving this attention. I've done some experimenting and this is what I've observed.
So I have this very nice PS4 hybrid controller (named PS-P01-WirelessController) that also has an Xbox mode. Rumble works on Xbox mode, so I know it's working mechanically. It has an LED with RGB elements which change colour depending on the mode it switches to. It has a touchpad.
Testing on Windows 10:
Testing on Android:
on bluetooth there are no sensors, features, or touchpad reported and product version is 65535. GUID is 0500000004c050000c4050000ffff3f00 (might have typed that wrong visually from phone). 21 buttons being reported. Wired product version is "0" and GUID is 030000004c050000c405000000006800. 16 buttons reported. The rest works the same as Windows 10 wired with the LED and rumble not working.
Here's the info my app spits out about the controller when wired (over bluetooth it has a product version of "0"):
Hopefully that paints a picture. I think it's more than just the controller being the issue since sensors and touchpad work, but then 0s coming through on bluetooth for both.
Before I post a new issue I would like to test the controller with something else. Can you recommend a game or app (other than mine, lol) that uses the touchpad, sensors & LED?
Someone on SDL forums just posted that they're having no issues with setting the LED on Win10 with a clone PS4 controller. I'm going to have to concede that the problem is with the game controller I have. It's a shame because it's a nice controller.
FYI, for gamepads the haptic interfaces are deprecated in favor of SDL_GameControllerRumble(), which is implemented on more platforms for game controllers. The haptic API in general is moving towards just supporting wheels and flightsticks.
@slouken, I believe it's a practical thing to "make it official" in the next release notes, just to avoid confusion. Just a thought.
We will make it official for SDL3, which is coming after the next release.
Haptic effects (so as rumble, I guess) aren't usable in SDL 2.0.14 on Windows 10 19043.1052.
Please see the following links for additional info:
The main problem is that
SDL_SYS_JoystickIsHaptic
returns 0 for both an Xbox One (original) and an Xbox 360 (compatible) controller since they both useSDL_RAWINPUT_JoystickDriver
. Disabling the raw input driver via a hint (SDL_SetHint(SDL_HINT_JOYSTICK_RAWINPUT, "0");
) as someone suggested seems to fix the issue at least for the Xbox 360 controller (the Xbox One controller switch toSDL_WGI_JoystickDriver
instead), but mess up things for other devices (e.g. Fanatec Podium DD1 wheel base).Replacing
SDL_HapticOpenFromJoystick
withSDL_HapticOpen
bypass the issue, but is not a working solution in the general case (with more than one controller plugged in) since indices of joysticks and haptic devices aren't related each other. And there's no either a way to map joysticks with haptic devices afterwards their creation.