d3d12: fix oversized HUD and menus at native 1440p #3014

Closed
Rulemore wants to merge 2 commits from upstream-pr/3014 into main
Rulemore commented 2026-12-01 23:44:05 +00:00 (Migrated from github.com)

Imported from ubiquitarianism/leonida. Originally posted by Rulemore on 2026-12-01T23:44:05Z.


Claimed in the coordination issue as: D3D12-NATIVE1440-LEGACY-UI.

Depends on: #2889, #2958 for coordination of the overlapping output planner; whichever lands second needs rebasing. This narrow fix includes no code from either PR and can otherwise stand alone.

What and why

Series X at -Resolution 1440 -NoDlss currently shrinks the 4K mode row and Settings viewport. The game's 4K-authored HUD and menus are then laid out on a 1440p stage, making them oversized.

Port the native-1440p legacy UI mechanism from DexNom/VIctory via VIctory-NVIDIA: retain the stock 4K mode row and Settings viewport; set the legacy UI flag, 3840x2160 layout and 2560x1440 output whenever video settings are copied. Enlarge the UI pool to 94 MiB for the two legacy surfaces and two 1440p targets. Scene scale remains independently controlled by the existing render-scale hooks. Other output sizes retain their existing experimental path.

The new trampoline is guarded by the original site's hash and its padding. Patch groups now validate and snapshot all ranges, reject overlaps, and stage all page protections before writing. A protection failure restores staged protections without installing a partial control-flow patch. Protections are restored in reverse order for ranges sharing a page.

Tested

  • New native-1440p layout regression fails on the original planner and passes with this change.
  • cargo test --locked -p leonida-loader --lib: 92 passed, including the optional supported-image guard checks with LEONIDA_GAME_DIR set locally.
  • Tests cover trampoline targets and settings offsets, hash rejection, protection-staging failure, successful writes/reverse restoration, overlap rejection, and both native and existing non-native output guards.
  • cargo clippy --locked -p leonida-loader --lib --tests --no-deps: passed.
  • Optimized diag build with diagnostics,mimalloc: passed.
  • Changed-file clean-room scan and git diff --check: passed.
  • Native 1440p startup smoke test reaches the profile/start screen with the corrected UI layout and no UI-pool assertion. The user subsequently confirmed that the in-game HUD is correctly sized too. Full pause-map and extended play validation are not claimed here. No performance gain is claimed.

GPUs tested: NVIDIA GeForce RTX 4070 SUPER, driver 617.14, Windows 11 build 26200; Series X, native 2560x1440, DLSS and frame generation off (startup smoke only).

AI-assisted: OpenAI Codex (GPT-6); independent read-only review by GPT-6.2 Sol. Review findings were addressed and the revised diff reviewed again.

Checklist

  • Based on upstream main 2705632c5.
  • One topic; no ultrawide feature or shader-translator changes.
  • No game files, logs, screenshots, dumps, keys or decryption changes included.
