Error on executing Steam Play game via command-line (Proton)
Solution 1:
Here's an experiment that may help you get the answer. For convenience, I'll refer to your default Steam library location as $STEAM
(the default is ~/.local/share/Steam/
). Proton is installed by default to $STEAM/steamapps/common/Proton 3.7
, I'll call this $PROTON
.
So, when I tried running The Witcher, Steam ran this command:
"$PROTON/dist/bin/wine-preloader" "$PROTON/dist/bin/wine" "Z:\$STEAM\steamapps\common\The Witcher Enhanced Edition\System\witcher.exe"
Where $STEAM
has backslashes instead of slashes, as it's a Windows path. In addition, it set something like 70 environment variables (related to Wine, Steam, various hardware/drivers, libraries, etc.). A single variable, WINESERVERSOCKET
referred to the wine server started for this instance. If I omitted this variable and used all the rest, I could start the game from the command line.
Steps:
-
Replace
$PROTON/dist/bin/wine-preloader
with a wrapper script that saves the environment somewhere:PROTON="$HOME/.local/share/Steam/steamapps/common/Proton 3.7" # adjust to your settings mv "$PROTON/dist/bin/wine-preloader" "$PROTON/dist/bin/wine-preloader-orig" printf "%s\n" '#! /bin/sh' 'env --null | grep -vz WINESERVERSOCKET > ~/env' > "$PROTON/dist/bin/wine-preloader" printf 'exec %q "$@"\n' "$PROTON/dist/bin/wine-preloader-orig" >> "$PROTON/dist/bin/wine-preloader" chmod +x "$PROTON/dist/bin/wine-preloader"
The script is essentially this:
#! /bin/sh env --null | grep -vz WINESERVERSOCKET= > ~/env printf "%s\0" "$0"-orig "$@" > ~/cmd exec /home/user/.local/share/Steam/steamapps/common/Proton\ 3.7/dist/bin/wine-preloader-orig "$@"
It saves the environment, except for
WINESERVERSOCKET
, in~/env
, the command to run and arguments in~/cmd
and runs the actual file with the arguments provided. It uses ASCII null characters to separate everything, since the actual environment variables may contain newlines.Note that I save the command with
-orig
added for convenience. Run the game from the Steam GUI. The wrapper script will create these files.
-
You can load the environment and run the command from these files. In bash
mapfile -d '' -t env < ~/env mapfile -d '' -t cmd < ~/cmd env "${env[@]}" "${cmd[@]}"
-d ''
here tells bash the files use the ASCII null character as delimiter.
This much was sufficient for The Witcher to run for me. All of those environment variables probably won't be necessary. I leave it to you to test which aren't.
Of course, all of these might be completely unnecessary. Looking at Steam's command-line options, we have:
-applaunch <appID> [launch parameters] Launches an Game or Application through Steam.
And when I ran:
steam -applaunch 20900 foo bar
the Wine command was:
"$PROTON/dist/bin/wine" "Z:\$STEAM\steamapps\common\The Witcher Enhanced Edition\System\witcher.exe" foo bar
So Steam did pass on foo
and bar
as arguments to the game. This might be all you need.