Skip to content

Instantly share code, notes, and snippets.

@evg-zhabotinsky
Created December 23, 2021 16:59
Show Gist options
  • Star 2 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save evg-zhabotinsky/cd54c8d8bf3803599d3b33cc56e6fbc0 to your computer and use it in GitHub Desktop.
Save evg-zhabotinsky/cd54c8d8bf3803599d3b33cc56e6fbc0 to your computer and use it in GitHub Desktop.
Steam "Pressure Vessel"-based runtime disabler
#!/bin/bash
# Steam "Pressure Vessel" runtime eliminator.
#
# Valve ships various pre-packaged runtime environments for games to use.
# They are cool, in a way: Most games "just work" with them.
# However, such convenience comes at the cost of performance and sometimes reliability.
#
# Normally, I disable any and all such runtimes and install all the required dependencies myself.
# However, running Windows games using Proton enforces use of a runtime.
# That runtime is shipped in a "Pressure Vessel" container, which is more isolated.
# The worst part is, user-supplied LD_PRELOAD and LD_LIBRARY_PATH are ignored due to that.
# That means no primusrun/pvkrun/whatever for Windows games, which sucks.
#
# This little script's purpose is to cut "Pressure Vessel" out of game's command line.
# Be warned that that gives you the ability *and responsibility* to manage the dependencies.
# Place pressure-vent.sh after all " -- " in game's launch options, if any.
# Placing e.g. "xterm -e" at the start of launch options is an easy way to see logs.
# Examples:
# primusrun ~/pressure-vent.sh %command%
# xterm -e /full/path/to/pressure-vent.sh pvkrun %command%
# Functions
cmdprn() {
printf '%s:\n%q' "$1" "$2"
printf ' %q' "${@:3}"
printf '\n\n'
}
err() {
printf '%s\nPress Enter to quit.\n' "$1"
read
exit 1
}
# Debug
cmdprn "Original command line" "$@"
printf "LD_PRELOAD:\n%q\n\n" "$LD_PRELOAD"
printf "LD_LIBRARY_PATH:\n%q\n\n" "$LD_LIBRARY_PATH"
# Find Pressure Vessel arguments (between two first "--")
((left=1))
while [[ left -le $# && "${!left}" != "--" ]]; do
((left++))
done
((right=left+1))
while [[ right -le $# && "${!right}" != "--" ]]; do
((right++))
done
[[ right -gt $# ]] && err 'Error processing command line.'
# Cut them out
set -- "${@:1:left}" "${@:right+1}"
cmdprn "Processed command line" "$@" # Debug
"$@" || err "Game terminated with code $?."
# Comment out if it actually waits for Enter and you don't like it
printf 'Finished without error. Press Enter to quit.\n' && read
@ayunami2000
Copy link

Is there a way to get SteamVR to recognize the game as something other than wine64-preloader using this script?

@evg-zhabotinsky
Copy link
Author

evg-zhabotinsky commented Aug 27, 2022

@ayunami2000 I'll make a wild guess that's what Discord shows in "playing a game" status for you. Is this correct?

I did some poking around, and it seems Discord takes some name from the inner-most process it can find running undes Steam. So, for me it first shows pressure-vent, then proton, then wine-preloader, and then the name of the game when it finishes launching. The thing is, some Windows apps/games (e.g. Battle.net launcher) don't override their own name, and under Wine Discord keeps seeing them as wine-preloader. Under Windows I'd expect them to show up as game_binary.exe or something like that.

I don't think anything simple can be done about it, patching Wine is probably the only "practical" solution. This script has nothing to do with the problem.

@ayunami2000
Copy link

Nope, it's not Discord, it's SteamVR that has the issue. I did do some research and I did see that Discord does it as well, but specifically SteamVR is doing it when this script is used. It seems to cause VR apps to not be shown in the VR headset, but they do in fact pick up the inputs from the headset and controllers.

@evg-zhabotinsky
Copy link
Author

evg-zhabotinsky commented Aug 27, 2022

Oh. Then I have no idea what's going on. VR doesn't work on any of my Linux systems.

Are you trying to run a Windows VR game through Proton? Or does SteamVR itself force the use of a pressure-vessel runtime that you are trying to avoid? Sorry, dumb question, wine-preloader implies a Windows game.

@evg-zhabotinsky
Copy link
Author

@ayunami2000 I suggest trying to put exec at the start of line 54.

That way this script will be replaced with the command it launches, instead of starting a new process for it and hanging between that process and Steam in the process tree.

@ayunami2000
Copy link

Check the entry for the game on ProtonDB: https://www.protondb.com/app/438100

I just need SteamVR to properly recognize the game, and it should work.

@evg-zhabotinsky
Copy link
Author

@ayunami2000 The only suggestions I have is exec at line 54 in this script, or not using this script and letting the game use the containerized runtime. If it doesn't work even without this script, I have no idea what the problem could be, the internets say "it should just work".

@evg-zhabotinsky
Copy link
Author

evg-zhabotinsky commented Aug 27, 2022

Also, some comments say only "Proton-experimental" works in VR with the recently introduced anticheat.

@ayunami2000
Copy link

Also, some comments say only "Proton-experimental" works in VR with the recently introduced anticheat.

I used proton-experimental. I'll give the exec trick a try to see if it works when I get a chance. Thanks for the quick response!

@ayunami2000
Copy link

@ayunami2000 The only suggestions I have is exec at line 54 in this script, or not using this script and letting the game use the containerized runtime. If it doesn't work even without this script, I have no idea what the problem could be, the internets say "it should just work".

It doesn't work without the script for other reasons; namely, the bubblewrap process requires capabilities that my system cannot provide to the processes, so it doesn't work at all without removing pressure-vessel altogether. I've also tried to create a "fake" bubblewrap binary for it, but with no success so far.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment