Skip to content

Commit e894250

Browse files
authored
Merge pull request #95 from arrowmaster/patch-run-script
Updates to nix shell script
2 parents 60284ed + 6abda2f commit e894250

File tree

1 file changed

+18
-15
lines changed

1 file changed

+18
-15
lines changed

assets/nix/run.sh

Lines changed: 18 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -60,25 +60,17 @@ corlib_dir=""
6060

6161
################################################################################
6262
# Everything past this point is the actual script
63+
set -e
6364

64-
# Special case: program is launched via Steam
65-
# In that case rerun the script via their bootstrapper to ensure Steam overlay works
66-
steam_arg_helper() {
67-
if [ "$executable_name" != "" ] && [ "$1" != "${1%"$executable_name"}" ]; then
68-
return 0
69-
elif [ "$executable_name" = "" ] && [ "$1" != "${1%.x86_64}" ]; then
70-
return 0
71-
elif [ "$executable_name" = "" ] && [ "$1" != "${1%.x86}" ]; then
72-
return 0
73-
else
74-
return 1
75-
fi
76-
}
65+
# Special case: program is launched via Steam on Linux
66+
# In that case rerun the script via their bootstrapper to delay adding Doorstop to LD_PRELOAD
67+
# This is required until https://github.com/NeighTools/UnityDoorstop/issues/88 is resolved
7768
for a in "$@"; do
7869
if [ "$a" = "SteamLaunch" ]; then
7970
rotated=0; max=$#
8071
while [ $rotated -lt $max ]; do
81-
if steam_arg_helper "$1"; then
72+
# Test if argument is prefixed with the value of $PWD
73+
if [ "$1" != "${1#"${PWD%/}/"}" ]; then
8274
to_rotate=$(($# - rotated))
8375
set -- "$@" "$0"
8476
while [ $((to_rotate-=1)) -ge 0 ]; do
@@ -92,7 +84,7 @@ for a in "$@"; do
9284
rotated=$((rotated+1))
9385
fi
9486
done
95-
echo "Please set executable_name to a valid name in a text editor" 1>&2
87+
echo "Could not determine game executable launched by Steam" 1>&2
9688
exit 1
9789
fi
9890
done
@@ -191,6 +183,17 @@ executable_path=$(resolve_executable_path "${executable_path}")
191183
# Figure out the arch of the executable with file
192184
file_out="$(LD_PRELOAD="" file -b "${executable_path}")"
193185
case "${file_out}" in
186+
*PE32*)
187+
echo "The executable is a Windows executable file. You must use Wine/Proton and BepInEx for Windows with this executable." 1>&2
188+
echo "Uninstall BepInEx for *nix and install BepInEx for Windows instead." 1>&2
189+
echo "More info: https://docs.bepinex.dev/articles/advanced/steam_interop.html#protonwine" 1>&2
190+
exit 1
191+
;;
192+
*shell\ script*)
193+
# Fallback for games that launch a shell script from Steam
194+
# default to x64, change as needed
195+
arch="x64"
196+
;;
194197
*64-bit*)
195198
arch="x64"
196199
;;

0 commit comments

Comments
 (0)