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

Cemu: discuss cemuhook integration #8410

Draft
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

git-developer
Copy link

This PR is currently used as medium to discuss an idea that needs to be harmonized before Draft status is removed.

@dmanlfc: it looks like you are the one who implemented the controller generator for cemu 2.0. First of all, thanks for that! I want to let you know that I refactored the controller generator to allow DSU (cemuhook) in addition to SDL as controller API. I'd like to discuss if there's interest to integrate my changes into batocera. If you're interested in this topic, your feedback is welcome.

@Darknior
Copy link

For my part, if there is a way to add gyroscope support and some other cool feature for cemu, i'm very interested :)
I love this emulator, he has so many great games :)

@git-developer
Copy link
Author

I'm running Cemu with motion (gyroscope) support, which doesn't seem to work out of the box with batocera 36.

I'd prefer motion support over SDL API, but didn't get it to work. Thus I added support for DSU API (=cemuhook). Maybe the latest Cemu release (2.0-29 currently) has working SDL motion, then we only need to update Cemu. This would be best.

Otherwise we can integrate my solution, consisting of 1.) the controller generator in this PR and 2.) one or more cemuhook servers. I successfully tested the server joycond-cemuhook for Nintendo controllers (e.g. Switch Pro) and ds4drv for Sony controllers (e.g. DS4). My repo batocera-extra has everything required for a proof-of-concept.

Feel free to have a look, to test and to ask. Ideas on how the integration into batocera could look like are welcome.

@Darknior
Copy link

Ok thanks, for my part i will can beta test with DS4 if there is an Batocera implementation.

@dmanlfc
Copy link
Collaborator

dmanlfc commented Mar 27, 2023

hey @git-developer yes I'm happy to move in this direction provided cemu doesn't have any short term plans to implement a SDL method. I'm busy this week & away this weekend but let's discuss on Discord, just reach out to me there.

@dmanlfc
Copy link
Collaborator

dmanlfc commented Apr 5, 2023

@git-developer where are the rest of the elements to make this work? What's required in terms of other packages etc?
I have to say I'm not a fan of cemu hook & if we can avoid it we should.
I don't see how the background server is start & stopped accordingly in configgen.
Just ping me on Discord & we can chat further about an approach.

@git-developer
Copy link
Author

Installation / Start / Dependencies

In my POC, servers are installed and started on boot via custom.sh, not per emulator run.

batocera-extra currently comes with 3 different servers:

  • joycond-cemuhook for Nintendo controllers (docs)
  • ds4drv-cemuhook for PS controllers (docs)
  • linuxmotehook2 for Wiimotes (docs)

The required dependencies for a server are in the server install script (just have a look in each server directory). They are currently downloaded from the Arch repo.

Motion via SDL without cemuhook

Valerie, maintainer of linuxmotehook2, told me that

Cemu itself does support SDL motion, it's that SDL2 on Linux omits HIDAPI backend by default.

Yuzu has motion support via SDL because it overrides this default. Maybe Cemu and Citra can be adapted to do the same?

Limit of 4 controllers per cemuhook server

  • The cemuhook (DSU) protocol is limited to 4 controllers per server. This is a real limitation at least for Wiimotes because a Nunchuck or MotionPlus sensor is managed as separate controller.
  • Starting a server per connected controller solves this limitation. The emulator has to be able to configure a server per connected controller. This is possible in Cemu. Citra is single player, so no problems here. I didn't consider other emulators yet.

Server lifecycle (starting / stop)

  • All 3 servers properly handle connection and disconnection of controllers. So stopping a server is not really required (although I'd prefer to do it).
  • When ds4drv-cemuhook is started, batocera shows a connected Sony controller even if there is none. This is ugly, so I'd rather start ds4drv-cemuhook on demand than on boot.
  • linuxmotehook2 allows to filter controllers per MAC which makes it easy to run a server per controller. I didn't check that for the other servers.

Summary

My insights so far:

  1. cemuhook server depends on controller model
  2. cemuhook protocol is limited to 4 controllers per server
  3. Cemu and Citra require cemuhook for motion, at least 1 other emulator doesn't.

Open questions so far:

  1. Can Cemu and Citra be configured to support motion control via SDL? (If yes, stop all cemuhook efforts.)
  2. How many cemuhook servers should be started?
    1. one per controller model
    2. one per connected controller (my favorite)
  3. When should the cemuhook servers be started?
    1. on emulator start (my favorite)
    2. on controller connection
  4. How to detect which servers to start?

@dmanlfc
Copy link
Collaborator

dmanlfc commented Apr 24, 2023

@git-developer i have bought a switch controller, i can look later this week.

@git-developer git-developer deleted the feature/cemu-cemuhook branch May 26, 2024 11:54
@git-developer git-developer restored the feature/cemu-cemuhook branch May 26, 2024 11:58
@git-developer
Copy link
Author

Close was unintended.

@git-developer git-developer reopened this May 26, 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

Successfully merging this pull request may close these issues.

None yet

3 participants