From 493b0aab4d00dfba7efd7cfa6796baa2b1a7924b Mon Sep 17 00:00:00 2001 From: Marco Cawthorne Date: Sat, 21 May 2022 13:55:52 -0700 Subject: [PATCH] Initial commit --- compatibilitytool.vdf | 13 +++++++++++++ toolmanifest.vdf | 7 +++++++ wrapper | 24 ++++++++++++++++++++++++ 3 files changed, 44 insertions(+) create mode 100644 compatibilitytool.vdf create mode 100644 toolmanifest.vdf create mode 100755 wrapper diff --git a/compatibilitytool.vdf b/compatibilitytool.vdf new file mode 100644 index 0000000..dcfcb31 --- /dev/null +++ b/compatibilitytool.vdf @@ -0,0 +1,13 @@ +"compatibilitytools" +{ + "compat_tools" + { + "custom-tool" // Internal name of this tool + { + "install_path" "." + "display_name" "SteamPlay Custom" + "from_oslist" "windows" + "to_oslist" "linux" + } + } +} diff --git a/toolmanifest.vdf b/toolmanifest.vdf new file mode 100644 index 0000000..05a94c3 --- /dev/null +++ b/toolmanifest.vdf @@ -0,0 +1,7 @@ +"manifest" +{ + "commandline" "/wrapper run" + "commandline_waitforexitandrun" "/wrapper wait-before-run" + "commandline_getnativepath" "/wrapper get-native-path" + "commandline_getcompatpath" "/wrapper get-compat-path" +} diff --git a/wrapper b/wrapper new file mode 100755 index 0000000..0706023 --- /dev/null +++ b/wrapper @@ -0,0 +1,24 @@ +#!/bin/sh + +SPC_CFG="$HOME/.config/steamcustomrc" +COMMANDTYPE=$1 + +if [ "$COMMANDTYPE" = "wait-before-run" ]; then + # env check + STEAM_APPID="$SteamGameId" + + # find something valid, first result only + CHECK_GAME=$(grep "$STEAM_APPID:" "$SPC_CFG" | head -n 1) + + # nothing found? throw a message... + if [ -z "$CHECK_GAME" ]; then + notify-send -a "SteamPlay-Custom" \ + -i "steam" "SteamPlay-Custom" \ + "AppID $STEAM_APPID has no entry in $SPC_CFG" + exit + fi + + # run our alternative + RUN_GAME=$(echo "$CHECK_GAME" | cut -d ':' -f 2) + exec $RUN_GAME +fi