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

Open
github-bot wants to merge 1 commit from github-bot/gh-3380 into main AGit
Owner

@⁠guilhermegomes380-debug on GitHub · 2026-12-03 18:04 UTC · original
guilhermegomes380-debug:d3d12/map-cursor-any-output → main · +165 −1 · 1 files · 1 commits · open

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

**@⁠guilhermegomes380-debug** on GitHub · 2026-12-03 18:04 UTC · [original](https://github.com/ProjectLeonida/mandy/pull/3380) `guilhermegomes380-debug:d3d12/map-cursor-any-output` → `main` · +165 −1 · 1 files · 1 commits · open 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)
With LEONIDA_OUTPUT=2560x1440 the pause map drew its cursor at two thirds of its
place: the cursor's pixels (fraction x screen size, handler +0x140) are drawn by
the map screen in its own 3840x2160 frame, while the same pixels feed the choice
under the cursor in screen pixels. The setter's call at 0x23246fc now goes to a
stub that stores 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) take fraction x the output's
mode row from stubs in int3 padding, and the zoom's anchor (0x2324330, +0x140
back to a fraction) divides by 3840x2160. Applied only together with the output
patches.

Run on 2026-12-03 (RTX 5070, 2560x1440): the cursor is drawn on the shop and the
destination falls under it; with the drawn value alone the destination fell half
again as far.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
github-bot locked as GitHub sync and limited conversation to collaborators 2026-12-03 18:05:45 +00:00
This pull request can be merged automatically.
This branch is out-of-date with the base branch
You are not authorized to merge this pull request.
View command line instructions

Checkout

From your project repository, check out a new branch and test the changes.
git fetch -u origin '+refs/pull/3380/head:github-bot/gh-3380'
git switch 'github-bot/gh-3380'

Merge

Merge the changes and update on Forgejo.
git switch 'main'
git merge --no-ff 'github-bot/gh-3380'
git switch 'github-bot/gh-3380'
git rebase 'main'
git switch 'main'
git merge --ff-only 'github-bot/gh-3380'
git switch 'github-bot/gh-3380'
git rebase 'main'
git switch 'main'
git merge --no-ff 'github-bot/gh-3380'
git switch 'main'
git merge --squash 'github-bot/gh-3380'
git switch 'main'
git merge --ff-only 'github-bot/gh-3380'
git switch 'main'
git merge 'github-bot/gh-3380'
git push origin 'main'
This discussion has been locked. Commenting is limited to contributors.
No reviewers
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.

Dependencies

No dependencies set

Reference
github/ubiquitarianism--leonida!3380
No description provided.