diff --git a/recomp/patches-v110.txt b/recomp/patches-v110.txt index 456b0475..fcbc84ec 100644 --- a/recomp/patches-v110.txt +++ b/recomp/patches-v110.txt @@ -12,6 +12,8 @@ set output TOTK_PATCH_OUTPUT 0 set scene TOTK_PATCH_SCENE 0 set shadow TOTK_PATCH_SHADOW 0 set cascade TOTK_PATCH_CASCADE 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. site fps60 main 90e978 6b08015f 7100055f # clamp: cmp w10, #1 (was cmp w10, w8 = minimum) diff --git a/recomp/patches-v121.txt b/recomp/patches-v121.txt index 738d605d..f1749df4 100644 --- a/recomp/patches-v121.txt +++ b/recomp/patches-v121.txt @@ -143,6 +143,17 @@ 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) +# 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 +# FSR and FXAA switches) walks a +# list at its +0x120 and passes three floats of each entry to virtual setters, which the mod describes as the drop of +# model and texture detail when the frame rate falls; it skips all of it, to the epilogue, when the value it reads at +# main+0xc7eb24 is above 8. Reading 9 there skips it as the mod does; w21 is not read again on that path (the epilogue +# restores it). +set steady TOTK_LOD_STEADY 0 +site steady main c7eb24 b9400815 52800135 # ldr w21, [x0, #8] -> mov w21, #9 (b.gt 0xc7ee4c taken) + # Direct mouse camera (runtime/mouse_direct.c; the same hooks as patches-v143.txt, mapped by enclosing function to the # 1.2.1 main, each original word checked). The camera input update (main+0xd18088, 1.4.3 0x874c1c) after its dead zone, # clamp and StickExponent keeps x in s11 (1.4.3 s9); the host callback performs the displaced store and adds raw mouse diff --git a/recomp/patches-v143.txt b/recomp/patches-v143.txt index 404a3b10..6652899c 100644 --- a/recomp/patches-v143.txt +++ b/recomp/patches-v143.txt @@ -13,6 +13,13 @@ set scene TOTK_PATCH_SCENE 0 set shadow TOTK_PATCH_SHADOW 0 set cascade TOTK_PATCH_CASCADE 0 set grass TOTK_PATCH_GRASS 0 +# 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, +# 0x586f44) come back before the compare. So the site is the compare, which every path reaches: w10 = 9 skips the +# list walk to the epilogue (main+0x58729c), which does not read w10. +set steady TOTK_LOD_STEADY 0 +site steady main 586954 7100215f 5280012a 7100215f # cmp w10, #8 -> mov w10, #9; cmp w10, #8 (b.gt 0x58729c taken) # 60 fps: the adaptive present-interval controller (main+0x2db174, 1.2.1 0x8f26c8) gets the minimum interval 1. site fps60 main 2db204 6b08015f 7100055f # clamp: cmp w10, #1 (was cmp w10, w8 = minimum) diff --git a/runtime/cfg.c b/runtime/cfg.c index 9d0aafe5..dda29abd 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", "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"}, - {"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"}, @@ -139,6 +139,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_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/ui/menu.cpp b/runtime/ui/menu.cpp index ec9fbec4..43b122c2 100644 --- a/runtime/ui/menu.cpp +++ b/runtime/ui/menu.cpp @@ -722,6 +722,7 @@ static void tab_screen(float scale) { row_shadow_scale(); row_shadow_range(); row_grass_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 %%"); opt_toggle("TOTK_DLAA", UI_MENU_DLAA, UI_MENU_DLAA_DESC); diff --git a/runtime/ui_text.c b/runtime/ui_text.c index d3392591..50802d6d 100644 --- a/runtime/ui_text.c +++ b/runtime/ui_text.c @@ -96,6 +96,8 @@ 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_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", [UI_MENU_SHARPNESS_DESC] = "Sharpening after FSR scaling; 0 turns it off.", [UI_MENU_COLOR] = "Colour", @@ -635,6 +637,8 @@ static const char *const text_ru[UI_TEXT_COUNT] = { [UI_MENU_ANISO] = "Фильтрация текстур", [UI_MENU_ANISO_DESC] = "Анизотропная фильтрация текстур поверхностей: земля, дороги и стены под острым углом остаются чёткими вдали, а не размываются. Игра: уровень, который запрашивает игра, как на Switch.", [UI_MENU_ANISO_GAME] = "Игра", + [UI_MENU_LOD_STEADY] = "Стабильная детализация под нагрузкой", + [UI_MENU_LOD_STEADY_DESC] = "Пропускает настройку игры, снижающую детализацию моделей и текстур при падении частоты кадров, как эмуляторный мод Disable LOD Quality Reduction. Только для версий игры 1.2.1 и 1.4.3. На слабых ПК не включайте: там это снижение и держит частоту кадров.", [UI_MENU_SHARPNESS] = "Резкость FSR", [UI_MENU_SHARPNESS_DESC] = "Повышение резкости после масштабирования FSR; 0 выключает его.", [UI_MENU_COLOR] = "Цвет", @@ -1490,6 +1494,10 @@ 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_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 " + "versões 1.2.1 e 1.4.3 do jogo. Deixe desligado em PCs fracos: lá essa redução mantém a taxa de quadros.", [UI_MENU_COLOR] = "Cor", [UI_MENU_COLOR_PRESET] = "Perfil de cor", [UI_MENU_COLOR_PRESET_DESC] = "Define os quatro valores abaixo. Vívido: mais contraste e saturação, sombras um " @@ -2204,6 +2212,9 @@ 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_STEADY] = "负载下保持细节", + [UI_MENU_LOD_STEADY_DESC] = "跳过游戏在帧率下降时降低模型和纹理细节的设置,与模拟器模组 Disable LOD Quality " + "Reduction 的作用相同。仅适用于游戏版本 1.2.1 和 1.4.3。低配电脑请勿开启:在那里正是这种降低维持了帧率。", [UI_MENU_HDR_GROUP] = "HDR", [UI_MENU_HDR] = "HDR 输出", [UI_MENU_HDR_DESC] = "在 HDR 显示器上呈现明亮的高光。需要在 Windows 中开启 HDR(“使用 HDR”),或使用带色彩管理的 Wayland 合成器;否则画面保持 " diff --git a/runtime/ui_text.h b/runtime/ui_text.h index 1077e0dd..0f85f056 100644 --- a/runtime/ui_text.h +++ b/runtime/ui_text.h @@ -42,6 +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_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 4cc20269..8c27f7a4 100644 --- a/totk.ini.example +++ b/totk.ini.example @@ -249,6 +249,10 @@ # 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 +# 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. +# lod_steady = 0 # Screen-space contact shadows, strength in percent (0 = off): after the game lights its scene, each pixel traces a # short way toward the sun through the depth buffer and darkens where something close blocks it, adding the small # shadows at feet, under stones and in grass that the shadow maps miss. Read at start.