1
1
#! /bin/sh
2
2
3
3
prefix_addition=" "
4
+ with_dxvk=" yes"
4
5
5
6
configure_dxvk () {
6
- local version download_dir
7
+ local version download_dir check_recent_ver sys32_path sys64_path
8
+
9
+ printf " Vulkan device found. Configuring DXVK...\n"
10
+
11
+ # New drivers should support Vulkan 1.3
12
+ check_recent_ver=$( vulkaninfo | grep -o " 1\.3" )
13
+ if [ " $check_recent_ver " ]; then
14
+ printf " Vulkan 1.3 device detected, using the latest DXVK version...\n"
15
+ version=" 2.2"
16
+
17
+ else
18
+ printf " No Vulkan 1.3 device detected. Using the latest legacy DXVK version (1.10.3)\n"
19
+ version=" 1.10.3"
20
+
21
+ fi
7
22
8
- echo " Vulkan device found. Configuring DXVK..."
9
- version=" 1.10.3"
10
23
download_dir=" ~/.local/share/shin/tools"
11
- wget -P " $download_dir " " https://github.com/doitsujin/dxvk/releases/download/v${version} /dxvk-${version} .tar.gz"
24
+ wget -P -q " $download_dir " " https://github.com/doitsujin/dxvk/releases/download/v${version} /dxvk-${version} .tar.gz"
12
25
tar -xf " $download_dir /dxvk-${version} .tar.gz" -C " $download_dir "
13
- WINEPREFIX=" $1 " " $download_dir /dxvk-$version /setup-dxvk.sh install" > /dev/null 2>&1
26
+
27
+ cd " $download_dir /dxvk-${version} "
28
+
29
+ # Someone please shorten this
30
+ # Install 32-bit libraries
31
+ sys32_path=" $1 /drive_c/windows/system32"
32
+ mv " $sys32_path /d3d10_1.dll" " $sys32_path /d3d10_1.dll.old"
33
+ mv " $sys32_path /d3d10core.dll" " $sys32_path /d3d10core.dll.old"
34
+ mv " $sys32_path /d3d10.dll" " $sys32_path /d3d10.dll.old"
35
+ mv " $sys32_path /d3d9.dll" " $sys32_path /d3d9.dll.old"
36
+ mv " $sys32_path /d3d11.dll" " $sys32_path /d3d11.dll.old"
37
+ mv " $sys32_path /dxgi.dll" " $sys32_path /dxgi.dll.old"
38
+ cp " x32/*.dll" " $sys32_path "
39
+
40
+ # Install 64-bit libraries
41
+ sys64_path=" $1 /drive_c/windows/syswow64"
42
+ mv " $sys64_path /d3d10_1.dll" " $sys64_path /d3d10_1.dll.old"
43
+ mv " $sys64_path /d3d10core.dll" " $sys64_path /d3d10core.dll.old"
44
+ mv " $sys64_path /d3d10.dll" " $sys64_path /d3d10.dll.old"
45
+ mv " $sys64_path /d3d9.dll" " $sys64_path /d3d9.dll.old"
46
+ mv " $sys64_path /d3d11.dll" " $sys64_path /d3d11.dll.old"
47
+ mv " $sys64_path /dxgi.dll" " $sys64_path /dxgi.dll.old"
48
+ cp " x64/*.dll" " $sys64_path "
49
+
50
+ export WINEPREFIX=" $1 "
51
+ wine reg add ' HKEY_CURRENT_USER\Software\Wine\DllOverrides' /v d3d10_1 /d native /f > /dev/null 2>&1
52
+ wine reg add ' HKEY_CURRENT_USER\Software\Wine\DllOverrides' /v d3d10 /d native /f > /dev/null 2>&1
53
+ wine reg add ' HKEY_CURRENT_USER\Software\Wine\DllOverrides' /v d3d10core /d native /f > /dev/null 2>&1
54
+ wine reg add ' HKEY_CURRENT_USER\Software\Wine\DllOverrides' /v d3d9 /d native /f > /dev/null 2>&1
55
+ wine reg add ' HKEY_CURRENT_USER\Software\Wine\DllOverrides' /v d3d11 /d native /f > /dev/null 2>&1
56
+ wine reg add ' HKEY_CURRENT_USER\Software\Wine\DllOverrides' /v dxgi /d native /f > /dev/null 2>&1
14
57
15
58
}
16
59
@@ -22,15 +65,35 @@ vulkan_is_there() {
22
65
[ $vk_devices -gt 0 ] && return 0 || return 1
23
66
}
24
67
25
- parse_opt () {
68
+ parse_add_opt () {
69
+
70
+ shift ; shift
71
+
72
+ while [ $# -gt 0 ]; do
73
+ printf " Arguments: $1 \n"
74
+
75
+ case " $1 " in
76
+ --without-dxvk) with_dxvk=" no" ;;
77
+
78
+ esac
79
+
80
+ shift
81
+
82
+ done
83
+
84
+ }
85
+
86
+ parse_run_opt () {
26
87
27
88
shift ; shift
28
89
29
90
while [ $# -gt 0 ]; do
30
91
printf " Arguments: $1 \n"
31
92
32
93
case " $1 " in
33
- --nv-prime-offload) prefix_addition=" ${prefix_addition} __NV_PRIME_RENDER_OFFLOAD=1 __GLX_VENDOR_LIBRARY_NAME=nvidia" ;;
94
+ --nv-glx-offload) prefix_addition=" ${prefix_addition} __NV_PRIME_RENDER_OFFLOAD=1 __GLX_VENDOR_LIBRARY_NAME=nvidia" ;;
95
+ --nv-vk-offload) prefix_addition=" ${prefix_addition} __NV_PRIME_RENDER_OFFLOAD=1 __VK_LAYER_NV_optimus=NVIDIA_only" ;;
96
+ --use-zink) prefix_addition=" ${prefix_addition} __GLX_VENDOR_LIBRARY_NAME=mesa MESA_LOADER_DRIVER_OVERRIDE=zink GALLIUM_DRIVER=zink" ;;
34
97
--prime-offload) prefix_addition=" ${prefix_addition} DRI_PRIME=1" ;;
35
98
--game-mode) prefix_addition=" ${prefix_addition} gamemoderun" ;;
36
99
@@ -45,7 +108,10 @@ parse_opt() {
45
108
operation_run () {
46
109
local game_inf game_name game_runner game_dir game_exe game_cmd_prefix previous_dir
47
110
48
- game_inf=$( grep " $1 " ~ /.local/share/shin/mess.vars)
111
+ game_inf=$( grep " ${1} _" ~ /.local/share/shin/mess.vars)
112
+
113
+ [ -z " $( echo $game_inf ) " ] && printf " No games found using the specified ID\n" && exit
114
+
49
115
game_name=$( echo " $game_inf " | grep -o " ${2} _NAME='[^']*" | sed " s/${2} _NAME='//" )
50
116
game_runner=$( echo " $game_inf " | grep -o " ${2} _RUNNER='[^']*" | sed " s/${2} _RUNNER='//" )
51
117
game_dir=$( echo " $game_inf " | grep -o " ${2} _DIR='[^']*" | sed " s/${2} _DIR='//" )
@@ -82,14 +148,19 @@ operation_add() {
82
148
runner=" native"
83
149
84
150
else
151
+ wine_prefix=" $HOME /.local/share/shin/wineprefixes/$1 "
85
152
printf " Configuring wine prefix...\n"
86
- ! [ -d " $HOME /.local/share/shin/wineprefixes/$1 " ] && mkdir -p " $HOME /.local/share/shin/wineprefixes/$1 "
87
- WINEPREFIX=" $HOME /.local/share/shin/wineprefixes/$1 " wineboot -u > /dev/null 2>&1
88
- is_vulkan_there=$( vulkan_is_there)
153
+ ! [ -d " $wine_prefix " ] && mkdir -p " $wine_prefix "
154
+ WINEPREFIX=" $wine_prefix " wineboot -u > /dev/null 2>&1
155
+
156
+ if [ " $with_dxvk " = " yes" ]; then
157
+ is_vulkan_there=$( vulkan_is_there)
158
+ [ $is_vulkan_there = 0 ] && configure_dxvk " $wine_prefix " || printf " No Vulkan device found. Falling back to WINED3D"
159
+
160
+ fi
89
161
90
- [ $is_vulkan_there = 0 ] && configure_dxvk " $HOME /.local/share/shin/wineprefixes/$1 " || printf " No Vulkan device found. Falling back to WINED3D"
91
162
runner=" wine"
92
- cmd_prefix=" WINEFSYNC=1 WINEESYNC=1 WINEPREFIX=$HOME /.local/share/shin/wineprefixes/ $1 "
163
+ cmd_prefix=" WINEFSYNC=1 WINEESYNC=1 WINEPREFIX=$wine_prefix "
93
164
94
165
fi
95
166
@@ -102,9 +173,8 @@ operation_add() {
102
173
103
174
# # MAIN ##
104
175
105
- parse_opt " $@ "
106
-
107
176
if [ " $1 " = add ]; then
177
+ parse_add_opt " $@ "
108
178
printf " Please enter the game ID This will be used to identify your game when using the 'run' operation\n>> "
109
179
read -r game_id
110
180
@@ -114,6 +184,7 @@ if [ "$1" = add ]; then
114
184
operation_add " $game_id " " $game_name " " $2 "
115
185
116
186
elif [ " $1 " = " run" ]; then
187
+ parse_run_opt " $@ "
117
188
operation_run " $2 "
118
189
119
190
elif [ " $1 " = " list" ]; then
@@ -122,18 +193,25 @@ elif [ "$1" = "list" ]; then
122
193
123
194
elif [ " $1 " = " help" ]; then
124
195
cat << EOF
125
- Usage: shin <command> <command arg> [ARGUMENTS ]...
196
+ Usage: shin <command> <command arg> [OPTIONS ]...
126
197
127
198
Example: shin add <game path>
128
199
shin run <game id> --game-mode --nv-prime-offload
129
200
130
- Options:
201
+ \` run \` Options:
131
202
132
- --nv-prime-offload Run the game on NVIDIA GPU using PRIME render offload
203
+ --nv-glx-offload Run OpenGL game on NVIDIA GPU
204
+ --nv-vk-offload Run Vulkan game on NVIDIA GPU
205
+ --use-zink Translate OpenGL to Vulkan using Mesa Zink driver, might improve
206
+ OpenGL games performance
133
207
--prime-offload Run the game on discrete GPU using PRIME render offload
134
208
(only for open-source drivers)
135
209
--game-mode Run the game with Feral Interactive Game Mode to
136
210
optimize gaming performance
211
+
212
+ \` add\` Options:
213
+
214
+ --without-dxvk Configure wine prefix without DXVK
137
215
EOF
138
216
139
217
fi
0 commit comments