Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #!/bin/bash
- # checks
- [ ! -x "$(command -v dwarfs)" ] && echo "dwarfs not installed." && exit; [ ! -x "$(command -v fuse-overlayfs)" ] && echo "fuse-overlayfs not installed." && exit;
- cd "$(dirname "$(readlink -f "$0")")" || exit; [ "$EUID" = "0" ] && exit; [ "$1" = "" ] && echo "Commandline can't be blank - choose a game." && exit
- GAME=$1
- export JCD="/home/$(whoami)/Games/jc141"; [ ! -d "$JCD/$GAME" ] && mkdir -p "$JCD/$GAME"
- # wine
- export WINE="$(command -v wine)";
- export WINEPREFIX="$JCD/$GAME"; export WINEDLLOVERRIDES="winemenubuilder.exe=d;mshtml=d;nvapi,nvapi64=n"; export WINE_LARGE_ADDRESS_AWARE=1;
- export GAMEDIR="$WINEPREFIX/drive_c/$GAME"
- # dwarfs
- #bash "$PWD/settings.sh" extract;
- zcat "$PWD/logo.txt.gz"; echo "Path of the $GAME wineprefix is: $WINEPREFIX";
- # external vulkan translation
- #export DXVK_ASYNC=1
- 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"
- VLKVER="$(curl -s -m 5 https://api.github.com/repos/jc141x/vulkan/releases/latest | awk -F '["/]' '/"browser_download_url":/ {print $11}' | cut -c 1-)"
- status-vulkan() { [[ ! -f "$VLKLOG" || -z "$(awk "/^${FUNCNAME[1]}\$/ {print \$1}" "$VLKLOG" 2>/dev/null)" ]] || { echo "${FUNCNAME[1]} present" && return 1; }; }
- 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")"
- [ ! -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; }
- rm -rf "vulkan.tar.xz" && bash "$PWD/vulkan/setup-vulkan.sh" && rm -Rf "$VULKAN"; }
- vulkan-dl() { echo "Using external vulkan translation (dxvk,vkd3d,dxvk-nvapi)." && vulkan && echo "$VLKVER" >"$VLKLOG"; }
- [[ ! -f "$VLKLOG" && -z "$(status-vulkan)" ]] && vulkan-dl;
- [[ -f "$VLKLOG" && -n "$VLKVER" && "$VLKVER" != "$(awk '{print $1}' "$VLKLOG")" ]] && { rm -f vulkan.tar.xz || true; } && vulkan-dl; export DXVK_ENABLE_NVAPI=1
- GSS="$GAMEDIR/start.sh"
- echo ""
- echo "Summary:"
- echo "WINE=$WINE"
- echo "WINEPREFIX=$WINEPREFIX"
- echo "WINEDLLOVERRIDES=$WINEDLLOVERRIDES"
- echo "WINE_LARGE_ADDRESS_AWARE=1"
- echo "VLKLOG=$VLKLOG"
- echo "VULKAN=$VULKAN"
- echo "VULVER=$VULVER"
- echo "DXVK_ENABLE_NVAPI=$DXVK_ENABLE_NVAPI"
- echo "Working Directory=$WINEPREFIX/drive_c/$GAME"
- echo "Command Line: \"$WINE\" \"$PWD/$GAME/setup.exe\" \"\$@\""
- echo "GSS=\"$GSS\""
- echo ""
- sleep 5
- # block WAN
- [ ! -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."; }
- # start
- echo "For any misunderstandings or need of support, join the community on Matrix.";
- [ "${DBG:=0}" = "1" ] || { export WINEDEBUG='-all' && echo "Output muted by default to avoid performance impact. Can unmute with DBG=1." && exec &>/dev/null; }
- #create game starter script
- cat << EOF > $GSS
- #!/bin/bash
- # checks
- [ ! -x "\$(command -v dwarfs)" ] && echo "dwarfs not installed." && exit; [ ! -x "\$(command -v fuse-overlayfs)" ] && echo "fuse-overlayfs not installed." && exit;
- cd "\$(dirname "\$(readlink -f "\$0")")" || exit; [ "\$EUID" = "0" ] && exit
- export JCD="/home/\$(whoami)/Games/jc141"; [ ! -d "\$JCD/$GAME" ] && mkdir -p "\$JCD/$GAME"
- # wine
- export WINE="\$(command -v wine)";
- export WINEPREFIX="\$JCD/$GAME/"; export WINEDLLOVERRIDES="winemenubuilder.exe=d;mshtml=d;nvapi,nvapi64=n"; export WINE_LARGE_ADDRESS_AWARE=1;
- export GAMEDIR="\$WINEPREFIX/drive_c/$GAME/"
- # dwarfs
- #bash "\$PWD/settings.sh" extract;
- zcat "\$PWD/logo.txt.gz"; echo "Path of the $GAME wineprefix is: \$WINEPREFIX";
- # external vulkan translation
- #export DXVK_ASYNC=1
- 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"
- VLKVER="\$(curl -s -m 5 https://api.github.com/repos/jc141x/vulkan/releases/latest | awk -F '["/]' '/"browser_download_url":/ {print \$11}' | cut -c 1-)"
- status-vulkan() { [[ ! -f "\$VLKLOG" || -z "\$(awk "/^\${FUNCNAME[1]}\$/ {print \$1}" "\$VLKLOG" 2>/dev/null)" ]] || { echo "\${FUNCNAME[1]} present" && return 1; }; }
- 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")"
- [ ! -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; }
- rm -rf "vulkan.tar.xz" && bash "\$PWD/vulkan/setup-vulkan.sh" && rm -Rf "\$VULKAN"; }
- vulkan-dl() { echo "Using external vulkan translation (dxvk,vkd3d,dxvk-nvapi)." && vulkan && echo "\$VLKVER" >"\$VLKLOG"; }
- [[ ! -f "\$VLKLOG" && -z "\$(status-vulkan)" ]] && vulkan-dl;
- [[ -f "\$VLKLOG" && -n "\$VLKVER" && "\$VLKVER" != "\$(awk '{print \$1}' "\$VLKLOG")" ]] && { rm -f vulkan.tar.xz || true; } && vulkan-dl; export DXVK_ENABLE_NVAPI=1
- echo ""
- echo "Summary:"
- echo "WINE=\$WINE"
- echo "WINEPREFIX=\$WINEPREFIX"
- echo "WINEDLLOVERRIDES=\$WINEDLLOVERRIDES"
- echo "WINE_LARGE_ADDRESS_AWARE=1"
- echo "VLKLOG=\$VLKLOG"
- echo "VULKAN=\$VULKAN"
- echo "VULVER=\$VULVER"
- echo "DXVK_ENABLE_NVAPI=\$DXVK_ENABLE_NVAPI"
- echo "Working Directory=\$GAMEDIR"
- echo ""
- sleep 5
- # block WAN
- [ ! -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."; }
- # start
- echo "For any misunderstandings or need of support, join the community on Matrix.";
- [ "\${DBG:=0}" = "1" ] || { export WINEDEBUG='-all' && echo "Output muted by default to avoid performance impact. Can unmute with DBG=1." && exec &>/dev/null; }
- cd "\$GAMEDIR"; "\$WINE" "setup.exe" "\$@"
- EOF
- chmod a+x $GSS
- cd "$PWD/$GAME"; "$WINE" "setup.exe" "$@"
- echo ""
- echo "Be sure to change the name of the game executable in $GSS - default is setup.exe"
- echo ""
Advertisement
Advertisement