-
Notifications
You must be signed in to change notification settings - Fork 2
/
setup_dxvk.sh
executable file
·64 lines (55 loc) · 1.67 KB
/
setup_dxvk.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
#!/bin/sh
declare -A dlls=(
[d3d9]="dxvk/d3d9.dll"
[d3d10]="dxvk/d3d10core.dll"
[d3d11]="dxvk/d3d11.dll"
[dxgi]="dxvk/dxgi.dll"
[mcfgthreads]="mcfgthreads/mcfgthread-12.dll"
)
declare -A targets=([d3d9]=1 [d3d11]=1 [dxgi]=1 [d3d10]=1 [mcfgthreads]=1)
install_file() {
$do_symlink && file_cmd="ln -sv" || file_cmd="install -m 755 -v"
srcfile=$1
dstfile=$2
if [ -f "${srcfile}.so" ]; then
srcfile="${srcfile}.so"
fi
if ! [ -f "${srcfile}" ]; then
echo "${srcfile}: File not found. Skipping." >&2
return 1
fi
if [ -n "$1" ]; then
if [ -f "${dstfile}" ] || [ -h "${dstfile}" ]; then
if ! [ -f "${dstfile}.old" ]; then
mv -v "${dstfile}" "${dstfile}.old"
else
rm -v "${dstfile}"
fi
fi
$file_cmd "${srcfile}" "${dstfile}"
else
echo "${dstfile}: File not found in wine prefix" >&2
return 1
fi
}
install_override() {
dll=$(basename "$1")
if ! wine reg add 'HKEY_CURRENT_USER\Software\Wine\DllOverrides' /v "$dll" /d native /f >/dev/null 2>&1; then
echo -e "Failed to add override for $dll"
exit 1
fi
}
declare -A paths
for target in "${!targets[@]}"; do
[ "${targets[$target]}" -eq 1 ] || continue
for dll in ${dlls[$target]}; do
dllname=$(basename "$dll")
basedir=$(dirname "$dll")
basedir32=${basedir}32_dir
paths["${!basedir32}/$dllname"]="$WINEPREFIX/drive_c/windows/system32/$dllname"
done
done
for srcpath in "${!paths[@]}"; do
install_file "$srcpath" "${paths["$srcpath"]}"
install_override "$(basename "$srcpath" .dll)"
done