From f86d462f82a683cc99dffbfdd69af91606c8e6c3 Mon Sep 17 00:00:00 2001 From: Eamonn Rea Date: Fri, 6 Oct 2023 18:44:02 +0100 Subject: [PATCH] Add Non-Steam Game: Add Artwork Fetching by SteamGridDB Game ID (#927) --- lang/chinese.txt | 4 ++- lang/dutch.txt | 4 ++- lang/english.txt | 4 ++- lang/englishUK.txt | 4 ++- lang/french.txt | 4 ++- lang/german.txt | 4 ++- lang/italian.txt | 4 ++- lang/polish.txt | 4 ++- lang/russian.txt | 4 ++- steamtinkerlaunch | 88 ++++++++++++++++++++++++++++++++++++---------- 10 files changed, 96 insertions(+), 28 deletions(-) diff --git a/lang/chinese.txt b/lang/chinese.txt index dcf35eb2..a74ea034 100644 --- a/lang/chinese.txt +++ b/lang/chinese.txt @@ -445,7 +445,7 @@ GUI_STEAMCATSEL="选择 Steam 类别" BUT_SEL="选择" BUT_CREATE="创建" BUT_TAGS="标签" -GUI_WARNNSG1="Ensure the Steam Client is closed before any new Non-Steam Games are added." +GUI_WARNNSG1="Ensure the Steam Client is closed before any new Non-Steam Games are added.\n\nIf using the SteamGridDB Game ID, you will need to provide a SteamGridDB API key and set this in the global config. Check the SteamGridDB wiki page for guidance." TRAY_SRC="Steam 重置集合" GUI_VINFO="已安装的支持 Vortex 的游戏" GUI_VINFO1="要禁用 Vortex Steam 类别中的游戏,需要在 Steam 客户端中直接从该类别中删除。" @@ -1237,3 +1237,5 @@ DESC_USERESHSPEKPLUGIN="copy ReShade DLLs without renaming them and let SpecialK NOTY_RESHADEINSTALLING="Installing ReShade..." GUI_NOSTGEXEARTWORKFALLBACK="Search EXE Directory for Fallback Artwork" DESC_NOSTGEXEARTWORKFALLBACK="Look for image files named 'hero', 'logo', 'boxart', and 'tenfoot' in the same folder as the game executable, and use this for game artwork if no artwork is selected above - This will respect the chosen copy method option above" +GUI_NOSTSGDBAID="SteamGridDB Game ID (optional)" +DESC_NOSTSGDBAID="the SteamGridDB Game ID to search on to find grids automatically (requires SteamGridDB API key set on Global Menu) -- This will respect the SteamGridDB options on the Global Menu" diff --git a/lang/dutch.txt b/lang/dutch.txt index f37169d4..6e75c51f 100644 --- a/lang/dutch.txt +++ b/lang/dutch.txt @@ -441,7 +441,7 @@ GUI_STEAMCATSEL="Select Steam Collections" BUT_SEL="SELECT" BUT_CREATE="CREATE" BUT_TAGS="COLLECTIONS" -GUI_WARNNSG1="Ensure the Steam Client is closed before any new Non-Steam Games are added." +GUI_WARNNSG1="Ensure the Steam Client is closed before any new Non-Steam Games are added.\n\nIf using the SteamGridDB Game ID, you will need to provide a SteamGridDB API key and set this in the global config. Check the SteamGridDB wiki page for guidance." TRAY_SRC="Steam Reset Collections" GUI_VINFO="Installed games with Vortex support" GUI_VINFO1="To disable Vortex for a game in the Vortex Steam collection.\nit needs to be removed from the collection directly within the Steam client" @@ -1236,3 +1236,5 @@ DESC_USERESHSPEKPLUGIN="copy ReShade DLLs without renaming them and let SpecialK NOTY_RESHADEINSTALLING="Installing ReShade..." GUI_NOSTGEXEARTWORKFALLBACK="Search EXE Directory for Fallback Artwork" DESC_NOSTGEXEARTWORKFALLBACK="Look for image files named 'hero', 'logo', 'boxart', and 'tenfoot' in the same folder as the game executable, and use this for game artwork if no artwork is selected above - This will respect the chosen copy method option above" +GUI_NOSTSGDBAID="SteamGridDB Game ID (optional)" +DESC_NOSTSGDBAID="the SteamGridDB Game ID to search on to find grids automatically (requires SteamGridDB API key set on Global Menu) -- This will respect the SteamGridDB options on the Global Menu" diff --git a/lang/english.txt b/lang/english.txt index 5a43f9bc..4ed041e0 100644 --- a/lang/english.txt +++ b/lang/english.txt @@ -445,7 +445,7 @@ GUI_STEAMCATSEL="Select Steam Collections" BUT_SEL="SELECT" BUT_CREATE="CREATE" BUT_TAGS="COLLECTIONS" -GUI_WARNNSG1="Ensure the Steam Client is closed before any new Non-Steam Games are added." +GUI_WARNNSG1="Ensure the Steam Client is closed before any new Non-Steam Games are added.\n\nIf using the SteamGridDB Game ID, you will need to provide a SteamGridDB API key and set this in the global config. Check the SteamGridDB wiki page for guidance." TRAY_SRC="Steam Reset Collections" GUI_VINFO="Installed games with Vortex support" GUI_VINFO1="To disable Vortex for a game in the Vortex Steam collection.\nit needs to be removed from the collection directly within the Steam client" @@ -1237,3 +1237,5 @@ DESC_USERESHSPEKPLUGIN="copy ReShade DLLs without renaming them and let SpecialK NOTY_RESHADEINSTALLING="Installing ReShade..." GUI_NOSTGEXEARTWORKFALLBACK="Search EXE Directory for Fallback Artwork" DESC_NOSTGEXEARTWORKFALLBACK="Look for image files named 'hero', 'logo', 'boxart', and 'tenfoot' in the same folder as the game executable, and use this for game artwork if no artwork is selected above - This will respect the chosen copy method option above" +GUI_NOSTSGDBAID="SteamGridDB Game ID (optional)" +DESC_NOSTSGDBAID="the SteamGridDB Game ID to search on to find grids automatically (requires SteamGridDB API key set on Global Menu) -- This will respect the SteamGridDB options on the Global Menu" diff --git a/lang/englishUK.txt b/lang/englishUK.txt index 17f41a9f..0029e1d9 100644 --- a/lang/englishUK.txt +++ b/lang/englishUK.txt @@ -441,7 +441,7 @@ GUI_STEAMCATSEL="Select Steam Collections" BUT_SEL="SELECT" BUT_CREATE="CREATE" BUT_TAGS="COLLECTIONS" -GUI_WARNNSG1="Ensure the Steam Client is closed before any new Non-Steam Games are added." +GUI_WARNNSG1="Ensure the Steam Client is closed before any new Non-Steam Games are added.\n\nIf using the SteamGridDB Game ID, you will need to provide a SteamGridDB API key and set this in the global config. Check the SteamGridDB wiki page for guidance." TRAY_SRC="Steam Reset Collections" GUI_VINFO="Installed games with Vortex support" GUI_VINFO1="To disable Vortex for a game in the Vortex Steam collection.\nit needs to be removed from the collection directly within the Steam client" @@ -1236,3 +1236,5 @@ DESC_USERESHSPEKPLUGIN="copy ReShade DLLs without renaming them and let SpecialK NOTY_RESHADEINSTALLING="Installing ReShade..." GUI_NOSTGEXEARTWORKFALLBACK="Search EXE Directory for Fallback Artwork" DESC_NOSTGEXEARTWORKFALLBACK="Look for image files named 'hero', 'logo', 'boxart', and 'tenfoot' in the same folder as the game executable, and use this for game artwork if no artwork is selected above - This will respect the chosen copy method option above" +GUI_NOSTSGDBAID="SteamGridDB Game ID (optional)" +DESC_NOSTSGDBAID="the SteamGridDB Game ID to search on to find grids automatically (requires SteamGridDB API key set on Global Menu) -- This will respect the SteamGridDB options on the Global Menu" diff --git a/lang/french.txt b/lang/french.txt index f0e3d100..a1db42d5 100644 --- a/lang/french.txt +++ b/lang/french.txt @@ -440,7 +440,7 @@ GUI_STEAMCATSEL="Sélectionner les catégories Steam" BUT_SEL="SELECTIONNER" BUT_CREATE="CREER" BUT_TAGS="COLLECTIONS" -GUI_WARNNSG1="Ensure the Steam Client is closed before any new Non-Steam Games are added." +GUI_WARNNSG1="Ensure the Steam Client is closed before any new Non-Steam Games are added.\n\nIf using the SteamGridDB Game ID, you will need to provide a SteamGridDB API key and set this in the global config. Check the SteamGridDB wiki page for guidance." TRAY_SRC="Réinitialisation des collections Steam" GUI_VINFO="Jeux installés prenant en charge Vortex" GUI_VINFO1="Pour désactiver Vortex pour un jeu de la catégorie Steam Vortex,\nil faut le supprimer de la catégorie directement dans le client Steam" @@ -1235,3 +1235,5 @@ DESC_USERESHSPEKPLUGIN="copy ReShade DLLs without renaming them and let SpecialK NOTY_RESHADEINSTALLING="Installing ReShade..." GUI_NOSTGEXEARTWORKFALLBACK="Search EXE Directory for Fallback Artwork" DESC_NOSTGEXEARTWORKFALLBACK="Look for image files named 'hero', 'logo', 'boxart', and 'tenfoot' in the same folder as the game executable, and use this for game artwork if no artwork is selected above - This will respect the chosen copy method option above" +GUI_NOSTSGDBAID="SteamGridDB Game ID (optional)" +DESC_NOSTSGDBAID="the SteamGridDB Game ID to search on to find grids automatically (requires SteamGridDB API key set on Global Menu) -- This will respect the SteamGridDB options on the Global Menu" diff --git a/lang/german.txt b/lang/german.txt index bff80886..c538e33a 100644 --- a/lang/german.txt +++ b/lang/german.txt @@ -441,7 +441,7 @@ GUI_STEAMCATSEL="Wähle Steam Kollektionen" BUT_SEL="WÄHLEN" BUT_CREATE="ERSTELLEN" BUT_TAGS="COLLECTIONS" -GUI_WARNNSG1="Ensure the Steam Client is closed before any new Non-Steam Games are added." +GUI_WARNNSG1="Ensure the Steam Client is closed before any new Non-Steam Games are added.\n\nIf using the SteamGridDB Game ID, you will need to provide a SteamGridDB API key and set this in the global config. Check the SteamGridDB wiki page for guidance." TRAY_SRC="Steam Reset Collections" GUI_VINFO="Installierte Spiele mit Vortex Unterstützung" GUI_VINFO1="Um Vortex für ein Spiel zu deaktivieren, welches in der Vortex Steam Kollektion ist,\nmuß das Spiel direkt im Steam Client aus der Kollektion entfernt werden." @@ -1238,3 +1238,5 @@ DESC_USERESHSPEKPLUGIN="copy ReShade DLLs without renaming them and let SpecialK NOTY_RESHADEINSTALLING="Installing ReShade..." GUI_NOSTGEXEARTWORKFALLBACK="Search EXE Directory for Fallback Artwork" DESC_NOSTGEXEARTWORKFALLBACK="Look for image files named 'hero', 'logo', 'boxart', and 'tenfoot' in the same folder as the game executable, and use this for game artwork if no artwork is selected above - This will respect the chosen copy method option above" +GUI_NOSTSGDBAID="SteamGridDB Game ID (optional)" +DESC_NOSTSGDBAID="the SteamGridDB Game ID to search on to find grids automatically (requires SteamGridDB API key set on Global Menu) -- This will respect the SteamGridDB options on the Global Menu" diff --git a/lang/italian.txt b/lang/italian.txt index 3b255c91..45b77777 100644 --- a/lang/italian.txt +++ b/lang/italian.txt @@ -441,7 +441,7 @@ GUI_STEAMCATSEL="Selezionare categorie Steam" BUT_SEL="SELEZIONARE" BUT_CREATE="CREARE" BUT_TAGS="COLLECTIONS" -GUI_WARNNSG1="Ensure the Steam Client is closed before any new Non-Steam Games are added." +GUI_WARNNSG1="Ensure the Steam Client is closed before any new Non-Steam Games are added.\n\nIf using the SteamGridDB Game ID, you will need to provide a SteamGridDB API key and set this in the global config. Check the SteamGridDB wiki page for guidance." TRAY_SRC="Steam Reset Collections" GUI_VINFO="Giochi installati con il supporto a Vortex" GUI_VINFO1="To disable Vortex for a game in the Vortex Steam Category.\nit needs to be removed from the category directly within the Steam Client" @@ -1236,3 +1236,5 @@ DESC_USERESHSPEKPLUGIN="copy ReShade DLLs without renaming them and let SpecialK NOTY_RESHADEINSTALLING="Installing ReShade..." GUI_NOSTGEXEARTWORKFALLBACK="Search EXE Directory for Fallback Artwork" DESC_NOSTGEXEARTWORKFALLBACK="Look for image files named 'hero', 'logo', 'boxart', and 'tenfoot' in the same folder as the game executable, and use this for game artwork if no artwork is selected above - This will respect the chosen copy method option above" +GUI_NOSTSGDBAID="SteamGridDB Game ID (optional)" +DESC_NOSTSGDBAID="the SteamGridDB Game ID to search on to find grids automatically (requires SteamGridDB API key set on Global Menu) -- This will respect the SteamGridDB options on the Global Menu" diff --git a/lang/polish.txt b/lang/polish.txt index 5b963713..8e64a700 100644 --- a/lang/polish.txt +++ b/lang/polish.txt @@ -441,7 +441,7 @@ GUI_STEAMCATSEL="Wybierz kategorie Steam" BUT_SEL="WYBIERZ" BUT_CREATE="UTWÓRZ" BUT_TAGS="TAGI" -GUI_WARNNSG1="Ensure the Steam Client is closed before any new Non-Steam Games are added." +GUI_WARNNSG1="Ensure the Steam Client is closed before any new Non-Steam Games are added.\n\nIf using the SteamGridDB Game ID, you will need to provide a SteamGridDB API key and set this in the global config. Check the SteamGridDB wiki page for guidance." TRAY_SRC="Resetuj kolkcje Steam" GUI_VINFO="Zainstalowane gry ze wsparciem Vortex" GUI_VINFO1="By wyłączyć Vortex dla gry w kategorii Steam Vortex.\nmusi zostać usunięte z kategorii bezpośrednio w kliencie Steama" @@ -1236,3 +1236,5 @@ DESC_USERESHSPEKPLUGIN="copy ReShade DLLs without renaming them and let SpecialK NOTY_RESHADEINSTALLING="Installing ReShade..." GUI_NOSTGEXEARTWORKFALLBACK="Search EXE Directory for Fallback Artwork" DESC_NOSTGEXEARTWORKFALLBACK="Look for image files named 'hero', 'logo', 'boxart', and 'tenfoot' in the same folder as the game executable, and use this for game artwork if no artwork is selected above - This will respect the chosen copy method option above" +GUI_NOSTSGDBAID="SteamGridDB Game ID (optional)" +DESC_NOSTSGDBAID="the SteamGridDB Game ID to search on to find grids automatically (requires SteamGridDB API key set on Global Menu) -- This will respect the SteamGridDB options on the Global Menu" diff --git a/lang/russian.txt b/lang/russian.txt index 71e7842d..672a29b8 100644 --- a/lang/russian.txt +++ b/lang/russian.txt @@ -441,7 +441,7 @@ GUI_STEAMCATSEL="Select Steam Collections" BUT_SEL="SELECT" BUT_CREATE="CREATE" BUT_TAGS="COLLECTIONS" -GUI_WARNNSG1="Ensure the Steam Client is closed before any new Non-Steam Games are added." +GUI_WARNNSG1="Ensure the Steam Client is closed before any new Non-Steam Games are added.\n\nIf using the SteamGridDB Game ID, you will need to provide a SteamGridDB API key and set this in the global config. Check the SteamGridDB wiki page for guidance." TRAY_SRC="Steam Reset Collections" GUI_VINFO="Installed games with Vortex support" GUI_VINFO1="To disable Vortex for a game in the Vortex Steam collection.\nit needs to be removed from the collection directly within the Steam Client" @@ -1236,3 +1236,5 @@ DESC_USERESHSPEKPLUGIN="copy ReShade DLLs without renaming them and let SpecialK NOTY_RESHADEINSTALLING="Installing ReShade..." GUI_NOSTGEXEARTWORKFALLBACK="Search EXE Directory for Fallback Artwork" DESC_NOSTGEXEARTWORKFALLBACK="Look for image files named 'hero', 'logo', 'boxart', and 'tenfoot' in the same folder as the game executable, and use this for game artwork if no artwork is selected above - This will respect the chosen copy method option above" +GUI_NOSTSGDBAID="SteamGridDB Game ID (optional)" +DESC_NOSTSGDBAID="the SteamGridDB Game ID to search on to find grids automatically (requires SteamGridDB API key set on Global Menu) -- This will respect the SteamGridDB options on the Global Menu" diff --git a/steamtinkerlaunch b/steamtinkerlaunch index d785205f..f12b7a87 100755 --- a/steamtinkerlaunch +++ b/steamtinkerlaunch @@ -6,7 +6,7 @@ PREFIX="/usr" PROGNAME="SteamTinkerLaunch" NICEPROGNAME="Steam Tinker Launch" -PROGVERS="v14.0.20231003-1" +PROGVERS="v14.0.20231007-1" PROGCMD="${0##*/}" PROGINTERNALPROTNAME="Proton-stl" SHOSTL="stl" @@ -1372,7 +1372,7 @@ function getGameDataForInstalledGames { function checkSGDbApi { if [ -z "$SGDBAPIKEY" ] || [ "$SGDBAPIKEY" == "$NON" ]; then - writelog "SKIP" "${FUNCNAME[0]} - No SteamGrid Api Key found - Get one at '${STEAMGRIDDBAPI}'" + writelog "SKIP" "${FUNCNAME[0]} - No SteamGrid Api Key found - Get one at 'https://www.steamgriddb.com/profile/preferences/api/' (requires a SteamGridDB account) and see the SteamGridDB wiki page for guidance on how to supply the API key." writelog "SKIP" "${FUNCNAME[0]} - and save it in the Global Config ('SGDBAPIKEY')" return 1 else @@ -1383,11 +1383,15 @@ function checkSGDbApi { # Takes a list of appids separated by newlines function getGrids { if checkSGDbApi && [ "$STLPLAY" -eq 0 ]; then + CHOSENAPI="${2:-STEAMGRIDDBAPI}" # Endpoint (i.e. different one for different grids) + FORCESGDBDLTOSTEAM="${3:-0}" # Force Non-Steam games to always download to SteamGrid dir + GRIDNAMEAPPIDOVERRIDE="$4" # Override the AppID used for the grid, useful if the ID searched on is not the Steam AppID + # Split into batches of 100 games - too many and cloudflare blocks requests because of a too big header file while mapfile -t -n 100 ary && ((${#ary[@]})); do PART=$(printf '%s\n' "${ary[@]}") # If the whole batch has no grids we get a 404 and wget gives an error. --content-on-error ensures we still get the response json and the following logic still works - RESPONSE="$("$WGET" --content-on-error --header="Authorization: Bearer $SGDBAPIKEY" -q "${STEAMGRIDDBAPI}/$(echo "$PART" | awk '{print $1}' | paste -s -d, -)?styles=${SGDBSTYLES}&dimensions=${SGDBDIMS}&types=${SGDBTYPES}&nsfw=${SGDBNSFW}&humor=${SGDBHUMOR}" -O - 2> >(grep -v "SSL_INIT"))" + RESPONSE="$("$WGET" --content-on-error --header="Authorization: Bearer $SGDBAPIKEY" -q "${CHOSENAPI}/$(echo "$PART" | awk '{print $1}' | paste -s -d, -)?styles=${SGDBSTYLES}&dimensions=${SGDBDIMS}&types=${SGDBTYPES}&nsfw=${SGDBNSFW}&humor=${SGDBHUMOR}" -O - 2> >(grep -v "SSL_INIT"))" if ! "$JQ" -e '.success' 1> /dev/null <<< "$RESPONSE"; then writelog "INFO" "${FUNCNAME[0]} - The server response wasn't 'success' for this batch of requested games." @@ -1411,7 +1415,12 @@ function getGrids { for i in $(seq 0 $(("$RESPONSE_LENGTH" - 1))); do # match the current json array member against the appid list # this assumes we get the same order back we put in before - APPID=$(sed "$((i + 1))q;d" <<< "$PART") + if [ -n "$GRIDNAMEAPPIDOVERRIDE" ]; then + writelog "INFO" "${FUNCNAME[0]} - Overriding SteamGridDB AppID as '$GRIDNAMEAPPIDOVERRIDE'" + APPID="$GRIDNAMEAPPIDOVERRIDE" + else + APPID=$(sed "$((i + 1))q;d" <<< "$PART") + fi if ! "$JQ" -e ".data[$i].success" 1> /dev/null <<< "$RESPONSE"; then writelog "INFO" "${FUNCNAME[0]} - The server response for '$APPID' wasn't 'success'" @@ -1426,7 +1435,7 @@ function getGrids { if grep -q "^https" <<< "$GRIDDLURL"; then DLSRC="${GRIDDLURL//\"}" - if [ "$SGDBDLTOSTEAM" -eq 1 ]; then + if [ "$SGDBDLTOSTEAM" -eq 1 ] || [ "$FORCESGDBDLTOSTEAM" -eq 1 ]; then if [ -z "$SUSDA" ]; then setSteamPaths fi @@ -1438,7 +1447,7 @@ function getGrids { fi mkProjDir "$GRIDDLDIR" - + DLDST="$GRIDDLDIR/${APPID}p.${GRIDDLURL##*.}" STARTDL=1 @@ -1484,6 +1493,23 @@ function getGridsForInstalledGames { fi } +# TODO implement this for general use on the commandline if not already supported! +# Right now it can only be used when adding a Non-Steam Game and not retroactively +function getGridsForNonSteamGame { + STEAMGRIDDBGAMEID="$1" + NONSTEAMAPPID="$2" + + # "1" "3963591317" + if checkSGDbApi; then + if [ -n "$STEAMGRIDDBGAMEID" ]; then + writelog "INFO" "${FUNCNAME[0]} - Getting grids for Non-Steam Game from SteamGridDB for SteamGridDB Ghttps://www.steamgriddb.com/grid/74151ame ID of '${STEAMGRIDDBGAMEID}'" + getGrids "$STEAMGRIDDBGAMEID" "$STEAMGRIDDBNOSTAPI" "1" "$NONSTEAMAPPID" + else + writelog "SKIP" "${FUNCNAME[0]} - No SteamGridDB Game ID provided -- skipping" + fi + fi +} + function getDataForAllGamesinSharedConfig { while read -r CATAID; do getGameData "$CATAID" @@ -2695,6 +2721,7 @@ function setDefaultCfgValues { if [ -z "$WINETRICKSURL" ] ; then WINETRICKSURL="$GHURL/Winetricks/winetricks"; fi if [ -z "$X64DBGURL" ] ; then X64DBGURL="$GHURL/x64dbg/x64dbg/releases/tag/snapshot";fi if [ -z "$STEAMGRIDDBAPI" ] ; then STEAMGRIDDBAPI="https://www.steamgriddb.com/api/v2/grids/steam";fi + if [ -z "$STEAMGRIDDBNOSTAPI" ] ; then STEAMGRIDDBNOSTAPI="https://www.steamgriddb.com/api/v2/grids/game";fi if [ -z "$CONTYRELURL" ] ; then CONTYRELURL="$GHURL/Kron4ek/Conty/releases"; fi if [ -z "$MO2PROJURL" ] ; then MO2PROJURL="$GHURL/ModOrganizer2/modorganizer"; fi if [ -z "$HMMPROJURL" ] ; then HMMPROJURL="$GHURL/thesupersonic16/HedgeModManager"; fi @@ -21010,6 +21037,11 @@ function howto { echo " --copy Copy art files to Steam Grid folder (default) - optional" echo " --link Symlink art files to Steam Grid folder - optional" echo " --move Move art files to Steam Grid folder - optional" + echo " --auto-artwork Use image files in the game EXE directory with names 'hero', 'logo', 'boxart', 'tenfoot' - optional" + echo " This will respect the copy method flags above." + echo " Note also that this will return for any files assumed to be images, even if Steam doesn't support the image format." + echo " -sgid=|--steamgriddb-game-id= Game ID from SteamGridDB to search and download grid artwork on - optional" + echo " This requires a SteamGridDB API key. See the SteamGridDB wiki page for guidance on how to generate and supply it." echo " backup Backup found '$STUS' files" echo " (for 'SteamAppID' or 'all')" echo " block Opens the category Block selection menu" @@ -21419,7 +21451,10 @@ function commandline { elif [ "$1" == "getslrbtn" ]; then # Internal use only for the Main Menu button fetchGameSLRGui "$2" elif [ "$1" == "debug" ]; then - notiShow "$NOTY_SPEKDLLCONFLICT" "X" + # Why are you looking here? :-) + + ## SteamGridDB ID and Non-Steam Game AppID, respectively + getGridsForNonSteamGame "5265668" "3963591317" elif [ "$1" == "mo2" ]; then if [ -n "$2" ]; then if [ "$2" == "download" ] || [ "$2" == "d" ]; then @@ -22791,6 +22826,7 @@ function addNonSteamGameGui { --field=" $GUI_SGATENFOOT!$DESC_SGATENFOOT ('NOSTGTENFOOT')":FL "${NOSTGTENFOOT/#-/ -}" \ --field=" $GUI_SGASETACTION!$DESC_SGASETACTION ('NOSTGSETACTION')":CB "$( cleanDropDown "copy" "$SGASETACTIONS" )" \ --field=" $GUI_NOSTGEXEARTWORKFALLBACK!$DESC_NOSTGEXEARTWORKFALLBACK ('NOSTGEXEARTWORKFALLBACK')":CHK "${NOSTGEXEARTWORKFALLBACK/#-/ -}" \ + --field=" $GUI_NOSTSGDBAID!$DESC_NOSTSGDBAID ('NOSTSGDBAID')" "${NOSTSGDBAID/#-/ -}" \ --field="$(spanFont "$GUI_NOSTGPROPS" "H")":LBL " " \ --field=" $GUI_NOSTGCOMPATTOOL!$DESC_NOSTGCOMPATTOOL ('NOSTCOMPATTOOL')":CBE "$( cleanDropDown "$NON" "$NSGPROTYADLIST" )" \ --field=" $GUI_NOSTGLAOP!$DESC_NOSTGLAOP ('NOSTGLAOP')" "${NOSTGLAOP/#-/ -}" \ @@ -22810,8 +22846,7 @@ function addNonSteamGameGui { 4) writelog "INFO" "${FUNCNAME[0]} - Selected '$BUT_CREATE'" if [ -n "$NSGSET" ]; then mapfile -d "|" -t -O "${#NSGSETARR[@]}" NSGSETARR < <(printf '%s' "$NSGSET") - ## TODO test this rework, because the UI has changed, the order of arguments has changed! - ## The current rework here was taken from #576, but needs testing + writelog "INFO" "${FUNCNAME[0]} - The Non-Steam Game args are ${NSGSETARR[*]}" # NSGSETARR[0] is blank space # NSGSETARR[1] is Paths heading @@ -22826,14 +22861,15 @@ function addNonSteamGameGui { NOSTGTENFOOT="${NSGSETARR[10]}" NOSTGSETACTION="${NSGSETARR[11]}" NOSTGEXEARTWORKFALLBACK="$( retBool "${NSGSETARR[12]}" )" - # NSGSETARR[13] is Properties heading - NOSTCOMPATTOOL="${NSGSETARR[14]}" - NOSTGLAOP="${NSGSETARR[15]}" - NOSTTAGS="${NSGSETARR[16]}" - NOSTGHIDE="$( retBool "${NSGSETARR[17]}" )" - NOSTGADC="$( retBool "${NSGSETARR[18]}" )" - NOSTGAO="$( retBool "${NSGSETARR[19]}" )" - NOSTGVR="$( retBool "${NSGSETARR[20]}" )" + NOSTSGDBAID="${NSGSETARR[13]}" + # NSGSETARR[14] is Properties heading + NOSTCOMPATTOOL="${NSGSETARR[15]}" + NOSTGLAOP="${NSGSETARR[16]}" + NOSTTAGS="${NSGSETARR[17]}" + NOSTGHIDE="$( retBool "${NSGSETARR[18]}" )" + NOSTGADC="$( retBool "${NSGSETARR[10]}" )" + NOSTGAO="$( retBool "${NSGSETARR[20]}" )" + NOSTGVR="$( retBool "${NSGSETARR[21]}" )" ## Makes sure we ignore none compatibility tool if [[ "$NOSTCOMPATTOOL" = "$NON" ]]; then @@ -22846,8 +22882,8 @@ function addNonSteamGameGui { fi ## Arguments here like -hr, -lg, etc are made to match setGameArt - writelog "INFO" "${FUNCNAME[0]} - addNonSteamGame -an=\"$NOSTGAPPNAME\" -ep=\"$NOSTGEXEPATH\" -sd=\"$NOSTGSTDIR\" -ip=\"$NOSTGICONPATH\" -lo=\"$NOSTGLAOP\" -hd=\"$NOSTGHIDE\" -adc=\"$NOSTGADC\" -ao=\"$NOSTGAO\" -vr=\"$NOSTGVR\" -t=\"$NOSTTAGS\" -ct=\"$NOSTCOMPATTOOL\" -hr=\"$NOSTGHERO\" -lg=\"$NOSTGLOGO\" -ba=\"$NOSTGBOXART\" -tf=\"$NOSTGTENFOOT\" \"--${NOSTGSETACTION}\" \"$NOSTARTEXECMD\"" - addNonSteamGame -an="$NOSTGAPPNAME" -ep="$NOSTGEXEPATH" -sd="$NOSTGSTDIR" -ip="$NOSTGICONPATH" -lo="$NOSTGLAOP" -hd="$NOSTGHIDE" -adc="$NOSTGADC" -ao="$NOSTGAO" -vr="$NOSTGVR" -t="$NOSTTAGS" -ct="$NOSTCOMPATTOOL" -hr="$NOSTGHERO" -lg="$NOSTGLOGO" -ba="$NOSTGBOXART" -tf="$NOSTGTENFOOT" "--${NOSTGSETACTION}" "$NOSTARTEXECMD" + writelog "INFO" "${FUNCNAME[0]} - addNonSteamGame -an=\"$NOSTGAPPNAME\" -ep=\"$NOSTGEXEPATH\" -sd=\"$NOSTGSTDIR\" -ip=\"$NOSTGICONPATH\" -lo=\"$NOSTGLAOP\" -hd=\"$NOSTGHIDE\" -adc=\"$NOSTGADC\" -ao=\"$NOSTGAO\" -vr=\"$NOSTGVR\" -t=\"$NOSTTAGS\" -ct=\"$NOSTCOMPATTOOL\" -hr=\"$NOSTGHERO\" -lg=\"$NOSTGLOGO\" -ba=\"$NOSTGBOXART\" -tf=\"$NOSTGTENFOOT\" \"--${NOSTGSETACTION}\" \"$NOSTARTEXECMD\" -sgid=\"$NOSTSGDBAID\"" + addNonSteamGame -an="$NOSTGAPPNAME" -ep="$NOSTGEXEPATH" -sd="$NOSTGSTDIR" -ip="$NOSTGICONPATH" -lo="$NOSTGLAOP" -hd="$NOSTGHIDE" -adc="$NOSTGADC" -ao="$NOSTGAO" -vr="$NOSTGVR" -t="$NOSTTAGS" -ct="$NOSTCOMPATTOOL" -hr="$NOSTGHERO" -lg="$NOSTGLOGO" -ba="$NOSTGBOXART" -tf="$NOSTGTENFOOT" "--${NOSTGSETACTION}" "$NOSTARTEXECMD" -sgid="$NOSTSGDBAID" fi ;; esac @@ -22943,6 +22979,7 @@ function addNonSteamGame { NOSTVR=0 NOSTSTLLO=0 NOSTAUTOARTWORK=0 + NOSTUSESGDB=0 for i in "$@"; do case $i in @@ -23024,6 +23061,13 @@ function addNonSteamGame { --auto-artwork) NOSTAUTOARTWORK=1 # Look for artwork with matching names from game EXE folder (hero/logo/boxart/tenfoot.png/jpg/jpeg/gif) shift ;; + --steamgriddb-game-id|-sgid=*) + NOSTSGDBGAMEID="${i#*=}" # SteamGridDB Game ID to search for grids on (optional) + # This is off by default but always passed from addNonSteamGame, so if we actually get a value, enable it + if [ -n "$NOSTSGDBGAMEID" ]; then + NOSTUSESGDB=1 + fi + shift ;; ## Used to pass to setGameArt to define how we want to set game artwork (essentially giving a Non-Steam Game UI the functionality of setGameArt since we call it here anyway) --copy) SGACOPYMETHOD="--copy" # Copy file to grid folder -- Default @@ -23090,6 +23134,7 @@ function addNonSteamGame { writelog "INFO" "${FUNCNAME[0]} - Tenfoot Artwork: '${NOSTGTENFOOT}'" writelog "INFO" "${FUNCNAME[0]} - Copy Method for Artwork: '${SGACOPYMETHOD}'" writelog "INFO" "${FUNCNAME[0]} - EXE Dir Fallback Artwork: '${NOSTGEXEARTWORKFALLBACK}'" + writelog "INFO" "${FUNCNAME[0]} - SteamGridDB Game ID: '${NOSTSGDBGAMEID}'" if [ -f "$SCPATH" ]; then writelog "INFO" "${FUNCNAME[0]} - The file '$SCPATH' already exists, creating a backup, then removing the 2 closing backslashes at the end" @@ -23118,6 +23163,11 @@ function addNonSteamGame { NOSTICONPATH="$( findGameArtInExeDir "$NOSTEXEBASEDIR" "icon" "$NOSTICONPATH" )" fi + if [ "$NOSTUSESGDB" -eq 1 ]; then + # SteamGridDB ID and Non-Steam Game AppID, respectively + getGridsForNonSteamGame "$NOSTSGDBGAMEID" "$NOSTAIDGRID" + fi + writelog "INFO" "${FUNCNAME[0]} - Adding new set '$NEWSET'" ## TODO refactor to use a function for generating each line to write out, it would be a bit cleaner than this