Advertisement
EvilSupahFly

Game Installer Script Based on JC141 Script

Dec 27th, 2023 (edited)
1,327
0
Never
1
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Bash 6.38 KB | Source Code | 0 0
  1. #!/bin/bash
  2. # checks
  3. [ ! -x "$(command -v dwarfs)" ] && echo "dwarfs not installed." && exit; [ ! -x "$(command -v fuse-overlayfs)" ] && echo "fuse-overlayfs not installed." && exit;
  4. cd "$(dirname "$(readlink -f "$0")")" || exit; [ "$EUID" = "0" ] && exit; [ "$1" = "" ] && echo "Commandline can't be blank - choose a game." && exit
  5.  
  6. GAME=$1
  7. export JCD="/home/$(whoami)/Games/jc141"; [ ! -d "$JCD/$GAME" ] && mkdir -p "$JCD/$GAME"
  8.  
  9. # wine
  10. export WINE="$(command -v wine)";
  11. export WINEPREFIX="$JCD/$GAME"; export WINEDLLOVERRIDES="winemenubuilder.exe=d;mshtml=d;nvapi,nvapi64=n"; export WINE_LARGE_ADDRESS_AWARE=1;
  12. export GAMEDIR="$WINEPREFIX/drive_c/$GAME"
  13.  
  14. # dwarfs
  15. #bash "$PWD/settings.sh" extract;
  16. zcat "$PWD/logo.txt.gz"; echo "Path of the $GAME wineprefix is: $WINEPREFIX";
  17.  
  18. # external vulkan translation
  19. #export DXVK_ASYNC=1
  20.  
  21. ping -c 1 github.com >/dev/null || { echo "Possibly no network. This may mean that booting will fail." ; }; VLKLOG="$WINEPREFIX/vulkan.log"; VULKAN="$PWD/vulkan"
  22. VLKVER="$(curl -s -m 5 https://api.github.com/repos/jc141x/vulkan/releases/latest | awk -F '["/]' '/"browser_download_url":/ {print $11}' | cut -c 1-)"
  23. status-vulkan() { [[ ! -f "$VLKLOG" || -z "$(awk "/^${FUNCNAME[1]}\$/ {print \$1}" "$VLKLOG" 2>/dev/null)" ]] || { echo "${FUNCNAME[1]} present" && return 1; }; }
  24. vulkan() { DL_URL="$(curl -s https://api.github.com/repos/jc141x/vulkan/releases/latest | awk -F '["]' '/"browser_download_url":/ {print $4}')"; VLK="$(basename "$DL_URL")"
  25. [ ! -f "$VLK" ] && command -v curl >/dev/null 2>&1 && curl -LO "$DL_URL" && tar -xvf "vulkan.tar.xz" || { rm "$VLK" && echo "ERROR: Failed to extract vulkan translation." && return 1; }
  26. rm -rf "vulkan.tar.xz" && bash "$PWD/vulkan/setup-vulkan.sh" && rm -Rf "$VULKAN"; }
  27. vulkan-dl() { echo "Using external vulkan translation (dxvk,vkd3d,dxvk-nvapi)." && vulkan && echo "$VLKVER" >"$VLKLOG"; }
  28. [[ ! -f "$VLKLOG" && -z "$(status-vulkan)" ]] && vulkan-dl;
  29. [[ -f "$VLKLOG" && -n "$VLKVER" && "$VLKVER" != "$(awk '{print $1}' "$VLKLOG")" ]] && { rm -f vulkan.tar.xz || true; } && vulkan-dl; export DXVK_ENABLE_NVAPI=1
  30. GSS="$GAMEDIR/start.sh"
  31.  
  32. echo ""
  33. echo "Summary:"
  34. echo "WINE=$WINE"
  35. echo "WINEPREFIX=$WINEPREFIX"
  36. echo "WINEDLLOVERRIDES=$WINEDLLOVERRIDES"
  37. echo "WINE_LARGE_ADDRESS_AWARE=1"
  38. echo "VLKLOG=$VLKLOG"
  39. echo "VULKAN=$VULKAN"
  40. echo "VULVER=$VULVER"
  41. echo "DXVK_ENABLE_NVAPI=$DXVK_ENABLE_NVAPI"
  42. echo "Working Directory=$WINEPREFIX/drive_c/$GAME"
  43. echo "Command Line: \"$WINE\" \"$PWD/$GAME/setup.exe\" \"\$@\""
  44. echo "GSS=\"$GSS\""
  45. echo ""
  46. sleep 5
  47.  
  48. # block WAN
  49. [ ! -f "/usr/lib64/bindToInterface.so" ] && echo "bindtointerface package not installed, no WAN blocking." || [ "${WANBLK:=1}" = "0" ] && echo "WAN blocking is not enabled due to user input." || { export BIND_INTERFACE=lo; export BIND_EXCLUDE=10.,172.16.,192.168.; export LD_PRELOAD='/usr/$LIB/bindToInterface.so'; echo "bindtointerface WAN blocking enabled."; }
  50.  
  51. # start
  52. echo "For any misunderstandings or need of support, join the community on Matrix.";
  53. [ "${DBG:=0}" = "1" ] || { export WINEDEBUG='-all' && echo "Output muted by default to avoid performance impact. Can unmute with DBG=1." && exec &>/dev/null; }
  54.  
  55. #create game starter script
  56.  
  57. cat << EOF > $GSS
  58. #!/bin/bash
  59. # checks
  60. [ ! -x "\$(command -v dwarfs)" ] && echo "dwarfs not installed." && exit; [ ! -x "\$(command -v fuse-overlayfs)" ] && echo "fuse-overlayfs not installed." && exit;
  61. cd "\$(dirname "\$(readlink -f "\$0")")" || exit; [ "\$EUID" = "0" ] && exit
  62.  
  63. export JCD="/home/\$(whoami)/Games/jc141"; [ ! -d "\$JCD/$GAME" ] && mkdir -p "\$JCD/$GAME"
  64.  
  65. # wine
  66. export WINE="\$(command -v wine)";
  67. export WINEPREFIX="\$JCD/$GAME/"; export WINEDLLOVERRIDES="winemenubuilder.exe=d;mshtml=d;nvapi,nvapi64=n"; export WINE_LARGE_ADDRESS_AWARE=1;
  68. export GAMEDIR="\$WINEPREFIX/drive_c/$GAME/"
  69.  
  70. # dwarfs
  71. #bash "\$PWD/settings.sh" extract;
  72. zcat "\$PWD/logo.txt.gz"; echo "Path of the $GAME wineprefix is: \$WINEPREFIX";
  73.  
  74. # external vulkan translation
  75. #export DXVK_ASYNC=1
  76.  
  77. ping -c 1 github.com >/dev/null || { echo "Possibly no network. This may mean that booting will fail." ; }; VLKLOG="\$WINEPREFIX/vulkan.log"; VULKAN="\$PWD/vulkan"
  78. VLKVER="\$(curl -s -m 5 https://api.github.com/repos/jc141x/vulkan/releases/latest | awk -F '["/]' '/"browser_download_url":/ {print \$11}' | cut -c 1-)"
  79. status-vulkan() { [[ ! -f "\$VLKLOG" || -z "\$(awk "/^\${FUNCNAME[1]}\$/ {print \$1}" "\$VLKLOG" 2>/dev/null)" ]] || { echo "\${FUNCNAME[1]} present" && return 1; }; }
  80. vulkan() { DL_URL="\$(curl -s https://api.github.com/repos/jc141x/vulkan/releases/latest | awk -F '["]' '/"browser_download_url":/ {print \$4}')"; VLK="\$(basename "\$DL_URL")"
  81. [ ! -f "\$VLK" ] && command -v curl >/dev/null 2>&1 && curl -LO "\$DL_URL" && tar -xvf "vulkan.tar.xz" || { rm "\$VLK" && echo "ERROR: Failed to extract vulkan translation." && return 1; }
  82. rm -rf "vulkan.tar.xz" && bash "\$PWD/vulkan/setup-vulkan.sh" && rm -Rf "\$VULKAN"; }
  83. vulkan-dl() { echo "Using external vulkan translation (dxvk,vkd3d,dxvk-nvapi)." && vulkan && echo "\$VLKVER" >"\$VLKLOG"; }
  84. [[ ! -f "\$VLKLOG" && -z "\$(status-vulkan)" ]] && vulkan-dl;
  85. [[ -f "\$VLKLOG" && -n "\$VLKVER" && "\$VLKVER" != "\$(awk '{print \$1}' "\$VLKLOG")" ]] && { rm -f vulkan.tar.xz || true; } && vulkan-dl; export DXVK_ENABLE_NVAPI=1
  86.  
  87. echo ""
  88. echo "Summary:"
  89. echo "WINE=\$WINE"
  90. echo "WINEPREFIX=\$WINEPREFIX"
  91. echo "WINEDLLOVERRIDES=\$WINEDLLOVERRIDES"
  92. echo "WINE_LARGE_ADDRESS_AWARE=1"
  93. echo "VLKLOG=\$VLKLOG"
  94. echo "VULKAN=\$VULKAN"
  95. echo "VULVER=\$VULVER"
  96. echo "DXVK_ENABLE_NVAPI=\$DXVK_ENABLE_NVAPI"
  97. echo "Working Directory=\$GAMEDIR"
  98. echo ""
  99. sleep 5
  100.  
  101. # block WAN
  102. [ ! -f "/usr/lib64/bindToInterface.so" ] && echo "bindtointerface package not installed, no WAN blocking." || [ "\${WANBLK:=1}" = "0" ] && echo "WAN blocking is not enabled due to user input." || { export BIND_INTERFACE=lo; export BIND_EXCLUDE=10.,172.16.,192.168.; export LD_PRELOAD='/usr/\$LIB/bindToInterface.so'; echo "bindtointerface WAN blocking enabled."; }
  103.  
  104. # start
  105. echo "For any misunderstandings or need of support, join the community on Matrix.";
  106. [ "\${DBG:=0}" = "1" ] || { export WINEDEBUG='-all' && echo "Output muted by default to avoid performance impact. Can unmute with DBG=1." && exec &>/dev/null; }
  107. cd "\$GAMEDIR"; "\$WINE" "setup.exe" "\$@"
  108. EOF
  109. chmod a+x $GSS
  110.  
  111. cd "$PWD/$GAME"; "$WINE" "setup.exe" "$@"
  112.  
  113. echo ""
  114. echo "Be sure to change the name of the game executable in $GSS - default is setup.exe"
  115. echo ""
Advertisement
Comments
Add Comment
Please, Sign In to add comment
Advertisement