Wiki/wiki-rtd/docs/wiki_experiments/desktop-launch/desktop-launch.md

400 lines
10 KiB
Markdown
Raw Normal View History

2025-03-15 04:35:54 +00:00
# Launching Desktop Games & Apps with RetroDECK
2025-03-13 15:11:34 +00:00
2025-03-15 04:35:54 +00:00
This experiment was initiated by the user **murkl** and later expanded upon by the RetroDECK Team. The goal was to explore the possibility of launching desktop games and apps within RetroDECK.
2025-03-15 15:56:11 +00:00
**Note:** RetroDECK was never intended to be used in this manner, so things like inputs may work as expected.
2025-03-13 15:11:34 +00:00
2025-03-15 21:43:36 +00:00
![type:video](vcmi-retrodeck.mp4)
2025-03-13 15:11:34 +00:00
## Prerequisites
2025-03-15 15:56:11 +00:00
### Flatpak Spawn Permission
2025-03-13 15:11:34 +00:00
**Information:**
2025-03-13 18:12:58 +00:00
This experiment requires the `flatpak-spawn` permission, which breaks the sandbox environment that RetroDECK operates in. Therefore, we do not recommend attempting this unless you are confident in your understanding of the process and its implications.
2025-03-13 15:11:34 +00:00
You can enable it by running this command in the terminal.
```
flatpak override --user --talk-name=org.freedesktop.Flatpak net.retrodeck.retrodeck
```
2025-03-15 15:56:11 +00:00
### Add RetroDECK to Steam
You also need to add RetroDECK to Steam to utilize Steam Input.
2025-03-13 15:11:34 +00:00
## Folder structure
| Type | Folder | Comment |
| :---: | :---: | :---: |
| Windows Roms Folder | `retrodeck/roms/windows/` | |
## How-to Make .desktop files
2025-03-13 15:41:07 +00:00
Make an empty file with the `<gamename>.desktop`.
2025-03-13 15:11:34 +00:00
2025-03-13 18:14:39 +00:00
**Example:**
`Ultima I.desktop` and put it into the `retrodeck/roms/windows/` folder.
2025-03-13 15:11:34 +00:00
2025-03-13 15:41:07 +00:00
## How-to: Launch Lutris Games
2025-03-13 15:11:34 +00:00
2025-03-13 15:41:07 +00:00
### Step 1: Create an empty desktop file
2025-03-13 15:11:34 +00:00
2025-03-13 17:43:35 +00:00
First, create the `.desktop` file as mentioned above with the game name and put it in the `retrodeck/roms/windows/` folder.
2025-03-13 15:11:34 +00:00
2025-03-13 15:41:07 +00:00
### Step 2: Get Identifier and Internal ID
2025-03-13 15:11:34 +00:00
2025-03-13 15:41:07 +00:00
1. Open Lutris.
2. In Lutris, `Right Click` the game -> `Configure` and make a note of your `Internal ID` under `Identifier`.
3. Make a note of the `Identifier` as well.
2025-03-13 15:11:34 +00:00
2025-03-13 15:41:07 +00:00
**Example:** Ultima I
<img src="../lutris.png" width="800">
**Internal ID:** 2
**Identifier:** ultima-i
### Step 3: Populate the .desktop file
2025-03-13 17:43:35 +00:00
Open the `.desktop` file and populate it.
2025-03-13 17:42:32 +00:00
2025-03-13 18:01:44 +00:00
The files are different if you have the native version of Lutris installed or the Flatpak version.
2025-03-13 18:04:18 +00:00
### Step 3a: Lutris (Native)
2025-03-13 17:42:32 +00:00
This for Lutris that is installed natively.
Copy this:
2025-03-13 15:41:07 +00:00
```
[Desktop Entry]
Type=Application
Name=NAMEHERE
Icon=lutris_IDENTIFIERHERE
Exec=env LUTRIS_SKIP_INIT=1 flatpak-spawn --host lutris lutris:rungameid/INTERNALIDHERE
Categories=Game
```
2025-03-13 17:42:32 +00:00
Change the values of:
2025-03-13 15:41:07 +00:00
2025-03-13 17:42:32 +00:00
- **Name=** NAMEHERE
- **Icon=** lutris_IDENTIFIERHERE
- **Exec=** rungameid/INTERNALIDHERE
2025-03-13 15:41:07 +00:00
2025-03-13 18:42:57 +00:00
**Example: Ultima I.desktop**
2025-03-13 15:41:07 +00:00
```
[Desktop Entry]
Type=Application
Name=Ultima I
Icon=lutris_ultima-i
Exec=env LUTRIS_SKIP_INIT=1 flatpak-spawn --host lutris lutris:rungameid/2
Categories=Game
```
2025-03-13 18:04:18 +00:00
### Step 3b: Lutris (Flatpak)
2025-03-13 17:42:32 +00:00
This for Lutris that is installed via Flatpak.
Copy this:
```
[Desktop Entry]
Type=Application
Name=NAMEHERE
Icon=lutris_IDENTIFIERHERE
Exec=env LUTRIS_SKIP_INIT=1 flatpak-spawn --host flatpak run net.lutris.Lutris lutris:rungameid/INTERNALIDHERE
Categories=Game
```
Change the values of:
- **Name=** NAMEHERE
- **Icon=** lutris_IDENTIFIERHERE
- **Exec=** rungameid/INTERNALIDHERE
2025-03-13 18:42:57 +00:00
**Example: Ultima I.desktop**
2025-03-13 17:42:32 +00:00
```
[Desktop Entry]
Type=Application
Name=Ultima I
Icon=lutris_ultima-i
Exec=env LUTRIS_SKIP_INIT=1 flatpak-spawn --host flatpak run net.lutris.Lutris lutris:rungameid/2
Categories=Game
```
2025-03-13 15:41:07 +00:00
## How-to: Launch Steam Games
### Step 1: Create an empty desktop file
2025-03-13 17:43:35 +00:00
First, create the `.desktop` file as mentioned above with the game name and put it in the `retrodeck/roms/windows/` folder.
2025-03-13 15:41:07 +00:00
### Step 2: Get the Steam AppID
1. Open Steam.
2. In Steam, go to `Library` -> `Right Click` the game -> `Properties` -> `Updates`.
3. Make a note of the `AppID`.
**Example:** ASTLIBRA Revision
<img src="../steam.png" width="800">
**App ID:** 1718570
### Step 3: Populate the .desktop file
2025-03-13 18:01:44 +00:00
Open the `.desktop` file and populate it.
The files are different if you have the native version of Steam installed or the Flatpak version.
2025-03-13 17:42:32 +00:00
2025-03-13 18:04:18 +00:00
### Step 3a: Steam (Native)
2025-03-13 17:42:32 +00:00
This for Steam that is installed natively.
Copy this:
2025-03-13 15:41:07 +00:00
```
2025-03-13 15:11:34 +00:00
[Desktop Entry]
Type=Application
2025-03-13 15:41:07 +00:00
Name=G NAMEHERE
2025-03-13 17:42:32 +00:00
Icon=steam_icon_APPIDHERE
Exec=flatpak-spawn --host steam -silent steam://rungameid/APPIDHERE
2025-03-13 15:11:34 +00:00
Categories=Game
2025-03-13 15:41:07 +00:00
```
2025-03-13 17:42:32 +00:00
Change the values of:
2025-03-13 15:11:34 +00:00
2025-03-13 17:42:32 +00:00
- **Name=** NAMEHERE
- **Icon=** steam_APPIDHERE
- **Exec=** rungameid/APPIDHERE
2025-03-13 15:11:34 +00:00
2025-03-13 18:42:57 +00:00
**Example: ASTLIBRA Revision.desktop**
2025-03-13 15:11:34 +00:00
2025-03-13 15:41:07 +00:00
```
2025-03-13 15:11:34 +00:00
[Desktop Entry]
Type=Application
2025-03-13 15:41:07 +00:00
Name=ASTLIBRA Revision
2025-03-13 17:42:32 +00:00
Icon=steam_icon_1718570
2025-03-13 21:11:25 +00:00
Exec=flatpak-spawn --host steam -silent steam://rungameid/1718570
2025-03-13 15:11:34 +00:00
Categories=Game
2025-03-13 15:41:07 +00:00
```
2025-03-13 18:04:18 +00:00
### Step 3b: Steam (Flatpak)
2025-03-13 17:42:32 +00:00
This for Steam that is installed via Flatpak.
Copy this:
```
[Desktop Entry]
Type=Application
Name=G NAMEHERE
Icon=steam_icon_APPIDHERE
Exec=flatpak-spawn --host flatpak run com.valvesoftware.Steam -silent steam://rungameid/APPIDHERE
Categories=Game
```
Change the values of:
- **Name=** NAMEHERE
- **Icon=** steam_APPIDHERE
- **Exec=** rungameid/APPIDHERE
2025-03-13 18:42:57 +00:00
**Example: ASTLIBRA Revision.desktop**
2025-03-13 17:42:32 +00:00
```
[Desktop Entry]
Type=Application
Name=ASTLIBRA Revision
Icon=steam_icon_1718570
Exec=flatpak-spawn --host flatpak run com.valvesoftware.Steam -silent steam://rungameid/1718570
Categories=Game
```
2025-03-13 21:11:25 +00:00
## How-to: Launch Flatpak Games
2025-03-13 18:42:57 +00:00
2025-03-13 21:11:25 +00:00
You can either copy and edit the desktop files or make your own.
2025-03-13 21:52:02 +00:00
### Copy and Edit .desktop files (Recommended)
2025-03-13 21:11:25 +00:00
#### Step 1: Find the files
**Note:** All files here are symlinks, but the export folders contains them all in a conventient way.
Depending if you how you have installed the application they can either be under:
- **System Wide:** `/var/lib/flatpak/exports/share/applications/`
- **Local User:** `~/.local/share/flatpak/exports/share/applications/`
#### Step 2: Show Target
`Right Click` on the symlinked `.desktop` file in the folder and press `Show Target`.
This will take you to the real `.desktop` shortcut.
Example `eu.vcmi.VCMI.desktop`:
- **System Wide:** `/var/lib/flatpak/app/eu.vcmi.VCMI/current/active/export/share/applications/`
- **Local User:** `~/.local/share/flatpak/app/eu.vcmi.VCMI/current/active/export/share/applications/`
#### Step 3: Copy the .desktop file
Copy the `.desktop` file to `retrodeck/roms/windows/`
#### Step 4: Rename the file
Rename the file to something more fitting.
**Examples:**
`net.openra.OpenRA.desktop` -> `OpenRA.desktop` or `Red Alert.desktop`
`eu.vcmi.VCMI.desktop` -> `VCMI.desktop` or `Heroes of Might and Magic III.desktop`
#### Step 5: Edit the file
Open the `.desktop` file and edit the **Exec=** values so they are changed to `flatpak-spawn --host flatpak run`.
**Example VCMI.desktop:**
- **Before:** `Exec=/usr/bin/flatpak run --branch=stable --arch=x86_64 --command=vcmilauncher eu.vcmi.VCMI`
- **After:** `Exec=flatpak-spawn --host flatpak run --branch=stable --arch=x86_64 --command=vcmilauncher eu.vcmi.VCMI`
### Make your own desktop files
#### Step 1: Create an empty desktop file
2025-03-13 18:42:57 +00:00
First, create the `.desktop` file as mentioned above with the game name and put it in the `retrodeck/roms/windows/` folder.
2025-03-13 21:11:25 +00:00
#### Step 2: Get the Run Command and Full Flatpak Name.
**Find them on Desktop**
2025-03-13 18:42:57 +00:00
2025-03-13 21:11:25 +00:00
Note this was done in KDE
2025-03-13 18:42:57 +00:00
2025-03-13 21:11:25 +00:00
- `Right Click` in on the Application in the `Application Launcher Menu` and press `Edit Application`.
- `Command-line arguments` should contain the `Full Flatpak Name` and `Run Command`.
**Find them on Flathub:**
- Go to [Flathub](https://flathub.org/).
- On flathub go to a the application you want to add, press the `Down Arrow` next to `Download Button` to get the `Run Command` and `Full Flatpak Name`.
2025-03-13 18:42:57 +00:00
**Example: OpenRA.desktop**
2025-03-13 21:11:25 +00:00
[OpenRA - Flathub](https://flathub.org/apps/net.openra.OpenRA)
2025-03-13 18:42:57 +00:00
<img src="../openra.png" width="800">
- **Run command:** flatpak run net.openra.OpenRA
- **Full Flatpak Name:** net.openra.OpenRA
### Step 3: Populate the .desktop file
Open the `.desktop` file and populate it.
Copy this:
```
[Desktop Entry]
Type=Application
Name=NAMEHERE
Icon=FULLFLATPAKNAMEHERE
Exec=flatpak-spawn --host flatpak run RUNCOMMMANDHERE
Categories=Game
```
Change the values of:
- **Name=** NAMEHERE
- **Icon=** FULLFLATPAKNAMEHERE
- **Exec=** RUNCOMMMANDHERE
**Example: OpenRA.desktop**
```
[Desktop Entry]
Type=Application
Name=OpenRA
Icon=net.openra.OpenRA
Exec=flatpak-spawn --host flatpak run net.openra.OpenRA
Categories=Game
```
2025-03-13 21:52:02 +00:00
## How-to: Launch Heroic Games
#### Step 1: Create and move .desktop file from Heroic
2025-03-15 04:35:54 +00:00
1. Open Heroic.
2. Install the game .
3. Go to the `Library` -> `Your Game` -> Press the `Three Dotted Menu`.
4. Press `Add Shortcut`.
2025-03-13 21:52:02 +00:00
5. A shortcut will now be created on the Desktop.
2025-03-15 04:35:54 +00:00
6. Move or copy that to `retrodeck/roms/windows/`.
2025-03-13 21:52:02 +00:00
<img src="../heroic-shortcut.png" width="800">
### Step 2: Edit the .desktop file
Open the `.desktop` file and edit it.
The files are different if you have the native version of Heroic installed or the Flatpak version.
### Step 2b: Heroic (Flatpak)
Edit the file original file.
- **Exec=** Add the `flatpak-spawn --host flatpak run com.heroicgameslauncher.hgl --no-gui --no-sandbox` instead of `xdg-open`.
**Example: Original - Flight of the Amazon Queen.desktop**
```
[Desktop Entry]
Name=Flight of the Amazon Queen
Exec=xdg-open heroic://launch?appName=1207659723&runner=gog
Terminal=false
Type=Application
Icon=/home/deck/Games/Heroic/Flight of the Amazon Queen/goggame-1207659723.ico
Categories=Game;
```
**Example: Edited - Flight of the Amazon Queen.desktop**
```
[Desktop Entry]
Name=Flight of the Amazon Queen
Exec=flatpak-spawn --host flatpak run com.heroicgameslauncher.hgl --no-gui --no-sandbox heroic://launch?appName=1207659723
Terminal=false
Type=Application
Icon=/home/deck/Games/Heroic/Flight of the Amazon Queen/goggame-1207659723.ico
Categories=Game;
```
2025-03-13 21:11:25 +00:00
## How-to: Launch Native Games
**W.I.P**
You can either copy and edit the desktop files or make your own.
2025-03-13 21:52:02 +00:00
### Copy and Edit .desktop files (Recommended)
2025-03-13 21:11:25 +00:00
#### Step 1: Find the files
The desktop files should be located under
`/usr/share/applications/`
2025-03-13 18:13:56 +00:00
## The Last Step: Launch the Games via RetroDECK & Scrape
2025-03-13 15:11:34 +00:00
2025-03-13 18:10:19 +00:00
After the `.desktop` files have been created and everything is working as expected, RetroDECK will recognize the `.desktop` file the next time you start it. The games will appear under the Windows tab in ES-DE. If you have named the games correctly, there is a good chance that the scraper will identify them.