fix(libSceAudioOut): implement sceAudioOutSetPadSpkVolume and unblock PSBox (PPSA99810) #12791

Closed
Elma7e wants to merge 1 commit from upstream-pr/12791 into main
Elma7e commented 2026-10-29 09:26:00 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by Elma7e on 2026-10-29T09:26:00Z.


What

sceAudioOutSetPadSpkVolume threw NotImplemented_nid_no_patch from Unimplemented.cpp. When PPSA99810 plays alert chimes on its detached controller speaker worker thread (src/media/audio_out_ps5.cpp:184), the uncaught exception terminates the process with SIGABRT (exit 134).

This PR:

  • Moves sceAudioOutSetPadSpkVolume into AudioOut.cpp.
  • Introduces named constant PADSPK_VOLUME_MAX = 127 and DEFAULT_PORT_STATE_VOLUME = 127.
  • Enforces port handle validation (0x80260003 INVALID_PORT).
  • Enforces volume bounds checking from 0 to PADSPK_VOLUME_MAX, returning 0x80260009 (INVALID_VOLUME) for values outside that range.
  • Enforces port type validation, returning 0x8026000A (INVALID_PORT_TYPE) for non-PORT_TYPE_PADSPK ports.
  • Stores padSpkVolume on the port and reflects it in sceAudioOutGetPortState.
  • Connects padSpkVolume in prepareBuffer to scale both float and 16-bit PCM audio output streams by volume / 127, so the write actually controls audio output rather than dropping its data.
  • Updates docs/dev/debt/libSceAudioOut.md under Silent stubs, noting that volume linearly scales pad speaker output and bounds/error codes are assumed from title scaling and sibling calls, and removes the unimplemented stub entry.
  • Expands AudioOutMixLevelPadSpk.cpp with TestPadSpeakerVolume() using a ±16384 alternating block, verifying valid levels, volume 0 muting (silence), invalid handles, wrong port types, and out-of-range volumes.

Tested

  • Standalone GCC 15.2.0 build with ±16384 alternating test block, all assertions passing (exit 0).
  • Volume attenuation verified: setting volume to 0 produces silence, while volume 127 outputs full default mix level.
  • Negative control: reverting AudioOut.cpp to throwing stub causes TestPadSpeakerVolume to abort as expected.
  • python3 tools/check_conventions.py --base upstream/main --head HEAD: passed with 0 errors.

Checklist

  • Based on current main; no other open PR implements the same functions
  • One topic per PR; follow-ups go in a new PR
  • No comments in code except technical debt
  • Unimplemented paths throw (NotImplemented_nid_no_patch); silent stubs are listed under Silent stubs in their library's technical debt file
  • No notes, investigation .md files or images added to the repository (attach them to this PR)
  • New third-party code is a submodule built from source
  • Generic behaviour, not specific to one title
  • Depends on: none
  • Fixes: none
  • Unblocks: PPSA99810 (PSBox Cloud Gaming alert chime playback past crash)
  • GPUs tested: n/a
  • AI-assisted: yes
<!-- greyfinch-sync:boykopovar/AnyPS5:issue:5065505857 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/12791). Originally posted by [Elma7e](https://github.com/Elma7e) on 2026-10-29T09:26:00Z. --- ### What `sceAudioOutSetPadSpkVolume` threw `NotImplemented_nid_no_patch` from `Unimplemented.cpp`. When PPSA99810 plays alert chimes on its detached controller speaker worker thread (`src/media/audio_out_ps5.cpp:184`), the uncaught exception terminates the process with `SIGABRT` (exit 134). This PR: - Moves `sceAudioOutSetPadSpkVolume` into `AudioOut.cpp`. - Introduces named constant `PADSPK_VOLUME_MAX = 127` and `DEFAULT_PORT_STATE_VOLUME = 127`. - Enforces port handle validation (`0x80260003` `INVALID_PORT`). - Enforces volume bounds checking from 0 to `PADSPK_VOLUME_MAX`, returning `0x80260009` (`INVALID_VOLUME`) for values outside that range. - Enforces port type validation, returning `0x8026000A` (`INVALID_PORT_TYPE`) for non-`PORT_TYPE_PADSPK` ports. - Stores `padSpkVolume` on the port and reflects it in `sceAudioOutGetPortState`. - Connects `padSpkVolume` in `prepareBuffer` to scale both float and 16-bit PCM audio output streams by `volume / 127`, so the write actually controls audio output rather than dropping its data. - Updates `docs/dev/debt/libSceAudioOut.md` under *Silent stubs*, noting that volume linearly scales pad speaker output and bounds/error codes are assumed from title scaling and sibling calls, and removes the unimplemented stub entry. - Expands `AudioOutMixLevelPadSpk.cpp` with `TestPadSpeakerVolume()` using a ±16384 alternating block, verifying valid levels, volume 0 muting (silence), invalid handles, wrong port types, and out-of-range volumes. ### Tested - Standalone GCC 15.2.0 build with ±16384 alternating test block, all assertions passing (`exit 0`). - Volume attenuation verified: setting volume to 0 produces silence, while volume 127 outputs full default mix level. - Negative control: reverting `AudioOut.cpp` to throwing stub causes `TestPadSpeakerVolume` to abort as expected. - `python3 tools/check_conventions.py --base upstream/main --head HEAD`: passed with 0 errors. ### Checklist - [x] Based on current `main`; no other open PR implements the same functions - [x] One topic per PR; follow-ups go in a new PR - [x] No comments in code except [technical debt](https://github.com/boykopovar/AnyPS5/blob/main/docs/dev/CONVENTIONS.md) - [x] Unimplemented paths throw (`NotImplemented_nid_no_patch`); silent stubs are listed under Silent stubs in their library's [technical debt](https://github.com/boykopovar/AnyPS5/tree/main/docs/dev/debt) file - [x] No notes, investigation `.md` files or images added to the repository (attach them to this PR) - [x] New third-party code is a submodule built from source - [x] Generic behaviour, not specific to one title - [x] Depends on: none - [x] Fixes: none - [x] Unblocks: PPSA99810 (PSBox Cloud Gaming alert chime playback past crash) - [x] GPUs tested: n/a - [x] AI-assisted: yes
XairRrR commented 2026-10-29 10:50:01 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by XairRrR on 2026-10-29T10:50:01Z.

Review: CHANGES_REQUESTED


Reviewed — changes requested

The new TestPadSpeakerVolume aborts every time it runs, and the range check, the error codes and the sceAudioOutGetPortState volume rest only on the title's call site, which the project rules do not accept as a source for library behaviour.

What I ran

Head bb9c53974580183c23e82cada844204350040d16, merged with --no-ff onto main 1db077e876a839f75d11a56e728e7f56a4a8c25e (no conflicts). Arch Linux 7.2.11-zen, GCC 16.2.1, Intel Core i9-14900KF, NVIDIA GeForce RTX 4070 Ti SUPER (driver 615.78.08), Release build with Ninja, in a clean worktree.

git diff --check origin/main...refs/review/12791
python3 tools/check_conventions.py --base origin/main
cmake --build build -j10 --target audio_out_mix_level_pad_spk_tests libSceAudioOut
cmake --build build -j10 --target libs
cmake --build build -j10
ctest --test-dir build -R audio_out_mix_level_pad_spk --output-on-failure
gdb -batch -ex run -ex bt build/tests/audio_out_mix_level_pad_spk_tests
ctest --test-dir build -j4 -R "audio_out|public_headers" --output-on-failure

# test with only the TestPadSpeakerVolume input block changed to ±16384 (as in TestDefaultLevel)
ctest --test-dir build -R audio_out_mix_level_pad_spk --output-on-failure

# negative control: same corrected test, production files from main
git checkout origin/main -- core/libs/prx/libSceAudioOut/src/AudioOut.cpp core/libs/prx/libSceAudioOut/src/Unimplemented.cpp
cmake --build build -j10 --target audio_out_mix_level_pad_spk_tests
ctest --test-dir build -R audio_out_mix_level_pad_spk --output-on-failure

Results

Check Result
Merge onto main Clean
git diff --check Clean
check_conventions.py All conventions checks passed.
Build (libSceAudioOut, libs, all) OK
audio_out_mix_level_pad_spk (PR as submitted) Fails: Subprocess aborted in 0.32 s
audio_out|public_headers (117 tests) 116 pass; only audio_out_mix_level_pad_spk fails
Same test with the TestPadSpeakerVolume block changed to ±16384 Passes (0.45 s)
Failure and backtrace
1/1 Test #1857: audio_out_mix_level_pad_spk ......Subprocess aborted***Exception:   0.32 sec
0% tests passed, 1 tests failed out of 1

Thread 1 "audio_out_mix_l" received signal SIGABRT, Aborted.
#2  0x00007ffff7225685 in abort () from /usr/lib/libc.so.6
#3  0x0000555555556305 in (anonymous namespace)::Scaled(std::vector<short, std::allocator<short> > const&, int) [clone .cold] ()
#4  0x00005555555588d0 in main ()

Negative control

With the test changed only so that it can pass (the ±16384 block, see the first blocking finding) and AudioOut.cpp and Unimplemented.cpp restored from main, the test fails as it should:

Output
1/1 Test #1857: audio_out_mix_level_pad_spk ......Subprocess aborted***Exception:   0.36 sec
terminate called after throwing an instance of 'std::runtime_error'
  what():  sceAudioOutSetPadSpkVolume not implemented
0% tests passed, 1 tests failed out of 1

The test as submitted fails with and without the production change, so it does not show anything about the change yet.

Findings

Blocking

  1. The new test always aborts. TestPadSpeakerVolume uses Ramp() and compares against Scaled(block, defaultMixLevel). Scaled requires sample * level % 32768 == 0. The Ramp() samples are ±256·(k+1) and 11626 = 2·5813, so the product is a multiple of 32768 only when k+1 is a multiple of 64. 254 of the 256 samples fail, starting with the first one, so Require aborts before the comparison runs, on any machine. This does not match "all assertions passing" in Tested. TestDefaultLevel uses a ±16384 block for this reason. With that block in TestPadSpeakerVolume the test passes on this tree, and the negative control above then fails. Fix: use a ±16384 block, or a ramp whose samples are multiples of 32768 / gcd(11626, 32768) = 16384, and quote ctest -R audio_out_mix_level_pad_spk in Tested, as already asked in the earlier comment.

  2. The behaviour comes from a call site, which the rules do not accept as a source for this. sceAudioOutSetPadSpkVolume returns 0x80260009 outside 0–127, uses a fixed check order and returns success otherwise. sceAudioOutGetPortState now reports the stored value as volume for pad speaker ports. The debt entry says all of this is assumed from "the title's scaling and sibling calls". REVERSE_ENGINEERING.md says: "A call site doesn't settle what the library writes, which error codes it returns, its side effects, or the values a title happens to accept … Everything that the call site and the other sources leave open throws". It also says a silent stub is allowed only when it affects the UI, and "a write that drops its data, is not UI". CONTRIBUTING.md says the same. Here the volume is stored but never applied to the pad speaker audio, so listing it under Silent stubs does not fit. This goes further than the earlier collaborator comment, which suggested Silent stubs together with the assumption wording. In practice this means:

    • a title that passes e.g. 128 or 255 gets an error code nobody has observed, instead of a throw that names the gap;
    • every pad speaker port's GetPortState.volume changes from 127 to whatever the title last set. Nothing shows that the console reports it there.

    Fix: settle the behaviour from a stronger source before implementing it, for example the export in a PS5 libSceAudioOut module (the same debt file already cites the 13.60 module for sceAudioOut2LoTerminate) or a console measurement. That source would give the range, the error codes, the check order, and whether the value reaches the output and GetPortState. Then apply the volume to the pad speaker output if the console does. Until then the export should keep throwing.

Non-blocking

  1. The description is out of date with the branch. It says the debt entry goes under Functional, but it is under Silent stubs. It mentions a VOLUME_MAX = 127 constant, but the code uses the literal 127 in three places (L121, L384, L702). It also gives the crash as "SIGABRT (0xC0000005 / exit 134)". 0xC0000005 is a Windows access violation, while an uncaught exception on Linux is SIGABRT / exit 134. If the code stays, a named constant next to DEFAULT_VOLUME would keep the three uses in step.

Not verified

  • What sceAudioOutSetPadSpkVolume does on a console: its range, error codes, check order and effect on output and port state. I found no source in the PR or in the tree.
  • That PPSA99810 gets past the crash. I did not run the title.
  • The Windows build and tests.

To get this to a good state

  1. Fix the TestPadSpeakerVolume input block so that Scaled can succeed, and quote a passing ctest -R audio_out_mix_level_pad_spk run.
  2. Find a firmware-module disassembly or a console measurement for the export, and implement what it shows, including applying the volume to the output if the console does. Otherwise keep NotImplemented_nid_no_patch and the original Unknown function info entry.
  3. Update the description to match the branch.
<!-- greyfinch-sync:boykopovar/AnyPS5:review:5696502838 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/12791#pullrequestreview-5696502838). Originally posted by [XairRrR](https://github.com/XairRrR) on 2026-10-29T10:50:01Z. **Review:** CHANGES_REQUESTED --- # Reviewed — changes requested The new `TestPadSpeakerVolume` aborts every time it runs, and the range check, the error codes and the `sceAudioOutGetPortState` volume rest only on the title's call site, which the project rules do not accept as a source for library behaviour. ## What I ran Head `bb9c53974580183c23e82cada844204350040d16`, merged with `--no-ff` onto `main` `1db077e876a839f75d11a56e728e7f56a4a8c25e` (no conflicts). Arch Linux 7.2.11-zen, GCC 16.2.1, Intel Core i9-14900KF, NVIDIA GeForce RTX 4070 Ti SUPER (driver 615.78.08), Release build with Ninja, in a clean worktree. ``` git diff --check origin/main...refs/review/12791 python3 tools/check_conventions.py --base origin/main cmake --build build -j10 --target audio_out_mix_level_pad_spk_tests libSceAudioOut cmake --build build -j10 --target libs cmake --build build -j10 ctest --test-dir build -R audio_out_mix_level_pad_spk --output-on-failure gdb -batch -ex run -ex bt build/tests/audio_out_mix_level_pad_spk_tests ctest --test-dir build -j4 -R "audio_out|public_headers" --output-on-failure # test with only the TestPadSpeakerVolume input block changed to ±16384 (as in TestDefaultLevel) ctest --test-dir build -R audio_out_mix_level_pad_spk --output-on-failure # negative control: same corrected test, production files from main git checkout origin/main -- core/libs/prx/libSceAudioOut/src/AudioOut.cpp core/libs/prx/libSceAudioOut/src/Unimplemented.cpp cmake --build build -j10 --target audio_out_mix_level_pad_spk_tests ctest --test-dir build -R audio_out_mix_level_pad_spk --output-on-failure ``` ## Results | Check | Result | | --- | --- | | Merge onto `main` | Clean | | `git diff --check` | Clean | | `check_conventions.py` | `All conventions checks passed.` | | Build (`libSceAudioOut`, `libs`, all) | OK | | `audio_out_mix_level_pad_spk` (PR as submitted) | **Fails**: `Subprocess aborted` in 0.32 s | | `audio_out\|public_headers` (117 tests) | 116 pass; only `audio_out_mix_level_pad_spk` fails | | Same test with the `TestPadSpeakerVolume` block changed to ±16384 | Passes (0.45 s) | <details><summary>Failure and backtrace</summary> ``` 1/1 Test #1857: audio_out_mix_level_pad_spk ......Subprocess aborted***Exception: 0.32 sec 0% tests passed, 1 tests failed out of 1 Thread 1 "audio_out_mix_l" received signal SIGABRT, Aborted. #2 0x00007ffff7225685 in abort () from /usr/lib/libc.so.6 #3 0x0000555555556305 in (anonymous namespace)::Scaled(std::vector<short, std::allocator<short> > const&, int) [clone .cold] () #4 0x00005555555588d0 in main () ``` </details> ## Negative control With the test changed only so that it can pass (the ±16384 block, see the first blocking finding) and `AudioOut.cpp` and `Unimplemented.cpp` restored from `main`, the test fails as it should: <details><summary>Output</summary> ``` 1/1 Test #1857: audio_out_mix_level_pad_spk ......Subprocess aborted***Exception: 0.36 sec terminate called after throwing an instance of 'std::runtime_error' what(): sceAudioOutSetPadSpkVolume not implemented 0% tests passed, 1 tests failed out of 1 ``` </details> The test as submitted fails with and without the production change, so it does not show anything about the change yet. ## Findings ### Blocking 1. **The new test always aborts.** [`TestPadSpeakerVolume`](https://github.com/boykopovar/AnyPS5/blob/bb9c53974580183c23e82cada844204350040d16/core/libs/prx/libSceAudioOut/tests/AudioOutMixLevelPadSpk.cpp#L169-L170) uses `Ramp()` and compares against [`Scaled(block, defaultMixLevel)`](https://github.com/boykopovar/AnyPS5/blob/bb9c53974580183c23e82cada844204350040d16/core/libs/prx/libSceAudioOut/tests/AudioOutMixLevelPadSpk.cpp#L195). [`Scaled`](https://github.com/boykopovar/AnyPS5/blob/bb9c53974580183c23e82cada844204350040d16/core/libs/prx/libSceAudioOut/tests/AudioOutMixLevelPadSpk.cpp#L87-L90) requires `sample * level % 32768 == 0`. The `Ramp()` samples are ±256·(k+1) and 11626 = 2·5813, so the product is a multiple of 32768 only when k+1 is a multiple of 64. 254 of the 256 samples fail, starting with the first one, so `Require` aborts before the comparison runs, on any machine. This does not match "all assertions passing" in *Tested*. `TestDefaultLevel` uses a ±16384 block for this reason. With that block in `TestPadSpeakerVolume` the test passes on this tree, and the negative control above then fails. Fix: use a ±16384 block, or a ramp whose samples are multiples of 32768 / gcd(11626, 32768) = 16384, and quote `ctest -R audio_out_mix_level_pad_spk` in *Tested*, as already asked in [the earlier comment](https://github.com/boykopovar/AnyPS5/pull/12791#issuecomment-6493426954). 2. **The behaviour comes from a call site, which the rules do not accept as a source for this.** [`sceAudioOutSetPadSpkVolume`](https://github.com/boykopovar/AnyPS5/blob/bb9c53974580183c23e82cada844204350040d16/core/libs/prx/libSceAudioOut/src/AudioOut.cpp#L696-L710) returns 0x80260009 outside 0–127, uses a fixed check order and returns success otherwise. [`sceAudioOutGetPortState`](https://github.com/boykopovar/AnyPS5/blob/bb9c53974580183c23e82cada844204350040d16/core/libs/prx/libSceAudioOut/src/AudioOut.cpp#L593) now reports the stored value as `volume` for pad speaker ports. The debt entry says all of this is assumed from "the title's scaling and sibling calls". [REVERSE_ENGINEERING.md](https://github.com/boykopovar/AnyPS5/blob/1db077e876a839f75d11a56e728e7f56a4a8c25e/docs/dev/REVERSE_ENGINEERING.md#L38-L43) says: "A call site doesn't settle what the library writes, which error codes it returns, its side effects, or the values a title happens to accept … Everything that the call site and the other sources leave open throws". It also says a silent stub is allowed only when it affects the UI, and "a write that drops its data, is not UI". [CONTRIBUTING.md](https://github.com/boykopovar/AnyPS5/blob/1db077e876a839f75d11a56e728e7f56a4a8c25e/CONTRIBUTING.md#L10) says the same. Here the volume is stored but never applied to the pad speaker audio, so listing it under *Silent stubs* does not fit. This goes further than the earlier collaborator comment, which suggested *Silent stubs* together with the assumption wording. In practice this means: - a title that passes e.g. 128 or 255 gets an error code nobody has observed, instead of a throw that names the gap; - every pad speaker port's `GetPortState.volume` changes from 127 to whatever the title last set. Nothing shows that the console reports it there. Fix: settle the behaviour from a stronger source before implementing it, for example the export in a PS5 `libSceAudioOut` module (the same debt file already cites the 13.60 module for `sceAudioOut2LoTerminate`) or a console measurement. That source would give the range, the error codes, the check order, and whether the value reaches the output and `GetPortState`. Then apply the volume to the pad speaker output if the console does. Until then the export should keep throwing. ### Non-blocking 1. The description is out of date with the branch. It says the debt entry goes under *Functional*, but it is under *Silent stubs*. It mentions a `VOLUME_MAX = 127` constant, but the code uses the literal `127` in three places ([L121](https://github.com/boykopovar/AnyPS5/blob/bb9c53974580183c23e82cada844204350040d16/core/libs/prx/libSceAudioOut/src/AudioOut.cpp#L121), [L384](https://github.com/boykopovar/AnyPS5/blob/bb9c53974580183c23e82cada844204350040d16/core/libs/prx/libSceAudioOut/src/AudioOut.cpp#L384), [L702](https://github.com/boykopovar/AnyPS5/blob/bb9c53974580183c23e82cada844204350040d16/core/libs/prx/libSceAudioOut/src/AudioOut.cpp#L702)). It also gives the crash as "`SIGABRT` (`0xC0000005` / exit 134)". 0xC0000005 is a Windows access violation, while an uncaught exception on Linux is SIGABRT / exit 134. If the code stays, a named constant next to `DEFAULT_VOLUME` would keep the three uses in step. ## Not verified - What `sceAudioOutSetPadSpkVolume` does on a console: its range, error codes, check order and effect on output and port state. I found no source in the PR or in the tree. - That PPSA99810 gets past the crash. I did not run the title. - The Windows build and tests. ## To get this to a good state 1. Fix the `TestPadSpeakerVolume` input block so that `Scaled` can succeed, and quote a passing `ctest -R audio_out_mix_level_pad_spk` run. 2. Find a firmware-module disassembly or a console measurement for the export, and implement what it shows, including applying the volume to the output if the console does. Otherwise keep `NotImplemented_nid_no_patch` and the original *Unknown function info* entry. 3. Update the description to match the branch.
XairRrR commented 2026-10-29 11:45:47 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by XairRrR on 2026-10-29T11:45:47Z.

Review: CHANGES_REQUESTED


Re-checked — changes still requested

The new commit fixes the test input block and adds the named constant, and the test now passes and fails without the change as it should; the export still implements a range, error codes and a GetPortState effect that come only from the title's call site.

What changed since my last review

  • New head commit 159d10a5a9 on top of 5c32f54c11, which is the same patch as the previously reviewed bb9c539745 rebased on newer main. The range-diff shows no other change.
  • TestPadSpeakerVolume now uses a ±16384 alternating block instead of Ramp().
  • PADSPK_VOLUME_MAX = 127 replaces the three literal 127s in AudioOut.cpp.
  • The description now says Silent stubs, names the constant and drops the Windows error code.
  • In the author's comment of 11:32 UTC, the debt entry stays under Silent stubs with the "assumed, not console-measured" wording. That comment does not answer the second blocking finding: where the behaviour comes from.

What I ran

Head 159d10a5a9009d88d693e181fb7819eb97a9b618, merged with --no-ff onto main ba5b5330b37724bca4b99f30faab504653635a04 (no conflicts), in a clean worktree. Arch Linux 7.2.11-zen, GCC 16.2.1, Intel Core i9-14900KF, NVIDIA GeForce RTX 4070 Ti SUPER (driver 615.78.08), Release build with Ninja.

git range-diff origin/main bb9c53974580183c23e82cada844204350040d16 refs/review/12791
git diff 5c32f54c11 159d10a5a9
git diff --check origin/main...refs/review/12791
python3 tools/check_conventions.py --base origin/main
cmake --build build -j10 --target audio_out_mix_level_pad_spk_tests libSceAudioOut
cmake --build build -j10 --target libs
cmake --build build -j10
ctest --test-dir build -R audio_out_mix_level_pad_spk --output-on-failure
ctest --test-dir build -j4 -R "audio_out|public_headers" --output-on-failure

# negative control
git checkout origin/main -- core/libs/prx/libSceAudioOut/src/AudioOut.cpp core/libs/prx/libSceAudioOut/src/Unimplemented.cpp
cmake --build build -j10 --target audio_out_mix_level_pad_spk_tests
ctest --test-dir build -R audio_out_mix_level_pad_spk --output-on-failure
git checkout HEAD -- core/libs/prx/libSceAudioOut/src/
cmake --build build -j10 --target audio_out_mix_level_pad_spk_tests
ctest --test-dir build -R audio_out_mix_level_pad_spk
Check Result
Merge onto main Clean
git diff --check Clean
check_conventions.py All conventions checks passed.
Build (libSceAudioOut, libs, all) OK
audio_out_mix_level_pad_spk Passed, 0.44 s
audio_out|public_headers (117 tests) 117/117 pass
Negative control (production files from main) Fails as expected
Restored merged files Passed, 0.34 s
Negative control output
1/1 Test #1859: audio_out_mix_level_pad_spk ......Subprocess aborted***Exception:   0.37 sec
terminate called after throwing an instance of 'std::runtime_error'
  what():  sceAudioOutSetPadSpkVolume not implemented

Previous findings

  • Blocking 1, the test always aborts: Resolved. TestPadSpeakerVolume now uses the ±16384 block. The test passes on the merged tree and fails with the production files from main (see above). Tested still quotes only a standalone build. The ctest run above covers this.
  • Blocking 2, the behaviour comes from a call site: Still open. sceAudioOutSetPadSpkVolume is the same as before apart from the constant. It accepts 0–127, returns 0x80260009 / 0x8026000A in a fixed order, and stores the value. sceAudioOutGetPortState reports it. The debt entry now says all of this is assumed. Saying so is accurate, but the rules do not allow it. REVERSE_ENGINEERING.md on current main says that error codes, side effects and the values a title accepts which the call site leaves open must throw. It also says that "a write that drops its data, is not UI", so this does not qualify as a silent stub either (CONTRIBUTING.md). The stored volume does not reach the pad speaker output. The test confirms this: the output is still Scaled(block, defaultMixLevel) after the volume is set to 0. The earlier collaborator comment asked for the "assumed" wording, and the branch now has it. That wording records the gap, but it does not make the export acceptable under the rule.
  • Non-blocking 1, description and literals: Resolved. The description matches the branch, and PADSPK_VOLUME_MAX replaces the literals.

New findings

Blocking

None beyond the open finding above.

Non-blocking

  1. sceAudioOutGetPortState now reports PADSPK_VOLUME_MAX as volume for main, BGM, voice and every other non-pad-speaker port. The value is still 127, as on main, but the constant's name ties it to the pad speaker. If this code stays, use a neutral constant for the other ports' reported volume.

Not verified

  • What sceAudioOutSetPadSpkVolume does on a console: range, error codes, check order, effect on the output and on GetPortState. The PR and the tree still give no source for any of this.
  • That PPSA99810 gets past the crash. I did not run the title.
  • The Windows build and tests.

To get this to a good state

  1. Base the behaviour on a source the rules accept, such as the export's disassembly from a PS5 libSceAudioOut module (the debt file already cites the 13.60 module for sceAudioOut2LoTerminate) or a console measurement. Implement what it shows, including applying the volume to the pad speaker output if the console does. Cite the source in the debt entry.
  2. Until there is such a source, keep the export throwing (NotImplemented_nid_no_patch) and keep the original Unknown function info entry.
<!-- greyfinch-sync:boykopovar/AnyPS5:review:5697136165 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/12791#pullrequestreview-5697136165). Originally posted by [XairRrR](https://github.com/XairRrR) on 2026-10-29T11:45:47Z. **Review:** CHANGES_REQUESTED --- # Re-checked — changes still requested The new commit fixes the test input block and adds the named constant, and the test now passes and fails without the change as it should; the export still implements a range, error codes and a `GetPortState` effect that come only from the title's call site. ## What changed since my last review - New head commit `159d10a5a9` on top of `5c32f54c11`, which is the same patch as the previously reviewed `bb9c539745` rebased on newer `main`. The range-diff shows no other change. - `TestPadSpeakerVolume` now uses a ±16384 alternating block instead of `Ramp()`. - `PADSPK_VOLUME_MAX = 127` replaces the three literal `127`s in `AudioOut.cpp`. - The description now says *Silent stubs*, names the constant and drops the Windows error code. - In the author's comment of 11:32 UTC, the debt entry stays under *Silent stubs* with the "assumed, not console-measured" wording. That comment does not answer the second blocking finding: where the behaviour comes from. ## What I ran Head `159d10a5a9009d88d693e181fb7819eb97a9b618`, merged with `--no-ff` onto `main` `ba5b5330b37724bca4b99f30faab504653635a04` (no conflicts), in a clean worktree. Arch Linux 7.2.11-zen, GCC 16.2.1, Intel Core i9-14900KF, NVIDIA GeForce RTX 4070 Ti SUPER (driver 615.78.08), Release build with Ninja. ``` git range-diff origin/main bb9c53974580183c23e82cada844204350040d16 refs/review/12791 git diff 5c32f54c11 159d10a5a9 git diff --check origin/main...refs/review/12791 python3 tools/check_conventions.py --base origin/main cmake --build build -j10 --target audio_out_mix_level_pad_spk_tests libSceAudioOut cmake --build build -j10 --target libs cmake --build build -j10 ctest --test-dir build -R audio_out_mix_level_pad_spk --output-on-failure ctest --test-dir build -j4 -R "audio_out|public_headers" --output-on-failure # negative control git checkout origin/main -- core/libs/prx/libSceAudioOut/src/AudioOut.cpp core/libs/prx/libSceAudioOut/src/Unimplemented.cpp cmake --build build -j10 --target audio_out_mix_level_pad_spk_tests ctest --test-dir build -R audio_out_mix_level_pad_spk --output-on-failure git checkout HEAD -- core/libs/prx/libSceAudioOut/src/ cmake --build build -j10 --target audio_out_mix_level_pad_spk_tests ctest --test-dir build -R audio_out_mix_level_pad_spk ``` | Check | Result | | --- | --- | | Merge onto `main` | Clean | | `git diff --check` | Clean | | `check_conventions.py` | `All conventions checks passed.` | | Build (`libSceAudioOut`, `libs`, all) | OK | | `audio_out_mix_level_pad_spk` | Passed, 0.44 s | | `audio_out\|public_headers` (117 tests) | 117/117 pass | | Negative control (production files from `main`) | Fails as expected | | Restored merged files | Passed, 0.34 s | <details><summary>Negative control output</summary> ``` 1/1 Test #1859: audio_out_mix_level_pad_spk ......Subprocess aborted***Exception: 0.37 sec terminate called after throwing an instance of 'std::runtime_error' what(): sceAudioOutSetPadSpkVolume not implemented ``` </details> ## Previous findings - **Blocking 1, the test always aborts:** Resolved. [`TestPadSpeakerVolume`](https://github.com/boykopovar/AnyPS5/blob/159d10a5a9009d88d693e181fb7819eb97a9b618/core/libs/prx/libSceAudioOut/tests/AudioOutMixLevelPadSpk.cpp#L169-L171) now uses the ±16384 block. The test passes on the merged tree and fails with the production files from `main` (see above). *Tested* still quotes only a standalone build. The `ctest` run above covers this. - **Blocking 2, the behaviour comes from a call site:** Still open. [`sceAudioOutSetPadSpkVolume`](https://github.com/boykopovar/AnyPS5/blob/159d10a5a9009d88d693e181fb7819eb97a9b618/core/libs/prx/libSceAudioOut/src/AudioOut.cpp#L697-L711) is the same as before apart from the constant. It accepts 0–127, returns 0x80260009 / 0x8026000A in a fixed order, and stores the value. [`sceAudioOutGetPortState`](https://github.com/boykopovar/AnyPS5/blob/159d10a5a9009d88d693e181fb7819eb97a9b618/core/libs/prx/libSceAudioOut/src/AudioOut.cpp#L594) reports it. The [debt entry](https://github.com/boykopovar/AnyPS5/blob/159d10a5a9009d88d693e181fb7819eb97a9b618/docs/dev/debt/libSceAudioOut.md#L5) now says all of this is assumed. Saying so is accurate, but the rules do not allow it. [REVERSE_ENGINEERING.md](https://github.com/boykopovar/AnyPS5/blob/ba5b5330b37724bca4b99f30faab504653635a04/docs/dev/REVERSE_ENGINEERING.md#L38-L43) on current `main` says that error codes, side effects and the values a title accepts which the call site leaves open must throw. It also says that "a write that drops its data, is not UI", so this does not qualify as a silent stub either ([CONTRIBUTING.md](https://github.com/boykopovar/AnyPS5/blob/ba5b5330b37724bca4b99f30faab504653635a04/CONTRIBUTING.md#L9-L10)). The stored volume does not reach the pad speaker output. The test confirms this: the output is still `Scaled(block, defaultMixLevel)` after the volume is set to 0. The earlier collaborator comment asked for the "assumed" wording, and the branch now has it. That wording records the gap, but it does not make the export acceptable under the rule. - **Non-blocking 1, description and literals:** Resolved. The description matches the branch, and `PADSPK_VOLUME_MAX` replaces the literals. ## New findings ### Blocking None beyond the open finding above. ### Non-blocking 1. [`sceAudioOutGetPortState`](https://github.com/boykopovar/AnyPS5/blob/159d10a5a9009d88d693e181fb7819eb97a9b618/core/libs/prx/libSceAudioOut/src/AudioOut.cpp#L594) now reports `PADSPK_VOLUME_MAX` as `volume` for main, BGM, voice and every other non-pad-speaker port. The value is still 127, as on `main`, but the constant's name ties it to the pad speaker. If this code stays, use a neutral constant for the other ports' reported volume. ## Not verified - What `sceAudioOutSetPadSpkVolume` does on a console: range, error codes, check order, effect on the output and on `GetPortState`. The PR and the tree still give no source for any of this. - That PPSA99810 gets past the crash. I did not run the title. - The Windows build and tests. ## To get this to a good state 1. Base the behaviour on a source the rules accept, such as the export's disassembly from a PS5 `libSceAudioOut` module (the debt file already cites the 13.60 module for `sceAudioOut2LoTerminate`) or a console measurement. Implement what it shows, including applying the volume to the pad speaker output if the console does. Cite the source in the debt entry. 2. Until there is such a source, keep the export throwing (`NotImplemented_nid_no_patch`) and keep the original *Unknown function info* entry.
XairRrR commented 2026-11-02 21:23:35 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by XairRrR on 2026-11-02T21:23:35Z.

Review: CHANGES_REQUESTED


Re-checked — changes still requested

The new commit applies the pad speaker volume to the output as a linear volume / 127 gain, adds a test that volume 0 mutes the output, and adds a neutral constant for the volume GetPortState reports on other ports. The range, the error codes, the check order and now the gain law still come only from the title's call site.

What changed since my last review

  • Head is now 659c03096b, one commit replacing 5c32f54c11 + 159d10a5a9.
  • prepareBuffer multiplies pad speaker samples by padSpkVolume / PADSPK_VOLUME_MAX, for both float and S16.
  • DEFAULT_PORT_STATE_VOLUME = 127 is now the volume sceAudioOutGetPortState reports for ports that are not pad speakers.
  • TestPadSpeakerVolume adds a playback with volume 0 that must be silent, and checks the reported volume of a main port.
  • The debt entry is still under Silent stubs. It now says the export scales the output linearly, and lists that linear scaling among the assumptions.
  • The description and the author's comment of 2026-10-29 16:09 UTC describe these changes. No reply addresses where the behaviour comes from.

What I ran

Head 659c03096b914e1a46d9a2d5b9985f5db9e8b9bc, merged with --no-ff onto main 9090972b7e91fd266819cbd77a8b058e177b5682 (merged tree 1f07e2e621), in a clean worktree. Debian 13 VM, GCC 14.2.0, Release, Ninja. The script built the merged tree and ran the selected tests.

git diff --check 9090972b7e91fd266819cbd77a8b058e177b5682...659c03096b914e1a46d9a2d5b9985f5db9e8b9bc
python3 tools/check_conventions.py --base 9090972b7e91fd266819cbd77a8b058e177b5682
ctest --test-dir build -R "audio_out_mix_level_pad_spk|public_headers" --output-on-failure
ctest --test-dir build -R "^audio_out_mix_level_pad_spk$" --output-on-failure

# negative control 1: AudioOut.cpp and Unimplemented.cpp from main
git show 9090972b7e:<file> > <file>
ninja -C build audio_out_mix_level_pad_spk_tests
ctest --test-dir build -R "^audio_out_mix_level_pad_spk$" --output-on-failure

# negative control 2: merged tree minus the S16 gain line `s = s * padVol / PADSPK_VOLUME_MAX;`
ninja -C build audio_out_mix_level_pad_spk_tests
ctest --test-dir build -R "^audio_out_mix_level_pad_spk$" --output-on-failure

# restore after each control
git show 1f07e2e621:<file> > <file>
ninja -C build audio_out_mix_level_pad_spk_tests
ctest --test-dir build -R "^audio_out_mix_level_pad_spk$"
git status --porcelain
Check Result
git diff --check Clean
check_conventions.py All conventions checks passed.
Script build and tests (build.json) 759 of 761 passed. The one failure, unwrap_self, also fails on main; one test was skipped as expected. No new failures or timeouts
audio_out_mix_level_pad_spk + public_headers* (66 tests) All passed (exit 0)
audio_out_mix_level_pad_spk alone Passed, 0.29 s
Negative control 1 (production files from main) Fails (Subprocess aborted)
Negative control 2 (S16 gain line removed) Fails (Subprocess aborted)
Restored merged tree Passes; git status --porcelain is empty

Previous findings

  • Blocking 1, the test always aborted: Resolved, and it stays resolved. The test passes on the merged tree and fails with the production files from main.

  • Blocking 2, the behaviour comes from a call site: Still open. The new commit removes one half of the objection: the volume now reaches the output, so the export no longer stores a value without using it. Everything else is still unsourced:

    • the 0–127 range;
    • the error codes 0x80260009 and 0x8026000A;
    • the order of the checks: handle, then volume, then port type (AudioOut.cpp#L704-L718);
    • the new linear gain law;
    • the GetPortState value.

    The debt entry itself calls all of this "assumed, not console-measured". REVERSE_ENGINEERING.md on current main says that error codes, side effects and the values a title accepts, when the call site leaves them open, must throw. The entry is also in the wrong section:

    • The export changes audio output, which is not UI, so it is not a silent stub as CONTRIBUTING.md defines one.
    • The entry describes behaviour the export implements, not a stub.
  • Non-blocking 1, description and literals: Resolved, and it stays resolved.

  • Non-blocking 2, PADSPK_VOLUME_MAX reported for non-pad ports: Resolved. Other ports now report DEFAULT_PORT_STATE_VOLUME (L601). The test checks that a main port reports 127.

New findings

Blocking

None beyond the open finding above.

Non-blocking

  1. The new output check covers only volume 0 (silence) and 127 (unchanged) (test L200-L202). At volume 64 the test reads back only GetPortState, so any mapping with 0 → silent and 127 → unity would pass. The S16 path also divides twice: first by the mix level and channel volume, then by PADSPK_VOLUME_MAX (L247). Each division truncates toward zero. If a sourced gain law is ever added, check an intermediate level against exact expected samples, and fold the factor into a single division.

Not verified

  • What sceAudioOutSetPadSpkVolume does on a console: range, error codes, check order, gain law and the GetPortState value. The PR and the tree still give no source for any of this.
  • That PPSA99810 gets past the crash. I did not run the title.
  • Windows: maskym reports a passing joint run at this head. I did not repeat it.

To get this to a good state

  1. Base the behaviour on a source the rules accept: the export's disassembly from a PS5 libSceAudioOut module (the debt file already cites the 13.60 module for sceAudioOut2LoTerminate), or a console measurement. Implement what that source shows, cite it in the debt entry, and move the entry out of Silent stubs, keeping only what is still unverified.
  2. Until there is such a source, keep the export throwing (NotImplemented_nid_no_patch) and restore the original Unknown function info entry.
<!-- greyfinch-sync:boykopovar/AnyPS5:review:5743553174 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/12791#pullrequestreview-5743553174). Originally posted by [XairRrR](https://github.com/XairRrR) on 2026-11-02T21:23:35Z. **Review:** CHANGES_REQUESTED --- # Re-checked — changes still requested The new commit applies the pad speaker volume to the output as a linear `volume / 127` gain, adds a test that volume 0 mutes the output, and adds a neutral constant for the volume `GetPortState` reports on other ports. The range, the error codes, the check order and now the gain law still come only from the title's call site. ## What changed since my last review - Head is now `659c03096b`, one commit replacing `5c32f54c11` + `159d10a5a9`. - [`prepareBuffer`](https://github.com/boykopovar/AnyPS5/blob/659c03096b914e1a46d9a2d5b9985f5db9e8b9bc/core/libs/prx/libSceAudioOut/src/AudioOut.cpp#L228-L247) multiplies pad speaker samples by `padSpkVolume / PADSPK_VOLUME_MAX`, for both float and S16. - `DEFAULT_PORT_STATE_VOLUME = 127` is now the volume [`sceAudioOutGetPortState`](https://github.com/boykopovar/AnyPS5/blob/659c03096b914e1a46d9a2d5b9985f5db9e8b9bc/core/libs/prx/libSceAudioOut/src/AudioOut.cpp#L601) reports for ports that are not pad speakers. - `TestPadSpeakerVolume` adds a playback with volume 0 that must be silent, and checks the reported volume of a main port. - The debt entry is still under *Silent stubs*. It now says the export scales the output linearly, and lists that linear scaling among the assumptions. - The description and the author's comment of 2026-10-29 16:09 UTC describe these changes. No reply addresses where the behaviour comes from. ## What I ran Head `659c03096b914e1a46d9a2d5b9985f5db9e8b9bc`, merged with `--no-ff` onto `main` `9090972b7e91fd266819cbd77a8b058e177b5682` (merged tree `1f07e2e621`), in a clean worktree. Debian 13 VM, GCC 14.2.0, Release, Ninja. The script built the merged tree and ran the selected tests. ``` git diff --check 9090972b7e91fd266819cbd77a8b058e177b5682...659c03096b914e1a46d9a2d5b9985f5db9e8b9bc python3 tools/check_conventions.py --base 9090972b7e91fd266819cbd77a8b058e177b5682 ctest --test-dir build -R "audio_out_mix_level_pad_spk|public_headers" --output-on-failure ctest --test-dir build -R "^audio_out_mix_level_pad_spk$" --output-on-failure # negative control 1: AudioOut.cpp and Unimplemented.cpp from main git show 9090972b7e:<file> > <file> ninja -C build audio_out_mix_level_pad_spk_tests ctest --test-dir build -R "^audio_out_mix_level_pad_spk$" --output-on-failure # negative control 2: merged tree minus the S16 gain line `s = s * padVol / PADSPK_VOLUME_MAX;` ninja -C build audio_out_mix_level_pad_spk_tests ctest --test-dir build -R "^audio_out_mix_level_pad_spk$" --output-on-failure # restore after each control git show 1f07e2e621:<file> > <file> ninja -C build audio_out_mix_level_pad_spk_tests ctest --test-dir build -R "^audio_out_mix_level_pad_spk$" git status --porcelain ``` | Check | Result | | --- | --- | | `git diff --check` | Clean | | `check_conventions.py` | `All conventions checks passed.` | | Script build and tests (build.json) | 759 of 761 passed. The one failure, `unwrap_self`, also fails on `main`; one test was skipped as expected. No new failures or timeouts | | `audio_out_mix_level_pad_spk` + `public_headers*` (66 tests) | All passed (exit 0) | | `audio_out_mix_level_pad_spk` alone | Passed, 0.29 s | | Negative control 1 (production files from `main`) | Fails (Subprocess aborted) | | Negative control 2 (S16 gain line removed) | Fails (Subprocess aborted) | | Restored merged tree | Passes; `git status --porcelain` is empty | ## Previous findings - **Blocking 1, the test always aborted:** Resolved, and it stays resolved. The test passes on the merged tree and fails with the production files from `main`. - **Blocking 2, the behaviour comes from a call site:** Still open. The new commit removes one half of the objection: the volume now reaches the output, so the export no longer stores a value without using it. Everything else is still unsourced: - the 0–127 range; - the error codes 0x80260009 and 0x8026000A; - the order of the checks: handle, then volume, then port type ([`AudioOut.cpp#L704-L718`](https://github.com/boykopovar/AnyPS5/blob/659c03096b914e1a46d9a2d5b9985f5db9e8b9bc/core/libs/prx/libSceAudioOut/src/AudioOut.cpp#L704-L718)); - the new linear gain law; - the `GetPortState` value. The [debt entry](https://github.com/boykopovar/AnyPS5/blob/659c03096b914e1a46d9a2d5b9985f5db9e8b9bc/docs/dev/debt/libSceAudioOut.md#L5) itself calls all of this "assumed, not console-measured". [REVERSE_ENGINEERING.md](https://github.com/boykopovar/AnyPS5/blob/9090972b7e91fd266819cbd77a8b058e177b5682/docs/dev/REVERSE_ENGINEERING.md#L38-L43) on current `main` says that error codes, side effects and the values a title accepts, when the call site leaves them open, must throw. The entry is also in the wrong section: - The export changes audio output, which is not UI, so it is not a silent stub as [CONTRIBUTING.md](https://github.com/boykopovar/AnyPS5/blob/9090972b7e91fd266819cbd77a8b058e177b5682/CONTRIBUTING.md#L10) defines one. - The entry describes behaviour the export implements, not a stub. - **Non-blocking 1, description and literals:** Resolved, and it stays resolved. - **Non-blocking 2, `PADSPK_VOLUME_MAX` reported for non-pad ports:** Resolved. Other ports now report `DEFAULT_PORT_STATE_VOLUME` ([L601](https://github.com/boykopovar/AnyPS5/blob/659c03096b914e1a46d9a2d5b9985f5db9e8b9bc/core/libs/prx/libSceAudioOut/src/AudioOut.cpp#L601)). The test checks that a main port reports 127. ## New findings ### Blocking None beyond the open finding above. ### Non-blocking 1. The new output check covers only volume 0 (silence) and 127 (unchanged) ([test L200-L202](https://github.com/boykopovar/AnyPS5/blob/659c03096b914e1a46d9a2d5b9985f5db9e8b9bc/core/libs/prx/libSceAudioOut/tests/AudioOutMixLevelPadSpk.cpp#L200-L202)). At volume 64 the test reads back only `GetPortState`, so any mapping with 0 → silent and 127 → unity would pass. The S16 path also divides twice: first by the mix level and channel volume, then by `PADSPK_VOLUME_MAX` ([L247](https://github.com/boykopovar/AnyPS5/blob/659c03096b914e1a46d9a2d5b9985f5db9e8b9bc/core/libs/prx/libSceAudioOut/src/AudioOut.cpp#L247)). Each division truncates toward zero. If a sourced gain law is ever added, check an intermediate level against exact expected samples, and fold the factor into a single division. ## Not verified - What `sceAudioOutSetPadSpkVolume` does on a console: range, error codes, check order, gain law and the `GetPortState` value. The PR and the tree still give no source for any of this. - That PPSA99810 gets past the crash. I did not run the title. - Windows: maskym reports a passing joint run at this head. I did not repeat it. ## To get this to a good state 1. Base the behaviour on a source the rules accept: the export's disassembly from a PS5 `libSceAudioOut` module (the debt file already cites the 13.60 module for `sceAudioOut2LoTerminate`), or a console measurement. Implement what that source shows, cite it in the debt entry, and move the entry out of *Silent stubs*, keeping only what is still unverified. 2. Until there is such a source, keep the export throwing (`NotImplemented_nid_no_patch`) and restore the original *Unknown function info* entry. <!-- anyps5-bots job=2518 head=659c03096b914e1a46d9a2d5b9985f5db9e8b9bc -->

Pull request closed

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
boykopovar/AnyPS5!12791
No description provided.