feat(libSceVoiceQoS): implement packet and local endpoint attribute functions to unblock Aliens: Fireteam Elite #7727

Merged
leorossi2005 merged 3 commits from upstream-pr/7727 into main 2026-10-20 15:50:26 +00:00
leorossi2005 commented 2026-10-19 03:16:34 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by leorossi2005 on 2026-10-19T03:16:34Z.


What

Implements sceVoiceQoSGetLocalEndpointAttribute, sceVoiceQoSReadPacket, and sceVoiceQoSWritePacket in libSceVoiceQoS.

Signatures, register conventions, buffer structures, and return handling were reconstructed via x86_64 binary disassembly of Aliens: Fireteam Elite (PPSA03393, eboot.bin):

  1. sceVoiceQoSGetLocalEndpointAttribute (NID eZu2RP0Ma3w, call site 0x76D132):
  76d11e: lea -0x2041(%rbp), %rdx       # arg 3: void* value (out buffer)
  76d125: mov $0x1, %ecx                # arg 4: int32_t size (1 byte)
  76d12a: mov 0x10(%rsi), %edi          # arg 1: int32_t localId
  76d12d: mov $0x1, %esi                # arg 2: int32_t attributeId
  76d132: call sceVoiceQoSGetLocalEndpointAttribute
  76d137: test %eax, %eax
  76d139: jne  0x76d2fa                 # error jump if nonzero
  76d13f: cmpb $0x0, -0x2041(%rbp)      # checks returned attribute byte
  • Reads attributes previously stored for the local endpoint via SetLocalEndpointAttribute; if unset, zeroes the destination buffer and returns 0.
  1. sceVoiceQoSReadPacket (NID PWokFqab5q4, call site 0x76D16E):
  76d14c: movl $0x2000, -0x2048(%rbp)   # buffer capacity = 0x2000 (8192 bytes)
  76d156: lea  -0x2030(%rbp), %r14      # packet destination buffer
  76d15d: lea  -0x2048(%rbp), %rdx      # arg 3: uint32_t* pSize
  76d164: mov  0x18(%r12), %rax         # connection struct
  76d169: mov  %r14, %rsi               # arg 2: void* buffer
  76d16c: mov  (%rax), %edi             # arg 1: int32_t connectionId
  76d16e: call sceVoiceQoSReadPacket
  76d173: test %eax, %eax
  76d175: je   0x76d1c1                 # jumps to size check on success
  ...
  76d1c1: mov  -0x2048(%rbp), %eax      # reads *pSize
  76d1cc: test %eax, %eax
  76d1ce: je   0x76d2fa                 # if *pSize == 0, cleanly exits packet loop

Verified by the caller's internal logging format string:
log"sceVoiceQoSReadPacket() failed for connection id %d. Error code %#x"

  • Returns 0 with *size = 0 when no voice packets are queued in the receive buffer, allowing games to exit the polling loop cleanly without triggering timeout or logout cycles.
  1. sceVoiceQoSWritePacket (NID SpxLratrO1Q, call site 0x76CECB):
  76ceae: mov    (%rdi), %edi           # arg 1: int32_t connectionId
  76ceb9: movzwl 0x30(%rsi), %eax       # packet length
  76cec0: lea    -0x24(%rbp), %rdx      # arg 3: uint32_t* pSize
  76cec4: mov    %eax, -0x24(%rbp)
  76cec7: mov    0x38(%rsi), %rsi       # arg 2: const void* buffer
  76cecb: call   sceVoiceQoSWritePacket

Verified by the caller's internal logging format string:
log"sceVoiceQoSWritePacket() failed. Error code: %#x"

  • Validates connection and parameters, accepting outgoing voice packets.

Other changes:

  • Added comprehensive unit tests in core/libs/tests/GuestVoiceQoS.cpp.
  • Updated technical debt records in docs/dev/debt/libSceVoiceQoS.md.

Tested

  • Windows 11 x64, ctest -R guest_voice_qos (all tests passed).
  • Aliens: Fireteam Elite (PPSA03393): verified past voice initialization, endpoint configuration, and the voice polling loop; resolves infinite EOS logout loop on startup and progresses to map loading.

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: PPSA03393
  • GPUs tested: n/a
  • AI-assisted: yes
<!-- greyfinch-sync:boykopovar/AnyPS5:issue:4915298062 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/7727). Originally posted by [leorossi2005](https://github.com/leorossi2005) on 2026-10-19T03:16:34Z. --- ### What Implements `sceVoiceQoSGetLocalEndpointAttribute`, `sceVoiceQoSReadPacket`, and `sceVoiceQoSWritePacket` in `libSceVoiceQoS`. Signatures, register conventions, buffer structures, and return handling were reconstructed via x86_64 binary disassembly of *Aliens: Fireteam Elite* (PPSA03393, `eboot.bin`): 1. `sceVoiceQoSGetLocalEndpointAttribute` (NID `eZu2RP0Ma3w`, call site `0x76D132`): ```asm 76d11e: lea -0x2041(%rbp), %rdx # arg 3: void* value (out buffer) 76d125: mov $0x1, %ecx # arg 4: int32_t size (1 byte) 76d12a: mov 0x10(%rsi), %edi # arg 1: int32_t localId 76d12d: mov $0x1, %esi # arg 2: int32_t attributeId 76d132: call sceVoiceQoSGetLocalEndpointAttribute 76d137: test %eax, %eax 76d139: jne 0x76d2fa # error jump if nonzero 76d13f: cmpb $0x0, -0x2041(%rbp) # checks returned attribute byte ``` - Reads attributes previously stored for the local endpoint via `SetLocalEndpointAttribute`; if unset, zeroes the destination buffer and returns 0. 2. `sceVoiceQoSReadPacket` (NID `PWokFqab5q4`, call site `0x76D16E`): ```asm 76d14c: movl $0x2000, -0x2048(%rbp) # buffer capacity = 0x2000 (8192 bytes) 76d156: lea -0x2030(%rbp), %r14 # packet destination buffer 76d15d: lea -0x2048(%rbp), %rdx # arg 3: uint32_t* pSize 76d164: mov 0x18(%r12), %rax # connection struct 76d169: mov %r14, %rsi # arg 2: void* buffer 76d16c: mov (%rax), %edi # arg 1: int32_t connectionId 76d16e: call sceVoiceQoSReadPacket 76d173: test %eax, %eax 76d175: je 0x76d1c1 # jumps to size check on success ... 76d1c1: mov -0x2048(%rbp), %eax # reads *pSize 76d1cc: test %eax, %eax 76d1ce: je 0x76d2fa # if *pSize == 0, cleanly exits packet loop ``` Verified by the caller's internal logging format string: `log"sceVoiceQoSReadPacket() failed for connection id %d. Error code %#x"` - Returns 0 with `*size = 0` when no voice packets are queued in the receive buffer, allowing games to exit the polling loop cleanly without triggering timeout or logout cycles. 3. `sceVoiceQoSWritePacket` (NID `SpxLratrO1Q`, call site `0x76CECB`): ```asm 76ceae: mov (%rdi), %edi # arg 1: int32_t connectionId 76ceb9: movzwl 0x30(%rsi), %eax # packet length 76cec0: lea -0x24(%rbp), %rdx # arg 3: uint32_t* pSize 76cec4: mov %eax, -0x24(%rbp) 76cec7: mov 0x38(%rsi), %rsi # arg 2: const void* buffer 76cecb: call sceVoiceQoSWritePacket ``` Verified by the caller's internal logging format string: `log"sceVoiceQoSWritePacket() failed. Error code: %#x"` - Validates connection and parameters, accepting outgoing voice packets. Other changes: - Added comprehensive unit tests in `core/libs/tests/GuestVoiceQoS.cpp`. - Updated technical debt records in `docs/dev/debt/libSceVoiceQoS.md`. ### Tested - Windows 11 x64, `ctest -R guest_voice_qos` (all tests passed). - *Aliens: Fireteam Elite* (PPSA03393): verified past voice initialization, endpoint configuration, and the voice polling loop; resolves infinite EOS logout loop on startup and progresses to map loading. ### 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: PPSA03393 - [x] GPUs tested: n/a - [x] AI-assisted: yes
github-actions[bot] commented 2026-10-19 03:17:22 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by github-actions[bot] on 2026-10-19T03:17:22Z.


Progress report (8075b6a → 2b64ff2)

📈 System libraries: 79.89% (+0.06%, +3 implemented functions)

✅ 3 implemented
Library Name
libSceVoiceQoS sceVoiceQoSGetLocalEndpointAttribute
libSceVoiceQoS sceVoiceQoSReadPacket
libSceVoiceQoS sceVoiceQoSWritePacket
<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6258887151 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/7727#issuecomment-6258887151). Originally posted by [github-actions[bot]](https://github.com/apps/github-actions) on 2026-10-19T03:17:22Z. --- <!-- progress-report --> ### Progress report (8075b6a → 2b64ff2) 📈 **System libraries**: 79.89% (+0.06%, +3 implemented functions) <details> <summary>✅ 3 implemented</summary> | Library | Name | | - | - | | libSceVoiceQoS | `sceVoiceQoSGetLocalEndpointAttribute` | | libSceVoiceQoS | `sceVoiceQoSReadPacket` | | libSceVoiceQoS | `sceVoiceQoSWritePacket` | </details>
github-actions[bot] commented 2026-10-19 03:28:50 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by github-actions[bot] on 2026-10-19T03:28:50Z.


Some comparisons could not be completed because a pull request conflicts with the base branch. Review these shared files manually before concluding that there is no overlap.

Pull request Shared files not compared
PR 6044 core/libs/tests/GuestVoiceQoS.cpp
<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6259014136 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/7727#issuecomment-6259014136). Originally posted by [github-actions[bot]](https://github.com/apps/github-actions) on 2026-10-19T03:28:50Z. --- <!-- pr-overlap --> Some comparisons could not be completed because a pull request conflicts with the base branch. Review these shared files manually before concluding that there is no overlap. | Pull request | Shared files not compared | |---|---| | [PR 6044](https://www.github.com/boykopovar/AnyPS5/pull/6044) | `core/libs/tests/GuestVoiceQoS.cpp` |
jotitadev commented 2026-10-19 05:31:15 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by jotitadev on 2026-10-19T05:31:15Z.

Review: COMMENTED


Linux run of 7fdb261e6, since the description only lists Windows.

Machine: Linux x86_64, i7-8700 (6 cores / 12 threads), Ubuntu 26.04, GCC 15.2, Release, BUILD_TESTING=ON, full build. Head 7fdb261e6 merged onto main 72a3d9f2a.

  • Build ok. guest_voice_qos, guest_voice_qos_app_type_0x10000000 and patched_libraries pass, and the non-GPU suite is 761/761, same as main.
  • The new GuestVoiceQoS.cpp on main (library unchanged): both voice tests abort with sceVoiceQoSGetLocalEndpointAttribute not implemented, so the test covers the change.

One thing on the packet calls. sceVoiceQoSReadPacket always reports 0 bytes and sceVoiceQoSWritePacket drops the buffer and returns 0, so both now succeed without doing their job. That is what CONTRIBUTING.md calls a silent stub. It allows one only when it unblocks a title and only affects the UI, and asks for it under ### Silent stubs in the library's debt file. Here it is described inside the sceVoiceQoSInit entry under Unknown function info, and voice packets are not UI. Either keep the two packet calls throwing, or move that description to a Silent stubs entry so the maintainers can decide. Also, WritePacket leaves *size untouched. If that argument is in/out (bytes accepted), a caller could read it as 0 bytes written and retry. The Aliens call sites in the description may show which.

Written with AI assistance (Claude Code). I ran the builds and tests above on my machine.

<!-- greyfinch-sync:boykopovar/AnyPS5:review:5567301813 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/7727#pullrequestreview-5567301813). Originally posted by [jotitadev](https://github.com/jotitadev) on 2026-10-19T05:31:15Z. **Review:** COMMENTED --- Linux run of `7fdb261e6`, since the description only lists Windows. Machine: Linux x86_64, i7-8700 (6 cores / 12 threads), Ubuntu 26.04, GCC 15.2, Release, `BUILD_TESTING=ON`, full build. Head `7fdb261e6` merged onto `main` `72a3d9f2a`. - Build ok. `guest_voice_qos`, `guest_voice_qos_app_type_0x10000000` and `patched_libraries` pass, and the non-GPU suite is 761/761, same as `main`. - The new `GuestVoiceQoS.cpp` on `main` (library unchanged): both voice tests abort with `sceVoiceQoSGetLocalEndpointAttribute not implemented`, so the test covers the change. One thing on the packet calls. `sceVoiceQoSReadPacket` always reports 0 bytes and `sceVoiceQoSWritePacket` drops the buffer and returns 0, so both now succeed without doing their job. That is what CONTRIBUTING.md calls a silent stub. It allows one only when it unblocks a title and only affects the UI, and asks for it under `### Silent stubs` in the library's debt file. Here it is described inside the `sceVoiceQoSInit` entry under Unknown function info, and voice packets are not UI. Either keep the two packet calls throwing, or move that description to a Silent stubs entry so the maintainers can decide. Also, `WritePacket` leaves `*size` untouched. If that argument is in/out (bytes accepted), a caller could read it as 0 bytes written and retry. The Aliens call sites in the description may show which. Written with AI assistance (Claude Code). I ran the builds and tests above on my machine.
leorossi2005 commented 2026-10-19 06:02:56 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by leorossi2005 on 2026-10-19T06:02:56Z.


@jotitadev Thanks for testing this on Linux and confirming test coverage!

Regarding the packet calls:

  1. I have moved sceVoiceQoSReadPacket and sceVoiceQoSWritePacket into their own dedicated entries under ### Silent stubs in docs/dev/debt/libSceVoiceQoS.md, explaining why network voice streaming is stubbed out for titles requiring them on boot.
  2. Regarding WritePacket and *size: looking at the call site in Aliens: Fireteam Elite (0x76CE90-0x76CF10), *size is indeed in/out and the title explicitly verifies that all bytes were accepted:
0x76cec0: lea rdx, [rbp - 0x24]
0x76cec4: mov dword ptr [rbp - 0x24], eax    ; eax = input packet length
0x76cec7: mov rsi, qword ptr [rsi + 0x38]   ; packet buffer
0x76cecb: call sceVoiceQoSWritePacket
0x76ced0: test eax, eax
0x76ced2: je 0x76cf07
...
0x76cf07: movzx ecx, word ptr [rbx + 0x30]  ; original packet length
0x76cf0b: mov edx, dword ptr [rbp - 0x24]    ; *size upon return
0x76cf0e: cmp edx, ecx                       ; verify *size == original length
0x76cf10: je 0x76cf69                        ; success path

Before the call, the title initializes [rbp - 0x24] with the packet length. On return, it checks cmp edx, ecx to ensure *size equals the requested length. Leaving *size untouched (treating all input bytes as accepted) satisfies this check and allows the game to proceed.

<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6260780196 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/7727#issuecomment-6260780196). Originally posted by [leorossi2005](https://github.com/leorossi2005) on 2026-10-19T06:02:56Z. --- @jotitadev Thanks for testing this on Linux and confirming test coverage! Regarding the packet calls: 1. I have moved `sceVoiceQoSReadPacket` and `sceVoiceQoSWritePacket` into their own dedicated entries under `### Silent stubs` in `docs/dev/debt/libSceVoiceQoS.md`, explaining why network voice streaming is stubbed out for titles requiring them on boot. 2. Regarding `WritePacket` and `*size`: looking at the call site in Aliens: Fireteam Elite (`0x76CE90`-`0x76CF10`), `*size` is indeed in/out and the title explicitly verifies that all bytes were accepted: ```asm 0x76cec0: lea rdx, [rbp - 0x24] 0x76cec4: mov dword ptr [rbp - 0x24], eax ; eax = input packet length 0x76cec7: mov rsi, qword ptr [rsi + 0x38] ; packet buffer 0x76cecb: call sceVoiceQoSWritePacket 0x76ced0: test eax, eax 0x76ced2: je 0x76cf07 ... 0x76cf07: movzx ecx, word ptr [rbx + 0x30] ; original packet length 0x76cf0b: mov edx, dword ptr [rbp - 0x24] ; *size upon return 0x76cf0e: cmp edx, ecx ; verify *size == original length 0x76cf10: je 0x76cf69 ; success path ``` Before the call, the title initializes `[rbp - 0x24]` with the packet length. On return, it checks `cmp edx, ecx` to ensure `*size` equals the requested length. Leaving `*size` untouched (treating all input bytes as accepted) satisfies this check and allows the game to proceed.
adriadam10 commented 2026-10-20 15:50:47 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by adriadam10 on 2026-10-20T15:50:47Z.


Checked the new exports against the Aliens: Fireteam Elite call sites quoted in the description, the "Silent stubs" entries in the library's technical debt, and the guest test (it aborts on main with not implemented, as @jotitadev confirmed on Linux); merged.

<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6295014952 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/7727#issuecomment-6295014952). Originally posted by [adriadam10](https://github.com/adriadam10) on 2026-10-20T15:50:47Z. --- Checked the new exports against the Aliens: Fireteam Elite call sites quoted in the description, the "Silent stubs" entries in the library's technical debt, and the guest test (it aborts on `main` with `not implemented`, as @jotitadev confirmed on Linux); merged.
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!7727
No description provided.