Skip to content

Instantly share code, notes, and snippets.

@evg-zhabotinsky
Created December 23, 2021 16:59
Show Gist options
  • 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

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