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

Linux version for support with Sunshine server? #4

Closed
joeknock90 opened this issue Dec 9, 2022 · 57 comments · Fixed by #39 or #40
Closed

Linux version for support with Sunshine server? #4

joeknock90 opened this issue Dec 9, 2022 · 57 comments · Fixed by #39 or #40

Comments

@joeknock90
Copy link

I love this idea as an alternative to steam remote play, which as of now is riddled with issues while using a Linux host.

Sunshine works extremely well for my usecase as an alternative. This project for a Linux host would solve all basically all of it's shortcomings for my use case.

I am not a developer or programmer, but if you think it's possible I'd be happy to provide any help I can.

Either way, thanks for your time!

@FrogTheFrog
Copy link
Owner

Heyo, I've already replied to this question more or less, so I will paste the quote:

Yes, on Linux the Sunshine is the equivalent for the official NVidia server. However, for me personally the experience was worse than remoteplay when I tried it so it went out of my sight immediately. However, buddy does not care whether it's a Sunshine or NVidia, but the linux specific API still needs to be implemented to detect if steam is running and what games are running at the moment. On Windows I've managed to find all the necessary info of it in the registry, on Linux... Who knows? I would welcome PR that implement this, but I don't plan any investigation soon.

In short, investigation needs to be done how and where Steam stores relevant info on Linux + API needs to be created to watch this info. A PR would be welcome :)

@joeknock90
Copy link
Author

Sorry, didn't see that anywhere!

Thanks for the breakdown! Wish I had more C++ experience. Hopefully someone smarter than me comes along.

Appreciate it!

@sevansup
Copy link

sevansup commented Dec 19, 2022

With Nvidia shutting down GameStream (announced this week), thereby breaking Moonlight--and also the new Steam Big Picture mode breaking other things, I wonder if ultimately Sunshine will be the way to go. It is sounding like it at the moment. Steam Link just isn't a good enough replacement yet sadly. https://nvidia.custhelp.com/app/answers/detail/a_id/5436

@FrogTheFrog
Copy link
Owner

With Nvidia shutting down GameStream (announced this week), thereby breaking Moonlight--and also the new Steam Big Picture mode breaking other things, I wonder if ultimately Sunshine will be the way to go. It is sounding like it at the moment. Steam Link just isn't a good enough replacement yet sadly. https://nvidia.custhelp.com/app/answers/detail/a_id/5436

I've already got the Sunshine working (for Windows only) and will be pushing the update soon'ish to the Testing store (maybe even before the new year). I will cancel NVidia faster, before it cancels me :D

@FrogTheFrog
Copy link
Owner

FrogTheFrog commented Dec 30, 2022

As of now the Buddy compiles on linux, but the proper implementation is still missing. There are 5 interfaces in https://github.com/FrogTheFrog/moondeck-buddy/tree/main/src/lib/os/linux that need to be implemented.

So if anyone else is reading this with a knack for linux and think they can help, please do :D

I myself will start working on SteamHandler interface. @joeknock90 don't expect anything soon as linux is still an unfamiliar ground for me, but at least the work has started...

@joeknock90
Copy link
Author

@FrogTheFrog

Nothing expected soon. My last 10 years of work have been bash and ansible as a sysadmin so I've basically forgotten everything else.

However, if there is assistance I can provide don't hesitate to reach out!

Thanks a bunch for putting some time into this!

@XenHat
Copy link

XenHat commented Jan 1, 2023

Consider me interested. I am taking a week off but when I am back, I'll be happy to help testing, at the very least. almost all my devices run Linux.
I don't have much experience interfacing with Linux directly, but I have several years of bash, C# and C++ under my belt. If I can help in any way, I'd be happy to.

@FrogTheFrog
Copy link
Owner

Consider me interested. I am taking a week off but when I am back, I'll be happy to help testing, at the very least. almost all my devices run Linux. I don't have much experience interfacing with Linux directly, but I have several years of bash, C# and C++ under my belt. If I can help in any way, I'd be happy to.

