fix(voice): a Voice Language saved in option.sav is applied after a restart #970

Merged
HumanBean merged 2 commits from HumanBean/Longshot:fix/voice-language-option-sav into main 2026-11-15 23:31:41 +00:00
Owner

Type: fix · Risk: low · Tested on: Linux, RTX 3090 · Needs: Windows, any GPU

Why

A player picks Japanese as the game's Voice Language, and after a restart the voices are English again, while the game's
own Options screen still shows Japanese. Three players reported it in #430 (the sage's cutscene after Bongo Bongo,
Darunia after the Fire Temple, Navi at Lord Jabu-Jabu). It looks random because a change made on the Options screen
does work for the rest of that session; it is lost at the next start.

Fixes #430. See #125 (the other direction, Japanese voices under Portuguese text): the same option and the same code,
but this PR does not claim to explain that report.

How to reproduce

Seen on: Linux, RTX 3090, v3.0.0-rc.4 (source 1d7adfa3)
Settings and switches: defaults, language.txt en-US
Steps: set the game's Voice Language to Japanese (the title's Options), quit, start again, Continue, and play a
voiced scene (the Great Deku Tree's first words, from the kokiri-start repo save).
Expected: Japanese voices.
Actual: English voices. With HOS_FS_TRACE=1 the scene opens USen_EventFlowMsg-_Dm_Kokiri_0150--*.bwav while
OptionData.VoiceLanguage reads Japanese (#69b014ce) the whole session.

What changed

The game applies the voice language in two places only: at its voice resource's first update (the text language's
default), and afterwards when GameDataMgr lists OptionData.VoiceLanguage among the flags written since its last pass.
option.sav is read a moment after that first update, and its value replaces the option without being listed. This PR
routes that one "was it written?" question through the host, which also answers yes when the option's value is not the
one it had at the update before, so the game's own branch reads the option and applies it.

  • host: hos_oot_voice_option() in the new host/oot_voice.c calls the game's f_80a9d1c0, keeps its answer, and
    adds a yes when the option's value changed without a write. It logs voice: the Voice Language option changed without a write ...: applied (at most 8 times).
  • lift: patch_voice_option() in nx2/oot_patches.py edits the update's (f_80a9ca30) one call of f_80a9d1c0, by
    its return address, on the supported build only; report() warns when the place is not found once.
  • docs: HOS_VOICE_OPTION_FOLLOW=0 in docs/development.md.
  • test: tests/test_oot_voice_option.py.

How the cause was found, on v3.0.0-rc.4: with the control bridge's memory reads, the option was English at frame 4
with USen in the voice manager, the saved value from frame 70 on, and USen still applied; the disassembly of
f_80a9ca30, f_80a9d1c0 and f_809d48c0 shows the two places above.

Measurements

Verdict: it passes: with Japanese saved in option.sav, the scene's voices are English with the hook off and
Japanese with it on, on the same build, save and settings. One run each. The bug depends on timing: with the base's
default settings the game applied the saved value by itself (Japanese with the hook on or off); with the installed
v3.0.0-rc.4 folder's longshot_options.ini (frame rate cap, frame pacing, fullscreen, DLSS preset among its
differences) it never did.

Hardware: Linux, RTX 3090
Scene: Kokiri Forest, the Great Deku Tree's first scene, headless through the control bridge
Method: HOS_FS_TRACE=1, the voice files the scene opens; OptionData.VoiceLanguage read through watch --events oot --flags
How to reproduce: longshot_ctl.py launch <game> --save <kokiri-start's slot with an option.sav holding Japanese> --headless --env HOS_FS_TRACE=1, Continue, teleport to Hyrule Field and back to Kokiri Forest, walk forward

Before: v3.0.0-rc.4 @ 1d7adfa3 After, HOS_VOICE_OPTION_FOLLOW=0: this PR @ 9d3af749 After: this PR @ 9d3af749
Voice files opened, option.sav = Japanese, the rc.4 folder's settings USen_* (wrong; 3 starts of 3) USen_* (wrong) JPja_*
Voice files opened, option.sav = Japanese, default settings not run JPja_* JPja_*
Voice files opened, no option.sav (English, the default) USen_* not run not run

