d3d12 loader: the map cursor with an output other than 3840x2160 #3380

Open
guilhermegomes380-debug wants to merge 1 commit from upstream-pr/3380 into main
guilhermegomes380-debug commented 2026-12-03 18:04:14 +00:00 (Migrated from github.com)

Imported from ubiquitarianism/leonida. Originally posted by guilhermegomes380-debug on 2026-12-03T18:04:14Z.


Claimed in the coordination issue as: not claimed beforehand; a bug found while playing, fixed and tested locally first.

Related: #2958 (ultrawide output, which positions the map cursor for its own wide layout; this one only covers LEONIDA_OUTPUT sizes from output_patches, so the two touch the same handler but not the same code).

What and why

With LEONIDA_OUTPUT=2560x1440 (the launcher's default on Series X at 1440p and below), the pause map draws its cursor at two thirds of where it is: pointing at a shop marks a spot half again as far from the top-left corner. At 3840x2160 it is right.

The map's input handler keeps the cursor as a fraction of the screen (+0xA8) and its pixels (+0x140) as fraction x screen size (0x2324770, size from 0x22DA840). The map screen draws +0x140 in its own fixed 3840x2160 frame, while the same +0x140 feeds the choices under the cursor in screen pixels. So, only when output_patches applied (all or none through apply_all, each site guarded by its expected bytes):

  • the setter's call at 0x23246fc goes to a stub storing fraction x 3840x2160 (0x2324770 itself is unchanged, so its other caller, the pick at 0x2324cf6, keeps screen pixels);
  • the five readers of +0x140 (hover 0x2322fec, drag start 0x23240fa, viewport cursor 0x232474a, hit test 0x232415d, query near the cursor 0x2324f1d) call stubs in int3 padding that compute fraction x the output's mode row (0x615c100);
  • the zoom's anchor (0x2324330, +0x140 back to a fraction) divides by 3840x2160.

Stubs live in five int3 runs (0x55e6b15, 0x55e824c, 0x55fddd4, 0x55ff284, 0x55ffd07), none reached by any call or jump; the test pins every byte and the bounds of each run.

Tested

  • cargo test -p leonida-loader --locked --lib: 92 passed (the new the_map_cursor_patches_are_the_bytes_checked_on_2026_12_03 pins all bytes; it does not exist on main).
  • python -I scripts/check_no_game_data.py on the changed file: passes.
  • In game, retail Series X build 1.0.2.1, 2560x1440 output: the log shows all 14 map cursor: hooks applied; the cursor is drawn where pointed, the destination falls on the shop (also near the right and bottom edges), dragging and zoom at the cursor follow it, and markers under the cursor react. Before: the destination fell 1.5x away. An earlier live version that patched only the drawn value moved the cursor right but sent the destination half again as far.

GPUs tested: NVIDIA GeForce RTX 5070, driver 621.40, Windows 11 Pro (build 26300)

AI-assisted: yes. Code, disassembly reading and live tests with Claude Opus 5.5 (Claude Code); three passes of a separate read-only reviewer agent (Claude Opus 5.5) audited the encodings, padding runs, register use and the other readers of +0x140, and its findings (the hit test, the second caller of 0x2324770, the zoom anchor and the near query) are in this change.

Checklist

  • Based on current main and merges cleanly (a conflicting pull request is labeled needs rebase).
  • One topic; follow-up work goes in a new pull request.
  • No game data, keys or decryption (CONTRIBUTING.md), including in logs or reports quoted here.
  • A new translator rule is in the contract table of docs/design.md, with how it was confirmed. (n/a: no translator change)

🤖 Generated with Claude Code

<!-- greyfinch-sync:ubiquitarianism/leonida:issue:5632155150 --> Imported from [ubiquitarianism/leonida](https://github.com/ProjectLeonida/mandy/pull/3380). Originally posted by [guilhermegomes380-debug](https://github.com/guilhermegomes380-debug) on 2026-12-03T18:04:14Z. --- Claimed in the coordination issue as: not claimed beforehand; a bug found while playing, fixed and tested locally first. Related: #2958 (ultrawide output, which positions the map cursor for its own wide layout; this one only covers `LEONIDA_OUTPUT` sizes from `output_patches`, so the two touch the same handler but not the same code). ### What and why With `LEONIDA_OUTPUT=2560x1440` (the launcher's default on Series X at 1440p and below), the pause map draws its cursor at two thirds of where it is: pointing at a shop marks a spot half again as far from the top-left corner. At 3840x2160 it is right. The map's input handler keeps the cursor as a fraction of the screen (`+0xA8`) and its pixels (`+0x140`) as fraction x screen size (0x2324770, size from 0x22DA840). The map screen draws `+0x140` in its own fixed 3840x2160 frame, while the same `+0x140` feeds the choices under the cursor in screen pixels. So, only when `output_patches` applied (all or none through `apply_all`, each site guarded by its expected bytes): - the setter's call at 0x23246fc goes to a stub storing fraction x 3840x2160 (0x2324770 itself is unchanged, so its other caller, the pick at 0x2324cf6, keeps screen pixels); - the five readers of `+0x140` (hover 0x2322fec, drag start 0x23240fa, viewport cursor 0x232474a, hit test 0x232415d, query near the cursor 0x2324f1d) call stubs in int3 padding that compute fraction x the output's mode row (0x615c100); - the zoom's anchor (0x2324330, `+0x140` back to a fraction) divides by 3840x2160. Stubs live in five int3 runs (0x55e6b15, 0x55e824c, 0x55fddd4, 0x55ff284, 0x55ffd07), none reached by any call or jump; the test pins every byte and the bounds of each run. ### Tested - `cargo test -p leonida-loader --locked --lib`: 92 passed (the new `the_map_cursor_patches_are_the_bytes_checked_on_2026_12_03` pins all bytes; it does not exist on `main`). - `python -I scripts/check_no_game_data.py` on the changed file: passes. - In game, retail Series X build 1.0.2.1, 2560x1440 output: the log shows all 14 `map cursor:` hooks applied; the cursor is drawn where pointed, the destination falls on the shop (also near the right and bottom edges), dragging and zoom at the cursor follow it, and markers under the cursor react. Before: the destination fell 1.5x away. An earlier live version that patched only the drawn value moved the cursor right but sent the destination half again as far. GPUs tested: NVIDIA GeForce RTX 5070, driver 621.40, Windows 11 Pro (build 26300) AI-assisted: yes. Code, disassembly reading and live tests with Claude Opus 5.5 (Claude Code); three passes of a separate read-only reviewer agent (Claude Opus 5.5) audited the encodings, padding runs, register use and the other readers of `+0x140`, and its findings (the hit test, the second caller of 0x2324770, the zoom anchor and the near query) are in this change. ### Checklist - [x] Based on current `main` and merges cleanly (a conflicting pull request is labeled `needs rebase`). - [x] One topic; follow-up work goes in a new pull request. - [x] No game data, keys or decryption (CONTRIBUTING.md), including in logs or reports quoted here. - [ ] A new translator rule is in the contract table of `docs/design.md`, with how it was confirmed. (n/a: no translator change) 🤖 Generated with [Claude Code](https://claude.com/claude-code)
This pull request cannot be merged automatically due to conflicts.
Merge manually to resolve the conflicts.
View command line instructions

Checkout

From your project repository, check out a new branch and test the changes.
git fetch -u origin 'upstream-pr/3380:upstream-pr/3380'
git switch 'upstream-pr/3380'

Merge

Merge the changes and update on Forgejo.

Warning: The "Autodetect manual merge" setting is not enabled for this repository, you will have to mark this pull request as manually merged afterwards.

git switch 'main'
git merge --no-ff 'upstream-pr/3380'
git switch 'upstream-pr/3380'
git rebase 'main'
git switch 'main'
git merge --ff-only 'upstream-pr/3380'
git switch 'upstream-pr/3380'
git rebase 'main'
git switch 'main'
git merge --no-ff 'upstream-pr/3380'
git switch 'main'
git merge --squash 'upstream-pr/3380'
git switch 'main'
git merge --ff-only 'upstream-pr/3380'
git switch 'main'
git merge 'upstream-pr/3380'
git push origin 'main'
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!3380
No description provided.