compat-common: optional locale= in tombox.cfg sets the user language a title sees #151
No reviewers
Labels
No labels
accessibility
bug
documentation
duplicate
enhancement
good first issue
help wanted
invalid
library
question
wontfix
No milestone
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
github/omonkeyz--xbox-emulator!151
Loading…
Reference in a new issue
No description provided.
Delete branch "gh-pr/151/head"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
@GDAgent on GitHub · 2026-11-22 16:18 UTC · original
GDAgent:port/compat-locale-override→main· +242 −3 · 5 files · 1 commits · closed without mergingLibrary / area: compat-common (new
locale.rs; one-time install next togdk_user::installinnet_guard::ensure)Exports changed (exports.txt rows): none (host kernelbase entry points are patched in-process)
Source of the behaviour: a console reports the language chosen in its system settings; on a PC the title sees the Windows user's language. Windows API contracts per the Win32 docs (buffer sizing,
ERROR_INSUFFICIENT_BUFFER,MUI_LANGUAGE_ID/MUI_LANGUAGE_NAME). Ported from brcly/TomBox 31d8b03 (GDAgent) plus brcly's 64e7c2a (size queries), MIT OR Apache-2.0.With
locale=<name>intombox.cfgthese queries answer with that locale:GetUserDefaultLocaleNameGetUserDefaultLCIDGetUserDefaultLangIDGetUserDefaultUILanguageGetUserPreferredUILanguagesThe emulated
XPackageGetUserLocale(gdk::package::user_locale) readsGetUserDefaultLocaleName, so it follows too.Without the line nothing changes. Behaviour details:
LocaleNameToLCID, thenLCIDToLocaleName(en-usbecomesen-US). An unknown name, or one without its own LCID, is logged and ignored.net_guard::resolve_export/write_jumpbecomepub(crate)solocale.rscan reuse them.Tests:
cargo test -p compat-common --lib locale: 5 passed. They cover canonicalisation, buffer contract, MUI id form, the hooks reporting the configured locale, and that host exports can take the patch.--test locale_override: 1 passed. It is process-wide, so it has its own test binary.Whole
compat-common --lib: 136 passed, 12 failed. The same 12 (online::trackmania::*andonline::xdefiant::tests::parameters_match_real_service_layout) fail on plainmaintoo: they need the unpublishedbackend_data/, which builds with empty stand-ins.Native Windows 11; not run under Proton.
Not verified in a title with this repo's build; the checks above are unit tests against the real Windows locale APIs.
cargo test -p compat-commonpasses (locale tests pass; the 12 failures also occur onmain)No game or console files and no binaries included
No fake success; anything not possible is left
missingwith a note@omonkeyz on GitHub · 2026-11-22 16:28 UTC · original
Applied in
a689c70(merged in604b5a1) with your authorship kept, thanks! I removed one trailing//comment in locale.rs, because the repo allows no comment lines at all.Pull request closed