Help fixing Heroic Games Launcher Snap

HI!

I am the main developer of Heroic Games Launcher and we have a Snap package available but it is not working fully because of some limitations of the confinement so I need help figuring out how to fix those or how to change it to use classic confinement since this one works just fine.

The current issues are:

  • Heroic comes with some binary files that are needed to deal with the stores integration, one of them, Legendary, which deals with the Epic games side, cannot write its configs. For some reason, even if it is called from inside Heroic, it doesn’t have permission to write inside Heroic’s folder. It needs to have access to the snap/../config/heroic/legendaryConfig folder. Without it, it is not possible to Log on to the Epic Games store, list games, install them, etc.

  • The second issue is that Heroic uses curl to download things like Wine, Proton, DXVK and VKD3D. Since it is confined it cannot use it. I tried using the layout feature to symlink /usr/bin/curl but that also does not work for some reason.

  • The latest issue is that Heroic needs to access some folders in the user’s home. Things like the .local/share/Steam folder so it can check for Proton versions and also add Heroic shortcuts to Steam. It also accesses .local/share/lutris folder to check for wine versions from it as well.

  • Other features that Heroic has and we were able to implement on Flatpak like Feral Gamemode and Gamescope I also don’t know how to do so I would need help figuring out on how to download and compile those files or some way to make them available to Heroic so users can use these features.

I am not familiar with how Snaps and Flatpaks are close or not but if it helps I can paste here the link to our manifest file.

I also think that the easiest fix would be to make it use the classic confinement so it would have access to those helpers and to the necessary files on the home folder when needed.

For context: Our Github: https://github.com/Heroic-Games-Launcher/HeroicGamesLauncher Our current snap package: Install Heroic Games Launcher on Linux | Snap Store

I also maintain the Snap package for HyperPlay which is a Heroic fork and has the same issues.

Thanks in advance :slight_smile:

1 Like

Can you share the snap manifest with us, or do you use the electron-building for making snap?

Hi! I am using Electron-builder for that. After installing the snap I know it stores the generated manifest somewhere but I dont remember the exact path.

I just saw it and what better is to make a custom one, instead of using from electron builder. It’s anyway outdated.

I tried to help Heroic on this subject once and came to the same conclusion: the best way would be creating a custom one. Hopefully we’ll have it now!

@flaviofearn if you need any help, @soumyaDghosh and I might give it a try.

I appreciate all the help on this matter.

From where can we start? :slight_smile:

Leave it on me. Just do me a favour by testing it, cause I haven’t used it for a long time now.

1 Like

I’d be happy to assist where needed, too.

Looks like the template YAML is located at node_modules/app-builder-lib/templates/snap/snapcraft.yaml. The actual YAML that is used for the installed version of Heroic can be found on your system at /snap/heroic/current/meta/snap.yaml.

Your third issue should be solved by adding a personal-files plug like we do on the Steam snap. I’ll look into the other problems some more.

Getting things like GameMode to work might be tricky, but I have some prior work on that for the Steam Snap (1, 2). GameMode specifically will likely need this PR that has yet to be merged to work in a Snap environment: https://github.com/flatpak/xdg-desktop-portal/pull/882.

1 Like

Sure! Thanks a lot! Let me know when you need testing that I can do it and will also ask the rest of the team to test it as well.

Great! I tried using the personal files and also creating a dot-config plug for the legendary config but they did not work, at least not with electron-builder. Not sure if its something wrong with this lib but I could see the plugs correctly on the YML so I am not sure anymore.

I also testing the snaps in Endeavour OS, should I test it on Ubuntu?

Testing on mainline Ubuntu would be a good baseline to test against, yes. If you do end up going the custom snapcraft.yaml route, I’d also recommend upgrading to core 22 (or at least core 20).

I think electron-builder is not supporting core 22 because I was having several errors when trying to build with it. Core 20 worked fine I believe. Will test again.

EDIT: I have Ubuntu 23.04 on my machine as well, I will try it on it as well.

It doesn’t look like electron-builder supports core 22, core 22 has quite a few syntax changes so it would probably require a custom YAML (which I’d probably recommend if you’re up for it, anyway). I’m taking a stab at writing one, too

I’d recommend not using electron-builder for this use case. It’s fine for more traditional electron apps, but heroic is a bit more complex. My recommendation would be to use a separate packaging repo for the snap that references the binary of heroic published on github releases page. We have plenty of prior art there which I think @ashtonn can dig up.

1 Like

This is @kenvandine’s prior work on Heroic: https://github.com/kenvandine/heroic-games-launcher/blob/main/snap/snapcraft.yaml

Like he said, it pulls the deb from the latest release on GitHub and builds the Snap from that. It still has some of the issues you’ve described, but it’d be a good place to start.

I believe curl is working correctly with that version, it at least is letting me download Proton and Wine versions it seems.

For your third issue, you should be able to add this to the plugs section of that YAML:

  dot-local-share:
    interface: personal-files
    write:
      - $HOME/.local/share/Steam
      - $HOME/.local/share/lutris

Then run snap connect heroic-games-launcher:dot-local-share to connect it after building and installing.

Signing in still doesn’t seem to work, I’ll investigate that further.

Should I share the manifest only? Actually that’d obviously be easy for me

Thanks! I overlooked this. I will start from here then.

This is the thread I created to discuss on snaps.

Great, already tested a few things and some of them fixed it on our end.

Opened this PR here and linked all discussions there so we can follow up everything: https://github.com/Heroic-Games-Launcher/HeroicGamesLauncher/pull/3128

We might not need the snapcraft file, but let’s see. :slight_smile:

Hey, how can forcefully change the XDG_CONFIG_DIR? Even with a custom script before launching, the XDG_CONFIG_HOME again sets to $SNAP_USER_DATA/.config where as for heroic it should be in $SNAP_USER_COMMON/.config

Yes, I already fixed that on the PR.

1 Like