feat(libSceRudp): implement the poll exports #7495

Merged
nekomancer01 merged 3 commits from upstream-pr/7495 into main 2026-10-20 10:12:44 +00:00
nekomancer01 commented 2026-10-18 09:35:26 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by nekomancer01 on 2026-10-18T09:35:26Z.


What

Implements sceRudpPollCreate, sceRudpPollControl, sceRudpPollWait and sceRudpPollDestroy, imported by PPSA31327 (Yakuza 0 Director's Cut).

  • Signatures, the 8-byte SceRudpPollEvent, the operations (1 add, 2 modify, 3 remove) and the argument checks follow the PS Vita library in Vita3K. RUDP_ERROR_INVALID_POLL_ID (0x8077001F) and RUDP_ERROR_TOO_MANY_CONTEXTS (0x80770020) match the PS3 codes in RPCS3. Vita3K does not implement sceRudpPollDestroy; int sceRudpPollDestroy(int pollId) is inferred.
  • No context can connect in this library, so no context ever reports an event: sceRudpPollWait returns 0 when its timeout elapses. Destroying the poll or calling sceRudpEnd wakes a waiter, which then returns RUDP_ERROR_INVALID_POLL_ID or RUDP_ERROR_NOT_INITIALIZED.
  • sceRudpTerminate removes the context from every poll; sceRudpEnd destroys all polls.
  • None of this is measured on a PS5; recorded in docs/dev/debt/libSceRudp.md.

Tested

Ubuntu 26.04 (WSL2), GCC, Release, full build with BUILD_TESTING=ON. New guest_rudp_poll test covers argument errors, capacity, duplicate add, modify/remove of absent contexts, timeout elapse, removal on terminate, and waiters woken by sceRudpPollDestroy and sceRudpEnd. Full ctest: 1433 passed, 0 failed (59 Vulkan/VideoOut tests skipped, no Vulkan device under WSL). Not tested with a title. Merges cleanly with #7087, the other open PR that changes libSceRudp.

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

🤖 Generated with Claude Code

<!-- greyfinch-sync:boykopovar/AnyPS5:issue:4908008167 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/7495). Originally posted by [nekomancer01](https://github.com/nekomancer01) on 2026-10-18T09:35:26Z. --- ### What Implements `sceRudpPollCreate`, `sceRudpPollControl`, `sceRudpPollWait` and `sceRudpPollDestroy`, imported by PPSA31327 (Yakuza 0 Director's Cut). - Signatures, the 8-byte `SceRudpPollEvent`, the operations (1 add, 2 modify, 3 remove) and the argument checks follow the PS Vita library in [Vita3K](https://github.com/AndnixSH/Vita3K-PS-Vita-OS-Fork/blob/master/vita3k/modules/SceRudp/SceLibRudp.cpp). `RUDP_ERROR_INVALID_POLL_ID` (0x8077001F) and `RUDP_ERROR_TOO_MANY_CONTEXTS` (0x80770020) match the PS3 codes in [RPCS3](https://github.com/RPCS3/rpcs3/blob/master/rpcs3/Emu/Cell/Modules/cellRudp.h). Vita3K does not implement `sceRudpPollDestroy`; `int sceRudpPollDestroy(int pollId)` is inferred. - No context can connect in this library, so no context ever reports an event: `sceRudpPollWait` returns 0 when its timeout elapses. Destroying the poll or calling `sceRudpEnd` wakes a waiter, which then returns `RUDP_ERROR_INVALID_POLL_ID` or `RUDP_ERROR_NOT_INITIALIZED`. - `sceRudpTerminate` removes the context from every poll; `sceRudpEnd` destroys all polls. - None of this is measured on a PS5; recorded in `docs/dev/debt/libSceRudp.md`. ### Tested Ubuntu 26.04 (WSL2), GCC, Release, full build with `BUILD_TESTING=ON`. New `guest_rudp_poll` test covers argument errors, capacity, duplicate add, modify/remove of absent contexts, timeout elapse, removal on terminate, and waiters woken by `sceRudpPollDestroy` and `sceRudpEnd`. Full `ctest`: 1433 passed, 0 failed (59 Vulkan/VideoOut tests skipped, no Vulkan device under WSL). Not tested with a title. Merges cleanly with #7087, the other open PR that changes `libSceRudp`. ### 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 🤖 Generated with [Claude Code](https://claude.com/claude-code)
github-actions[bot] commented 2026-10-18 10:31:34 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by github-actions[bot] on 2026-10-18T10:31:34Z.


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 5021 core/libs/CMakeLists.txt
PR 6044 core/libs/CMakeLists.txt
PR 7201 core/libs/CMakeLists.txt
PR 7332 core/libs/CMakeLists.txt
PR 7622 core/libs/CMakeLists.txt
<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6248784138 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/7495#issuecomment-6248784138). Originally posted by [github-actions[bot]](https://github.com/apps/github-actions) on 2026-10-18T10:31:34Z. --- <!-- 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 5021](https://www.github.com/boykopovar/AnyPS5/pull/5021) | `core/libs/CMakeLists.txt` | | [PR 6044](https://www.github.com/boykopovar/AnyPS5/pull/6044) | `core/libs/CMakeLists.txt` | | [PR 7201](https://www.github.com/boykopovar/AnyPS5/pull/7201) | `core/libs/CMakeLists.txt` | | [PR 7332](https://www.github.com/boykopovar/AnyPS5/pull/7332) | `core/libs/CMakeLists.txt` | | [PR 7622](https://www.github.com/boykopovar/AnyPS5/pull/7622) | `core/libs/CMakeLists.txt` |
wachi35676 commented 2026-10-18 12:05:40 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by wachi35676 on 2026-10-18T12:05:40Z.


Windows results (the description lists WSL only): Windows 11, WinLibs GCC 15.2.0 (MinGW), Release, this PR applied onto main 3e3e8b905. guest_rudp_poll passes 30/30, and the other rudp tests and guest_offline_imports pass. On main the new test aborts. A probe with long sceRudpPollWait timeouts on MinGW stays blocked, then returns RUDP_ERROR_INVALID_POLL_ID after sceRudpPollDestroy, with no early return. Timeouts tried: INT64_MAX/2000, 2^40, 2^32 and 3.6e9 µs.

Two differences from the cited Vita3K code:

  • Check order in ADD. Vita3K's sceRudpPollControl checks entries.size() >= max_size (TOO_MANY_CONTEXTS) before the duplicate check (INVALID_CONTEXT_ID). This PR checks for the duplicate first: re-adding a context to a full size-1 poll returns 0x80770003, where Vita3K returns 0x80770020, and the new test asserts 0x80770003. Either follow Vita3K's order or note the choice in the debt entry.
  • Empty poll. Vita3K's sceRudpPollWait returns 0 at once when the poll has no entries. This PR waits for the full timeout. That is fine, but it isn't from Vita3K.

AI-assisted: yes (Claude Code); results above were run on this machine.

<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6249706064 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/7495#issuecomment-6249706064). Originally posted by [wachi35676](https://github.com/wachi35676) on 2026-10-18T12:05:40Z. --- Windows results (the description lists WSL only): Windows 11, WinLibs GCC 15.2.0 (MinGW), Release, this PR applied onto `main` `3e3e8b905`. `guest_rudp_poll` passes 30/30, and the other rudp tests and `guest_offline_imports` pass. On `main` the new test aborts. A probe with long `sceRudpPollWait` timeouts on MinGW stays blocked, then returns `RUDP_ERROR_INVALID_POLL_ID` after `sceRudpPollDestroy`, with no early return. Timeouts tried: INT64_MAX/2000, 2^40, 2^32 and 3.6e9 µs. Two differences from the cited Vita3K code: - **Check order in ADD.** Vita3K's `sceRudpPollControl` checks `entries.size() >= max_size` (`TOO_MANY_CONTEXTS`) before the duplicate check (`INVALID_CONTEXT_ID`). This PR checks for the duplicate first: re-adding a context to a full size-1 poll returns `0x80770003`, where Vita3K returns `0x80770020`, and the new test asserts `0x80770003`. Either follow Vita3K's order or note the choice in the debt entry. - **Empty poll.** Vita3K's `sceRudpPollWait` returns 0 at once when the poll has no entries. This PR waits for the full timeout. That is fine, but it isn't from Vita3K. AI-assisted: yes (Claude Code); results above were run on this machine.
nekomancer01 commented 2026-10-18 12:24:30 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by nekomancer01 on 2026-10-18T12:24:30Z.


Thank you for testing it using a Windows run.

  • ADD check order: fixed in 272a2fd1c. sceRudpPollControl now checks capacity before duplicates, as Vita3K does, and the test asserts TOO_MANY_CONTEXTS for re-adding to a full poll, plus INVALID_CONTEXT_ID for a duplicate in a poll with room left. sceRudpPollDestroy now also rejects a negative id with INVALID_ARGUMENT, like the other poll calls.
  • Empty poll: kept the wait. With nothing to watch, a poll has no events until its timeout, like epoll_wait on an empty set; Vita3K's early return logs a warning and looks like an emulator shortcut. The difference from Vita3K is now noted in the debt entry.

Overlap comment: checked the four PRs manually. #5021, #6222 and #7201 change unrelated parts of core/libs/CMakeLists.txt. #6044 moves all library tests into subfolders; if it lands first I'll move GuestRudpPoll.cpp the same way.

Windows 11, WinLibs GCC 15.2.0 (MinGW): guest_rudp_poll 30/30 and the other Rudp tests pass, results from @wachi35676 in the comments.

<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6249880612 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/7495#issuecomment-6249880612). Originally posted by [nekomancer01](https://github.com/nekomancer01) on 2026-10-18T12:24:30Z. --- Thank you for testing it using a Windows run. - **ADD check order:** fixed in 272a2fd1c. `sceRudpPollControl` now checks capacity before duplicates, as Vita3K does, and the test asserts `TOO_MANY_CONTEXTS` for re-adding to a full poll, plus `INVALID_CONTEXT_ID` for a duplicate in a poll with room left. `sceRudpPollDestroy` now also rejects a negative id with `INVALID_ARGUMENT`, like the other poll calls. - **Empty poll:** kept the wait. With nothing to watch, a poll has no events until its timeout, like `epoll_wait` on an empty set; Vita3K's early return logs a warning and looks like an emulator shortcut. The difference from Vita3K is now noted in the debt entry. Overlap comment: checked the four PRs manually. #5021, #6222 and #7201 change unrelated parts of `core/libs/CMakeLists.txt`. #6044 moves all library tests into subfolders; if it lands first I'll move `GuestRudpPoll.cpp` the same way. Windows 11, WinLibs GCC 15.2.0 (MinGW): `guest_rudp_poll` 30/30 and the other Rudp tests pass, results from @wachi35676 in the comments.
github-actions[bot] commented 2026-10-19 16:29:26 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by github-actions[bot] on 2026-10-19T16:29:26Z.


Progress report (8a7ba4b → e416409)

📈 System libraries: 65.23% (+0.06%, +4 implemented functions)

✅ 4 implemented
Library Name
libSceRudp sceRudpPollControl
libSceRudp sceRudpPollCreate
libSceRudp sceRudpPollDestroy
libSceRudp sceRudpPollWait
<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6272030628 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/7495#issuecomment-6272030628). Originally posted by [github-actions[bot]](https://github.com/apps/github-actions) on 2026-10-19T16:29:26Z. --- <!-- progress-report --> ### Progress report (8a7ba4b → e416409) 📈 **System libraries**: 65.23% (+0.06%, +4 implemented functions) <details> <summary>✅ 4 implemented</summary> | Library | Name | | - | - | | libSceRudp | `sceRudpPollControl` | | libSceRudp | `sceRudpPollCreate` | | libSceRudp | `sceRudpPollDestroy` | | libSceRudp | `sceRudpPollWait` | </details>
nekomancer01 commented 2026-10-20 00:17:25 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by nekomancer01 on 2026-10-20T00:17:25Z.


Rebased onto main to resolve the debt file conflict after #7087; the check-order fix is now a8352d301. Also shortened the poll debt entry to the new 1000-character limit (fbb8dff23).

<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6280267242 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/7495#issuecomment-6280267242). Originally posted by [nekomancer01](https://github.com/nekomancer01) on 2026-10-20T00:17:25Z. --- Rebased onto main to resolve the debt file conflict after #7087; the check-order fix is now a8352d301. Also shortened the poll debt entry to the new 1000-character limit (fbb8dff23).
adriadam10 commented 2026-10-20 10:13:07 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by adriadam10 on 2026-10-20T10:13:07Z.


Re-checked the shortened poll debt entry (docs only since the last review; code and test unchanged); no conflict with main; merged.

<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6288604230 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/7495#issuecomment-6288604230). Originally posted by [adriadam10](https://github.com/adriadam10) on 2026-10-20T10:13:07Z. --- Re-checked the shortened poll debt entry (docs only since the last review; code and test unchanged); no conflict with main; 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!7495
No description provided.