From dd615deb94d9181a98f4fca857d251d2b80560e4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Hannes=20K=C3=B6rber?= Date: Fri, 13 Aug 2021 18:54:22 +0200 Subject: [PATCH] Add gothic install scripts --- scripts/install-gothic.sh | 79 +++++++++++++--- scripts/install-gothic2.sh | 183 +++++++++++++++++++++++++++++++++++++ 2 files changed, 248 insertions(+), 14 deletions(-) create mode 100755 scripts/install-gothic2.sh diff --git a/scripts/install-gothic.sh b/scripts/install-gothic.sh index 77f9fb0..59008f1 100755 --- a/scripts/install-gothic.sh +++ b/scripts/install-gothic.sh @@ -1,6 +1,13 @@ #!/usr/bin/env bash -read -p "Make sure that gothic was installed via Steam! to continue, to abort " +# Steam setting: Proton 4.11-13 +# +# * It *must not* have any symlinks for the directmusic dlls like: +# pfx/dosdevices/c:/windows/syswow64/dmusic.dll + +STEAMAPPS=/var/games/steamapps/ + +read -p "Make sure that gothic was installed via Steam and started once! to continue, to abort " set -o nounset set -o xtrace @@ -11,20 +18,58 @@ downloaddir=~/download/gothic mkdir -p "${downloaddir}" cd "${downloaddir}" -curl -L -o gothic_patch_108k.exe "https://www.worldofgothic.de/download.php?id=15" -curl -L -o gothic1_playerkit-1.08k.exe "https://www.worldofgothic.de/download.php?id=61" -curl -L -o Definitive_Edition_1_4_2.exe "https://www.worldofgothic.de/download.php?id=1586" -curl -L -O https://github.com/GothicFixTeam/GothicFix/releases/download/v1.8/G1Classic-SystemPack-1.8.exe -curl -L -O https://github.com/GothicFixTeam/GothicFix/releases/download/v1.8/Gothic1_PlayerKit-2.8.exe +curl -C - -L -o gothic_patch_108k.exe "https://www.worldofgothic.de/download.php?id=15" +curl -C - -L -o gothic1_playerkit-1.08k.exe "https://www.worldofgothic.de/download.php?id=61" -read -p "During installation, use \"Z:\\var\\games\\steamapps\\common\\Gothic\\\" as the install directory! to continue, to abort " +curl -C - -L -o Definitive_Edition_1_4_5.exe "https://www.worldofgothic.de/download.php?id=1586" -export WINEPREFIX=/var/games/steamapps/compatdata/65540/pfx/ +# superseded by union +curl -C - -L -O https://github.com/GothicFixTeam/GothicFix/releases/download/v1.8/G1Classic-SystemPack-1.8.exe -wine "${downloaddir}"/gothic1_playerkit-1.08k.exe -wine "${downloaddir}"/Gothic1_PlayerKit-2.8.exe +# curl -C - -L -O https://github.com/GothicFixTeam/GothicFix/releases/download/v1.8/Gothic1_PlayerKit-2.8.exe + +curl -C - -L -o Ninja-2.5.09.exe "https://www.worldofgothic.de/download.php?id=1626" +# curl -C - -L -o Union_1.0j_22.02.2021.exe "https://www.worldofgothic.de/download.php?id=1625" + +curl -C - -L -o G1CP-1.0.0.exe "https://www.worldofgothic.de/download.php?id=1636" + +#curl -C - -L -o Spine_1.29.0.exe "https://www.worldofgothic.de/download.php?id=1417" + +curl -C - -L -o Gothic1-GD3D11-17.7-dev16.zip https://github.com/Kirides/GD3D11/releases/download/v17.7-dev16/Gothic1-GD3D11-17.7-dev16.zip +curl -C - -L -o RiisisGothic1TextureMixV1.1.zip "https://www.worldofgothic.de/download.php?id=1458" + +read -p 'During installation, use "Z:\var\games\steamapps\common\Gothic\" as the install directory! to continue, to abort ' + + +export WINEPREFIX="${STEAMAPPS}/compatdata/65540/pfx/" + +#winetricks dxvk +winetricks directmusic + +#read -p "In winecfg, go to Libraries tab, in 'existing overrides' search for 'dsound', select it and press remove button " +#winecfg + +# wine "${downloaddir}"/gothic_patch_108k.exe +# wine "${downloaddir}"/gothic1_playerkit-1.08k.exe + +# wine "${downloaddir}"/Gothic1_PlayerKit-2.8.exe wine "${downloaddir}"/G1Classic-SystemPack-1.8.exe -wine "${downloaddir}"/Definitive_Edition_1_4_2.exe + +wine "${downloaddir}"/Ninja-2.5.09.exe + +# cmd="${WINEPREFIX}/dosdevices/c:/windows/syswow64/cmd.exe" +# cmdtarget="$(readlink "${cmd}")" +# rm "${WINEPREFIX}/dosdevices/c:/windows/syswow64/cmd.exe" +# winetricks cmd # for union install +# wine "${downloaddir}"/Union_1.0j_22.02.2021.exe +# ln -sf "$cmdtarget" "$cmd" + +wine "${downloaddir}"/G1CP-1.0.0.exe +wine "${downloaddir}"/Definitive_Edition_1_4_5.exe + +unzip -u "${downloaddir}"/Gothic1-GD3D11-17.7-dev16.zip -d "${STEAMAPPS}/common/Gothic/system" +unzip -u "${downloaddir}"/RiisisGothic1TextureMixV1.1.zip -d "${STEAMAPPS}/common/Gothic/Data" + read -p "Now run the game once and exit! to continue, to abort " @@ -33,22 +78,28 @@ cd /var/games/steamapps/common/Gothic sed -i 's/^playLogoVideos=.*$/playLogoVideos=0\r/' system/Gothic.ini sed -i 's/^sightValue=.*$/sightValue=14\r/' system/Gothic.ini sed -i 's/^modelDetail=.*$/modelDetail=1\r/' system/Gothic.ini -sed -i 's/^subTitles=.*$/subTitles=0\r/' system/Gothic.ini -sed -i 's/^bloodDetail=.*$/bloodDetail=3\r/' system/Gothic.ini +sed -i 's/^subTitles=.*$/subTitles=1\r/' system/Gothic.ini +sed -i 's/^animatedWindows=.*$/animatedWindows=0\r/' system/Gothic.ini +sed -i 's/^bloodDetail=.*$/bloodDetail=2\r/' system/Gothic.ini sed -i 's/^zVidResFullscreenX=.*$/zVidResFullscreenX=2560\r/' system/Gothic.ini sed -i 's/^zVidResFullscreenY=.*$/zVidResFullscreenY=1440\r/' system/Gothic.ini +sed -i 's/^zDetailTexturesEnabled=.*$/zDetailTexturesEnabled=1\r/' system/Gothic.ini +sed -i 's/^zSubdivSurfacesEnabled=.*$/zSubdivSurfacesEnabled=1\r/' system/Gothic.ini sed -i 's/^SimpleWindow=.*$/SimpleWindow=0\r/' system/SystemPack.ini sed -i 's/^Gothic2_Control=.*$/Gothic2_Control=1\r/' system/SystemPack.ini sed -i 's/^USInternationalKeyboardLayout=.*$/USInternationalKeyboardLayout=0\r/' system/SystemPack.ini sed -i 's/^FPS_Limit=.*$/FPS_Limit=144\r/' system/SystemPack.ini -sed -i 's/^VerticalFOV=.*$/VerticalFOV=50.625\r/' system/SystemPack.ini +sed -i 's/^VerticalFOV=.*$/VerticalFOV=85\r/' system/SystemPack.ini sed -i 's/^OutDoorPortalDistanceMultiplier=.*$/OutDoorPortalDistanceMultiplier=3\r/' system/SystemPack.ini sed -i 's/^InDoorPortalDistanceMultiplier=.*$/InDoorPortalDistanceMultiplier=3\r/' system/SystemPack.ini sed -i 's/^WoodPortalDistanceMultiplier=.*$/WoodPortalDistanceMultiplier=3\r/' system/SystemPack.ini sed -i 's/^DrawDistanceMultiplier=.*$/DrawDistanceMultiplier=3\r/' system/SystemPack.ini +sed -i 's/^keyDelayRate=.*$/keyDelayRate=50\r/' system/SystemPack.ini +sed -i 's/^keyDelayFirst=.*$/keyDelayFirst=150\r/' system/SystemPack.ini + sed -i 's/^HideFocus=.*$/HideFocus=0\r/' system/SystemPack.ini sed -i 's/^Scale=.*$/Scale=1.9\r/' system/SystemPack.ini diff --git a/scripts/install-gothic2.sh b/scripts/install-gothic2.sh new file mode 100755 index 0000000..bc72544 --- /dev/null +++ b/scripts/install-gothic2.sh @@ -0,0 +1,183 @@ +#!/usr/bin/env bash + +set -o nounset +set -o xtrace +set -o errexit + +BASEDIR=/var/games/gothic2 + +export GAMEDATA=${BASEDIR}/data/ +export ARCHIVE=${BASEDIR}/gothic2.data.tar.zstd +export WINEPREFIX=${BASEDIR}/wineprefix +export WINEARCH=win64 + +export WINEVERSION=6.3 + +DOWNLOADDIR=~/download/gothic2 + +mkdir -p "${WINEPREFIX}" + +if [[ "$(wine --version)" != "wine-${WINEVERSION}" ]] ; then + printf '%s\n' "Wine version ${WINEVERSION} required" >&2 + exit 1 +fi + +archive() { + origin="$1" + if [[ -e "${ARCHIVE}" ]] ; then + return + fi + tar -cv --zstd -p -f "${ARCHIVE}" -C "$1" . +} + +extract() { + if [[ -e "${GAMEDATA}" ]] ; then + return + fi + + mkdir -p "${GAMEDATA}" + tar x --zstd -f "${ARCHIVE}" -C "${GAMEDATA}" +} + +start() { + # For the DX11 renderer, PWD has to be the folder containing the "GD3D11" folder + cd "${GAMEDATA}/system/" + + # There is a bug in the DX11 renderer that leads to the mouse cursor always + # being visible + # + # See https://bugs.winehq.org/show_bug.cgi?id=48483 + # + # Workaround is to disable the cursor completely during gameplay + # if command -v unclutter >/dev/null ; then + # unclutter --timeout 0 --jitter 100000 --ignore-scrolling & + # pid=$! + # trap "kill $pid" EXIT + # else + # echo "WARNING: Unclutter not installed, cannot disable mouse cursor" + # fi + + wine ./Gothic2.exe +} + +ini() { + cd "${GAMEDATA}" + + set_ini() { + local file="$1" + local key="$2" + local value="$3" + if ! grep -q "^${key}=" "${file}" ; then + echo "Key ${key} not fmund in ${file}" + exit 1 + fi + + sed -i "s/^${key}=.*$/${key}=${value}\r/" "${file}" + } + + set_ini system/Gothic.ini sightValue 14 + set_ini system/Gothic.ini modelDetail 1 + set_ini system/Gothic.ini animatedWindows 0 + set_ini system/Gothic.ini playLogoVideos 0 + set_ini system/Gothic.ini useGothic1Controls 1 + set_ini system/Gothic.ini keyDelayRate 50 + set_ini system/Gothic.ini keyDelayFirst 150 + set_ini system/Gothic.ini subTitles 1 + set_ini system/Gothic.ini invMaxColumns 8 + set_ini system/Gothic.ini invMaxRows 0 + set_ini system/Gothic.ini useQuickSaveKeys 1 + set_ini system/Gothic.ini zVidResFullscreenX 2560 + set_ini system/Gothic.ini zVidResFullscreenY 1440 + set_ini system/Gothic.ini zVidResFullscreenBPP 32 + set_ini system/Gothic.ini zRainWindScale 0.1 + set_ini system/Gothic.ini zMouseRotationScale 15.0 + set_ini system/Gothic.ini zSmoothMouse 0 + + set_ini system/SystemPack.ini VerticalFOV 85.0 + set_ini system/SystemPack.ini DrawDistanceMultiplier 3 + set_ini system/SystemPack.ini OutDoorPortalDistanceMultiplier 3 + set_ini system/SystemPack.ini InDoorPortalDistanceMultiplier 3 +} + + +case $1 in + install) + extract + + mkdir -p "${DOWNLOADDIR}" + cd "${DOWNLOADDIR}" + + curl -C - -L -o g2addon-2_6.exe "https://www.worldofgothic.de/download.php?id=173" + curl -C - -L -o gothic2_fix-2.6.0.0-rev2.exe "https://www.worldofgothic.de/download.php?id=833" + curl -C - -L -o gothic2_playerkit-2.6f.exe "https://www.worldofgothic.de/download.php?id=518" + curl -C - -L -o G2NoTR-SystemPack-1.8.exe "https://www.worldofgothic.de/download.php?id=1525" + + curl -C - -L -o LHiver204_DE_22-06-20.exe "https://www.worldofgothic.de/download.php?id=1580" + + curl -C - -L -o LaaHack.zip "https://www.worldofgothic.de/download.php?id=1457" + + curl -C - -L -O "https://github.com/Kirides/GD3D11/releases/download/v17.7-dev20/Gothic2-GD3D11-v17.7-dev20.zip" + + curl -C - -L -o Normalmaps_LHiver.zip "http://www.gothic-dx11.de/download/Normalmaps_LHiver.zip" + + curl -C - -L -O https://github.com/Kirides/ninja-quickloot/releases/download/v1.9.5/Quickloot.vdf + + curl -C - -L -O https://github.com/szapp/Ninja/releases/download/v2.7.12/Ninja-2.7.12.exe + + laatmp=$(mktemp -d) + + unzip -o LaaHack.zip -d "${laatmp}" + + # winetricks -q dxvk + winetricks -q directmusic + if command -v setup_dxvk >/dev/null ; then + setup_dxvk install + else + echo "WARNING: Using dxvk via winetricks, untested" + winetricks dxvk + fi + + read -p 'During installation, use "Z:\var\games\gothic2\data" as the install directory! to continue, to abort ' + + wine "${DOWNLOADDIR}"/g2addon-2_6.exe + wine "${DOWNLOADDIR}"/gothic2_fix-2.6.0.0-rev2.exe + wine "${DOWNLOADDIR}"/gothic2_playerkit-2.6f.exe + wine "${DOWNLOADDIR}"/G2NoTR-SystemPack-1.8.exe + wine "${DOWNLOADDIR}"/LHiver204_DE_22-06-20.exe + wine "${DOWNLOADDIR}"/Ninja-2.7.12.exe + + cd "${GAMEDATA}" + + unzip -o "${DOWNLOADDIR}"/Gothic2-GD3D11-v17.7-dev20.zip -d ./system/ + + cp "${DOWNLOADDIR}"/Quickloot.vdf ./Data + + t="./system/GD3D11/Textures/replacements/Normalmaps_xxx" + mkdir -p "${t}" + unzip -o "${DOWNLOADDIR}"/Normalmaps_LHiver.zip -d "${t}" + unset t + + read -p "For the LAA Hack, select only ${GAMEDATA}/system/Gothic2.exe [ to continue] " + wine "${laatmp}"/LaaHack.exe + rm -rf "${laatmp}" + + # Required to create all ini files + read -p "Now run the game once and exit! [ to continue] " + + ini + ln Data/ModVDF/LHE204_DE.mod Data/LHE204_DE.mod + ;; + ini) + ini + ;; + start) + export WINEDLLOVERRIDES="ddraw=n,b;dsound=b,n;d3dcompiler_47=n,b" + start + ;; + archive) + archive "$2" + ;; + exec) + "${@}" + ;; +esac