diff --git a/THIRD_PARTY_NOTICES.md b/THIRD_PARTY_NOTICES.md index 44db3260..894c518a 100644 --- a/THIRD_PARTY_NOTICES.md +++ b/THIRD_PARTY_NOTICES.md @@ -58,4 +58,6 @@ These tools run on the developer's or player's machine during the build. They ar | hactool (SciresM @ `1d64a83450e025622f3468c28fc4164dad2c5ef6` plus `tools/hactool/portable.patch`, from MacNativeGames' `build_hactool()`: `MNG_TITLE_KEYS` and relaxed BKTR layout checks; our `tools/hactool/unicode.patch`: an embedded manifest that makes UTF-8 the process code page), built by `tools/build_hactool.py` with MSYS2 UCRT64 gcc; imports only KERNEL32 and the UCRT | https://github.com/SciresM/hactool | ISC | `bin/hactool.exe` | | `totk_xlate.exe` (Ryujinx shader translator, NativeAOT build of `tools/xlate/`, see the Ryujinx row above) | built by `tools/build_xlate.py` | MIT | `bin/totk_xlate.exe` | | MacNativeGames shader variant list | https://github.com/ly05010419/MacNativeGames @ `b75be8cfa704df3701e86130c8ced268e79d6b11` (`games/totk/assets/shader_list.tsv`), Copyright (c) 2026 MacNativeGames contributors | MIT | `data/shader_list.tsv` | - +| MacNativeGames TotK resolution patches: output, swapchain and scene size sites and instruction words for 1.2.1 and 1.4.3, the data-page layout, the HeapDef heap names and sizes | https://github.com/ly05010419/MacNativeGames @ `aaf6ba1` (`games/totk/runtime/game_patches.c`, `game_patches_v143.c`, `game_version.h`, `games/totk/scripts/make_output_res_overlay.py`), Copyright (c) 2026 MacNativeGames contributors | MIT | `recomp/patches-v121.txt`, `recomp/patches-v143.txt`, `runtime/resolution.c` | +| AMD FidelityFX Super Resolution 1.0 (`ffx_a.h`, `ffx_fsr1.h`, unmodified; licence text in `runtime/shaders/ffx/LICENSE.txt`) | https://github.com/GPUOpen-Effects/FidelityFX-FSR @ `a21ffb8f6c13233ba336352bdff293894c706575`, Copyright (c) 2021 Advanced Micro Devices, Inc. | MIT | `runtime/shaders/ffx/`, `runtime/shaders/fsr_easu.comp`, `runtime/shaders/fsr_rcas.comp` (compiled into `runtime/fsr_easu_spv.h`, `runtime/fsr_rcas_spv.h`) | +| Zstandard 1.5.7 (MSYS2 `mingw-w64-ucrt-x86_64-zstd`), static link | https://github.com/facebook/zstd, Copyright (c) Meta Platforms, Inc. and affiliates | BSD-3-Clause | `runtime/resolution.c` (the HeapDef table) | diff --git a/runtime/resolution.c b/runtime/resolution.c index 9f480bfe..709e8f65 100644 --- a/runtime/resolution.c +++ b/runtime/resolution.c @@ -12,8 +12,10 @@ // // Patch page: +16 the scene size {w, h} as floats, +32 the output size and +48 the swapchain size as {w, h} in one // 64-bit word, +40 the renderer (1.2.1) or display configuration (1.4.3) the patched code stores there. -// Both versions scale the scene they read by output width / 1920 (MacNativeGames measured it on 1.4.3: 2560x1440 asked -// on a 2560x1440 canvas rendered 3408x1920), so the page holds the wanted size divided by that factor. +// 1.4.3 scales the scene it reads by output width / 1920 (a 2560x1440 output renders its 1600x900 scene at 2128x1200; +// MacNativeGames measured the same), so its page holds the wanted size divided by that factor and the game's 5/6 needs +// no scene patch. 1.2.1 renders the size it reads (1600x900 on a 2560x1440 output): its page holds the wanted size, and +// the scene set is on whenever the output differs from 1920x1080. // // Heap: agl's DynamicTextureAllocator is one fixed heap, "DynamicTextureAllocatorMem" in // System/HeapSize/Product.Nin_NX_NVN.HeapDef.byml.zs (113664 KiB, carved from "Graphics", 201728 KiB). At 2560x1440 @@ -199,12 +201,13 @@ void res_init(void) { return; } fs_init(); // romfs.c serves the grown HeapDef from here on (res_heapdef_served) - if (!R.heapdef_ok) { + if (res_heap_extra_kib() && !R.heapdef_ok) { // sizes at or below the shipped ones fit the shipped heaps rt_log("resolution: no grown HeapDef table; the game keeps its own resolution"); return; } uint8_t *page = rt_patch_page(); - double k = (double)R.ow / BASE_W; // the game's own scaling of the scene with the output width + double k = RT_V143 ? (double)R.ow / BASE_W : 1.0; // 1.4.3's own scaling of the scene with the output width + int scene_on = R.scene_set || (!RT_V143 && (R.ow != BASE_W || R.oh != BASE_H)); float sc[2] = {(float)(R.sw / k), (float)(R.sh / k)}; uint64_t out = pack(R.ow, R.oh), none = 0; memcpy(page + 16, sc, sizeof sc); @@ -212,7 +215,7 @@ void res_init(void) { memcpy(page + 40, &none, 8); memcpy(page + 48, &out, 8); rt_patch_switch(output, R.ow != BASE_W || R.oh != BASE_H); - rt_patch_switch(scene, R.scene_set); + rt_patch_switch(scene, scene_on); rt_log("resolution: output %ux%u, scene %ux%u%s; texture heap +%llu KiB", R.ow, R.oh, R.sw, R.sh, - R.scene_set ? "" : " (the game's 5/6)", (unsigned long long)res_heap_extra_kib()); + scene_on ? "" : " (the game's own 5/6 of the output)", (unsigned long long)res_heap_extra_kib()); } diff --git a/tools/make_release.py b/tools/make_release.py index 50e5be90..2aeaf93a 100644 --- a/tools/make_release.py +++ b/tools/make_release.py @@ -79,6 +79,8 @@ PINS = { '065076fe13d39ab97eea4740596426d5ae741b5044e48e1c9495d04835c92dbe'), 'vma': (MSYS2 + 'mingw-w64-ucrt-x86_64-vulkan-memory-allocator-3.4.0-1-any.pkg.tar.zst', '44c81162337915afecda3185f66fd98268a54454580b2717080c9dfef57fe781'), + 'zstd': (MSYS2 + 'mingw-w64-ucrt-x86_64-zstd-1.5.7-2-any.pkg.tar.zst', # static libzstd.a (runtime/resolution.c) + 'dbdb8427280046a2b41697780aa4c52983b708082b0da4755951dc3bea96ca89'), } # The component MSI inside the python.org installer that carries Tcl/Tk and tkinter (Burn names its payloads a0..a27). TCLTK_PAYLOAD = ('a12', 'ac87609db3f715404dd41a989c2f1706ea1512f3d86217f938d11c63af8eb505') @@ -295,6 +297,10 @@ def build_deps(out): copy_tree(root / 'include' / inc, d / 'include' / inc) for lib in libs: shutil.copy2(root / 'lib' / lib, d / 'lib') + zstd = unpack('zstd') / 'ucrt64' + for name in ('zstd.h', 'zstd_errors.h'): + shutil.copy2(zstd / 'include' / name, d / 'include') + shutil.copy2(zstd / 'lib' / 'libzstd.a', d / 'lib') def collect_licenses(out): @@ -306,6 +312,8 @@ def collect_licenses(out): (unpack('vulkan-loader') / 'ucrt64' / 'share' / 'licenses' / 'vulkan-loader' / 'LICENSE', 'vulkan-loader-LICENSE.txt'), (unpack('vma') / 'ucrt64' / 'share' / 'licenses' / 'VulkanMemoryAllocator' / 'LICENSE', 'vulkan-memory-allocator-LICENSE.txt'), (unpack('sdl3-dll') / 'LICENSE.txt', 'SDL3-LICENSE.txt'), + (unpack('zstd') / 'ucrt64' / 'share' / 'licenses' / 'zstd' / 'LICENSE', 'zstd-LICENSE.txt'), + (ROOT / 'runtime' / 'shaders' / 'ffx' / 'LICENSE.txt', 'FidelityFX-FSR-LICENSE.txt'), (MAIN_ROOT / 'toolchain' / 'hactool' / 'LICENSE', 'hactool-LICENSE.txt'), (MAIN_ROOT / 'refs' / 'MacNativeGames' / 'LICENSE', 'MacNativeGames-LICENSE.txt'), ] diff --git a/totk.ini.example b/totk.ini.example index 6c1b2e22..d182bea7 100644 --- a/totk.ini.example +++ b/totk.ini.example @@ -34,6 +34,16 @@ # Which GPU to use: its index in the log, or part of its name. Default: the first discrete GPU with Vulkan 1.3. # gpu_index = 0 # gpu_name = NVIDIA +# 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. Read at start. +# output_res = 1920x1080 +# 3D render scale: the scene's size relative to the game resolution, game (5/6, the game's own 1600x900 at 1080p) or +# a percentage (25 to 400, at most 4096 pixels a side); above 100 supersamples the scene (anti-aliasing). Read at start. +# render_scale = game +# Scaling to the window when it is larger than the game resolution: fsr (AMD FSR 1) or bilinear, and FSR's sharpening +# from 0 (off) to 100. Changes while the game runs take effect at once. +# upscaler = fsr +# sharpness = 80 [language] # Language: a Windows locale such as de-DE, or a Switch code (en-US, ja, zh-Hant, ...). Default: the Windows locale.