fix(libSceAudioOut): report not-initialized, null-pointer and flag errors from sceAudioOut2GetSpeakerInfo #8693
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/8693"
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 JAB-dev on 2026-10-20T21:16:07Z.
What
sceAudioOut2GetSpeakerInfonow returns the AudioOut2 errors the console returns instead of a made-up code and silent success. BeforesceAudioOut2Initializeit returns0x80268006(not initialized), a null result pointer returns0x8026800C(invalid pointer; the repo returned0x80260502, which is not an AudioOut2 error code), and flags above 1 return0x80268001(invalid param) without touching the result.sceAudioOut2Initializenow records that it ran, so the call can tell. The success output is unchanged.The PS5 SDK declares
sceAudioOut2GetSpeakerInfo(SceAudioOut2SpeakerInfo *outInfo, uint32_t flags)and defines flag bit 0,SCE_AUDIO_OUT2_GET_SPEAKER_INFO_FLAG_FOLLOW_HEADPHONE_CONNECT, as the only flag (audio_out2.h), and definesSCE_AUDIO_OUT2_ERROR_INVALID_PARAMas 0x80268001,SCE_AUDIO_OUT2_ERROR_NOT_INITIALIZEDas 0x80268006 andSCE_AUDIO_OUT2_ERROR_INVALID_POINTERas 0x8026800C (error.h). PS5 firmwarelibSceAudioOut3.20 (vaddr 0x1fab0) and 4.03 (vaddr 0x203f0) check in this order: the module-initialized byte, which the init path sets and the terminate path clears, then a null result pointer, then the flags. Flags above 1 are refused in both branches of the flags check; the other branch, picked by a module global, also refuses flag 1, and that global is not modelled here; the debt entry records it.No scanned local title imports this function; the change only affects a caller that runs before
sceAudioOut2Initialize, passes a null pointer or passes flags above 1, which fail on the console too.sceAudioOutInitnow also initializes AudioOut2. In PS5 firmware 3.20 and 4.03 it callssceAudioOut2Initialize(after which a second call returns0x8026000e), and that call is the only thing that sets the flagsceAudioOut2GetSpeakerInfotests first, so a title that only callssceAudioOutInitpasses the not-initialized check on the console. An independent run of the firmware 13.42 module (thanks to BunnyFl, on this PR) showed the same call. HeresceAudioOutInitstill returns 0 on repeated calls. The initialized flag moves intoAudioOut.cppnext to it, so the two test targets that build only that file still link.Tested
Windows 11 x64, MinGW GCC 15.2.0 (WinLibs r7).
audio_out2_device_state(existing test, extended): beforesceAudioOut2Initialize, a valid call, a null call and a flags-2 call all return0x80268006and leave the buffer filled with 0xAB untouched. After it, a null pointer returns0x8026800C(also with flags 2), flags 2 and0x80000000return0x80268001with the buffer untouched, flags 1 succeeds with the front pair, and the existing flags-0 checks pass. The expected codes are written out from the SDK header values, not computed by the code under test.mainthe test fails: the first call before initialization returns 0 where0x80268006is expected, and a null pointer returns0x80260502.sceAudioOutInitand thensceAudioOut2GetSpeakerInfo, which succeeds; withsceAudioOutInitreturning 0 without initializing, that check fails. The debt file now records that a repeatedsceAudioOutInitreturns 0 here against0x8026000eon the firmware, that a repeatedsceAudioOut2Initializeis unmeasured, and that flag 1 is refused below an unidentified per-process libkernel value. All 43audio_outtests pass, and the convention check andgit diff --checkpass.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 xXPBSXx on 2026-10-21T05:17:26Z.
Independent Windows run of this PR (data only).
Environment: Windows 10 Pro 10.0.19045, Ryzen 7 5800X3D, WinLibs GCC 15.2.0 r7 (MinGW-w64 UCRT), Release, BUILD_TESTING=ON. Merge-tree of the PR head against
mainis clean. I built onlyaudio_out2_device_state_tests;ctest -N -R audio_out2_device_statelists exactly one test.Results (3 runs each):
audio_out2_device_statepasses 3/3.core/libs/prx/libSceAudioOut/src/AudioOut2Internal.hpp,core/libs/prx/libSceAudioOut/src/AudioOut2SpeakerArray.cpp,core/libs/prx/libSceAudioOut/src/AudioOut2System.cppwith the version from the PR's merge base (73b6a4cc71), then rebuilt. The test fails 3/3 (exit 0xc0000409). I restored the PR's files afterwards.Not run: other platforms, the other tests in the same family, the full repository CTest, and any title or console run.
AI-assisted (Claude Code).
Imported from boykopovar/AnyPS5. Originally posted by xXPBSXx on 2026-10-21T09:45:24Z.
Linux data point for
4b0c16a173: WSL2 Ubuntu 24.04 (a virtualised kernel, not bare-metal Linux), GCC 13.3.0, Release,BUILD_TESTING=ON, PR head alone (not merged ontomain).ctest -R '^audio_out2_device_state$'passes 3 of 3.AudioOut2Internal.hpp,AudioOut2SpeakerArray.cppandAudioOut2System.cpprestored to the merge-base (new test cases kept): fails (Subprocess aborted).Not tested: macOS, Windows, a title run.
AI-assisted (Claude Code).
Imported from boykopovar/AnyPS5. Originally posted by harisibrar1 on 2026-10-24T15:32:44Z.
Review: COMMENTED
Checked against main
b607bfdc8band main's libSceAudioOut debt file:sceAudioOutInitreturns 0 here where the firmware returns0x8026000e. Could that go into docs/dev/debt/libSceAudioOut.md? Right now no entry covers it.libSceAudioOut/tests/AudioOut2DeviceState.cpp:159-160callssceAudioOutInit()(which now initializes AudioOut2) and then requiressceAudioOut2Initialize() == 0. Is a repeatedsceAudioOut2Initializeknown to return 0 on the console? If not, I'd drop that assertion or record the repeat behaviour as unmeasured in the debt file.Reviewed with AI assistance (Claude Code); the checks above were run locally on my machine.