Then we are on the same boat :D. As I mentioned before, I found where Steam stores info about currently running games just like on Windows, so I can at least start implementing SteamHandler interface.

As for the others interfaces, I have no clue what to do at the moment. It still in the investigation phase. For example, do I need to handle resolution change? Maybe the sunshine actually does it when grabbing the screen? If not, how the hell do you resize desktop on Wayland?

I will create an issue for each interface so feel free to post any findings/suggestions there.

@joeknock90
Copy link
Author

Sunshine can handle resolution changes with pre and post scripts on Linux. For instance I have 2 separate entries for when I have my deck docked and on the TV, and for when I'm just carrying it around that uses xrandr to change resolution. (Still using X11)

On wayland I believe wlr-randr exists for the same purpose as xrandr

I wonder if you would be able to take the current resolution reported by the Steam Deck with something like wlr-randr, detect if the host machine is running X11 or Wayland, then use the appropriate tool to change resolution at runtime.

Just some thoughts.

@FrogTheFrog
Copy link
Owner

Ty, that was some good info. As for steamdeck, I already grab its resolution and there's an option to also select a custom resolution from the list 😉

@FrogTheFrog
Copy link
Owner

I have implemented a partial linux support.

The only thing that's missing is 2 functions:

  • to hide a cursor (don't know if that's even needed on linux)
  • to change the resolution

