diff --git a/assets/nix/run.sh b/assets/nix/run.sh index c840973..6992417 100755 --- a/assets/nix/run.sh +++ b/assets/nix/run.sh @@ -60,25 +60,17 @@ corlib_dir="" ################################################################################ # Everything past this point is the actual script +set -e -# Special case: program is launched via Steam -# In that case rerun the script via their bootstrapper to ensure Steam overlay works -steam_arg_helper() { - if [ "$executable_name" != "" ] && [ "$1" != "${1%"$executable_name"}" ]; then - return 0 - elif [ "$executable_name" = "" ] && [ "$1" != "${1%.x86_64}" ]; then - return 0 - elif [ "$executable_name" = "" ] && [ "$1" != "${1%.x86}" ]; then - return 0 - else - return 1 - fi -} +# Special case: program is launched via Steam on Linux +# In that case rerun the script via their bootstrapper to delay adding Doorstop to LD_PRELOAD +# This is required until https://github.com/NeighTools/UnityDoorstop/issues/88 is resolved for a in "$@"; do if [ "$a" = "SteamLaunch" ]; then rotated=0; max=$# while [ $rotated -lt $max ]; do - if steam_arg_helper "$1"; then + # Test if argument is prefixed with the value of $PWD + if [ "$1" != "${1#"${PWD%/}/"}" ]; then to_rotate=$(($# - rotated)) set -- "$@" "$0" while [ $((to_rotate-=1)) -ge 0 ]; do @@ -92,7 +84,7 @@ for a in "$@"; do rotated=$((rotated+1)) fi done - echo "Please set executable_name to a valid name in a text editor" 1>&2 + echo "Could not determine game executable launched by Steam" 1>&2 exit 1 fi done @@ -191,6 +183,17 @@ executable_path=$(resolve_executable_path "${executable_path}") # Figure out the arch of the executable with file file_out="$(LD_PRELOAD="" file -b "${executable_path}")" case "${file_out}" in + *PE32*) + echo "The executable is a Windows executable file. You must use Wine/Proton and BepInEx for Windows with this executable." 1>&2 + echo "Uninstall BepInEx for *nix and install BepInEx for Windows instead." 1>&2 + echo "More info: https://docs.bepinex.dev/articles/advanced/steam_interop.html#protonwine" 1>&2 + exit 1 + ;; + *shell\ script*) + # Fallback for games that launch a shell script from Steam + # default to x64, change as needed + arch="x64" + ;; *64-bit*) arch="x64" ;;