Skip to content

Instantly share code, notes, and snippets.

@user5145
Last active December 21, 2019 09:56
Show Gist options
  • Save user5145/b2e562127d139b98e6f24f1c7a5c1f65 to your computer and use it in GitHub Desktop.
Save user5145/b2e562127d139b98e6f24f1c7a5c1f65 to your computer and use it in GitHub Desktop.
wine starter
#!/usr/bin/env sh
#
# it's a script that is supposed to remove ankama craziness from linux dofus version
# by downloading it's own wine and dxvk.
# adobe air uses direct 11 on windows 8+ and dofus uses adobe air
#
FILE_PATH=$(realpath $0)
DIR_PATH=$(dirname ${FILE_PATH})
GAME="Ankama Launcher-Setup-x86_64.AppImage"
WINE_VERSION=4.0.3
WINE32="${DIR_PATH}/dofus/wine/upstream-linux-x86/wine-${WINE_VERSION}"
WINE64="${DIR_PATH}/dofus/wine/upstream-linux-amd64/wine-${WINE_VERSION}"
PATH=${WINE64}/bin:${WINE32}/bin:${PATH}
DXVK_INSTALL_DIR="${DIR_PATH}/dofus/wine/"
DXVK_HOME_DIR="${DIR_PATH}/dofus/wine/dxvk-1.4.6"
export WINEPREFIX="${DIR_PATH}/dofus/wine-prefix"
prepareDxvkBin(){
echo "downloading dxvk binary into ${DXVK_HOME_DIR}"
wget https://github.com/doitsujin/dxvk/releases/download/v1.4.6/dxvk-1.4.6.tar.gz --directory-prefix /tmp/
mkdir -p ${DXVK_INSTALL_DIR}
tar -xf /tmp/dxvk-1.4.6.tar.gz -C ${DXVK_INSTALL_DIR}
}
# https://www.playonlinux.com/wine/binaries/phoenicis
prepareWineBin(){
echo "downloading wine binary into ${WINE32} and ${WINE64}"
wget https://www.playonlinux.com/wine/binaries/phoenicis/upstream-linux-x86/PlayOnLinux-wine-4.0.3-upstream-linux-x86.tar.gz --directory-prefix /tmp/
mkdir -p ${WINE32}
tar -xf /tmp/PlayOnLinux-wine-4.0.3-upstream-linux-x86.tar.gz -C ${WINE32}
#wget https://www.playonlinux.com/wine/binaries/phoenicis/upstream-linux-amd64/PlayOnLinux-wine-4.0.3-upstream-linux-amd64.tar.gz --directory-prefix /tmp/
#mkdir -p ${WINE64}
#tar -xf /tmp/PlayOnLinux-wine-4.0.3-upstream-linux-x86.tar.gz -C ${WINE64}
}
clearWinVersion(){
echo "Clear Windows Version"
${WINE32}/bin/wine reg delete 'HKLM\Software\Microsoft\Windows\CurrentVersion' /v SubVersionNumber /f
${WINE32}/bin/wine reg delete 'HKLM\Software\Microsoft\Windows\CurrentVersion' /v VersionNumber /f
${WINE32}/bin/wine reg delete 'HKLM\Software\Microsoft\Windows NT\CurrentVersion' /v CSDVersion /f
${WINE32}/bin/wine reg delete 'HKLM\Software\Microsoft\Windows NT\CurrentVersion' /v CurrentVersion /f
${WINE32}/bin/wine reg delete 'HKLM\Software\Microsoft\Windows NT\CurrentVersion' /v CurrentBuildNumber /f
${WINE32}/bin/wine reg delete 'HKLM\System\CurrentControlSet\Control\ProductOptions' /v ProductType /f
${WINE32}/bin/wine reg delete 'HKLM\System\CurrentControlSet\Control\ServiceCurrent' /v OS /f
${WINE32}/bin/wine reg delete 'HKLM\System\CurrentControlSet\Control\Windows' /v CSDVersion /f
${WINE32}/bin/wine reg delete 'HKCU\Software\Wine' /v Version /f
${WINE32}/bin/wine reg delete 'HKLM\System\CurrentControlSet\Control\ProductOptions' /v ProductType /f
}
setWinVersionto81(){
echo "Set Windows Version to 8.1 (9)"
${WINE32}/bin/wine reg add 'HKLM\System\CurrentControlSet\Control\ProductOptions' /v ProductType /d 'WinNT' /f
${WINE32}/bin/wine reg add 'HKEY_LOCAL_MACHINE\Software\Microsoft\Windows NT\CurrentVersion' /v CSDVersion /d '' /f
${WINE32}/bin/wine reg add 'HKEY_LOCAL_MACHINE\Software\Microsoft\Windows NT\CurrentVersion' /v CurrentBuildNumber /d '9600' /f
${WINE32}/bin/wine reg add 'HKEY_LOCAL_MACHINE\Software\Microsoft\Windows NT\CurrentVersion' /v CurrentVersion /d '6.3' /f
${WINE32}/bin/wine reg add 'HKEY_LOCAL_MACHINE\System\CurrentControlSet\Control\Windows' /v CSDVersion /t REG_DWORD /d 00000000 /f
}
echo "launching ${GAME} in ${DIR_PATH}"
prepareWineBin
prepareDxvkBin
wineboot
setWinVersionto81
"${DXVK_HOME_DIR}/setup_dxvk.sh" "uninstall"
"${DXVK_HOME_DIR}/setup_dxvk.sh" "install"
"${DIR_PATH}/$GAME"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment