diff --git a/docs/architecture.md b/docs/architecture.md index c5931732..b4a18d98 100644 --- a/docs/architecture.md +++ b/docs/architecture.md @@ -112,7 +112,8 @@ Every guest thread is a host thread. TotK assumes Horizon's scheduler: three app `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 + screen's corners (`hud_width = 21:9` or `16:9` keeps it in the middle of the screen instead, from the `-hud21x9` or + `-hud16x9` variant of the folder), 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 stretched. diff --git a/docs/building.md b/docs/building.md index 5332c22a..dac50564 100644 --- a/docs/building.md +++ b/docs/building.md @@ -117,6 +117,10 @@ of them. they write `build\\romfs-patches-xbox` and `romfs-patches-xbox-label` ([controls.md](controls.md), "Xbox button prompts"), which `build_game.py` copies next to `totk.exe` like `romfs-patches`. `--prompts pc` writes `romfs-patches-pc`, the keyboard and mouse prompts ([controls.md](controls.md), "PC button prompts"). + `--aspect x` writes the UI laid out for a game resolution of another shape; with `--hud 16:9` or `--hud 21:9` + (a screen wider than that) the HUD stays within the middle 16:9 or 21:9 instead of the screen's corners. The default + `--out` then is `build\\romfs-patches-x-hud16x9` (`-hud21x9`), which the game loads for `hud_width = 16:9` + (`21:9`) in `totk.ini` ([totk.ini.example](../totk.ini.example)). A build from source has no layouts for other shapes than 16:9. At an `output_res` such as 5120x1440 the game then draws the largest 16:9 size inside it (2560x1440) and the present adds bars, instead of a wide camera over a diff --git a/installer/steps.py b/installer/steps.py index 3c3c1e25..3794be0e 100644 --- a/installer/steps.py +++ b/installer/steps.py @@ -1199,7 +1199,24 @@ class PcPrompts(Step): # ---- 6b. screen shapes -SHAPED_FOLDER = re.compile(r'^romfs-patches(?:-xbox|-xbox-label|-pc)?-\d+x\d+$') +SHAPED_FOLDER = re.compile(r'^romfs-patches(?:-xbox|-xbox-label|-pc)?-\d+x\d+(?:-hud(?:16|21)x9)?$') + + +def hud_width(dest): + """The selected HUD cap, with the same default as runtime/cfg.c.""" + try: + text = (dest / 'totk.ini').read_text(encoding='utf-8-sig', errors='replace') + except OSError: + text = '' + value = (screens.ini_value(text, 'hud_width') or 'full').lower() + return value if value in ('16:9', '21:9') else 'full' + + +def shape_hud(size, hud): + """The selected cap when at least 1% narrower than the shape, as make_romfs_patches.py requires.""" + w, h = (int(v) for v in size.split('x')) + cap = {'16:9': 16 / 9, '21:9': 21 / 9}.get(hud) + return hud if cap and cap < w / h * 0.99 else None class Shapes(Step): @@ -1207,7 +1224,7 @@ class Shapes(Step): in totk.ini, romfs-patches-