Skip to content

fix(audioout): serialize SDL audio initialization for Dark Forces - #4789

Merged
oneandonlydean merged 2 commits into
boykopovar:mainfrom
PrintOrb:fix/audioout-shared-sdl-init
Oct 14, 2026
Merged

oneandonlydean merged 2 commits into
boykopovar:mainfrom
PrintOrb:fix/audioout-shared-sdl-init

Conversation

@PrintOrb

@PrintOrb PrintOrb commented Oct 12, 2026 •

Copy link
Copy Markdown
Contributor

What

STAR WARS: Dark Forces Remaster (PPSA19728, 02.000.000) can crash in SDL_AudioQuit_REAL at address zero when legacy AudioOut and AudioOut2 initialize SDL audio concurrently. Debugger traces show overlapping initialization from sceAudioOutOpen and sceAudioOut2ContextCreate.

Serialize SDL audio initialization through a shared helper. Preserve SDL's return value and the existing caller error handling.

Tested

Native Windows, Release build, based on main 529f7bfd4. Full libs build passes. The new audio_out_initialization test exercises the production helper with a controlled SDL backend, checks serialization and unchanged failure/success returns, and passes. Removing serialization produces overlapping backend calls and fails the regression. Existing audio_out_ex, audio_out2_latency and audio_out2_port_buffers pass (4/4 total). Conventions, test registration and whitespace checks pass. Newer main ee4962190 was checked before publication: neither affected library changed, and the branch merges cleanly; the build/test results above are for the stated tested base.

Earlier title testing required the independent NGS2 voice-index fix to reach this audio path. With both fixes, manual testing completed the first mission. Tab/PDA performance problems remain. Gameplay was not repeated on the refreshed main build.

Checklist

@github-actions

github-actions Bot commented Oct 13, 2026 •

Copy link
Copy Markdown

Other open pull requests touch the same code. Merging one will break the other, or both implement the same thing. If this one builds on them, list them in Depends on.

Pull request Conflicting files (lines on main) Same exports Same new files
#3533 core/libs/prx/libSceAudioOut/CMakeLists.txt L19
#5448 core/libs/prx/libSceAudioOut/src/AudioOut2Context.cpp L16
#5558 core/libs/prx/libSceAudioOut/CMakeLists.txt L19

@xXPBSXx

xXPBSXx commented Oct 13, 2026

Copy link
Copy Markdown
Contributor

Windows test: head 5031432db merged onto current main 5d50886ee, together with 9 other open pull requests in one build (the merges were conflict-free); a failure would have been bisected per PR. Windows 10, MinGW GCC (WinLibs), Ninja Release, -j2: full build 0 errors; ctest for the tests this change adds or touches: audio_out_initialization passed; python tools/check_conventions.py --base upstream/main passed for the combined tree. I did not run the new tests against main without the change.

AI-assisted (Claude Code).

@johnohhh1

Copy link
Copy Markdown
Contributor

Independent Linux validation of 5031432db0d39c8c95504218673166cf6a69ef1a, applied alone to main 959d39fb2b050fa76beed0b49b4c2f13a119ab5a (without #4788 or other pending PRs).

Ubuntu 26.04.1 x86-64, GCC 15.2.0, Release, bundled dependencies, testing and SPIR-V Tools enabled. SDL_AUDIODRIVER=dummy was set only in the test process.

  • Full baseline and patched builds pass. All 12 selected AudioOut/patched-library suites pass on the candidate without skips, including audio_out_initialization; serial CTest with a 30-second maximum. The slowest selected test takes 4.40 seconds.
  • The author's exact initialization regression passes against the production AudioOutSdl.cpp helper. Against an unsynchronized control that calls SDL_InitSubSystem(SDL_INIT_AUDIO) directly, it fails with peak=2, while preserving the backend's -1,0 return sequence.
  • An additional stress probe starts 12 threads together for 1,536 calls, mixing backend success and failure. The unsynchronized control reaches 12 simultaneous backend calls and fails the serialization check; the production helper reaches only one and passes, with every call made and each thread's return value preserved.
  • Conventions and whitespace checks pass; the combined change matches the original stable patch ID and retains the original author.

The concurrency checks compile the actual production helper with a controlled SDL backend. They establish serialization and return-value preservation, not reproduction of the real SDL_AudioQuit_REAL crash or gameplay progress. The existing AudioOut library suites use SDL's dummy driver. No title or native PS5 was run, and Windows was not retested.

AI-assisted validation/report: Codex. Original implementation and authorship preserved.

@oneandonlydean
oneandonlydean merged commit 6d03255 into boykopovar:main Oct 14, 2026
10 of 11 checks passed
0xcrstn added a commit to 0xcrstn/AnyPS5 that referenced this pull request Oct 14, 2026
…ization leaves PPSA23566 on a black, silent screen before its intro

Bisected on 2026-10-14: upstream main plus the registration limit stays black and silent at about 50 FPS; the same with this merge reverted shows the intro.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
0xcrstn added a commit to 0xcrstn/AnyPS5 that referenced this pull request Oct 15, 2026
Brings the UFC 6 candidate (c222bd2) up to upstream main, 436 commits
past its old base 84b01f9. Conflicts were resolved keeping both sides:

- shader: image tables replace bindless tables in the fork's
  materializer, capture and compiled-walk paths (compiled walks and
  memoized fast paths fall back for plans with image tables); both
  disk-cache format bumps collapse into FormatVersion 36; Linux layout
  checks recomputed (BindingAllocationResult 208, IrResourcePlan 600);
  prebuilt shader packs are tried before the writable cache on reload.
- agc: upstream's draw shape keys, stage data hits, byte caps and
  described compute layouts are folded into the fork's binding plans,
  relocation, sizing and compute compile-ahead; upstream's unwritten
  snapshot cap and budget combine with the fork's epoch revalidation.
- agc: registration preparations queued behind or past the preparation
  budget are not awaited at submission, keeping preparation in the
  background.
- depth: upstream's base-slice depth plane sampling replaces the fork's
  version.
- audio: the fork keeps boykopovar#4789 reverted.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants