feat(libSceVoice): implement sceVoiceInitHQ and sceVoiceVADSetVersion #9082

Merged
YossiYad merged 5 commits from upstream-pr/9082 into main 2026-10-23 02:37:55 +00:00
YossiYad commented 2026-10-21 11:58:43 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by YossiYad on 2026-10-21T11:58:43Z.


What

Two libSceVoice calls threw. They now follow shadPS4's voice.cpp:

  • sceVoiceInitHQ(param, version) runs sceVoiceInit: shadPS4's two calls share one init path. A second init through either returns 0x804E0802, and after sceVoiceEnd either initializes again. A null parameter returns 0x804E0805 from both, as in shadPS4, since sceVoiceInit on main now checks its arguments (version 100 and a known app type).
  • sceVoiceVADSetVersion(version) accepts 0 and 1 and returns ARGUMENT_INVALID (0x804E0805, shadPS4's voice_error.h) for any other version. It does not need the library to be initialized, as in shadPS4. The version is not used, since no voice activity detection runs.

Neither is measured on a PS5; the debt entry says so, and the two "unknown signature" lines are removed.

Tested

Linux (Fedora 44, GCC, Ninja, -DBUILD_TESTING=ON), based on main 47fa6eecf8:

  • guest_voice (core/libs/tests/GuestVoice.cpp) gains VAD versions 0, 1, 2 and -1, sceVoiceInitHQ with a null parameter and a wrong version, initializing through it, the busy result from both init calls, starting after it, and sceVoiceInitHQ refusing after a plain sceVoiceInit. It aborts on main, and fails when sceVoiceInitHQ returns 0 without initializing, when version 1 is refused, or when every non-negative version is accepted.
  • Full ctest: 1790 of 1798 pass. The 8 failures fail the same way on main on this machine and do not link libSceVoice: application_heap_scripting, application_heap_lazy, agc_driver_guest_memory_lifetime, agc_driver_image_array_window_past_layer_limit, agc_driver_tessellation and the three net_dontwait_blocking_* cases.
  • tools/progress.py --compare: libraries +0.02%, 2 functions implemented, none lost.
  • tools/check_conventions.py --base upstream/main passes. tools/pr_overlap.py lists #8989 (other libSceVoice functions: mute-all, bitrate, port update) and #6044 as editing the same files; neither implements these two.

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: none
  • GPUs tested: n/a
  • AI-assisted: yes
<!-- greyfinch-sync:boykopovar/AnyPS5:issue:4951163256 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/9082). Originally posted by [YossiYad](https://github.com/YossiYad) on 2026-10-21T11:58:43Z. --- ### What Two libSceVoice calls threw. They now follow [shadPS4's voice.cpp](https://github.com/shadps4-emu/shadPS4/blob/a808e76/src/core/libraries/voice/voice.cpp): - `sceVoiceInitHQ(param, version)` runs `sceVoiceInit`: shadPS4's two calls share one init path. A second init through either returns `0x804E0802`, and after `sceVoiceEnd` either initializes again. A null parameter returns `0x804E0805` from both, as in shadPS4, since `sceVoiceInit` on `main` now checks its arguments (version 100 and a known app type). - `sceVoiceVADSetVersion(version)` accepts 0 and 1 and returns `ARGUMENT_INVALID` (`0x804E0805`, shadPS4's voice_error.h) for any other version. It does not need the library to be initialized, as in shadPS4. The version is not used, since no voice activity detection runs. Neither is measured on a PS5; the debt entry says so, and the two "unknown signature" lines are removed. ### Tested Linux (Fedora 44, GCC, Ninja, `-DBUILD_TESTING=ON`), based on `main` `47fa6eecf8`: - `guest_voice` (`core/libs/tests/GuestVoice.cpp`) gains VAD versions 0, 1, 2 and -1, `sceVoiceInitHQ` with a null parameter and a wrong version, initializing through it, the busy result from both init calls, starting after it, and `sceVoiceInitHQ` refusing after a plain `sceVoiceInit`. It aborts on `main`, and fails when `sceVoiceInitHQ` returns 0 without initializing, when version 1 is refused, or when every non-negative version is accepted. - Full `ctest`: 1790 of 1798 pass. The 8 failures fail the same way on `main` on this machine and do not link libSceVoice: `application_heap_scripting`, `application_heap_lazy`, `agc_driver_guest_memory_lifetime`, `agc_driver_image_array_window_past_layer_limit`, `agc_driver_tessellation` and the three `net_dontwait_blocking_*` cases. - `tools/progress.py --compare`: libraries +0.02%, 2 functions implemented, none lost. - `tools/check_conventions.py --base upstream/main` passes. `tools/pr_overlap.py` lists #8989 (other libSceVoice functions: mute-all, bitrate, port update) and #6044 as editing the same files; neither implements these two. ### Checklist <!-- Rules behind each item: https://github.com/boykopovar/AnyPS5/blob/main/CONTRIBUTING.md --> - [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: none - [x] GPUs tested: n/a - [x] AI-assisted: yes
YossiYad commented 2026-10-22 05:33:55 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by YossiYad on 2026-10-22T05:33:55Z.


Rebased onto main da54c652e (head a596bc316). main reworked sceVoiceInit: it now needs version 100 and a known app type, and returns 0x804E0805 for a null parameter. sceVoiceInitHQ still calls it, so a null parameter now gets 0x804E0805 here too, as in shadPS4. The test uses version 100 and also checks a wrong version, sceVoiceVADSetVersion uses main's InvalidArgument constant, and I removed the line in the debt entry about the null parameter differing from shadPS4. guest_voice passes 3 of 3.

<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6333560289 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/9082#issuecomment-6333560289). Originally posted by [YossiYad](https://github.com/YossiYad) on 2026-10-22T05:33:55Z. --- Rebased onto `main` `da54c652e` (head `a596bc316`). `main` reworked `sceVoiceInit`: it now needs version 100 and a known app type, and returns `0x804E0805` for a null parameter. `sceVoiceInitHQ` still calls it, so a null parameter now gets `0x804E0805` here too, as in shadPS4. The test uses version 100 and also checks a wrong version, `sceVoiceVADSetVersion` uses `main`'s `InvalidArgument` constant, and I removed the line in the debt entry about the null parameter differing from shadPS4. `guest_voice` passes 3 of 3.
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!9082
No description provided.