Merge upstream dev into fsr4

The installer runs dev's new kit step and keeps the FSR step after DLSS: check, kit, fonts, extract, lift, compile,
prepare, pc_prompts, shapes, dlss, fsr, cleanup; docs/installer.md numbers FSR 10 and the clean-up 11. cfg.c keeps
dev's DLSS settings (dlss_fixed_exposure, dlaa_effects_after, dlaa_cam_jitter) beside dlaa_backend. The Screen tab
keeps FSR sharpness with the upscaler's rows, before dev's two new DLSS rows. totk.ini.example takes dev's game
versions for dynamic_res and keeps the note that FSR holds the scene at 100 %.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
codexx-devandClaude Opus 5.5 committed 2026-11-19 21:37:07 -03:00
commit 35d7411bab
120 files changed
+10442 -1299

No files matched your search

+19 -12
View File
@@ -58,6 +58,7 @@
static struct {
int decided;
unsigned ow, oh, sw, sh; // output and scene
unsigned aw, ah; // the output TOTK_OUTPUT_RES asks for, before shape_fallback
int scene_set; // the scene differs from the game's 5/6 of the output
int heapdef_ok; // romfs.c serves the grown HeapDef
int on; // res_init switched the patch sets on
@@ -173,14 +174,14 @@ static void shape_fallback(void) {
static void decide(void) {
if (R.decided) return;
R.decided = 1;
R.ow = BASE_W;
R.oh = BASE_H;
R.ow = R.aw = BASE_W;
R.oh = R.ah = BASE_H;
const char *o = cfg_value("TOTK_OUTPUT_RES");
unsigned w = 0, h = 0;
char tail;
if (sscanf(o, "%ux%u%c", &w, &h, &tail) == 2 && w >= 1280 && h >= 720 && w <= 7680 && h <= 4320) {
R.ow = w & ~1u;
R.oh = h & ~1u;
R.ow = R.aw = w & ~1u;
R.oh = R.ah = h & ~1u;
shape_fallback();
} else {
rt_log("resolution: TOTK_OUTPUT_RES=%s is not <width>x<height> in 1280x720..7680x4320; 1920x1080", o);
@@ -522,9 +523,10 @@ static void shadow_init(uint8_t *page) {
// ---- start: the patch page and the sets
static uint64_t pack(unsigned w, unsigned h) { return (uint64_t)h << 32 | w; }
// TOTK_SHADOW_RANGE (percent, 50 to 400; 100 = the game's): the sun's shadow cascades end at 20, 40, 80 and 160 m.
// Other values multiply those distances through the cascade patch set (recomp/patches-v143.txt), so the sharp first
// cascade reaches further and the visible steps between cascades move away from the player, at the cost of shadow
// TOTK_SHADOW_RANGE (percent, 50 to 400; 100 = the game's): the sun's shadow cascades end at 20, 40, 80 and 160 m by
// the depth shadow parameters' defaults; in the field the shadow controller computes the boundaries from the camera
// each frame instead. Other values multiply the boundaries through the cascade patch set (recomp/patches-v143.txt and
// patches-v121.txt; the controller's sites take page +64 over 20 as the factor), so the sharp first cascade reaches further and the visible steps between cascades move away from the player, at the cost of shadow
// texels per metre (TOTK_SHADOW_SCALE pays that back).
static void res_shadow_range(void) {
int pct = cfg_int("TOTK_SHADOW_RANGE"), set = rt_patch_set("cascade");
@@ -637,10 +639,10 @@ int res_wants_wide_overlay(const unsigned out[2]) {
return !res_is_16x9(out[0], out[1]) && rt_patch_set("aspect") >= 0;
}
// Field of view (TOTK_FOV, percent of the game's own, 70..140, live): the camera's vertical view angle times the
// factor on page +60 (recomp/patches-v143.txt, set fov). The horizontal angle follows through the aspect ratio. 100
// switches the set off, so the camera code is the game's own. Runs on a settings change (gfx_present.c
// window_settings_live), the first time at the first present.
// Field of view (TOTK_FOV, percent of the game's own, 70..140, live): the camera's vertical view angle times the factor
// on page +60 (recomp/patches-v110.txt, patches-v121.txt and patches-v143.txt, set fov). The horizontal angle follows
// through the aspect ratio. 100 switches the set off, so the camera code is the game's own. Runs on a settings change
// (gfx_present.c window_settings_live), the first time at the first present.
#define FOV_MIN 70
#define FOV_MAX 140
void res_fov_live(void) {
@@ -660,7 +662,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
@@ -694,6 +696,11 @@ void res_wanted(unsigned out[2]) {
out[0] = R.ow, out[1] = R.oh;
}
void res_asked(unsigned out[2]) {
decide();
out[0] = R.aw, out[1] = R.ah;
}
// A TOTK_DLSS change while the game runs (vk_dlaa.c, at a present): the new scene size goes to the patch page, where
// the game reads it when it sets its render size (main+0x585e48). 1.4.3 does that once, at start: its renderer setup
// (main+0x7000e67028) calls main+0x585bd0(renderer, force), which picks the console mode's sizes and flags the render