forked from CastroFidel/PortWINE
		
	Merge branch 'steam-covers' of github.com:Boria138/PortWINE into Boria138-steam-covers
This commit is contained in:
		| @@ -1,7 +1,6 @@ | ||||
| #!/bin/bash | ||||
| # GPL-3.0 license | ||||
| # based on https://github.com/sonic2kk/steamtinkerlaunch/blob/master/steamtinkerlaunch | ||||
|  | ||||
| PROGNAME="PortProton" | ||||
| name_desktop_png="${name_desktop// /_}" | ||||
| NOSTAPPNAME="$name_desktop" | ||||
| @@ -151,7 +150,15 @@ function downloadArtFromSteamGridDB { | ||||
|     [ -n "$SEARCHHUMOR" ] && SGDB_ENDPOINT_STR+="&humor=${SEARCHHUMOR}" | ||||
|     [ -n "$SEARCHEPILEPSY" ] && SGDB_ENDPOINT_STR+="&epilepsy=${SEARCHEPILEPSY}" | ||||
|  | ||||
|     set -o pipefail | ||||
|     RESPONSE=$(curl -H "Authorization: Bearer $SGDBAPIKEY" -s "$SGDB_ENDPOINT_STR" 2> >(grep -v "SSL_INIT")) | ||||
|     if [[ "${PIPESTATUS[0]}" != 0 ]] && [[ "$DOWNLOAD_STEAM_GRID" != 0 ]] ; then | ||||
| 		pw_notify_send -i info \ | ||||
| 		"$(gettext "SteamGridDB is not response, force disable cover download")" | ||||
| 		sed -i 's/DOWNLOAD_STEAM_GRID=.*/DOWNLOAD_STEAM_GRID="0"/' "$USER_CONF" | ||||
| 		export DOWNLOAD_STEAM_GRID="0" | ||||
| 		return | ||||
|     fi | ||||
|  | ||||
|  | ||||
|     if ! jq -e '.success' <<< "$RESPONSE" > /dev/null; then | ||||
| @@ -289,6 +296,7 @@ function commandlineGetSteamGridDBArtwork { | ||||
| 	SGDBSEARCHENDPOINT_LOGO="${BASESTEAMGRIDDBAPI}/logos/${SGDBENDPOINTTYPE}" | ||||
| 	SGDBSEARCHENDPOINT_BOXART="${BASESTEAMGRIDDBAPI}/grids/${SGDBENDPOINTTYPE}"	 # Grid endpoint is used for Boxart and Tenfoot, which SteamGridDB counts as vertical/horizontal grids respectively | ||||
|  | ||||
|  | ||||
| 	# Download Hero, Logo, Boxart, Tenfoot from SteamGridDB from given endpoint using given AppID | ||||
| 	# On SteamGridDB tenfoot called horizontal Steam grid, so fetch it by passing specific dimensions matching this -- Users can override this, but default is what SteamGridDB expects for the tenfoot sizes | ||||
| 	downloadArtFromSteamGridDB "$GSGDBA_APPID" "$SGDBSEARCHENDPOINT_HERO" "${GSGDBA_FILENAME}_hero" "$SGDBHEROSTYLES" "$SGDBHERODIMS" "$SGDBHEROTYPES" "$SGDBHERONSFW" "$SGDBHEROHUMOR" "$SGDBHEROEPILEPSY" "$GSGDBA_HASFILE" "$GSGDBA_APPLYARTWORK" | ||||
| @@ -325,7 +333,9 @@ if [ -n "$NOSTAPPNAME" ]; then | ||||
| fi | ||||
|  | ||||
| # Store the ID we searched with, so getSteamGridDBNonSteamIcon doesn't have to hit the endpoint again and we save an API call | ||||
| commandlineGetSteamGridDBArtwork --search-name="$NOSTSEARCHNAME" --filename-appid="$NOSTAIDGRID" "$NOSTSEARCHFLAG" --apply --replace-existing | ||||
| if [[ "$DOWNLOAD_STEAM_GRID" == "1" ]] ; then | ||||
| 	commandlineGetSteamGridDBArtwork --search-name="$NOSTSEARCHNAME" --filename-appid="$NOSTAIDGRID" "$NOSTSEARCHFLAG" --apply --replace-existing | ||||
| fi | ||||
| { | ||||
| 	printf '\x00%s\x00' "$NEWSET" | ||||
| 	printf '\x02%s\x00%b' "appid" "$NOSTAIDVDFHEXFMT" | ||||
| @@ -356,4 +366,6 @@ commandlineGetSteamGridDBArtwork --search-name="$NOSTSEARCHNAME" --filename-appi | ||||
| 	printf '\x08\x08\x08\x08' | ||||
| } >> "$SCPATH" | ||||
|  | ||||
| setGameArt "$NOSTAIDGRID" --hero="$NOSTGHERO" --logo="$NOSTGLOGO" --boxart="$NOSTGBOXART" --tenfoot="$NOSTGTENFOOT" "$SGACOPYMETHOD" | ||||
| if [[ "$DOWNLOAD_STEAM_GRID" == "1" ]] ; then | ||||
| 	setGameArt "$NOSTAIDGRID" --hero="$NOSTGHERO" --logo="$NOSTGLOGO" --boxart="$NOSTGBOXART" --tenfoot="$NOSTGTENFOOT" "$SGACOPYMETHOD" | ||||
| fi | ||||
|   | ||||
| @@ -5403,6 +5403,28 @@ change_branch () { | ||||
| } | ||||
| export -f change_branch | ||||
|  | ||||
| change_download_grid () { | ||||
|     if [[ "$DOWNLOAD_STEAM_GRID" == "1" ]] ; then | ||||
|         sed -i 's/DOWNLOAD_STEAM_GRID=.*/DOWNLOAD_STEAM_GRID="0"/' "$USER_CONF" | ||||
|         pw_notify_send -i info \ | ||||
|         "$(gettext "Cover downloads are enabled")" | ||||
|     else | ||||
|         sed -i 's/DOWNLOAD_STEAM_GRID=.*/DOWNLOAD_STEAM_GRID="1"/' "$USER_CONF" | ||||
|         pw_notify_send -i info \ | ||||
|         "$(gettext "Cover downloads are disabled")" | ||||
|     fi | ||||
|     print_info "Restarting PP for change cover download behavior..." | ||||
|     export SKIP_CHECK_UPDATES="1" | ||||
|     if [[ -z "${PW_ALL_DF}" ]] ; then | ||||
|         export TAB_MAIN_MENU="4" | ||||
|     else | ||||
|         export TAB_MAIN_MENU="5" | ||||
|     fi | ||||
|     /usr/bin/env bash -c ${pw_full_command_line[*]} & | ||||
|     exit 0 | ||||
| } | ||||
| export -f change_download_grid | ||||
|  | ||||
| change_gui_start () { | ||||
|     if [[ "$PW_GUI_START" == "NOTEBOOK" ]] ; then | ||||
|         sed -i 's/="NOTEBOOK"/="PANED"/g' "$USER_CONF" | ||||
|   | ||||
| @@ -209,6 +209,11 @@ fi | ||||
| export MIRROR | ||||
| print_info "The first mirror in used: $MIRROR\n" | ||||
|  | ||||
| # choose downloading covers from SteamGridDB or not | ||||
| if [[ -z "$DOWNLOAD_STEAM_GRID" ]] ; then | ||||
|     echo 'export DOWNLOAD_STEAM_GRID="1"' >> "$USER_CONF" | ||||
|     export DOWNLOAD_STEAM_GRID="1" | ||||
| fi | ||||
|  | ||||
| if [[ "${INSTALLING_PORT}" == 1 ]] ; then | ||||
|     return 0 | ||||
| @@ -666,6 +671,11 @@ else | ||||
|     else NEW_BRANCH="STABLE" | ||||
|     fi | ||||
|  | ||||
|     if [[ "$DOWNLOAD_STEAM_GRID" == "1" ]] | ||||
|     then NEW_STEAM_BEHAVIOR="Disable" | ||||
|     else NEW_STEAM_BEHAVIOR="Enable" | ||||
|     fi | ||||
|  | ||||
|     IFS=$'\n' | ||||
|     PW_ALL_DF="$(ls "${PORT_WINE_PATH}"/ | grep .desktop | grep -vE '(PortProton|readme)')" | ||||
|     if [[ -z "${PW_ALL_DF}" ]] | ||||
| @@ -713,6 +723,7 @@ else | ||||
|     --field="   $(gettext "Change mirror to") $NEW_MIRROR"!"$PW_GUI_ICON_PATH/$BUTTON_SIZE_MM.png"!"":"FBTN" '@bash -c "button_click change_mirror"' \ | ||||
|     --field="   $(gettext "Change branch to") $NEW_BRANCH"!"$PW_GUI_ICON_PATH/$BUTTON_SIZE_MM.png"!"":"FBTN" '@bash -c "button_click change_branch"' \ | ||||
|     --field="   $(gettext "Change start gui")"!"$PW_GUI_ICON_PATH/$BUTTON_SIZE_MM.png"!"":"FBTN" '@bash -c "button_click change_gui_start"' \ | ||||
|     --field="   $NEW_STEAM_BEHAVIOR $(gettext "steam covers download")"!"$PW_GUI_ICON_PATH/$BUTTON_SIZE_MM.png"!"":"FBTN" '@bash -c "button_click change_download_grid"' \ | ||||
|     2>/dev/null & | ||||
|  | ||||
|     "${pw_yad}" --plug=$KEY --tabnum="${PW_GUI_SORT_TABS[2]}" --form --columns=3 --align-buttons --separator=";" \ | ||||
| @@ -870,6 +881,7 @@ fi | ||||
|     change_mirror) change_mirror ;; | ||||
|     change_branch) change_branch ;; | ||||
|     change_gui_start) change_gui_start ;; | ||||
|     change_download_grid) change_download_grid ;; | ||||
|     118) gui_edit_db ;; | ||||
|     120) gui_vkbasalt ;; | ||||
|     122) gui_mangohud ;; | ||||
|   | ||||
		Reference in New Issue
	
	Block a user