fix(libSceAudioOut): refuse sceAudioOut2Mastering calls before sceAudioOut2Initialize #11244
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/11244"
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 boykopovar/AnyPS5. Originally posted by SeaSunPT on 2026-10-25T22:28:48Z.
What
Before
sceAudioOut2Initialize,sceAudioOut2MasteringInit,sceAudioOut2MasteringInitEx,sceAudioOut2MasteringTerm,sceAudioOut2MasteringGetStateandsceAudioOut2MasteringSetParamwent straight to their own checks:sceAudioOut2MasteringInit(0)initialized mastering and returned 0. The console returns0x80268006(not initialized) from all five. Each now returns0x80268006first whenAudioOut2IsInitialized_nid_no_patch()is false, assceAudioOut2GetSpeakerInfodoes, and changes no state.Source: #9027 (https://github.com/boykopovar/AnyPS5/pull/9027) read the decrypted PS5
libSceAudioOut: Init (XHl38ZNknbs0x22660) and InitEx (7ukE-Yrzqog0x22650) jump into one routine at 0x22360; Term is2bbBBOkH4CY0x22690, GetStateVZidxi2cYh00x22da0 and SetParamv8iOE+j8a5o0x228e0. It states that the console also returns0x80268006from all of these beforesceAudioOut2Initialize, and it left the check out only because that initialization was not tracked. #9027 calls the module 12.00; the open #10179 relabels it 13.60.Check order:
0x80268006comes before the already-initialized return of 0 and before the flag check (0x80268201). The earlier debt entry, replaced in #9027, recorded that order: "native initialization requires AudioOut2 initialization (0x80268006 otherwise), returns success immediately when already initialized, and otherwise rejects nonzero flags with 0x80268201" (f7a7be1a2).sceAudioOut2Initialize, mastering cannot be initialized, because Init refuses. If0x80268203came first, the console would return it there, not0x80268006. So0x80268006comes before0x80268203, and #9027 puts0x80268203before the pointer, parameter and flag checks.sceAudioOut2Terminatethrows here, so AudioOut2 never goes back to uninitialized aftersceAudioOut2Initialize, and no other state shows the order.The debt entry for Init and InitEx loses the closed clause; the rest stays open. Unchanged: the
output/userchecks and audio-server failures #9027 left out, the legacysceAudioOutMastering*calls, and the missing0x80268006insceAudioOut2SetSystemDebugState,sceAudioOut2EnableChatandsceAudioOut2DisableChat(each in its own debt entry; a separate PR).Tested
Windows 11 Pro 26200, WinLibs GCC 15.2.0 r7, Ninja, Release,
-DBUILD_TESTING=ON, onmainb82cc9689.audio_out2_latency(existing test, newTestMasteringBeforeInitializerun inmainbeforesceAudioOut2Initialize): Init with flags 0 and 1, InitEx with 0, bit 31 and 1, Term, GetState with a null and a valid state, and SetParam with a valid parameter and with a null parameter and flags 2 all return0x80268006, and the refused GetState leaves the states unwritten. The existingTestMasteringInitthat runs next still gets0x80268203from Term, so the refused Init calls did not initialize mastering.AudioOut2Mastering.cppfrommainand the new test kept,audio_out2_latencyaborts (exit code 0xc0000409) on its first check:mastering initialization before AudioOut2 initialization is refused, sincesceAudioOut2MasteringInit(0)returns 0. With the change it passes.ctest --test-dir build -R "audio" --output-on-failure, three runs: 51/51 passed each time.ctest --test-dir build -R "public_headers" --output-on-failure: 65/65 passed.ctest --test-dir build -j 8 --output-on-failure: 2 of 2392 tests failed. The two failures,agc_host_import_cut_lifetimeandagc_driver_depth_plane_partial_store, also fail onmainon this machine (NVIDIA RTX 5070 Ti) and do not involve libSceAudioOut.python tools/check_conventions.py --base origin/mainpasses;git diff --check origin/mainis clean.python tools/pr_overlap.py --branch fix/audioout2-mastering-not-initialized: the only conflict is with #10179, on debt line 16 (its12.00->13.60label). Whichever PR merges second needs a docs-only rebase. #9818 and #9826 already conflict withmaininAudioOut2Mastering.cpp. #11035 edits the same test'smainand merges cleanly with this branch.Linux not tested.
Checklist
main; no other open PR implements the same functionsNotImplemented_nid_no_patch); silent stubs are listed under Silent stubs in their library's technical debt file.mdfiles or images added to the repository (attach them to this PR)🤖 Generated with Claude Code
Imported from boykopovar/AnyPS5. Originally posted by MarcZX10 on 2026-10-25T22:31:02Z.
Review: APPROVED
Reviewed exact head
4128be2f60327e5bc90fdbcd03f05d90a6b17b7e. The initialization guard precedes each mastering method’s existing mastering-state, flag, pointer, and state-ID checks, matching the measured not-initialized result without mutating state; the test runs beforesceAudioOut2Initializeand confirms refused state reads leave output untouched. Current-main conventions and diff-check pass. The author reports the focused Windows audio tests and full-suite baseline failures; hosted product jobs were skipped by path policy, and I did not rerun the runtime tests locally. #10179 and #11035 remain open; their stated overlap is documented.Imported from boykopovar/AnyPS5. Originally posted by thepoppfish on 2026-10-25T22:53:20Z.
Review: APPROVED
Reviewed exact head
4128be2f60327e5bc90fdbcd03f05d90a6b17b7eand independently reproduced the initialization-state fix on native Windows with GCC 16.2.0-6 UCRT, C++20,-O1 -g -fno-inline -flto, static C++ runtime.The new guards preserve the check order documented by the module reading in #9027. That source explicitly reports
0x80268006for all five calls before AudioOut2 initialization; #10179 corrects its firmware label to 13.60. I did not inspect a console binary or run a console probe myself.Validation:
AudioOut2Mastering.cpp,AudioOut.cpp,AudioOut2Context.cpp,AudioOut2System.cppandAudioOut2Low.cpp, using this checkout's real headers and SDL headers at the pinned submodule4b69833bc54abf3dd3288d4aa7afbba527775e5b. The actual production global initialization state and all four initialization entry points are used. The only support implementation is the usualNotImplementedthrowing boundary; LTO removes unused device/backend paths.AudioOut2Latency.cpppasses. Four additional process-isolated modes (sceAudioOut2Initialize, legacysceAudioOutInit,sceAudioOut2InitializeEx,sceAudioOut2LoInit) each pass 114 checks, 456 total. These include all five early refusals, pointer/flag/state-ID precedence, unchanged output bytes,PAGE_NOACCESSinput/output pointers rejected without touching memory, no mastering-state mutation on refusal, all individual flag bits after initialization, and repeated mastering-init/term behavior. CTest: 5/5 pass, 0 skipped, 0.24 s.b82cc9689498cf7a0e2565b44001e9deb00d2f6bmakes the committed test abort atmastering initialization before AudioOut2 initialization is refused(exit0xc0000409). Each additional mode reports 35 failed checks on that parent implementation, versus 0 on this head. The other four production modules are byte-identical to the parent after checkout line-ending normalization.9925a9e401ac5fde5cf0fe7dd12b1b906f2f4263and pinned mainb90d009d9f73354cbea239a74a8f7e2dcd138772(local commit546e5bd2dc01b4c634ca5fa551a8373912fe7c01, treeaecde74cd489295437e05f963a7076756690ac8b). The combined committed test retains the before-initialization mastering checks and #11035's repeated-initialization checks. Rebuilt from that tree: 5/5 pass, 0 skipped, 0.38 s, including another 456/456 probe checks. This establishes compatibility for these pinned revisions; merge-order coordination and the reported #10179 docs overlap remain separate.Scope: focused native implementation tests with unused backend paths removed. No full shared-library/product build, SDL playback, Linux/macOS, retail-console or title run, and no canonical PR-overlap scan by me. AI-assisted review and fixture: Codex.
Complete standalone fixture for reproduction
Initialize the SDL submodule in the checkout of the exact reviewed head. Save the three files below in a separate directory. Before configuring, create
ParentMastering.cppin that directory with this Python snippet, settingrepoto the reviewed checkout:Configure with GCC/MinGW, setting
REPOandSDL_INCLUDEto the checkout and its3rdparty/SDL2/includedirectory, then build and run CTest:parent_author.exeis the expected-aborting negative control.parent_probe.exe direct(orlegacy,extended,low) prints 114 checks/35 failures and exits 1; the correspondinghead_probe.exeprints 114/0 and exits 0. Each mode starts in a fresh process. Theobjcopypost-build step follows the project's Windows unwind-section handling for exceptions across the guest ABI.CMakeLists.txt
Support.cpp
Probe.cpp
Imported from boykopovar/AnyPS5. Originally posted by jotitadev on 2026-10-27T01:07:03Z.
Review: COMMENTED
Linux run of the current head, since the description says Linux was not tested.
Machine: Linux x86_64, i7-8700 (6 cores / 12 threads, AVX2), Ubuntu 26.04, GCC 15.2, Release,
BUILD_TESTING=ON. Headd736ea814merged ontomaincb45ae2dd.audio_out/audiooutpass,audio_out2_latencyamong them.AudioOut2Mastering.cpptomainand keeping the test abortsaudio_out2_latencywithmastering initialization before AudioOut2 initialization is refused, so the test catches the regression on Linux too.Written with AI assistance (Claude Code). I ran the builds and tests above on my machine.