Skip to content

Commit

Permalink
ModOrganizer 2: Improve NXM urlscheme robustness (#1096)
Browse files Browse the repository at this point in the history
  • Loading branch information
zerodogg authored May 3, 2024
1 parent d2f953b commit 59b421b
Showing 1 changed file with 30 additions and 7 deletions.
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

0 comments on commit 59b421b

Please sign in to comment.