cemu-project / Cemu

Cemu - Wii U emulator
https://cemu.info
Mozilla Public License 2.0
7.26k stars 594 forks source link

Input not recognsing a button only on Linux SDL2 #1260

Open r-garciag opened 3 months ago

r-garciag commented 3 months ago

Current Behavior

I'm currently using a HORIPAD game controller on Cemu. On Windows everything works as expected, using SDL2 every button is recognised. On Linux, the "a" button doesn't get recognised on Cemu. I tried switching distros and remapping the environment variables. Steam does recognise every button, it is jut Cemu. I tried creating a "gamecontrollerdb.txt" on /.local/share/Cemu with the same env. variable with no results.

Environment command: d0d0f0000c100000011010000,HORI. HORIPAD S,crc:0d91,platform:Linux,b:b2,a:b1,y:b3,x:b0,dpleft:h0.8,dpright:h0.2,dpup:h0.1,dpdown:h0.4,leftx:a0,lefty:a1,leftstick:b10,rightx:a2,righty:a3,rightstick:b11,leftshoulder:b4,lefttrigger:b6,rightshoulder:b5,righttrigger:b7,back:b8,start:b9,guide:b12,misc1:b13,hint:!SDL_GAMECONTROLLER_USE_BUTTON_LABELS:=1,steam:2,platform:Linux,

Expected Behavior

As in eny other emulator and Steam, every button should be shown in the mapping page when pressed.

Steps to Reproduce

  1. Install Cemu (doesn't matter AppImage, Flatpak or Flatpak Beta)
  2. Connect Gamecontroller (id:d0d0f0000c100000011010000)
  3. Try to configure button "a"

System Info (Optional)

OS: Fedora 40

Emulation Settings (Optional)

No response

Logs (Optional)

No response

barolo commented 3 months ago

I had identical issue with different pad. What worked for me, was mapping using this app https://gitlab.com/ryochan7/sdl2-gamepad-mapper ,exporting the resulting environment variable in terminal and launching Cemu.

export SDL_GAMECONTROLLERCONFIG="030064716f0e00008401000011010000,PDP Faceoff Deluxe+ Audio Wired Controller for Nintendo Switch,a:b1,b:b2,x:b0,y:b3,back:b8,guide:b12,start:b9,leftshoulder:b4,rightshoulder:b5,leftstick:b10,rightstick:b11,dpup:h0.1,dpleft:h0.8,dpdown:h0.4,dpright:h0.2,leftx:a0,lefty:a1,rightx:a2,righty:a3,lefttrigger:b6,righttrigger:b7,platform:Linux"

Cemu

Putting it in gamecontrollerdb.txt didn't work.

r-garciag commented 3 months ago

Thank you for the answer. I've already tried both sdl2-game-mapper and gamepad-tool, which aims to solve the same problem. I tried again by exporting the variable generated by sdl2-game-mapper and launching Cemu in the same terminal, but it didn't work.

As you can see, the "a" button is being pressed and recognised by sdl2-game-mapper byt not for Cemu, who doesn't remap the button:

Captura desde 2024-07-19 16-27-11

barolo commented 3 months ago

Just as I said, I had identical issue, with "a" button not working, just a few days ago. The difference is, I'm not using flatpak nor AppImage, but native Cemu for my distro. So perhaps that's why?

It's packaged for Fedora in Copr so you could try this one perhaps try the zipped one for Ubuntu?

barolo commented 3 months ago

Supposedly env ENV_VARIABLE Cemu.AppImage should work too.

r-garciag commented 3 months ago

Supposedly env ENV_VARIABLE Cemu.AppImage should work too.

This!. Finally, with the env command the issue is fixed. is there a way to set it up as a global variable for the appimage/distro-package?

For the record this is the command: env SDL_GAMECONTROLLERCONFIG="0300a2370d0f0000c100000011010000,HORIPAD S,a:b1,b:b2,x:b0,y:b3,back:b8,guide:b12,start:b9,leftshoulder:b4,rightshoulder:b5,leftstick:b10,rightstick:b11,dpup:h0.1,dpleft:h0.8,dpdown:h0.4,dpright:h0.2,leftx:a0,lefty:a1,rightx:a2,righty:a3,lefttrigger:b6,righttrigger:b7,platform:Linux,crc:37a2," ./Cemu-2.0-88-x86_64.AppImage

barolo commented 3 months ago

This!. Finally, with the env command the issue is fixed. is there a way to set it up as a global variable for the appimage/distro-package?

No idea, you're better off just installing the distro one, then you can set it globally in bashrc or something. or make a Desktop shortcut with that command

r-garciag commented 3 months ago

Okay, thanks @barolo for pointing me to the right direction. Here is a brief tutorial about adding the env variable to the Cemu Flatpak:

  1. Open your info.cemu.Cemu.desktop file under /var/lib/flatpak/exports/share/applications (use sudo and nano)

  2. Look for this line Exec=/usr/bin/flatpak run --branch=stable --arch=x86_64 --command=/app/bin/Cemu-wrapper info.cemu.Cemu

  3. Jut before the info.cemu.Cemu part, add the following: --env SDL_GAMECONTROLLERCONFIG="[YourEnvVariable]"

  4. You should have something similar to this: Exec=/usr/bin/flatpak run --branch=stable --arch=x86_64 --command=/app/bin/Cemu-wrapper --env SDL_GAMECONTROLLERCONFIG="[YourEnvVariable]" info.cemu.Cemu

Save it, and now you can launch Cemu as usual, no need for entering commands.

I hope it helps, and the devs can find a real solution to this bug. I'm willing to test or give any log that may be relevant.

barolo commented 3 months ago

I hope it helps, and the devs can find a real solution to this bug. I'm willing to test or give any log that may be relevant.

The real solution would be to report it to SDL2 folks I think. AFAIK improper mapping will happen in all apps using sdl, just that most can remap properly. So it's better to fix the profile upstream. Secondary, would be to have proper remapping in Cemu but it would probably land really low on the priorities list of things to-do.

I would leave it open though, since clearly something wrong with Cemu unable to read input and map properly (as shown by all other apps being able to do so).