run_bepinex.sh 2.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465
  1. #!/bin/sh
  2. # BepInEx running script
  3. #
  4. # This script is used to run a Unity game with BepInEx enabled.
  5. #
  6. # Usage: Configure the script below and simply run this script when you want to run your game modded.
  7. echo "Please open run.sh in a text editor and configure executable name. Comment or remove this line when you're done." && exit 1;
  8. # -------- SETTINGS --------
  9. # ---- EDIT AS NEEDED ------
  10. # EDIT THIS: The name of the executable to run
  11. # LINUX: This is the name of the Unity game executable
  12. # MACOS: This is the name of the game app WITHOUT the .app
  13. executable_name="";
  14. # The rest is automatically handled by BepInEx
  15. # Whether or not to enable Doorstop. Valid values: TRUE or FALSE
  16. export DOORSTOP_ENABLE=TRUE;
  17. # What .NET assembly to execute. Valid value is a path to a .NET DLL that mono can execute.
  18. export DOORSTOP_INVOKE_DLL_PATH=${PWD}/BepInEx/core/BepInEx.Preloader.dll;
  19. # ----- DO NOT EDIT FROM THIS LINE FORWARD ------
  20. # ----- (unless you know what you're doing) ------
  21. doorstop_libs=${PWD}/doorstop_libs;
  22. arch="";
  23. executable_path="";
  24. lib_postfix="";
  25. os_type=`uname -s`;
  26. case $os_type in
  27. Linux*) executable_path=${PWD}/${executable_name};
  28. lib_postfix="so";;
  29. Darwin*) executable_path=${PWD}/${executable_name}.app/Contents/MacOS/${executable_name};
  30. lib_postfix="dylib";;
  31. *) echo "Cannot identify OS (got $(uname -s))!";
  32. echo "Please create an issue at https://github.com/BepInEx/BepInEx/issues.";
  33. exit 1;;
  34. esac
  35. executable_type=`file -b "${executable_path}"`;
  36. case $executable_type in
  37. *64-bit*) arch="x64";;
  38. *32-bit*) arch="x86";;
  39. *) echo "Cannot identify executable type (got ${executable_type})!";
  40. echo "Please create an issue at https://github.com/BepInEx/BepInEx/issues.";
  41. exit 1;;
  42. esac
  43. doorstop_libname=libdoorstop_${arch}.${lib_postfix};
  44. case $os_type in
  45. Linux*) export LD_LIBRARY_PATH=${doorstop_libs}:${LD_LIBRARY_PATH};
  46. export LD_PRELOAD=$doorstop_libname;;
  47. Darwin*) export DYLD_LIBRARY_PATH=${doorstop_libs}:${DYLD_LIBRARY_PATH};
  48. export DYLD_INSERT_LIBRARIES=${doorstop_libs}/$doorstop_libname;;
  49. esac
  50. "${executable_path}"