diff options
Diffstat (limited to 'scripts/play-linux.sh')
| -rwxr-xr-x | scripts/play-linux.sh | 74 |
1 files changed, 74 insertions, 0 deletions
diff --git a/scripts/play-linux.sh b/scripts/play-linux.sh new file mode 100755 index 000000000..35a44256f --- /dev/null +++ b/scripts/play-linux.sh | |||
| @@ -0,0 +1,74 @@ | |||
| 1 | #!/bin/sh | ||
| 2 | # Starts Leonida's D3D12 runtime (d3d12/, a Windows program) on Linux under Wine, with the VKD3D-Proton that comes in | ||
| 3 | # the package (scripts/fetch_vkd3d_proton.py puts it in vkd3d-proton/ beside this script), so nothing else needs to be | ||
| 4 | # downloaded for Direct3D 12. Wine itself and a Vulkan driver (Mesa or NVIDIA's) are the system's. | ||
| 5 | # | ||
| 6 | # ./play-linux.sh /path/to/your/game_scarlett_master.exe [--series-x] | ||
| 7 | # | ||
| 8 | # Leonida keeps its own Wine prefix (LEONIDA_WINEPREFIX, default ~/.local/share/leonida/prefix): the bundled | ||
| 9 | # d3d12.dll and d3d12core.dll are installed there and preferred over Wine's (WINEDLLOVERRIDES), so no other prefix | ||
| 10 | # is changed. LEONIDA_* variables already set win over the defaults below. | ||
| 11 | set -eu | ||
| 12 | |||
| 13 | if [ $# -lt 1 ]; then | ||
| 14 | echo "usage: $0 /path/to/game_scarlett_master.exe [--series-x]" >&2 | ||
| 15 | exit 2 | ||
| 16 | fi | ||
| 17 | game_exe=$1 | ||
| 18 | shift | ||
| 19 | console=series-s | ||
| 20 | if [ "${1:-}" = "--series-x" ]; then console=series-x; fi | ||
| 21 | [ -f "$game_exe" ] || { echo "No $game_exe" >&2; exit 1; } | ||
| 22 | |||
| 23 | here=$(cd "$(dirname "$0")" && pwd) | ||
| 24 | runtime=${LEONIDA_RUNTIME:-$here/leonida.exe} | ||
| 25 | vkd3d=${LEONIDA_VKD3D:-$here/vkd3d-proton} | ||
| 26 | [ -f "$runtime" ] || { echo "No $runtime (the Windows build of d3d12/)" >&2; exit 1; } | ||
| 27 | for dll in d3d12.dll d3d12core.dll; do | ||
| 28 | [ -f "$vkd3d/$dll" ] || { echo "No $vkd3d/$dll: run scripts/fetch_vkd3d_proton.py when packaging" >&2; exit 1; } | ||
| 29 | done | ||
| 30 | command -v wine >/dev/null 2>&1 || { echo "Wine is needed (your distribution's wine package, or Proton's)" >&2; exit 1; } | ||
| 31 | |||
| 32 | data=${XDG_DATA_HOME:-$HOME/.local/share}/leonida | ||
| 33 | export WINEPREFIX=${LEONIDA_WINEPREFIX:-$data/prefix} | ||
| 34 | export WINEARCH=win64 | ||
| 35 | if [ ! -d "$WINEPREFIX/drive_c/windows/system32" ]; then | ||
| 36 | echo "Leonida: making its Wine prefix in $WINEPREFIX" | ||
| 37 | mkdir -p "$WINEPREFIX" | ||
| 38 | WINEDEBUG=-all wineboot -u >/dev/null 2>&1 | ||
| 39 | fi | ||
| 40 | # The bundled VKD3D-Proton, copied in when it is missing or differs (a new package). | ||
| 41 | system32=$WINEPREFIX/drive_c/windows/system32 | ||
| 42 | for dll in d3d12.dll d3d12core.dll; do | ||
| 43 | if ! cmp -s "$vkd3d/$dll" "$system32/$dll"; then cp "$vkd3d/$dll" "$system32/$dll"; fi | ||
| 44 | done | ||
| 45 | export WINEDLLOVERRIDES="d3d12,d3d12core=n${WINEDLLOVERRIDES:+;$WINEDLLOVERRIDES}" | ||
| 46 | |||
| 47 | # Where the title's files are, and where the caches and saves go. | ||
| 48 | export LEONIDA_GAME_DIR=${LEONIDA_GAME_DIR:-$(cd "$(dirname "$game_exe")" && pwd)} | ||
| 49 | export LEONIDA_CACHE_DIR=${LEONIDA_CACHE_DIR:-$data/cache} | ||
| 50 | export LEONIDA_DATA_DIR=${LEONIDA_DATA_DIR:-$data/data} | ||
| 51 | mkdir -p "$LEONIDA_CACHE_DIR" "$LEONIDA_DATA_DIR" | ||
| 52 | |||
| 53 | # The settings scripts/play-nvidia.ps1 measured (d3d12/README.md), as defaults. | ||
| 54 | set_default() { eval "[ -n \"\${$1:-}\" ] || export $1=\"$2\""; } | ||
| 55 | set_default LEONIDA_TEXTURE_NO_WAIT 1 | ||
| 56 | set_default LEONIDA_RELAY 2 | ||
| 57 | set_default LEONIDA_CARD_STEPS 2 | ||
| 58 | set_default LEONIDA_DYNAMIC_SLOTS 524288 | ||
| 59 | set_default LEONIDA_PIPELINE_WAIT_MS 10000 | ||
| 60 | set_default LEONIDA_RENDER_SCALE 0.5 | ||
| 61 | set_default LEONIDA_OWN_UPSCALER 1 | ||
| 62 | set_default LEONIDA_BVH_MISS 1 | ||
| 63 | set_default LEONIDA_CARD_BUFFERS_MIN_MB 1 | ||
| 64 | set_default LEONIDA_CARD_BUFFERS_MB 1536 | ||
| 65 | set_default LEONIDA_COMPOSE 1 | ||
| 66 | set_default LEONIDA_NAN_SCRUB 1 | ||
| 67 | set_default LEONIDA_AMBIENT_AIR 1.5 | ||
| 68 | set_default LEONIDA_AMBIENT_MOST 2 | ||
| 69 | # Match the Windows launcher defaults; explicit 0 keeps either path off for comparisons. | ||
| 70 | set_default LEONIDA_COPY_SCOPED 1 | ||
| 71 | set_default LEONIDA_PORT_DESCRIPTORS 1 | ||
| 72 | |||
| 73 | echo "Leonida: $console under Wine with the bundled VKD3D-Proton ($(head -n 1 "$vkd3d/SOURCE.txt" 2>/dev/null || echo bundled))" | ||
| 74 | exec wine "$runtime" run "$game_exe" --execute --console "$console" | ||