I have tested this on my crappy laptop with integrated intel GPU and these are some things I've noticed:

  • Steam's OLD big picture mode is crashing a lot for me when launching or closing games, or just at random (with or without stream)
  • Steam's NEW big picture mode does not work for me at all so I can't test it
  • Steam does not always detect that games have closed, so the Buddy does not detect it either (reproducible with https://store.steampowered.com/app/736260/Baba_Is_You/), however then the Steam Big Picture mode crashes after some time for whatever reason so it's a WIN WIN...

Until it is fully complete I will not provide builds. You can check the github workflows how to build it on linux.

I will now be taking a little break from further development as I'm feeling a little burnout and need to play some games :).

@joeknock90
Copy link
Author

I have implemented a partial linux support.

The only thing that's missing is 2 functions:

* to hide a cursor (don't know if that's even needed on linux)

* to change the resolution

I have tested this on my crappy laptop with integrated intel GPU and these are some things I've noticed:

* Steam's OLD big picture mode is crashing a lot for me when launching or closing games, or just at random (with or without stream)

* Steam's NEW big picture mode does not work for me at all so I can't test it

* Steam does not always detect that games have closed, so the Buddy does not detect it either (reproducible with https://store.steampowered.com/app/736260/Baba_Is_You/), however then the Steam Big Picture mode crashes after some time for whatever reason so it's a WIN WIN...

Until it is fully complete I will not provide builds. You can check the github workflows how to build it on linux.

I will now be taking a little break from further development as I'm feeling a little burnout and need to play some games :).

If you were physically close to me right now you'd have to fight my love off.

I'll build and test it out as well. Thank you for your hard work.

@FrogTheFrog
Copy link
Owner

I have implemented a partial linux support.
The only thing that's missing is 2 functions:

* to hide a cursor (don't know if that's even needed on linux)

* to change the resolution

I have tested this on my crappy laptop with integrated intel GPU and these are some things I've noticed:

* Steam's OLD big picture mode is crashing a lot for me when launching or closing games, or just at random (with or without stream)

* Steam's NEW big picture mode does not work for me at all so I can't test it

* Steam does not always detect that games have closed, so the Buddy does not detect it either (reproducible with https://store.steampowered.com/app/736260/Baba_Is_You/), however then the Steam Big Picture mode crashes after some time for whatever reason so it's a WIN WIN...

Until it is fully complete I will not provide builds. You can check the github workflows how to build it on linux.
I will now be taking a little break from further development as I'm feeling a little burnout and need to play some games :).

If you were physically close to me right now you'd have to fight my love off.

I'll build and test it out as well. Thank you for your hard work.

Heh 😁 Forgot to mention that I also had to fix a bug in Sunshine, so you must use the latest nightly (or compile it)

@joeknock90
Copy link
Author

joeknock90 commented Jan 21, 2023

NEAT

image

I was able to build it (in an ubuntu distrobox podman instance because I couldn't figure out dependencies on Arch. Oh well, what works works)

I had to restart my steam deck in order to get it to pair, and for some reason I also had to change the default port to something other than 59999. That's probably something I have configured somewhere though.

Still messing about with it. Couldn't get one thing to run but that's all I tried, so more to come.

Your speedy work is amazing. Thank you again for everything you've put into this. Enjoy some decompression time, I'm sure this wasn't easy.

Edit: Also yes I built and installed sunshine nightly.

@FrogTheFrog
Copy link
Owner

Be sure to enable debug logs 😉. I also semi hardcoded path to registry.vdf file, according to Valve that's ok. However if Steam is not detected that's where to look first. Maybe the path needs to change...

@joeknock90
Copy link
Author

Ooh Debug is helpful.

Yeah I'm almost 100% confident that the issue I'm having now purely sunshine and possibly mesa.

as far as I can tell, the buddy part is working great.

@FrogTheFrog
Copy link
Owner

Ooh Debug is helpful.

Yeah I'm almost 100% confident that the issue I'm having now purely sunshine and possibly mesa.

as far as I can tell, the buddy part is working great.

You can try to disable big picture mode, maybe it will help? Just comment out a few lines in Steam handler::launchSomething...

@XenHat
Copy link

XenHat commented Jan 22, 2023

Steam's NEW big picture mode does not work for me at all so I can't test it

I was able to get it working without hardware accelerated UI on my NVIDIA 3070 with the steam beta channel, if that's of any help.

I'll try compiling and testing the latest MoonDeckBuddy and Sunshine code later today!

EDIT: I'll have to wait for a Linux binary or more streamlined build steps because I can't get the repo to build. It wants a .pem key and that's my cue to give up.
I'll check again in a week or so, enjoy your time off!

@FrogTheFrog
Copy link
Owner

Steam's NEW big picture mode does not work for me at all so I can't test it

I was able to get it working without hardware accelerated UI on my NVIDIA 3070 with the steam beta channel, if that's of any help.

I'll try compiling and testing the latest MoonDeckBuddy and Sunshine code later today!

EDIT: I'll have to wait for a Linux binary or more streamlined build steps because I can't get the repo to build. It wants a .pem key and that's my cue to give up. I'll check again in a week or so, enjoy your time off!

Make sure to fully checkout the submodules with git submodule update --init.

@XenHat
Copy link

XenHat commented Jan 24, 2023

Oh thank you so much! I always forget this part. 😓

@XenHat
Copy link

XenHat commented Jan 24, 2023

This works pretty well!
https://youtu.be/XGE71bP8U9M

There's a minor glitch with an error page being overlaid transparently over the game when a notification pops up but at first blush this is good!

@FrogTheFrog
Copy link
Owner

There's a minor glitch with an error page being overlaid transparently over the game when a notification pops up but at first blush this is good!

I think you're talking about this: OMGDuke/protondb-decky#46

@FrogTheFrog
Copy link
Owner

FrogTheFrog commented Jan 27, 2023

So I have finished porting what I could and here's a short summary:

  • Due to a 1 letter typo (Apps vs apps), the detection algorithm was working at 1/3 the capacity on linux :D. Fixed now.
  • Buddy will now terminate the app if Steam crashes and does not kill it (linux only).
  • X11 resolution change support has been enabled (MoonDeck 1.5.2 is highly recommended for this to work properly).
  • Wayland resolution change support has been postponed. Got halfway there only to realize the protocol is currently supported on 1 compositor only... https://wayland.app/protocols/wlr-output-management-unstable-v1
  • Cursor hiding API was not implemented as I could not replicate the "I will not go away" problem I had on Windows.
  • No binary packaging for now as it is the most sanity draining task ever, especially when it is done by CMake... A PR would be very much appreciated for this.

All of this will apply as soon as #21 is closed.

@joeknock90
Copy link
Author

Ok, so just built and tested, and.... wow. Wow dude. I can't believe how fast you did that.

@FrogTheFrog
Copy link
Owner

Ok, so just built and tested, and.... wow. Wow dude. I can't believe how fast you did that.

I thought it was gonna be fun playing with Wayland, boy was I wrong. It's a dreaded callback hell in C++ with an awkward tree like structure with back references...

At that point I just wanted to get this done no matter the cost and forget about :D. Thanks to the HW acceleration tip from @XenHat , I at least managed to get Steam stable with the new beta update...

Enough ranting, I'm off to actually play games!

@hjpaul7
Copy link

hjpaul7 commented Feb 25, 2023

I feel like I'm really close..

Was able to build it, and I run MoonDeckStream from /build/src/stream and then MoonDeckBuddy from /build/src/buddy. Paired it with my deck, but when I launch a game from MoonDeckBuddy - it launches the game on my host PC but on the deck it says "Failed to find application MoonDeckStream".

Am I missing anything?

@FrogTheFrog
Copy link
Owner

I feel like I'm really close..

Was able to build it, and I run MoonDeckStream from /build/src/stream and then MoonDeckBuddy from /build/src/buddy. Paired it with my deck, but when I launch a game from MoonDeckBuddy - it launches the game on my host PC but on the deck it says "Failed to find application MoonDeckStream".

Am I missing anything?

You don't need to run MoonDeckStream, but add it to Sunshine like this: https://github.com/FrogTheFrog/moondeck-buddy/wiki/Sunshine-setup

@hjpaul7
Copy link

hjpaul7 commented Feb 25, 2023

I feel like I'm really close..
Was able to build it, and I run MoonDeckStream from /build/src/stream and then MoonDeckBuddy from /build/src/buddy. Paired it with my deck, but when I launch a game from MoonDeckBuddy - it launches the game on my host PC but on the deck it says "Failed to find application MoonDeckStream".
Am I missing anything?

You don't need to run MoonDeckStream, but add it to Sunshine like this: https://github.com/FrogTheFrog/moondeck-buddy/wiki/Sunshine-setup

Worked! Thank you, so badass

@FabianZettl
Copy link

Hey guys, I want to get Moondeck running with my Nobara Desktop as a host.
Any quick tutorial on how to build this? Never done it myself.

@hjpaul7
Copy link

hjpaul7 commented May 16, 2023

Hey guys, I want to get Moondeck running with my Nobara Desktop as a host. Any quick tutorial on how to build this? Never done it myself.

@FabianZettl there are the commands I ran to build it:

git submodule update --init
cmake -D CMAKE_C_COMPILER=/usr/bin/clang -D CMAKE_CXX_COMPILER=/usr/bin/clang++ -B build -G Ninja
cmake --build build
cmake install build
cd build
cd src/buddy
./MoonDeckBuddy

Edit: @FrogTheFrog since we have a Linux build now, could we include that in the release?

@XenHat
Copy link

XenHat commented May 19, 2023

Doesn't nobara use Wayland by default? Try Xorg.

@XenHat
Copy link

XenHat commented May 19, 2023

Hey guys, I want to get Moondeck running with my Nobara Desktop as a host. Any quick tutorial on how to build this? Never done it myself.

@FabianZettl there are the commands I ran to build it:

git submodule update --init
cmake -D CMAKE_C_COMPILER=/usr/bin/clang -D CMAKE_CXX_COMPILER=/usr/bin/clang++ -B build -G Ninja
cmake --build build
cmake install build
cd build
cd src/buddy
./MoonDeckBuddy

Edit: @FrogTheFrog since we have a Linux build now, could we include that in the release?

A PR would be welcome for configuring this CMakeLists.txt file to package all the necessary binaries and whatnot, 'cause I have no experience with it yet on Linux :/. I'm just too lazy to spent hours playing around and hoping someone knowledgeable would come around :D

This is what i've been using so far:

❯ cat build.sh
#!/bin/sh
sudo pacman -S --needed qt6-httpserver
cmake -DENABLE_CLANG_TIDY=False -DCMAKE_BUILD_TYPE:STRING=Release -B build -G Ninja
#sed -i 's/-mno-direct-extern-access//g' build/build.ninja
cmake --build build -j

I unfortunately have no experience dealing with CMake's native packaging utilities so I can't currently help there.

@hjpaul7
Copy link

hjpaul7 commented May 29, 2023

Hey guys, I want to get Moondeck running with my Nobara Desktop as a host. Any quick tutorial on how to build this? Never done it myself.

@FabianZettl there are the commands I ran to build it:

git submodule update --init
cmake -D CMAKE_C_COMPILER=/usr/bin/clang -D CMAKE_CXX_COMPILER=/usr/bin/clang++ -B build -G Ninja
cmake --build build
cmake install build
cd build
cd src/buddy
./MoonDeckBuddy

Edit: @FrogTheFrog since we have a Linux build now, could we include that in the release?

A PR would be welcome for configuring this CMakeLists.txt file to package all the necessary binaries and whatnot, 'cause I have no experience with it yet on Linux :/. I'm just too lazy to spent hours playing around and hoping someone knowledgeable would come around :D

Sorry I got busy and didn't see this 🙃

I can make a PR later today, should I attach a tar here as well with the binaries?

@FrogTheFrog
Copy link
Owner

Hey guys, I want to get Moondeck running with my Nobara Desktop as a host. Any quick tutorial on how to build this? Never done it myself.

@FabianZettl there are the commands I ran to build it:

git submodule update --init
cmake -D CMAKE_C_COMPILER=/usr/bin/clang -D CMAKE_CXX_COMPILER=/usr/bin/clang++ -B build -G Ninja
cmake --build build
cmake install build
cd build
cd src/buddy
./MoonDeckBuddy

Edit: @FrogTheFrog since we have a Linux build now, could we include that in the release?

A PR would be welcome for configuring this CMakeLists.txt file to package all the necessary binaries and whatnot, 'cause I have no experience with it yet on Linux :/. I'm just too lazy to spent hours playing around and hoping someone knowledgeable would come around :D

Sorry I got busy and didn't see this upside_down_face

I can make a PR later today, should I attach a tar here as well with the binaries?

Once you get CMake to package binaries correctly, please modify the github workflow a little, so that the binaries are uploaded like in Windows

@XenHat
Copy link

XenHat commented May 29, 2023

Once you get CMake to package binaries correctly, please modify the github workflow a little, so that the binaries are uploaded like in Windows

I tried doing this on my fork (because I wanted to turn off big picture, and build it using the provided workflow), and I ran into errors using the method Windows uses to generate the "installer", see https://github.com/XenHat/moondeck-buddy/blob/a4f263a1e3b8abbb5fe37c983813c87e4afeb131/CMakeLists.txt#L134

Hopefully this can be solved, as I failed to do so. Feel free to use anything in there.

@FabianZettl
Copy link

Any news here on a linux support for the buddy?

@FrogTheFrog
Copy link
Owner

Any news here on a linux support for the buddy?

It's supported, you just need to build it yourself for now. You can use GitHub workflow as an example

@FrogTheFrog FrogTheFrog mentioned this issue Jun 25, 2023
3 tasks
@FrogTheFrog
Copy link
Owner

It seems that new Steam update broke the legacy support and Valve no longer updates the registry.vdf file :/ Can anyone confirm that the Buddy has stopped working?

@XenHat
Copy link

XenHat commented Jun 25, 2023 via email

@FrogTheFrog
Copy link
Owner

@XenHat it seems to be related to this ValveSoftware/steam-for-linux#9672.

Time for a workaround I guess...

@FrogTheFrog
Copy link
Owner

Github plz

@FrogTheFrog FrogTheFrog reopened this Jun 25, 2023
@XenHat
Copy link

XenHat commented Jun 25, 2023 via email

@hjpaul7
Copy link

hjpaul7 commented Jun 25, 2023

You were able to workaround it?

@FrogTheFrog
Copy link
Owner

You were able to workaround it?

Yes. I'm watching child processes under Steam now. The relevant ones contain the AppId in the process' cmdline (linux only).

If that changes in the future, I have yet another possible workaround that should work on any OS, but is more complicated...

@FrogTheFrog
Copy link
Owner

@hustin-paul @XenHat and others, please test out this AppImage build if you have time:
https://github.com/FrogTheFrog/moondeck-buddy/actions/runs/5380998997

I have updated the Wiki on how to use this.

If there are no issues or no one responds :D, I will merge the PR in a few days.

@hjpaul7
Copy link

hjpaul7 commented Jun 26, 2023

I'll test here in about an hour

Edit: Moonlight package broken in AUR, trying to fix

@hjpaul7
Copy link

hjpaul7 commented Jun 27, 2023

@FrogTheFrog

I'm not able to get it working properly. After running:

./MoonDeckBuddy --exec MoonDeckBuddy

and then adding same command but for MoonDeckStream in sunshine. Launch MoonDeckBuddy on steam deck -> PC resolution will change and Moonlight on deck returns "GeForce Experience returned error: Failed to start the specified application (Error 0)" and crashes.

Decided to test a bit and ran the command for MoonDeckStream outside of Sunshine:

./MoonDeckBuddy --exec MoonDeckStream

and launched from Deck, and it opened the game on the PC but then crashes on deck.

Edit: Launching straight from Moonlight on deck is working however.

Double Edit lol:

Looks like libprocps was needed. Installed that, checked out to your linux-deploy branch and built Buddy/Stream as before, and now it's working fine :)

@FrogTheFrog
Copy link
Owner

@hustin-paul Sorry, I don't get it. You said you build it yourself, what about the AppImage file? libprocps is included in there. Is it working or not?

@hjpaul7
Copy link

hjpaul7 commented Jun 27, 2023

The app image did not work for me, but building it did.

@FrogTheFrog
Copy link
Owner

The app image did not work for me, but building it did.

Can you test the AppImage again and check if the logs contain anything? Including the Sunshine log.

@FabianZettl
Copy link

FabianZettl commented Jun 27, 2023

Tried the appimage and everything worked great immediately, played Dead Cells and Crisis Core via Moondeck this morning ;)

EndeavourOS with RTX3060 on desktop.

@XenHat
Copy link

XenHat commented Jun 27, 2023

Is it not possible to use fuse3?

❯ ./MoonDeckBuddy-af16e4e-x86_64.AppImage
dlopen(): error loading libfuse.so.2

❯ yay -Q | grep fuse  
confuse 3.3-3
fuse-common 3.14.1-1
fuse3 3.14.1-1
kio-fuse 5.0.1-1
python-defusedxml 0.7.1-5

Installing fuse2 works, however

@FrogTheFrog
Copy link
Owner

@XenHat Nope, we are stuck in the past for now :/
AppImage/AppImageKit#1120

@XenHat
Copy link

XenHat commented Jun 27, 2023

So far the AppImage runs, but it timed out and disconnected me from the working session while steam was updating.. so I'll report in a few, haha.

@XenHat
Copy link

XenHat commented Jun 27, 2023

@FrogTheFrog Works great on X11! I'll test on wayland some time later. I have to fix my wifi now... 🧰

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