fix(voice): accept valid worker priorities and affinities in sceVoiceSetThreadsParams #9730

Merged
dantdmdarealguy merged 1 commit from upstream-pr/9730 into main 2026-10-23 01:01:05 +00:00
dantdmdarealguy commented 2026-10-22 10:17:42 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by dantdmdarealguy on 2026-10-22T10:17:42Z.


What

sceVoiceSetThreadsParams mode 1 has thrown for every input since fe4016f61. Grand Theft Auto V (PPSA04264) calls it right after sceVoiceInit and aborts on current main (7e2ba73e4):

[libc] unhandled exception 'St11logic_error' thrown from 00007ffd403e6e43
terminate called after throwing an instance of 'std::logic_error'
  what():  sceVoiceSetThreadsParams: worker priority and affinity are not implemented
FATAL: abort() (SIGABRT) on thread 65100
    [rsp+0x3f8] 0x00000001422fb35a app.exe+0x22fb35a

The call is at eboot 0x22eb355. It runs after sceVoiceInit({app_type 0x10000000}, 100) and passes mode 1 with priority 700 (0x2bc) and affinity mask 0x7f for all three workers.

Mode 1 now returns 0 when every priority is in 256-767 and every affinity mask is non-zero and within 0x1fff. This is the range a PS5 thread takes, and the range sceVideoOutOpen already accepts for its service thread (VIDEO_OUT_SERVICE_THREAD_PRIORITY_HIGHEST/LOWEST, VIDEO_OUT_SERVICE_THREAD_AFFINITY_ALL). Like sceVideoOutOpen and sceUserServiceInitialize2, the values reach no host scheduling: AnyPS5 runs no voice worker threads, as the existing sceVoiceStart debt entry says. Other priorities and masks still throw, because the console's result for them is unknown. The debt entry is cut down to that gap.

Tested

Windows 11 Pro, Intel Core i9-14900K, NVIDIA GeForce RTX 5080 (driver 32.0.16.1742), WinLibs GCC 15.2.0, Release.

  • ctest -R '^guest_voice$', which now covers GTA V's values, the range edges, and each out-of-range priority and mask in each of the three slots:
    • with main's Export.cpp: Exit code 0xc0000409 (the mode-1 throw);
    • with this change: Passed.
  • guest_voice_port_attr, guest_voice_chat, guest_voice_qos, guest_voice_qos_app_type_0x10000000 and patched_libraries pass. check_test_registration and check_conventions are clean.
  • Grand Theft Auto V 01.005.000, Story mode, default settings, 6 runs of 600-900 s:
    • main stops at the line above, 2 of 2 runs: at +271 s with empty caches, after the first-launch shader precompile, and at +14 s with warm caches.
    • With this change it gets past that call to the title screen, the landing menu, Resume Story and the North Yankton prologue, with the player moving on scripted pad input at 22-27 presents per 10 s.
    • The next stop is the open-world crash of #9136, which open PRs #9181 and #9159 address. It appears in the prologue on this machine.

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: PPSA04264 (Grand Theft Auto V, discussion #1203)
  • GPUs tested: n/a
  • AI-assisted: yes, some AI assistance was used
<!-- greyfinch-sync:boykopovar/AnyPS5:issue:4965765514 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/9730). Originally posted by [dantdmdarealguy](https://github.com/dantdmdarealguy) on 2026-10-22T10:17:42Z. --- ### What `sceVoiceSetThreadsParams` mode 1 has thrown for every input since fe4016f61. Grand Theft Auto V (PPSA04264) calls it right after `sceVoiceInit` and aborts on current `main` (7e2ba73e4): ``` [libc] unhandled exception 'St11logic_error' thrown from 00007ffd403e6e43 terminate called after throwing an instance of 'std::logic_error' what(): sceVoiceSetThreadsParams: worker priority and affinity are not implemented FATAL: abort() (SIGABRT) on thread 65100 [rsp+0x3f8] 0x00000001422fb35a app.exe+0x22fb35a ``` The call is at eboot `0x22eb355`. It runs after `sceVoiceInit({app_type 0x10000000}, 100)` and passes mode 1 with priority 700 (`0x2bc`) and affinity mask `0x7f` for all three workers. Mode 1 now returns 0 when every priority is in 256-767 and every affinity mask is non-zero and within `0x1fff`. This is the range a PS5 thread takes, and the range `sceVideoOutOpen` already accepts for its service thread (`VIDEO_OUT_SERVICE_THREAD_PRIORITY_HIGHEST`/`LOWEST`, `VIDEO_OUT_SERVICE_THREAD_AFFINITY_ALL`). Like `sceVideoOutOpen` and `sceUserServiceInitialize2`, the values reach no host scheduling: AnyPS5 runs no voice worker threads, as the existing `sceVoiceStart` debt entry says. Other priorities and masks still throw, because the console's result for them is unknown. The debt entry is cut down to that gap. ### Tested Windows 11 Pro, Intel Core i9-14900K, NVIDIA GeForce RTX 5080 (driver 32.0.16.1742), WinLibs GCC 15.2.0, Release. - `ctest -R '^guest_voice$'`, which now covers GTA V's values, the range edges, and each out-of-range priority and mask in each of the three slots: - with `main`'s `Export.cpp`: `Exit code 0xc0000409` (the mode-1 throw); - with this change: `Passed`. - `guest_voice_port_attr`, `guest_voice_chat`, `guest_voice_qos`, `guest_voice_qos_app_type_0x10000000` and `patched_libraries` pass. `check_test_registration` and `check_conventions` are clean. - Grand Theft Auto V 01.005.000, Story mode, default settings, 6 runs of 600-900 s: - `main` stops at the line above, 2 of 2 runs: at +271 s with empty caches, after the first-launch shader precompile, and at +14 s with warm caches. - With this change it gets past that call to the title screen, the landing menu, Resume Story and the North Yankton prologue, with the player moving on scripted pad input at 22-27 presents per 10 s. - The next stop is the open-world crash of #9136, which open PRs #9181 and #9159 address. It appears in the prologue on this machine. ### 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: PPSA04264 (Grand Theft Auto V, discussion #1203) - [x] GPUs tested: n/a - [x] AI-assisted: yes, some AI assistance was used
MarcZX10 commented 2026-10-22 11:57:19 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by MarcZX10 on 2026-10-22T11:57:19Z.


The implementation keeps valid mode-1 settings from affecting host scheduling and retains throwing behavior outside the evidenced range; the focused boundary tests and the GTA V red/green run are useful evidence. I checked the exact head: conventions and whitespace pass, and it merges cleanly, but current main is 4 commits ahead of the branch. Please refresh it and rerun guest_voice plus the overlap check before merge. The hosted full Linux/Windows jobs are skipped on this PR.

<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6340153653 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/9730#issuecomment-6340153653). Originally posted by [MarcZX10](https://github.com/MarcZX10) on 2026-10-22T11:57:19Z. --- The implementation keeps valid mode-1 settings from affecting host scheduling and retains throwing behavior outside the evidenced range; the focused boundary tests and the GTA V red/green run are useful evidence. I checked the exact head: conventions and whitespace pass, and it merges cleanly, but current `main` is 4 commits ahead of the branch. Please refresh it and rerun `guest_voice` plus the overlap check before merge. The hosted full Linux/Windows jobs are skipped on this PR.
CPritch commented 2026-10-22 13:01:13 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by CPritch on 2026-10-22T13:01:13Z.


A Linux data point, on the other region of GTA V (PPSA04263 01.010.002): Linux 7.2.8-zen1-2-zen, NVIDIA GeForce RTX 5060 Laptop GPU, NVIDIA 615.71.09, GCC Release build.

Without this change, main a6dcea927 aborts at start-up the same way (exit code 134):

[libc] unhandled exception 'St11logic_error' thrown from 0x7f8c9806c3c0
terminate called after throwing an instance of 'std::logic_error'
  what():  sceVoiceSetThreadsParams: worker priority and affinity are not implemented

With it, main 4777caca3 + ed8a900ca boots, loads the Story from Resume Story and runs the prologue: six sessions of 2.5 to 4 minutes, with no voice error in the log. The arguments of the call were not logged here.
Not tested: voice chat itself.
AI-assisted: yes

<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6341389677 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/9730#issuecomment-6341389677). Originally posted by [CPritch](https://github.com/CPritch) on 2026-10-22T13:01:13Z. --- A Linux data point, on the other region of GTA V (PPSA04263 01.010.002): Linux 7.2.8-zen1-2-zen, NVIDIA GeForce RTX 5060 Laptop GPU, NVIDIA 615.71.09, GCC Release build. Without this change, main a6dcea927 aborts at start-up the same way (exit code 134): ``` [libc] unhandled exception 'St11logic_error' thrown from 0x7f8c9806c3c0 terminate called after throwing an instance of 'std::logic_error' what(): sceVoiceSetThreadsParams: worker priority and affinity are not implemented ``` With it, main 4777caca3 + ed8a900ca boots, loads the Story from Resume Story and runs the prologue: six sessions of 2.5 to 4 minutes, with no voice error in the log. The arguments of the call were not logged here. Not tested: voice chat itself. AI-assisted: yes
harisibrar1 commented 2026-10-22 13:40:05 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by harisibrar1 on 2026-10-22T13:40:05Z.

Review: APPROVED


Checked against main 8b3e39832a, shadPS4 c1b26558 (voice.cpp) and ps5-payload-dev/sdk a7685ce8:

  • This still merges cleanly with main at 8b3e39832a, and main has no libSceVoice commits since your base, so the refresh asked for earlier should be a no-op.
  • The accepted range matches main's own constants: 256..767, as in scePthreadAttrSetschedparam (libkernel/Pthread/src/Attr.cpp) and VIDEO_OUT_SERVICE_THREAD_PRIORITY_HIGHEST/LOWEST, and masks within DEFAULT_THREAD_AFFINITY/sceKernelGetAvailableCpumask() = 0x1FFF, non-zero as in sceVideoOutOpen. libkernel's POSIX sched path also accepts 896..959; those still throw here, which is the safe side.
  • The VoiceThreadsParams layout in SceTypes.hpp matches the 9-field initialisers in the new tests.
  • shadPS4 returns OK unconditionally, so this is stricter than the other reference implementation, which is good.
  • Small optional point: libSceVideoOut.md lists the same "validated but not applied" priority/affinity case under ### Silent stubs. It might be worth a ### Silent stubs heading in libSceVoice.md for consistency, though libSceUserService.md does it the way you did, so either seems defensible.

Reviewed with AI assistance (Claude Code); the checks above were run locally on my machine.

<!-- greyfinch-sync:boykopovar/AnyPS5:review:5615136587 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/9730#pullrequestreview-5615136587). Originally posted by [harisibrar1](https://github.com/harisibrar1) on 2026-10-22T13:40:05Z. **Review:** APPROVED --- Checked against main 8b3e39832a, shadPS4 c1b26558 (`voice.cpp`) and ps5-payload-dev/sdk a7685ce8: - This still merges cleanly with main at 8b3e39832a, and main has no libSceVoice commits since your base, so the refresh asked for earlier should be a no-op. - The accepted range matches main's own constants: 256..767, as in `scePthreadAttrSetschedparam` (`libkernel/Pthread/src/Attr.cpp`) and `VIDEO_OUT_SERVICE_THREAD_PRIORITY_HIGHEST/LOWEST`, and masks within `DEFAULT_THREAD_AFFINITY`/`sceKernelGetAvailableCpumask()` = 0x1FFF, non-zero as in `sceVideoOutOpen`. libkernel's POSIX sched path also accepts 896..959; those still throw here, which is the safe side. - The `VoiceThreadsParams` layout in `SceTypes.hpp` matches the 9-field initialisers in the new tests. - shadPS4 returns OK unconditionally, so this is stricter than the other reference implementation, which is good. - Small optional point: `libSceVideoOut.md` lists the same "validated but not applied" priority/affinity case under `### Silent stubs`. It might be worth a `### Silent stubs` heading in `libSceVoice.md` for consistency, though `libSceUserService.md` does it the way you did, so either seems defensible. Reviewed with AI assistance (Claude Code); the checks above were run locally on my machine.
MarcZX10 commented 2026-10-22 15:18:11 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by MarcZX10 on 2026-10-22T15:18:11Z.

Review: APPROVED


The mode-1 validation is narrowly bounded to the reported PS5 priority and affinity ranges, preserves mode-0 behavior, and still rejects unsupported values without applying host scheduling. The new tests cover each worker slot and the pre/post-start state behavior. I found no blocking defect.

Local checks on exact head ed8a900caf92bbc7f5de356d1cdd727361b184d8: g++ -std=c++20 -fsyntax-only passed for Export.cpp and GuestVoice.cpp; git diff --check and conventions passed. The current-main merge tree is clean, and no commits since the PR base changed the touched files. Runtime CTest and GTA V A/B results are author-reported, not local runs. Hosted product Linux/Windows jobs are skipped on this PR.

<!-- greyfinch-sync:boykopovar/AnyPS5:review:5616527294 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/9730#pullrequestreview-5616527294). Originally posted by [MarcZX10](https://github.com/MarcZX10) on 2026-10-22T15:18:11Z. **Review:** APPROVED --- The mode-1 validation is narrowly bounded to the reported PS5 priority and affinity ranges, preserves mode-0 behavior, and still rejects unsupported values without applying host scheduling. The new tests cover each worker slot and the pre/post-start state behavior. I found no blocking defect. Local checks on exact head `ed8a900caf92bbc7f5de356d1cdd727361b184d8`: `g++ -std=c++20 -fsyntax-only` passed for `Export.cpp` and `GuestVoice.cpp`; `git diff --check` and conventions passed. The current-main merge tree is clean, and no commits since the PR base changed the touched files. Runtime CTest and GTA V A/B results are author-reported, not local runs. Hosted product Linux/Windows jobs are skipped on this PR.
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!9730
No description provided.