Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Nxm urlscheme robustness #1096

Merged
merged 7 commits into from
May 3, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
37 changes: 30 additions & 7 deletions steamtinkerlaunch
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
PREFIX="/usr"
PROGNAME="SteamTinkerLaunch"
NICEPROGNAME="Steam Tinker Launch"
PROGVERS="v14.0.20240503-1"
PROGVERS="v14.0.20240503-2"
PROGCMD="${0##*/}"
PROGINTERNALPROTNAME="Proton-stl"
SHOSTL="stl"
Expand Down Expand Up @@ -17376,8 +17376,6 @@ function manageMO2GInstance {
StatusWindow "$(strFix "$NOTY_INSTSTART" "$MO")" "installMO2" "InstallMO2Status"
fi

echo "$MOINST" > "$LAMOINST"

if [ -f "$MO2INSTFAIL" ]; then
writelog "SKIP" "${FUNCNAME[0]} - '$MO2INSTFAIL' found - seems like installation failed previously - skipping ${FUNCNAME[0]}"
else
Expand Down Expand Up @@ -17628,6 +17626,15 @@ function dlMod2nexurl {
else
writelog "ERROR" "${FUNCNAME[0]} - Could not find a valid $MO instance for '${MONGURL}' - giving up"
fi
elif [ -d "${GMO2EXE%/*}" ] && [ -n "$MO2PFX" ] && [ -n "$MO2WINE" ]; then
MYINST="$(grep -m1 "\"${MONGURL}\"" "$MO2GAMES" | cut -d ';' -f1)"
MYINST="${MYINST//\"/}"
if [ -n "$MYINST" ]; then
writelog "INFO" "${FUNCNAME[0]} - Starting global MO2 in prefix '$MO2PFX' using '$MO2WINE' on $MYINST"
WINEDEBUG="-all" WINEPREFIX="$MO2PFX" "$MO2WINE" "$GMO2EXE" -i "$MYINST" "$1" 2>&1 | tee /tmp/RUNMO2DL.log
else
writelog "ERROR" "${FUNCNAME[0]} - Could not find a valid global MO2 instance"
fi
else
writelog "ERROR" "${FUNCNAME[0]} - Attempted to download Url '$1' for game '$MONGURL', but seems like global '$MYGLOBDLDAT' has incomplete data - giving up" "E"
fi
Expand Down Expand Up @@ -19762,22 +19769,37 @@ function updateMO2GlobConf {
{
echo "GMO2EXE=\"$MO2EXE\""
echo "RUNPROTON=\"$MO2RUNPROT\""
echo "MO2PFX=\"$MO2PFX\""
echo "MO2WINE=\"$MO2WINE\""
echo "MO2INST=\"$MO2INST\""
echo "STEAM_COMPAT_CLIENT_INSTALL_PATH=\"$STEAM_COMPAT_CLIENT_INSTALL_PATH\""
echo "STEAM_COMPAT_DATA_PATH=\"$MO2CODA\""
} > "$MYGLOBDLDAT"
echo "global" > "$LAMOINST"
}

function updateMO2PortConf {
MONGURL="$(grep -i "\"$MO2GAM\"" "$MO2GAMES" | head -n1 | cut -d ';' -f4)"
MONGURL="${MONGURL//\"}"

mkProjDir "$STLMO2DLDATDIR"
MYPORTDLDAT="${STLMO2DLDATDIR}/${MONGURL}.conf"

if [ -z "${MONGURL}" ]; then
writelog "WARN" "${FUNCNAME[0]} - extracting the gamename MONGURL from '$MO2GAMES' by looking for '$MO2GAM' failed - the file '$MYPORTDLDAT' won't be found"
# Fall back to AID if MO2GAM couldn't be found
if [ -n "$AID" ]; then
MONGURL="$(grep -i "\"$AID\"" "$MO2GAMES" | head -n1 | cut -d ';' -f4)"
MONGURL="${MONGURL//\"}"
if [ -z "${MONGURL}" ]; then
writelog "WARN" "${FUNCNAME[0]} - extracting the gamename MONGURL from '$MO2GAMES' by looking for '$MO2GAM' or '$AID' failed - the file '$MYPORTDLDAT' won't be found"
return
fi
else
writelog "WARN" "${FUNCNAME[0]} - extracting the gamename MONGURL from '$MO2GAMES' by looking for '$MO2GAM' failed - the file '$MYPORTDLDAT' won't be found (and no AID to fall back to)"
return
fi
fi

mkProjDir "$STLMO2DLDATDIR"
MYPORTDLDAT="${STLMO2DLDATDIR}/${MONGURL}.conf"

writelog "INFO" "${FUNCNAME[0]} - Updating '$MYPORTDLDAT' with up to date data"

{
Expand All @@ -19789,6 +19811,7 @@ function updateMO2PortConf {
echo "STEAM_COMPAT_CLIENT_INSTALL_PATH=\"$STEAM_COMPAT_CLIENT_INSTALL_PATH\""
echo "STEAM_COMPAT_DATA_PATH=\"$STEAM_COMPAT_DATA_PATH\""
} > "$MYPORTDLDAT"
echo "portable" > "$LAMOINST"
}

function prepMO2 {
Expand Down