FrogTheFrog / moondeck-buddy

A server-side part of the MoonDeck plugin for the SteamDeck.
GNU Lesser General Public License v3.0
151 stars 9 forks source link

[Feature Request] Preserve Sunshine environment variables #85

Closed xTeixeira closed 3 months ago

xTeixeira commented 3 months ago
All commands get these environment variables by default from Sunshine: Var Name  
SUNSHINE_APP_ID App ID
SUNSHINE_APP_NAME App Name
SUNSHINE_CLIENT_WIDTH The Width requested by the client (int)
SUNSHINE_CLIENT_HEIGHT The Height requested by the client (int)
SUNSHINE_CLIENT_FPS The FPS requested by the client (int)
SUNSHINE_CLIENT_HDR HDR is enabled by the client (true/false)
SUNSHINE_CLIENT_GCMAP The requested gamepad mask, in a bitset/bitfield format (int)
SUNSHINE_CLIENT_HOST_AUDIO The client has requested host audio (true/false)
SUNSHINE_CLIENT_ENABLE_SOPS The client has requested the option to optimize the game for optimal streaming (true/false)
SUNSHINE_CLIENT_AUDIO_CONFIGURATION The Audio Configuration requested by the client (2.0/5.1/7.1)

When running through moondeck-buddy, Steam (or whatever is being launched) doesn't get these variables since it is launched by moondeck-buddy, not Sunshine.

It could be useful to have these available for use along with steam_binary_override and custom Steam launch scripts.

Particularly I would like to have SUNSHINE_CLIENT_WIDTH and SUNSHINE_CLIENT_HEIGHT in order to run Steam under gamescope and set the correct resolution for gamescope through command line options.

FrogTheFrog commented 3 months ago

It's impossible to change the ENV for a running process without nasty hacks as far as I know.

The current implementation invokes the binary, however this doesn't really do anything if the Steam is already running apart from telling the running instance which app to run.

I don't really know how to even approach this request 🤔

xTeixeira commented 3 months ago

Ah I see, that makes sense.

For my setup I pretty much need Steam to NOT be already running when starting a stream, because I need to pass the correct resolution to gamescope when starting it (and the resolution might change depending on whether I'm playing on an external screen or not). And AFAIK running Steam under gamescope is currently the only way to stream in HDR from a Linux host...

Anyway, I'm currently accomplishing what I need by having a script run by Sunshine as a command preparation and saving the environment to a .env file which gets sourced by my custom steam launch script, and I see this feature wouldn't be very useful for any situation where Steam is already running when a stream starts, so probably no need to implement this after all.