Skip to content

Instantly share code, notes, and snippets.

@Corben78
Last active February 7, 2021 18:14
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Corben78/72a6a3770a4a71b05813bd1ddc14cd36 to your computer and use it in GitHub Desktop.
Save Corben78/72a6a3770a4a71b05813bd1ddc14cd36 to your computer and use it in GitHub Desktop.
Adjust MangoHud json config file for Proton use on Ubuntu, when MangoHud is installed from git.
#!/bin/bash
MANGOHUDJSON=${MANGOHUDJSON:-/usr/share/vulkan/implicit_layer.d/MangoHud.json}
MPATH=$(dirname "$MANGOHUDJSON")
MFILE=$(basename "$MANGOHUDJSON" .json)
MANGOHUD32="$MPATH"/"$MFILE"32.json
if [ ! -e "$MANGOHUDJSON" ]; then
echo "$MANGOHUDJSON file not found"
exit 1
fi
is32bit_created=false
isLIB_replaced=false
function ismodded() {
[ -e "$MANGOHUD32" ] && is32bit_created=true
REPLACED=$(grep \$LIB "$MANGOHUDJSON")
[ -z "$REPLACED" ] && isLIB_replaced=true
}
case $1 in
do)
ismodded
if $is32bit_created; then
echo 32 bit config already created. skipping
else
echo creating 32 bit config
sudo cp "$MANGOHUDJSON" "$MANGOHUD32"
echo replacing layer name for 32 bit
sudo sed -i 's/VK_LAYER_MANGOHUD_overlay/VK_LAYER_MANGOHUD_overlay_32/' "$MANGOHUD32"
echo replacing \$LIB for 32 bit
sudo sed -i 's#\\$LIB#lib/i386-linux-gnu#' "$MANGOHUD32"
fi
if $isLIB_replaced; then
echo \$LIB already replaced, skipping
else
echo replacing \$LIB for 64 bit
sudo sed -i 's#\\$LIB#lib/x86_64-linux-gnu#' "$MANGOHUDJSON"
fi
;;
undo)
echo removing 32 bit config
sudo rm "$MANGOHUD32"
echo reverting replacement for 64 bit
sudo sed -i 's#lib/x86_64-linux-gnu#\\$LIB#' "$MANGOHUDJSON"
;;
*)
echo "Post-Process MangoHud config for 64 and 32 Bit"
echo "usage: $0 do - adjust config files"
echo " $0 undo - revert changes"
esac
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment