From 9d66735e73d8cb2ee140383604e7a013feca3fd8 Mon Sep 17 00:00:00 2001 From: Marjaperse <50570224+Marjaperse@users.noreply.github.com> Date: Mon, 16 Nov 2026 17:24:48 +0200 Subject: [PATCH] Make the dynamic resolution toggle work on game version 1.1.0 The menu exposed dynamic_res on 1.1.0, but its patch table had no fixres set, so disabling it left the engine's 80/90/100 percent tiers active. Patch the scale returned by the controller's common epilogue, matching the existing 1.2.1 and 1.4.3 implementation. The configured render scale remains the maximum size, and enabling dynamic resolution restores the original controller live. Extend the 1.1.0 differential patch tests across dynamic tiers and both switch states, checking register, SIMD and flag preservation. All 51 sites and 889 spin back-edges match local ExeFS; 720 native/Unicorn cases pass. All five runtime probes pass. Live off/on/off testing shows native 3440x1440, lower tiers when enabled, and 3440x1440 again when disabled. --- recomp/patches-v110.txt | 5 +++++ runtime/resolution.c | 2 +- tests/patches_v110_check.py | 15 +++++++++++---- totk.ini.example | 2 +- 4 files changed, 18 insertions(+), 6 deletions(-) diff --git a/recomp/patches-v110.txt b/recomp/patches-v110.txt index fcbc84ec..0741a5ee 100644 --- a/recomp/patches-v110.txt +++ b/recomp/patches-v110.txt @@ -103,6 +103,11 @@ set pooloff TOTK_POOL_OFFSET_PATCH 1 site pooloff main 9b93a8 93407f22 2a1903e2 site pooloff main 9b93c4 8b39c101 8b394101 +# Fixed scene tier: the 1.1.0 controller (main+0xce8d74, 1.2.1 main+0xcc26f4) returns its scale through w23 in +# the shared epilogue. res_dynres_live enables this set when dynamic_res is off, preserving the configured render_scale. +set fixres TOTK_FIXED_RES_PATCH 0 +site fixres main ce9280 2a1703e9 52a7f009 # mov w9, w23 -> mov w9, #0x3f800000 (1.0f) + # Sun shadow map: the size rounded here is used for width (+0x3d8), height (+0x3f8) and viewport together. # runtime/resolution.c shadow_init supplies the fixed size at page +92; the default remains the game's size. site shadow main d0760c 11001d6b @page:x11 b9405d6b 11001d6b diff --git a/runtime/resolution.c b/runtime/resolution.c index 313967fd..82f90eac 100644 --- a/runtime/resolution.c +++ b/runtime/resolution.c @@ -648,7 +648,7 @@ void res_fov_live(void) { rt_log("resolution: field of view %d%% of the game's", pct); } -// TOTK_DYNAMIC_RES = 0 holds the game's dynamic resolution at 100 % (recomp/patches-v121.txt and patches-v143.txt, +// TOTK_DYNAMIC_RES = 0 holds the game's dynamic resolution at 100 % (patches-v110.txt, patches-v121.txt and patches-v143.txt, // set fixres), so the scene renders at the size render_scale chose. The game picks its tier (100, 90 or 80 %) mostly // from a fixed cost model made for the Switch: one term grows with the object counts, one with (scene width / 1600) // squared. The GPU time it also measures (two NVN report timestamps, a frame apart) only lowers that prediction when the diff --git a/tests/patches_v110_check.py b/tests/patches_v110_check.py index f0f53bfd..8d49589b 100644 --- a/tests/patches_v110_check.py +++ b/tests/patches_v110_check.py @@ -30,6 +30,7 @@ SITES = [ ('pooloff', 0x9b93a8, 2, 'offset'), ('pooloff', 0x9b93c4, 1, 'source'), ('shadow', 0xd0760c, 11, 'shadow'), *[('cascade', a, 8, 'cascade') for a in (0x1157fb8, 0x1158040, 0x11580c8, 0x115814c)], + ('fixres', 0xce9280, 9, 'fixed'), ] @@ -74,7 +75,7 @@ def main(): words.append((orig, repl)) build = ROOT / 'build' build.mkdir(exist_ok=True) - groups = {ratio: ([], []) for ratio in (1.0, 0.5, 0.25)} + groups = {ratio: ([], []) for ratio in (1.0, 0.9, 0.8, 0.5, 0.25)} page = bytearray(0x1000) # Distinct fields reveal an accidental load from the neighboring page slot. for off, value in ((0, 0.5), (4, 1 / 60), (56, 21 / 9), (60, 1.2), @@ -92,7 +93,7 @@ def main(): for k, (name, off, target, kind) in enumerate(SITES): pc = base + off for enabled in (0, 1): - for ratio in (1.0, 0.5, 0.25): + for ratio in groups: for offset in (0, 0x7fffffff, 0x80000000, 0xffffffff): mem = bytearray(initial) struct.pack_into('