Skip to content

Commit

Permalink
v3.8 - 10k
Browse files Browse the repository at this point in the history
  • Loading branch information
frostworx committed Feb 1, 2021
1 parent b49f6e2 commit a397b60
Show file tree
Hide file tree
Showing 2 changed files with 105 additions and 49 deletions.
3 changes: 3 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -1283,6 +1283,9 @@ all directories with files from the `steamuser` inside the Proton pfx will be ba
The destination directory is `STLCFGDIR/backup/steamuser/id/$AID`.
A `STLCFGDIR/backup/steamuser/title/$GAMETITLE` symlink pointing to it will be created as well.

##### Backup using commandline:
see [Command Line](#Command-Line)

## Game Launch Speed
**stl** has pretty much to check, but when everything is configured, several option-checks can be disabled (per game)
to speed up the actual game start process.
Expand Down
151 changes: 102 additions & 49 deletions stl
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
### project ###

PROGNAME="SteamTinkerLaunch"
PROGVERS="v3.7-next3"
PROGVERS="v3.8"
PROGCMD="$(basename "$0")"
PROJECTPAGE="https://github.com/frostworx/steamtinkerlaunch"

Expand Down Expand Up @@ -43,16 +43,13 @@ LSUSB="lsusb"
JQ="jq"
CONVERT="convert"
RSYNC="rsync"
CHECKHMD=1 # will be set to 0 if $LSUSB is not found. Then the hmd presence check is skipped

# autotweak platforms
CHECKHMD=1 # will be set to 0 if $LSUSB is not found. Then the hmd presence check is skipped
LU="lutris"
PF="protonfixes"
AUTOTWEAKPLATFORMS="$PF $LU"
LUATDEBUG=0
FORCEOVERRIDEPROTON=0

# this variable is filled with the last Auto Tweak variable accepted and is the only Auto Tweak config which is finally loaded
LOADAUTOCFG=""
FACO="favorites.conf"
MENSO="menusort.conf"
Expand Down Expand Up @@ -81,7 +78,6 @@ TMPL="template"
WARCH="-x86_64"
DLWINEVERSION="$NON"
EARLYUSEWINE=0

FAVMENU="$MTEMP/favmenu"
GAMEMENU="$MTEMP/gamemenu"
GAMETEMPMENU="$MTEMP/gametemplmenu"
Expand Down Expand Up @@ -149,7 +145,6 @@ SBSTWEAKDIR="$TWEAKDIR/sbs" # directory for optional config over
ATDLDIR="$STLDLDIR/autotweak" # main autotweak download dir
CEDLDIR="$STLDLDIR/cheatengine"
STLCEDIR="$STLCFGDIR/cheatengine"

STLVORTEXDIR="$STLCFGDIR/vortex" # stl vortex dir
PLACEHOLDERAID="31337"
PLACEHOLDERGN="Placeholder"
Expand Down Expand Up @@ -235,6 +230,7 @@ ISGAME=0 # 1=game was launched, 2=windows game, 3=linux game
WFEAR="waitforexitandrun"
SA="steamapps"
SAC="$SA/common"
CODA="compatdata"
CTD="compatibilitytools.d"
USS="/usr/share/steam"
SYSSTEAMCOMPATOOLS="$USS/$CTD"
Expand Down Expand Up @@ -2469,7 +2465,6 @@ function EditorDialog {

loadCfg "$STLGUICFG" X
updateWinRes "$TITLE" "$STLGUICFG" "EDREQWIDTH" "EDREQHEIGHT" &

setShowPic

EDFILES="$(for f in $(printf '%s\n' "${CfgFiles[@]}"); do echo FALSE ; echo "$f" ; done | \
Expand Down Expand Up @@ -3114,7 +3109,6 @@ function openCustMenu {
TITLE="${PROGNAME}-${MYCAT}"
loadCfg "$STLGUICFG" X
updateWinRes "$TITLE" "$STLGUICFG" "$MYWI" "$MYHE" &

setShowPic
cp "$SHOWPIC" "$FAVPIC"

Expand Down Expand Up @@ -3226,7 +3220,6 @@ function setGuiFavoritesSelection {

loadCfg "$STLGUICFG" X
updateWinRes "$TITLE" "$STLGUICFG" "FAVSELWIDTH" "FAVSELHEIGHT" &

setShowPic

FAVENTRIES="$(favoritesMenuEntries | \
Expand Down Expand Up @@ -3292,7 +3285,6 @@ function setGuiCategoryMenuSel {

loadCfg "$STLGUICFG" X
updateWinRes "$TITLE" "$STLGUICFG" "CATSELWIDTH" "CATSELHEIGHT" &

setShowPic

if [ -z "$CURCAT" ]; then
Expand Down Expand Up @@ -4274,7 +4266,6 @@ function getGameWindowName {

function getGameWindowData {
SBSgetGamePID

waitForGameWindow

if [ "$GAMEWINDOWID" == "0x0" ]; then
Expand All @@ -4283,8 +4274,6 @@ function getGameWindowData {
fi

if [ -n "$GAMEWINDOWID" ]; then


WSIZ="$(getWindowHeight "$WINS")"
writelog "INFO" "${FUNCNAME[0]} - Found Window Height for gameid '$GAMEWINDOWID' is '$WSIZ' and minimal VR Height is '$MINVRWINH'"

Expand Down Expand Up @@ -4393,8 +4382,7 @@ function SBSrunVRVideoPlayer {

"$PKILL" -9 "$SBSVRKGPID"
else
if [ -z "$VRVIDEOPLAYERARGS" ];
then
if [ -z "$VRVIDEOPLAYERARGS" ]; then
writelog "SKIP" "${FUNCNAME[0]} - ERROR - no VRVIDEOPLAYERARGS '$VRVIDEOPLAYERARGS'"
fi

Expand Down Expand Up @@ -4446,11 +4434,11 @@ function SBSrunVRVideoPlayer {
SBSVRWID=$("$XWININFO" -name "$SBSVRWINNAME" -stats | grep "^$XWININFO" | gawk -F 'id: ' '{print $2}' | cut -d ' ' -f1)

if [ -n "$SBSVRWID" ]; then
writelog "INFO" "${FUNCNAME[0]} - Pressing w in '$VRVIDEOPLAYER' window '$SBSVRWINNAME' to adjust view: '$XDO windowactivate --sync $SBSVRWID key w'"
"$XDO" windowactivate --sync "$SBSVRWID" key w
writelog "INFO" "${FUNCNAME[0]} - Pressing w in '$VRVIDEOPLAYER' window '$SBSVRWINNAME' to adjust view: '$XDO windowactivate --sync $SBSVRWID key w'"
"$XDO" windowactivate --sync "$SBSVRWID" key w

writelog "INFO" "${FUNCNAME[0]} - Activating game window with id '$GAMEWINDOWID' for input"
"$XDO" windowactivate --sync "$GAMEWINDOWID" click 1
writelog "INFO" "${FUNCNAME[0]} - Activating game window with id '$GAMEWINDOWID' for input"
"$XDO" windowactivate --sync "$GAMEWINDOWID" click 1
else
writelog "SKIP" "${FUNCNAME[0]} - WARN - SBSVRWID '$SBSVRWID' is empty!"
fi
Expand Down Expand Up @@ -4888,7 +4876,6 @@ function GameShaderDialog {

loadCfg "$STLGUICFG" X
updateWinRes "$TITLE" "$STLGUICFG" "SHADREQWIDTH" "SHADREQWIDTH" &

setShowPic

SHADFILES="$(for f in $(printf '%s\n' "${ShaderFiles[@]}"); do if [ ! -f "$SHADDESTDIR/$(basename "$f")" ]; then echo FALSE ; echo "$f" ; else echo TRUE ; echo "$f" ;fi ; done | \
Expand Down Expand Up @@ -5273,7 +5260,6 @@ function askSettings {

loadCfg "$STLGUICFG" X
updateWinRes "$TITLE" "$STLGUICFG" "ASKSETREQWIDTH" "ASKSETREQHEIGHT" &

setShowPic

if [ "$STARTMENU" == "Editor" ]; then
Expand Down Expand Up @@ -7879,7 +7865,6 @@ function askVortex {

loadCfg "$STLGUICFG" X
updateWinRes "$TITLE" "$STLGUICFG" "ASKVTXREQWIDTH" "ASKVTXREQHEIGHT" &

setShowPic

"$YAD" --image "$SHOWPIC" --image-on-top --window-icon="$STLICON" --form --center --on-top "$WINDECO" \
Expand Down Expand Up @@ -8611,7 +8596,6 @@ function gameArgs {
}

function createDLWineList {
#XXXXXXXXXXXXXXXXXX
writelog "INFO" "${FUNCNAME[0]} - Generating list of online available Wine archives"
WINEDLLIST="$STLSHM/WineDL.txt"
MAXAGE=360
Expand Down Expand Up @@ -8832,8 +8816,6 @@ function createWineList {
}
function setWineVars {
# writelog "INFO" "${FUNCNAME[0]} - XXXXXXXXXXXXXXXXX DEBUG - RUNWINEVERSION $RUNWINEVERSION - WINEVERSION $WINEVERSION"
if [ "$USEWINE" -eq 1 ] && [ "$ISGAME" -eq 2 ] && { [ -z "$RUNWINEVERSION" ] || [ "$RUNWINEVERSION" != "$WINEVERSION" ];}; then
writelog "INFO" "${FUNCNAME[0]} - USEWINE is enabled. Creating some wine related variables"
Expand Down Expand Up @@ -9339,6 +9321,8 @@ function howto {
echo " from <platform>. Valid platforms:"
echo " $AUTOTWEAKPLATFORMS"
echo " 'dl' updates the source before import"
echo " backup <value> Backup found '$STUS' files"
echo " (for 'SteamAppID' or 'all')"
echo " block Opens the category Block selection menu"
echo " compat <cmd> Will (add|del|get) $PROGCMD as"
echo " Steam compatibility tool"
Expand Down Expand Up @@ -9420,6 +9404,13 @@ function commandline {
else
howto
fi
elif [ "$1" == "backup" ]; then
if [ "$2" == "all" ]; then
backupSteamUserGate "$2"
else
FUSEID "$2"
backupSteamUserGate "$USEID"
fi
elif [ "$1" == "block" ]; then
FUSEID "$2"
setGuiBlockSelection "$USEID"
Expand Down Expand Up @@ -9451,7 +9442,7 @@ function commandline {
openGameLauncher "$2" "$3"
elif [ "$1" == "set" ]; then
if [ -n "$2" ]; then
ENTLIST="$(sed -n "/#STARTsaveCfgdefault_template/,/#ENDsaveCfgdefault_template/p;/#ENDsaveCfgdefault_template/q" "$0" | grep "echo" | grep "=" | cut -d '"' -f2 | cut -d '=' -f1 | sed 's/^#//')"
ENTLIST="$(sed -n "/#STARTsaveCfgdefault_template/,/#ENDsaveCfgdefault_template/p;/#ENDsaveCfgdefault_template/q" "$0" | grep "echo" | grep "=" | cut -d '"' -f2 | cut -d '=' -f1 | sed 's/^#//')"
if ! grep "$2" <<< "$ENTLIST" >/dev/null; then
echo "$2 is no valid entry - valid are:"
echo "-----------------------"
Expand Down Expand Up @@ -9608,8 +9599,6 @@ function storeMetaData {
createSymLink "${FUNCNAME[0]}" "$GEMETA/$AID.conf" "$TIGEMETA/${GN}.conf" X
createSymLink "${FUNCNAME[0]}" "$CUMETA/$AID.conf" "$TICUMETA/${GN}.conf" X
# XXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
}
function delMenuTemps {
Expand All @@ -9623,54 +9612,120 @@ function delWinetricksTemps {
function backupSteamUser {
if [ "$BACKUPSTEAMUSER" -eq 1 ]; then
TICFGF="${GN/$LGS /}"
BAID="$1"
if [ -n "$GN" ]; then
BACKTI="${GN/$LGS /}"
else
getGameName "$BAID"
if [ -n "$GAMENAME" ]; then
BACKTI="$GAMENAME"
fi
fi
if [ -n "$2" ]; then
if [ -d "$2" ]; then
writelog "INFO" "${FUNCNAME[0]} - Using argument 2 '$2' as WINEPREFIX'"
GPFX="$2"
else
writelog "SKIP" "${FUNCNAME[0]} - Directory in argument 2 '$2' does not exist"
GPFX=""
fi
fi
if [ -z "$GPFX" ]; then
listAppManifests
APPMA="$(listAppManifests | grep "${BAID}.acf")"
writelog "INFO" "${FUNCNAME[0]} - BAID '$BAID' + APPMA '$APPMA'" "E"
AMF="$(basename "$APPMA")"
GPFX="$(dirname "$APPMA")/$CODA/$BAID/pfx"
writelog "INFO" "${FUNCNAME[0]} - Found WINEPREFIX '$GPFX' in '$AMF'"
else
writelog "SKIP" "${FUNCNAME[0]} - Could not retrieve WINEPREFIX from '$AMF'"
GPFX=""
fi
if [ -z "$GPFX" ]; then
if [ -f "$CUMETA/$AID.conf" ]; then
writelog "INFO" "${FUNCNAME[0]} - Loading metadata config '$CUMETA/$AID.conf'"
loadCfg "$CUMETA/$AID.conf" X
if [ -f "$CUMETA/$BAID.conf" ]; then
writelog "INFO" "${FUNCNAME[0]} - Loading metadata config '$CUMETA/$BAID.conf'"
loadCfg "$CUMETA/$BAID.conf" X
if [ -d "$WINEPREFIX" ]; then
writelog "INFO" "${FUNCNAME[0]} - Searching in stored metadata WINEPREFIX '$WINEPREFIX' for files to backup"
GPFX="$WINEPREFIX"
else
writelog "SKIP" "${FUNCNAME[0]} - Stored metadata WINEPREFIX '$WINEPREFIX' does not exist"
fi
else
writelog "SKIP" "${FUNCNAME[0]} - No metadata metadata config '$CUMETA/$AID.conf' found to search for the WINEPREFIX"
writelog "SKIP" "${FUNCNAME[0]} - No metadata config '$CUMETA/$BAID.conf' found to search for the WINEPREFIX"
GPFX=""
fi
fi
if [ -z "$GPFX" ]; then
TICFGF="${GN/$LGS /}"
writelog "SKIP" "${FUNCNAME[0]} - Game pfx unknown for '$TICFGF ($AID)'"
if [ -z "$BACKTI" ]; then
writelog "SKIP" "${FUNCNAME[0]} - Game pfx unknown for '$BAID'"
else
writelog "SKIP" "${FUNCNAME[0]} - Game pfx unknown for '$BACKTI ($BAID)'"
fi
else
writelog "INFO" "${FUNCNAME[0]} - Backup enabled for Game '$TICFGF ($AID)'"
mkProjDir "$SUBADIRID/$AID" 1
if [ -z "$2" ]; then
writelog "INFO" "${FUNCNAME[0]} - Backup enabled for Game '$BACKTI ($BAID)'"
fi
mkProjDir "$SUBADIRID/$BAID" 1
mkProjDir "$SUBADIRTI" 1
SteamUserDir="$GPFX/$DRCU/$STUS"
if [ -d "$SteamUserDir" ];then
writelog "INFO" "${FUNCNAME[0]} - backing up directory '$SteamUserDir' to '$SUBADIRID/$AID'"
notiShow "$(strFix "$NOTY_STARTBACKUP" "$GN" "$AID")"
"$RSYNC" -am "$SteamUserDir" "$SUBADIRID/$AID"
notiShow "$(strFix "$NOTY_STOPBACKUP" "$GN" "$AID")"
writelog "INFO" "${FUNCNAME[0]} - backing up directory '$SteamUserDir' to '$SUBADIRID/$BAID'" "E"
if [ -z "$2" ]; then
notiShow "$(strFix "$NOTY_STARTBACKUP" "$BACKTI" "$BAID")"
fi
"$RSYNC" -am "$SteamUserDir" "$SUBADIRID/$BAID"
if [ -z "$2" ]; then
notiShow "$(strFix "$NOTY_STOPBACKUP" "$BACKTI" "$BAID")"
fi
else
writelog "SKIP" "${FUNCNAME[0]} - directory '$SteamUserDir' does not exist - nothing to backup"
fi
if [ -z "$GN" ]; then
writelog "SKIP" "${FUNCNAME[0]} - Skipping symlinking backup - no valid game name found"
if [ -z "$BACKTI" ]; then
if [ -z "$2" ]; then
writelog "SKIP" "${FUNCNAME[0]} - Skipping symlinking backup - no valid game name found"
fi
else
createSymLink "${FUNCNAME[0]}" "$SUBADIRID/$AID" "$SUBADIRTI/$TICFGF"
createSymLink "${FUNCNAME[0]}" "$SUBADIRID/$BAID" "$SUBADIRTI/$BACKTI"
fi
fi
fi
BACKTI=""
GAMENAME=""
}
function backupSteamUserGate {
BACKUPSTEAMUSER=1
if [ "$1" != "all" ]; then
backupSteamUser "$1"
else
LOGFILE="$TEMPLOG"
writelog "INFO" "${FUNCNAME[0]} - Selected to backup all '$STUS' files from all found pfxes" "E"
while read -r APPMA; do
AMF="$(basename "$APPMA")"
BAID="$(cut -d'_' -f2 <<< "$AMF" | cut -d'.' -f1)"
BPFX="$(dirname "$APPMA")/$CODA/$BAID/pfx"
if [ -d "$BPFX" ]; then
writelog "INFO" "${FUNCNAME[0]} - Backup all '$STUS' files for pfx '$BPFX'" #"E"
backupSteamUser "$BAID" "$BPFX"
fi
done < <(listAppManifests)
fi
}
#STARTCLOSESTL ###
function closeSTL {
backupSteamUser
backupSteamUser "$AID"
if [ "$PROTON_LOG" -eq 1 ]; then
createSymLink "${FUNCNAME[0]}" "$STLPROTONIDLOGDIR/steam-${AID}.log" "$STLPROTONTILOGDIR//steam-${GN}.log"
Expand Down Expand Up @@ -9850,7 +9905,6 @@ function emptyVars {

# empty "all" internal variables created by $PROGCMD - the ending logfile is "$2" and is written here
elif [ "$1" == "A" ]; then
# writelog "INFO" "${FUNCNAME[0]} - Clearing 'all' '$PROGCMD' internal Variables (before exit)"
env | grep "=" | grep -v "^ " | sort -o "$STLSHM/${FUNCNAME[0]}-in"
writelog "STOP" "$2"
restoreOrgVars
Expand Down Expand Up @@ -9941,7 +9995,6 @@ function main {
commandline "$@"
fi
fi

}

main "$@"

0 comments on commit a397b60

Please sign in to comment.