diff --git a/data_from_portwine/scripts/add_in_steam.sh b/data_from_portwine/scripts/add_in_steam.sh index 34793b9..9478826 100755 --- a/data_from_portwine/scripts/add_in_steam.sh +++ b/data_from_portwine/scripts/add_in_steam.sh @@ -153,7 +153,8 @@ getSteamGridDBId() { } getUserIds() { - SLUF="${HOME}/.local/share/Steam/config/loginusers.vdf" + [[ -z "${STEAM_BASE_FOLDER}" ]] && STEAM_BASE_FOLDER="$(getSteamPath)" + SLUF="${STEAM_BASE_FOLDER}/config/loginusers.vdf" if [[ -f "${SLUF}" ]]; then STUIDS=() while read -r line; do @@ -168,7 +169,8 @@ getUserIds() { } getUserId() { - SLUF="${HOME}/.local/share/Steam/config/loginusers.vdf" + [[ -z "${STEAM_BASE_FOLDER}" ]] && STEAM_BASE_FOLDER="$(getSteamPath)" + SLUF="${STEAM_BASE_FOLDER}/config/loginusers.vdf" if [[ -f "${SLUF}" ]]; then SLUFUB=false STUID="" @@ -196,17 +198,33 @@ getUserPath() { STUID="$(getUserId)" fi if [ -n "${STUID}" ]; then - STUIDPATH="${HOME}/.local/share/Steam/userdata/${STUID}" - if [[ -d "${STUIDPATH}" ]]; then - if [[ -f "${STUIDPATH}/config/shortcuts.vdf" ]]; then - echo "${STUIDPATH}/config" - fi + [[ -z "${STEAM_BASE_FOLDER}" ]] && STEAM_BASE_FOLDER="$(getSteamPath)" + STUIDPATH="${STEAM_BASE_FOLDER}/userdata/${STUID}" + if [[ -d "${STUIDPATH}/config/" ]]; then + echo "${STUIDPATH}/config" fi fi } +getSteamPath() { + local paths=( + "${HOME}/.steam/steam" + "${HOME}/.local/share/Steam" + "${HOME}/.var/app/com.valvesoftware.Steam/.steam/steam" + ) + for path in "${paths[@]}"; do + if [[ -d "${path}" ]]; then + STEAM_BASE_FOLDER="${path}" + echo "${STEAM_BASE_FOLDER}" + return 0 + fi + done + return 1 +} + listInstalledSteamGames() { - manifests=("${HOME}/.local/share/Steam/steamapps"/appmanifest_*.acf) + [[ -z "${STEAM_BASE_FOLDER}" ]] && STEAM_BASE_FOLDER="$(getSteamPath)" + manifests=("${STEAM_BASE_FOLDER}/steamapps"/appmanifest_*.acf) if [ ! -e "${manifests[0]}" ]; then jq -n '[]' else @@ -324,7 +342,11 @@ restartSteam() { while pgrep -i steam &>/dev/null ; do sleep 0.5 done - steam & + if command -v steam &>/dev/null; then + steam & + elif command -v flatpak >/dev/null 2>&1 && flatpak list | grep -q com.valvesoftware.Steam; then + flatpak run com.valvesoftware.Steam & + fi sleep 5 pw_stop_progress_bar exit 0 @@ -395,36 +417,38 @@ addEntry() { printf '\x00%s\x00' "shortcuts" > "${SCPATH}" NEWSET=0 fi - NOSTAIDVDFHEXFMT="\x$(awk '{$1=$1}1' FPAT='.{2}' OFS="\\\x" <<< "$NOSTAIDVDFHEX")" # binary-formatted string hex of the above which we actually write out - ex: \xc1\xc2\x5a\xdc + NOSTAIDVDFHEXFMT="\x$(awk '{$1=$1}1' FPAT='.{2}' OFS="\\\x" <<< "${NOSTAIDVDFHEX}")" # binary-formatted string hex of the above which we actually write out - ex: \xc1\xc2\x5a\xdc { printf '\x00%s\x00' "${NEWSET}" - printf '\x02%s\x00%b' "appid" "${NOSTAIDVDFHEXFMT}" - printf '\x01%s\x00%s\x00' "AppName" "${NOSTAPPNAME}" + printf '\x02%s\x00%b' "appid" "${NOSTAIDVDFHEXFMT}" # printf '\x01%s\x00%b' "appid" "${NOSTAIDVDFHEX}" +# printf '\x01%s\x00%s\x00' "AppName" "${NOSTAPPNAME}" + printf '\x00\x01%s\x00%s\x00' "AppName" "${NOSTAPPNAME}" printf '\x01%s\x00%s\x00' "Exe" "\"${NOSTEXEPATH}\"" printf '\x01%s\x00%s\x00' "StartDir" "\"${NOSTSTDIR}\"" printf '\x01%s\x00%s\x00' "icon" "${NOSTICONPATH}" - printf '\x01%s\x00%s\x00' "ShortcutPath" "" +# printf '\x01%s\x00%s\x00' "ShortcutPath" "" printf '\x01%s\x00%s\x00' "LaunchOptions" "${NOSTARGS:-}" - printf '\x02%s\x00%b\x00\x00\x00' "IsHidden" "\x00" - printf '\x02%s\x00%b\x00\x00\x00' "AllowDesktopConfig" "\x00" +# printf '\x02%s\x00%b\x00\x00\x00' "IsHidden" "\x00" +# printf '\x02%s\x00%b\x00\x00\x00' "AllowDesktopConfig" "\x00" # These values are now stored in localconfig.vdf under the "Apps" section, # under a block using the Non-Steam Game Signed 32bit AppID. (i.e., -223056321) # This is handled by `updateLocalConfigAppsValue` below # # Unsure if required, but still write these to the shortcuts.vdf file for consistency - printf '\x02%s\x00%b\x00\x00\x00' "AllowOverlay" "\x00" - printf '\x02%s\x00%b\x00\x00\x00' "OpenVR" "\x00" +# printf '\x02%s\x00%b\x00\x00\x00' "AllowOverlay" "\x00" +# printf '\x02%s\x00%b\x00\x00\x00' "OpenVR" "\x00" - printf '\x02%s\x00\x00\x00\x00\x00' "Devkit" - printf '\x01%s\x00\x00' "DevkitGameID" - printf '\x02%s\x00\x00\x00\x00\x00' "DevkitOverrideAppID" - printf '\x02%s\x00\x00\x00\x00\x00' "LastPlayTime" - printf '\x01%s\x00\x00' "FlatpakAppID" - printf '\x00%s\x00' "tags" - printf '\x08\x08\x08\x08' +# printf '\x02%s\x00\x00\x00\x00\x00' "Devkit" +# printf '\x01%s\x00\x00' "DevkitGameID" +# printf '\x02%s\x00\x00\x00\x00\x00' "DevkitOverrideAppID" +# printf '\x02%s\x00\x00\x00\x00\x00' "LastPlayTime" +# printf '\x01%s\x00\x00' "FlatpakAppID" +# printf '\x00%s\x00' "tags" +# printf '\x08\x08\x08\x08' + printf '\x08\x08\x08' } >> "${SCPATH}" fi } @@ -434,6 +458,7 @@ removeNonSteamGame() { [[ -n "$2" ]] && NOSTSHPATH="$2" [[ -z "${STUID}" ]] && STUID=$(getUserId) [[ -z "${STCFGPATH}" ]] && STCFGPATH="$(getUserPath ${STUID})" + [[ -z "${STEAM_BASE_FOLDER}" ]] && STEAM_BASE_FOLDER="$(getSteamPath)" if [[ -n "${STCFGPATH}" ]] && [[ -z "${SCPATH}" ]]; then SCPATH="${STCFGPATH}/shortcuts.vdf" fi @@ -453,8 +478,8 @@ removeNonSteamGame() { addEntry done rm -f "${STCFGPATH}/grid/${appid}.jpg" "${STCFGPATH}/grid/${appid}p.jpg" "${STCFGPATH}/grid/${appid}_hero.jpg" "${STCFGPATH}/grid/${appid}_logo.png" - rm -rf "${HOME}/.local/share/Steam/steamapps/compatdata/${appid}" - rm -rf "${HOME}/.local/share/Steam/steamapps/shadercache/${appid}" + rm -rf "${STEAM_BASE_FOLDER}/steamapps/compatdata/${appid}" + rm -rf "${STEAM_BASE_FOLDER}/steamapps/shadercache/${appid}" if [[ -f "${NOSTSHPATH}" ]]; then isInstallGame=false for STUIDCUR in $(getUserIds); do diff --git a/hexdump.txt b/hexdump.txt new file mode 100644 index 0000000..63bf451 --- /dev/null +++ b/hexdump.txt @@ -0,0 +1,18 @@ +00000000 00 73 68 6f 72 74 63 75 74 73 00 00 30 00 01 61 |.shortcuts..0..a| +00000010 70 70 69 64 00 33 39 33 39 37 31 34 38 35 35 00 |ppid.3939714855.| +00000020 01 41 70 70 4e 61 6d 65 00 4e 65 65 64 20 66 6f |.AppName.Need fo| +00000030 72 20 53 70 65 65 64 20 54 68 65 20 52 75 6e 00 |r Speed The Run.| +00000040 01 65 78 65 00 2f 68 6f 6d 65 2f 6d 69 6e 74 2f |.exe./home/mint/| +00000050 50 6f 72 74 50 72 6f 74 6f 6e 2f 73 74 65 61 6d |PortProton/steam| +00000060 5f 73 63 72 69 70 74 73 2f 4e 65 65 64 20 46 6f |_scripts/Need Fo| +00000070 72 20 53 70 65 65 64 20 54 68 65 20 52 75 6e 2e |r Speed The Run.| +00000080 73 68 00 01 53 74 61 72 74 44 69 72 00 2f 68 6f |sh..StartDir./ho| +00000090 6d 65 2f 6d 69 6e 74 2f 50 6f 72 74 50 72 6f 74 |me/mint/PortProt| +000000a0 6f 6e 2f 73 74 65 61 6d 5f 73 63 72 69 70 74 73 |on/steam_scripts| +000000b0 00 01 69 63 6f 6e 00 2f 68 6f 6d 65 2f 6d 69 6e |..icon./home/min| +000000c0 74 2f 50 6f 72 74 50 72 6f 74 6f 6e 2f 64 61 74 |t/PortProton/dat| +000000d0 61 2f 69 6d 67 2f 4e 65 65 64 5f 66 6f 72 5f 53 |a/img/Need_for_S| +000000e0 70 65 65 64 28 54 4d 29 5f 54 68 65 5f 52 75 6e |peed(TM)_The_Run| +000000f0 2e 70 6e 67 00 01 4c 61 75 6e 63 68 4f 70 74 69 |.png..LaunchOpti| +00000100 6f 6e 73 00 00 08 08 08 |ons.....| +00000108 diff --git a/shortcuts.vdf b/shortcuts.vdf new file mode 100644 index 0000000..1557e5b Binary files /dev/null and b/shortcuts.vdf differ diff --git a/start.sh b/start.sh new file mode 100755 index 0000000..3b87133 --- /dev/null +++ b/start.sh @@ -0,0 +1,17 @@ +#!/usr/bin/env bash + +. "./data_from_portwine/scripts/add_in_steam.sh" + +SCPATH="/home/mint/.steam/steam/userdata/360843101/config/shortcuts.vdf" +rm -f "${SCPATH}" + +NOSTAIDVDFHEX='3939714855' +NOSTAPPNAME='Need for Speed The Run' +NOSTEXEPATH='/home/mint/PortProton/steam_scripts/Need For Speed The Run.sh' +NOSTSTDIR='/home/mint/PortProton/steam_scripts' +NOSTICONPATH='/home/mint/PortProton/data/img/Need_for_Speed(TM)_The_Run.png' +NOSTARGS='' + +addEntry + +listNonSteamGames