From a4fde2090ab38e2464ab10fe841730f6a5e47b0d Mon Sep 17 00:00:00 2001 From: chrg6 Date: Sat, 7 Nov 2026 09:14:36 -0500 Subject: [PATCH] Put DLSS back in the settings menu, and build the kit's runtime at -O2 without strict aliasing. The Screen tab gets the DLSS switch and its model choice after the picture rows. There is no quality-mode row: this build cannot change the game's scene size, so every mode would render the same. The description says that DLSS works on each frame on its own for now and takes effect after a restart; the model row is greyed out while DLSS is off. tools/make_game.py compiles with tools/build_game.py's aliasing rule: -fno-strict-aliasing everywhere, since the lifted code reaches guest memory through casts of one address to several types, and the runtime at -O2 (the lifted code stays at -O1). x86-64-v3 is left out so that the kit runs on CPUs without AVX2. Co-Authored-By: Claude Opus 5.5 --- runtime/ui/menu.cpp | 6 ++++++ runtime/ui_text.c | 5 +++++ runtime/ui_text.h | 2 ++ tools/make_game.py | 7 +++++-- 4 files changed, 18 insertions(+), 2 deletions(-) diff --git a/runtime/ui/menu.cpp b/runtime/ui/menu.cpp index 68855d76..312612c7 100644 --- a/runtime/ui/menu.cpp +++ b/runtime/ui/menu.cpp @@ -748,6 +748,12 @@ static void tab_screen(float scale) { opt_slider("NX2NAVI_SHARPNESS", UI_MENU_SHARPNESS, 0, 100, UI_MENU_SHARPNESS_DESC, 5, "%.0f %%"); static const UiTextId aspect[] = {UI_MENU_ASPECT_FIT, UI_MENU_ASPECT_STRETCH}; opt_choice("NX2NAVI_ASPECT", UI_MENU_ASPECT, aspect, 2, UI_MENU_ASPECT_DESC); + // DLSS at the game's own resolution (vk_dlaa.c). This build cannot change the scene size (no scene patch set), so + // the quality modes would all render the same: there is no mode row, only the switch and the model. + opt_toggle("NX2NAVI_DLAA", UI_MENU_DLAA, UI_MENU_DLAA_GAME_DESC); + static const UiTextId preset[] = {UI_MENU_DLSS_PRESET_DEFAULT, UI_MENU_DLSS_PRESET_K, UI_MENU_DLSS_PRESET_J}; + if (!cfg_bool("NX2NAVI_DLAA")) opt_disable_next(UI_MENU_DLSS_PRESET_NEEDS_DLAA); + opt_choice("NX2NAVI_DLSS_PRESET", UI_MENU_DLSS_PRESET, preset, 3, UI_MENU_DLSS_PRESET_DESC); opt_end(); } diff --git a/runtime/ui_text.c b/runtime/ui_text.c index c7e7bf92..d1c10bf9 100644 --- a/runtime/ui_text.c +++ b/runtime/ui_text.c @@ -502,6 +502,11 @@ static const char *const text_en[UI_TEXT_COUNT] = { [UI_MENU_CHEAT_UNSUPPORTED_DESC] = "This cheat cannot be used with this version of the game:", [UI_BOOT_TITLE] = "Preparing shaders", [UI_BOOT_HINT] = "This happens once after an update or a graphics driver change.", [UI_BOOT_STARTING] = "Starting", [UI_BOOT_SHADERS] = "Shaders: %lld of %lld", [UI_BOOT_PIPELINES] = "Pipelines: %lld of %lld", + [UI_MENU_DLAA_GAME_DESC] = "NVIDIA DLSS anti-aliasing for the 3D scene at the game's own resolution (NVIDIA RTX GPUs; " + DLSS_FILE " next to the game's .exe). The HUD is not touched. Early version: it works on " + "each frame on its own for now, without the motion history that makes DLSS sharpest. " + "Takes effect after a restart.", + [UI_MENU_DLSS_PRESET_NEEDS_DLAA] = "only with DLSS on", [UI_MENU_CHEATS_REBUILD] = "Rebuild the game now", [UI_MENU_CHEATS_REBUILD_DESC] = "Some cheats change the game's code and are not built into it: they are new or " "edited, or their last rebuild failed or was cancelled. Closes the game; the setup " diff --git a/runtime/ui_text.h b/runtime/ui_text.h index 71836c5b..53150189 100644 --- a/runtime/ui_text.h +++ b/runtime/ui_text.h @@ -241,6 +241,8 @@ typedef enum { // the boot screen while the boot prewarm prepares shaders and pipelines (boot.c, ui/menu.cpp menu_boot_frame) UI_BOOT_TITLE, UI_BOOT_HINT, UI_BOOT_STARTING, UI_BOOT_SHADERS, UI_BOOT_PIPELINES, // printf: "%lld" done, "%lld" total + // the settings menu's DLSS row for this game (ui/menu.cpp tab_screen): DLSS at the game's own resolution + UI_MENU_DLAA_GAME_DESC, UI_MENU_DLSS_PRESET_NEEDS_DLAA, UI_TEXT_COUNT } UiTextId; diff --git a/tools/make_game.py b/tools/make_game.py index ce45bba9..967a8bfc 100644 --- a/tools/make_game.py +++ b/tools/make_game.py @@ -343,8 +343,11 @@ def step_compile(out, cache, msys, jobs): def cc(job): src, dst = job cpp = src.suffix in ('.cpp', '.cxx') - cmd = [str(clangxx if cpp else clang), '-c', '-std=gnu++17' if cpp else '-std=gnu11', '-O1', '-w', *inc, - '-o', str(dst), str(src)] + # the lifted code at -O1 (its size makes -O2 slow to build), the runtime at -O2; neither may assume strict aliasing: + # the lifted code reaches guest memory through casts of one address to several types (tools/build_game.py's flags) + guest = dst.name.startswith(('main_', 'sdk_', 'subsdk0_')) + cmd = [str(clangxx if cpp else clang), '-c', '-std=gnu++17' if cpp else '-std=gnu11', '-O1' if guest else '-O2', + '-fno-strict-aliasing', '-w', *inc, '-o', str(dst), str(src)] p = subprocess.run(cmd, capture_output=True, text=True, env=env) return src, p.returncode, p.stderr[-1500:]