From 48cb8a198ab49beca9abf5ac5da32f64068d3f30 Mon Sep 17 00:00:00 2001 From: codexx-dev Date: Mon, 16 Nov 2026 22:11:09 -0300 Subject: [PATCH] Tick the setup's AMD FSR box by default only with an AMD display adapter The FSR step downloads on any GPU since #1, but the box was ticked for every player. The window now lists the display adapters Windows reports (screens.windows_adapter_names) and ticks it when one is AMD, or when none could be listed. The README's install list gets its fourth step back, and the menu's Upscalers text no longer says FSR runs on AMD GPUs alone. Co-Authored-By: Claude Opus 5.5 --- README.md | 12 +++++++----- docs/installer.md | 6 ++++-- installer/gui.py | 7 +++++-- installer/guilogic.py | 9 +++++++++ installer/screens.py | 22 ++++++++++++++++++++++ installer/text/en.json | 2 +- installer/text/pt-BR.json | 2 +- installer/text/ru.json | 2 +- installer/text/zh-Hans.json | 2 +- runtime/ui_text.c | 15 +++++++++------ tests/installer_gui_test.py | 18 +++++++++++++++++- 11 files changed, 77 insertions(+), 20 deletions(-) diff --git a/README.md b/README.md index aca23a4c..05015dbc 100644 --- a/README.md +++ b/README.md @@ -23,8 +23,9 @@ Report problems as issues, following [CONTRIBUTING.md](CONTRIBUTING.md). - NVIDIA DLSS / DLAA on RTX GPUs: the setup downloads `nvngx_dlss.dll` from NVIDIA's DLSS SDK repository (github.com/NVIDIA/DLSS, NVIDIA RTX SDK license) when it finds an RTX GPU; untick it in the setup to skip it - AMD FSR 4 on supported Radeon RX 9000, 7000 and 6000 GPUs (FSR 3.1 on other GPUs supported by the SDK), in the same - modes as DLSS: on Windows, the setup downloads AMD's signed FSR SDK libraries (github.com/GPUOpen-LibrariesAndSDKs/FidelityFX-SDK, - AMD FSR SDK license); the SDK determines which GPU devices and upscaler versions it supports + modes as DLSS: on Windows, the setup downloads AMD's signed FSR SDK libraries + (github.com/GPUOpen-LibrariesAndSDKs/FidelityFX-SDK, AMD FSR SDK license), ticked by default with an AMD GPU; the SDK + determines which GPU devices and upscaler versions it supports - HDR10 output with peak, game and HUD brightness settings - 16:10 (Steam Deck, handhelds), 3:2 (Surface, Framework), 21:9 and 32:9 (ultrawide) game resolutions, with the camera and the interface in that shape - Anisotropic texture filtering up to 16x, for sharp ground into the distance @@ -56,9 +57,10 @@ Requirements: Windows 10 or later, an x86-64 CPU with SSE4.2 (AVX2/FMA machines 2. Start `TotK-Setup.exe`. If SmartScreen warns about an unsigned app, choose *More info*, then *Run anyway*. 3. Pick your game files, the language and an install folder, and press *Start*. The setup builds the game once. With an NVIDIA RTX GPU it also downloads NVIDIA DLSS, unless you untick *Download NVIDIA DLSS*; turn DLSS on in the - menu (F1). If *Download AMD FSR* is selected, it downloads the FSR SDK libraries on Windows; the SDK chooses the - upscaler version supported by the GPU. In the menu, pick *AMD FSR* under *Upscalers*. - 4. Play `totk.exe` from the install folder. + menu (F1). With *Download AMD FSR* ticked (the default with an AMD GPU; tick it for another GPU) it downloads + AMD's FSR SDK libraries, and the SDK picks the upscaler version the GPU supports. In the menu, pick *AMD FSR* + under *Upscalers*. +4. Play `totk.exe` from the install folder. ### Linux diff --git a/docs/installer.md b/docs/installer.md index 4dfcb8f6..05a21a06 100644 --- a/docs/installer.md +++ b/docs/installer.md @@ -100,12 +100,14 @@ loads the saves 1.4.3 wrote. the library; NGX loads it from the folder of totk.exe for `dlaa` and the DLSS modes. A DLSS library already in the folder (a newer one the player put there) is kept. Without an RTX GPU the step only logs and does nothing; a failed download warns, the game runs without DLSS, and the next run of the setup tries again. -9. **FSR** (the window's tick box, on by default, or `--fsr`; Windows): download +9. **FSR** (the window's tick box, on by default when Windows lists an AMD display adapter, `screens.py` + `windows_adapter_names`; or `--fsr`; Windows): download `amd_fidelityfx_loader_vk.dll` and `amd_fidelityfx_upscaler_vk.dll` from AMD's FSR SDK repository (github.com/GPUOpen-LibrariesAndSDKs/FidelityFX-SDK, tag `v2.4.0`, `Kits/FidelityFX/signedbin/`, AMD FSR SDK license) into the install folder and check their sizes and SHA-256 (`steps.py`, `Fsr`). Both go in only when both downloaded and matched. `dlaa_backend = fsr` loads them from the folder of totk.exe. Libraries already in the folder - are kept; the SDK selects an upscaler version supported by the GPU; a failed download warns and the next run tries again. + are kept; the SDK selects an upscaler version supported by the GPU; a failed download warns and the next run tries + again. 10. **Clean up** the temp folder, except the generated C and the objects (about 1.3 GB), and write `build-cache/rebuild.txt` in the install folder. diff --git a/installer/gui.py b/installer/gui.py index 40840070..54fb7c92 100644 --- a/installer/gui.py +++ b/installer/gui.py @@ -37,8 +37,10 @@ except ImportError: from . import ini from . import layout as layouts from . import recent +from . import screens from .guilogic import (DONE, FAILED, PENDING, RUNNING, SKIPPED, UI_LANGUAGE_LABELS, UI_LANGUAGES, Catalog, Form, Model, - Process, amount, default_game_language, describe_event, parse_line, windows_ui_language) + Process, amount, default_game_language, describe_event, fsr_default, parse_line, + windows_ui_language) POLL_MS = 100 GLYPH = {PENDING: '\u25cb', RUNNING: '\u25b6', DONE: '\u2714', SKIPPED: '\u2013', FAILED: '\u2716'} @@ -273,7 +275,8 @@ class App: self.bind_text(dlss, 'text', 'ui.dlss') dlss.pack(anchor='w', pady=(dpi.px(8), 0)) self.label(f, 'ui.dlss_help', wraplength=WRAP, justify='left').pack(anchor='w', padx=(dpi.px(22), 0)) - self.fsr_var = tk.BooleanVar(value=True) + # ticked by default with an AMD display adapter only (guilogic.fsr_default); the player can tick it on any GPU + self.fsr_var = tk.BooleanVar(value=fsr_default(screens.windows_adapter_names())) fsr = ttk.Checkbutton(f, variable=self.fsr_var) self.bind_text(fsr, 'text', 'ui.fsr') fsr.pack(anchor='w', pady=(dpi.px(8), 0)) diff --git a/installer/guilogic.py b/installer/guilogic.py index 233d8795..09090865 100644 --- a/installer/guilogic.py +++ b/installer/guilogic.py @@ -129,6 +129,15 @@ def amount(cat, done, total, unit): # ---- the form ---------------------------------------------------------------------------------------------------- +def fsr_default(adapters): + """Whether the window ticks Download AMD FSR at start: with an AMD display adapter among adapters (their names, + screens.windows_adapter_names), and when none could be listed, as before. The step downloads on any GPU when + ticked (steps.Fsr); unticked by default on other GPUs, their players only download it when they choose to.""" + if not adapters: + return True + return any('AMD' in a.upper() or 'RADEON' in a.upper() for a in adapters) + + @dataclass class Form: base: str = '' diff --git a/installer/screens.py b/installer/screens.py index eb61c800..a4429bde 100644 --- a/installer/screens.py +++ b/installer/screens.py @@ -94,6 +94,28 @@ def windows_displays(): return out +def windows_adapter_names(): + """The names of the display adapters Windows lists (EnumDisplayDevicesW, "AMD Radeon RX 9060 XT"), without + starting Vulkan; [] elsewhere or when the call fails. The setup window decides its defaults by them before the host + check has run.""" + if os.name != 'nt': + return [] + try: + user32 = ctypes.WinDLL('user32') + out, i = [], 0 + while i < 64: + dev = DISPLAY_DEVICEW() + dev.cb = ctypes.sizeof(dev) + if not user32.EnumDisplayDevicesW(None, i, ctypes.byref(dev), 0): + break + i += 1 + if dev.DeviceString and dev.DeviceString not in out: + out.append(dev.DeviceString) + return out + except (OSError, AttributeError, ValueError): + return [] + + XRANDR = re.compile(r'\sconnected\s+(?:primary\s+)?(\d+)x(\d+)\+') diff --git a/installer/text/en.json b/installer/text/en.json index 08f26783..e6022d02 100644 --- a/installer/text/en.json +++ b/installer/text/en.json @@ -141,7 +141,7 @@ "ui.dlss": "Download NVIDIA DLSS (nvngx_dlss.dll) for NVIDIA RTX graphics cards", "ui.dlss_help": "From NVIDIA's DLSS SDK on GitHub, under NVIDIA's RTX SDK license (github.com/NVIDIA/DLSS). It makes the dlaa and DLSS settings work; without it they do nothing.", "ui.fsr": "Download AMD FSR SDK libraries (FSR 3.1/4) for compatible Vulkan graphics cards", - "ui.fsr_help": "From AMD's FSR SDK on GitHub, under AMD's FSR SDK license (github.com/GPUOpen-LibrariesAndSDKs/FidelityFX-SDK). The SDK selects an upscaler version supported by your GPU. Required for AMD FSR in Upscalers; without it that choice does nothing.", + "ui.fsr_help": "From AMD's FSR SDK on GitHub, under AMD's FSR SDK license (github.com/GPUOpen-LibrariesAndSDKs/FidelityFX-SDK). The SDK selects an upscaler version supported by your GPU. Required for AMD FSR in Upscalers; without it that choice does nothing. Ticked at start when the computer has an AMD graphics card.", "ui.compressed_help": "Compressed NSZ and XCZ files work as they are: the setup unpacks them by itself (until the game data is extracted, that needs as much free space as the unpacked files take).", "ui.type_game": "Game files (NSP, XCI, NSZ, XCZ)", "ui.type_keys": "Key files (*.keys)", diff --git a/installer/text/pt-BR.json b/installer/text/pt-BR.json index 78795552..6d154185 100644 --- a/installer/text/pt-BR.json +++ b/installer/text/pt-BR.json @@ -141,7 +141,7 @@ "ui.dlss": "Baixar o NVIDIA DLSS (nvngx_dlss.dll) para placas de vídeo NVIDIA RTX", "ui.dlss_help": "Do DLSS SDK da NVIDIA no GitHub, sob a licença NVIDIA RTX SDK (github.com/NVIDIA/DLSS). Sem ele as opções dlaa e DLSS não fazem nada.", "ui.fsr": "Baixar as bibliotecas AMD FSR SDK (FSR 3.1/4) para GPUs Vulkan compatíveis", - "ui.fsr_help": "Do FSR SDK da AMD no GitHub, sob a licença do AMD FSR SDK (github.com/GPUOpen-LibrariesAndSDKs/FidelityFX-SDK). O SDK escolhe a versão do upscaler compatível com sua GPU. As bibliotecas são necessárias para AMD FSR em Upscalers; sem elas essa opção não funciona.", + "ui.fsr_help": "Do FSR SDK da AMD no GitHub, sob a licença do AMD FSR SDK (github.com/GPUOpen-LibrariesAndSDKs/FidelityFX-SDK). O SDK escolhe a versão do upscaler compatível com sua GPU. As bibliotecas são necessárias para AMD FSR em Upscalers; sem elas essa opção não funciona. Vem marcada quando o computador tem uma placa de vídeo AMD.", "ui.compressed_help": "Arquivos compactados NSZ e XCZ funcionam do jeito que estão: a instalação os descompacta sozinha (para isso, até os dados do jogo serem extraídos, ela precisa de tanto espaço livre quanto ocupam os arquivos descompactados).", "ui.type_game": "Arquivos de jogo (NSP, XCI, NSZ, XCZ)", "ui.type_keys": "Arquivos de chaves (*.keys)", diff --git a/installer/text/ru.json b/installer/text/ru.json index 1ce346a1..b677c53a 100644 --- a/installer/text/ru.json +++ b/installer/text/ru.json @@ -141,7 +141,7 @@ "ui.dlss": "Загрузить NVIDIA DLSS (nvngx_dlss.dll) для видеокарт NVIDIA RTX", "ui.dlss_help": "Из DLSS SDK от NVIDIA на GitHub, по лицензии NVIDIA RTX SDK (github.com/NVIDIA/DLSS). Без него настройки dlaa и DLSS ничего не делают.", "ui.fsr": "Загрузить библиотеки AMD FSR SDK (FSR 3.1/4) для совместимых видеокарт с Vulkan", - "ui.fsr_help": "Из FSR SDK от AMD на GitHub, по лицензии AMD FSR SDK (github.com/GPUOpen-LibrariesAndSDKs/FidelityFX-SDK). SDK выбирает версию апскейлера, поддерживаемую видеокартой. Библиотеки нужны для AMD FSR в пункте «Апскейлеры»; без них этот выбор ничего не делает.", + "ui.fsr_help": "Из FSR SDK от AMD на GitHub, по лицензии AMD FSR SDK (github.com/GPUOpen-LibrariesAndSDKs/FidelityFX-SDK). SDK выбирает версию апскейлера, поддерживаемую видеокартой. Библиотеки нужны для AMD FSR в пункте «Апскейлеры»; без них этот выбор ничего не делает. Отмечено по умолчанию, если в компьютере есть видеокарта AMD.", "ui.compressed_help": "Сжатые файлы NSZ и XCZ подходят как есть: установка сама их распакует (для этого, пока извлекаются данные игры, нужно столько свободного места, сколько занимают распакованные файлы).", "ui.type_game": "Файлы игры (NSP, XCI, NSZ, XCZ)", "ui.type_keys": "Файлы ключей (*.keys)", diff --git a/installer/text/zh-Hans.json b/installer/text/zh-Hans.json index 8ae39dc1..05df7cad 100644 --- a/installer/text/zh-Hans.json +++ b/installer/text/zh-Hans.json @@ -141,7 +141,7 @@ "ui.dlss": "为 NVIDIA RTX 显卡下载 NVIDIA DLSS(nvngx_dlss.dll)", "ui.dlss_help": "来自 GitHub 上 NVIDIA 的 DLSS SDK,遵循 NVIDIA RTX SDK 许可(github.com/NVIDIA/DLSS)。没有它,dlaa 和 DLSS 设置不起作用。", "ui.fsr": "为兼容 Vulkan 的显卡下载 AMD FSR SDK 库(FSR 3.1/4)", - "ui.fsr_help": "来自 GitHub 上 AMD 的 FSR SDK,遵循 AMD FSR SDK 许可(github.com/GPUOpen-LibrariesAndSDKs/FidelityFX-SDK)。SDK 会选择显卡支持的超分辨率版本。要在“超分辨率技术”中使用 AMD FSR,必须安装这些库;否则该选项不起作用。", + "ui.fsr_help": "来自 GitHub 上 AMD 的 FSR SDK,遵循 AMD FSR SDK 许可(github.com/GPUOpen-LibrariesAndSDKs/FidelityFX-SDK)。SDK 会选择显卡支持的超分辨率版本。要在“超分辨率技术”中使用 AMD FSR,必须安装这些库;否则该选项不起作用。电脑装有 AMD 显卡时默认勾选。", "ui.compressed_help": "压缩的 NSZ 和 XCZ 文件可以直接使用:安装程序会自行解压(在游戏数据提取完成之前,需要与解压后文件大小相同的可用空间)。", "ui.type_game": "游戏文件(NSP、XCI、NSZ、XCZ)", "ui.type_keys": "密钥文件(*.keys)", diff --git a/runtime/ui_text.c b/runtime/ui_text.c index 44448e5b..34c9d835 100644 --- a/runtime/ui_text.c +++ b/runtime/ui_text.c @@ -150,7 +150,8 @@ static const char *const text_en[UI_TEXT_COUNT] = { "draws less of it. Takes effect at the next start.", [UI_MENU_DLAA] = "Upscalers", [UI_MENU_DLAA_DESC] = "What smooths and scales the 3D scene. NVIDIA DLSS: NVIDIA RTX GPUs, " DLSS_FILE " next to " EXE_FILE - ". AMD FSR: AMD Radeon GPUs, FSR 4 on the RX 9000, 7000 and 6000 series and FSR 3.1 elsewhere " + ". AMD FSR: FSR 4 on AMD Radeon RX 9000, 7000 and 6000, FSR 3.1 on other GPUs " + "AMD's library supports " "(Windows; amd_fidelityfx_loader_vk.dll and amd_fidelityfx_upscaler_vk.dll next to " EXE_FILE "); with it the game's FXAA and its dynamic resolution are off. Smoother edges and less " "shimmer; the HUD is not touched. The mode below sets the resolution it works from. Takes " @@ -708,8 +709,9 @@ static const char *const text_ru[UI_TEXT_COUNT] = { "перезапуска.", [UI_MENU_DLAA] = "Апскейлеры", [UI_MENU_DLAA_DESC] = "Что сглаживает и масштабирует 3D-сцену. NVIDIA DLSS: видеокарты NVIDIA RTX, " DLSS_FILE " рядом с " - EXE_FILE ". AMD FSR: видеокарты AMD Radeon, FSR 4 на сериях RX 9000, 7000 и 6000 и FSR 3.1 на " - "остальных (Windows; amd_fidelityfx_loader_vk.dll и amd_fidelityfx_upscaler_vk.dll рядом с " + EXE_FILE ". AMD FSR: FSR 4 на AMD Radeon RX 9000, 7000 и 6000, FSR 3.1 на других видеокартах, " + "которые поддерживает библиотека AMD (Windows; amd_fidelityfx_loader_vk.dll и " + "amd_fidelityfx_upscaler_vk.dll рядом с " EXE_FILE "); с ним FXAA игры и её динамическое разрешение выключены. Ровнее края и меньше " "мерцания; интерфейс не затрагивается. Режим ниже задаёт разрешение, с которым он работает. " "Действует после перезапуска.", @@ -1677,8 +1679,9 @@ static const char *const text_pt_br[UI_TEXT_COUNT] = { "cai (PCSS). 0 mantém o filtro do jogo. Vale no próximo início.", [UI_MENU_DLAA] = "Upscalers", [UI_MENU_DLAA_DESC] = "O que suaviza e amplia a cena 3D. NVIDIA DLSS: placas NVIDIA RTX, nvngx_dlss.dll ao lado do " - "totk.exe. AMD FSR: placas AMD Radeon, FSR 4 nas séries RX 9000, 7000 e 6000 e FSR 3.1 nas " - "demais (Windows; amd_fidelityfx_loader_vk.dll e amd_fidelityfx_upscaler_vk.dll ao lado do " + "totk.exe. AMD FSR: FSR 4 nas AMD Radeon RX 9000, 7000 e 6000, FSR 3.1 nas outras placas que a " + "biblioteca da AMD suporta (Windows; amd_fidelityfx_loader_vk.dll e " + "amd_fidelityfx_upscaler_vk.dll ao lado do " "totk.exe); com ele o FXAA do jogo e a resolução dinâmica ficam desligados. Bordas mais suaves " "e menos cintilação; o HUD não é afetado. O modo abaixo define a resolução de onde ele parte. " "Vale após reiniciar.", @@ -2366,7 +2369,7 @@ static const char *const text_zh_hans[UI_TEXT_COUNT] = { [UI_MENU_PCSS_DESC] = "物体接触地面处的太阳阴影锐利,阴影投得越远越柔和(PCSS)。0 保留游戏自身的过滤。下次启动时生效。", [UI_MENU_DLAA] = "超分辨率技术", [UI_MENU_DLAA_DESC] = "平滑并放大 3D 场景的技术。NVIDIA DLSS:NVIDIA RTX 显卡,nvngx_dlss.dll 放在 totk.exe 旁。AMD FSR:AMD Radeon " - "显卡,RX 9000、7000 和 6000 系列为 FSR 4,其他为 FSR 3.1(Windows;amd_fidelityfx_loader_vk.dll 和 " + "RX 9000、7000 和 6000 系列为 FSR 4,AMD 库支持的其他显卡为 FSR 3.1(Windows;amd_fidelityfx_loader_vk.dll 和 " "amd_fidelityfx_upscaler_vk.dll 放在 totk.exe 旁);使用它时游戏的 FXAA 和动态分辨率关闭。边缘更平滑," "闪烁更少;HUD 不受影响。下方的模式决定它的工作分辨率。重启后生效。", [UI_MENU_DLAA_OFF] = "关", diff --git a/tests/installer_gui_test.py b/tests/installer_gui_test.py index 1b31b13e..4abb0804 100644 --- a/tests/installer_gui_test.py +++ b/tests/installer_gui_test.py @@ -41,7 +41,8 @@ from installer.runner import Context # noqa: E402 from installer.steps import Fonts, all_steps # noqa: E402 from installer.guilogic import (DONE, FAILED, PENDING, RUNNING, SKIPPED, UI_LANGUAGE_LABELS, # noqa: E402 UI_LANGUAGES, Catalog, Form, Model, Process, amount, default_game_language, - describe_event, parse_line, ui_language_for_langid, windows_ui_language) + describe_event, fsr_default, parse_line, ui_language_for_langid, + windows_ui_language) INSTALLED = ROOT / 'build' / 'install-test' FIXTURE = ROOT / 'build' / 'inst-gui' / 'e2e-install' @@ -181,6 +182,21 @@ class RunStatesTest(unittest.TestCase): self.assertEqual(m.result, 'ok') +class FsrDefaultTest(unittest.TestCase): + """Download AMD FSR is ticked at start with an AMD adapter only, and when no adapter could be listed.""" + + def test_amd(self): + self.assertTrue(fsr_default(['AMD Radeon RX 9060 XT'])) + self.assertTrue(fsr_default(['Intel(R) UHD Graphics', 'AMD Radeon(TM) Graphics'])) + + def test_other_gpus(self): + self.assertFalse(fsr_default(['NVIDIA GeForce RTX 4080 SUPER'])) + self.assertFalse(fsr_default(['Intel(R) Arc(TM) A770 Graphics', 'Microsoft Basic Render Driver'])) + + def test_unknown(self): + self.assertTrue(fsr_default([])) + + class FormTest(unittest.TestCase): def setUp(self): self.tmp = tempfile.TemporaryDirectory()