RetroDECK icon indicating copy to clipboard operation
RetroDECK copied to clipboard

How to launch Steam games from RetroDECK?

Open Daeymon opened this issue 2 years ago • 19 comments

EmulationStation DE supports launching Steam games via a "steam" folder with .desktop files. It does this with the below addition to the es_systems.xml.

That system is not present with RetroDeck's build of EmulationStation. Any chance of adding this in? It then gives a user the option of having RetroDeck act as a singular frontend for the whole deck. Handy for those of us who can't stand the Steam frontend.

    <system>
        <name>steam</name>
        <fullname>Valve Steam</fullname>
        <path>%ROMPATH%/steam</path>
        <extension>.desktop .sh</extension>
        <command label="Steam (Standalone)">%RUNINBACKGROUND% %ENABLESHORTCUTS% %EMULATOR_OS-SHELL% %ROM%</command>
        <platform>steam</platform>
        <theme>steam</theme>
    </system>

Daeymon avatar Dec 06 '23 16:12 Daeymon

Of all the systems, this is the most complex one to discuss. Most others we just need to get to and add into RetroDECK.

But Steam is an huge exception to the RetroDECK design, as we don't want to add entire Steam into RetroDECK, thus we break the "everything is included" design paradigm.

The main problem is that if allow it we are then moving outside of our flatpak and launching via a 3rd party application in this case Steam (that can also be a flatpak).

Maybe it could be a exception system people could enable from the Configurator as a special case and not something that should be on default (or maybe the community really wants it on all the time).

Steam is also special as we are also using it to "Add RetroDECK to Steam" and using "Steam Input" for the controller profiles. So in one way Steam is already an exception to this design.

But we will discuss it at least internally first so thanks for sending in the request :)

Lazorne avatar Dec 06 '23 19:12 Lazorne

Unless I'm doing something wrong, there might not be a need for a discussion.

I added Steam as a custom system to RetroDeck's ES-DE. Seems to load in the games fine and looking at the log, it executes the launch command fine. But for whatever reason the command line being executed is not resulting in the game being launched.

Doing all this in the AppImage version of ES-DE results in the same logs and works fine. Could this be a limitation of it being within a FlatPak?

Daeymon avatar Dec 06 '23 22:12 Daeymon

It probably is that that you need to add more permissions to the flatpak via Flatseal. But what those are it is hard to say on whim.

One more negative aspect is that you will get a performance and battery impact by having ES-DE running in the background on heavy Steam Games.

We did have an internal discussion and our feelings as of today are that we should not add if for above reasons. There is a potential of opening the Pandoras Box that if we add Steam as an exception people will demand other exceptions like Lutris, Epic Games Store, Kodi.

I will mark this issue as Won't Fix but...

If you can figure out how to get it to run and what those permissions are, feel free to report back here as it is good to know :)

Lazorne avatar Dec 07 '23 07:12 Lazorne

This issue will be writable even once closed, I will close it as it's not to be implemented.

XargonWan avatar Dec 07 '23 12:12 XargonWan

@Lazorne

I gave it a go playing with the permissions with Flatseal, even using Lutris as an example since it can launch Steam games from within its flatpak. But regardless how over the top I made the permissions there is still no joy. I guess the permissions needed to load a game from a .desktop file are different than how Lutris does it.

If you ever get curious and figure out what the permissions needed are, then I would be very interested. Certainly wouldn't mind having this as something I have to apply myself after each update.

Daeymon avatar Dec 08 '23 14:12 Daeymon

I'm sure the community will figure it out, either us or someone else. The important thing is when they do we document it on the wiki so it is not lost in discord comments.

Lazorne avatar Dec 15 '23 05:12 Lazorne

@Lazorne Has there been any rumblings or interest on this one from elsewhere in the community in the last 6 months?

I know there is progress to push RetroDeck games into the Steam Library. I'm still keen to go the other way since the Steam Library interface just sucks. I did go with ES-DE vanilla and do the whole emulators separately thing, but RetroDeck is just such a clean and unified experience and installation, that I ended up losing patience with spinning those emulator plates and went back to using RetroDeck.

Daeymon avatar Jun 18 '24 19:06 Daeymon

@Lazorne Has there been any rumblings or interest on this one from elsewhere in the community in the last 6 months?

I know there is progress to push RetroDeck games into the Steam Library. I'm still keen to go the other way since the Steam Library interface just sucks. I did go with ES-DE vanilla and do the whole emulators separately thing, but RetroDeck is just such a clean and unified experience and installation, that I ended up losing patience with spinning those emulator plates and went back to using RetroDeck.

Honestly not, I mean it's probably already possible if you uncomment the Steam system from es_systems.xml (in the ro partition, or you can try to add it as a custom system, check the ES-DE guide about that). However is disabled because it's out of scope and so we don't want to support it. However you can try.

XargonWan avatar Jun 19 '24 02:06 XargonWan

@Lazorne Has there been any rumblings or interest on this one from elsewhere in the community in the last 6 months? I know there is progress to push RetroDeck games into the Steam Library. I'm still keen to go the other way since the Steam Library interface just sucks. I did go with ES-DE vanilla and do the whole emulators separately thing, but RetroDeck is just such a clean and unified experience and installation, that I ended up losing patience with spinning those emulator plates and went back to using RetroDeck.

Honestly not, I mean it's probably already possible if you uncomment the Steam system from es_systems.xml (in the ro partition, or you can try to add it as a custom system, check the ES-DE guide about that). However is disabled because it's out of scope and so we don't want to support it. However you can try.

Re-enabling the Steam system in RetroDeck is the easy part. Just add it as a custom system. The part I still can't figure out is what permissions the flatpak needs to execute the command line that ES-DE gets from the .desktop file.

