input-overlay icon indicating copy to clipboard operation
input-overlay copied to clipboard

Gamepad issues

Open univrsal opened this issue 2 years ago • 59 comments

I've just finished some tests with SDL2, and it seems like I could replace the gamepad library with it. Before I do that, it would be good to have some people test SDL2 with their game pads to see if the mappings are working. SDL2 is used in a lot of games so I assume there shouldn't be any issues. I've attached the SDL2 gamepad test.

sdl2.gamepadtest.zip image Holding shift will show the back of the controller with additional buttons.

I'll also close all gamepad related issues and we'll just use this issue to collect information regarding gamepads.

SDL2 tests so far

Previous gamepad issues: #294

  • LT + RT should be representable with buttons (Not an issue with mappings, but rather something I'd need to change in input overlay)
  • There should be an option for a "capture" or "share" button alongside the "guide" button since newer controllers also have this button. Not super important, but, might as well be a thing. (I assume SDL2 has this)

#286, #253 Should be fixed when using SDL2 #260 Should work with SDL2, if not I won't spend any additional time on this for now #208 Apparently a crash with the gamepad library, should be fixed when using SDL2. #195, #191 Mapping/ D-Pad issue should be fixed with SDL2 #183 SDL2 should support xbox one gamepads just fine #175 More mapping issues once again SDL2 should handle them correctly #241 Another dpad issue #116 General issue with gamepad being detected #213 Razer Rajiu not being detected, apparently that is a controller, so sdl will most likely handle it just fine. #196 DirectInput implementation seemed to have caused stalls (probably waiting for a mutex)

Semi related issues: #285 The incorrect position of the analog sticks is an issue with the library using different value ranges for linux and windows #199 The binding tab will be removed as sdl2 should take care of correct bindings

univrsal avatar Dec 05 '22 23:12 univrsal

seems to work fine for me, even with everything else connected

Arbel-arad avatar Dec 06 '22 18:12 Arbel-arad

seems to work fine for me, even with everything else connected

Thanks for testing, since your issue was a crash we'll have to see if the problem was really fixed once I switch the plugin to sdl

univrsal avatar Dec 06 '22 19:12 univrsal

I don't think that testing via WINE would be a fair test of how the native Linux SDL performs, but SDL2 stuff works perfectly on my system and I think porting to SDL2 would probably fix all my issues.

Would be happy to help test anything or provide some code changes as well depending on what's needed.

FWIW, since Nintendo Switch controller support is relatively new on Linux, a lot of things don't properly support it (mapping the buttons wrong under the assumption it's just an Xbox controller), although SDL2 actually does support it correctly.

clarfonthey avatar Dec 07 '22 17:12 clarfonthey

I don't think that testing via WINE would be a fair test of how the native Linux SDL performs, but SDL2 stuff works perfectly on my system and I think porting to SDL2 would probably fix all my issues.

Would be happy to help test anything or provide some code changes as well depending on what's needed.

FWIW, since Nintendo Switch controller support is relatively new on Linux, a lot of things don't properly support it (mapping the buttons wrong under the assumption it's just an Xbox controller), although SDL2 actually does support it correctly.

You can compile the program yourself if you want, it's just https://github.com/univrsal/SDL/blob/main/test/testgamecontroller.c which is part of the sdl2 tests

univrsal avatar Dec 07 '22 18:12 univrsal

You can compile the program yourself if you want, it's just https://github.com/univrsal/SDL/blob/main/test/testgamecontroller.c which is part of the sdl2 tests

Tested in Linux with a PS3, PS4, and PS5 controller, seems to work fine on all.

HereInPlainSight avatar Dec 07 '22 21:12 HereInPlainSight

I can test it for Xbox and Xbox Elite controllers later today or tomorrow. Additionally, I will also submit new preset/design for the Xbox controller.

sanyer avatar Dec 08 '22 10:12 sanyer

You can compile the program yourself if you want, it's just https://github.com/univrsal/SDL/blob/main/test/testgamecontroller.c which is part of the sdl2 tests

Tested in Linux with a PS3, PS4, and PS5 controller, seems to work fine on all.

