Using winecfg or regedit on a Proton game prefix

July 19, 2019 - Reading time: 4 minutes

Using WINE directly from terminal on your Proton games prefix is kinda tricky (or shitty, it depends..). Using Proton is kinda the same story, here is a much simpler way of manipulating Proton prefix from terminal (originally posted here).

Create a script somewhere and make it executable:

#!/bin/bash

STEAMROOT="$HOME/.steam"
protVer=$1
gameID=$2
progZ=$3

if [ -d "$STEAMROOT/steam/steamapps/common/Proton $protVer/" ] 
then
    echo "Proton $protVer exists." 
else
    echo "Error: Proton $protVer does not exists."
    exit
fi

if [ -d "$STEAMROOT/steam/steamapps/compatdata/$gameID/pfx/" ] 
then
    echo "Game $gameID exists." 
else
    echo "Error: Game $gameID doesn't seem to be installed with Proton."
    exit
fi

if [[ ! $progZ =~ ^(winecfg|regedit)$ ]]; then
    echo "Error: invalid third parameter"
    echo "Accepted values are 'winecfg' or 'regedit'"
else
    echo "Executing wine $progZ on $STEAMROOT/steam/steamapps/compatdata/$gameID/pfx/"
    export PATH="$STEAMROOT/steam/steamapps/common/Proton $protVer/dist/bin/:$STEAMROOT/ubuntu12_32/steam-runtime/amd64/bin:$STEAMROOT/ubuntu12_32/steam-runtime/amd64/usr/bin:$PATH"
    export WINEDEBUG="-all"
    export WINEDLLPATH="$STEAMROOT/steam/steamapps/common/Proton $protVer/dist/lib64/wine:$STEAMROOT/steam/steamapps/common/Proton $protVer/dist/lib/wine"
    export LD_LIBRARY_PATH="$STEAMROOT/steam/steamapps/common/Proton $protVer/dist/lib64:$STEAMROOT/steam/steamapps/common/Proton $protVer/dist/lib:$STEAMROOT/ubuntu12_32/steam-runtime/pinned_libs_32:$STEAMROOT/ubuntu12_32/steam-runtime/pinned_libs_64:/usr/lib/x86_64-linux-gnu/libfakeroot:/lib/i386-linux-gnu:/usr/lib/i386-linux-gnu:/usr/local/lib:/lib/x86_64-linux-gnu:/usr/lib/x86_64-linux-gnu:/lib:/usr/lib:/usr/lib/i386-linux-gnu/i686:/usr/lib/i386-linux-gnu/sse2:/usr/lib/i386-linux-gnu/i686/sse2:$STEAMROOT/ubuntu12_32/steam-runtime/i386/lib/i386-linux-gnu:$STEAMROOT/ubuntu12_32/steam-runtime/i386/lib:$STEAMROOT/ubuntu12_32/steam-runtime/i386/usr/lib/i386-linux-gnu:$STEAMROOT/ubuntu12_32/steam-runtime/i386/usr/lib:$STEAMROOT/ubuntu12_32/steam-runtime/amd64/lib/x86_64-linux-gnu:$STEAMROOT/ubuntu12_32/steam-runtime/amd64/lib:$STEAMROOT/ubuntu12_32/steam-runtime/amd64/usr/lib/x86_64-linux-gnu:$STEAMROOT/ubuntu12_32/steam-runtime/amd64/usr/lib:"
    export WINEDLLOVERRIDES="d3d11=n;dxgi=n"
    WINEPREFIX=$STEAMROOT/steam/steamapps/compatdata/$gameID/pfx/ wine $progZ
fi

Then simply call the script with the current or wanted (if installed of course) Proton version as found in ~/.local/share/Steam/steamapps/common/Proton 4.2/ in this example it is 4.2, and the Proton game Steam AppID as found in ~/.local/share/Steam/steamapps/compatdata/, for example here Killing Floor 2 has an AppID of 232090, and the third parameter will be winecfg or regedit depending on what you want to do.

./protoncfg.sh 4.2 232090 regedit

This script was useful to fix the annoying issue that occurs on Killing Floor 2 which reinstalls DotNet Framework every time you start the game, see this in more details here.

On an unrelated side note, copying/pasting this script from a web browser can create issues when executing it because of the carriage return character at the end of lines.

/bin/bash^M: bad interpreter: No such file or directory
syntax error near unexpected token `fi'
and so on...

To fix this issue simply run this command on the script file:

sed -i -e 's/\r$//' protoncfg.sh

On another unrelated note here is proton-exec https://gitlab.com/SparrowOchon/proton-exec a script to run multiple executable files under same prefix.