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

Support for game detection is limited on Linux #1900

Open
Ortham opened this issue Aug 20, 2023 · 10 comments
Open

Support for game detection is limited on Linux #1900

Ortham opened this issue Aug 20, 2023 · 10 comments
Labels

Comments

@Ortham
Copy link
Member

Ortham commented Aug 20, 2023

Support for detecting Steam games is being done as part of #1893, but aside from that all game installs need to be manually configured.

There are two aspects of game detection, detecting install paths and detecting local data paths.

For install paths:

  • GOG game install paths are detected by looking up Registry entries, which obviously doesn't work on Linux.
  • Microsoft Store game install paths are found by scanning drive roots for .GamingRoot files to find MS Store library locations. This could be done on Linux by scanning mount points instead. Older MS Store installs are found by looking them up in the Registry.
  • Epic Games Store game install paths are found by looking up a Registry entry to find where EGS stores its manifest files. If that fails, LOOT falls back to using a Windows API to guess EGS's program data path.

For local data paths, all three game sources have the same problem: there's no obvious way to detect what the correct path is. It can be done for Steam because Steam provides a native Linux application that manages the local data paths, so they exist at consistent, guessable locations. GOG, MSS and EGS don't provide native game launchers / managers.

That said, there are native third-party launchers/managers that might manage games' local data paths. Those I've heard of are:

  • Lutris (EGS, GOG) - available as a Flatpak
  • Heroic Games Launcher (EGS, GOG) - available as a Flatpak and AppImage
  • Legendary (EGS) - CLI, used by Heroic Games Launcher
  • Minigalaxy (GOG) - not available as a Flatpak or AppImage
  • GameHub (Steam, GOG) - not seen any updates in over a year, warns that AppImage and Flatpak are unstable.
  • Bottles - available as a Flatpak. Not a launcher, but more of a Wine prefix manager that allows you to install Windows launchers and use them through Wine.

From searching around, Heroic seems to be most commonly recommended, followed by Lutris, and I saw a few mentions of Bottles. However, with Bottles being a Wine prefix manager, I don't think it would be possible to detect games installed through it, because they'd actually be installed through launchers/managers running in Wine, so you'd need to have LOOT interface with the Wine prefixes to do game detection like it does on Windows.

MSS games don't seem to be available on Linux at all (no surprise there), so I think the only way a user would end up trying to play one would be if they had a Windows drive mounted. If that's the case then LOOT could potentially look for Windows user directories on the same drive to see if any had an existing local app data path, and detection could just fail if none is found. However, if there's more than one user with such data then LOOT could end up picking the wrong path, which wouldn't necessarily be obvious to the user.

@Ortham Ortham added the linux label Aug 20, 2023
@Ortham
Copy link
Member Author

Ortham commented Aug 24, 2023

I've installed Lutris and Heroic Games Launcher as Flatpak applications and had a play around with them, and here are some notes I've made:

HGL

  • The HGL Flatpak app has access to a bunch of specific directories, but nothing generic: filesystems=xdg-data/Steam;/mnt;~/.var/app/com.valvesoftware.Steam;/run/udev:ro;/run/media;~/Downloads/Heroic-secondary:create;xdg-data/applications;xdg-documents;xdg-data/lutris;~/Games/Heroic:create;xdg-desktop;xdg-run/app/com.discordapp.Discord:create;~/.steam;
  • Sign in to GOG and EGS to see their games in the application library view and install them.
  • HGL uses a default ~/Games/Heroic directory that it has permissions for by default, and if you try to install a game elsewhere it will detect and warn when it doesn't have permission for that path.
  • HGL uses a single shared Wine prefix for all installed games by default, but one of the options when installing a game is to supply a different path to create and use.
  • HGL doesn't seem to have a concept of library folders like Steam does, it looks like games installed outside the default directory are essentially just individual paths that could be anywhere.
  • HGL's wineprefix folders have a similar structure to Steam's, e.g. if I install Oblivion to ~/Games/Heroic/Oblivion, its Plugins.txt is at ~/Games/Heroic/Prefixes/default/pfx/drive_c/users/steamuser/AppData/Local/Oblivion/Plugins.txt.
  • HGL allows you to change the wineprefix used by a game after you install it. If I do that, files are created for the new wineprefix.
  • HGL stores its data in ~/.var/app/com.heroicgameslauncher.hgl/.
  • For GOG games, there's a config/heroic/gog_store/installed.json file that has an object containing an array of installed games with their instapp_path and appName. Those appnames appear in config/heroic/GamesConfig/<appname>.json filenames, and those files have a winePrefix that match the wineprefix configured in HGL.
  • For EGS games, there's a config/heroic/legendaryConfig/legendary/manifests/installed.json file that has an object with keys that are EGS app names (e.g. adeae8bbfc94427db57c7dfecce3f1d4 for FO3), and each of those keys has an object value with an install_path key. Like for GOG, there's a config/heroic/GamesConfig/<appname>.json file that has the wine prefix.

