From 41268c02dd44266be36d4838a9c3352c213e60ea Mon Sep 17 00:00:00 2001 From: Peiikai <339721950+peiikai@users.noreply.github.com> Date: Sun, 15 Nov 2026 20:52:00 -0600 Subject: [PATCH] General: HUD Centered / At edges (#817) On windows wider or taller than 16:9 (Aspect ratio Unlocked) the HUD can now sit at the screen's edges instead of in the centred 16:9 box: hearts and keys to the left edge, item buttons and rupees to the right. It uses the phone and tablet layout that already existed (runtime/hle/hud_corners.c), so the Metal and Vulkan draw paths are unchanged. Phones and tablets now follow the setting too, with At edges as their default; elsewhere the default is Centered. Co-Authored-By: Claude Opus 5.5 --- docs/debug-hooks.md | 2 ++ runtime/hle/hud_corners.c | 22 ++++++++++++++-------- runtime/settings.c | 3 +++ runtime/settings.h | 3 +++ runtime/ui/difficulty.mm | 12 ++++++++++-- runtime/ui/lang/de.inc | 4 ++++ runtime/ui/lang/es.inc | 4 ++++ runtime/ui/lang/fr.inc | 4 ++++ runtime/ui/lang/it.inc | 4 ++++ runtime/ui/lang/ja.inc | 4 ++++ runtime/ui/lang/ko.inc | 4 ++++ runtime/ui/lang/nl.inc | 4 ++++ runtime/ui/lang/pt-BR.inc | 4 ++++ runtime/ui/lang/ru.inc | 4 ++++ runtime/ui/lang/zh-Hans.inc | 4 ++++ runtime/ui/lang/zh-Hant.inc | 4 ++++ 16 files changed, 76 insertions(+), 10 deletions(-) diff --git a/docs/debug-hooks.md b/docs/debug-hooks.md index 2cdeb68c0..8feb76a8d 100644 --- a/docs/debug-hooks.md +++ b/docs/debug-hooks.md @@ -217,6 +217,8 @@ These work on both Metal and Vulkan unless noted. | `LARECOMP_NO_FRAME_CLEAR` | 1 (Vulkan: 0 / 1) | Don't clear scene render targets at their first use each frame. On Vulkan the default is no clears on integrated GPUs. | | `LARECOMP_TEX_FULLHASH` | 1 | Hash every texture in full each time instead of the faster partial checks. | | `LARECOMP_NO_WIDESCREEN` | 1 | Turn the widescreen view off (16:9 framing everywhere). | +| `LARECOMP_HUD_EDGES` | 1 | The game's HUD at the window's edges, as General > HUD = At edges. | +| `LARECOMP_NO_HUD_CORNERS` | 1 | Keep the game's HUD in the centred 16:9 box, whatever General > HUD says. | | `LARECOMP_NO_PAUSE_FILL` | 1 | Keep the pause screen's backdrop in the 16:9 box on other window shapes (the game shows around it). | | `LARECOMP_WIDE_TEST` | ratio | Pretend the window has this shape, relative to 16:9 (e.g. `1.3125` for 21:9). | diff --git a/runtime/hle/hud_corners.c b/runtime/hle/hud_corners.c index b70f0c763..53d1319b2 100644 --- a/runtime/hle/hud_corners.c +++ b/runtime/hle/hud_corners.c @@ -1,8 +1,9 @@ // Every platform: how shown the game's own X / Y item buttons are (hud_xy_alpha, for the D-pad items' cross), and with // D-pad = Items the rupee count moved left, out from under that cross (rupee_dx). // -// Phones and tablets: with Aspect ratio = Unlocked and a window wider or taller than 16:9, the game's HUD goes to the real -// screen corners instead of the centred 16:9 box, in every room so it never jumps at a door; and optionally its X / Y item +// With Aspect ratio = Unlocked, General > HUD = At edges (the default on phones and tablets; ultrawide monitors: issue +// #817) and a window wider or taller than 16:9, the game's HUD goes to the real screen corners instead of the centred +// 16:9 box, in every room so it never jumps at a door. Phones and tablets: optionally its X / Y item // buttons are hidden while the on-screen controls (which show those items) are up. // // Game thread (rt_hud_corners_tick, from the HUD's state update, HUD_HEARTS_SITE, x0 = the HUD): each group pane under @@ -177,21 +178,27 @@ void rt_hud_corners_tick(uint64_t hud) { find_panes(hud); } if (g_pane[RUPEE]) set_xy(RUPEE, g_authored[RUPEE] + rupee_dx(), *(const float *)(uintptr_t)(g_pane[RUPEE] + 0x34)); -#if PLAT_TOUCH float f = widescreen_factor(); bool in = game_in_play() && world_on_screen(); - bool want = in && g_settings.aspect == ASPECT_UNLOCKED && (f > 1.01f || f < 0.99f) && !ENV("LARECOMP_NO_HUD_CORNERS"); + bool want = in && g_settings.aspect == ASPECT_UNLOCKED && (f > 1.01f || f < 0.99f) && !ENV("LARECOMP_NO_HUD_CORNERS") && + (g_settings.hud_pos == HUD_EDGES || ENV("LARECOMP_HUD_EDGES")); +#if PLAT_TOUCH bool hide = in && (g_settings.touch_hide_xy_hud || ENV("LARECOMP_HIDE_XY_HUD")) && touch_visible(); +#else + bool hide = false; +#endif if (!want && !hide && !g_moved) { bool any = false; for (unsigned i = 0; i < NPANES; i++) any |= g_hid[i]; - if (!any) { g_active = false, g_left = g_right = 0; return; } + if (!any) { g_active = false, g_left = g_right = g_up = 0; return; } } float l = 0, r = 0, up = 0; - if (want && f < 1) up = 360 * (1 / f - 1); // (a tablet: the band's spare height above it) + if (want && f < 1) up = 360 * (1 / f - 1); // (a tablet, or a tall window: the band's spare height above it) else if (want) { - float il, ir; + float il = 0, ir = 0; +#if PLAT_TOUCH menu_safe_insets(&il, &ir); // (the camera cutout: on one side only in landscape) +#endif float span = 1280 * f; // layout units across the window l = 640 * (f - 1) - il * span, r = 640 * (f - 1) - ir * span; if (l < 0) l = 0; @@ -213,7 +220,6 @@ void rt_hud_corners_tick(uint64_t hud) { else if (!hide && g_hid[i]) *fl |= 1, g_hid[i] = false; } g_moved = want, g_active = want, g_left = l, g_right = r, g_up = up; -#endif } // ---- render thread diff --git a/runtime/settings.c b/runtime/settings.c index ae13e36a3..9c9d3873b 100644 --- a/runtime/settings.c +++ b/runtime/settings.c @@ -47,6 +47,7 @@ const char *touch_control_name(int i) { Settings g_settings = { .aspect = ASPECT_UNLOCKED, + .hud_pos = PLAT_TOUCH ? HUD_EDGES : HUD_CENTERED, // (phones and tablets: as before the setting, clear of the thumbs) .dyn_min = 540, .fullscreen = false, .volume = 1.0f, @@ -310,6 +311,7 @@ void settings_load(void) { else if (!strcmp(key, "move_360")) g_settings.move_360 = atoi(val) != 0; else if (!strcmp(key, "hookshot_8way")) g_settings.hookshot_8way = atoi(val) != 0; else if (!strcmp(key, "blur_removal")) g_settings.blur_removal = atoi(val) != 0; + else if (!strcmp(key, "hud")) g_settings.hud_pos = !strcmp(val, "edges") ? HUD_EDGES : HUD_CENTERED; else if (!strcmp(key, "hide_hero_icon")) g_settings.hide_hero_icon = atoi(val) != 0; else if (!strcmp(key, "pause_unfocused")) g_settings.pause_unfocused = atoi(val) != 0; else if (!strcmp(key, "remember_window")) g_settings.remember_window = atoi(val) != 0; @@ -407,6 +409,7 @@ void settings_save(void) { #endif fprintf(f, "# LAS Recomp settings (edited from the in-game menu: F1, Esc, or Minus+Plus on a controller)\n"); fprintf(f, "aspect = %s\n", g_settings.aspect == ASPECT_ORIGINAL ? "original" : "unlocked"); + fprintf(f, "hud = %s\n", g_settings.hud_pos == HUD_EDGES ? "edges" : "centered"); fprintf(f, "fullscreen = %d\n", g_settings.fullscreen); fprintf(f, "volume = %.2f\n", g_settings.volume); fprintf(f, "audio_output = %s\n", k_audio_out_keys[g_settings.audio_out == AUDIO_OUT_51]); diff --git a/runtime/settings.h b/runtime/settings.h index bf0078ec8..31692cbcd 100644 --- a/runtime/settings.h +++ b/runtime/settings.h @@ -4,6 +4,7 @@ #include enum { ASPECT_UNLOCKED = 0, ASPECT_ORIGINAL = 1 }; +enum { HUD_CENTERED = 0, HUD_EDGES = 1 }; enum { RES_MATCH = 0, /* 1..8 = 1x..8x */ RES_DYNAMIC = 9 /* output_scale.c's mode while dyn_res is on */, RES_Q75 = 10, RES_Q25 = 11, RES_Q50 = 12 }; // (11 was 67% of the display: larecomp.ini "67%" now loads as RES_Q75) enum { UPSCALE_BILINEAR = 0, UPSCALE_METALFX = 1 /* macOS */, UPSCALE_FSR1 = 2 /* Windows: AMD FSR 1 */ }; @@ -70,6 +71,8 @@ typedef struct { bool hookshot_8way; // the hookshot fires along the nearest of 8 directions (for 360-degree movement): runtime/hle/hookshot.c bool blur_removal; // no tilt-shift blur at the top / bottom of the screen bool hide_hero_icon; // no Hero Mode icon on the HUD + int hud_pos; // HUD_*: windows not 16:9 (Aspect ratio Unlocked): the game's HUD in the centred 16:9 box, or at + // the window's edges (runtime/hle/hud_corners.c). Default: centred, at the edges on phones and tablets bool pause_unfocused; // the game stops while its window isn't in front (runtime/hle/vi.c) bool remember_window; // the window opens at the size it was closed at (runtime/paths.c rt_window_remember) int window_w, window_h; // that size, in points (0: none saved yet) diff --git a/runtime/ui/difficulty.mm b/runtime/ui/difficulty.mm index afcc13050..82120a6cc 100644 --- a/runtime/ui/difficulty.mm +++ b/runtime/ui/difficulty.mm @@ -50,8 +50,9 @@ // Mode keeps the game's own flag.) extern "C" void difficulty_frame(void) {} -// General tab: the menus' and the game's language, text speed, the Hero Mode icon and the speedrun timer - settings -// that change how the game is shown, not how it plays (user, 2026-11-11). The start screen's System tab stays apart. +// General tab: the menus' and the game's language, text speed, where the HUD sits, the Hero Mode icon and the speedrun +// timer - settings that change how the game is shown, not how it plays (user, 2026-11-11). The start screen's System tab +// stays apart. extern "C" void input_apply_background(void); // hle/input.c extern "C" void general_draw(float scale) { @@ -94,6 +95,13 @@ "Controllers keep working while another window is in front. macOS may ask for Input " "Monitoring permission.")) input_apply_background(), settings_save(); + { // (issue #817: ultrawide monitors; phones and tablets had it at the edges always, now their default) + static const char *const pos[] = {LN("Centered"), LN("At edges")}; + if (g_settings.aspect != ASPECT_UNLOCKED) opt_disable_next(), opt_needs_next("Aspect ratio", "Unlocked"); + if (opt_choice("HUD", &g_settings.hud_pos, pos, 2, PLAT_TOUCH ? HUD_EDGES : HUD_CENTERED, + "Where the hearts, items and rupees sit when the screen isn't 16:9.")) + settings_save(); + } if (opt_toggle("Hide Hero Mode icon", &g_settings.hide_hero_icon, false, "Hides the Hero Mode emblem in the corner of the screen while playing a Hero Mode file.")) settings_save(); diff --git a/runtime/ui/lang/de.inc b/runtime/ui/lang/de.inc index 392a5fb5e..955ca7ede 100644 --- a/runtime/ui/lang/de.inc +++ b/runtime/ui/lang/de.inc @@ -2157,3 +2157,7 @@ {"Update can't change the app's files here. Use Download.", "Update kann die Dateien der App hier nicht ändern. Nutze Herunterladen."}, {"Update", "Aktualisieren"}, {"Download", "Herunterladen"}, +{"HUD", "HUD"}, +{"Centered", "Mittig"}, +{"At edges", "Am Rand"}, +{"Where the hearts, items and rupees sit when the screen isn't 16:9.", "Wo Herzen, Items und Rubine sitzen, wenn der Bildschirm nicht 16:9 ist."}, diff --git a/runtime/ui/lang/es.inc b/runtime/ui/lang/es.inc index ae0bef743..7feb5ebb4 100644 --- a/runtime/ui/lang/es.inc +++ b/runtime/ui/lang/es.inc @@ -2157,3 +2157,7 @@ {"Update can't change the app's files here. Use Download.", "Actualizar no puede cambiar aquí los archivos de la app. Usa Descargar."}, {"Update", "Actualizar"}, {"Download", "Descargar"}, +{"HUD", "HUD"}, +{"Centered", "Centrado"}, +{"At edges", "En los bordes"}, +{"Where the hearts, items and rupees sit when the screen isn't 16:9.", "Dónde aparecen los corazones, los objetos y las rupias cuando la pantalla no es 16:9."}, diff --git a/runtime/ui/lang/fr.inc b/runtime/ui/lang/fr.inc index 0df49c403..663b6f338 100644 --- a/runtime/ui/lang/fr.inc +++ b/runtime/ui/lang/fr.inc @@ -2157,3 +2157,7 @@ {"Update can't change the app's files here. Use Download.", "Mettre à jour ne peut pas modifier les fichiers de l'app ici. Utilise Télécharger."}, {"Update", "Mettre à jour"}, {"Download", "Télécharger"}, +{"HUD", "HUD"}, +{"Centered", "Centré"}, +{"At edges", "Aux bords"}, +{"Where the hearts, items and rupees sit when the screen isn't 16:9.", "L'emplacement des cœurs, des objets et des rubis quand l'écran n'est pas en 16:9."}, diff --git a/runtime/ui/lang/it.inc b/runtime/ui/lang/it.inc index e9e65eb2b..8231f04f4 100644 --- a/runtime/ui/lang/it.inc +++ b/runtime/ui/lang/it.inc @@ -2157,3 +2157,7 @@ {"Update can't change the app's files here. Use Download.", "Aggiorna non può modificare qui i file dell'app. Usa Scarica."}, {"Update", "Aggiorna"}, {"Download", "Scarica"}, +{"HUD", "HUD"}, +{"Centered", "Al centro"}, +{"At edges", "Ai bordi"}, +{"Where the hearts, items and rupees sit when the screen isn't 16:9.", "Dove si trovano cuori, oggetti e rupie quando lo schermo non è 16:9."}, diff --git a/runtime/ui/lang/ja.inc b/runtime/ui/lang/ja.inc index 533ffc57d..8ce7abb8b 100644 --- a/runtime/ui/lang/ja.inc +++ b/runtime/ui/lang/ja.inc @@ -2157,3 +2157,7 @@ {"Update can't change the app's files here. Use Download.", "ここではアップデートでアプリのファイルを変更できません。ダウンロードを使ってください。"}, {"Update", "アップデート"}, {"Download", "ダウンロード"}, +{"HUD", "HUD"}, +{"Centered", "中央"}, +{"At edges", "画面の端"}, +{"Where the hearts, items and rupees sit when the screen isn't 16:9.", "画面が16:9でないとき、ハートやアイテム、ルピーを表示する位置です。"}, diff --git a/runtime/ui/lang/ko.inc b/runtime/ui/lang/ko.inc index 04eff6e78..c6a110f57 100644 --- a/runtime/ui/lang/ko.inc +++ b/runtime/ui/lang/ko.inc @@ -2157,3 +2157,7 @@ {"Update can't change the app's files here. Use Download.", "여기서는 업데이트로 앱 파일을 바꿀 수 없습니다. 다운로드를 사용하세요."}, {"Update", "업데이트"}, {"Download", "다운로드"}, +{"HUD", "HUD"}, +{"Centered", "가운데"}, +{"At edges", "화면 가장자리"}, +{"Where the hearts, items and rupees sit when the screen isn't 16:9.", "화면이 16:9가 아닐 때 하트, 아이템, 루피가 표시되는 위치입니다."}, diff --git a/runtime/ui/lang/nl.inc b/runtime/ui/lang/nl.inc index f2241747a..6445a8205 100644 --- a/runtime/ui/lang/nl.inc +++ b/runtime/ui/lang/nl.inc @@ -2157,3 +2157,7 @@ {"Update can't change the app's files here. Use Download.", "Bijwerken kan de bestanden van de app hier niet wijzigen. Gebruik Downloaden."}, {"Update", "Bijwerken"}, {"Download", "Downloaden"}, +{"HUD", "HUD"}, +{"Centered", "Midden"}, +{"At edges", "Aan de randen"}, +{"Where the hearts, items and rupees sit when the screen isn't 16:9.", "Waar de hartjes, voorwerpen en roepies staan als het scherm niet 16:9 is."}, diff --git a/runtime/ui/lang/pt-BR.inc b/runtime/ui/lang/pt-BR.inc index d34343597..bbed23c5e 100644 --- a/runtime/ui/lang/pt-BR.inc +++ b/runtime/ui/lang/pt-BR.inc @@ -2157,3 +2157,7 @@ {"Update can't change the app's files here. Use Download.", "Atualizar não pode alterar os arquivos do app aqui. Use Baixar."}, {"Update", "Atualizar"}, {"Download", "Baixar"}, +{"HUD", "HUD"}, +{"Centered", "Centralizado"}, +{"At edges", "Nas bordas"}, +{"Where the hearts, items and rupees sit when the screen isn't 16:9.", "Onde ficam os corações, itens e rupias quando a tela não é 16:9."}, diff --git a/runtime/ui/lang/ru.inc b/runtime/ui/lang/ru.inc index ff600a246..00897301d 100644 --- a/runtime/ui/lang/ru.inc +++ b/runtime/ui/lang/ru.inc @@ -2157,3 +2157,7 @@ {"Update can't change the app's files here. Use Download.", "Обновить не может изменить файлы приложения здесь. Используйте Скачать."}, {"Update", "Обновить"}, {"Download", "Скачать"}, +{"HUD", "HUD"}, +{"Centered", "По центру"}, +{"At edges", "По краям"}, +{"Where the hearts, items and rupees sit when the screen isn't 16:9.", "Где показаны сердца, предметы и рупии, если экран не 16:9."}, diff --git a/runtime/ui/lang/zh-Hans.inc b/runtime/ui/lang/zh-Hans.inc index 5ecca24e9..7d0a9f379 100644 --- a/runtime/ui/lang/zh-Hans.inc +++ b/runtime/ui/lang/zh-Hans.inc @@ -2157,3 +2157,7 @@ {"Update can't change the app's files here. Use Download.", "此处无法通过更新修改应用文件。请使用下载。"}, {"Update", "更新"}, {"Download", "下载"}, +{"HUD", "HUD"}, +{"Centered", "居中"}, +{"At edges", "屏幕边缘"}, +{"Where the hearts, items and rupees sit when the screen isn't 16:9.", "屏幕不是16:9时,心、道具和卢比显示的位置。"}, diff --git a/runtime/ui/lang/zh-Hant.inc b/runtime/ui/lang/zh-Hant.inc index 11c560d56..a7b1486b5 100644 --- a/runtime/ui/lang/zh-Hant.inc +++ b/runtime/ui/lang/zh-Hant.inc @@ -2157,3 +2157,7 @@ {"Update can't change the app's files here. Use Download.", "此處無法透過更新修改應用程式檔案。請使用下載。"}, {"Update", "更新"}, {"Download", "下載"}, +{"HUD", "HUD"}, +{"Centered", "置中"}, +{"At edges", "畫面邊緣"}, +{"Where the hearts, items and rupees sit when the screen isn't 16:9.", "畫面不是16:9時,愛心、道具和盧比顯示的位置。"},