Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Linux] Wiimote through SDLController only partially works #443

Closed
lisa-wolfgang opened this issue Nov 2, 2022 · 14 comments
Closed

[Linux] Wiimote through SDLController only partially works #443

lisa-wolfgang opened this issue Nov 2, 2022 · 14 comments

Comments

@lisa-wolfgang
Copy link
Contributor

lisa-wolfgang commented Nov 2, 2022

When adding a Wiimote using the SDLController API (the Wiimote API doesn't show as an option on Linux), multiple options appear. Across all of these options, only the A, B, and HOME buttons (on the Wiimote) and the C and Z buttons (on the Nunchuk) are recognized by Cemu. None of the other buttons on the physical remote are able to be registered to a mapping option:
image

When configuring the controller that gave the A/B/HOME inputs, rumble functions as intended, but the motion option is greyed out.

Cemu version: c3182ae
Operating system: Ubuntu 22.04.1 LTS

@Squall-Leonhart
Copy link
Contributor

SDL is not remappable, the mapping screen only reflects the settings of API's that are, so nothing you see set there, or not set there is an indication that the controller isn't fully mapped.

@lisa-wolfgang
Copy link
Contributor Author

Sorry, I didn't explain the issue very clearly, so I've gone back and made a couple of edits. That screenshot was meant to illustrate the only buttons I was able to get working.

@Squall-Leonhart
Copy link
Contributor

Issues with the SDL mapping are to be addressed to the SDL developers, they maintain the controller profiles upstream.

@lisa-wolfgang
Copy link
Contributor Author

lisa-wolfgang commented Nov 2, 2022

Upon further investigation, SDL seems to work fine as far as detecting input -- the problem is that Cemu doesn't seem to be able to read the inputs properly.

Source 0 (the Wii Remote's buttons) has 12 functional buttons, but Cemu only recognizes 3 of them.
Source 1 (the Wii Remote's Accelerometer) has 3 functional axes, but Cemu doesn't recognize any of them, and the motion option is greyed out for this source.
I wasn't able to test Source 2 (the Wii Remote's IR sensor) as I do not have an IR source to test with.

The order of the following sources seems to be a race condition between when the extensions are detected. In my testing, MotionPlus (built-in on my remote) has come after the Nunchuk occasionally.
Source 3 (MotionPlus) has 3 functional axes, but Cemu doesn't recognize any of them. The motion option is greyed out for this source. I'm not sure how to test if the MotionPlus checkbox has any effect.
Source 4 (Nunchuk if plugged in) has 3 functional axes, 2 functional buttons, and 1 "hat", but Cemu only recognizes the 2 buttons. The motion option is greyed out for this source.

Cemu only seems to be following the Name and Mapping properties of GameController rather than each individual joystick/source. Besides not being able to read all available inputs, it's not ideal user experience to have 5 indistinguishable sources that each do something different:

image

Here's the data I'm getting (for Sources 0 and 1) for reference:

Joystick Name:     'Nintendo Wii Remote'
Joystick GUID:     050000007e0500000603000001860000
Joystick Number:    0
Number of Axes:     0
Number of Buttons: 11
Number of Hats:     0
Number of Balls:    0
GameController:
  Name:    'Nintendo Wii Remote'
  Mapping: '050000007e0500000603000001860000,Nintendo Wii Remote,a:b0,b:b1,guide:b2,platform:Linux'

Joystick Name:     'Nintendo Wii Remote Accelerometer'
Joystick GUID:     050000007e0500000603000001860000
Joystick Number:    1
Number of Axes:     3
Number of Buttons:  0
Number of Hats:     0
Number of Balls:    0
GameController:
  Name:    'Nintendo Wii Remote'
  Mapping: '050000007e0500000603000001860000,Nintendo Wii Remote,a:b0,b:b1,guide:b2,platform:Linux'

@lisa-wolfgang
Copy link
Contributor Author

lisa-wolfgang commented Nov 2, 2022

It does appear that better Wiimote support in general has been added to the development branch of SDL (starting at libsdl-org/SDL@c72e14e), but this won't come to a release version for another month or two, and then this new version needs to be picked up by distros.

One option would be to utilize SDL_GameControllerAddMapping(), which (besides its most obvious purpose) allows for existing mappings to be updated.

@NZedPred
Copy link

If you build and install the latest SDL from source, you should find that the mapping of buttons is done in full and correctly. Can you try that? You will need to remove the line that has "sdl2" from the vcpkg.json file to ensure that the build system uses your local system library.

I have it working myself, for everything except motion controls. So not perfect, but should be a step up from what you have at the moment.

@v1993
Copy link

v1993 commented Nov 23, 2022

Coming from person who spent a LOT of time messing with SDL and WiiMotes in the past...

  1. SDL itself is more than capable of reading all button presses coming from wiimote. It's just that Cemu decides to use controller API that's a poor fit for less standard controllers. This can be worked around by using remapping tool such as https://generalarcade.com/gamepadtool/.
  2. Wiimote's motion is a story on its own on Linux... It was added way before standard API for motion devices became available and SDL currently does not even support said standard API.
  3. Linked commit in SDL adds HIDAPI driver that is disabled by default on Linux due to its shortcomings.

I'd say that for now the easiest way to use wiiremote in cemu is https://github.com/v1993/linuxmotehook2 (by me). It includes support for motion as well.

@matthew-js-porter
Copy link

@v1993 Does that work with IR pointing too?

@v1993
Copy link

v1993 commented Dec 11, 2022

Sadly no, since this is not something underlying protocol supports. It wouldn't work with SDL either tho.

@robertswiecki
Copy link

robertswiecki commented Apr 19, 2023

@v1993

Does linuxmotehook2 work correctly for you with cemu under Linux?

I made it to work with dolphin, but with cemu I get strange results for motion - it works correctly with eg Mario Kart 8 - if I turn the wiimote, so it points buttons towards the TV. Otherwise the axies seem kinda reversed.

I know that it's possible to reverse it in the config, but since it works well with dolphin...

PS: When I tried just now, the results were differnt, I was able to play the game if I pointed the buttons side of the Wiimote (Wiimote Plus - the -TR version) towards the floor.

@v1993
Copy link

v1993 commented Apr 19, 2023

@robertswiecki It's been forever since I've last used Cemu, so, sadly, there isn't much for me to say here. See v1993/linuxmotehook2#9 for the same problem.

PS: When I tried just now, the results were differnt, I was able to play the game if I pointed the buttons side of the Wiimote (Wiimote Plus - the -TR version) towards the floor.

Sounds like Cemu now applies orientation transformation on its own, huh? I'm not following its development, but that sounds plausible. I wonder if there's at least an option to turn that off.

@GNUGradyn
Copy link

This is still an issue. As far as I'm aware, there is no way to get full wiimote support on linux. For example, you can't add accelerometer controls via SDL. This is a showstopper for even basic games like super mario bros U. On windows, it seems you can pass wiimotes through directly via the "Wiimote" option under API. This is not an option on linux. Even running CEMU via proton does not resolve this issue because the emulator in proton cannot see any bluetooth devices connected to the host.

@lisa-wolfgang
Copy link
Contributor Author

lisa-wolfgang commented Jun 30, 2023

@GNUGradyn https://github.com/v1993/linuxmotehook2 is a full solution except for IR data and some of the less common extensions. It is true that Cemu doesn't have a built-in full solution on Linux, though.

@lisa-wolfgang
Copy link
Contributor Author

Closing since the native Wiimote API is now available on Linux and should be used instead of SDLController.

@lisa-wolfgang lisa-wolfgang closed this as not planned Won't fix, can't repro, duplicate, stale Apr 5, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

7 participants