Skip to content

Commit

Permalink
Merge pull request #592 from sonic2kk/fix-github-ver-mo2-vortex
Browse files Browse the repository at this point in the history
Fix logic for fetching MO2 and Vortex version
  • Loading branch information
frostworx authored Sep 21, 2022
2 parents fe05af2 + 1023b55 commit 7e16efb
Showing 1 changed file with 36 additions and 13 deletions.
49 changes: 36 additions & 13 deletions steamtinkerlaunch
Original file line number Diff line number Diff line change
Expand Up @@ -2490,7 +2490,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 @@ -2499,7 +2499,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 @@ -2816,8 +2816,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 @@ -2832,8 +2832,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 @@ -4976,7 +4976,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 @@ -4985,7 +4985,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 @@ -11947,6 +11947,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 @@ -12049,7 +12072,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 @@ -12069,7 +12092,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 @@ -13060,8 +13083,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 @@ -13078,7 +13101,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

0 comments on commit 7e16efb

Please sign in to comment.