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

Option to use steam via flatpak? #63

Closed
alucryd opened this issue Oct 17, 2023 · 34 comments
Closed

Option to use steam via flatpak? #63

alucryd opened this issue Oct 17, 2023 · 34 comments

Comments

@alucryd
Copy link

alucryd commented Oct 17, 2023

Hi there, I'm trying to get the flatpak version of steam to work with this, I created a simple shim in /usr/local/bin/steam so that it is available in path, but moondeck complains it failed to run the steam app. I can briefly see my desktop via Moonlight before I get the error message. Has anyone got a similar setup working?

Content of the shim:

#!/bin/sh
exec flatpak run com.valvesoftware.Steam "$@"
@FrogTheFrog
Copy link
Owner

Buddy uses a hardcoded path of /usr/bin/steam, try with this one?

@FrogTheFrog
Copy link
Owner

If you can build Buddy, take a look at https://github.com/FrogTheFrog/moondeck-buddy/blob/df5381e43711f36e30a5f98db485134856a2efa5/src/lib/os/linux/steamregistryobserver.cpp#L138C39-L138C53.

I'm currently checking only 1 directory, please create a PR if you want to check multiple or even another approach.

@alucryd
Copy link
Author

alucryd commented Oct 19, 2023

Thanks for the quick reply. I tried placing the shim at /usr/bin/steam, but it still won't work:

buddy
[21:26:20.094] INFO     buddy.utils: Log location: "/tmp/moondeckbuddy.log"
[21:26:20.094] INFO     buddy.main: startup. Version: 1.5.6
[21:26:20.186] INFO     buddy.server: Server started listening at port 59999
[21:26:20.186] INFO     buddy.main: startup finished.
[21:28:25.565] WARNING  buddy.utils: failed to initialize system tray...
[21:29:56.665] WARNING  buddy.os: Steam EXEC path is not available yet!
[21:30:25.890] INFO     buddy.main: shutdown.

I can definitely run steam -applaunch %appid% from a terminal though, so I'm not sure what's going on. I'll try building buddy myself. As for modifying it, I can probably try (although I don't speak c++).

@FrogTheFrog
Copy link
Owner

Have you managed to get it working?

@alucryd
Copy link
Author

alucryd commented Oct 24, 2023

I didn't, for some reason my build produces an unusable executable, it exits immediately without any error (exit code 0).

@FrogTheFrog
Copy link
Owner

It will do this if some other instance of MoonDeckBuddy is already running.

@FrogTheFrog
Copy link
Owner

I will try installing flatpak on my laptop and will let you know about my experience.

@FrogTheFrog
Copy link
Owner

@alucryd it was more annoying than I thought as flatpak messed everything up...

I've added 2 config settings (they will be saved to file once the new executable is run). They are called ...override. Set one to point to your registry file (for ex. /home/frog/.var/app/com.valvesoftware.Steam/.steam/registry.vdf) and the other one to that custom executable that you were using before.

The build can be found here until I get the release going:
https://github.com/FrogTheFrog/moondeck-buddy/actions/runs/6632376756

@FrogTheFrog
Copy link
Owner

@Nitrousoxide
Copy link

I'm also having this issue. If you have an appimage I can install to test your build I'd be happy to trial it for you.

@FrogTheFrog
Copy link
Owner

I'm also having this issue. If you have an appimage I can install to test your build I'd be happy to trial it for you.

I have restarted the build, please use the AppImage from that link above

@Nitrousoxide
Copy link

Looks like your linux build failed.

@FrogTheFrog
Copy link
Owner

FrogTheFrog commented Oct 29, 2023

Will fix it properly later, some stupid diagnostic check. Use build from this one:
https://github.com/FrogTheFrog/moondeck-buddy/actions/runs/6683686326

(once it finishes)

@Nitrousoxide
Copy link

Nitrousoxide commented Oct 29, 2023

I set my override in ~/.config/moondeckbuddy/settings.json

The app starts up, but when I go to my deck and try to start a game using moondeck, in this case TF2, I get this error.

❯ MoonDeckBuddy.AppImage 
[10:15:08.958] INFO     buddy.utils: Log location: "/tmp/moondeckbuddy.log"
[10:15:08.958] INFO     buddy.main: startup. Version: 1.5.7
[10:15:08.989] INFO     buddy.os: registry.vdf file path set to "/home/Brian/.steam/registry.vdf"
[10:15:08.989] INFO     buddy.os: Steam binary path set to "/home/Brian/.var/app/com.valvesoftware.Steam/.steam/registry.vdf"
[10:15:09.038] INFO     buddy.server: Server started listening at port 59999
[10:15:09.038] INFO     buddy.main: startup finished.
[10:15:10.089] INFO     buddy.os: Steam exec path: "/home/Brian/.var/app/com.valvesoftware.Steam/.steam/registry.vdf"
[10:15:48.595] WARNING  buddy.os: Failed to start Steam app launch sequence!