So finding games installed by HGL should be pretty straightforwards:

  • Starting at $XDG_CONFIG_HOME/heroic:
    • For GOG games, parse the file at gog_store/installed.json and search its installed array for objects with appName keys that have values that match a supported GOG game ID. For each that does, take the same object's install_path key's value as the game's install path.
    • For EGS games, parse the file at legendaryConfig/legendary/manifests/installed.json. Check the object for a key equal to the app name of a supported game, and for each match get the game's install path from the corresponding object's install_path key's value.
    • To find the local path for all games, parse the file at GamesConfig/<game ID / app name>.json. It holds and object with a key that's the game ID and a value that's an object. Read the winePrefix key's value, and append pfx/drive_c/users/steamuser/AppData/Local/<game local folder> to it to get the game's local path.

Lutris

  • The Lutris Flatpak application has access to $HOME and a few other specific directories: filesystems=home;/media;/run/media;~/.var/app/com.valvesoftware.Steam:ro;xdg-data/flatpak:ro;
  • Sign into GOG to see its games in the application library view and install games.
  • Signing into EGS involves first installing copies of Ubisoft Connect and the Epic Games Launcher... After doing that I got an error popup saying "Incompatible Wine version detected" "The Wine build you have selected does not support Esync. Please switch to an Esync-capable version." with an option to launch anyway, which I did not select. Another error popped up after that, but then when I retried signing into EGS, the EGS login window appeared. After selecting the EGS account option and entering my credentials, the window froze and turned blank white. It looks like it's a known issue, and the fix hasn't yet been released. I tried editing the Flatpak's Python code as suggested in that issue, but it didn't fix the issue for me, maybe being a Flatpak is getting in the way?
  • If I launch the EGS that Lutris installed (doing so through Lutris), I'm able to sign in to it and download Fallout 3. I chose to install it to ~/Downloads/EGS, and the install path was ~/Downloads/EGS/fallout3/Fallout 3 GOTY English/. It looks like the Wine prefix is the same one that EGS uses, with plugins.txt at /home/oliver/Games/epic-games-store/drive_c/users/oliver/AppData/Local/Fallout3/plugins.txt.
  • I installed Oblivion from GOG and it defaulted to installing it in ~/Games/gog/the-elder-scrolls-iv-oblivion-game-of-the-year-edition-deluxe/drive_c/GOG Games/Oblivion, with Plugins.txt at ~/Games/gog/the-elder-scrolls-iv-oblivion-game-of-the-year-edition-deluxe/drive_c/users/oliver/AppData/Local/Oblivion/. Note that the username in the latter path is not steamuser, instead it seems to have been taken from my linux config, it's the same value as $USER.
  • Launching Oblivion fails due to an error about Wine not supporting Esync. Lutris's settings show the default Wine is the system Wine (8.0.2) - I don't have Wine installed at a system level though. If I switch to using Proton - Experimental (the other option in the settings dropdown) it shows the same error. If I choose to ignore the error and continue, it shows a similar error about Fsync, but clicking through that too opens the launcher.
  • Lutris created a ~/Documents/My Games/Oblivion/Oblivion.ini... It's not a symlink: instead, the user subdirectories in ~/Games/gog/the-elder-scrolls-iv-oblivion-game-of-the-year-edition-deluxe/drive_c/users/oliver are symlinks to my Linux user directories:
oliver@oliver-desktop:~/Games/gog/the-elder-scrolls-iv-oblivion-game-of-the-year-edition-deluxe/drive_c/users/oliver$ ls -l
total 28
drwxr-xr-x 5 oliver oliver 4096 Aug 24 11:46  AppData
drwxr-xr-x 2 oliver oliver 4096 Aug 24 11:46  Contacts
lrwxrwxrwx 1 oliver oliver   20 Aug 24 11:46  Desktop -> /home/oliver/Desktop
lrwxrwxrwx 1 oliver oliver   22 Aug 24 11:46  Documents -> /home/oliver/Documents
lrwxrwxrwx 1 oliver oliver   22 Aug 24 11:46  Downloads -> /home/oliver/Downloads
drwxr-xr-x 2 oliver oliver 4096 Aug 24 11:46  Favorites
drwxr-xr-x 2 oliver oliver 4096 Aug 24 11:46  Links
lrwxrwxrwx 1 oliver oliver   18 Aug 24 11:46  Music -> /home/oliver/Music
lrwxrwxrwx 1 oliver oliver   21 Aug 24 11:46  Pictures -> /home/oliver/Pictures
drwxr-xr-x 2 oliver oliver 4096 Aug 24 11:46 'Saved Games'
drwxr-xr-x 2 oliver oliver 4096 Aug 24 11:46  Searches
drwxr-xr-x 2 oliver oliver 4096 Aug 24 11:57  Temp
lrwxrwxrwx 1 oliver oliver   19 Aug 24 11:46  Videos -> /home/oliver/Videos
  • I also installed Fallout 3 from GOG to the same ~/Games/gog folder, and its install path is ~/Games/gog/fallout-3-game-of-the-year-edition/drive_c/GOG Games/Fallout 3/.
  • Lutris also seems to be responsible for creating a ~/.wine Wine prefix, but it doesn't seem to be used by anything.
  • The Lutris Flatpak app keeps its data in ~/.var/app/net.lutris.Lutris. It looks like there's a config/lutris/games directory that contains *.yml files, one per installed application, e.g. elder_scrolls_iv_oblivion_game_of_the_year_edition_deluxe_the_game-1692874648.yml, epic-games-store-standard-1692874859.yml and fallout_3_game_of_the_year_edition_game-1693071206.yml (there's not one for FO3 installed from EGS, presumably because that was done through the EGL and so Lutris wasn't really involved).
  • In those YAML files there's a game.exe field that could be used to get the install path, though for Oblivion and Fallout 3 it's an absolute path, while for EGS it's relative to game.prefix, which is the Wine prefix. While the local path is in the same directory tree by default, it is possible to set a different Wine prefix, and if I set it to /home/oliver/Games/Heroic/Prefixes/default and then save the config and run the game, the launcher appears but most options are greyed out (because it can't find the game?). There is no wine.prefix for the GOG FO3 install, probably because I didn't customise it.
  • The numeric IDs in the YAML filenames don't match any IDs I know, they're not GOG or EGS or even Steam IDs. However, there is a service property in the YAML files that is gog and a service_id property that is the game's GOG game ID. The EGS YAML file doesn't have those properties.

So, to detect GOG games installed through Lutris:

  • look for *.yml files in $XDG_CONFIG_HOME/lutris/games and ~/.var/app/net.lutris.Lutris/config/games. For each YAML file found, parse it and check if it contains service: gog. If so, check if service_id is set to a supported GOG game ID. If it is, read game.exe: for Oblivion and FO3 it's the launcher executable's absolute path, so the game install path is that path's parent directory.
  • If the install path is valid, walk back up it until you hit drive_c, and then the local app data folder is at drive_c/users/<linux user?>/AppData/Local/<game folder>.

This would need yaml-cpp to be built and linked as part of LOOT's build process so that the YAML files could be parsed.

I guess detecting EGS games installed through Lutris would be similar. I don't think there's a good way to detect EGS games installed through the EGS that Lutris installs, as that happens inside Wine. You could find the Wine prefix from Lutris's game YAML file for EGS, and from there you could either interface with Wine to do the same detection that LOOT does on Windows, or you could guess the default location of the manifests (which is correct on my install), but then the manifest contains a Windows path which would need to be mapped to a Linux path: Z:\ seems to be the mount point for Linux's root /.

Lutris definitely seems more customisable and supports many more sources than HGL, but the UX is relatively unpolished, it seems buggier, and it's making a mess of my home directory with those symlinks. Based on my short experience, I definitely prefer HGL over Lutris for managing EGS and GOG games. Maybe I'll come back to Lutris after v0.5.14 is released.

@Ortham
Copy link
Member Author

Ortham commented Aug 25, 2023

I've implemented support for detecting GOG and EGS games installed through Heroic Games Launcher in 499552e.

@Ortham
Copy link
Member Author

Ortham commented Oct 20, 2023