<!-- greyfinch-sync:ubiquitarianism/leonida:issue:5596751200 --> Imported from [ubiquitarianism/leonida](https://github.com/ProjectLeonida/mandy/pull/3014). Originally posted by [Rulemore](https://github.com/Rulemore) on 2026-12-01T23:44:05Z. --- Claimed in the coordination issue as: [D3D12-NATIVE1440-LEGACY-UI](https://github.com/ProjectLeonida/mandy/issues/2570#issuecomment-7329633830). Depends on: #2889, #2958 for coordination of the overlapping output planner; whichever lands second needs rebasing. This narrow fix includes no code from either PR and can otherwise stand alone. ### What and why Series X at `-Resolution 1440 -NoDlss` currently shrinks the 4K mode row and Settings viewport. The game's 4K-authored HUD and menus are then laid out on a 1440p stage, making them oversized. Port the native-1440p legacy UI mechanism from DexNom/VIctory via VIctory-NVIDIA: retain the stock 4K mode row and Settings viewport; set the legacy UI flag, 3840x2160 layout and 2560x1440 output whenever video settings are copied. Enlarge the UI pool to 94 MiB for the two legacy surfaces and two 1440p targets. Scene scale remains independently controlled by the existing render-scale hooks. Other output sizes retain their existing experimental path. The new trampoline is guarded by the original site's hash and its padding. Patch groups now validate and snapshot all ranges, reject overlaps, and stage all page protections before writing. A protection failure restores staged protections without installing a partial control-flow patch. Protections are restored in reverse order for ranges sharing a page. ### Tested - New native-1440p layout regression fails on the original planner and passes with this change. - `cargo test --locked -p leonida-loader --lib`: 92 passed, including the optional supported-image guard checks with `LEONIDA_GAME_DIR` set locally. - Tests cover trampoline targets and settings offsets, hash rejection, protection-staging failure, successful writes/reverse restoration, overlap rejection, and both native and existing non-native output guards. - `cargo clippy --locked -p leonida-loader --lib --tests --no-deps`: passed. - Optimized `diag` build with `diagnostics,mimalloc`: passed. - Changed-file clean-room scan and `git diff --check`: passed. - Native 1440p startup smoke test reaches the profile/start screen with the corrected UI layout and no UI-pool assertion. The user subsequently confirmed that the in-game HUD is correctly sized too. Full pause-map and extended play validation are not claimed here. No performance gain is claimed. GPUs tested: NVIDIA GeForce RTX 4070 SUPER, driver 617.14, Windows 11 build 26200; Series X, native 2560x1440, DLSS and frame generation off (startup smoke only). AI-assisted: OpenAI Codex (GPT-6); independent read-only review by GPT-6.2 Sol. Review findings were addressed and the revised diff reviewed again. ### Checklist - [x] Based on upstream `main` 2705632c5. - [x] One topic; no ultrawide feature or shader-translator changes. - [x] No game files, logs, screenshots, dumps, keys or decryption changes included.
andrew-ai commented 2026-12-01 23:45:01 +00:00 (Migrated from github.com)

Imported from ubiquitarianism/leonida. Originally posted by andrew-ai on 2026-12-01T23:45:01Z.


The current-behavior paragraph in docs/ultrawide.md, lines 130–133 still says the 1440p profile changes the 3840×2160 mode row and points the Settings viewport at it. At this revision the 2560×1440 case returns early and preserves the 4K UI layout. This affects both an explicit LEONIDA_OUTPUT=2560x1440 and the LEONIDA_OUTPUT_1440=1 shorthand when no explicit size is set.

Please qualify the existing description as applying to other output sizes, and describe native 1440p separately. I ran the generated-switches check at 64c4b3ee4 and it exited 0. That check covers the switches table, while this discrepancy is in the hand-written guide. Source and documentation review only.

Codex-assisted.

<!-- greyfinch-sync:ubiquitarianism/leonida:comment:7329728344 --> Imported from [ubiquitarianism/leonida](https://github.com/ProjectLeonida/mandy/pull/3014#issuecomment-7329728344). Originally posted by [andrew-ai](https://github.com/andrew-ai) on 2026-12-01T23:45:01Z. --- The current-behavior paragraph in [docs/ultrawide.md, lines 130–133](https://github.com/ProjectLeonida/mandy/blob/64c4b3ee4/docs/ultrawide.md#L130-L133) still says the 1440p profile changes the 3840×2160 mode row and points the Settings viewport at it. At this revision the 2560×1440 case returns early and preserves the 4K UI layout. This affects both an explicit LEONIDA_OUTPUT=2560x1440 and the LEONIDA_OUTPUT_1440=1 shorthand when no explicit size is set. Please qualify the existing description as applying to other output sizes, and describe native 1440p separately. I ran the generated-switches check at 64c4b3ee4 and it exited 0. That check covers the switches table, while this discrepancy is in the hand-written guide. Source and documentation review only. Codex-assisted.
Rulemore commented 2026-12-01 23:55:58 +00:00 (Migrated from github.com)

Imported from ubiquitarianism/leonida. Originally posted by Rulemore on 2026-12-01T23:55:58Z.


Updated in 973f31d50. The guide now describes native 2560x1440 separately: stock 4K mode/Settings viewport, legacy 4K UI layout, 1440p output targets and the 94 MiB UI pool. It also documents the LEONIDA_OUTPUT_1440 fallback and limits the old experimental mode-row/viewport description to other non-stock output sizes. Documentation only; changed-file clean-room scan and git diff --check passed. Codex-assisted.

<!-- greyfinch-sync:ubiquitarianism/leonida:comment:7329941609 --> Imported from [ubiquitarianism/leonida](https://github.com/ProjectLeonida/mandy/pull/3014#issuecomment-7329941609). Originally posted by [Rulemore](https://github.com/Rulemore) on 2026-12-01T23:55:58Z. --- Updated in 973f31d50. The guide now describes native 2560x1440 separately: stock 4K mode/Settings viewport, legacy 4K UI layout, 1440p output targets and the 94 MiB UI pool. It also documents the LEONIDA_OUTPUT_1440 fallback and limits the old experimental mode-row/viewport description to other non-stock output sizes. Documentation only; changed-file clean-room scan and git diff --check passed. Codex-assisted.
andrew-ai commented 2026-12-01 23:58:30 +00:00 (Migrated from github.com)

Imported from ubiquitarianism/leonida. Originally posted by andrew-ai on 2026-12-01T23:58:30Z.


Confirmed the documentation correction at 973f31d50. The guide now matches the native 2560x1440 selection, its fallback when the explicit output is blank, and the separate path for other non-stock sizes. The generated switches check also passes. My documentation finding is resolved. Codex-assisted.

<!-- greyfinch-sync:ubiquitarianism/leonida:comment:7329990226 --> Imported from [ubiquitarianism/leonida](https://github.com/ProjectLeonida/mandy/pull/3014#issuecomment-7329990226). Originally posted by [andrew-ai](https://github.com/andrew-ai) on 2026-12-01T23:58:30Z. --- Confirmed the documentation correction at 973f31d50. The guide now matches the native 2560x1440 selection, its fallback when the explicit output is blank, and the separate path for other non-stock sizes. The generated switches check also passes. My documentation finding is resolved. Codex-assisted.
MoonEyes commented 2026-12-02 12:19:23 +00:00 (Migrated from github.com)

Imported from ubiquitarianism/leonida. Originally posted by MoonEyes on 2026-12-02T12:19:23Z.


Closing: this pull request no longer applies to current main (merge conflict in d3d12/crates/leonida-loader/src/hooks.rs), and open pull requests that have fallen out of step with main are being closed so the list stays workable. If you still want this change, rebase it on current main and reopen it (or open a new pull request); it will be looked at again.

AI-assisted (Claude Code).

<!-- greyfinch-sync:ubiquitarianism/leonida:comment:7345166987 --> Imported from [ubiquitarianism/leonida](https://github.com/ProjectLeonida/mandy/pull/3014#issuecomment-7345166987). Originally posted by [MoonEyes](https://github.com/MoonEyes) on 2026-12-02T12:19:23Z. --- Closing: this pull request no longer applies to current `main` (merge conflict in `d3d12/crates/leonida-loader/src/hooks.rs`), and open pull requests that have fallen out of step with `main` are being closed so the list stays workable. If you still want this change, rebase it on current `main` and reopen it (or open a new pull request); it will be looked at again. AI-assisted (Claude Code).

Pull request closed

Sign in to join this conversation.
No reviewers
No labels
No milestone
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Reference
ProjectLeonida/mandy!3014
No description provided.