Edit wait, I think I also need to add the steam flatpak binary path too. let me see if I can find that

@Nitrousoxide
Copy link

I added a steam shim in ~/.local/bin and set the binary override to that. It seemed to start games. TF2 loaded but I couldn't control anything via the deck. I tried Sea of Stars and Baulder's Gate 3 and they both just error'd out on the deck side, though they did start the game on my computer's side.

This is what the log looks like

❯ MoonDeckBuddy.AppImage 
[10:27:01.582] INFO     buddy.utils: Log location: "/tmp/moondeckbuddy.log"
[10:27:01.582] INFO     buddy.main: startup. Version: 1.5.7
[10:27:01.609] INFO     buddy.os: registry.vdf file path set to "/home/Brian/.var/app/com.valvesoftware.Steam/.steam/registry.vdf"
[10:27:01.610] INFO     buddy.os: Steam binary path set to "/home/Brian/.local/bin/steam"
[10:27:01.658] INFO     buddy.server: Server started listening at port 59999
[10:27:01.658] INFO     buddy.main: startup finished.
[10:27:02.716] WARNING  buddy.os: Steam PID from registry.vdf does not match what we have found (normal for flatpak or outdated data)! Using PID 10012 (instead of 108) to track Steam process.
[10:27:02.734] INFO     buddy.os: Steam exec path: "/home/Brian/.local/bin/steam"
[10:27:23.965] WARNING  buddy.os: Steam PID from registry.vdf does not match what we have found (normal for flatpak or outdated data)! Using PID 10012 (instead of 108) to track Steam process.
[10:27:26.196] WARNING  buddy.os: Steam PID from registry.vdf does not match what we have found (normal for flatpak or outdated data)! Using PID 10012 (instead of 108) to track Steam process.
[10:28:04.752] WARNING  buddy.os: Steam PID from registry.vdf does not match what we have found (normal for flatpak or outdated data)! Using PID 10012 (instead of 108) to track Steam process.
[10:28:06.182] WARNING  buddy.os: Steam PID from registry.vdf does not match what we have found (normal for flatpak or outdated data)! Using PID 10012 (instead of 108) to track Steam process.
[10:29:22.441] WARNING  buddy.os: Steam PID from registry.vdf does not match what we have found (normal for flatpak or outdated data)! Using PID 10012 (instead of 108) to track Steam process.
[10:29:23.792] WARNING  buddy.os: Steam PID from registry.vdf does not match what we have found (normal for flatpak or outdated data)! Using PID 10012 (instead of 108) to track Steam process.
[10:30:12.604] WARNING  buddy.os: Steam PID from registry.vdf does not match what we have found (normal for flatpak or outdated data)! Using PID 10012 (instead of 108) to track Steam process.
[10:30:14.404] WARNING  buddy.os: Steam PID from registry.vdf does not match what we have found (normal for flatpak or outdated data)! Using PID 10012 (instead of 108) to track Steam process.
[10:31:00.267] WARNING  buddy.os: Steam PID from registry.vdf does not match what we have found (normal for flatpak or outdated data)! Using PID 10012 (instead of 108) to track Steam process.
[10:31:02.039] WARNING  buddy.os: Steam PID from registry.vdf does not match what we have found (normal for flatpak or outdated data)! Using PID 10012 (instead of 108) to track Steam process.
[10:32:30.999] WARNING  buddy.os: Steam PID from registry.vdf does not match what we have found (normal for flatpak or outdated data)! Using PID 10012 (instead of 108) to track Steam process.
[10:32:32.743] WARNING  buddy.os: Steam PID from registry.vdf does not match what we have found (normal for flatpak or outdated data)! Using PID 10012 (instead of 108) to track Steam process.

@FrogTheFrog
Copy link
Owner

Could you enable debug logs for Buddy and paste the log again?

@Nitrousoxide
Copy link

Here's the log for "Sea of Stars" which does start up on the computer but fails to display anything on the deck and I have to "b" out of.

moondeckbuddy.log

@FrogTheFrog
Copy link
Owner

Pfff, well the Buddy is working as expected at least, a little too spamy (which I will fix), but works.

fails to display anything

Did you try restarting SteamDeck? Sometimes the UI bugs out. Also, what does it mean exactly? Does it launch Moonlight or does it get stuck with the Steam spinner?

FYI, Valve broke something since the last big update and now Buddy cannot detect intermediate states for the games. It's either running (the process itself) or not. So, if Steam decides to update it on the host, you will get error'ed out. These timeouts can be increased in MoonDeck.

@Nitrousoxide
Copy link

Restarting the deck seems to work.

@Nitrousoxide
Copy link

Also, I noticed in the logs intially (not the set I sent you) that it says auto-changing the resolution isn't supported in wayland. I do have a solution on my end for this in a gnome desktop environment. I imagine that KDE will require a different app than: gnome-randr though

image

@FrogTheFrog
Copy link
Owner

Yeah, wayland specification does not yet have the protocol for changing resolution...

