Skip to content

Stacked on seedds/nxnative#1383: the game is told the device's HDR peak (1,600 nits by model), not a fixed 1,000 - #8

Closed
oliverames wants to merge 2 commits into
pr-1383-headfrom
hdr-device-peak
Closed

oliverames wants to merge 2 commits into
pr-1383-headfrom
hdr-device-peak

Conversation

@oliverames

Copy link
Copy Markdown
Owner

Stacked on seedds#1383 (not mergeable into main yet: main has no HDR presentation code, it lives in seedds#1383 / seedds#1249 / seedds#1176). Not fully tested. The base branch pr-1383-head is seedds#1383's head (e8ac7386); this PR adds two commits on it, so it can be rebased onto whichever HDR PR lands.

  1. 8c646e2f (earlier): front_ios.m reads the hardware model and publishes the device's peak HDR brightness (1,600 nits for the iPhone 12 Pro and later, 1,200 for the iPhone 10 and 11, the M-series iPad XDR panels), and the layers' mastering metadata can top out at it when it is below the game's own 1,000; DM_HDR_EDR_MAX (a ratio of paper white) overrides.
  2. acaedf15: the game is also told that peak. QueryDisplayHdrStatus answered a fixed 1,000, so a game tone-mapped to a 1,000-nit display on a panel that reaches 1,600; it now answers dm_hdr_mastering_peak() (the model peak when published, else 1,000), and the layer metadata carries the same value. DM_HDR_EDR_MAX still caps it.

Checked. Built into an iOS Release build and run on a physical iPhone 19,4 (potential EDR headroom 8.0, paper white 203, so about 1,624 nits): the log line reads vi HDR: enabled (EDR display), virtual peak 1600 nits, and the owner reports the picture looks good in a race.

Not checked. No side-by-side against the 1,000-nit value, no measurement of nits, no Mac run, and the unit tests were not run (the build tree has the PR's own docs-index failure at e8ac7386, docs/agents/game-patches.md out of date, unrelated to this change). A model missing from the table keeps 1,000. A brightness or heat cost of the higher EDR peak was not measured: the slow GPU state in the same runs is unexplained and HDR load has not been ruled out as a contributor (a DM_HDR=0 run is planned).

Oliver Ames added 2 commits November 7, 2026 12:34
…front_ios.m reads the hardware model; 1,600 nits on the modern panels), and DM_HDR_EDR_MAX overrides
QueryDisplayHdrStatus and the layer's mastering metadata now report the front end's model peak when it published one
(1,600 nits for the iPhone 12 Pro and later), else the virtual 1,000. DM_HDR_EDR_MAX still caps it. Stacked on seedds#1383.
@chatgpt-codex-connector

Copy link
Copy Markdown
Codex Review Summary: ❌ Failed

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ❌ Failed 2026-11-07T17:34:55.472584Z
We couldn’t complete this review. Comment @codex review to try again.
acaedf1 PR opened
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@chatgpt-codex-connector

Copy link
Copy Markdown

You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard.
To continue using code reviews, you can upgrade your account or add credits to your account and enable them for code reviews in your settings.

@oliverames

Copy link
Copy Markdown
Owner Author

Folded into #9, which carries this change rebuilt on seedds#1176's HDR design (the HDR code this was stacked on, seedds#1383's, is a different implementation) together with the launcher rows and the packed-conversion probe.

@oliverames oliverames closed this Nov 7, 2026
oliverames pushed a commit that referenced this pull request Nov 28, 2026
Issue seedds#3046 reported that building FINAL FANTASY TACTICS 1.5.1 (v524288)
from a derived profile lost the 1.4.0 build-keyed job-pool wake-up cut,
leaving a blank window on Mac and iPad. A plain MATCH_CUTS rule cannot
carry that cut because main+0x12558 overwrites a PC-relative `b SignalEvent`
whose encoding changes when the PLT moves, and the 8-byte wrapper at
0x12554 is byte-identical to an adjacent wrapper at 0x1254c.

- dm/tools/nso_match.py: share locate_rule and validate_called_by so
  MATCH_STUBS / MATCH_FRAME_STEP support `called_by` for short ambiguous
  callees, fail-closed like MATCH_CUTS.
- dm/games/010038B015560000/patches.py: replace 1.4.0 CUTS with a
  game-bound MATCH_STUBS rule located via the single-job submit caller
  (main+0x14790, bl at +0x94) with the wait wrapper (main+0x12500)
  checked in `others`. Patch only `ldr x0,[x0]` into a 3-instruction
  trampoline (`str x0,[x0,#8]; ldr x0,[x0]; b site+4`), leaving
  `b SignalEvent` untouched across PLT shifts. Moves BINDING from
  `build` to `game`.
- dm/tools/check_thread_cuts.py: support MATCH_STUBS and dynamic
  SignalEvent/WaitEvent PLT lookup in FFT's Unicorn replay.
- dm/tools/tests/test_nso_match.py: add unit test for `called_by` in
  locate_stub.
- Docs: update game note, rewriter/threads reference entries, and
  regenerate docs/agents/game-patches.md.

Verified with test_nso_match.py, test_patches.py, test_docs.py,
test_nro_pack.py, full patch_nso.py rewrites, and Unicorn instruction
replay on both 1.0.0 (v0) and 1.4.0 (v393216) mains. 1.5.1 runtime
retest awaits confirmation on seedds#3046.

Co-authored-by: Phil Wu <194177+runty@users.noreply.github.com>
oliverames pushed a commit that referenced this pull request Nov 28, 2026
…ostbite frame regulator (PR seedds#3234)

Rewriter (dm/tools/patch_nso.py):
- Check DATA_BLOCKS and spin_quick(T, hi) at the start of spin_region before calling spin_lock(T), guard spin_lock(a) on its first instruction's mnemonic before decoding lookahead words, and clear spin_dec in spin_region's finally block after every head.
- Bounds spin_dec to <= ~135 entries per head instead of growing with text size per worker (which passed 24 GB on EA SPORTS FC 27 1.8e's 185 MB main; full 1.8d main rewrite now peaks at 2.20 GiB RSS), while cutting spin-search decodes by 39% and time by 30% with byte-identical output.
- Add synthetic unit tests in test_spin_waits.py and drop the two fixed pyright reportOptionalSubscript entries from lint_python_baseline.tsv.

Host (dm/host/hle_fpslock.c):
- Extend fb_find() to read GameRenderSettings.Enable from Frostbite reflection and locate the unique fmov vD.2d, seedds#30.0 / adrp+ldr / stur qD, [xR, #8] regulator store (failing closed with [RED] on ambiguity), verified on EA SPORTS FC 27 v0 (0xd9f4e18), 1.8d.310c (0xda20e38), and 1.8e.50bc disassembly (0xda5d0f8).
- Remove the build-gated FC 27 row from k_locks[] and its HOST_BINDING entry in docs_patches.py, add dynamic and negative cases in t_fpslock.c, and update docs and generated indexes (including the 1.8e.50bc iPhone 17 Pro and Mac 5K notes).

Co-authored-by: Vertu User <55468974+vertu-user@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant