Skip to content

Proposal: a game profile the host reads at run time (design note and dm_profile() accessor) - #492

Closed
v0lumehi wants to merge 1 commit into
seedds:mainfrom
v0lumehi:runtime-profile
Closed

v0lumehi wants to merge 1 commit into
seedds:mainfrom
v0lumehi:runtime-profile

Conversation

@v0lumehi

Copy link
Copy Markdown
Contributor

What and why

A proposal for the largest patch NX2Apple carries (#388, "Fewer patches for forks"): the game profile read by the host at run time, so one host binary can serve any game, instead of 37 DM_GAME_* macros compiled in from game_profile.h. The design is docs/runtime-profile.md: the problem, what the fork's experiment (73a89fb0) did and did not prove, which values could be read at run time (identity, guest memory, switches, Metal setup) and which stay compile-time until measured (tex_flush_upload, tex_dirty_upload, render_cond, on graphics call paths), a five-step migration, the risks.

Code is included: step 1 only. dm/host/hle_profile.{c,h} gives dm_profile(), which returns the compiled constants in one struct; t_profile.c checks every field against its macro. No call site changes and no behaviour change; the host links it by the existing hle_*.c wildcard.

Decision for @seedds

  • Adopt in steps (the five in the note, each a PR that keeps every game working): the fork drops its parser and call-site edits as the steps land and keeps only the launcher on top.
  • Adopt partly (steps 1 to 3, graphics flags and the per-game build stay): the fork keeps a small patch for the graphics flags.
  • Keep compile-time: this PR can close; the fork keeps its patch and its sync patchers.

Refs #388.

Checked

  • Tests: make -C dm/host/tests GAME=010015100B514000 run (includes t_profile; t_profile also run for three other profiles); make -C dm/host GAME=010015100B514000 builds; python3 -m unittest dm/tools/tests/test_docs.py; lint_python.py: 0 new.
  • Games run: none. The change moves no value and reads none.
  • Devices and OS: M-series Mac, macOS 26.
  • Measurements: none; the note says which cost claims are readings of the code, not measurements.

Docs

  • The finding is in docs/runtime-profile.md, linked from docs/development.md; no reference entry, so no symptom index change
  • No chain tool changed
  • No game files, keys or data extracted from a game in the change or the attachments

…dm_profile() accessor)

docs/runtime-profile.md: the problem (one host per game), what NX2Apple's experiment did and proved, which values can be read at run time and which stay compile-time for now, the migration in steps, the risks. Step 1 is code: dm_profile() returns the compiled constants in one struct, with a test; no call site changes.
v0lumehi added a commit to LNPANDY/NX2Apple that referenced this pull request Oct 30, 2026
The loader's settable image header is forwarded as seedds/nxnative#729. The game framework, its build, tests and env switch row are fork-only until the runtime profile (seedds/nxnative#492) is upstream, because the framework carries profile.tsv and main.m sets DM_PROFILE.
v0lumehi added a commit to LNPANDY/NX2Apple that referenced this pull request Oct 30, 2026
The loader's settable image header is forwarded as seedds/nxnative#729. The game framework, its build, tests and env switch row are fork-only until the runtime profile (seedds/nxnative#492) is upstream, because the framework carries profile.tsv and main.m sets DM_PROFILE.
v0lumehi added a commit to LNPANDY/NX2Apple that referenced this pull request Oct 31, 2026
The loader's settable image header is forwarded as seedds/nxnative#729. The game framework, its build, tests and env switch row are fork-only until the runtime profile (seedds/nxnative#492) is upstream, because the framework carries profile.tsv and main.m sets DM_PROFILE.
v0lumehi added a commit to LNPANDY/NX2Apple that referenced this pull request Oct 31, 2026
The loader's settable image header is forwarded as seedds/nxnative#729. The game framework, its build, tests and env switch row are fork-only until the runtime profile (seedds/nxnative#492) is upstream, because the framework carries profile.tsv and main.m sets DM_PROFILE.
v0lumehi added a commit to LNPANDY/NX2Apple that referenced this pull request Oct 31, 2026
The loader's settable image header is forwarded as seedds/nxnative#729. The game framework, its build, tests and env switch row are fork-only until the runtime profile (seedds/nxnative#492) is upstream, because the framework carries profile.tsv and main.m sets DM_PROFILE.
v0lumehi added a commit to LNPANDY/NX2Apple that referenced this pull request Oct 31, 2026
The loader's settable image header is forwarded as seedds/nxnative#729. The game framework, its build, tests and env switch row are fork-only until the runtime profile (seedds/nxnative#492) is upstream, because the framework carries profile.tsv and main.m sets DM_PROFILE.
@seedds

seedds commented Nov 2, 2026

Copy link
Copy Markdown
Owner

Thanks for writing this up so carefully. I'm keeping the profile compile-time, so I'm closing this.

  • nxnative ships one app per game, so one host binary would help only forks, and the migration touches about 40 macros (41 in 18 files on main now, against 37 in 15 in the note).
  • The graphics flags (tex_flush_upload, tex_dirty_upload, render_cond) compile down to nothing today, and their cost at run time hasn't been measured.
  • Steps 1 to 3 alone still leave a per-game build, so the fork couldn't drop its patch, and step 1 alone adds a second copy of the values with nothing reading it.
  • One app with many games doesn't appear to need it: Run a game from a library loaded at run time (one app, many games) #926 describes each game built as its own framework, and that shape keeps the compile-time profile.

I'd look at this again with a measured gain for this project, or a need that shape can't meet. I know this leaves NX2Apple carrying its patch. dm_set_game_image_header and front_progress_hook (#729, #742) stay on main.

@seedds seedds closed this Nov 2, 2026
Fbenhaddou pushed a commit to Fbenhaddou/NX2Apple that referenced this pull request Nov 2, 2026
Drop 0045 and 0052 (landed upstream as seedds/nxnative#729 and LNPANDY#742), refresh 0053 and the route C patches for the setter now declared in front.h, mark the runtime profile patches as declined in seedds/nxnative#492, regenerate the gallery.
lucaszhongsj pushed a commit to lucaszhongsj/nxnative that referenced this pull request Nov 19, 2026
Upstream-Status: fork-only (declined seedds#492)
Reason: One host binary runs multiple games in the iPhone shell, so profile constants are read at run time
Issue: LNPANDY/NX2Apple#226
lucaszhongsj pushed a commit to lucaszhongsj/nxnative that referenced this pull request Nov 19, 2026
Upstream-Status: fork-only (declined seedds#492)
Reason: Build self-contained DmGame frameworks so the shared iOS shell can dlopen multiple games
Issue: LNPANDY/NX2Apple#392
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.

2 participants