Comments (6)
@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
from cartridges.
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:
- The GUI library, GTK, does not listen to gamepad inputs. To solve that, we have to use a separate gamepad input library for Python instead, and manually hook the events into the GUI, implement our own "selection cursor", etc, and make sure it all works properly in the GUI.
- There are over 100 gamepad input libraries for Python, and it would be considerable work to find the most robust, best library. There's libraries based on PyGame, and SDL (the cross-platform input library). Both of them require that we create a SDL "game window" before we are able to read inputs via them, which may be a big issue. There's also libraries like inputs which seems ideal because it doesn't require any external dependencies and doesn't need us to open any "fake game window" to register inputs.
- Sandboxing issues: Gamepads are treated as raw device nodes in
/dev
on Linux. We therefore needdevice=all
permission which is flagged as a "dangerous permission". There's attempts to make an "inputfd" protocol for Wayland (not merged yet) and a Flatpak portal for gamepad access without such broad permission privileges, but neither of those things are created yet. Linux is years behind Windows when it comes to gamepad input. - Device access permissions: Linux treats all devices in
/dev
, even gamepads, as root-access devices. You cannot access gamepads unless you (the user) run the app as root. Apps like Steam work around this via thesteam-devices
package which you install natively on the device, which adds some host rules to allow unprivileged users to access the gamepads. Neither the native nor the Flatpak versions of Steam work without those rules. But since Cartridges is a Flatpak app, we would not be able to install such rules ourselves. - Exclusive device access: Gamepads on Linux are not multiplexed. Only 1 app can read them at a time. So if we open the gamepad device for reading, then games won't be able to use the gamepad. We'd have to implement a complex system of listening/unregistering the gamepad constantly based on when the Cartridges app has focus. This also fails if a game is running in the background and currently has gamepad access, which would prevent Cartridges from registering the gamepad listener. Likewise, if Cartridges doesn't unregister its own gamepad listener fast enough when we launch a game, then the game itself may fail to open the gamepad device and won't have any inputs. So by registering a gamepad in Cartridges, we can cause many issues because Linux is so bad at gamepad handling.
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.
from cartridges.
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.
from cartridges.
https://gnome.pages.gitlab.gnome.org/libmanette/
from cartridges.
Yeah, I've been looking into that.
from cartridges.
@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.
from cartridges.
Related Issues (20)
- Add "Re-scan Library" option. HOT 1
- Some Flatpak games aren't imported HOT 3
- Support more than seven columns of games to better fill ultrawide (21:9) screens HOT 5
- Configurable Grid Dimensions HOT 2
- Better Handling of Long Titles HOT 3
- Preserve Image Aspect Ratio HOT 8
- Crashing on x11 kde plasma HOT 7
- Use of desktop entries' "TryExec" field HOT 5
- Crash upon changing cover image HOT 1
- Steam Entries wont launch HOT 3
- Fix flatpak permissions HOT 4
- Import/Export external drive games
- Option to (re-)query SteamGridDB post-setup
- Export into Sunshine HOT 1
- Covers of all games are not displayed HOT 6
- Add a choice of size for displayed game covers HOT 1
- Allow pinning games HOT 2
- Add sort title to games HOT 2
- Cartridges.metainfo.xml test fail HOT 2
- Filter Retroarch Games by Ssytem
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from cartridges.