From f75405ee51d0bd0417feb22272448f7ef374d8df Mon Sep 17 00:00:00 2001 From: ExpertKT Date: Mon, 2 Nov 2026 21:55:18 +0800 Subject: [PATCH 1/7] Log a warning when memory = import is used on a discrete GPU --- runtime/vk_memory.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/runtime/vk_memory.c b/runtime/vk_memory.c index d4242a80..d17a23e4 100644 --- a/runtime/vk_memory.c +++ b/runtime/vk_memory.c @@ -1201,6 +1201,11 @@ static void mirror_mode(int discrete) { sh && *sh ? " (TOTK_SHADOW)" : ""); rt_log("mem: mode %s (%s): %s", mode == 2 ? "verify" : mode ? "mirror" : "import", why, mode ? "pools used as buffers get a device-local mirror" : "every CPU-visible pool is imported host memory"); + // Import is the integrated-GPU mode. On a discrete card every draw reads the pools over PCIe (the comment above + // this section has the measurements), which is the difference between playable and 5 fps when it is not intended. + if (!mode && discrete) + rt_log("mem: warning: import on a discrete GPU: the GPU reads the game's pools over PCIe on every draw, far " + "slower than mirror (the auto default on a discrete GPU); use memory = auto unless testing"); } static void range_add(MRange **a, int *n, int *cap, PoolRec *r, uint64_t off, uint64_t size) { From 4cbc7bbb70be239659fb61501d20174f818dae1a Mon Sep 17 00:00:00 2001 From: Takeya Saito Date: Mon, 2 Nov 2026 18:10:48 +0000 Subject: [PATCH 2/7] Keep pooled speech balloons in 16:9 proportions on wide and tall game resolutions The marker fix gave the root's scale of BalloonMessage_00 to its part pane Pa_BalloonMessage_00. The game pools that part, cloning it into Pa_BalloonMessage_%02d at run time, and the clones don't keep the template pane's scale, so on 32:9 NPC speech balloons drew twice as wide as they should. The scale now goes inside the part layout instead, to the top panes of PaBalloonMessage_00 (C_CaptureBase_00 and N_InOut_00, their offset scaled with them), which every clone is built from. Its animations only key alpha, visibility and N_Loop_00's y. The part pane keeps scale 1. Same on the y axis for 16:10. Co-Authored-By: Claude Opus 5.5 --- tools/ultrawide_layout.py | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/tools/ultrawide_layout.py b/tools/ultrawide_layout.py index c67d212c..de36c28e 100644 --- a/tools/ultrawide_layout.py +++ b/tools/ultrawide_layout.py @@ -32,9 +32,15 @@ MARKER_ROOT = { 'AttentionBalloon_00': ('C_Capture_00', 'N_InOut_00'), # N_PosRoot_00 moves; N_InOut_00 animates y and alpha 'AttentionLockOn_00': ('N_Offset_00',), # N_PosRoot_00 moves; N_Offset_00 animates y 'EnemyInfo_00': ('Pa_EnemyLife_00', 'Pa_EnemyNotice_00'), # the parts move; N_EnemyLifeArea_* stay screen-sized - 'BalloonMessage_00': ('Pa_BalloonMessage_00',), + 'BalloonMessage_00': (), # the speech balloon part is pooled: its scale goes inside, see BALLOON_PART } +# Speech balloons are pooled: the game clones Pa_BalloonMessage_00 into Pa_BalloonMessage_%02d at run time, and the clones +# don't keep a scale set on the template part pane, so they drew at full canvas width. The scale goes on the part +# layout's top panes instead (their offset scaled with them, so they sit where a scaled root would put them); its +# animations only key alpha, visibility and N_Loop_00's y. (pane, x, y) as shipped. +BALLOON_PART = (('C_CaptureBase_00', 226.0, 20.0), ('N_InOut_00', 30.0, -10.0)) + def edits(k, hud_corner): """(layout, pane, field, value) for the aspect: k = 16/9 over the aspect (the root's scale), w = how far a 1920-wide layout's edge moves out in its own units (960 * (1 / k - 1)). OFF moves a pane out of sight.""" @@ -67,6 +73,8 @@ def edits(k, hud_corner): ('PaRecipeCardList_00', 'P_BG_00', 'scale_x', wide), ('SaveLoadIcon_00', 'RootPane', 'x', -960 * (1 - k)), ('ShopMenu_00', 'N_BG_00', 'scale_x', wide), ('StaffRoll_00', 'N_BG_00', 'scale_x', wide), + *[e for pane, x, _ in BALLOON_PART for e in (('PaBalloonMessage_00', pane, 'scale_x', k), + ('PaBalloonMessage_00', pane, 'x', x * k))], ] # Menus framed by two side decorations, a header and a background: the frame stays at the screen's edges. for layout, deco in (('PauseMenuOverlay_00', 'P_Deco{}_00'), ('SystemLoadList_00', 'P_Deco{}_00'), @@ -117,7 +125,9 @@ def tall_edits(k): *[('CameraPointer_00', p, 'scale_y', tall) for p in ('N_InOutScope_00', 'Pa_CameraFocus_00', 'S_Scissor_00', 'W_Shadow_01')], ('CameraSystemWindow_00', 'N_InOut_00', 'scale_y', tall), ('MessageLog_01', 'P_Capture_00', 'scale_y', tall), - *[(layout, 'N_SystemBG_00', 'scale_y', tall) for layout in ('SystemActionGuide_00',) + SYSTEM_MENUS]] + *[(layout, 'N_SystemBG_00', 'scale_y', tall) for layout in ('SystemActionGuide_00',) + SYSTEM_MENUS], + *[e for pane, _, y in BALLOON_PART for e in (('PaBalloonMessage_00', pane, 'scale_y', k), + ('PaBalloonMessage_00', pane, 'y', y * k))]] # The HUD at the screen's top and bottom edges instead of the middle 16:9 out += [(name, 'RootPane', 'y', 540 * (1 - k)) for name in ( 'AppAlbum_00', 'AppPictureBook_00', 'ChallengeLog_00', 'Challenge_00', 'InstantTipsWithPict_00', 'InstantTips_00', From 58262318709811eac5ff58d1776c7fc05709dd62 Mon Sep 17 00:00:00 2001 From: fsfksjfjse <145445903+fsfksjfjse@users.noreply.github.com> Date: Tue, 3 Nov 2026 03:39:34 +0800 Subject: [PATCH 3/7] Add cheat names to the font atlas glyph ranges --- runtime/ui/menu.cpp | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/runtime/ui/menu.cpp b/runtime/ui/menu.cpp index a4a6e33d..35b65311 100644 --- a/runtime/ui/menu.cpp +++ b/runtime/ui/menu.cpp @@ -346,6 +346,10 @@ static int fonts_up(float scale) { ImFontGlyphRangesBuilder b; b.AddText(ui_text_in("en", kCjk[i].name)); ui_text_visit(kCjk[i].lang, add_row_glyphs, &b); + // Cheat names come from a mod's cheats/.txt at runtime, so no catalog row holds them + // and their glyphs would otherwise fall back to the missing-glyph box. + for (int k = 0; k < cheats_count(); k++) + if (const CheatInfo *ci = cheats_info(k); ci && ci->name) b.AddText(ci->name); b.BuildRanges(&ranges[i]); ImFontConfig mc; mc.MergeMode = true; From 19ffd3a2dac0c1381481120ddb83d1aa633be9fe Mon Sep 17 00:00:00 2001 From: fsfksjfjse <145445903+fsfksjfjse@users.noreply.github.com> Date: Tue, 3 Nov 2026 03:55:25 +0800 Subject: [PATCH 4/7] Add mod folder names to the font atlas too A mod's folder name is drawn on the Mods tab (opt_text_row, menu.cpp) and as the Cheats tab's group heading (cheats_tab.cpp), and it comes from disk at runtime like a cheat name, so its glyphs were never in the atlas either. Both sources are added in the same place in fonts_up(), so one pass covers the whole menu. --- runtime/ui/menu.cpp | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/runtime/ui/menu.cpp b/runtime/ui/menu.cpp index 35b65311..d2a3ac39 100644 --- a/runtime/ui/menu.cpp +++ b/runtime/ui/menu.cpp @@ -346,10 +346,12 @@ static int fonts_up(float scale) { ImFontGlyphRangesBuilder b; b.AddText(ui_text_in("en", kCjk[i].name)); ui_text_visit(kCjk[i].lang, add_row_glyphs, &b); - // Cheat names come from a mod's cheats/.txt at runtime, so no catalog row holds them - // and their glyphs would otherwise fall back to the missing-glyph box. + // Text the menu shows that no catalog row holds: a mod's cheat names and its folder name, + // both read from disk at runtime. Their glyphs would otherwise fall back to the missing-glyph box. for (int k = 0; k < cheats_count(); k++) if (const CheatInfo *ci = cheats_info(k); ci && ci->name) b.AddText(ci->name); + for (int k = 0; k < mods_count(); k++) + if (const ModInfo *mi = mods_at(k); mi) b.AddText(mi->name); b.BuildRanges(&ranges[i]); ImFontConfig mc; mc.MergeMode = true; From 7f1dd277882c36803a6775d7648432cf78457d20 Mon Sep 17 00:00:00 2001 From: ProSep <9l0mhe7e@prosep.anonaddy.me> Date: Tue, 3 Nov 2026 01:16:00 +0100 Subject: [PATCH 5/7] Keep HDR highlights through the game's FSR 1 upscale Some frames the game upscales its tonemapped scene with its own FSR 1 pass instead of the plain upscale, and that shader clamps each channel to 0..1, so with TOTK_HDR=1 every highlight above the HUD's white is cut back to it: around the sun the glare turns into a flat grey-white patch that stays until the camera moves. vk_hdr.c fsr_unclamp finds the shader by FSR's two reciprocal constants and drops only the clamps whose result goes to its output, leaving the filter's own weight clamps alone. Co-Authored-By: Claude Opus 5.5 --- runtime/vk_hdr.c | 57 +++++++++++++++++++++++++++++++++++++++++++++++- 1 file changed, 56 insertions(+), 1 deletion(-) diff --git a/runtime/vk_hdr.c b/runtime/vk_hdr.c index 7d591b87..b5ebeeff 100644 --- a/runtime/vk_hdr.c +++ b/runtime/vk_hdr.c @@ -8,7 +8,8 @@ // 8-bit sRGB window texture it presents. So: // 1. vk_hdr_shader_swap: the tonemap's fragment shader becomes shaders/hdr_tonemap.frag, which keeps values above 1 // (relative to the HUD's white) and rolls off at the peak. It is recognised by its constants and resources, not by -// a hash, so another game version or translator still finds it; its SPIR-V is replaced in memory only. +// a hash, so another game version or translator still finds it; its SPIR-V is replaced in memory only. The game's +// FSR 1 upscale after it would clamp the picture to 1 again; fsr_unclamp drops that clamp in its SPIR-V. // 2. vk_hdr_draw / vk_hdr_present_source: a draw into a presented window texture that samples one float texture of // its size is that copy; the present then reads the float texture instead of the window texture. Any other last // draw into it leaves the window texture, decoded from sRGB: menus and movies stay SDR at the HUD's white. @@ -90,8 +91,62 @@ static int name_is(const uint32_t *a, uint32_t len, const char *s) { // OpName return (len - 2) * 4 >= n + 1 && !memcmp(a + 1, s, n + 1); } +// The game's FSR 1 upscale after the tonemap (some frames take it in place of the plain upscale; what picks it is not +// known yet, the scene size alone does not) ends with clamp(colour, 0.0, 1.0) per channel, which cuts the HDR +// highlights back to the HUD's white for as long as the game takes it. Its own 0..1 clamps of the filter weights each feed a float bit trick (OpBitcast), so only +// the clamps whose result goes to the shader's output change, to clamp(x, 0.0, x): the same instruction length, no new +// constant, and the r11g11b10f target stores no negative anyway. Recognised by FSR's two reciprocal constants +// (0x7ef07ebb, 0x7ef19fff) and its one texture fp_t_tcb_8. Returns the clamps changed. +enum { SPV_OP_EXT_INST_IMPORT = 11, SPV_OP_EXT_INST = 12, SPV_OP_VARIABLE = 59, SPV_OP_STORE = 62, + SPV_OP_ACCESS_CHAIN = 65, SPV_SC_OUTPUT = 3, GLSL_FCLAMP = 43 }; + +static int fsr_unclamp(uint32_t *w, uint64_t n) { + uint32_t bound = w[3], glsl = 0, float_type = 0, zero = 0, one = 0; + int magic = 0, tex = 0; + for (uint64_t i = 5; i < n;) { + uint32_t op = w[i] & 0xffff, len = w[i] >> 16; + if (!len || i + len > n) return 0; + const uint32_t *a = w + i + 1; + if (op == SPV_OP_EXT_INST_IMPORT && len >= 3 && name_is(a, len, "GLSL.std.450")) glsl = a[0]; + else if (op == SPV_OP_TYPE_FLOAT && len == 3 && a[1] == 32) float_type = a[0]; + else if (op == SPV_OP_CONSTANT && len == 4) { + magic |= (a[2] == 0x7ef07ebbu) | (a[2] == 0x7ef19fffu) << 1; + if (a[0] == float_type && float_type && a[2] == 0) zero = a[1]; + if (a[0] == float_type && float_type && a[2] == 0x3f800000u) one = a[1]; + } else if (op == SPV_OP_NAME && len >= 3 && name_is(a, len, "fp_t_tcb_8")) tex = 1; + i += len; + } + if (magic != 3 || !tex || !glsl || !zero || !one || !bound) return 0; + uint8_t *out = calloc(bound, 1); // id -> 1: a pointer into an Output variable, 2: a value stored through one + if (!out) return 0; + for (uint64_t i = 5; i < n; i += w[i] >> 16) { + uint32_t op = w[i] & 0xffff, len = w[i] >> 16; + const uint32_t *a = w + i + 1; + if (op == SPV_OP_VARIABLE && len >= 4 && a[2] == SPV_SC_OUTPUT && a[1] < bound) out[a[1]] = 1; + else if (op == SPV_OP_ACCESS_CHAIN && len >= 4 && a[2] < bound && out[a[2]] == 1 && a[1] < bound) out[a[1]] = 1; + else if (op == SPV_OP_STORE && len >= 3 && a[0] < bound && out[a[0]] == 1 && a[1] < bound) out[a[1]] = 2; + } + int changed = 0; + for (uint64_t i = 5; i < n; i += w[i] >> 16) { + uint32_t op = w[i] & 0xffff, len = w[i] >> 16; + uint32_t *a = w + i + 1; // result type, result, set, instruction, x, min, max + if (op == SPV_OP_EXT_INST && len == 8 && a[2] == glsl && a[3] == GLSL_FCLAMP && a[1] < bound && out[a[1]] == 2 && + a[5] == zero && a[6] == one) + a[6] = a[4], changed++; + } + free(out); + return changed; +} + void vk_hdr_shader_swap(uint32_t **spirv, uint64_t *words) { if (!vk_hdr_wanted() || !*spirv || *words < 5) return; + int unclamped = fsr_unclamp(*spirv, *words); + if (unclamped) { + static volatile int32_t fsrs; + rt_log("hdr: the game's FSR upscale keeps values above 1 (%d output clamps; %d so far)", unclamped, + plat_inc32(&fsrs)); + return; + } const uint32_t *w = *spirv; uint64_t n = *words; // the game's constants: the BT.601 red weight, -1/ln 2 (e^-x as exp2), 2/3 (the grade's red weight), the bloom clamp From 3d9c80e2bd27f8eb54ad821303586449587ab893 Mon Sep 17 00:00:00 2001 From: ProSep <9l0mhe7e@prosep.anonaddy.me> Date: Tue, 3 Nov 2026 03:21:31 +0100 Subject: [PATCH 6/7] Rewrite the FSR output clamps as max(x, 0) and log a missed match clamp(x, 0.0, x) is undefined for negative x in GLSL.std.450, so the output clamps of the game's FSR pass now become FMax(x, 0.0), one word shorter, with the rest of the module moved down. When the FSR shader is recognised but none of its output clamps is found (a translator that stores the colour another way), the log now says the highlights are still clipped instead of staying silent. The comment also notes that the game takes this pass at 1:1 too. Co-Authored-By: Claude Opus 5.5 --- runtime/vk_hdr.c | 52 ++++++++++++++++++++++++++++++++---------------- 1 file changed, 35 insertions(+), 17 deletions(-) diff --git a/runtime/vk_hdr.c b/runtime/vk_hdr.c index b5ebeeff..5a506387 100644 --- a/runtime/vk_hdr.c +++ b/runtime/vk_hdr.c @@ -91,16 +91,18 @@ static int name_is(const uint32_t *a, uint32_t len, const char *s) { // OpName return (len - 2) * 4 >= n + 1 && !memcmp(a + 1, s, n + 1); } -// The game's FSR 1 upscale after the tonemap (some frames take it in place of the plain upscale; what picks it is not -// known yet, the scene size alone does not) ends with clamp(colour, 0.0, 1.0) per channel, which cuts the HDR -// highlights back to the HUD's white for as long as the game takes it. Its own 0..1 clamps of the filter weights each feed a float bit trick (OpBitcast), so only -// the clamps whose result goes to the shader's output change, to clamp(x, 0.0, x): the same instruction length, no new -// constant, and the r11g11b10f target stores no negative anyway. Recognised by FSR's two reciprocal constants -// (0x7ef07ebb, 0x7ef19fff) and its one texture fp_t_tcb_8. Returns the clamps changed. +// The game's FSR 1 pass after the tonemap (some frames take it in place of the plain pass, at 1:1 as well as when it +// scales up; what picks it is not known yet) ends with clamp(colour, 0.0, 1.0) per channel, which cuts the HDR +// highlights back to the HUD's white for as long as the game takes it. Its own 0..1 clamps of the filter weights each +// feed a float bit trick (OpBitcast), so only the clamps whose result is stored to the shader's output change, to +// max(x, 0.0): one word shorter, so the words after it move down and the module shrinks. Recognised by FSR's two +// reciprocal constants (0x7ef07ebb, 0x7ef19fff) and its one texture fp_t_tcb_8. Returns the clamps changed, -1 for +// that shader with no output clamp found (a translator that stores the colour another way), 0 for any other shader. enum { SPV_OP_EXT_INST_IMPORT = 11, SPV_OP_EXT_INST = 12, SPV_OP_VARIABLE = 59, SPV_OP_STORE = 62, - SPV_OP_ACCESS_CHAIN = 65, SPV_SC_OUTPUT = 3, GLSL_FCLAMP = 43 }; + SPV_OP_ACCESS_CHAIN = 65, SPV_SC_OUTPUT = 3, GLSL_FMAX = 40, GLSL_FCLAMP = 43 }; -static int fsr_unclamp(uint32_t *w, uint64_t n) { +static int fsr_unclamp(uint32_t *w, uint64_t *words) { + uint64_t n = *words; uint32_t bound = w[3], glsl = 0, float_type = 0, zero = 0, one = 0; int magic = 0, tex = 0; for (uint64_t i = 5; i < n;) { @@ -116,7 +118,8 @@ static int fsr_unclamp(uint32_t *w, uint64_t n) { } else if (op == SPV_OP_NAME && len >= 3 && name_is(a, len, "fp_t_tcb_8")) tex = 1; i += len; } - if (magic != 3 || !tex || !glsl || !zero || !one || !bound) return 0; + if (magic != 3 || !tex) return 0; + if (!glsl || !zero || !one || !bound) return -1; uint8_t *out = calloc(bound, 1); // id -> 1: a pointer into an Output variable, 2: a value stored through one if (!out) return 0; for (uint64_t i = 5; i < n; i += w[i] >> 16) { @@ -127,26 +130,41 @@ static int fsr_unclamp(uint32_t *w, uint64_t n) { else if (op == SPV_OP_STORE && len >= 3 && a[0] < bound && out[a[0]] == 1 && a[1] < bound) out[a[1]] = 2; } int changed = 0; - for (uint64_t i = 5; i < n; i += w[i] >> 16) { + uint64_t k = 5; // the write position: never past the read position, as instructions only shrink + for (uint64_t i = 5; i < n;) { uint32_t op = w[i] & 0xffff, len = w[i] >> 16; - uint32_t *a = w + i + 1; // result type, result, set, instruction, x, min, max + const uint32_t *a = w + i + 1; // result type, result, set, instruction, x, min, max if (op == SPV_OP_EXT_INST && len == 8 && a[2] == glsl && a[3] == GLSL_FCLAMP && a[1] < bound && out[a[1]] == 2 && - a[5] == zero && a[6] == one) - a[6] = a[4], changed++; + a[5] == zero && a[6] == one) { + uint32_t ins[7] = {7u << 16 | SPV_OP_EXT_INST, a[0], a[1], a[2], GLSL_FMAX, a[4], zero}; + memmove(w + k, ins, sizeof ins); + k += 7, changed++; + } else { + memmove(w + k, w + i, len * sizeof *w); + k += len; + } + i += len; } free(out); - return changed; + *words = k; + return changed ? changed : -1; } void vk_hdr_shader_swap(uint32_t **spirv, uint64_t *words) { if (!vk_hdr_wanted() || !*spirv || *words < 5) return; - int unclamped = fsr_unclamp(*spirv, *words); - if (unclamped) { + int unclamped = fsr_unclamp(*spirv, words); + if (unclamped > 0) { static volatile int32_t fsrs; - rt_log("hdr: the game's FSR upscale keeps values above 1 (%d output clamps; %d so far)", unclamped, + rt_log("hdr: the game's FSR pass keeps values above 1 (%d output clamps; %d so far)", unclamped, plat_inc32(&fsrs)); return; } + if (unclamped < 0) { + static volatile int32_t missed; + if (plat_inc32(&missed) == 1) + rt_log("hdr: the game's FSR pass was found but no clamp of its output; it still clips HDR highlights"); + return; + } const uint32_t *w = *spirv; uint64_t n = *words; // the game's constants: the BT.601 red weight, -1/ln 2 (e^-x as exp2), 2/3 (the grade's red weight), the bloom clamp From 4e5637277e58aae9cd10f6bc6811509c02927d55 Mon Sep 17 00:00:00 2001 From: Wintego <17454585.Wintego@users.noreply.github.com> Date: Tue, 3 Nov 2026 09:16:51 +0300 Subject: [PATCH 7/7] Lay the UI out for 3:2 game resolutions The settings menu offers 1920x1280, 2160x1440, 2256x1504, 2880x1920 and 3000x2000 (the 3:2 screens of Surface and Framework laptops and tablets), and the setup builds romfs-patches-x for each, so the HUD moves to the top and bottom edges as it does at 16:10 instead of being stretched. --- README.md | 2 +- docs/architecture.md | 5 +++-- installer/steps.py | 6 ++++-- runtime/ui/menu.cpp | 6 ++++-- runtime/ui_text.c | 8 ++++---- totk.ini.example | 5 +++-- 6 files changed, 19 insertions(+), 13 deletions(-) diff --git a/README.md b/README.md index a6eee2b9..79543576 100644 --- a/README.md +++ b/README.md @@ -20,7 +20,7 @@ Report problems as issues, following [CONTRIBUTING.md](CONTRIBUTING.md). - 60 fps by default; up to 144 fps or the monitor's refresh rate (experimental) - Custom resolutions (1080p, 2k...), supersampling and AMD FSR 1 upscaling - HDR10 output with peak, game and HUD brightness settings -- 16:10 (Steam Deck, handhelds), 21:9 and 32:9 (ultrawide) game resolutions, with the camera and the interface in that shape +- 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 - In-game settings menu (F1) and performance overlay (F10) - Setup and in-game menu in English, Russian, Brazilian Portuguese and Simplified Chinese diff --git a/docs/architecture.md b/docs/architecture.md index cddd6971..3849e025 100644 --- a/docs/architecture.md +++ b/docs/architecture.md @@ -99,8 +99,9 @@ Every guest thread is a host thread. TotK assumes Horizon's scheduler: three app RCAS) on the present. An `output_res` that is not 16:9 (more than 1% off, `res_is_16x9`) also switches on the `aspect` patch set, which hands the output's ratio to the camera, and `romfs.c` `overlay_init` loads the `romfs-patches-x` overlay for it when it exists (`tools/make_romfs_patches.py --aspect`, laid out by - `tools/ultrawide_layout.py`; the installer builds ten sizes: 21:9 2560x1080, 3440x1440, 3840x1600, 5120x2160, 32:9 - 3840x1080, 5120x1440 and 16:10 1280x800, 1680x1050, 1920x1200, 2560x1600). A wider layout moves the HUD to the + `tools/ultrawide_layout.py`; the installer builds fifteen sizes: 21:9 2560x1080, 3440x1440, 3840x1600, 5120x2160, + 32:9 3840x1080, 5120x1440, 16:10 1280x800, 1680x1050, 1920x1200, 2560x1600 and 3:2 1920x1280, 2160x1440, 2256x1504, + 2880x1920, 3000x2000). A wider layout moves the HUD to the screen's corners, a narrower one to its top and bottom edges. Other sizes get the camera of their shape and the 16:9 HUD stretched over it. The `aspect` setting (`fit`, the default; `stretch`) decides what the present does when the window's shape differs from the output's: `fit` letterboxes, where a 16:9 game in a wider window used to be diff --git a/installer/steps.py b/installer/steps.py index 4c9f2ea5..12bc90e7 100644 --- a/installer/steps.py +++ b/installer/steps.py @@ -907,9 +907,11 @@ SKIPPED = re.compile(r'prepare-shaders: (\d+) variants skipped: the graphics dri # The game resolutions of another shape than 16:9 that runtime/ui/menu.cpp row_output_res lists: 21:9 and 32:9 monitors, -# and 16:10 screens (the Steam Deck's 1280x800, handhelds and laptops) +# 16:10 screens (the Steam Deck's 1280x800, handhelds and laptops) and 3:2 screens (Surface and Framework laptops and +# tablets) ASPECT_SIZES = ('2560x1080', '3440x1440', '3840x1600', '5120x2160', '3840x1080', '5120x1440', - '1280x800', '1680x1050', '1920x1200', '2560x1600') + '1280x800', '1680x1050', '1920x1200', '2560x1600', + '1920x1280', '2160x1440', '2256x1504', '2880x1920', '3000x2000') class Prepare(Step): diff --git a/runtime/ui/menu.cpp b/runtime/ui/menu.cpp index a4a6e33d..5483a529 100644 --- a/runtime/ui/menu.cpp +++ b/runtime/ui/menu.cpp @@ -485,13 +485,15 @@ static void row_window_size(void) { } // The game resolution (resolution.c): 16:9 sizes from its smallest, 1280x720 (for weak GPUs), up, the common 21:9 and -// 32:9 monitor sizes and the 16:10 screens of the Steam Deck, handhelds and laptops (the camera and the HUD follow +// 32:9 monitor sizes, the 16:10 screens of the Steam Deck, handhelds and laptops and the 3:2 screens of laptops and +// tablets (Surface, Framework; the camera and the HUD follow // another shape, resolution.c res_init; the installer lays the HUD out for each, installer/steps.py ASPECT_SIZES), and // the current value when it is another size. static void row_output_res(void) { static const char *const vals[] = {"1280x720", "1600x900", "1920x1080", "2560x1440", "3200x1800", "3840x2160", "2560x1080", "3440x1440", "3840x1600", "5120x2160", "3840x1080", "5120x1440", - "1280x800", "1680x1050", "1920x1200", "2560x1600"}; + "1280x800", "1680x1050", "1920x1200", "2560x1600", + "1920x1280", "2160x1440", "2256x1504", "2880x1920", "3000x2000"}; enum { N = sizeof vals / sizeof *vals }; char shown[N][32]; const char *names[N]; diff --git a/runtime/ui_text.c b/runtime/ui_text.c index 03ca1186..cc39efa1 100644 --- a/runtime/ui_text.c +++ b/runtime/ui_text.c @@ -55,7 +55,7 @@ static const char *const text_en[UI_TEXT_COUNT] = { [UI_MENU_OUTPUT_RES] = "Game resolution", [UI_MENU_OUTPUT_RES_DESC] = "The size the game draws its picture and interface in. Above 1920 x 1080 the game needs " "more video memory and GPU time. A wider size (21:9) widens the camera's view and moves " - "the HUD to the screen's corners; a taller one (16:10, Steam Deck) moves it to the top " + "the HUD to the screen's corners; a taller one (16:10, 3:2) moves it to the top " "and bottom edges.", [UI_MENU_RENDER_SCALE] = "3D render scale", [UI_MENU_RENDER_SCALE_DESC] = "Size of the 3D scene relative to the game resolution; the game's FSR scales it to " @@ -483,7 +483,7 @@ static const char *const text_ru[UI_TEXT_COUNT] = { [UI_MENU_OUTPUT_RES] = "Разрешение игры", [UI_MENU_OUTPUT_RES_DESC] = "Размер, в котором игра рисует картинку и интерфейс. Выше 1920 × 1080 игре нужно больше " "видеопамяти и времени GPU. Более широкий размер (21:9) расширяет обзор камеры и " - "переносит интерфейс в углы экрана, более высокий (16:10, Steam Deck) переносит его к " + "переносит интерфейс в углы экрана, более высокий (16:10, 3:2) переносит его к " "верхнему и нижнему краям.", [UI_MENU_RENDER_SCALE] = "Масштаб 3D-отрисовки", [UI_MENU_RENDER_SCALE_DESC] = "Размер 3D-сцены относительно разрешения игры; FSR игры доводит её до этого размера. " @@ -945,7 +945,7 @@ static const char *const text_pt_br[UI_TEXT_COUNT] = { [UI_MENU_OUTPUT_RES] = "Resolução do jogo", [UI_MENU_OUTPUT_RES_DESC] = "O tamanho em que o jogo desenha a imagem e a interface. Acima de 1920 x 1080 o jogo " "precisa de mais memória de vídeo e tempo de GPU. Um tamanho mais largo (21:9) amplia a " - "visão da câmera e leva o HUD para os cantos da tela; um mais alto (16:10, Steam Deck) " + "visão da câmera e leva o HUD para os cantos da tela; um mais alto (16:10, 3:2) " "leva-o para as bordas de cima e de baixo.", [UI_MENU_RENDER_SCALE] = "Escala da renderização 3D", [UI_MENU_RENDER_SCALE_DESC] = "Tamanho da cena 3D em relação à resolução do jogo; o FSR do jogo a amplia até esse " @@ -1419,7 +1419,7 @@ static const char *const text_zh_hans[UI_TEXT_COUNT] = { [UI_MENU_OUTPUT_RES_DESC] = "游戏绘制画面和界面的尺寸。" "高于 1920 x 1080 会占用更多显存和 GPU 时间。" "更宽的尺寸(21:9)会扩大视野,并把界面移到屏幕四角;" - "更高的尺寸(16:10、Steam Deck)则移到上下边缘。", + "更高的尺寸(16:10、3:2)则移到上下边缘。", [UI_MENU_RENDER_SCALE] = "3D 渲染比例", [UI_MENU_RENDER_SCALE_DESC] = "3D 场景相对于游戏分辨率的尺寸;" "游戏的 FSR 会将其缩放到该尺寸。" diff --git a/totk.ini.example b/totk.ini.example index e22dbbee..6360fb3c 100644 --- a/totk.ini.example +++ b/totk.ini.example @@ -136,8 +136,9 @@ # Game resolution: the size the game draws its picture and interface in (1280x720 to 7680x4320). Above 1920x1080 the # game's texture heap and memory pool grow with it. Another shape than 16:9, such as 3440x1440 on a 21:9 monitor or # the Steam Deck's 1280x800 (16:10), gives the camera's view that shape and lays the HUD out for it. The installer -# prepares the UI layout for ten sizes: 2560x1080, 3440x1440, 3840x1600, 5120x2160 (21:9), 3840x1080, 5120x1440 (32:9), -# 1280x800, 1680x1050, 1920x1200 and 2560x1600 (16:10). Any other size +# prepares the UI layout for fifteen sizes: 2560x1080, 3440x1440, 3840x1600, 5120x2160 (21:9), 3840x1080, 5120x1440 +# (32:9), 1280x800, 1680x1050, 1920x1200, 2560x1600 (16:10), 1920x1280, 2160x1440, 2256x1504, 2880x1920 and 3000x2000 +# (3:2). Any other size # gets the camera's view but a 16:9 HUD, stretched over the picture, unless you build its layout with # tools/make_romfs_patches.py --aspect WxH. Read at start. # output_res = 1920x1080