The After columns are a dev_packs.py pack of this branch's tree on the base main @ a00c485c (the build says
v3.0.0-rc.4-108-ga8a30c22-dirty: the tree before its two commits were made, the same files).

in play: "flags": {"OptionData.VoiceLanguage": "#69b014ce"}
[hos gmd::SaveDataMgr] fs: OpenFile(save:/option.sav)
[hos AudioUserTaskThread] fs: OpenFile(content://Voice/Resource//Stream/USen_EventFlowMsg-_Dm_Kokiri_0150--Dm_Kokiri_0150_Text_000_b.bwav)
[hos AudioUserTaskThread] fs: OpenFile(content://Voice/Resource//Stream/USen_EventFlowMsg-_Dm_Kokiri_0150--Dm_Kokiri_0150_Text_001_b.bwav)

After, the rc.4 folder's settings:

[hos ModuleSystemWorker1] voice: the Voice Language option changed without a write (0x69b014ce, was 0x82591fa9: option.sav was read): applied
[hos AudioUserTaskThread] fs: OpenFile(content://Voice/Resource//Stream/JPja_EventFlowMsg-_Dm_Kokiri_0150--Dm_Kokiri_0150_Text_000_b.bwav)
[hos AudioUserTaskThread] fs: OpenFile(content://Voice/Resource//Stream/JPja_EventFlowMsg-_Dm_Kokiri_0150--Dm_Kokiri_0150_Text_001_b.bwav)

Baseline: the first column is the installed v3.0.0-rc.4, not main; the switch's column is main's behaviour on the
same build as the fix.

Flags and settings

One new switch, for A/B.

Flag What it is Before this PR After this PR Effect Helps / doesn't help / untested Recommendation
HOS_VOICE_OPTION_FOLLOW=0 The game's own answer alone (the only behaviour) unset: the option is followed 0: a Voice Language read from option.sav can stay unapplied helps where the bug shows (the table above); no difference where the game applies it itself unset for everyone; 0 only for testing

Testing

Tested:

  • In the game, Linux, RTX 3090: the bug on v3.0.0-rc.4, and the fix with the hook off and on (above).
  • patch_voice_option() on a real lift's code_009.c: one edit, one declaration, a second run changes nothing; and the
    pack build's lift printed oot_patches: the Voice Language option followed after option.sav is read in code_009.c.

Not tested:

  • tests/test_oot_voice_option.py and tests/run_all.py: not run on this PC; left to CI.
  • A change on the game's Options screen with the hook (the game lists it as written, so the hook only keeps its answer).
  • Windows.
  • option.sav read before the voice resource's first update (not seen here): the game then writes the default over the
    saved value itself, which this PR does not change.

Must be tested:

  • Windows, any GPU: save Japanese as the Voice Language on the title's Options, restart, Continue and play a voiced
    scene, expecting Japanese voices (by hand: one of #430's reporters, or anyone who sees the bug on main).

Risks

What could break: the voices' language, if the option's value changed for a reason the game does not want applied;
none is known. The hook runs once per update of the voice resource and reads four values.

Turning it off: HOS_VOICE_OPTION_FOLLOW=0, or revert the commit.

Compatibility: the game's code is edited, so the lift's translation is redone on update. Saves and settings are not
changed; a player whose option.sav holds a Voice Language other than their text language's default now hears it.

Issues

Fixes #430
See #125

Checklist

Everyone

  • One topic.
  • The title is a Conventional Commit (type(scope): description) of the status line's type.
  • Why gives the reason plainly and links the issues that fit (the tracker searched).
  • Measurements has a verdict, or one line saying why there is nothing to measure.
  • Testing names what was tested, what wasn't, and what must still be tested, where and how.
  • Rebased on current main.
  • python -I -B tests/run_all.py passes (any failure that also fails on main is named). Not run on this PC: left to CI.
  • No game files, dumps, build output or generated files.
  • third_party/ untouched (a new folder with a PROVENANCE.md instead).
  • The license is OK: GPL-3.0-or-later, nothing incompatible and nothing decompiled.

When it applies

  • AI assistance recorded with Assisted-by: / Co-Authored-By: trailers.
  • Switches documented (docs/development.md; the README for a menu row) and shipped at their recommended value.
  • A game-free test added for the fix, failing on main and passing here. Added; not run either way on this PC.
  • Host code builds on both Windows (llvm-mingw) and Linux, with UTF-8 paths. Built on Linux (the pack); Windows not built.
  • Docs updated.

🤖 Generated with Claude Code

**Type:** fix · **Risk:** low · **Tested on:** Linux, RTX 3090 · **Needs:** Windows, any GPU ## Why A player picks Japanese as the game's Voice Language, and after a restart the voices are English again, while the game's own Options screen still shows Japanese. Three players reported it in #430 (the sage's cutscene after Bongo Bongo, Darunia after the Fire Temple, Navi at Lord Jabu-Jabu). It looks random because a change made on the Options screen does work for the rest of that session; it is lost at the next start. Fixes #430. See #125 (the other direction, Japanese voices under Portuguese text): the same option and the same code, but this PR does not claim to explain that report. ## How to reproduce **Seen on:** Linux, RTX 3090, `v3.0.0-rc.4` (source 1d7adfa3) **Settings and switches:** defaults, `language.txt` `en-US` **Steps:** set the game's Voice Language to Japanese (the title's Options), quit, start again, Continue, and play a voiced scene (the Great Deku Tree's first words, from the `kokiri-start` repo save). **Expected:** Japanese voices. **Actual:** English voices. With `HOS_FS_TRACE=1` the scene opens `USen_EventFlowMsg-_Dm_Kokiri_0150--*.bwav` while `OptionData.VoiceLanguage` reads `Japanese` (`#69b014ce`) the whole session. ## What changed The game applies the voice language in two places only: at its voice resource's first update (the text language's default), and afterwards when GameDataMgr lists `OptionData.VoiceLanguage` among the flags written since its last pass. `option.sav` is read a moment after that first update, and its value replaces the option without being listed. This PR routes that one "was it written?" question through the host, which also answers yes when the option's value is not the one it had at the update before, so the game's own branch reads the option and applies it. - host: `hos_oot_voice_option()` in the new `host/oot_voice.c` calls the game's `f_80a9d1c0`, keeps its answer, and adds a yes when the option's value changed without a write. It logs `voice: the Voice Language option changed without a write ...: applied` (at most 8 times). - lift: `patch_voice_option()` in `nx2/oot_patches.py` edits the update's (`f_80a9ca30`) one call of `f_80a9d1c0`, by its return address, on the supported build only; `report()` warns when the place is not found once. - docs: `HOS_VOICE_OPTION_FOLLOW=0` in `docs/development.md`. - test: `tests/test_oot_voice_option.py`. How the cause was found, on `v3.0.0-rc.4`: with the control bridge's memory reads, the option was `English` at frame 4 with `USen` in the voice manager, the saved value from frame 70 on, and `USen` still applied; the disassembly of `f_80a9ca30`, `f_80a9d1c0` and `f_809d48c0` shows the two places above. ## Measurements **Verdict:** it passes: with Japanese saved in `option.sav`, the scene's voices are English with the hook off and Japanese with it on, on the same build, save and settings. One run each. The bug depends on timing: with the base's default settings the game applied the saved value by itself (Japanese with the hook on or off); with the installed `v3.0.0-rc.4` folder's `longshot_options.ini` (frame rate cap, frame pacing, fullscreen, DLSS preset among its differences) it never did. Hardware: Linux, RTX 3090 Scene: Kokiri Forest, the Great Deku Tree's first scene, headless through the control bridge Method: `HOS_FS_TRACE=1`, the voice files the scene opens; `OptionData.VoiceLanguage` read through `watch --events oot --flags` How to reproduce: `longshot_ctl.py launch <game> --save <kokiri-start's slot with an option.sav holding Japanese> --headless --env HOS_FS_TRACE=1`, Continue, teleport to Hyrule Field and back to Kokiri Forest, walk forward | | Before: v3.0.0-rc.4 @ 1d7adfa3 | After, `HOS_VOICE_OPTION_FOLLOW=0`: this PR @ 9d3af749 | After: this PR @ 9d3af749 | |---|---|---|---| | Voice files opened, option.sav = Japanese, the rc.4 folder's settings | `USen_*` (wrong; 3 starts of 3) | `USen_*` (wrong) | `JPja_*` | | Voice files opened, option.sav = Japanese, default settings | not run | `JPja_*` | `JPja_*` | | Voice files opened, no option.sav (English, the default) | `USen_*` | not run | not run | The After columns are a `dev_packs.py` pack of this branch's tree on the base `main` @ a00c485c (the build says `v3.0.0-rc.4-108-ga8a30c22-dirty`: the tree before its two commits were made, the same files). ``` in play: "flags": {"OptionData.VoiceLanguage": "#69b014ce"} [hos gmd::SaveDataMgr] fs: OpenFile(save:/option.sav) [hos AudioUserTaskThread] fs: OpenFile(content://Voice/Resource//Stream/USen_EventFlowMsg-_Dm_Kokiri_0150--Dm_Kokiri_0150_Text_000_b.bwav) [hos AudioUserTaskThread] fs: OpenFile(content://Voice/Resource//Stream/USen_EventFlowMsg-_Dm_Kokiri_0150--Dm_Kokiri_0150_Text_001_b.bwav) ``` After, the rc.4 folder's settings: ``` [hos ModuleSystemWorker1] voice: the Voice Language option changed without a write (0x69b014ce, was 0x82591fa9: option.sav was read): applied [hos AudioUserTaskThread] fs: OpenFile(content://Voice/Resource//Stream/JPja_EventFlowMsg-_Dm_Kokiri_0150--Dm_Kokiri_0150_Text_000_b.bwav) [hos AudioUserTaskThread] fs: OpenFile(content://Voice/Resource//Stream/JPja_EventFlowMsg-_Dm_Kokiri_0150--Dm_Kokiri_0150_Text_001_b.bwav) ``` Baseline: the first column is the installed `v3.0.0-rc.4`, not `main`; the switch's column is `main`'s behaviour on the same build as the fix. ### Flags and settings One new switch, for A/B. | Flag | What it is | Before this PR | After this PR | Effect | Helps / doesn't help / untested | Recommendation | |---|---|---|---|---|---|---| | `HOS_VOICE_OPTION_FOLLOW=0` | The game's own answer alone | (the only behaviour) | unset: the option is followed | 0: a Voice Language read from `option.sav` can stay unapplied | helps where the bug shows (the table above); no difference where the game applies it itself | unset for everyone; 0 only for testing | ## Testing **Tested:** - In the game, Linux, RTX 3090: the bug on `v3.0.0-rc.4`, and the fix with the hook off and on (above). - `patch_voice_option()` on a real lift's `code_009.c`: one edit, one declaration, a second run changes nothing; and the pack build's lift printed `oot_patches: the Voice Language option followed after option.sav is read in code_009.c`. **Not tested:** - `tests/test_oot_voice_option.py` and `tests/run_all.py`: not run on this PC; left to CI. - A change on the game's Options screen with the hook (the game lists it as written, so the hook only keeps its answer). - Windows. - `option.sav` read before the voice resource's first update (not seen here): the game then writes the default over the saved value itself, which this PR does not change. **Must be tested:** - Windows, any GPU: save Japanese as the Voice Language on the title's Options, restart, Continue and play a voiced scene, expecting Japanese voices (by hand: one of #430's reporters, or anyone who sees the bug on `main`). ## Risks **What could break:** the voices' language, if the option's value changed for a reason the game does not want applied; none is known. The hook runs once per update of the voice resource and reads four values. **Turning it off:** `HOS_VOICE_OPTION_FOLLOW=0`, or revert the commit. **Compatibility:** the game's code is edited, so the lift's translation is redone on update. Saves and settings are not changed; a player whose `option.sav` holds a Voice Language other than their text language's default now hears it. ## Issues Fixes #430 See #125 ## Checklist ### Everyone - [x] One topic. - [x] The title is a Conventional Commit (`type(scope): description`) of the status line's type. - [x] Why gives the reason plainly and links the issues that fit (the tracker searched). - [x] Measurements has a verdict, or one line saying why there is nothing to measure. - [x] Testing names what was tested, what wasn't, and what must still be tested, where and how. - [x] Rebased on current `main`. - [ ] `python -I -B tests/run_all.py` passes (any failure that also fails on `main` is named). Not run on this PC: left to CI. - [x] No game files, dumps, build output or generated files. - [x] `third_party/` untouched (a new folder with a `PROVENANCE.md` instead). - [x] The license is OK: GPL-3.0-or-later, nothing incompatible and nothing decompiled. ### When it applies - [x] AI assistance recorded with `Assisted-by:` / `Co-Authored-By:` trailers. - [x] Switches documented (docs/development.md; the README for a menu row) and shipped at their recommended value. - [ ] A game-free test added for the fix, failing on `main` and passing here. Added; not run either way on this PC. - [ ] Host code builds on both Windows (llvm-mingw) and Linux, with UTF-8 paths. Built on Linux (the pack); Windows not built. - [x] Docs updated. 🤖 Generated with [Claude Code](https://claude.com/claude-code)
A game-free check of the voice resource's update: the option's value replaced without being listed as written
(option.sav read after the start) has to be applied. Fails until the fix: the voices stay the text language's default.

Assisted-by: Claude Code
Co-Authored-By: Claude Fable 5.2 <[email protected]>
fix(voice): a Voice Language saved in option.sav is applied after a restart
Some checks failed
CI / Python source checks (ubuntu-24.04, part 1/2) (pull_request) Has been skipped
CI / Python source checks (ubuntu-24.04, part 2/2) (pull_request) Has been skipped
CI / SPIR-V fixtures (global narrow load/store, direct surface atomics, F2I immediate) (pull_request) Has been skipped
Third-party parts / The same as upstream (pull_request) Has been skipped
Website / Website on Cloudflare (pull_request_target) Has been skipped
CI / Conventional Commit title (pull_request) Successful in 3s
CI / Workflow lint (actionlint) (pull_request) Successful in 5s
Guide screenshots / Guide images and local UI source review (pull_request) Failing after 4s
Third-party parts / As their notes say (pull_request) Successful in 8s
PR description / Description follows the template (pull_request_target) Failing after 5s
9d3af749e5
The game applies the voice language at its first update (the text language's default) and after that only when
GameDataMgr lists OptionData.VoiceLanguage as written. option.sav's value replaces the option without being listed, so
a saved choice showed on the Options screen and the voices stayed the default (Japanese chosen, English voices).
The update's check goes through host/oot_voice.c, which also answers yes when the option's value is not the one of the
update before. HOS_VOICE_OPTION_FOLLOW=0: as shipped.

Fixes #430

Assisted-by: Claude Code
Co-Authored-By: Claude Fable 5.2 <[email protected]>
Author
Owner

Tested in game: RTX 3090, Linux (headless, control bridge): Japanese saved in option.sav, Continue, the Great Deku Tree's first scene in Kokiri Forest. With the installed rc.4 folder's settings it opens USen_* voice files with HOS_VOICE_OPTION_FOLLOW=0 (the bug, as on v3.0.0-rc.4) and JPja_* with the fix, which logs 'voice: the Voice Language option changed without a write (0x69b014ce, was 0x82591fa9: option.sav was read): applied'. One run each.

Tested in game: RTX 3090, Linux (headless, control bridge): Japanese saved in option.sav, Continue, the Great Deku Tree's first scene in Kokiri Forest. With the installed rc.4 folder's settings it opens USen_* voice files with HOS_VOICE_OPTION_FOLLOW=0 (the bug, as on v3.0.0-rc.4) and JPja_* with the fix, which logs 'voice: the Voice Language option changed without a write (0x69b014ce, was 0x82591fa9: option.sav was read): applied'. One run each.
Author
Owner

Measurements: the After columns name the pushed commit (9d3af749, which only adds a code comment over the tree that ran). The numbers box is removed: the result is which voice files open, not a number.

Measurements: the After columns name the pushed commit (9d3af749, which only adds a code comment over the tree that ran). The numbers box is removed: the result is which voice files open, not a number.
HumanBean changed title from WIP: fix(voice): a Voice Language saved in option.sav is applied after a restart to fix(voice): a Voice Language saved in option.sav is applied after a restart 2026-11-15 23:31:37 +00:00
HumanBean deleted branch fix/voice-language-option-sav 2026-11-15 23:31:42 +00:00
Sign in to join this conversation.
No reviewers
No milestone
No project
No assignees
1 participant
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!970
No description provided.