kra-mo / cartridges

A GTK4 + Libadwaita game launcher
GNU General Public License v3.0
644 stars 34 forks source link

Controller Navigation Support #36

Open Saroufim opened 1 year ago

Saroufim commented 1 year ago

It would be great if the library can be navigated with a controller. Currently, it doesn't react to controller input.

Arcitec commented 1 year ago

We have been researching this and it turned out to be much more complex than originally thought. It's therefore put on a extremely low priority. If someone with expertise about this topic wants to help out, please do!

Here are the issues we have discovered:

These are the rules that Steam has to install to get access to gamepads:

/usr/lib/udev/rules.d/51-these-are-not-joysticks-rm.rules
/usr/lib/udev/rules.d/60-steam-input.rules
/usr/lib/udev/rules.d/60-steam-vr.rules

Those in turn are complex rules which define which devices are joysticks and which ones aren't. We would NOT be able to do something similar in Cartridges. If we implement gamepad access, it would be the user's own job to configure their host to give all non-root users access to read gamepads, and that's way out of the scope of what we'd be able to assist anyone with (just look at the rules in the files above, if you have Steam installed, they're very complex).

So if anyone's got more experience with solving Linux's gamepad situation and the issues above, then please help out! If not, we are unlikely to see gamepad support in Cartridges.

Mars7x commented 1 year ago

Highscore has support for gamepad navigation. I'm not sure about sandboxing, permissions, and exclusive device access, but maybe it could help a little to check out what they did.

sonnyp commented 1 year ago

https://gnome.pages.gitlab.gnome.org/libmanette/

kra-mo commented 1 year ago

Yeah, I've been looking into that.

kra-mo commented 1 year ago

@sonnyp do you by any chance happen to know how you can get libmanette working inside of Flatpak? I haven't had much luck.

Edit: Nevermind, as most things in life, it was a problem with my build configuration :) Its working now.

sonnyp commented 1 year ago

@kra-mo in case it's helpful: https://gitlab.gnome.org/GNOME/gnome-build-meta/-/merge_requests/2217

(you can't use libmanette from org.gnome.Sdk)

libmanette also has a working manifest example

And if you need some kind of demo, @halfmexican built one for Workbench here

https://github.com/sonnyp/Workbench/pull/309/files#diff-1b34825a0da7ebbdc205aae6048fba59c443d2959620a958b516f3d72d413930

PixsaOJ commented 5 months ago

If you are using Steam, you can enable Desktop Layout in controller settings.

kra-mo commented 5 months ago

Ah! That's neat. It is actually using libei too, which makes sense.