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

Fix logic for fetching MO2 and Vortex version #592

Merged
merged 1 commit into from
Sep 21, 2022
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
51 changes: 37 additions & 14 deletions steamtinkerlaunch
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
PREFIX="/usr"
PROGNAME="SteamTinkerLaunch"
NICEPROGNAME="Steam Tinker Launch"
PROGVERS="v11.1.20220920"
PROGVERS="v11.1.20220921"
PROGCMD="${0##*/}"
SHOSTL="stl"
GHURL="https://github.com"
Expand Down Expand Up @@ -2489,7 +2489,7 @@ function setDefaultCfgValues {
if [ -z "$DL_D3D47_64" ] ; then DL_D3D47_64="https://lutris.net/files/tools/dll/$D3D47"; fi
if [ -z "$DL_D3D47_32" ] ; then DL_D3D47_32="http://dege.freeweb.hu/dgVoodoo2/bin/D3DCompiler_47.zip"; fi
if [ -z "$RESHADEDLURL" ] ; then RESHADEDLURL="https://reshade.me/downloads"; fi
if [ -z "$VORTEXRELURL" ] ; then VORTEXRELURL="$GHURL/Nexus-Mods/${VTX^}/releases"; fi
if [ -z "$VORTEXPROJURL" ] ; then VORTEXPROJURL="$GHURL/Nexus-Mods/${VTX^}"; fi
if [ -z "$DXVKURL" ] ; then DXVKURL="$GHURL/doitsujin/dxvk"; fi
if [ -z "$XLIVEURL" ] ; then XLIVEURL="$GHURL/ThirteenAG/Ultimate-ASI-Loader/releases/download/v4.61/Ultimate-ASI-Loader.zip"; fi
if [ -z "$STASSURL" ] ; then STASSURL="https://steamcdn-a.akamaihd.net/steam/apps"; fi
Expand All @@ -2498,7 +2498,7 @@ function setDefaultCfgValues {
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 "$CONTYRELURL" ] ; then CONTYRELURL="$GHURL/Kron4ek/Conty/releases"; fi
if [ -z "$MO2DLURL" ] ; then MO2DLURL="$GHURL/ModOrganizer2/modorganizer/releases"; fi
if [ -z "$MO2PROJURL" ] ; then MO2PROJURL="$GHURL/ModOrganizer2/modorganizer"; fi
if [ -z "$CW_KRON4EK" ] ; then CW_KRON4EK="$GHURL/Kron4ek/Wine-Builds/releases"; fi
if [ -z "$IGCSZIP" ] ; then IGCSZIP="$GHURL/FransBouma/InjectableGenericCameraSystem/releases/download/IGCSInjector_102/IGCSInjector_v102.zip"; fi
if [ -z "$UUUURL" ] ; then UUUURL="https://framedsc.github.io/GeneralGuides/universal_ue4_consoleunlocker.htm#downloading-the-uuu"; fi
Expand Down Expand Up @@ -2815,8 +2815,8 @@ function saveCfg {
echo "DXVKURL=\"$DXVKURL\""
echo "## ${RESH} DL URL"
echo "RESHADEDLURL=\"$RESHADEDLURL\""
echo "## ${VTX^} DL URL"
echo "VORTEXRELURL=\"$VORTEXRELURL\""
echo "## ${VTX^} Project URL"
echo "VORTEXPROJURL=\"$VORTEXPROJURL\""
echo "## Xlive DL URL"
echo "XLIVEURL=\"$XLIVEURL\""
echo "## Steam Asset URL"
Expand All @@ -2831,8 +2831,8 @@ function saveCfg {
echo "STEAMGRIDDBAPI=\"$STEAMGRIDDBAPI\""
echo "## Conty DL URL"
echo "CONTYRELURL=\"$CONTYRELURL\""
echo "## Mod Organizer 2 DL URL"
echo "MO2DLURL=\"$MO2DLURL\""
echo "## Mod Organizer 2 Project URL"
echo "MO2PROJURL=\"$MO2PROJURL\""
echo "## $DPRS DL URL"
echo "DPRSRELURL=\"$DPRSRELURL\""
echo "## $DEPS URL"
Expand Down Expand Up @@ -4975,7 +4975,7 @@ function AllSettingsEntriesDummyFunction {
--field=" $GUI_DL_D3D47_64!$DESC_DL_D3D47_64 ('DL_D3D47_64')" "${DL_D3D47_64/#-/ -}" `#CAT_Urls` `#MENU_URL` \
--field=" $GUI_DL_D3D47_32!$DESC_DL_D3D47_32 ('DL_D3D47_32')" "${DL_D3D47_32/#-/ -}" `#CAT_Urls` `#MENU_URL` \
--field=" $GUI_RESHADEDLURL!$DESC_RESHADEDLURL ('RESHADEDLURL')" "${RESHADEDLURL/#-/ -}" `#CAT_Urls` `#MENU_URL` \
--field=" $GUI_VORTEXRELURL!$DESC_VORTEXRELURL ('VORTEXRELURL')" "${VORTEXRELURL/#-/ -}" `#CAT_Urls` `#MENU_URL` \
--field=" $GUI_VORTEXRELURL!$DESC_VORTEXRELURL ('VORTEXPROJURL')" "${VORTEXPROJURL/#-/ -}" `#CAT_Urls` `#MENU_URL` \
--field=" $GUI_DXVKURL!$DESC_DXVKURL ('DXVKURL')" "${DXVKURL/#-/ -}" `#CAT_Urls` `#MENU_URL` \
--field=" $GUI_XLIVEURL!$DESC_XLIVEURL ('XLIVEURL')" "${XLIVEURL/#-/ -}" `#CAT_Urls` `#MENU_URL` \
--field=" $GUI_STASSURL!$DESC_STASSURL ('STASSURL')" "${STASSURL/#-/ -}" `#CAT_Urls` `#MENU_URL` \
Expand All @@ -4984,7 +4984,7 @@ function AllSettingsEntriesDummyFunction {
--field=" $GUI_X64DBGURL!$DESC_X64DBGURL ('X64DBGURL')" "${X64DBGURL/#-/ -}" `#CAT_Urls` `#MENU_URL` \
--field=" $GUI_STEAMGRIDDBAPI!$DESC_STEAMGRIDDBAPI ('STEAMGRIDDBAPI')" "${STEAMGRIDDBAPI/#-/ -}" `#CAT_Urls` `#MENU_URL` \
--field=" $GUI_CONTYRELURL!$DESC_CONTYRELURL ('CONTYRELURL')" "${CONTYRELURL/#-/ -}" `#CAT_Urls` `#MENU_URL` \
--field=" $GUI_MO2DLURL!$DESC_MO2DLURL ('MO2DLURL')" "${MO2DLURL/#-/ -}" `#CAT_Urls` `#MENU_URL` \
--field=" $GUI_MO2DLURL!$DESC_MO2DLURL ('MO2PROJURL')" "${MO2PROJURL/#-/ -}" `#CAT_Urls` `#MENU_URL` \
--field=" $GUI_DPRSRELURL!$DESC_DPRSRELURL ('DPRSRELURL')" "${DPRSRELURL/#-/ -}" `#CAT_Urls` `#MENU_URL` \
--field=" $GUI_DEPURL!$DESC_DEPURL ('DEPURL')" "${DEPURL/#-/ -}" `#CAT_Urls` `#MENU_URL` \
--field="$(spanFont "$GUI_OPTSVR" "H")":LBL "SKIP" `#CAT_VR` `#HEAD_VR` `#MENU_GAME` `#MENU_GLOBAL` \
Expand Down Expand Up @@ -11946,6 +11946,29 @@ function installDotNet {
writelog "INFO" "${FUNCNAME[0]} - Stopped $DOTN$DNVER install - check $ILOG"
}

#### MO2 + Vortex ####
# NOTE: This was written with MO2 and Vortex in mind
# It relies on projects having proper releases and tagging
# It may need tweaking if this is used for other projects in future or might require an entirely new function
function getLatestGitHubExeVer {
SETUPNAME="$1"
PROJURL="$2"

RELEASESURL="${PROJURL}/releases"
EXPANDEDASSETSURL="${RELEASESURL}/expanded_assets"
TAGSURL="${PROJURL}/tags"

TAGSGREP="${RELEASESURL#"$GHURL"}/tag"

LATESTTAG="$("$WGET" -q "${TAGSURL}" -O - 2> >(grep -v "SSL_INIT") | grep -m1 "$TAGSGREP" | grep -oE "${TAGSGREP}[^\"]+")"
LATESTVER="${LATESTTAG##*/}"

LATESTRELEASEURL="${EXPANDEDASSETSURL}/${LATESTVER}"

SETUPFILE="$("$WGET" -q "${LATESTRELEASEURL}" -O - 2> >(grep -v "SSL_INIT") | grep "exe" | grep -m1 "$SETUPNAME" | grep -oE "${SETUPNAME}[^\"]+")"
echo "${SETUPFILE}"
}

#### VORTEX START: ####

function addVortexStage {
Expand Down Expand Up @@ -12048,7 +12071,7 @@ function setVortexDLMime {
function getLatestVortVer {
VSET="$VTX-setup"
writelog "INFO" "${FUNCNAME[0]} - Search for latest ${VTX^} stable Release"
VORTEXSETUP="$("$WGET" -q "${VORTEXRELURL}/latest" -O - 2> >(grep -v "SSL_INIT") | grep -m1 "$VSET" | grep -oE "${VSET}[^\"]+")"
VORTEXSETUP="$(getLatestGitHubExeVer "$VSET" "$VORTEXPROJURL")"
writelog "INFO" "${FUNCNAME[0]} - Found '$VORTEXSETUP'"
echo "VORTEXSETUP=$VORTEXSETUP" > "$VTST"
}
Expand All @@ -12068,7 +12091,7 @@ function dlLatestVortex {
VVRAW="$(grep -oP "${VSET}-\K[^X]+" <<< "$VORTEXSETUP")"
VORTEXVERSION="${VVRAW%.exe}"

DLURL="$VORTEXRELURL/download/v$VORTEXVERSION/$VORTEXSETUP"
DLURL="$VORTEXPROJURL/releases/download/v$VORTEXVERSION/$VORTEXSETUP"
# no idea how the sha512 is formatted in the yaml, so simply checking the size
DLCHK="stat"
INCHK="$("$WGET" -q "${DLURL//$VORTEXSETUP/latest.yml}" -O - 2> >(grep -v "SSL_INIT") | grep "size:" | gawk -F': ' '{print $2}')"
Expand Down Expand Up @@ -13059,8 +13082,8 @@ function askVortex {
function getLatestMO2Ver {
MO2SET="Mod.Organizer"

writelog "INFO" "${FUNCNAME[0]} - Search for latest '$MO2SET' Release under '$MO2DLURL'"
MO2SETUP="$("$WGET" -q "${MO2DLURL}" -O - 2> >(grep -v "SSL_INIT") | grep "exe" | grep -m1 "$MO2SET" | grep -oE "${MO2SET}[^\"]+")"
writelog "INFO" "${FUNCNAME[0]} - Search for latest '$MO2SET' Release under '$MO2PROJURL'"
MO2SETUP="$(getLatestGitHubExeVer "$MO2SET" "$MO2PROJURL")"
if [ -n "$MO2SETUP" ]; then
writelog "INFO" "${FUNCNAME[0]} - Found '$MO2SETUP'"
else
Expand All @@ -13077,7 +13100,7 @@ function dlLatestMO2 {
if [ ! -f "$MO2SPATH" ]; then
MO2VRAW="$(grep -oP "${MO2SET}-\K[^X]+" <<< "$MO2SETUP")"
MO2VERSION="${MO2VRAW%.exe}"
DLURL="$MO2DLURL/download/v$MO2VERSION/$MO2SETUP"
DLURL="$MO2PROJURL/releases/download/v$MO2VERSION/$MO2SETUP"
writelog "INFO" "${FUNCNAME[0]} - Downloading $MO2SETUP to $MO2DLDIR from '$DLURL'"

if [ -n "$1" ]; then
Expand Down