Skip to content

Mac: settings window before the game starts - #379

Closed
surajmandalcell wants to merge 1 commit into
seedds:mainfrom
surajmandalcell:mac-launcher
Closed

surajmandalcell wants to merge 1 commit into
seedds:mainfrom
surajmandalcell:mac-launcher

Conversation

@surajmandalcell

@surajmandalcell surajmandalcell commented Oct 27, 2026 •

Copy link
Copy Markdown
Contributor

Closes #374

Builds on #418 (meta column, schema 1), #399 (base) and #431 (saved choices), as agreed in #388.

The Mac app shows a settings window before dmhost starts, drawn only from launcher.json: a Basic view and an Advanced settings disclosure (level in meta), resolution shown in pixels from base, and a Mac-only Display mode row (DM_FULLSCREEN, platform:mac in shown). Sub-settings follow needs. The iPhone keeps its single list and shares the row code (LauncherRow.swift).

  • Choices are read and written as launcher.<VAR> in the app's domain (Saved choices: one store and one order for every way a game starts (#388) #431). A variable already set by the launch environment or an env.txt is shown locked and never written.
  • DM_LAUNCHER=0 or --no-launcher skips only the window; saved choices still apply. The "Show this window at launch" check box (launcher.show) does the same; holding Option shows the window again.
  • docs/frontends.md and docs/launcher.schema.json list the new meta key and the optional api field.

Tests: tools 346 passed, 16 skipped; iOS 31 passed.

Open: not played through from the window yet; BotW 1.6 has no registered render-scale stub, so its Resolution row is hidden.

@v0lumehi

Copy link
Copy Markdown
Contributor

Heads-up: seedds asked in #388 to agree on one settings schema and one store for player choices before the launchers are extended. I posted a proposal there (#388 (comment)): one optional meta column (key=value;…) in settings.tsv, a versioned launcher.json, and one store with one precedence. The window in this PR is the "default view" in that proposal: nxnative's own native window, drawn from launcher.json, with the platform and resolution metadata as meta keys. seedds also pointed out that a value inherited from the environment must not be overwritten by a saved one, which the proposed precedence covers. Your view in #388 would help most here.

seedds pushed a commit to Xipzer/nxnative that referenced this pull request Oct 27, 2026
…ON Schema front ends read

