added the installation of dxvk/vkd3d in the text interface

This commit is contained in:
Sergey Palcheh
2025-09-09 12:55:11 +06:00
parent 7f3f330fc4
commit 721fd5e76e

View File

@@ -2018,7 +2018,7 @@ update_last_conf_var() {
local new_value="$2"
local conf_file="$WINEPREFIX/last.conf"
if [[ ! -f "$conf_file" ]]; then
if [[ ! -f "$conf_file" ]] ; then
print_warning "Файл last.conf не найден, не могу обновить переменную $var_name."
return 1
fi
@@ -2030,8 +2030,108 @@ update_last_conf_var() {
fi
}
list_component_versions() {
local component_group="$1"
local sha256_file="$DATA_PATH/sha256sum.list"
[[ ! -f "$sha256_file" ]] && fatal "Файл с версиями не найден: $sha256_file"
print_info "Доступные версии для $component_group:"
awk -v group="$component_group" '
/^#+\s*([^#]+?)\s*#*$/ {
current_group = $0
gsub(/^#+\s*|\s*#*$/, "", current_group)
}
/^[a-f0-9]{64}/ {
if (current_group == group) {
filename = $2
sub(/\.tar\.xz$/, "", filename)
print " - " filename
}
}
' "$sha256_file" | sort -Vr
}
select_component_version() {
local component_group="$1"
local sha256_file="$DATA_PATH/sha256sum.list"
[[ ! -f "$sha256_file" ]] && fatal "Файл с версиями не найден: $sha256_file"
local versions=()
local current_group=""
while IFS= read -r line; do
if [[ "$line" =~ ^#+[[:space:]]([^#[:space:]]+)[[:space:]]#* ]] ; then
current_group="${BASH_REMATCH[1]}"
elif [[ "$current_group" == "$component_group" ]] && [[ "$line" =~ [a-f0-9]{64} ]] ; then
local filename
filename=$(echo "$line" | awk '{print $2}')
local version_name=${filename%.tar.xz}
versions+=("$version_name")
fi
done < "$sha256_file"
IFS=$'\n' versions=($(sort -Vr <<<"${versions[*]}"))
unset IFS
if [[ ${#versions[@]} -eq 0 ]] ; then
print_warning "Не найдено доступных версий для $component_group." >&2
return 1
fi
print_info "Выберите версию $component_group для установки:" >&2
echo >&2
local items_to_print=(" 0) Отмена")
for i in "${!versions[@]}" ; do
items_to_print+=(" $((i+1))) ${versions[$i]}")
done
local num_items=${#items_to_print[@]}
local term_width=${COLUMNS:-80}
local max_len=0
for item in "${items_to_print[@]}" ; do
(( ${#item} > max_len )) && max_len=${#item}
done
((max_len+=2))
local num_cols=$(( term_width / max_len ))
(( num_cols = num_cols > 0 ? num_cols : 1 ))
local num_rows=$(( (num_items + num_cols - 1) / num_cols ))
for ((i=0; i<num_rows; i++)) ; do
for ((j=0; j<num_cols; j++)) ; do
local index=$(( i + j * num_rows ))
(( index < num_items )) && printf "%-*s" "$max_len" "${items_to_print[index]}" >&2
done
echo >&2
done
local max_choice=${#versions[@]}
local user_choice
while true; do
echo >&2
read -p "Введите номер (0-$max_choice): " user_choice
if [[ "$user_choice" =~ ^[0-9]+$ ]] && (( user_choice >= 0 && user_choice <= max_choice )) ; then
if [[ "$user_choice" == "0" ]] ; then
return 1
fi
echo "${versions[$((user_choice-1))]}"
return 0
else
print_error "Неверный выбор. Введите число от 0 до $max_choice." >&2
fi
done
}
run_install_dxvk() {
local version="$1"
if [[ -z "$version" ]] ; then
version=$(select_component_version "DXVK")
[[ $? -ne 0 ]] && print_info "Установка DXVK отменена." && return
elif [[ "$version" == "list" ]]; then
list_component_versions "DXVK"
return
fi
check_prefix_var
init_database
init_wine_ver
@@ -2049,6 +2149,13 @@ run_install_dxvk() {
run_install_vkd3d() {
local version="$1"
if [[ -z "$version" ]] ; then
version=$(select_component_version "VKD3D")
[[ $? -ne 0 ]] && print_info "Установка VKD3D отменена." && return
elif [[ "$version" == "list" ]] ; then
list_component_versions "VKD3D"
return
fi
check_prefix_var
init_database
init_wine_ver
@@ -2072,8 +2179,8 @@ wh_info () {
install [скрипт] запустить скрипт установки программы
install [скрипт] --clear-pfx не использовать готовый префикс для установки ПО
install-dxvk [версия|none] установить/удалить DXVK в выбранный префикс
install-vkd3d [версия|none] установить/удалить VKD3D в выбранный префикс
install-dxvk [версия|none|list] установить, удалить или показать версии DXVK
install-vkd3d [версия|none|list] установить, удалить или показать версии VKD3D
installed список установленных программ
run [программа] запуск программы (отладка)