Lutris 0.5.14 was released, so I tried it again:

  • I had to manually flatpak --user install flathub org.gnome.Platform.Compat.i386//45 to fix an error on startup after running flatpak run net.lutris.Lutris.

Steam

The Steam integration just prompts Steam to download and install the game when you first try to play it after "installing" it through Lutris, so it'll get picked up by LOOT's existing Steam support.

GOG

  • Sign-in works, and I can see games listed.
  • When installing Oblivion, the installer defaults to Z:\GOG Games\Oblivion, but that could be changed.
  • Once Oblivion's installer finishes running, trying to play the game through Lutris shows a dialog with this error message: "This game has no executable set. The install process didn't finish properly.". Sure enough, the install directory is only ~ 600 MB.
  • When I remove the game from Lutris, deleting its existing files, and re-install it, I change the install path to C:\GOG Games\Oblivion. With that it installs properly.
  • Trying to play Oblivion fails with a logged "terminate called after throwing an instance of 'dxvk::DxvkError'" error for all 3 Wine versions I've got installed: System (8.0.2), wine-ge-8-20-x86_64 and Proton - Experimental.

EGS

  • Selecting EGS as a source prompts to install the EGL as a Wine application. Starting the process to do this eventually fails with an error:
Executing load_times 
grep: warning: stray \ before /
Executing cd /home/oliver/.var/app/net.lutris.Lutris/cache/winetricks/corefonts
Downloading https://mirrors.kernel.org/gentoo/distfiles/fe/times32.exe to /home/oliver/.var/app/net.lutris.Lutris/cache/winetricks/corefonts
[0] Downloading 'https://mirrors.kernel.org/gentoo/distfiles/fe/times32.exe' ...
HTTP ERROR response 404 Not Found [https://mirrors.kernel.org/gentoo/distfiles/fe/times32.exe]
Executing cd /home/oliver/.var/app/net.lutris.Lutris/cache/winetricks/corefonts
Downloading https://web.archive.org/web/2000/https://mirrors.kernel.org/gentoo/distfiles/fe/times32.exe to /home/oliver/.var/app/net.lutris.Lutris/cache/winetricks/corefonts
[0] Downloading 'https://web.archive.org/web/2000/https://mirrors.kernel.org/gentoo/distfiles/fe/times32.exe' ...
HTTP response 302  [https://web.archive.org/web/2000/https://mirrors.kernel.org/gentoo/distfiles/fe/times32.exe]
Adding URL: https://web.archive.org/web/20231003060032/https://mirrors.kernel.org/gentoo/distfiles/fe/times32.exe
[0] Downloading 'https://web.archive.org/web/20231003060032/https://mirrors.kernel.org/gentoo/distfiles/fe/times32.exe' ...
Saving 'times32.exe'
HTTP response 200  [https://web.archive.org/web/20231003060032/https://mirrors.kernel.org/gentoo/distfiles/fe/times32.exe]
Executing cd /home/oliver/.var/app/net.lutris.Lutris/data/lutris/runtime/winetricks
------------------------------------------------------
SHA256 mismatch!

URL: https://web.archive.org/web/2000/https://mirrors.kernel.org/gentoo/distfiles/fe/times32.exe
Downloaded: 84d659bbc974204da5d2dd4e86b56e3748575a889525fabbb328a1d9d523cee6
Expected: db56595ec6ef5d3de5c24994f001f03b2a13e37cee27bc25c58f6f43e8f807ab

This is often the result of an updated package such as vcrun2019.
If you are willing to accept the risk, you can bypass this check.
Alternatively, you may use the --force option to ignore this check entirely.

Continue anyway?
------------------------------------------------------
------------------------------------------------------
Unattended mode, not prompting for confirmation
------------------------------------------------------
Executing cabextract -q -d /home/oliver/Games/epic-games-store/dosdevices/c:/windows/temp /home/oliver/.var/app/net.lutris.Lutris/cache/winetricks/corefonts/times32.exe
/home/oliver/.var/app/net.lutris.Lutris/cache/winetricks/corefonts/times32.exe: no valid cabinets found
------------------------------------------------------
warning: Note: command cabextract -q -d /home/oliver/Games/epic-games-store/dosdevices/c:/windows/temp /home/oliver/.var/app/net.lutris.Lutris/cache/winetricks/corefonts/times32.exe returned status 1. Aborting.

I wasn't able to get as far as before with GOG or EGS. The EGS issue seems to be because the install script relies on archive.org as a mirror for some files (which doesn't seem like the best idea), and from searches it seems like it can be a bit flaky. I didn't notice the DXVK error last time I tried running Oblivion, so it seems to be failing for a different reason now, but I'm not sure that's progress.

@375gnu
Copy link
Contributor

375gnu commented Dec 22, 2023

Can I help providing required information? I have both TES 4 & 5 installed.

@Ortham
Copy link
Member Author

Ortham commented Dec 23, 2023

@375gnu How have you installed them, and what store are they from?

@375gnu
Copy link
Contributor

375gnu commented Dec 23, 2023

They both are from GOG, installed using Lutris (it itself was installed from native Debian package, not Flatpak).

@Ortham
Copy link
Member Author

Ortham commented Dec 24, 2023

@375gnu Can you share your elder_scrolls_iv_oblivion_game_of_the_year_edition_deluxe_the_game-1692874648.yml file? I think it'll be in ~/.config/lutris/games, and it might have a slightly different filename.

@375gnu
Copy link
Contributor

375gnu commented Dec 24, 2023

game:
  exe: /home/redacted/Games/gog/the-elder-scrolls-iv-oblivion-game-of-the-year-edition-deluxe/drive_c/GOG
    Games/Oblivion/OblivionLauncher.exe
  launch_configs:
  - exe: /home/redacted/Games/gog/the-elder-scrolls-iv-oblivion-game-of-the-year-edition-deluxe/drive_c/GOG
      Games/Oblivion/Oblivion.exe
    name: 'The Elder Scrolls IV: Oblivion'
  - exe: /home/redacted/Games/gog/the-elder-scrolls-iv-oblivion-game-of-the-year-edition-deluxe/drive_c/GOG
      Games/Oblivion/TESConstructionSet.exe
    name: TES Construction Set
  - exe: /home/redacted/Games/gog/the-elder-scrolls-iv-oblivion-game-of-the-year-edition-deluxe/drive_c/GOG
      Games/Oblivion/manual.pdf
    name: Manual
  name: 'The Elder Scrolls IV: Oblivion'
game_slug: the-elder-scrolls-iv-oblivion-game-of-the-year-edition-deluxe
name: 'The Elder Scrolls IV: Oblivion - Game of the Year Edition Deluxe'
requires: null
script:
  files:
  - goginstaller: N/A:Select the installer from GOG
  game:
    exe: /home/redacted/Games/gog/the-elder-scrolls-iv-oblivion-game-of-the-year-edition-deluxe/drive_c/GOG
      Games/Oblivion/OblivionLauncher.exe
    launch_configs:
    - exe: /home/redacted/Games/gog/the-elder-scrolls-iv-oblivion-game-of-the-year-edition-deluxe/drive_c/GOG
        Games/Oblivion/Oblivion.exe
      name: 'The Elder Scrolls IV: Oblivion'
    - exe: /home/redacted/Games/gog/the-elder-scrolls-iv-oblivion-game-of-the-year-edition-deluxe/drive_c/GOG
        Games/Oblivion/TESConstructionSet.exe
      name: TES Construction Set
    - exe: /home/redacted/Games/gog/the-elder-scrolls-iv-oblivion-game-of-the-year-edition-deluxe/drive_c/GOG
        Games/Oblivion/manual.pdf
      name: Manual
    name: 'The Elder Scrolls IV: Oblivion'
  installer:
  - autosetup_gog_game: goginstaller
  system: {}
  wine:
    version: wine-ge-8-25-x86_64
service: gog
service_id: '1458058109'
slug: elder_scrolls_iv_oblivion_game_of_the_year_edition_deluxe_the_game
system: {}
variables: {}
version: GOG
wine:
  version: lutris-GE-Proton8-13-x86_64
year: null

Note that long lines are split, this is an my artifacts.

@Ortham
Copy link
Member Author

Ortham commented Dec 28, 2023

@375gnu is the redacted username in /home/redacted/Games/gog/the-elder-scrolls-iv-oblivion-game-of-the-year-edition-deluxe/drive_c/GOG Games/Oblivion/OblivionLauncher.exe the same as the <user> in /home/redacted/Games/gog/the-elder-scrolls-iv-oblivion-game-of-the-year-edition-deluxe/drive_c/users/<user>/AppData/Local/Oblivion?

@375gnu
Copy link
Contributor

375gnu commented Dec 28, 2023

@Ortham yes, it's the same.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Development

No branches or pull requests

2 participants