HLE: list the host's voices to the title and speak in the one it picks #2770
No reviewers
Labels
No labels
accessibility
area: build
area: formats
area: gpu
area: loader
area: runtime
area: shader
bug
documentation
duplicate
enhancement
good first issue
gpu: amd
gpu: intel
gpu: nvidia
help wanted
host: wine
invalid
out of scope
question
request
run report
triage: confirmed
triage: has patch
triage: merge candidate
triage: needs info
triage: needs rebase
triage: needs work
triage: proposed close
wontfix
No milestone
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
github/Marvisak--VIctory!2770
Loading…
Reference in a new issue
No description provided.
Delete branch "github-bot/gh-2770"
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?
@kilolimaVI on GitHub · 2026-11-25 20:08 UTC · original
kilolimaVI:hle/speech-voices→main· +440 −62 · 3 files · 2 commits · draftStacked on #2760; only the top commit belongs here.
GTA VI's narration settings let the player pick a voice, but voice listing (slot 0x40) reported no voices and a custom voice (slot 0x60) was ignored. Now:
XSpeechSynthesizerEnumerateInstalledVoicescalls back once per host voice (WinRTSpeechSynthesizer::AllVoices) with anXSpeechSynthesizerVoiceInformationrecord laid out as documented (description, display name, gender 0 female / 1 male, voice id, language), stopping when the callback returns false. The strings live until the call returns.XSpeechSynthesizerSetCustomVoice), untilSetDefaultVoice. An id the host does not have is refused withE_INVALIDARG. Streams are spoken in the picked voice, or the default if that voice disappears.Tested
cargo test -p victory-hle --lib speech: 5 passed, none skipped (two new: the listing read back as the title reads it, and a picked voice speaks)cargo clippy --workspace --all-targets --locked -- -D warnings: cleanNot tested
E_INVALIDARGis a guess.AI use
Code, tests and description written with Claude (Claude Opus 5.5); I built and ran the tests on the hardware above.
@oni-swr on GitHub · 2026-11-25 20:36 UTC · original
Independent verification of head
3d4d19b0(WARP/CPU): looks good.0x70now has its own close). README andCargo.tomlfeatures match. Scope is fine.victory-hle --lib150 pass, 0 fail (baseline 146). Clippy-D warningsis clean.stream()ignore the host's audio (always silence),a_picked_voice_speaks_and_an_unknown_one_is_refusedfails (the audio is too short). This machine has host voices, so the test is not skipped. Without a voice, the voice tests skip with a message, as designed.Method: WARP/CPU only (no physical GPU;
VICTORY_WARP=1,VICTORY_D3D12_WARP=1, Windows SDKdxil.dllon PATH, so DXIL validation ran),cargo test -p <crate> --lib --lockedandcargo clippy -p <crate> --all-targets --locked -- -D warnings, compared withorigin/main13f91cae. Nothing from the game was used.AI-assisted review (Claude Code / Claude Sonnet 5.5).
@kilolimaVI on GitHub · 2026-11-25 20:40 UTC · original
Thanks @oni-swr, especially for the negative control: good to know the voice test fails when the audio is fake.
On the double close: agreed. Two more things apply here, both from review of my (now closed) speech PR this is stacked on:
0xc0000409, 7/20 parallel runs on another reviewer's machine).Both are fixed in the same change on DexNom/VIctory: one speech thread owning the synthesizer, handles as keys into a table (double or foreign closes refused), and output converted to 16 kHz mono; 20 consecutive parallel runs pass there. Here I'm converting this to a draft until #82 (the earlier speech PR) is rebased or merged, then I'll rebuild voice listing on top of it with those fixes.
@kotekompotek on GitHub · 2026-11-25 20:41 UTC · original
Builds on #2760's synthesize path with real voice enumeration - SpeechSynthesizer::AllVoices mapped into the title's VoiceInformation records so the title's picked voice is actually honored rather than always default. The record layout for the voice list was the unknown flagged in #2760; this apparently resolves it. Untested-live caveat in the README stays honest.
@kilolimaVI on GitHub · 2026-11-25 20:42 UTC · original
Thanks @kotekompotek. The record layout isn't guessed: it's the documented
XSpeechSynthesizerVoiceInformationfrom the public GDK reference (Description, DisplayName, Gender as uint32 Female=0/Male=1, VoiceId, Language), and the callback matchesXSpeechSynthesizerInstalledVoicesCallback. As noted above, this is a draft until #82 lands, since #2760 is closed in its favor.@fuzeofficlal on GitHub · 2026-11-25 20:52 UTC · original
Tested
3d4d19b0on Windows 11 (rustc 1.98.1MSVC) againstmain(13f91ca).0xC0000409crash reproduces here: runningcargo test -p victory-hle --lib --locked -- modules::speech::20 consecutive times in parallel crashed in 8/20 runs (40%) with exit code-1073740791(0xC0000409) (runs 4, 8, 10, 13, 14, 15, 16, 17), because bothvoices()(speech.rs:75-94) andsynthesize()(speech.rs:107-149) still construct/drop WinRTSpeechSynthesizerconcurrently on arbitrary caller threads.#2760was closed):SpeechSynthesizercalls onto a dedicated serialized worker thread with explicit apartment init should eliminate the0xC0000409crashes.create/close(speech.rs:217-234) andstream/close_stream(speech.rs:156-175, 273-279) still cast raw pointers directly toBox::from_raw, leaving double-close or bogus handles as UB; a handle table would guard both.synthesize()passes the host WAV bytes through without normalizing to 16 kHz mono 16-bit PCM (unlike#82), andvoices()currently swallows WinRT enumeration errors silently.cargo clippy -p victory-hle --all-targets -- -D warnings(default &--all-features) 0 warnings;cargo xtask policy184 files ok;enumerate_voicesCStringlifetime andreplace('␀', "")handling look clean.View command line instructions
Checkout
From your project repository, check out a new branch and test the changes.Merge
Merge the changes and update on Forgejo.