Merge pull request #220824 from 9ary/dxvk-dll-overrides
dxvk: fix DLL override setup dxvk: fix unbound variable warning in setup_dxvk.sh dxvk: fix all shellcheck warnings
This commit is contained in:
commit
24469dbb73
|
@ -2,11 +2,14 @@
|
||||||
|
|
||||||
set -eu -o pipefail
|
set -eu -o pipefail
|
||||||
|
|
||||||
|
# shellcheck disable=SC2034
|
||||||
|
{
|
||||||
dxvk32_dir=@dxvk32@/bin
|
dxvk32_dir=@dxvk32@/bin
|
||||||
dxvk64_dir=@dxvk64@/bin
|
dxvk64_dir=@dxvk64@/bin
|
||||||
|
|
||||||
mcfgthreads32_dir=@mcfgthreads32@/bin
|
mcfgthreads32_dir=@mcfgthreads32@/bin
|
||||||
mcfgthreads64_dir=@mcfgthreads64@/bin
|
mcfgthreads64_dir=@mcfgthreads64@/bin
|
||||||
|
}
|
||||||
|
|
||||||
## Defaults
|
## Defaults
|
||||||
|
|
||||||
|
@ -42,7 +45,7 @@ usage() {
|
||||||
exit 1
|
exit 1
|
||||||
}
|
}
|
||||||
|
|
||||||
case "$1" in
|
case "${1:-}" in
|
||||||
uninstall|install)
|
uninstall|install)
|
||||||
action=$1
|
action=$1
|
||||||
shift
|
shift
|
||||||
|
@ -51,7 +54,7 @@ case "$1" in
|
||||||
usage
|
usage
|
||||||
;;
|
;;
|
||||||
*)
|
*)
|
||||||
if [ ! -z "${1:-}" ]; then
|
if [ -n "${1:-}" ]; then
|
||||||
echo "Unrecognized command: $1"
|
echo "Unrecognized command: $1"
|
||||||
fi
|
fi
|
||||||
usage
|
usage
|
||||||
|
@ -62,19 +65,19 @@ esac
|
||||||
do_symlink=false
|
do_symlink=false
|
||||||
do_makeprefix=false
|
do_makeprefix=false
|
||||||
|
|
||||||
while [ ! -z "${1:-}" ]; do
|
while [ -n "${1:-}" ]; do
|
||||||
case "$1" in
|
case "$1" in
|
||||||
--with-dxgi)
|
--with-dxgi)
|
||||||
targets[dxgi]=1
|
targets[dxgi]=1
|
||||||
;;
|
;;
|
||||||
--without-dxgi)
|
--without-dxgi)
|
||||||
unset targets[dxgi]
|
unset "targets[dxgi]"
|
||||||
;;
|
;;
|
||||||
--with-d3d10)
|
--with-d3d10)
|
||||||
targets[d3d10]=1
|
targets[d3d10]=1
|
||||||
;;
|
;;
|
||||||
--without-d3d10)
|
--without-d3d10)
|
||||||
unset targets[d3d10]
|
unset "targets[d3d10]"
|
||||||
;;
|
;;
|
||||||
-s|--symlink)
|
-s|--symlink)
|
||||||
do_symlink=true
|
do_symlink=true
|
||||||
|
@ -90,7 +93,7 @@ while [ ! -z "${1:-}" ]; do
|
||||||
;;
|
;;
|
||||||
-p|--prefix)
|
-p|--prefix)
|
||||||
shift
|
shift
|
||||||
if [ ! -z "${1:-}" ]; then
|
if [ -n "${1:-}" ]; then
|
||||||
WINEPREFIX=$1
|
WINEPREFIX=$1
|
||||||
else
|
else
|
||||||
echo "Required PREFIX missing"
|
echo "Required PREFIX missing"
|
||||||
|
@ -223,8 +226,7 @@ uninstall_file() {
|
||||||
|
|
||||||
install_override() {
|
install_override() {
|
||||||
dll=$(basename "$1")
|
dll=$(basename "$1")
|
||||||
$wine reg add 'HKEY_CURRENT_USER\Software\Wine\DllOverrides' /v "$dll" /d native /f >/dev/null 2>&1
|
if ! $wine reg add 'HKEY_CURRENT_USER\Software\Wine\DllOverrides' /v "$dll" /d native /f >/dev/null 2>&1; then
|
||||||
if [ $? -ne 0 ]; then
|
|
||||||
echo -e "Failed to add override for $dll"
|
echo -e "Failed to add override for $dll"
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
@ -232,8 +234,7 @@ install_override() {
|
||||||
|
|
||||||
uninstall_override() {
|
uninstall_override() {
|
||||||
dll=$(basename "$1")
|
dll=$(basename "$1")
|
||||||
$wine reg delete 'HKEY_CURRENT_USER\Software\Wine\DllOverrides' /v "$dll" /f > /dev/null 2>&1
|
if ! $wine reg delete 'HKEY_CURRENT_USER\Software\Wine\DllOverrides' /v "$dll" /f > /dev/null 2>&1; then
|
||||||
if [ $? -ne 0 ]; then
|
|
||||||
echo "Failed to remove override for $dll"
|
echo "Failed to remove override for $dll"
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
@ -243,16 +244,16 @@ uninstall_override() {
|
||||||
declare -A paths
|
declare -A paths
|
||||||
|
|
||||||
for target in "${!targets[@]}"; do
|
for target in "${!targets[@]}"; do
|
||||||
[ ${targets[$target]} -eq 1 ] || continue
|
[ "${targets[$target]}" -eq 1 ] || continue
|
||||||
for dll in ${dlls[$target]}; do
|
for dll in ${dlls[$target]}; do
|
||||||
dllname=$(basename "$dll")
|
dllname=$(basename "$dll")
|
||||||
basedir=$(dirname "$dll")
|
basedir=$(dirname "$dll")
|
||||||
|
|
||||||
if [ ! -z "${win32_sys_path:-}" ]; then
|
if [ -n "${win32_sys_path:-}" ]; then
|
||||||
basedir32=${basedir}32_dir
|
basedir32=${basedir}32_dir
|
||||||
paths["${!basedir32}/$dllname"]="$win32_sys_path/$dllname"
|
paths["${!basedir32}/$dllname"]="$win32_sys_path/$dllname"
|
||||||
fi
|
fi
|
||||||
if [ ! -z "${win64_sys_path:-}" ]; then
|
if [ -n "${win64_sys_path:-}" ]; then
|
||||||
basedir64=${basedir}64_dir
|
basedir64=${basedir}64_dir
|
||||||
paths["${!basedir64}/$dllname"]="$win64_sys_path/$dllname"
|
paths["${!basedir64}/$dllname"]="$win64_sys_path/$dllname"
|
||||||
fi
|
fi
|
||||||
|
@ -260,6 +261,6 @@ for target in "${!targets[@]}"; do
|
||||||
done
|
done
|
||||||
|
|
||||||
for srcpath in "${!paths[@]}"; do
|
for srcpath in "${!paths[@]}"; do
|
||||||
${action}_file "$srcpath" "${paths["$srcpath"]}"
|
"${action}_file" "$srcpath" "${paths["$srcpath"]}"
|
||||||
${action}_override "$(basename srcpath)"
|
"${action}_override" "$(basename "$srcpath" .dll)"
|
||||||
done
|
done
|
||||||
|
|
Loading…
Reference in a new issue