I would highly recommend to take a look into https://docs.lizardbyte.dev/projects/sunshine/en/nightly/about/guides/app_examples.html#changing-resolution-and-refresh-rate-linux-wayland
as sunshine now has variables from Moonlight :)

@FrogTheFrog
Copy link
Owner

FrogTheFrog commented Oct 29, 2023

If "pass to Moonlight" option is enabled you can pass it all the way from MoonDeck to Sunshine. However, Moonlight only supports integers, so you would have to somehow find the closest value that your host supports. Or you could have multiple Sunshine app entries for MoonDeck, each with different resolution.

@Nitrousoxide
Copy link

I'm getting "failed to launch app in time" errors, though the apps are, in fact, launching on my PC. This is for BG3 here.
moondeckbuddy.log

@FrogTheFrog
Copy link
Owner

Could you run ps aux --forest for me and copy the Steam three when the BG3 is running?

@FrogTheFrog
Copy link
Owner

Also, was Steam closed after the first Stream?

[12:43:37.536] DEBUG    buddy.main: 
Request: QHttpServerRequest((Url: QUrl("https://192.168.7.236:59999/endStream"))(Headers: ("Host": "192.168.7.236:59999"), ("authorization": "basic MGJhYjA3N2EtM2RlMy00ZWUyLWJiNDMtOWQ1N2IzZmI0OTYy"), ("Accept": "*/*"), ("Accept-Encoding": "gzip, deflate"), ("User-Agent": "Python/3.10 aiohttp/3.8.5"), ("Content-Length": "0"), ("Content-Type": "application/octet-stream"))(RemoteHost: QHostAddress("::ffff:192.168.7.99"))(BodySize: 0)) | "" 
Response: QHttpServerResponder::StatusCode::Ok | "{\"result\":true}"
[12:43:38.224] DEBUG    buddy.os: Steam is no longer running!
[12:43:38.232] DEBUG    buddy.os: Handling Steam exit.
[12:43:39.724] DEBUG    buddy.os: Stream has ended.

@Nitrousoxide
Copy link

Nitrousoxide commented Oct 29, 2023

psoutputcropped.log

Could you run ps aux --forest for me and copy the Steam three when the BG3 is running?

Here you go. I cropped out the unnessessary stuff unrelated to steam/moondeck
psoutputcropped.log

Also, was Steam closed after the first Stream?

I added a "flatpak kill com.valvesoftware.Steam" command to the Sunshine app for MoonDeckStream because it seems to leave it running even though the config file says to kill it.

image

@FrogTheFrog
Copy link
Owner

Thanks.

I think killing it makes it problematic for Buddy and I will need to make it more robust :/.
That aside, https://192.168.7.236:59999/endStream tells me that MoonDeck is not closing steam when stream ends. Is it really configured in MoonDeck itself to close the Steam?

@FrogTheFrog
Copy link
Owner

@Nitrousoxide https://github.com/FrogTheFrog/moondeck-buddy/actions/runs/6685007818 should be more robust now when the Steam is killed. However, I would recommend you to enable the MoonDeck option I've mentioned. It's under host settings.

@Nitrousoxide
Copy link

Nitrousoxide commented Oct 29, 2023

Thanks, I took out the do/undo command to flatpak kill steam. It does seem to properly close it now (I didn't have it also selected in the moondeck app on the deck before so that might have been why)

I am still getting the timed out game start error though. It does start up on the computer and if I start the stream back up after it errors out I can control the game for 10 or 20 seconds but then it jumps back out again with the same failure to start error.

moondeckbuddy.log
psoutput.log

Edit: this time I was trying "Sea of Stars" rather than BG3

@FrogTheFrog
Copy link
Owner

@Nitrousoxide This should work now https://github.com/FrogTheFrog/moondeck-buddy/actions/runs/6685412767

Also found an issue with Sunshine where it waits on a zombie SteamDeckStream process... Will address this on MoonDeck and notify the Sunshine team.

@alucryd
Copy link
Author

alucryd commented Oct 29, 2023

Sorry I'm late to the party. I tried the latest build, it does start the game and I can play for a bit, but it quickly fails with the timeout error. I can provide logs later if that can help (it's getting late here).

@Nitrousoxide
Copy link

@Nitrousoxide This should work now https://github.com/FrogTheFrog/moondeck-buddy/actions/runs/6685412767

Also found an issue with Sunshine where it waits on a zombie SteamDeckStream process... Will address this on MoonDeck and notify the Sunshine team.

This seems to be reliably working so far.

@FrogTheFrog
Copy link
Owner

Sorry I'm late to the party. I tried the latest build, it does start the game and I can play for a bit, but it quickly fails with the timeout error. I can provide logs later if that can help (it's getting late here).

I'm also heading to sleep. Please post the debug logs from the from the build from the last link I've posted.

Will take a look tomorrow.

@FrogTheFrog
Copy link
Owner

I'm closing this as it has been resolved for one person and new version has been released.

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

No branches or pull requests

3 participants