Skip to content

Mac: default the game language to the Mac's own - #239

Open
Amost- wants to merge 1 commit into
seedds:mainfrom
Amost-:pr/mac-language-default
Open

Amost- wants to merge 1 commit into
seedds:mainfrom
Amost-:pr/mac-language-default

Conversation

@Amost-

@Amost- Amost- commented Oct 25, 2026 •

Copy link
Copy Markdown
Contributor

On the Mac every game started in English: nothing sets DM_LANG there, and hle_oe.c answered en-US. With this PR the Mac host follows the Mac's own language.

  • Host. With DM_LANG unset, GetDesiredLanguage / GetRegionCode answer the first of the Mac's preferred languages ([NSLocale preferredLanguages], in lang_mac.m, Mac only) that the game supports, read from control.nacp (SupportedLanguageFlag) beside the version's RomFS. Region variants map as the NSP script maps them (it-IT → it, en-AU → en-GB, es-MX → es-419, …). When none of the Mac's languages is the game's: en-US if the game has it, else the game's first language. The choice is made once at startup, before any guest thread runs (setenv must not race the guest's getenv), and logged: language: it (macOS preferred it-IT, en-GB; game supports en-US en-GB ja fr de es it). An explicit DM_LANG still wins; iOS is unchanged (its app always sets DM_LANG). The language code table moves from hle_sdk16.c to lang.c, shared through hle.h.
  • Mac app (--platform mac-app). pack_app.py writes DMLanguage only when --language / LANGUAGE names one, so by default the app follows the Mac; it also packs the game's control.nacp beside romfs/ (the base game's when the packed version has none). The Mac run command sets DM_LANG likewise only for a language asked for.
  • Entry: docs/reference/services.md, "Game language default from the Mac's preferred languages"; docs/development.md updated.

Behaviour change: Mac apps and Mac run commands built without --language no longer default to en-US; they follow the Mac. A game that stores its language in its save (FINAL FANTASY CRYSTAL CHRONICLES Remastered Edition does) keeps the save's language; the default applies to new saves.

Checked

  • This branch alone on main (9a56ecf): the host unit tests (new t_lang: 106 checks of the mapping, the control-data read and the fallbacks; t_oe); every test in dm/tools/tests, dm/ios/tests and dm/gfx/tests (test_nsp_mac_app.py: no --language gives no DMLanguage and no DM_LANG, --lang only when asked, the control.nacp copy and its fallback); dmhost for Super Mario Bros. Wonder (NVN), Hades (Vulkan) and Digimon Story Cyber Sleuth (GL); the iOS compile check.
  • On a Mac set to Italian, FINAL FANTASY CRYSTAL CHRONICLES Remastered Edition: tools/dmhost without DM_LANG logged language: it; an app built with --platform mac-app (no --language) logged the same and started in Italian; with DM_LANG=en-US the game ran in English.

Not checked

  • Mac language lists other than this one (Italian, then English, Japanese, Polish) beyond the unit tests.
  • The iPhone: by design no change there; only the compile check ran.

One of three independent PRs from the same bring-up; they touch separate code and can land in any order.

Rebased on today's main (the settings window, #379 / #388)

The settings store and window interact with this default:

  • pack_app.py now copies the Game language row's default into DMLanguage; with no --language, settings.py makes that the game's first language, which would have fixed every multi-language Mac app to it. The branch writes DMLanguage only when --language / LANGUAGE named one (a one-line guard, with a test), so the launcher leaves DM_LANG unset and the host follows the Mac's languages.
  • That holds when the window is not shown ("Show this window at launch" off, DM_LAUNCHER=0, a single-language game) and for a Mac-only build's run command. When the window is shown, Play sets every row, so DM_LANG becomes the row's default, the game's first language, and the window shows that as selected rather than the Mac's. The row would need an "Automatic (the Mac's languages)" option as its Mac default, with LauncherSettings.apply() leaving the variable unset for it. That is a change to the shared Swift model, which I did not make here; happy to add it in this PR or a follow-up, whichever you prefer.
  • settings.py is fed the packed version's control.nacp only; the base game's fallback (--nacp) reaches the host but not the list.

🤖 Generated with Claude Code

@Amost-
Amost- force-pushed the pr/mac-language-default branch 4 times, most recently from d5e8f49 to 2ee1cdd Compare October 27, 2026 21:01
@Amost-
Amost- force-pushed the pr/mac-language-default branch 5 times, most recently from 99207b7 to b2a575d Compare October 31, 2026 08:16
@github-actions github-actions Bot added host The Horizon host: SVCs, services, threads, memory (dm/host) packing Building an IPA or a Mac app: the NSP script, extraction, the shader split, the packers mac The Mac front end and app (dm/mac, front_mac.m) tools Tools and scripts (dm/tools, scripts) docs Documentation labels Nov 3, 2026
With DM_LANG unset, the Mac host answers GetDesiredLanguage / GetRegionCode with
the first of the Mac's preferred languages the game supports (control.nacp
SupportedLanguageFlag), resolved once at startup before guest threads run, and
logs the choice; when none is supported, en-US if the game has it, else the
game's first language. An explicit DM_LANG still wins; iOS is unchanged. The
language table moves to lang.c, shared through hle.h.

The Mac app writes DMLanguage, and the Mac run command sets DM_LANG, only when
--language / LANGUAGE names one, so by default both follow the Mac; the app
carries the game's control.nacp (the base game's when the packed version has
none). Tests: t_lang, test_nsp_mac_app. Documented in docs/reference/services.md
and docs/development.md.

Behaviour change: Mac apps and run commands without --language no longer default
to en-US.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
@Amost-
Amost- force-pushed the pr/mac-language-default branch from b2a575d to 4a5b357 Compare November 3, 2026 12:43
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

docs Documentation host The Horizon host: SVCs, services, threads, memory (dm/host) mac The Mac front end and app (dm/mac, front_mac.m) packing Building an IPA or a Mac app: the NSP script, extraction, the shader split, the packers tools Tools and scripts (dm/tools, scripts)

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant