chore(setting): add human readeble value to PW_VULKAN_USE
All checks were successful
Code check / Check code (push) Successful in 1m16s
All checks were successful
Code check / Check code (push) Successful in 1m16s
Signed-off-by: Boris Yumankulov <boria138@altlinux.org>
This commit is contained in:
@@ -2009,6 +2009,7 @@ class ExeSettingsDialog(QDialog):
|
||||
self.advanced_table.setRowCount(0)
|
||||
self.advanced_widgets.clear()
|
||||
self.original_display_values = {}
|
||||
self.value_mapping = {} # Store value mappings for settings that need translation
|
||||
self.advanced_table.verticalHeader().setVisible(False)
|
||||
|
||||
current = self.current_settings
|
||||
@@ -2050,11 +2051,18 @@ class ExeSettingsDialog(QDialog):
|
||||
elif setting['key'] == 'PW_AMD_VULKAN_USE':
|
||||
current_val = disabled_text if not current_raw or current_raw == '' or current_raw == 'disabled' else current_raw
|
||||
elif setting['key'] == 'PW_WINE_USE':
|
||||
# For PW_WINE_USE, only add to options if it's not empty, otherwise leave as is
|
||||
current_val = current_raw
|
||||
else:
|
||||
current_val = disabled_text if current_raw == 'disabled' else current_raw
|
||||
|
||||
# For settings with value mapping, convert the raw value to display text
|
||||
if '_value_map' in setting:
|
||||
# Create reverse mapping for lookup
|
||||
reverse_map = {v: k for k, v in setting['_value_map'].items()}
|
||||
if current_raw in reverse_map:
|
||||
# The value from DB maps to a display text, so show that text
|
||||
current_val = reverse_map[current_raw]
|
||||
|
||||
if current_val and current_val not in setting['options']:
|
||||
combo.addItem(current_val)
|
||||
combo.setCurrentText(current_val)
|
||||
@@ -2068,7 +2076,31 @@ class ExeSettingsDialog(QDialog):
|
||||
|
||||
self.advanced_table.setCellWidget(row, 1, combo)
|
||||
self.advanced_widgets[setting['key']] = combo
|
||||
self.original_display_values[setting['key']] = current_val
|
||||
|
||||
# For settings with value mapping, we need to store what was originally displayed to the user
|
||||
# If the current_raw value maps to a display text, store the display text for comparison
|
||||
if '_value_map' in setting:
|
||||
reverse_map = {v: k for k, v in setting['_value_map'].items()}
|
||||
if current_raw in reverse_map:
|
||||
# The raw value from database maps to a display text, store that display text
|
||||
# so comparison with user selection will work correctly
|
||||
self.original_display_values[setting['key']] = reverse_map[current_raw]
|
||||
else:
|
||||
# No mapping found, store the current display value
|
||||
self.original_display_values[setting['key']] = current_val
|
||||
else:
|
||||
# For regular settings, store the display value
|
||||
self.original_display_values[setting['key']] = current_val
|
||||
|
||||
# Check if this setting has a value mapping and store it
|
||||
if '_value_map' in setting:
|
||||
# Create reverse mapping for original value lookup
|
||||
reverse_map = {v: k for k, v in setting['_value_map'].items()}
|
||||
self.value_mapping[setting['key']] = {
|
||||
'forward': setting['_value_map'],
|
||||
'reverse': reverse_map
|
||||
}
|
||||
|
||||
|
||||
elif setting['type'] == 'text':
|
||||
line_edit = QLineEdit()
|
||||
@@ -2189,16 +2221,37 @@ class ExeSettingsDialog(QDialog):
|
||||
orig_val = self.original_display_values.get(key, '')
|
||||
if isinstance(widget, QComboBox):
|
||||
new_val = widget.currentText()
|
||||
|
||||
# Special handling for settings that have value mapping
|
||||
# Check if this key has a forward value mapping stored
|
||||
if key in self.value_mapping and 'forward' in self.value_mapping[key]:
|
||||
value_map = self.value_mapping[key]['forward']
|
||||
|
||||
# Compare the selected display text with the original display text
|
||||
has_changed = (new_val != orig_val)
|
||||
|
||||
# If new_val (the display text selected by user) is in the forward mapping,
|
||||
# convert it to the actual value for saving
|
||||
if new_val in value_map:
|
||||
new_val = value_map[new_val]
|
||||
# else: new_val remains as the display text (for cases not in the mapping)
|
||||
else:
|
||||
# No value mapping, regular comparison
|
||||
has_changed = (new_val != orig_val)
|
||||
|
||||
if new_val.lower() == _('disabled').lower():
|
||||
new_val = 'disabled'
|
||||
|
||||
if has_changed:
|
||||
changes.append(f"{key}={new_val}")
|
||||
|
||||
elif isinstance(widget, QLineEdit):
|
||||
new_val = widget.text().strip()
|
||||
if new_val != orig_val:
|
||||
changes.append(f"{key}={new_val}")
|
||||
else:
|
||||
continue
|
||||
|
||||
if new_val != orig_val:
|
||||
changes.append(f"{key}={new_val}")
|
||||
|
||||
if not changes:
|
||||
QMessageBox.information(self, _("Info"), _("No changes to apply."))
|
||||
return
|
||||
|
||||
@@ -77,13 +77,46 @@ def get_advanced_settings(disabled_text, logical_core_options, locale_options,
|
||||
})
|
||||
|
||||
# 3. Vulkan Backend
|
||||
vulkan_options = [
|
||||
_("Auto – latest DXVK + VKD3D (recommended)"), # → 6
|
||||
_("Stable – proven DXVK + VKD3D"), # → 2
|
||||
_("Sarek – experimental DXVK-Sarek + VKD3D-Sarek"), # → 1
|
||||
_("WINED3D – OpenGL (fallback only)") # → 0
|
||||
]
|
||||
|
||||
# Маппинг: отображаемый текст → реальное значение в ppdb
|
||||
vulkan_value_map = {
|
||||
vulkan_options[0]: "6",
|
||||
vulkan_options[1]: "2",
|
||||
vulkan_options[2]: "1",
|
||||
vulkan_options[3]: "0",
|
||||
}
|
||||
|
||||
advanced_settings.append({
|
||||
'key': 'PW_VULKAN_USE',
|
||||
'name': _("Vulkan Backend"),
|
||||
'description': _("Select Vulkan rendering backend:\n0 - WINED3D OpenGL\n1 - DXVK-Sarek and VKD3D\n2 - Stable DXVK and VKD3D\n6 - Newest DXVK and VKD3D"),
|
||||
'description': _(
|
||||
"Select the rendering backend for translating DirectX → Vulkan/OpenGL:\n\n"
|
||||
"• Auto – latest DXVK + VKD3D (recommended)\n"
|
||||
" The newest versions from the developers. Give the best compatibility and performance in modern games.\n"
|
||||
" Require up-to-date drivers:\n"
|
||||
" – AMD: Mesa 25.0+ or proprietary AMDVLK 2024.Q4+\n"
|
||||
" – NVIDIA: driver 550.54.14 or newer\n"
|
||||
" – Intel: Mesa 24.2+\n\n"
|
||||
"• Stable – proven DXVK + VKD3D\n"
|
||||
" Older but extremely well-tested versions. Work on any drivers that support Vulkan 1.3+.\n"
|
||||
" The best choice if you have problems with the newest versions.\n\n"
|
||||
"• Sarek – experimental DXVK-Sarek + VKD3D-Sarek\n"
|
||||
" Work even on older drivers and video cards that support at least Vulkan 1.1.\n\n"
|
||||
"• WINED3D – OpenGL translation (fallback)\n"
|
||||
" No DXVK/VKD3D used. DirectX is translated to OpenGL via built-in WineD3D.\n"
|
||||
" Works on absolutely any hardware, but performance is significantly lower.\n"
|
||||
" Use only as a last resort when nothing else starts."
|
||||
),
|
||||
'type': 'combo',
|
||||
'options': [ '0', '1', '2', '6'],
|
||||
'default': '6'
|
||||
'options': vulkan_options,
|
||||
'default': '6',
|
||||
'_value_map': vulkan_value_map
|
||||
})
|
||||
|
||||
# 4. Windows version
|
||||
|
||||
Reference in New Issue
Block a user