summarylogtreecommitdiffstats
path: root/setup_dxvk.patch
blob: 80d69f1a84d9cc9ad29f0c92ab0af36f8ae921e9 (plain)
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
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
diff --git a/setup_dxvk.sh b/setup_dxvk.sh
index f6bb5b7d..01cebf7f 100644
--- a/setup_dxvk.sh
+++ b/setup_dxvk.sh
@@ -50,6 +50,7 @@ if [ -z "$wine" ]; then
 fi
 
 wine64="${wine}64"
+wineboot="${wine}boot"
 
 # resolve 32-bit and 64-bit system32 path
 winever=`$wine --version | grep wine`
@@ -58,6 +59,10 @@ if [ -z "$winever" ]; then
     exit 1
 fi
 
+# ensure wine placeholder dlls are recreated
+# if they are missing
+$wineboot -u
+
 win32_sys_path=$($wine winepath -u 'C:\windows\system32' 2> /dev/null)
 win64_sys_path=$($wine64 winepath -u 'C:\windows\system32' 2> /dev/null)
 
@@ -91,14 +96,14 @@ installFile() {
   if [ -f "${srcfile}.so" ]; then
     srcfile="${srcfile}.so"
   fi
-  
+
   if ! [ -f "${srcfile}" ]; then
-    echo "${srcfile}: File not found" >&2
-    exit 1
+    echo "${srcfile}: File not found. Skipping." >&2
+    return 1
   fi
-  
+
   if [ -n "$1" ]; then
-    if [ -f "${dstfile}" ]; then
+    if [ -f "${dstfile}" ] || [ -h "${dstfile}" ]; then
       if ! [ -f "${dstfile}.old" ]; then
         mv "${dstfile}" "${dstfile}.old"
       else
@@ -107,31 +112,58 @@ installFile() {
       $file_cmd "${srcfile}" "${dstfile}"
     else
       echo "${dstfile}: File not found in wine prefix" >&2
-      exit 1
+      return 1
     fi
   fi
+  return 0
 }
 
 # remove dxvk dll, restore original file
 uninstallFile() {
-  dstfile="${1}/${2}.dll"
-  
+  dstfile="${1}/${3}.dll"
+  srcfile="${basedir}/${2}/${3}.dll"
+
+  if [ -f "${srcfile}.so" ]; then
+    srcfile="${srcfile}.so"
+  fi
+
+  if ! [ -f "${srcfile}" ]; then
+    echo "${srcfile}: File not found. Skipping." >&2
+    return 1
+  fi
+
+  if ! [ -f "${dstfile}" ] && ! [ -h "${dstfile}" ]; then
+    echo "${dstfile}: File not found. Skipping." >&2
+    return 1
+  fi
+
   if [ -f "${dstfile}.old" ]; then
     rm "${dstfile}"
     mv "${dstfile}.old" "${dstfile}"
+    return 0
+  else
+    return 1
   fi
 }
 
 install() {
   installFile "$win32_sys_path" "x32" "$1"
+  inst32_ret="$?"
   installFile "$win64_sys_path" "x64" "$1"
-  overrideDll "$1"
+  inst64_ret="$?"
+  if [ "$inst32_ret" -eq 0 ] || [ "$inst64_ret" -eq 0 ]; then
+    overrideDll "$1"
+  fi
 }
 
 uninstall() {
-  uninstallFile "$win32_sys_path" "$1"
-  uninstallFile "$win64_sys_path" "$1"
-  restoreDll "$1"
+  uninstallFile "$win32_sys_path" "x32" "$1"
+  uninst32_ret="$?"
+  uninstallFile "$win64_sys_path" "x64" "$1"
+  uninst64_ret="$?"
+  if [ "$uninst32_ret" -eq 0 ] || [ "$uninst64_ret" -eq 0 ]; then
+    restoreDll "$1"
+  fi
 }
 
 # skip dxgi during install if not explicitly