ValveSoftware / steam-runtime

A runtime environment for Steam applications
Other
1.18k stars 86 forks source link

Passing game args through pressure-vessel-wrap when running through runtime? #652

Closed Espionage724 closed 7 months ago

Espionage724 commented 7 months ago

I downloaded Dota 2 and Sniper runtime with steamcmd and can run it like this:

~/'Steam/steamapps/common/SteamLinuxRuntime_sniper/run' ~/'Steam/steamapps/common/dota 2 beta/game/dota.sh'

If I add -novid to that, I get:

pressure-vessel-wrap[14540]: E: Unknown option -novid

Is there a way to pass game-specific arguments when running like that? Or is there a a better way to go about it perhaps?

smcv commented 7 months ago
~/'Steam/steamapps/common/SteamLinuxRuntime_sniper/run' ~/'Steam/steamapps/common/dota 2 beta/game/dota.sh'

As far as I'm aware, this is not considered to be a supported way to run Dota 2; the supported way to run Dota 2 is via the Steam client. Anything other than that is subject to change and might stop working at any time. You can set up different command-lines if you want to, at your own risk, but it is unsupported.

Is there a way to pass game-specific arguments when running like that?

As you've seen, the container runtime framework normally assumes that options starting with - are intended for it, not for the game. However, it uses the same -- pseudo-argument seen in most GNU tools to tell the command-line parser where to stop, so this should work:

~/'Steam/steamapps/common/SteamLinuxRuntime_sniper/run' -- ~/'Steam/steamapps/common/dota 2 beta/game/dota.sh' -novid

Most of the Steam-adjacent tools that wrap another command allow -- for this purpose.

The way it is actually run by the Steam client is more like this, as you will see if you run Steam from a terminal and watch what it outputs on stdout/stderr while launching Dota 2:

~/'Steam/steamapps/common/SteamLinuxRuntime_sniper/_v2-entry-point' --verb=waitforexitandrun -- ~/'Steam/steamapps/common/dota 2 beta/game/dota.sh'

Because this uses the same -- pseudo-argument, it allows extra options to be appended. For example if you put -novid in the Steam client's Properties -> Launch Options, the resulting command-line ends with:

~/'Steam/steamapps/common/SteamLinuxRuntime_sniper/_v2-entry-point' --verb=waitforexitandrun -- ~/'Steam/steamapps/common/dota 2 beta/game/dota.sh' -novid

_v2-entry-point is the entry point to the container runtime framework that is used by Steam (hence its API-versioned name), and run is an implementation detail. Compared with the run script, _v2-entry-point adds logging, environment variable management, and a mechanism that game developers can use to insert debugging commands into a running container.

Or is there a a better way to go about it perhaps?

As far as I'm aware, the only officially supported way to run Dota 2 or any other Steam game is via the Steam client. If you are setting up your own custom command-lines, the more closely you stick to what the Steam client does, the more likely it is to work.

Espionage724 commented 7 months ago

Thank you for all the info! The double-dash -- works fine