I've tried giving RetroDeck all the permissions with FlatSeal. Changing the launch command in the .desktop file to "/run/host/steam", or "/run/host/usr/bin/steam" or even "/run/host/bin/steam". But in honesty, I'm just guessing. Probably needs a real flatpak expert to have a look though ones I've approached through stack social claim flatpaks cannot execute applications in "/usr/bin".

Daeymon avatar Jun 19 '24 06:06 Daeymon

Another application you could try is opengamepad UI https://github.com/ShadowBlip/OpenGamepadUI/

It got a similar feel and works with your steam library.

Lazorne avatar Jun 19 '24 07:06 Lazorne

OpenGamepadUI seems to be an alternative to the Steam gaming mode itself rather than just a frontend. I did spend my lunch break trying to install it on my Steam Deck, but I can't get the installer to work; I think I need to separately install a whole slew of dependences, and that doesn't appeal. Also looking at the git, its development has been more focused on supporting ChimeraOS rather than SteamOS.

Might do some more investigating in trying to get RetroDeck to utilise ES-DE's ability to invoke the exec line from a steam game .desktop file. Otherwise the best option if I want a unified frontend would be to go back to using vanilla ES-DE with separately installed emulators.

I will post back here if I do actually manage to pull it off.

Daeymon avatar Jun 19 '24 13:06 Daeymon

So a little bit of progress. I delved into Lutris, since they have this working. And found they use the command line: /usr/bin/xdg-open steam://rungameid/xxxxxx.

A standard created Steam .desktop file, which ES-DE needs, comes with the "Exec" line of: "steam steam://rungameid/xxxxxx"

So I changed that to the one that Lutris uses, and its works from RetroDeck ..... but only in Desktop mode. This method doesn't work in gaming mode for RetroDeck or Lutris (apparently it seems to be a gamescope bug with flatpaks). Curiously it does work for the AppImage version of ES-DE. I'll continue to tinker.

Daeymon avatar Jun 20 '24 17:06 Daeymon

Check if the bottom command work if you add that to retrodeck.

https://retrodeck.readthedocs.io/en/latest/wiki_steam/add-to-steam/

org.freedesktop.Flatpak

Lazorne avatar Jun 20 '24 17:06 Lazorne

Ha!! Well look at that. Truly a master at work. Thank you very much.

Used Flatseal to add Session Talk access to org.freedesktop.Flatpak for RetroDeck.

And then changed the exec line of the .desktop file to "/usr/bin/flatpak-spawn --host steam steam://rungameid/xxxxxx"

And it works!!! In both Desktop and Game modes.

Launching Steam games from RetroDeck!!! Now we're talking!!!

Daeymon avatar Jun 20 '24 17:06 Daeymon

As a small request, to minimise updates killing the Steam system. Would you be willing to considering doing symlink for the ES-DE "custom_systems" folder just like the "collections" and "gamelists" folders? That way, I won't have to re-add the es_systems.xml file after each update.

Daeymon avatar Jun 20 '24 18:06 Daeymon

We have added a issue for enabling custom systems in 0.9.0b

But in this usecase all you are doing is editing the xml to enable the system and roms/steam folder in ES-DE?

So just enabling the steam folder would solve your problem correct?

Lazorne avatar Jun 22 '24 05:06 Lazorne

With my user case, I add a new file to the "custom_systems" folder and name it "es_systems.xml". Then I put the following XML into the file:

<systemList>
    <system>
        <name>steam</name>
        <fullname>Valve Steam</fullname>
        <path>%ROMPATH%/steam</path>
        <extension>.desktop .sh</extension>
        <command label="Steam (Standalone)">%RUNINBACKGROUND% %ENABLESHORTCUTS% %EMULATOR_OS-SHELL% %ROM%</command>
        <platform>steam</platform>
        <theme>steam</theme>
    </system>
</systemList>

This restores the default Steam system to ES-DE without messing with the RetroDECK files. From that point on, its do as the ES-DE documentation states, which is use the "Add a shortcut to the desktop" feature in Steam to add a shortcut for the wanted games to the desktop, and then move those .desktop files to a "steam" folder within the "roms" folder.

One final manual step to get this working with a flatpak version of ES-DE (thank you by the way), is to add "/usr/bin/flatpak-spawn --host " in front of the word "steam" on the Exec line of each .desktop file.

Daeymon avatar Jun 22 '24 13:06 Daeymon

I'am using Lutris (Flatpak) and can launch Lutris games from RetroDeck (Flatpak) with this command (from desktop file):

Exec=flatpak-spawn --host flatpak run net.lutris.Lutris lutris:rungameid/11

On Arch you will need this package for flatpak-spawn: sudo pacman -S flatpak-xdg-utils

murkl avatar Jul 12 '24 06:07 murkl

I'am using Lutris (Flatpak) and can launch Lutris games from RetroDeck (Flatpak) with this command (from desktop file):

Exec=flatpak-spawn --host flatpak run net.lutris.Lutris lutris:rungameid/11

On Arch you will need this package for flatpak-spawn: sudo pacman -S flatpak-xdg-utils

OK now that would be another solution. But fun to document at least.

I don't know if ES-DE got an lutris integration.

We could create a seperate issue for it to put up a guide on the wiki.

I'll make a seperate issue for it.

Lazorne avatar Jul 12 '24 09:07 Lazorne

https://retrodeck.readthedocs.io/en/latest/wiki_experiments/desktop-launch/desktop-launch/

This is now done here

I also realized my mistake that I forgot to credit Daeymon as well. I have updated the guide and the blogpost with both your names, thanks <3

Lazorne avatar Mar 25 '25 08:03 Lazorne