Audio: a silent playback endpoint when the host has no render device #929
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/929"
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?
Imported from Marvisak/VIctory. Originally posted by vladbondarenko97 on 2026-11-24T14:17:38Z.
With no active Windows playback device, the title's audio output setup never allocates its buffers and returns while still holding a lock. The audio thread then never drains the per-thread 96 KiB command streams, and about 20–30 s in the title's audio-thread assert fires (its own
int3). This is the trap in #834, and the Wine/no-sound-driver case #222 warns about. The chain is diagnosed with RVAs in ivall/xcl#695. A console always has an output, so the title has no path for this.What is in it
modules/audio/silent.rsoverrides the title'sCoCreateInstance(ole32.dll,api-ms-win-core-com-l1-*; the retail exe imports it fromapi-ms-win-core-com-l1-1-0.dlland has noCoCreateInstanceEx/CoGetClassObjectimport). The host call always runs first. Only a successfulMMDeviceEnumerator/IMMDeviceEnumeratorcreation without aggregation is looked at.GetDeviceids and notifications go to the host.ISpatialAudioClientaccepts 48 kHz float. ItsISpatialAudioObjectRenderStreamsignals the title's event every 10 ms while started, hands out 480-frame buffers and discards them. Start/Stop/Reset can be repeated, and dynamic objects are counted and capped. One info line is logged when it is used.windows/windows-corebecome plaincfg(windows)dependencies (they were diagnostics-only).Tested
Unknown). RTX 3080 Ti (driver 32.0.16.1060), i7-12700KF, 32 GB, Windows 11 Pro 26300,--profile diag --features diagnostics, this branch merged ontomainffe310e, scripted keys (VICTORY_KEYS) through the first-run menus.no active playback device: the title gets a silent audio endpointat start; 30.0 fps throughout; no audio-thread assert. Captures show the intro key art (frame 1024) and the Rockstar legal terms screen with the Privacy Policy box ticked at frame 5400 (~3 min). Without this change,mainand xclmainboth hit that assert on this PC (~20–30 s).cargo clippy --workspace --all-targets --locked -- -D warningsand with--all-features: clean.cargo test -p victory-hle --locked: 99 passed, 1 failed. The failure ismodules::display::tests::sdr_and_display_deferrals(0x80070032), which fails the same way on cleanmainon this machine. The 6 new tests pass: routing native vs silent, the 48 kHz float format accepted / 44.1 kHz rejected, 20 buffer cycles → Stop (no signal) → Start → 20 more, dynamic object counting, and a realCoCreateInstancecall (skips itself without an audio service).cargo test -p xtask --locked: 4 passed.Not tested
AI use: Claude Code (Claude Sonnet 5.5) implemented the change and tests; Claude Opus 5.5 reviewed it, ran the retail test on my machine and wrote this description. I reviewed it.
Fixes #834. Also covers the case #222 warns about.
🤖 Generated with Claude Code
Imported from Marvisak/VIctory. Originally posted by DenRakEiw on 2026-11-24T14:21:20Z.
Review: APPROVED
Tested merged cleanly onto
main(ffe310e) on Windows 11 x64 (Rust 1.98.1 MSVC):cargo test -p victory-hle: 100 passed, 0 failed (plusno_dll_planting: 1 passed), includingmodules::audio::silent::tests::the_stream_signals_every_period_and_restartscargo clippy -p victory-hle --all-targets: 0 warningscargo xtask policy: ok (156 files ok)Clean silent-endpoint fallback for hosts without an audio render device. Approving.
AI-assisted (Gemini 4 Neon).
Imported from Marvisak/VIctory. Originally posted by mercuryVM on 2026-11-24T14:23:50Z.
Review: APPROVED
Tested
d80294fon Windows 11, RTX 5070, MSVC:cargo test -p victory-hle101 passed, including the silent-endpoint tests.cargo clippy -p victory-hle --all-targetsis clean, andcargo check -p victory --features diagnosticsis clean. This host has an active render device, so the silent path is covered by the unit tests only, and the title wasn't run.CLSID_MMDeviceEnumeratoris wrapped, and only when the host enumerator reports no active render endpoint. Everything else, and an enumerator that has a device, goes to the host'sCoCreateInstanceunchanged. No other HLE module overridesCoCreateInstance, so there's no ordering clash.windows/windows-corenon-optional forvictory-hlecosts some build time in non-diagnostics builds, but it's needed for#[implement].title+0x…). It doesn't help a reader of the code, and the repo avoids title-specific data, so I'd describe it as "the title's audio-thread assert" without the offset.AI-assisted (Claude Code).
Imported from Marvisak/VIctory. Originally posted by MichaelSmithAI on 2026-11-24T14:26:13Z.
Independent Wine 11.22 result for the no-driver case on
d80294f. With audio disabled in an isolated prefix, Wine’s own CoCreateInstance and endpoint enumeration succeeded, returned zero active playback devices, and returned 0x80070490 for the default endpoint. Through the VIctory hook, the same configuration exposed one active silent device. A spatial stream delivered three 480-frame float buffers.Restoring the audio driver in the same prefix restored four active playback devices and a working default. The hook then returned the native endpoint. All six authored tests passed as well. This verifies fallback selection, buffer delivery and return to native routing on Wine. We did not launch the title in this comparison. The title reaching the legal screen is the author’s Windows 11 result.
Imported from Marvisak/VIctory. Originally posted by dcastell1 on 2026-11-24T14:28:35Z.
Verified on native Windows (no Wine): NVIDIA GeForce RTX 5090 (driver 621.24), Windows 11 10.0.26300, Rust 1.98.1, MSVC 14.44.35207, debug build.
main@ffe310ebaseline on this box: 342 passed, 0 failed, 6 ignored.Six more than the baseline: the silent playback endpoint path ships its tests and every one runs green here.
Tree restored afterwards (full diff against a clean checkout); no game data, the tests are synthetic. AI-assisted (opencode): applied the patch to a built tree, ran
cargo test --workspace, reverted it.Imported from Marvisak/VIctory. Originally posted by vladbondarenko97 on 2026-11-24T14:56:42Z.
Thanks for the reviews and the Wine and RTX 5090 runs. @mercuryVM: done in
2b8756d. The module doc and this description now say "the title's audio-thread assert" with no offset (a doc-only commit on top, no code change).Imported from Marvisak/VIctory. Originally posted by Zipettte on 2026-11-24T15:40:54Z.
Tested on AMD Radeon RX 7700 XT (RDNA3, gfx1101), driver 32.0.32029.2010, Windows 11, Rust 1.98.1 MSVC at
2b8756d:cargo test -p victory-hlepasses, 101 passed / 0 failed. Workspace baseline on main (ffe310e) is green on the same machine (342 passed).Tested with AI assistance (Claude).
Imported from Marvisak/VIctory. Originally posted by Marvisak on 2026-11-25T01:29:06Z.
Automated triage for the maintainers.
Needs work: needs the maintainer's decision. This adds
modules/audio/silent.rs(crates/victory-hle). It overrides the title'sCoCreateInstance, and only when a successfulMMDeviceEnumeratorcreation finds no active render endpoint, it wraps the enumerator to offer one silent device. That device'sISpatialAudioClient/render stream accepts 48 kHz float, signals the title's event every 10 ms from a timer thread and discards buffers. Hosts with an active endpoint get the native enumerator back unchanged. The routing reads sensibly, and the PR gives evidence: a run of the title past the audio-thread assert on a PC with no playback device, plus an independent Wine check.Points for the maintainer:
crates/victory-hle/Cargo.tomlmakeswindows-corea non-optional dependency (it was diagnostics-only) and adds awindowsfeature, so release builds now link it.CI: not run.
Generated by Claude Code
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.Warning: The "Autodetect manual merge" setting is not enabled for this repository, you will have to mark this pull request as manually merged afterwards.