Created
November 14, 2021 17:50
-
-
Save LottieVixen/e89f7fc14e3d7038cd677716f86bef6c to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh | |
# BepInEx running script | |
# | |
# HOW TO USE: | |
# 1. Make this script executable with `chmod u+x ./start_game_bepinex.sh` | |
# 2. In Steam, go to game's preferences and change game's launch args to: | |
# ./start_game_bepinex.sh %command% | |
# 3. Start the game via Steam | |
# | |
# Note that you won't get a console this way | |
# | |
# NOTE: Edit the script only if you know what you're doing! | |
# Resolve base directory relative to this script | |
# Hopefully this resolves relative paths and links | |
a="/$0"; a=${a%/*}; a=${a#/}; a=${a:-.}; BASEDIR=$(cd "$a"; pwd -P) | |
# Special case: program is launched via Steam | |
# In that case rerun the script via their bootstrapper to ensure Steam overlay works | |
if [ "$2" = "SteamLaunch" ]; then | |
cmd="$1 $2 $3 $4 $0" | |
shift 4 | |
exec $cmd $@ | |
exit | |
fi | |
export DOORSTOP_ENABLE=TRUE | |
export DOORSTOP_INVOKE_DLL_PATH="$BASEDIR/BepInEx/core/BepInEx.Preloader.dll" | |
# Allow to specify --doorstop-enable true|false | |
# Everything else is passed as-is to `exec` | |
while :; do | |
case $1 in | |
--doorstop-enable) | |
if [ -n "$2" ]; then | |
export DOORSTOP_ENABLE=$(echo "$2" | tr a-z A-Z) | |
shift | |
else | |
echo "No --doorstop-enable value specified, using default!" | |
fi | |
;; | |
--doorstop-target) | |
if [ -n "$2" ]; then | |
export DOORSTOP_INVOKE_DLL_PATH="$2" | |
shift | |
else | |
echo "No --doorstop-target value specified, using default!" | |
fi | |
;; | |
--doorstop-dll-search-override) | |
if [ -n "$2" ]; then | |
export DOORSTOP_CORLIB_OVERRIDE_PATH="$2" | |
shift | |
else | |
echo "No --doorstop-dll-search-override value specified, using default!" | |
fi | |
;; | |
*) | |
if [ -z "$1" ]; then | |
break | |
fi | |
if [ -z "$launch" ]; then | |
launch="$1" | |
else | |
rest="$rest $1" | |
fi | |
;; | |
esac | |
shift | |
done | |
export LD_LIBRARY_PATH="$BASEDIR/doorstop_libs:$LD_LIBRARY_PATH" | |
export LD_PRELOAD="libdoorstop_x64.so:$LD_PRELOAD" | |
# Run the main executable | |
# Don't quote here since $exec may contain args passed by Steam | |
if [ -n "$launch" ]; then | |
exec "$launch" $rest | |
else | |
exec "$exec" | |
fi |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment