fix(menu): a Game language or Menu language picked in the menu is kept #3084

Merged
HumanBean merged 2 commits from llun/Longshot:fix/language-rows-kept into main 2026-12-03 14:39:02 +00:00
Member

Summary

A player picked Italian in the Insert menu, but the game stayed in English. The menu's own language also went back to
Auto at every restart. These are two bugs, both from #2822.

  1. Game language. The row saved its number in the list (game_language = 6) instead of the code ("it"). The game
    needs a code, so it ignored the 6 and played in English. The row read the 6 back and still showed Italiano.
  2. Menu language. The choice was saved, then dropped at the next start. Its list is filled in while the game runs
    (choicesFrom), but the file's reader only allowed the options in mod.toml, which for this row is just Auto. Saved
    choices of Microphone, Graphics card, ReShade preset file and NFC tag were dropped the same way.

What this changes:

  • The Game language row saves and reads the code. Auto leaves no line.
  • A choice with choicesFrom has no upper limit when the file is read.
  • Broken profiles repair themselves: a saved number from 1 to 16 is read as its language, and saved as the code the
    next time the game writes the file.
  • Two more places had the Game language mistake: RecompLauncher's launcher.ini also ended up as a number, and
    longshot mod would write 0. Both are fixed.

To see it on main: in the Insert menu's Gameplay tab, set Game language and Menu language to Italiano, then restart.
The game is in English, Menu language is Auto, and the log says
oe: the settings' game_language "6" is not a language the game has.

Read first: options_value and options_lines in game/crates/api/src/settings/service.rs, then language_code and
in_range in game/crates/longshot-game/src/settings_file.rs.

Testing

Tested: Windows 11, RTX 5080, sandbox on, no window, the kokiri-start save, throwaway profiles. The rows were set
over the control bridge, which uses the menu's own setter. One game folder, built from main and then from this branch:

  • main @ b4d56f526: pick Italian on both rows, then start twice more. Both starts log
    oe: language en-US (the default), Menu language is Auto, and the file holds game_language = 6.
  • This branch, fresh profile: the same steps. Both starts log oe: language it (game_language in the settings), Menu
    language stays Italiano, also after another setting changes, and the file holds game_language = "it".
  • Then, on this branch: Portuguese was played at the next start (pt-BR). Auto removed the line, and the start after
    it was in English.
  • This branch, over the settings file main had broken: Italian at the first start. The file held "it" after the
    next change of a setting.
  • dev.py smoke: PASS.

Five new tests fail on main and pass here. Two of them cover all 16 languages:
the_game_language_rows_choice_is_kept_by_its_code, a_game_language_kept_as_its_rows_number_is_read_as_its_code,
a_choice_whose_list_goes_on_with_the_pcs_is_kept, a_launchers_game_language_is_set_by_its_code and
the_game_language_is_written_by_its_code.

