From 5f1d74023bd8634a7dcf3d1aa00342a639a6c185 Mon Sep 17 00:00:00 2001 From: Valiantsin Dzerakh Date: Sat, 14 Nov 2026 23:07:00 +0300 Subject: [PATCH] Remove the lod_range setting and the lodrange patch set; lod_steady stays Playtests showed no visible difference from lod_range, and the emulator mod scene dropped the same change as a placebo. Co-Authored-By: Claude Opus 5.5 --- README.md | 1 - recomp/patches-v110.txt | 4 +--- recomp/patches-v121.txt | 11 ----------- recomp/patches-v143.txt | 6 ------ recomp/patches.py | 3 +-- runtime/cfg.c | 6 +++--- runtime/resolution.c | 24 ------------------------ runtime/ui/menu.cpp | 9 --------- runtime/ui_text.c | 12 ------------ runtime/ui_text.h | 2 +- totk.ini.example | 5 ----- 11 files changed, 6 insertions(+), 77 deletions(-) diff --git a/README.md b/README.md index 74ebb886..38780dce 100644 --- a/README.md +++ b/README.md @@ -25,7 +25,6 @@ Report problems as issues, following [CONTRIBUTING.md](CONTRIBUTING.md). - 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 -- Model detail range: models keep their detailed versions 1.5, 2 or 3 times farther, or at any distance (1.2.1 and 1.4.3) - In-game settings menu (F1) and performance overlay (F10) - Play time across runs on the Game tab of the settings menu, kept in `playtime.txt` next to the saves - Discord Rich Presence ("Playing TotK Recomp" with the play time), off by default, own application id supported diff --git a/recomp/patches-v110.txt b/recomp/patches-v110.txt index 691903e6..fcbc84ec 100644 --- a/recomp/patches-v110.txt +++ b/recomp/patches-v110.txt @@ -12,9 +12,7 @@ set output TOTK_PATCH_OUTPUT 0 set scene TOTK_PATCH_SCENE 0 set shadow TOTK_PATCH_SHADOW 0 set cascade TOTK_PATCH_CASCADE 0 -# Model level of detail and load-dependent quality (patches-v121.txt explains both): no sites found in this version -# yet, so the settings do nothing. -set lodrange TOTK_PATCH_LODRANGE 0 +# Load-dependent quality (patches-v121.txt explains it): no sites found in this version yet, so the setting does nothing. set steady TOTK_LOD_STEADY 0 # 60 fps: the adaptive present-interval controller (main+0x8f26c8, 1.0.0 0x8f6bec) gets the minimum interval 1. diff --git a/recomp/patches-v121.txt b/recomp/patches-v121.txt index 563cb6c7..f1749df4 100644 --- a/recomp/patches-v121.txt +++ b/recomp/patches-v121.txt @@ -143,17 +143,6 @@ set pooloff TOTK_POOL_OFFSET_PATCH 1 site pooloff main ad43f0 93407f22 2a1903e2 # sxtw x2, w25 -> mov w2, w25 (SetStorage offset) site pooloff main ad440c 8b39c101 8b394101 # add x1, x8, w25, sxtw -> add x1, x8, w25, uxtw (packaged data source) -# Model level of detail (runtime/resolution.c res_lod_range switches the set on). Each model unit keeps one record per -# view with a depth B, a second value 1.0 and a slope S = 1/(B - 1); the level pick (the virtual method main+0x27d225c -# and its inlined copies in the culling passes) keeps the most detailed level while the depth along the camera axis is -# within B and moves to coarser levels evenly up to B + 1/S. Most picks run the inlined copies, so the sites are where -# B is computed at model setup instead: the setter main+0x10eca28 (it saves B in s9 and derives S from it) and its -# inlined copy in main+0x925808. Both replace B with k * B + c from page +96 and +100 (k = 1.5, 2 or -# 3 with c = 0 moves every transition about k times farther; k = 1, c = 1e30 keeps the most detailed level at any -# depth). The models of an area take the value when they are set up, so a change shows after a restart. -set lodrange TOTK_PATCH_LODRANGE 0 -site lodrange main 10eca44 4ea01c09 @page:x8 2d4c0d02 1f020c00 4ea01c09 # mov v9.16b, v0.16b -> ldp s2, s3, [page+96]; fmadd s0, s0, s2, s3; mov v9.16b, v0.16b (x8, s2, s3 free here) -site lodrange main 925838 1e292100 @page:x8 2d4c0500 1f000508 1e292100 # fcmp s8, s9 -> ldp s0, s1, [page+96]; fmadd s8, s8, s0, s1; fcmp s8, s9 (x8 reloaded at +0x18, s0/s1 rewritten before use) # Load-dependent quality, after the emulator mod "Disable LOD Quality Reduction" (main-1.2.1.pchtxt), which turns a # conditional branch into an unconditional one; the generator patches only plain instructions (recomp/gen.py, the # emitter's patch), so the site feeds the branch instead. The graphics settings setup (main+0xc7e9xx, it also reads the diff --git a/recomp/patches-v143.txt b/recomp/patches-v143.txt index 568e86e1..6652899c 100644 --- a/recomp/patches-v143.txt +++ b/recomp/patches-v143.txt @@ -13,12 +13,6 @@ set scene TOTK_PATCH_SCENE 0 set shadow TOTK_PATCH_SHADOW 0 set cascade TOTK_PATCH_CASCADE 0 set grass TOTK_PATCH_GRASS 0 -# Model level of detail (patches-v121.txt explains the set; runtime/resolution.c res_lod_range switches it on). The -# setter main+0xc3dbe4 (1.2.1 0x10eca28) takes B in s0 and computes S = 1/(B - 1) after its entry compare, and -# main+0x3b8490 (1.2.1 0x925808) is its inlined copy; both scale B before the compare, so S follows. -set lodrange TOTK_PATCH_LODRANGE 0 -site lodrange main c3dbe4 1e212000 @page:x8 2d4c1103 1f031000 1e212000 # fcmp s0, s1 -> ldp s3, s4, [page+96]; fmadd s0, s0, s3, s4; fcmp s0, s1 (x8 written before any read, s3 written at +0xc, s4 unused) -site lodrange main 3b84d0 1e212000 @page:x8 2d4c0d02 1f020c00 1e212000 # fcmp s0, s1 -> ldp s2, s3, [page+96]; fmadd s0, s0, s2, s3; fcmp s0, s1 (x8 reloaded at +0x18, s2/s3 dead) # Load-dependent quality (patches-v121.txt, set steady). The graphics settings setup (main+0x5868c4) inlines the # three getters 1.2.1 calls: the value 1.2.1 reads at # main+0xc7eb24 is the ldr w10, [x10, #0x38] at main+0x58692c, and the getters' slow paths (main+0x586bc8, 0x586c18, diff --git a/recomp/patches.py b/recomp/patches.py index 884f4aee..f7ef378b 100644 --- a/recomp/patches.py +++ b/recomp/patches.py @@ -17,8 +17,7 @@ of the 2 MiB-aligned module slot free); the runtime commits it and owns its cont +0..15 the frame-rate step (runtime/frame_rate.c), +16..55 the output, swapchain and scene sizes (runtime/resolution.c res_init), +56..59 the camera's aspect ratio (runtime/resolution.c res_init, set aspect), +60..63 the field-of-view factor (runtime/resolution.c res_fov_live, set fov), +92..95 the sun shadow map size -(runtime/resolution.c shadow_init, set shadow), +96..103 the model detail depth factor and offset -(runtime/resolution.c res_lod_range, set lodrange). A new set takes words outside these. +(runtime/resolution.c shadow_init, set shadow). A new set takes words outside these. The replacement words are lifted at the site's address in place of the original instruction, and the generated C reads `if (rt_patch_on[]) { replacement } else { original }`: one byte load and a branch per executed site. Several diff --git a/runtime/cfg.c b/runtime/cfg.c index 31381696..4fa705fa 100644 --- a/runtime/cfg.c +++ b/runtime/cfg.c @@ -51,7 +51,7 @@ static const char *const known[] = { "GAMEPLAY_WEAPON_WHEEL", "GPL", "GPL_DRAW_BUILD", "GPU", "GPU_INDEX", "GPU_NAME", "GRASS_RANGE", "HDR", "HDR_GAME_NITS", "HDR_HUE", "HDR_PEAK_NITS", "HDR_UI_NITS", "HIGHFPS_FIX", "INPUT", "INPUT_RECORD", "INPUT_SCRIPT", "KSPIN_US", "LANG", "LIB_PREBUILD", - "LIB_PREBUILD_KEEP", "LIB_PREBUILD_THREADS", "LOCALE", "LOD_GUARD", "LOD_RANGE", "LOD_STEADY", "LSTICK_DEADZONE", "MAP_CLICK", "MEMORY", "MEMX", "MENU_LANG", "MENU_TEST", "MENU_FONT_FONTCONFIG", + "LIB_PREBUILD_KEEP", "LIB_PREBUILD_THREADS", "LOCALE", "LOD_GUARD", "LOD_STEADY", "LSTICK_DEADZONE", "MAP_CLICK", "MEMORY", "MEMX", "MENU_LANG", "MENU_TEST", "MENU_FONT_FONTCONFIG", "MEM_RESERVE_MIB", "MENU_CURSOR", "MENU_CURSOR_LOG", "MENU_TEST_DIR", "MENU_TEST_SET", "MINIMAL_LAYOUT", "MIRROR_GAP", "MODS_DIR", "MODS_DISABLED", "MODS_ORDER", "MODS_REBUILD", "MOTION", "MOUSE_AIM_SCALE", "MOUSE_MODE", "MOUSE_DIRECT_PATCH", "MOUSE_SENS", "MOVIE_ASPECT", "MOVIE_HOST", "MOVIE_PACE", "MVOBJ_ALL", "MVOBJ_BANKS", "MVOBJ_EQUAL", "MVOBJ_EXACT", "MVOBJ_EXEC", "MVOBJ_NOC4", "MVOBJ_ONLY", "MVOBJ_TIMES", "MVPREV_CHECK", "MVPREV_GROW", "MVPREV_SKIP", "MVPREV_TRUST", "MV_CHECK", "MV_SURVEY", @@ -78,7 +78,7 @@ static const struct { const char *key, *section; } sections[] = { {"FULLSCREEN", "display"}, {"WINDOW_SIZE", "display"}, {"PERF_OVERLAY", "display"}, {"VK_PRESENT", "display"}, {"GPU_INDEX", "display"}, {"OUTPUT_RES", "display"}, {"RENDER_SCALE", "display"}, {"UPSCALER", "display"}, {"SHARPNESS", "display"}, {"DYNAMIC_RES", "display"}, {"ASPECT", "display"}, {"MOVIE_ASPECT", "display"}, {"FOV", "display"}, {"ANISO", "display"}, - {"LOD_RANGE", "display"}, {"LOD_STEADY", "display"}, {"COLOR_PRESET", "display"}, + {"LOD_STEADY", "display"}, {"COLOR_PRESET", "display"}, {"COLOR_BRIGHTNESS", "display"}, {"COLOR_CONTRAST", "display"}, {"COLOR_SATURATION", "display"}, {"COLOR_GAMMA", "display"}, {"HDR", "display"}, {"HDR_PEAK_NITS", "display"}, {"HDR_GAME_NITS", "display"}, {"HDR_UI_NITS", "display"}, {"HDR_HUE", "display"}, {"SHADOW_RES", "display"}, @@ -138,7 +138,7 @@ static const CfgMeta metas[] = { {"DLAA", "0", "0|1", RESTART}, {"DLSS", "dlaa", "dlaa|quality|balanced|performance|ultra_performance", LIVE}, {"DLSS_PRESET", "default", "default|k|j", LIVE}, {"DLSS_CHAR_MASK", "65", "0|35|65|100", LIVE}, {"REFLEX", "off", "off|on|boost", RESTART}, {"FXAA", "1", "0|1", LIVE}, - {"LOD_RANGE", "100", "100|150|200|300|max", RESTART}, {"LOD_STEADY", "0", "0|1", RESTART}, // sets lodrange, steady + {"LOD_STEADY", "0", "0|1", RESTART}, // sets steady {"ASPECT", "fit", "fit|stretch", LIVE}, {"MOVIE_ASPECT", "keep", "keep|stretch", LIVE}, {"FOV", "100", "70..140", LIVE}, {"ANISO", "game", "game|2|4|8|16", RESTART}, // vk_texture.c sampler_features // colour adjustment (vk_color.c); the preset is the menu's, the four values are what the present uses diff --git a/runtime/resolution.c b/runtime/resolution.c index 6102ab07..313967fd 100644 --- a/runtime/resolution.c +++ b/runtime/resolution.c @@ -547,33 +547,9 @@ static void res_grass_range(void) { pct); } -// TOTK_LOD_RANGE (100, 150, 200, 300 or max; 100 = the game's): how far models keep their detailed levels. The game -// sets each model's level depth B when it sets the model up and derives the slope of its coarser levels from it (the -// lodrange patch set, recomp/patches-v121.txt); the set replaces B with k * B + c from page +96 and +100. A percent -// moves every level transition about that many times farther (c = 0); max keeps the most detailed level at any depth -// (k = 1, c = 1e30, far past any depth the pick compares). -static void res_lod_range(void) { - const char *v = cfg_get("TOTK_LOD_RANGE"); - int max = v && !strcasecmp(v, "max"), pct = max ? 0 : cfg_int("TOTK_LOD_RANGE"); - if (!max && (pct <= 100 || pct > 300)) return; - int set = rt_patch_set("lodrange"); - if (set < 0) { - rt_log("resolution: this game version has no lodrange patch set; lod_range stays 100"); - return; - } - float f[2] = {max ? 1.0f : pct / 100.0f, max ? 1e30f : 0.0f}; - memcpy((uint8_t *)rt_patch_page() + 96, f, sizeof f); - rt_patch_switch(set, 1); - if (max) - rt_log("resolution: models keep their most detailed level at any depth (TOTK_LOD_RANGE=max)"); - else - rt_log("resolution: model level depths x%g (TOTK_LOD_RANGE=%d)", f[0], pct); -} - void res_init(void) { res_shadow_range(); res_grass_range(); - res_lod_range(); if (!bigger()) { rt_log("resolution: the game's own (output 1920x1080, scene 1600x900)"); shadow_init(rt_patch_page()); diff --git a/runtime/ui/menu.cpp b/runtime/ui/menu.cpp index e7617dd1..8b32c7c3 100644 --- a/runtime/ui/menu.cpp +++ b/runtime/ui/menu.cpp @@ -587,14 +587,6 @@ static void row_grass_range(void) { opt_choice_list("TOTK_GRASS_RANGE", UI_MENU_GRASS_RANGE, vals, names, 6, UI_MENU_GRASS_RANGE_DESC); } -// Model detail range (resolution.c res_lod_range): how far models keep their detailed levels, in percent of the game's -// depths, or max for the most detailed level at any depth. -static void row_lod_range(void) { - static const char *const vals[] = {"100", "150", "200", "300", "max"}; - const char *names[] = {"1x", "1.5x", "2x", "3x", menu_text(UI_MENU_LOD_RANGE_MAX)}; - opt_choice_list("TOTK_LOD_RANGE", UI_MENU_LOD_RANGE, vals, names, 5, UI_MENU_LOD_RANGE_DESC); -} - static void row_gpu(void) { const char *vals[MAX_GPUS + 1], *names[MAX_GPUS + 1]; char idx[MAX_GPUS][4]; @@ -727,7 +719,6 @@ static void tab_screen(float scale) { row_shadow_scale(); row_shadow_range(); row_grass_range(); - row_lod_range(); opt_toggle("TOTK_LOD_STEADY", UI_MENU_LOD_STEADY, UI_MENU_LOD_STEADY_DESC); opt_slider("TOTK_PCSS", UI_MENU_PCSS, 0, 200, UI_MENU_PCSS_DESC, 10, "%.0f %%"); opt_slider("TOTK_CONTACT_SHADOWS", UI_MENU_CONTACT_SHADOWS, 0, 100, UI_MENU_CONTACT_SHADOWS_DESC, 10, "%.0f %%"); diff --git a/runtime/ui_text.c b/runtime/ui_text.c index efbc3e76..8a627f9f 100644 --- a/runtime/ui_text.c +++ b/runtime/ui_text.c @@ -96,9 +96,6 @@ static const char *const text_en[UI_TEXT_COUNT] = { [UI_MENU_ANISO] = "Texture filtering", [UI_MENU_ANISO_DESC] = "Anisotropic filtering of surface textures: ground, roads and walls seen at a shallow angle stay sharp into the distance instead of blurring. Game: the level the game asks for, as on the Switch.", [UI_MENU_ANISO_GAME] = "Game", - [UI_MENU_LOD_RANGE] = "Model detail range", - [UI_MENU_LOD_RANGE_DESC] = "How far models keep their detailed versions before the game switches to simpler ones. Higher keeps cliffs, ruins and sky islands detailed further out; Max never simplifies them. Costs GPU time, more on weaker graphics cards. Grass has its own range above. Takes effect at the next start.", - [UI_MENU_LOD_RANGE_MAX] = "Max", [UI_MENU_LOD_STEADY] = "Steady detail under load", [UI_MENU_LOD_STEADY_DESC] = "Skips the game's setup for lowering model and texture detail when the frame rate drops, as the emulator mod Disable LOD Quality Reduction does. Game versions 1.2.1 and 1.4.3. Leave it off on weak PCs: there this drop keeps the frame rate up.", [UI_MENU_SHARPNESS] = "FSR sharpness", @@ -634,9 +631,6 @@ static const char *const text_ru[UI_TEXT_COUNT] = { [UI_MENU_ANISO] = "Фильтрация текстур", [UI_MENU_ANISO_DESC] = "Анизотропная фильтрация текстур поверхностей: земля, дороги и стены под острым углом остаются чёткими вдали, а не размываются. Игра: уровень, который запрашивает игра, как на Switch.", [UI_MENU_ANISO_GAME] = "Игра", - [UI_MENU_LOD_RANGE] = "Дальность детализации моделей", - [UI_MENU_LOD_RANGE_DESC] = "Как далеко модели остаются подробными, прежде чем игра заменит их упрощёнными. Выше: скалы, руины и небесные острова подробны дальше; «Максимум»: модели не упрощаются никогда. Нагружает видеокарту, слабую сильнее. У травы своя дальность выше. Действует после перезапуска.", - [UI_MENU_LOD_RANGE_MAX] = "Максимум", [UI_MENU_LOD_STEADY] = "Стабильная детализация под нагрузкой", [UI_MENU_LOD_STEADY_DESC] = "Пропускает настройку игры, снижающую детализацию моделей и текстур при падении частоты кадров, как эмуляторный мод Disable LOD Quality Reduction. Только для версий игры 1.2.1 и 1.4.3. На слабых ПК не включайте: там это снижение и держит частоту кадров.", [UI_MENU_SHARPNESS] = "Резкость FSR", @@ -1482,9 +1476,6 @@ static const char *const text_pt_br[UI_TEXT_COUNT] = { "ângulo raso continuam nítidos ao longe em vez de borrar. Jogo: o nível que o jogo pede, " "como no Switch.", [UI_MENU_ANISO_GAME] = "Jogo", - [UI_MENU_LOD_RANGE] = "Alcance do detalhe dos modelos", - [UI_MENU_LOD_RANGE_DESC] = "Até onde os modelos mantêm as versões detalhadas antes de o jogo trocá-las por versões mais simples. Mais alto mantém penhascos, ruínas e ilhas do céu detalhados mais longe; Máximo nunca os simplifica. Custa tempo de GPU, mais em placas fracas. A grama tem o próprio alcance acima. Vale no próximo início.", - [UI_MENU_LOD_RANGE_MAX] = "Máximo", [UI_MENU_LOD_STEADY] = "Detalhe estável sob carga", [UI_MENU_LOD_STEADY_DESC] = "Pula a configuração do jogo que reduz o detalhe de modelos e texturas quando a taxa " "de quadros cai, como faz o mod de emulador Disable LOD Quality Reduction. Só nas " @@ -2198,9 +2189,6 @@ static const char *const text_zh_hans[UI_TEXT_COUNT] = { [UI_MENU_ANISO] = "纹理过滤", [UI_MENU_ANISO_DESC] = "表面纹理的各向异性过滤:以小角度看到的地面、道路和墙壁在远处依然清晰,而不会模糊。游戏:使用游戏请求的级别,与 Switch 上相同。", [UI_MENU_ANISO_GAME] = "游戏", - [UI_MENU_LOD_RANGE] = "模型细节范围", - [UI_MENU_LOD_RANGE_DESC] = "模型在游戏换成简化版本之前保持细节的距离。调高后悬崖、遗迹和天空岛在更远处仍保持细节;“最大”则从不简化。会占用显卡时间,显卡越弱影响越大。草地在上方有单独的范围设置。下次启动时生效。", - [UI_MENU_LOD_RANGE_MAX] = "最大", [UI_MENU_LOD_STEADY] = "负载下保持细节", [UI_MENU_LOD_STEADY_DESC] = "跳过游戏在帧率下降时降低模型和纹理细节的设置,与模拟器模组 Disable LOD Quality " "Reduction 的作用相同。仅适用于游戏版本 1.2.1 和 1.4.3。低配电脑请勿开启:在那里正是这种降低维持了帧率。", diff --git a/runtime/ui_text.h b/runtime/ui_text.h index 38d88a01..b2812bd7 100644 --- a/runtime/ui_text.h +++ b/runtime/ui_text.h @@ -42,7 +42,7 @@ typedef enum { UI_MENU_FOV, UI_MENU_FOV_DESC, UI_MENU_SHADOW_RES, UI_MENU_SHADOW_RES_DESC, UI_MENU_SHADOW_RES_GAME, UI_MENU_ANISO, UI_MENU_ANISO_DESC, UI_MENU_ANISO_GAME, - UI_MENU_LOD_RANGE, UI_MENU_LOD_RANGE_DESC, UI_MENU_LOD_RANGE_MAX, UI_MENU_LOD_STEADY, UI_MENU_LOD_STEADY_DESC, + UI_MENU_LOD_STEADY, UI_MENU_LOD_STEADY_DESC, UI_MENU_SHARPNESS, UI_MENU_SHARPNESS_DESC, UI_MENU_COLOR, // group heading over the colour rows UI_MENU_COLOR_PRESET, UI_MENU_COLOR_PRESET_DESC, UI_MENU_COLOR_DEFAULT, UI_MENU_COLOR_VIVID, UI_MENU_COLOR_CLARITY, diff --git a/totk.ini.example b/totk.ini.example index 26a80e6e..a2b8a4a1 100644 --- a/totk.ini.example +++ b/totk.ini.example @@ -249,11 +249,6 @@ # it; the grass map's textures grow with it, so its detail per metre stays the game's, and the grass heap grows by about # 9 MiB times (percent / 100)^2 - 1. Lower draws less grass. Read at start. # grass_range = 100 -# How far models keep their detailed levels before the game switches them to simpler ones: 100 (the game's), 150, 200 -# or 300 percent of its depths, or max for the most detailed level at any depth (recomp/patches-v121.txt, set -# lodrange). Higher keeps cliffs, ruins and sky islands detailed further out and costs GPU time. Game versions 1.2.1 -# and 1.4.3. Read at start. -# lod_range = 100 # Steady detail under load: 1 skips the game's setup for lowering model and texture detail when the frame rate drops, # as the emulator mod "Disable LOD Quality Reduction" does (set steady); 0 (the default) leaves it. Leave it off on weak # PCs, where that drop keeps the frame rate up. Game versions 1.2.1 and 1.4.3. Read at start.