The ps4 and ps4 controller have a touch pad, right? Did sdl2 detect any input when you used them? (There probably won't be any visualization since the display uses an xbox gamepad, but maybe the console window shows something). Also did the button with the playstation logo work?

I can test it for Xbox and Xbox Elite controllers later today or tomorrow. Additionally, I will also submit new preset/design for the Xbox controller.

Can you also test if the guide button and the additional buttons work?

univrsal avatar Dec 08 '22 11:12 univrsal

Can you also test if the guide button and the additional buttons work?

Sure, will do.

sanyer avatar Dec 08 '22 11:12 sanyer

All buttons (including Guide) work. And I don't have controller with Share button, so couldn't test that. Sticks register direction correctly, but stick coordinates are all over the place, or at least it is hard to get consistent numbers, but perhaps it is just the internal thing as overlay always shows correct direction.

sanyer avatar Dec 08 '22 12:12 sanyer

All buttons (including Guide) work. And I don't have controller with Share button, so couldn't test that. Sticks register direction correctly, but stick coordinates are all over the place, or at least it is hard to get consistent numbers, but perhaps it is just the internal thing as overlay always shows correct direction.

Thanks for testing. I assume there's a way to convert the axis values if the interface shows the movements correctly.

univrsal avatar Dec 08 '22 12:12 univrsal

The ps4 and ps4 controller have a touch pad, right? Did sdl2 detect any input when you used them? (There probably won't be any visualization since the display uses an xbox gamepad, but maybe the console window shows something).

Yes, as you said, no visual indicator. (I had to filter out the gyro \ accelerometer lines via ./testgamecontroller 2>&1 | grep -v "gyro\|accelerometer", for any other Linux user looking to pull out useful output.) This was as quick a straight press on the touchpad on a PS5 controller as possible. Note that only the first line and the 'button touchpad release' had to do with me pressing down, the rest is all 'We see a finger!' output. It's very spammy.

INFO: Controller 5 button touchpad pressed
INFO: Controller 5 touchpad 0 finger 0 moved to 0.85, 0.48, 1.00
INFO: Controller 5 touchpad 0 finger 0 moved to 0.85, 0.48, 1.00
INFO: Controller 5 touchpad 0 finger 0 moved to 0.85, 0.47, 1.00
INFO: Controller 5 touchpad 0 finger 0 moved to 0.85, 0.47, 1.00
INFO: Controller 5 touchpad 0 finger 0 moved to 0.85, 0.47, 1.00
INFO: Controller 5 touchpad 0 finger 0 moved to 0.85, 0.47, 1.00
INFO: Controller 5 touchpad 0 finger 0 moved to 0.85, 0.47, 1.00
INFO: Controller 5 touchpad 0 finger 0 moved to 0.85, 0.47, 1.00
INFO: Controller 5 touchpad 0 finger 0 moved to 0.85, 0.47, 1.00
INFO: Controller 5 touchpad 0 finger 0 moved to 0.85, 0.47, 1.00
INFO: Controller 5 button touchpad released
INFO: Controller 5 touchpad 0 finger 0 moved to 0.85, 0.47, 1.00
INFO: Controller 5 touchpad 0 finger 0 moved to 0.85, 0.47, 1.00
INFO: Controller 5 touchpad 0 finger 0 moved to 0.85, 0.47, 1.00
INFO: Controller 5 touchpad 0 finger 0 moved to 0.85, 0.48, 1.00
INFO: Controller 5 touchpad 0 finger 0 moved to 0.85, 0.48, 1.00
INFO: Controller 5 touchpad 0 finger 0 moved to 0.85, 0.48, 1.00
INFO: Controller 5 touchpad 0 finger 0 moved to 0.85, 0.48, 1.00
INFO: Controller 5 touchpad 0 finger 0 moved to 0.85, 0.49, 1.00
INFO: Controller 5 touchpad 0 finger 0 moved to 0.85, 0.49, 1.00
INFO: Controller 5 touchpad 0 finger 0 moved to 0.85, 0.49, 1.00
INFO: Controller 5 touchpad 0 finger 0 moved to 0.85, 0.50, 1.00
INFO: Controller 5 touchpad 0 finger 0 moved to 0.85, 0.50, 1.00
INFO: Controller 5 touchpad 0 finger 0 released at 0.85, 0.50, 0.00

Also did the button with the playstation logo work?

Yes. It showed as the giant center button in the picture (output indicated the 'guide' button), and the microphone mute button was reflected in the button just under that (the 'misc1' button).


Unrelated to the rest, since people were talking about switch controllers, I found an off-brand pro version I had in the house, and it works as expected. Y and X are swapped visually, but report correctly, the same as B and A, since Nintendo and Microsoft seem to have reversed positioning on those compared to each other.

Edit: I forgot the switch controller had buttons on the back / bottom. These do not seem to report anything at all when pressed.

HereInPlainSight avatar Dec 08 '22 15:12 HereInPlainSight

The ps4 and ps4 controller have a touch pad, right? Did sdl2 detect any input when you used them? (There probably won't be any visualization since the display uses an xbox gamepad, but maybe the console window shows something).

Yes, as you said, no visual indicator. (I had to filter out the gyro \ accelerometer lines via ./testgamecontroller 2>&1 | grep -v "gyro\|accelerometer", for any other Linux user looking to pull out useful output.) This was as quick a straight press on the touchpad on a PS5 controller as possible. Note that only the first line and the 'button touchpad release' had to do with me pressing down, the rest is all 'We see a finger!' output. It's very spammy.

INFO: Controller 5 button touchpad pressed
INFO: Controller 5 touchpad 0 finger 0 moved to 0.85, 0.48, 1.00
INFO: Controller 5 touchpad 0 finger 0 moved to 0.85, 0.48, 1.00
INFO: Controller 5 touchpad 0 finger 0 moved to 0.85, 0.47, 1.00
INFO: Controller 5 touchpad 0 finger 0 moved to 0.85, 0.47, 1.00
INFO: Controller 5 touchpad 0 finger 0 moved to 0.85, 0.47, 1.00
INFO: Controller 5 touchpad 0 finger 0 moved to 0.85, 0.47, 1.00
INFO: Controller 5 touchpad 0 finger 0 moved to 0.85, 0.47, 1.00
INFO: Controller 5 touchpad 0 finger 0 moved to 0.85, 0.47, 1.00
INFO: Controller 5 touchpad 0 finger 0 moved to 0.85, 0.47, 1.00
INFO: Controller 5 touchpad 0 finger 0 moved to 0.85, 0.47, 1.00
INFO: Controller 5 button touchpad released
INFO: Controller 5 touchpad 0 finger 0 moved to 0.85, 0.47, 1.00
INFO: Controller 5 touchpad 0 finger 0 moved to 0.85, 0.47, 1.00
INFO: Controller 5 touchpad 0 finger 0 moved to 0.85, 0.47, 1.00
INFO: Controller 5 touchpad 0 finger 0 moved to 0.85, 0.48, 1.00
INFO: Controller 5 touchpad 0 finger 0 moved to 0.85, 0.48, 1.00
INFO: Controller 5 touchpad 0 finger 0 moved to 0.85, 0.48, 1.00
INFO: Controller 5 touchpad 0 finger 0 moved to 0.85, 0.48, 1.00
INFO: Controller 5 touchpad 0 finger 0 moved to 0.85, 0.49, 1.00
INFO: Controller 5 touchpad 0 finger 0 moved to 0.85, 0.49, 1.00
INFO: Controller 5 touchpad 0 finger 0 moved to 0.85, 0.49, 1.00
INFO: Controller 5 touchpad 0 finger 0 moved to 0.85, 0.50, 1.00
INFO: Controller 5 touchpad 0 finger 0 moved to 0.85, 0.50, 1.00
INFO: Controller 5 touchpad 0 finger 0 released at 0.85, 0.50, 0.00

Also did the button with the playstation logo work?

Yes. It showed as the giant center button in the picture (output indicated the 'guide' button), and the microphone mute button was reflected in the button just under that (the 'misc1' button).

Thanks for the feedback. I assume that the movement is limited to values between 0 and 1. So I guess input overlay could visualize and forward that via the websocket server. The swapped X/Y are a bit annoying, but the preset for the switch can just switch (hah) them, alternatively it seems like there is an option to change this in sdl

Unrelated to the rest, since people were talking about switch controllers, I found an off-brand pro version I had in the house, and it works as expected. Y and X are swapped visually, but report correctly, the same as B and A, since Nintendo and Microsoft seem to have reversed positioning on those compared to each other.

Edit: I forgot the switch controller had buttons on the back / bottom. These do not seem to report anything at all when pressed.

Are those extra buttons also on a normal switch pro controller? If not it's probably an issue with SDL assuming that it is a switch pro controller

univrsal avatar Dec 08 '22 18:12 univrsal

I assume that the movement is limited to values between 0 and 1.

Correct. Touchpad values on the PS5 touchpad seem to be 0.00 through 1.00 on the X and Y axis, with a Z value that seems to always be '1.00' when the touchpad's being touched, and '0.00' as the very last value as the touch pad is released. (You can see that in my output above.) No indication that I can see that the Z value is ever anything other than a binary value besides it being shown as having a decimal point. 0.00 0.00 is the top-left coordinates, 1.00 1.00 is the bottom-right. I can test the PS4 controller if you want, but I suspect it's the exact same given everything else is.

Also, while it only lists 'finger 0' above, it looks like the touchpad can register two fingers (0 and 1) at the same time.

Are those extra buttons also on a normal switch pro controller?

I don't see anything that looks similar on the pictures of a real switch pro controller, so I guess not. I have no idea what they're for, but since it's an off-brand and doesn't exist on the official pro controller and they're not registering in SDL, I doubt it's worth caring about.

HereInPlainSight avatar Dec 09 '22 00:12 HereInPlainSight

Correct. Touchpad values on the PS5 touchpad seem to be 0.00 through 1.00 on the X and Y axis, with a Z value that seems to always be '1.00' when the touchpad's being touched, and '0.00' as the very last value as the touch pad is released. (You can see that in my output above.) No indication that I can see that the Z value is ever anything other than a binary value besides it being shown as having a decimal point. 0.00 0.00 is the top-left coordinates, 1.00 1.00 is the bottom-right. I can test the PS4 controller if you want, but I suspect it's the exact same given everything else is.

The code references the third value as pressure so maybe it could technically be in between 0 and 1 just not with playstation controllers.

univrsal avatar Dec 09 '22 11:12 univrsal

I assume that the movement is limited to values between 0 and 1.

Correct. Touchpad values on the PS5 touchpad seem to be 0.00 through 1.00 on the X and Y axis, with a Z value that seems to always be '1.00' when the touchpad's being touched, and '0.00' as the very last value as the touch pad is released. (You can see that in my output above.) No indication that I can see that the Z value is ever anything other than a binary value besides it being shown as having a decimal point. 0.00 0.00 is the top-left coordinates, 1.00 1.00 is the bottom-right. I can test the PS4 controller if you want, but I suspect it's the exact same given everything else is.

Also, while it only lists 'finger 0' above, it looks like the touchpad can register two fingers (0 and 1) at the same time.

Are those extra buttons also on a normal switch pro controller?

I don't see anything that looks similar on the pictures of a real switch pro controller, so I guess not. I have no idea what they're for, but since it's an off-brand and doesn't exist on the official pro controller and they're not registering in SDL, I doubt it's worth caring about.

Those buttons probably have to be assigned to mimick another face or shoulder button, which is non-standard for the base model of controlers for microsoft, sony, and nintendo, so no need to worry. I would assume that if theyre assigned, SDL2 would show the mimicked button being activated and not those back buttons, but not something I think would be a deal breaker for people.

ngeTaco avatar Dec 20 '22 23:12 ngeTaco

I don't think that testing via WINE would be a fair test of how the native Linux SDL performs, but SDL2 stuff works perfectly on my system and I think porting to SDL2 would probably fix all my issues. Would be happy to help test anything or provide some code changes as well depending on what's needed. FWIW, since Nintendo Switch controller support is relatively new on Linux, a lot of things don't properly support it (mapping the buttons wrong under the assumption it's just an Xbox controller), although SDL2 actually does support it correctly.

You can compile the program yourself if you want, it's just https://github.com/univrsal/SDL/blob/main/test/testgamecontroller.c which is part of the sdl2 tests

Are there build instructions for this?

ItsRogueRen avatar Jan 21 '23 20:01 ItsRogueRen

Are there build instructions for this?

Clone the repo and change directory to it.

mkdir build
cd build
cmake -DSDL_TESTS=ON ../
cmake --build .

testgamecontroller should now be inside the test subdirectory. If you've got a gyroscope in your controller and you want to verify output on the command line, you might want to filter the gyroscope info out with something like ./testgamecontroller 2>&1 | grep -v "gyro\|accelerometer", it's super spammy.

HereInPlainSight avatar Jan 22 '23 07:01 HereInPlainSight

https://github.com/univrsal/input-overlay/issues/241 Another dpad issue

Seems like the main dpad issue imo. Dpad being POV-hat seems to be the standard going forward. Previous version worked with this paradigm, if I recall correctly something about that library used an "is_hat" boolean to distinguish pov hat situations.

GameKyuubi avatar Feb 02 '23 06:02 GameKyuubi

Have you tried the gamepad test program?

univrsal avatar Feb 02 '23 13:02 univrsal

I'm on linux so I can't use the attachment, but it's the sdl2-gamepad branch?

GameKyuubi avatar Feb 03 '23 04:02 GameKyuubi

the test program is part of the sdl2 tests, but the branch should also work if you want to test the plugin with sdl2. It doesn't build on ubuntu for some reason though

univrsal avatar Feb 03 '23 13:02 univrsal

https://github.com/univrsal/input-overlay/actions/runs/4166499103 Contains a windows and linux build using sdl2 for gamepad input. The presets in the master branch should be updated to use the new keycodes. If you have presets that you've made yourself you can just load them in the config tool and then export it again to convert it to the new keycodes.

univrsal avatar Feb 13 '23 18:02 univrsal

@univrsal I'm on Arch, when I try to build that commit I get pages of errors. Same with latest master. Pacman reports installed version is 5.0.0.r9.g05b175f-1.

GameKyuubi avatar Feb 19 '23 03:02 GameKyuubi

yeah It's something with simd headers clashing with sdl2, debug builds don't have that issue for some reason

univrsal avatar Feb 19 '23 10:02 univrsal

XBOX 360 Controller Not Working properly UNDER OBS: leftshoulder,rightshoulder,x,y,a,b,start,back NOT WORKING in input-overlay object dpad,left and right stick,button rightstick,button leftstick, axis righttrigger,axis lefttrigger WORKING NORMALLY

  • Issue present in xinput mode. DirectInput mode not working at all.
  • tested 2 different controllers (different models) same issue.
  • sdl2.gamepadtest.zip Working PERFECTLY
  • Gamepad Bindings under inputoverlay configuration responding properly
  • browser ojbect configured with https://gamepadviewer.com/ working flawlessly with same controllers.
  • Same problem in ALL presets (dualsense, gamecube,gamepad etc) Thanks in advace with your precious help.

andreottigiulio avatar Feb 20 '23 13:02 andreottigiulio

Did you test it with the test program?

univrsal avatar Feb 20 '23 13:02 univrsal

i wrote "sdl2.gamepadtest.zip Working PERFECTLY" trying to be as complete as possible. sorry for bothering but i really have no more ideas

andreottigiulio avatar Feb 20 '23 13:02 andreottigiulio

no worries, I missed that. If the test program works the next release should fix the issues

univrsal avatar Feb 20 '23 14:02 univrsal

Anybody who wants can try the new gamepad and network backend with this. If there's no more bugs I'll close this issue.

univrsal avatar Mar 07 '23 20:03 univrsal

Xbox elite controller 2 here: Y and X buttons are swapped using the gamepad preset. Swapping them in the profile was simple enough.

patlefort avatar Mar 08 '23 17:03 patlefort