diff options
author | Jesse Plamondon-Willard <Pathoschild@users.noreply.github.com> | 2021-11-30 17:14:03 -0500 |
---|---|---|
committer | Jesse Plamondon-Willard <Pathoschild@users.noreply.github.com> | 2021-11-30 17:14:03 -0500 |
commit | 3342502993c39efec6734c68e4800d29073eeeec (patch) | |
tree | a96f1b62b3aeba3d5b12ad7496de06a94d39c977 /src/SMAPI.Installer/assets | |
parent | d578345cfd53df8a91ae8e0e1346b711332a999a (diff) | |
parent | b294ac1203aa78575f8c72f0be1ee9d3edff15ab (diff) | |
download | SMAPI-3342502993c39efec6734c68e4800d29073eeeec.tar.gz SMAPI-3342502993c39efec6734c68e4800d29073eeeec.tar.bz2 SMAPI-3342502993c39efec6734c68e4800d29073eeeec.zip |
Merge branch 'develop' into stable
Diffstat (limited to 'src/SMAPI.Installer/assets')
-rw-r--r-- | src/SMAPI.Installer/assets/README.txt | 2 | ||||
-rw-r--r-- | src/SMAPI.Installer/assets/System.Numerics.dll | bin | 54272 -> 0 bytes | |||
-rw-r--r-- | src/SMAPI.Installer/assets/System.Runtime.Caching.dll | bin | 71168 -> 0 bytes | |||
-rw-r--r-- | src/SMAPI.Installer/assets/runtimeconfig.unix.json | 14 | ||||
-rw-r--r-- | src/SMAPI.Installer/assets/runtimeconfig.windows.json | 12 | ||||
-rw-r--r-- | src/SMAPI.Installer/assets/unix-install.sh | 24 | ||||
-rw-r--r-- | src/SMAPI.Installer/assets/unix-launcher.sh | 113 | ||||
-rw-r--r-- | src/SMAPI.Installer/assets/windows-install.bat | 53 |
8 files changed, 130 insertions, 88 deletions
diff --git a/src/SMAPI.Installer/assets/README.txt b/src/SMAPI.Installer/assets/README.txt index c3a7e271..5c20529a 100644 --- a/src/SMAPI.Installer/assets/README.txt +++ b/src/SMAPI.Installer/assets/README.txt @@ -24,7 +24,7 @@ Manual install THIS IS NOT RECOMMENDED FOR MOST PLAYERS. See instructions above instead. If you really want to install SMAPI manually, here's how. -1. Unzip "internal/windows-install.dat" (on Windows) or "internal/unix-install.dat" (on +1. Unzip "internal/windows/install.dat" (on Windows) or "internal/unix/install.dat" (on Linux/macOS). You can change '.dat' to '.zip', it's just a normal zip file renamed to prevent confusion. 2. Copy the files from the folder you just unzipped into your game folder. The diff --git a/src/SMAPI.Installer/assets/System.Numerics.dll b/src/SMAPI.Installer/assets/System.Numerics.dll Binary files differdeleted file mode 100644 index fed0f92c..00000000 --- a/src/SMAPI.Installer/assets/System.Numerics.dll +++ /dev/null diff --git a/src/SMAPI.Installer/assets/System.Runtime.Caching.dll b/src/SMAPI.Installer/assets/System.Runtime.Caching.dll Binary files differdeleted file mode 100644 index a062391d..00000000 --- a/src/SMAPI.Installer/assets/System.Runtime.Caching.dll +++ /dev/null diff --git a/src/SMAPI.Installer/assets/runtimeconfig.unix.json b/src/SMAPI.Installer/assets/runtimeconfig.unix.json new file mode 100644 index 00000000..8a01ceb1 --- /dev/null +++ b/src/SMAPI.Installer/assets/runtimeconfig.unix.json @@ -0,0 +1,14 @@ +{ + "runtimeOptions": { + "tfm": "net5.0", + "includedFrameworks": [ + { + "name": "Microsoft.NETCore.App", + "version": "5.0.7" + } + ], + "configProperties": { + "System.Runtime.TieredCompilation": false + } + } +} diff --git a/src/SMAPI.Installer/assets/runtimeconfig.windows.json b/src/SMAPI.Installer/assets/runtimeconfig.windows.json new file mode 100644 index 00000000..b693d809 --- /dev/null +++ b/src/SMAPI.Installer/assets/runtimeconfig.windows.json @@ -0,0 +1,12 @@ +{ + "runtimeOptions": { + "tfm": "net5.0", + "framework": { + "name": "Microsoft.NETCore.App", + "version": "5.0.0" + }, + "configProperties": { + "System.Runtime.TieredCompilation": false + } + } +} diff --git a/src/SMAPI.Installer/assets/unix-install.sh b/src/SMAPI.Installer/assets/unix-install.sh index 311c5469..07df4e6c 100644 --- a/src/SMAPI.Installer/assets/unix-install.sh +++ b/src/SMAPI.Installer/assets/unix-install.sh @@ -1,24 +1,14 @@ #!/bin/bash -# Run the SMAPI installer through Mono on Linux or macOS. # Move to script's directory cd "`dirname "$0"`" -# get cross-distro version of POSIX command -COMMAND="" -if command -v command >/dev/null 2>&1; then - COMMAND="command -v" -elif type type >/dev/null 2>&1; then - COMMAND="type" +# make sure .NET 5 is installed +if ! command -v dotnet >/dev/null 2>&1; then + echo "Oops! You must have .NET 5 installed to use SMAPI: https://dotnet.microsoft.com/download"; + read + exit 1 fi -# if $TERM is not set to xterm, mono will bail out when attempting to write to the console. -export TERM=xterm - -# validate Mono & run installer -if $COMMAND mono >/dev/null 2>&1; then - mono internal/unix-install.exe -else - echo "Oops! Looks like Mono isn't installed. Please install Mono from https://mono-project.com, reboot, and run this installer again." - read -fi +# run installer +dotnet internal/unix/SMAPI.Installer.dll diff --git a/src/SMAPI.Installer/assets/unix-launcher.sh b/src/SMAPI.Installer/assets/unix-launcher.sh index d309f750..58f7a5ae 100644 --- a/src/SMAPI.Installer/assets/unix-launcher.sh +++ b/src/SMAPI.Installer/assets/unix-launcher.sh @@ -1,51 +1,19 @@ #!/usr/bin/env bash -# MonoKickstart Shell Script -# Written by Ethan "flibitijibibo" Lee -# Modified for SMAPI by various contributors -# Move to script's directory +########## +## Initial setup +########## +# move to script's directory cd "$(dirname "$0")" || exit $? -# Get the system architecture -UNAME=$(uname) -ARCH=$(uname -m) - -# MonoKickstart picks the right libfolder, so just execute the right binary. -if [ "$UNAME" == "Darwin" ]; then - # ... Except on OSX. - export DYLD_LIBRARY_PATH=$DYLD_LIBRARY_PATH:./osx/ - - # El Capitan is a total idiot and wipes this variable out, making the - # Steam overlay disappear. This sidesteps "System Integrity Protection" - # and resets the variable with Valve's own variable (they provided this - # fix by the way, thanks Valve!). Note that you will need to update your - # launch configuration to the script location, NOT just the app location - # (i.e. Kick.app/Contents/MacOS/Kick, not just Kick.app). - # -flibit - if [ "$STEAM_DYLD_INSERT_LIBRARIES" != "" ] && [ "$DYLD_INSERT_LIBRARIES" == "" ]; then - export DYLD_INSERT_LIBRARIES="$STEAM_DYLD_INSERT_LIBRARIES" - fi - - # this was here before - ln -sf mcs.bin.osx mcs - - # fix "DllNotFoundException: libgdiplus.dylib" errors when loading images in SMAPI - if [ -f libgdiplus.dylib ]; then - rm libgdiplus.dylib - fi - if [ -f /Library/Frameworks/Mono.framework/Versions/Current/lib/libgdiplus.dylib ]; then - ln -s /Library/Frameworks/Mono.framework/Versions/Current/lib/libgdiplus.dylib libgdiplus.dylib - fi - # create bin file - # Note: don't overwrite if it's identical, to avoid resetting permission flags - if [ ! -x StardewModdingAPI.bin.osx ] || ! cmp StardewValley.bin.osx StardewModdingAPI.bin.osx >/dev/null 2>&1; then - cp -p StardewValley.bin.osx StardewModdingAPI.bin.osx - fi - - # Make sure we're running in Terminal (so the user can see errors/warnings/update alerts). - # Previously we would just use `open -a Terminal` to launch the .bin.osx file, but that - # doesn't let us set environment variables. +########## +## Open terminal if needed +########## +# on macOS, make sure we're running in a Terminal +# Besides letting the player see errors/warnings/alerts in the console, this is also needed because +# Steam messes with the PATH. +if [ "$(uname)" == "Darwin" ]; then if [ ! -t 1 ]; then # https://stackoverflow.com/q/911168/262123 # sanity check to make sure we don't have an infinite loop of opening windows SKIP_TERMINAL=false @@ -68,21 +36,38 @@ if [ "$UNAME" == "Darwin" ]; then exit 0 fi fi +fi + - # launch SMAPI - LC_ALL="C" ./StardewModdingAPI.bin.osx "$@" +########## +## Validate assumptions +########## +# script must be run from the game folder +if [ ! -f "Stardew Valley.dll" ]; then + echo "Oops! SMAPI must be placed in the Stardew Valley game folder.\nSee instructions: https://stardewvalleywiki.com/Modding:Player_Guide"; + read + exit 1 +fi + +# .NET 5 must be installed +if ! command -v dotnet >/dev/null 2>&1; then + echo "Oops! You must have .NET 5 installed to use SMAPI: https://dotnet.microsoft.com/download"; + read + exit 1 +fi + + +########## +## Launch SMAPI +########## +# macOS +if [ "$(uname)" == "Darwin" ]; then + dotnet StardewModdingAPI.dll "$@" + +# Linux else # choose binary file to launch - LAUNCH_FILE="" - if [ "$ARCH" == "x86_64" ]; then - ln -sf mcs.bin.x86_64 mcs - cp StardewValley.bin.x86_64 StardewModdingAPI.bin.x86_64 - LAUNCH_FILE="./StardewModdingAPI.bin.x86_64" - else - ln -sf mcs.bin.x86 mcs - cp StardewValley.bin.x86 StardewModdingAPI.bin.x86 - LAUNCH_FILE="./StardewModdingAPI.bin.x86" - fi + LAUNCH_FILE="./StardewModdingAPI" export LAUNCH_FILE # select terminal (prefer xterm for best compatibility, then known supported terminals) @@ -105,44 +90,44 @@ else terminal|termite) # consumes only one argument after -e # options containing space characters are unsupported - exec $TERMINAL_NAME -e "env TERM=xterm LC_ALL=\"C\" $LAUNCH_FILE $@" + exec $TERMINAL_NAME -e "env TERM=xterm $LAUNCH_FILE $@" ;; xterm|konsole|alacritty) # consumes all arguments after -e - exec $TERMINAL_NAME -e env TERM=xterm LC_ALL="C" $LAUNCH_FILE "$@" + exec $TERMINAL_NAME -e env TERM=xterm $LAUNCH_FILE "$@" ;; terminator|xfce4-terminal|mate-terminal) # consumes all arguments after -x - exec $TERMINAL_NAME -x env TERM=xterm LC_ALL="C" $LAUNCH_FILE "$@" + exec $TERMINAL_NAME -x env TERM=xterm $LAUNCH_FILE "$@" ;; gnome-terminal) # consumes all arguments after -- - exec $TERMINAL_NAME -- env TERM=xterm LC_ALL="C" $LAUNCH_FILE "$@" + exec $TERMINAL_NAME -- env TERM=xterm $LAUNCH_FILE "$@" ;; kitty) # consumes all trailing arguments - exec $TERMINAL_NAME env TERM=xterm LC_ALL="C" $LAUNCH_FILE "$@" + exec $TERMINAL_NAME env TERM=xterm $LAUNCH_FILE "$@" ;; *) # If we don't know the terminal, just try to run it in the current shell. # If THAT fails, launch with no output. - env TERM=xterm LC_ALL="C" $LAUNCH_FILE "$@" + env TERM=xterm $LAUNCH_FILE "$@" if [ $? -eq 127 ]; then - exec LC_ALL="C" $LAUNCH_FILE --no-terminal "$@" + exec $LAUNCH_FILE --no-terminal "$@" fi esac ## terminal isn't executable; fallback to current shell or no terminal else echo "The '$TERMINAL_NAME' terminal isn't executable. SMAPI might be running in a sandbox or the system might be misconfigured? Falling back to current shell." - env TERM=xterm LC_ALL="C" $LAUNCH_FILE "$@" + env TERM=xterm $LAUNCH_FILE "$@" if [ $? -eq 127 ]; then - exec LC_ALL="C" $LAUNCH_FILE --no-terminal "$@" + exec $LAUNCH_FILE --no-terminal "$@" fi fi fi diff --git a/src/SMAPI.Installer/assets/windows-install.bat b/src/SMAPI.Installer/assets/windows-install.bat index 2cd98554..2e0be906 100644 --- a/src/SMAPI.Installer/assets/windows-install.bat +++ b/src/SMAPI.Installer/assets/windows-install.bat @@ -1,8 +1,49 @@ @echo off -echo "%~dp0" | findstr /C:"%TEMP%" 1>nul -if not errorlevel 1 ( - echo Oops! It looks like you're running the installer from inside a zip file. Make sure you unzip the download first. - pause -) else ( - start /WAIT /B internal\windows-install.exe + +SET installerDir=%~dp0 + +REM make sure we're not running within a zip folder +echo %installerDir% | findstr /C:"%TEMP%" 1>nul +if %ERRORLEVEL% EQU 0 ( + echo Oops! It looks like you're running the installer from inside a zip file. Make sure you unzip the download first. + echo. + pause + exit +) + +REM make sure .NET 5 is installed +WHERE dotnet /q +if %ERRORLEVEL% NEQ 0 ( + echo Oops! You must have .NET 5 ^(desktop x64^) installed to use SMAPI: https://dotnet.microsoft.com/download/dotnet/5.0/runtime + echo. + pause + exit +) +dotnet --info | findstr /C:"Microsoft.WindowsDesktop.App 5." 1>nul +if %ERRORLEVEL% NEQ 0 ( + echo Oops! You must have .NET 5 ^(desktop x64^) installed to use SMAPI: https://dotnet.microsoft.com/download/dotnet/5.0/runtime + echo. + pause + exit +) + +REM make sure an antivirus hasn't deleted the installer DLL +if not exist "%installerDir%internal\windows\SMAPI.Installer.dll" ( + echo Oops! SMAPI is missing one of its files. Your antivirus might have deleted it. + echo Missing file: %installerDir%internal\windows\SMAPI.Installer.dll + echo. + pause + exit +) + +REM start installer +dotnet internal\windows\SMAPI.Installer.dll + +REM keep window open if it failed +if %ERRORLEVEL% NEQ 0 ( + echo. + echo Oops! The SMAPI installer seems to have failed. The error details may be shown above. + echo. + pause + exit ) |