The suite, run in parts, all with gnullvm:

  • Python checks: 821 pass. test_i18n_complete fails, as it does on main @ b4d56f526 (#3065 fixes it). 51 are marked
    to be skipped on Windows.
  • Rust (test_lifter's three steps, run directly): format and clippy are clean, and 3424 tests pass, 0 fail. One
    test was left out because it is already known to fail on main:
    every_site_has_one_owner_and_the_sites_are_the_ones_before_the_split.

Still to test:

  • Windows or Linux: pick a Game language with the mouse or a gamepad, and restart from the menu's own question, expecting
    the game in that language (by hand)
  • Linux: the same starts as above, expecting the same log lines (by hand)
  • A PC with two graphics cards or a microphone: pick one, start the game twice more, expecting it kept (by hand)

Measurements

Nothing to measure: this changes how lines of the settings file are read and written, and nothing that runs each frame.

Risks

A revert is enough.

  • After updating: someone who picked a language on nightlies 1007 to 1022 and got used to English gets the language
    they picked.
  • A language from a mod: a saved number past 16 is dropped, because it depended on which mods were on. The player
    picks it again.
  • A choice past the end of its list is no longer dropped when the file is read. The older settings file had no upper
    limit either.

Checklist

Ready for review

  • One topic, on current main; the title is a Conventional Commit.
  • Tested on my own PC, in the game for a change the game runs, as Testing says.
  • mise run test passes (any failure that also fails on main is named).
  • Measured against main, or Measurements says why there is nothing to measure.
  • No game files, build output or hand-edited generated files; third_party/ untouched; nothing GPL-incompatible.

When it applies

  • A fix: a game-free test that fails on main and passes here.
  • AI assistance recorded with Assisted-by: / Co-Authored-By: trailers.

Ready to merge

  • Everything in Still to test has run, its results in Tested.
  • Tier 1 hardware it can affect is tested (docs/dev/standards.md, "Hardware tiers").
  • Approved in review, every comment answered.
  • CI passes on the head; on current main, measured again or a comment says why the numbers still hold.

🤖 Generated with Claude Code

## Summary A player picked Italian in the Insert menu, but the game stayed in English. The menu's own language also went back to Auto at every restart. These are two bugs, both from #2822. 1. **Game language.** The row saved its number in the list (`game_language = 6`) instead of the code (`"it"`). The game needs a code, so it ignored the 6 and played in English. The row read the 6 back and still showed Italiano. 2. **Menu language.** The choice was saved, then dropped at the next start. Its list is filled in while the game runs (`choicesFrom`), but the file's reader only allowed the options in `mod.toml`, which for this row is just Auto. Saved choices of Microphone, Graphics card, ReShade preset file and NFC tag were dropped the same way. What this changes: - The Game language row saves and reads the code. Auto leaves no line. - A choice with `choicesFrom` has no upper limit when the file is read. - **Broken profiles repair themselves:** a saved number from 1 to 16 is read as its language, and saved as the code the next time the game writes the file. - Two more places had the Game language mistake: RecompLauncher's `launcher.ini` also ended up as a number, and `longshot mod` would write 0. Both are fixed. **To see it on `main`:** in the Insert menu's Gameplay tab, set Game language and Menu language to Italiano, then restart. The game is in English, Menu language is Auto, and the log says `oe: the settings' game_language "6" is not a language the game has`. Read first: `options_value` and `options_lines` in `game/crates/api/src/settings/service.rs`, then `language_code` and `in_range` in `game/crates/longshot-game/src/settings_file.rs`. ## Testing **Tested:** Windows 11, RTX 5080, sandbox on, no window, the `kokiri-start` save, throwaway profiles. The rows were set over the control bridge, which uses the menu's own setter. One game folder, built from `main` and then from this branch: - **`main` @ b4d56f526:** pick Italian on both rows, then start twice more. Both starts log `oe: language en-US (the default)`, Menu language is Auto, and the file holds `game_language = 6`. - **This branch, fresh profile:** the same steps. Both starts log `oe: language it (game_language in the settings)`, Menu language stays Italiano, also after another setting changes, and the file holds `game_language = "it"`. - **Then, on this branch:** Portuguese was played at the next start (`pt-BR`). Auto removed the line, and the start after it was in English. - **This branch, over the settings file `main` had broken:** Italian at the first start. The file held `"it"` after the next change of a setting. - `dev.py smoke`: PASS. Five new tests fail on `main` and pass here. Two of them cover all 16 languages: `the_game_language_rows_choice_is_kept_by_its_code`, `a_game_language_kept_as_its_rows_number_is_read_as_its_code`, `a_choice_whose_list_goes_on_with_the_pcs_is_kept`, `a_launchers_game_language_is_set_by_its_code` and `the_game_language_is_written_by_its_code`. The suite, run in parts, all with gnullvm: - **Python checks:** 821 pass. `test_i18n_complete` fails, as it does on `main` @ b4d56f526 (#3065 fixes it). 51 are marked to be skipped on Windows. - **Rust (`test_lifter`'s three steps, run directly):** format and clippy are clean, and 3424 tests pass, 0 fail. One test was left out because it is already known to fail on `main`: `every_site_has_one_owner_and_the_sites_are_the_ones_before_the_split`. **Still to test:** - Windows or Linux: pick a Game language with the mouse or a gamepad, and restart from the menu's own question, expecting the game in that language (by hand) - Linux: the same starts as above, expecting the same log lines (by hand) - A PC with two graphics cards or a microphone: pick one, start the game twice more, expecting it kept (by hand) ## Measurements Nothing to measure: this changes how lines of the settings file are read and written, and nothing that runs each frame. ## Risks A revert is enough. - **After updating:** someone who picked a language on nightlies 1007 to 1022 and got used to English gets the language they picked. - **A language from a mod:** a saved number past 16 is dropped, because it depended on which mods were on. The player picks it again. - **A choice past the end of its list** is no longer dropped when the file is read. The older settings file had no upper limit either. ## Checklist ### Ready for review - [x] One topic, on current `main`; the title is a Conventional Commit. - [x] Tested on my own PC, in the game for a change the game runs, as Testing says. - [x] `mise run test` passes (any failure that also fails on `main` is named). - [x] Measured against `main`, or Measurements says why there is nothing to measure. - [x] No game files, build output or hand-edited generated files; `third_party/` untouched; nothing GPL-incompatible. ### When it applies - [x] A fix: a game-free test that fails on `main` and passes here. - [x] AI assistance recorded with `Assisted-by:` / `Co-Authored-By:` trailers. ### Ready to merge - [ ] Everything in Still to test has run, its results in Tested. - [ ] Tier 1 hardware it can affect is tested (docs/dev/standards.md, "Hardware tiers"). - [ ] Approved in review, every comment answered. - [ ] CI passes on the head; on current `main`, measured again or a comment says why the numbers still hold. 🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude Opus 5.5 <[email protected]>
fix(menu): the Game language and Menu language picked in the menu are kept, and a saved number is read as its language
Some checks failed
PR description / Title and description (pull_request_target) Successful in 7s
CI / What the change needs (pull_request) Successful in 8s
CI / Third-party parts and guide screenshots (pull_request) Successful in 13s
CI / Lint (pre-commit, ShellCheck, actionlint) (pull_request) Successful in 17s
CI / Rust (rustfmt, clippy, cargo test, end to end) (pull_request) Failing after 17m52s
CI / Host C for Windows (llvm-mingw, compile only) (pull_request) Failing after 1m24s
CI / Renderer build check (Windows, compile --only renderer, without and with FSR 4) (pull_request) Successful in 13m54s
CI / Renderer build check (Linux, compile --only renderer, without and with FSR 4) (pull_request) Successful in 13m28s
CI / Website build and checks (pull_request) Failing after 38s
CI / Game-free checks (run_all.py, part 2/2) (pull_request) Failing after 51m12s
CI / Game-free checks (run_all.py, part 1/2) (pull_request) Failing after 1h0m4s
5b3d63d040
Co-Authored-By: Claude Opus 5.5 <[email protected]>
Author
Member

Tested in game: Windows 11, RTX 5080, sandbox on, kokiri-start, throwaway profiles: on main Italian picked on both rows is English with the menu on Auto after a restart (game_language = 6); here the game and the menu stay Italian over restarts, a profile main left with 6 starts in Italian, Portuguese and Auto work, and dev.py smoke passes.

Tested in game: Windows 11, RTX 5080, sandbox on, kokiri-start, throwaway profiles: on main Italian picked on both rows is English with the menu on Auto after a restart (game_language = 6); here the game and the menu stay Italian over restarts, a profile main left with 6 starts in Italian, Portuguese and Auto work, and dev.py smoke passes.
Author
Member
@review
BeanBot left a comment

Recommendation: Approve. The menu fix works for the stock languages in the reported Windows run, but the shared settings path cannot read or select mod-provided languages through longshot mod settings. Nothing blocking is left: what remains is for the author before merging (below). Recommend approval; not approved on the forge.

The change saves Game language by code, repairs stock-language numbers from affected nightlies, and preserves dynamically populated choices. It also makes the settings service depend on a published language list that the offline mod tool does not initialize.

Should fix (1): not blocking, but worth doing before merging.

  • L1 game/crates/api/src/settings/service.rs:492: The language codec uses the process-global published list, but the offline mod settings command never publishes the loading mods' languages. (more on the line) Do: Give the offline settings service the language list from its scanned loader before reading or setting the row, and test reading and selecting a mod-provided language through the command.

Testing before merging (1) (the change behaves the same on every system: one run of the change itself is enough; it doesn't hold the recommendation)

  • L2: The menu's own mouse or gamepad selection and restart flow still needs the manual run listed in the PR. When: The reported run sets the rows through the control bridge, so it does not exercise the menu input and restart question. Do: Select a Game language using the menu, accept its restart question, and verify the restarted game uses that language.

@fix can do L1.

Checks: Still running: 11 checks.

More: does it help, other systems, switches, what was read

Does it help: Yes. The author reports that Italian remained selected for both rows across restarts on Windows, where main reverted to English and Auto; Portuguese, Auto, and repair of a saved 6 also worked. This is not a performance change.

Other systems: The shared settings reader also handles microphone, GPU, ReShade and NFC choices; the new test covers their saved numbers, but device selection has not been tested on hardware. Mod-provided languages in the offline mod tool need a fix. Linux and manual menu input remain untested.

Switches: None.

Reviewed: 5b3d63d040 against b4d56f5264: Read the repository rules, contribution guide, PR template, standards, diff and commits; inspected the changed settings paths and their callers, language registry, manifest declarations, host language selection and mod tool. The large service and settings-now files were inspected around the changes and relevant callers rather than fully read; no generated files or recorded runs were changed. Tooling's separate repository was not available in the checkout.; nothing run (a code review).

Checked and fine:

  • Both commits record AI assistance in trailers.
  • The changed files contain no game-derived output, generated files, API version changes or switch changes.
  • The language migration bounds-checks numeric stock-language values, including the minimum signed integer.
  • The reported test covers the original stock-language failure on main and the repaired profile on this branch.

Testing: Read-only review; no tests or project code were run. CI was still running in the supplied status.

Overlaps and merge order: Not checked; the network is closed.


Automated code review by BeanBot (gpt-6.1-terra), asked for by llun. Nothing was run; a maintainer decides.

**Recommendation: Approve.** The menu fix works for the stock languages in the reported Windows run, but the shared settings path cannot read or select mod-provided languages through `longshot mod settings`. Nothing blocking is left: what remains is for the author before merging (below). Recommend approval; not approved on the forge. The change saves Game language by code, repairs stock-language numbers from affected nightlies, and preserves dynamically populated choices. It also makes the settings service depend on a published language list that the offline mod tool does not initialize. **Should fix (1)**: not blocking, but worth doing before merging. - **L1** `game/crates/api/src/settings/service.rs:492`: The language codec uses the process-global published list, but the offline mod settings command never publishes the loading mods' languages. (more on the line) **Do:** Give the offline settings service the language list from its scanned loader before reading or setting the row, and test reading and selecting a mod-provided language through the command. **Testing before merging (1)** (the change behaves the same on every system: one run of the change itself is enough; it doesn't hold the recommendation) - **L2**: The menu's own mouse or gamepad selection and restart flow still needs the manual run listed in the PR. *When:* The reported run sets the rows through the control bridge, so it does not exercise the menu input and restart question. **Do:** Select a Game language using the menu, accept its restart question, and verify the restarted game uses that language. `@fix` can do L1. **Checks:** Still running: 11 checks. <details> <summary>More: does it help, other systems, switches, what was read</summary> **Does it help:** Yes. The author reports that Italian remained selected for both rows across restarts on Windows, where main reverted to English and Auto; Portuguese, Auto, and repair of a saved 6 also worked. This is not a performance change. **Other systems:** The shared settings reader also handles microphone, GPU, ReShade and NFC choices; the new test covers their saved numbers, but device selection has not been tested on hardware. Mod-provided languages in the offline mod tool need a fix. Linux and manual menu input remain untested. **Switches:** None. **Reviewed:** 5b3d63d040d2 against b4d56f526449: Read the repository rules, contribution guide, PR template, standards, diff and commits; inspected the changed settings paths and their callers, language registry, manifest declarations, host language selection and mod tool. The large service and settings-now files were inspected around the changes and relevant callers rather than fully read; no generated files or recorded runs were changed. Tooling's separate repository was not available in the checkout.; nothing run (a code review). **Checked and fine:** - Both commits record AI assistance in trailers. - The changed files contain no game-derived output, generated files, API version changes or switch changes. - The language migration bounds-checks numeric stock-language values, including the minimum signed integer. - The reported test covers the original stock-language failure on main and the repaired profile on this branch. **Testing:** Read-only review; no tests or project code were run. CI was still running in the supplied status. **Overlaps and merge order:** Not checked; the network is closed. </details> --- <sub>Automated code review by BeanBot (gpt-6.1-terra), asked for by llun. Nothing was run; a maintainer decides.</sub>
@ -485,0 +489,4 @@
Codec::Language => {
let code = match index() {
0 => String::new(),
i => crate::game_languages::row_code(i).ok_or("not one of the game's languages")?,
Member

L1 (should fix): The language codec uses the process-global published list, but the offline mod settings command never publishes the loading mods' languages.

When: With a mod adding a language at row 17, longshot mod settings system/interface --set game_language=17 reaches row_code(17) with an empty added-language list and refuses the setting. Reading an existing code for that language similarly reports Auto through row_value.

Do: Give the offline settings service the language list from its scanned loader before reading or setting the row, and test reading and selecting a mod-provided language through the command.

**L1** (should fix): The language codec uses the process-global published list, but the offline mod settings command never publishes the loading mods' languages. *When:* With a mod adding a language at row 17, `longshot mod settings system/interface --set game_language=17` reaches `row_code(17)` with an empty added-language list and refuses the setting. Reading an existing code for that language similarly reports Auto through `row_value`. **Do:** Give the offline settings service the language list from its scanned loader before reading or setting the row, and test reading and selecting a mod-provided language through the command.
HumanBean deleted branch fix/language-rows-kept 2026-12-03 14:39:02 +00:00
Author
Member

Both of BeanBot's points, after the merge:

  • L1: it was right. longshot mod settings did not know the languages mods add. The fix and its test missed this merge and are in #3092.
  • L2: run on Windows 11, RTX 5080, on 5d327053b (main 238f4f65f with #3092's fix). Italian was picked on the Game language row with the menu's own keys, over the control bridge. The restart question came up and "yes" was pressed (menu: restart now, to apply game_language). The run had no window, so the game did not restart from that; the bridge's relaunch restarted it. The next start logs oe: language it (game_language in the settings). A mouse or a gamepad, and the restart from the question itself, are still not tested.
Both of BeanBot's points, after the merge: - **L1:** it was right. `longshot mod settings` did not know the languages mods add. The fix and its test missed this merge and are in https://git.magicbean.dev/MagicBeanDev/Longshot/pulls/3092. - **L2:** run on Windows 11, RTX 5080, on 5d327053b (main 238f4f65f with #3092's fix). Italian was picked on the Game language row with the menu's own keys, over the control bridge. The restart question came up and "yes" was pressed (`menu: restart now, to apply game_language`). The run had no window, so the game did not restart from that; the bridge's `relaunch` restarted it. The next start logs `oe: language it (game_language in the settings)`. A mouse or a gamepad, and the restart from the question itself, are still not tested.
Sign in to join this conversation.
No reviewers
No milestone
No project
No assignees
2 participants
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set

Reference
MagicBeanDev/Longshot!3084
No description provided.