Draft for the discussion in seedds#388. Two open PRs want the ninth column of
settings.tsv for different things (seedds#355: needs, seedds#399: level), and seedds#379
brings its own metadata. This makes the ninth column one optional meta
column of key=value pairs, so any number of optional fields fit:

- settings.py's META lists the keys with the pattern each value must
  match (level=basic, needs=<VAR>=<value>); an unknown key, a key given
  twice, a value that does not match, or needs naming a variable no row
  sets stops settings.py. The fields go into the row of launcher.json.
- launcher.json gets "schema": 1. Schema 1 grows only by optional
  fields: a reader ignores fields it does not know, and a field keeps its
  meaning. docs/launcher.schema.json describes the file as a JSON Schema,
  so a front end can check it and generate types from it.
- The five settings a front end shows first carry level=basic, and
  Rumble strength carries needs=DM_RUMBLE=1, as seedds#355 has it.

The platform split stays the shown column's platform:<ios|mac> (seedds#352).

test_launcher_settings.py: the fields and the version in a written list,
the strict meta parsing, META agreeing with docs/frontends.md and the
schema, and every list written for Breath of the Wild, Wonder and Hades
(iOS and Mac) conforming to the schema (a small validator for the
keywords the schema uses, as CI has no jsonschema package).
test_docs, test_lint_python, test_launcher_storage, test_nsp_mac_app and
test_pso_offline pass.
@surajmandalcell

Copy link
Copy Markdown
Contributor Author

@seedds rebased onto main (6d1e07b), as asked in #388:

Still a draft until I've played a game through from the window.

The Mac .app now shows the launcher settings from dm/games/settings.tsv before
it starts dmhost: a Basic view with an Advanced settings disclosure, resolution
in real pixels, and a Window / Fullscreen row. Skip it with the check box,
--no-launcher or DM_LAUNCHER=0; hold Option to show it again.

Builds on seedds#352.
seedds added a commit that referenced this pull request Oct 27, 2026
A Mac app now shows its settings in a native window before the host
starts (dm/mac/Launcher.swift, linked into the launcher by pack_app.py
with swiftc), drawn from its launcher.json with the iOS launcher's
model and rows (LauncherSettings.swift, and LauncherRow.swift, moved out
of the iOS launcher to be shared). The settings marked level=basic come
first; the others are under a remembered Advanced settings disclosure,
in the list's usual sections, with Reset to tested defaults. The
render scale shows its size in pixels for the chosen console mode when
the list carries the profile's base size. Play puts the settings into
the environment the host inherits; Quit, Cmd-Q and closing the window
end the app without the game.

The window keeps its choices in the saved-choices store (#431), so a
start from a front end or with the window turned off gets the same
settings. A variable the launch environment or an env file set is
shown fixed and left as it is: the launcher passes the names in
DM_ENV_LAUNCH_KEYS and DM_ENV_FILE_KEYS. DM_LAUNCHER=0, --no-launcher
(open <app> --args --no-launcher) and "Show this window at launch"
turned off skip the window, and the launcher then applies the saved
choices itself; Option at launch shows it again. The window's own
state is window.show and window.advanced, outside the launcher.
namespace a front end resets.

Display mode is a Mac row, 0=Window,1=Fullscreen. front_mac.m now reads
DM_FULLSCREEN by value (any value but 0 is fullscreen), so the row
needs no special empty value that unsets the variable.

Changes from #379: the Mac uses the same sections and labels as the
iPhone instead of its own (one list, one set of names, as #388 agreed);
the level, the base size and the platform split come from the meta
column, render_base and platform:mac already on main; no api field.

Checked: test_launcher_storage compiles the window with the model and
rows and measures the real grouped Form (Basic and Advanced, fitting
and growing from the top edge) and checks Basic/Advanced rows, Display
mode, the size in pixels and launch overrides shown fixed;
test_nsp_mac_app checks the launcher is linked from its C and Swift
sources, the reuse key covers swiftc and the Swift files, and the
launch and env-file keys and --no-launcher with saved choices. A Mario
Wonder Mac app packed by the NSP script showed the window from Finder
(open; 12 settings), and started without it with --no-launcher played
on (2,700 frames presented). Play in the live window was not clicked:
this session cannot send input to it.

Co-authored-by: Suraj Mandal <[email protected]>
@seedds

seedds commented Oct 27, 2026

Copy link
Copy Markdown
Owner

Thanks, @surajmandalcell. The settings window landed on main as 1e207fa, with you as co-author. Its layout, the Basic/Advanced split, the window sizing, the footer and Option-to-show are yours. It sits on top of the schema (#418) and the saved-choices store (#431).

What changed from this PR:

  • One list, one set of names. The Mac uses the iPhone's sections and labels (Game, Controls, Performance; Render scale) instead of its own, as Front ends: one interface between the engine and graphical apps (settings, build progress, runtime events) #388 agreed. Basic is the level=basic rows, and the size in pixels comes from the profile's render_base (base). The api field is dropped.
  • The store. The window keeps its choices in launcher.<VAR> in the app's domain, which the launcher also reads without the window. A variable set by the launch environment or an env.txt is shown fixed ("Set at launch" / "Set by an env file") and left as it is. That fixes the inherited-environment overwrite. DM_LAUNCHER=0, --no-launcher and the window turned off skip it but still apply the saved choices. The window's own state moved to window.show / window.advanced, outside the launcher. keys a front end resets.
  • Display mode is 0=Window,1=Fullscreen, and front_mac.m reads DM_FULLSCREEN by value, so the model needs no empty value that unsets a variable.

Checked:

  • Tests: the storage check (now with your layout check, which measures the real Form) and the Mac app tests pass, along with every other tool and iOS test file and the lint ratchet.
  • A real app: I packed a Mario Wonder Mac app with the NSP script. Opened from Finder, it showed the window (12 settings). Started with --no-launcher, it played on (about 2,700 frames presented).
  • Not checked: clicking Play in the live window, since I couldn't send input to it.

Closing this PR.

@seedds seedds closed this Oct 27, 2026
Xipzer pushed a commit to Xipzer/nxnative that referenced this pull request Oct 27, 2026
…ON Schema front ends read

Draft for the discussion in seedds#388. Two open PRs want the ninth column of
settings.tsv for different things (seedds#355: needs, seedds#399: level), and seedds#379
brings its own metadata. This makes the ninth column one optional meta
column of key=value pairs, so any number of optional fields fit:

- settings.py's META lists the keys with the pattern each value must
  match (level=basic, needs=<VAR>=<value>); an unknown key, a key given
  twice, a value that does not match, or needs naming a variable no row
  sets stops settings.py. The fields go into the row of launcher.json.
- launcher.json gets "schema": 1. Schema 1 grows only by optional
  fields: a reader ignores fields it does not know, and a field keeps its
  meaning. docs/launcher.schema.json describes the file as a JSON Schema,
  so a front end can check it and generate types from it.
- The five settings a front end shows first carry level=basic, and
  Rumble strength carries needs=DM_RUMBLE=1, as seedds#355 has it.

The platform split stays the shown column's platform:<ios|mac> (seedds#352).

test_launcher_settings.py: the fields and the version in a written list,
the strict meta parsing, META agreeing with docs/frontends.md and the
schema, and every list written for Breath of the Wild, Wonder and Hades
(iOS and Mac) conforming to the schema (a small validator for the
keywords the schema uses, as CI has no jsonschema package).
test_docs, test_lint_python, test_launcher_storage, test_nsp_mac_app and
test_pso_offline pass.
@oliverames oliverames mentioned this pull request Oct 28, 2026
1 of 3 tasks
@surajmandalcell
surajmandalcell deleted the mac-launcher branch October 31, 2026 02:36
Know-It-All-Brother pushed a commit to Know-It-All-Brother/nxnative that referenced this pull request Nov 9, 2026
…#374, seedds#388)

A Mac app now shows its settings in a native window before the host
starts (dm/mac/Launcher.swift, linked into the launcher by pack_app.py
with swiftc), drawn from its launcher.json with the iOS launcher's
model and rows (LauncherSettings.swift, and LauncherRow.swift, moved out
of the iOS launcher to be shared). The settings marked level=basic come
first; the others are under a remembered Advanced settings disclosure,
in the list's usual sections, with Reset to tested defaults. The
render scale shows its size in pixels for the chosen console mode when
the list carries the profile's base size. Play puts the settings into
the environment the host inherits; Quit, Cmd-Q and closing the window
end the app without the game.

The window keeps its choices in the saved-choices store (seedds#431), so a
start from a front end or with the window turned off gets the same
settings. A variable the launch environment or an env file set is
shown fixed and left as it is: the launcher passes the names in
DM_ENV_LAUNCH_KEYS and DM_ENV_FILE_KEYS. DM_LAUNCHER=0, --no-launcher
(open <app> --args --no-launcher) and "Show this window at launch"
turned off skip the window, and the launcher then applies the saved
choices itself; Option at launch shows it again. The window's own
state is window.show and window.advanced, outside the launcher.
namespace a front end resets.

Display mode is a Mac row, 0=Window,1=Fullscreen. front_mac.m now reads
DM_FULLSCREEN by value (any value but 0 is fullscreen), so the row
needs no special empty value that unsets the variable.

Changes from seedds#379: the Mac uses the same sections and labels as the
iPhone instead of its own (one list, one set of names, as seedds#388 agreed);
the level, the base size and the platform split come from the meta
column, render_base and platform:mac already on main; no api field.

Checked: test_launcher_storage compiles the window with the model and
rows and measures the real grouped Form (Basic and Advanced, fitting
and growing from the top edge) and checks Basic/Advanced rows, Display
mode, the size in pixels and launch overrides shown fixed;
test_nsp_mac_app checks the launcher is linked from its C and Swift
sources, the reuse key covers swiftc and the Swift files, and the
launch and env-file keys and --no-launcher with saved choices. A Mario
Wonder Mac app packed by the NSP script showed the window from Finder
(open; 12 settings), and started without it with --no-launcher played
on (2,700 frames presented). Play in the live window was not clicked:
this session cannot send input to it.

Co-authored-by: Suraj Mandal <[email protected]>
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.

Mac: a settings window before the game starts (resolution, display mode, frame rate)

3 participants