apu: warn when the host has no audio output device #222

Open
a55uka wants to merge 1 commit from upstream-pr/222 into main
a55uka commented 2026-11-24 01:35:23 +00:00 (Migrated from github.com)

Imported from Marvisak/VIctory. Originally posted by a55uka on 2026-11-24T01:35:23Z.


On Linux, if Wine has no sound driver, the game stops about 15 seconds in. It always stops at its own int3 assert at title+0x4dcbc9d, in the loading-screen loop (title+0x5ab12e0), and nothing in the crash report mentions audio.

Cause: with no output device, the game's audio never empties its command buffer. Each pass of the loading loop adds about 1.7 KB to a 96 KB buffer until the next write doesn't fit, and the game asserts. Fedora ships Wine's sound drivers as separate packages (wine-pulseaudio, wine-alsa), and installing wine alone doesn't pull them in, so this is easy to hit.

Tested:

  • Fedora with Wine 11.21 Staging and PipeWire, on an i7-12700K with an RTX 4070.
  • Audio driver off in the prefix: the warning is logged, then the assert at +0x4dcbc9d.
  • With winepulse: no warning, no assert, and the game runs past the loading screen.
  • Not tested on Windows, where it has nothing to warn about when a sound device is present.
<!-- greyfinch-sync:Marvisak/VIctory:issue:6572596691 --> Imported from [Marvisak/VIctory](https://github.com/Marvisak/VIctory/pull/222). Originally posted by [a55uka](https://github.com/a55uka) on 2026-11-24T01:35:23Z. --- On Linux, if Wine has no sound driver, the game stops about 15 seconds in. It always stops at its own int3 assert at title+0x4dcbc9d, in the loading-screen loop (title+0x5ab12e0), and nothing in the crash report mentions audio. Cause: with no output device, the game's audio never empties its command buffer. Each pass of the loading loop adds about 1.7 KB to a 96 KB buffer until the next write doesn't fit, and the game asserts. Fedora ships Wine's sound drivers as separate packages (wine-pulseaudio, wine-alsa), and installing wine alone doesn't pull them in, so this is easy to hit. Tested: - Fedora with Wine 11.21 Staging and PipeWire, on an i7-12700K with an RTX 4070. - Audio driver off in the prefix: the warning is logged, then the assert at +0x4dcbc9d. - With winepulse: no warning, no assert, and the game runs past the loading screen. - Not tested on Windows, where it has nothing to warn about when a sound device is present.
jeremygold02 commented 2026-11-24 06:56:00 +00:00 (Migrated from github.com)

Imported from Marvisak/VIctory. Originally posted by jeremygold02 on 2026-11-24T05:19:03Z.


Thanks @a55uka for adding a once-only warning when the host reports no audio output devices.

I tested commit 9a77707b01c040e7c4480fb96b2c6e17b79b04d8 with:

cargo test --locked -p victory-hle --lib decodes_opus_as_the_title_drives_it -- --test-threads=1

The targeted test passed (1 passed, 0 failed; 85 filtered). decodes_opus_as_the_title_drives_it connects through XApuConnect, which calls the new once-only output-device check, then continues through the title-shaped Opus command flow.

This confirms the connection path still succeeds with the check in place. The test does not force the no-device branch or assert the warning event/text, and it does not exercise the documented host audio-driver setup.

<!-- greyfinch-sync:Marvisak/VIctory:comment:7122833473 --> Imported from [Marvisak/VIctory](https://github.com/Marvisak/VIctory/pull/222#issuecomment-7122833473). Originally posted by [jeremygold02](https://github.com/jeremygold02) on 2026-11-24T05:19:03Z. --- Thanks @a55uka for adding a once-only warning when the host reports no audio output devices. I tested commit `9a77707b01c040e7c4480fb96b2c6e17b79b04d8` with: ``` cargo test --locked -p victory-hle --lib decodes_opus_as_the_title_drives_it -- --test-threads=1 ``` The targeted test passed (1 passed, 0 failed; 85 filtered). [`decodes_opus_as_the_title_drives_it`](https://github.com/Marvisak/VIctory/blob/9a77707b01c040e7c4480fb96b2c6e17b79b04d8/crates/victory-hle/src/modules/apu.rs#L435) connects through `XApuConnect`, which calls the new [once-only output-device check](https://github.com/Marvisak/VIctory/blob/9a77707b01c040e7c4480fb96b2c6e17b79b04d8/crates/victory-hle/src/modules/apu.rs#L39), then continues through the title-shaped Opus command flow. This confirms the connection path still succeeds with the check in place. The test does not force the no-device branch or assert the warning event/text, and it does not exercise the documented host audio-driver setup.
mercuryVM commented 2026-11-24 08:03:15 +00:00 (Migrated from github.com)

Imported from Marvisak/VIctory. Originally posted by mercuryVM on 2026-11-24T08:03:15Z.

Review: APPROVED


Tested 9a77707 on Windows 11, RTX 5070, MSVC: cargo test --workspace --no-fail-fast passes (264 passed, 0 failed). I did not run it under Wine.

  • The safety screen was fine. The Cargo.toml change only adds the Win32_Media_Audio feature to the existing windows-sys dependency, with no new crate. waveOutGetNumDevs takes no arguments and only counts devices.
  • Once keeps it to a single check, on the first XApuConnect. That is cheap, and it runs before the title starts filling command buffers.
  • A caveat for the warning's accuracy: waveOutGetNumDevs counts legacy waveOut endpoints. On Windows that matches "an audio output exists" closely enough. Under Wine it depends on which driver backs winmm, which is the case the PR targets and the one you tested.
  • The README note is honest: it says Linux is not a supported host, and gives the package names.

No issues found.

AI-assisted (Claude Code).

<!-- greyfinch-sync:Marvisak/VIctory:review:6035624806 --> Imported from [Marvisak/VIctory](https://github.com/Marvisak/VIctory/pull/222#pullrequestreview-6035624806). Originally posted by [mercuryVM](https://github.com/mercuryVM) on 2026-11-24T08:03:15Z. **Review:** APPROVED --- Tested 9a77707 on Windows 11, RTX 5070, MSVC: `cargo test --workspace --no-fail-fast` passes (264 passed, 0 failed). I did not run it under Wine. - The safety screen was fine. The `Cargo.toml` change only adds the `Win32_Media_Audio` feature to the existing `windows-sys` dependency, with no new crate. `waveOutGetNumDevs` takes no arguments and only counts devices. - `Once` keeps it to a single check, on the first `XApuConnect`. That is cheap, and it runs before the title starts filling command buffers. - A caveat for the warning's accuracy: `waveOutGetNumDevs` counts legacy waveOut endpoints. On Windows that matches "an audio output exists" closely enough. Under Wine it depends on which driver backs winmm, which is the case the PR targets and the one you tested. - The README note is honest: it says Linux is not a supported host, and gives the package names. No issues found. AI-assisted (Claude Code).
Marvisak commented 2026-11-25 01:07:41 +00:00 (Migrated from github.com)

Imported from Marvisak/VIctory. Originally posted by Marvisak on 2026-11-25T00:21:13Z.


Automated triage for the maintainers.

Needs rebase. This PR does not merge cleanly into current main (ac2525d). Conflicting files: README.md.

The content has not been reviewed yet; it will be once the branch is rebased onto main.


Generated by Claude Code

<!-- greyfinch-sync:Marvisak/VIctory:comment:7148419908 --> Imported from [Marvisak/VIctory](https://github.com/Marvisak/VIctory/pull/222#issuecomment-7148419908). Originally posted by [Marvisak](https://github.com/Marvisak) on 2026-11-25T00:21:13Z. --- <!-- victory-triage v1 head=9a77707b01c040e7c4480fb96b2c6e17b79b04d8 verdict=needs-rebase at=2026-11-25T00:13:20Z --> Automated triage for the maintainers. **Needs rebase.** This PR does not merge cleanly into current `main` (ac2525d). Conflicting files: `README.md`. The content has not been reviewed yet; it will be once the branch is rebased onto `main`. --- _Generated by [Claude Code](https://claude.ai/code)_
This pull request cannot be merged automatically due to conflicts.
Merge manually to resolve the conflicts.
View command line instructions

Checkout

From your project repository, check out a new branch and test the changes.
git fetch -u origin 'upstream-pr/222:upstream-pr/222'
git switch 'upstream-pr/222'

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.

git switch 'main'
git merge --no-ff 'upstream-pr/222'
git switch 'upstream-pr/222'
git rebase 'main'
git switch 'main'
git merge --ff-only 'upstream-pr/222'
git switch 'upstream-pr/222'
git rebase 'main'
git switch 'main'
git merge --no-ff 'upstream-pr/222'
git switch 'main'
git merge --squash 'upstream-pr/222'
git switch 'main'
git merge --ff-only 'upstream-pr/222'
git switch 'main'
git merge 'upstream-pr/222'
git push origin 'main'
Sign in to join this conversation.
No reviewers
No labels
No milestone
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.

Reference
Marvisak/VIctory!222
No description provided.