#!/bin/bash export WINEDEBUG=-all dlls_dir=`dirname $(readlink -f $0)` build_arch='@arch@' if [ ! -f "$dlls_dir/d3d11.dll" ] || [ ! -f "$dlls_dir/dxgi.dll" ]; then echo "d3d11.dll or dxgi.dll not found in $dlls_dir" exit 1 fi if [ $build_arch == "x86_64" ]; then wine=wine64 else wine=wine fi if [ -z "$WINEPREFIX" ]; then echo "WINEPREFIX is not set, continue? (y/N)" read continue if [ "$continue" != "y" ] && [ "$continue" != "Y" ]; then exit 1 fi fi unix_sys_path="$($wine winepath -u 'C:\windows\system32')" function removeOverride { echo "$1:" echo -n ' [1/2] Removing override... ' wine reg add 'HKEY_CURRENT_USER\Software\Wine\DllOverrides' /v $1 /d builtin /f if [ ! $? ]; then exit 1 fi local dll="$unix_sys_path/$1.dll" echo -n ' [2/2] Removing link... ' if [ -h "$dll" ]; then rm "$dll" if [ "$?" == "0" ]; then echo "Done." fi else echo "'$dll' is not a link or doesn't exist." fi } function createOverride { echo "$1:" echo -n ' [1/2] Creating override... ' wine reg add 'HKEY_CURRENT_USER\Software\Wine\DllOverrides' /v $1 /d native /f echo -n " [2/2] Creating link to $1.dll... " ln -sf "$dlls_dir/$1.dll" "$unix_sys_path/$1.dll" if [ $? ]; then echo "Done." fi } if [ "$1" == "reset" ]; then echo -n '[1/2] ' removeOverride d3d11 echo -n '[2/2] ' removeOverride dxgi elif [ -z "$1" ]; then echo -n '[1/2] ' createOverride d3d11 echo -n '[2/2] ' createOverride dxgi else echo "Unrecognized option: $1" echo "Usage: $0 [reset]" exit 1 fi