feat(libSceUlt): implement sceUltUlthreadTryJoin, sceUltUlthreadRuntimeDestroy and the underscore ulthread exports #2153

Merged
EdouardSence merged 1 commit from upstream-pr/2153 into main 2026-10-09 21:59:50 +00:00
EdouardSence commented 2026-10-09 10:07:23 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by EdouardSence on 2026-10-09T10:07:23Z.


What

Rise of the Ronin (PPSA04540) imports these five libSceUlt functions, and none of them is exported:

  • _sceUltUlthreadRuntimeOptParamInitialize
  • _sceUltUlthreadRuntimeCreate
  • _sceUltUlthreadCreate
  • sceUltUlthreadTryJoin
  • sceUltUlthreadRuntimeDestroy

On main the relinked title doesn't start, because the loader reports them as undefined symbols. The title imports no libSceUlt function without the underscore except sceUltInitialize, sceUltFinalize, sceUltUlthreadJoin and sceUltUlthreadRuntimeGetWorkAreaSize. So the underscore names are the exported entry points the SDK calls.

  • Underscore exports: they forward to the existing sceUltUlthreadRuntimeOptParamInitialize, sceUltUlthreadRuntimeCreate and sceUltUlthreadCreate. Those already take the trailing build version argument.
  • sceUltUlthreadTryJoin: returns ULT_ERROR_BUSY while the ulthread's entry has not returned. Otherwise it joins like sceUltUlthreadJoin.
  • sceUltUlthreadRuntimeDestroy: returns ULT_ERROR_BUSY while an ulthread created on the runtime is not joined. Otherwise it forgets the runtime, so a later sceUltUlthreadCreate on it returns ULT_ERROR_STATE.

The shared signatures and both busy rules are inferred. They are recorded in TechnicalDebt.

Tested

Linux (CachyOS, GCC), RX 9070 XT.

  • New tests: guest_ult_thread_tryjoin and guest_ult_thread_destroy cover busy and joined TryJoin, busy and idle RuntimeDestroy, a destroyed runtime, and the null and unknown cases, all through the underscore exports. The existing guest_ult_* tests still pass (10/10).
  • tools/check_conventions.py: passes.
  • Rise of the Ronin, scripted and headless:
    • With this change, plus local placeholders that throw for the other missing imports (libSceJson2, libSceSaveData, libSceNgs2, libSceNet, libSceRazorCpu), the title gets through its ULT setup.
    • It then creates its swapchain, starts compiling shaders and stops at about 9 s on computed/data-dependent s_swappc_b64 call target at program counter 0x00000074 is not statically resolvable (#1817).
    • With throwing placeholders for the ULT functions instead, it stopped on the first call, _sceUltUlthreadRuntimeOptParamInitialize not implemented.

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 in TechnicalDebt
  • 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
  • AI-assisted: yes. The investigation, code, tests and this description were written by Claude (Claude Code) on my machine.

🤖 Generated with Claude Code

<!-- greyfinch-sync:boykopovar/AnyPS5:issue:4798979793 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/2153). Originally posted by [EdouardSence](https://github.com/EdouardSence) on 2026-10-09T10:07:23Z. --- ### What Rise of the Ronin (PPSA04540) imports these five libSceUlt functions, and none of them is exported: - `_sceUltUlthreadRuntimeOptParamInitialize` - `_sceUltUlthreadRuntimeCreate` - `_sceUltUlthreadCreate` - `sceUltUlthreadTryJoin` - `sceUltUlthreadRuntimeDestroy` On `main` the relinked title doesn't start, because the loader reports them as undefined symbols. The title imports no libSceUlt function without the underscore except `sceUltInitialize`, `sceUltFinalize`, `sceUltUlthreadJoin` and `sceUltUlthreadRuntimeGetWorkAreaSize`. So the underscore names are the exported entry points the SDK calls. - **Underscore exports:** they forward to the existing `sceUltUlthreadRuntimeOptParamInitialize`, `sceUltUlthreadRuntimeCreate` and `sceUltUlthreadCreate`. Those already take the trailing build version argument. - **`sceUltUlthreadTryJoin`:** returns `ULT_ERROR_BUSY` while the ulthread's entry has not returned. Otherwise it joins like `sceUltUlthreadJoin`. - **`sceUltUlthreadRuntimeDestroy`:** returns `ULT_ERROR_BUSY` while an ulthread created on the runtime is not joined. Otherwise it forgets the runtime, so a later `sceUltUlthreadCreate` on it returns `ULT_ERROR_STATE`. The shared signatures and both busy rules are inferred. They are recorded in TechnicalDebt. ### Tested Linux (CachyOS, GCC), RX 9070 XT. - **New tests:** `guest_ult_thread_tryjoin` and `guest_ult_thread_destroy` cover busy and joined `TryJoin`, busy and idle `RuntimeDestroy`, a destroyed runtime, and the null and unknown cases, all through the underscore exports. The existing `guest_ult_*` tests still pass (10/10). - **`tools/check_conventions.py`:** passes. - **Rise of the Ronin**, scripted and headless: - With this change, plus local placeholders that throw for the other missing imports (libSceJson2, libSceSaveData, libSceNgs2, libSceNet, libSceRazorCpu), the title gets through its ULT setup. - It then creates its swapchain, starts compiling shaders and stops at about 9 s on `computed/data-dependent s_swappc_b64 call target at program counter 0x00000074 is not statically resolvable` (#1817). - With throwing placeholders for the ULT functions instead, it stopped on the first call, `_sceUltUlthreadRuntimeOptParamInitialize not implemented`. ### 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 in [TechnicalDebt](https://github.com/boykopovar/AnyPS5/blob/main/docs/dev/TechnicalDebt.md#silent-stubs) - [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] AI-assisted: yes. The investigation, code, tests and this description were written by Claude (Claude Code) on my machine. 🤖 Generated with [Claude Code](https://claude.com/claude-code)
github-actions[bot] commented 2026-10-09 10:07:58 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by github-actions[bot] on 2026-10-09T10:07:58Z.


Progress report (54f28f2 → 04dda44)

📈 System libraries: 85.33% (+0.03%, +5 implemented functions)

✅ 5 implemented
Library Name
libSceUlt _sceUltUlthreadCreate
libSceUlt _sceUltUlthreadRuntimeCreate
libSceUlt _sceUltUlthreadRuntimeOptParamInitialize
libSceUlt sceUltUlthreadRuntimeDestroy
libSceUlt sceUltUlthreadTryJoin
<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6078787475 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/2153#issuecomment-6078787475). Originally posted by [github-actions[bot]](https://github.com/apps/github-actions) on 2026-10-09T10:07:58Z. --- <!-- progress-report --> ### Progress report (54f28f2 → 04dda44) 📈 **System libraries**: 85.33% (+0.03%, +5 implemented functions) <details> <summary>✅ 5 implemented</summary> | Library | Name | | - | - | | libSceUlt | `_sceUltUlthreadCreate` | | libSceUlt | `_sceUltUlthreadRuntimeCreate` | | libSceUlt | `_sceUltUlthreadRuntimeOptParamInitialize` | | libSceUlt | `sceUltUlthreadRuntimeDestroy` | | libSceUlt | `sceUltUlthreadTryJoin` | </details>
popcoder565 commented 2026-10-09 15:46:51 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by popcoder565 on 2026-10-09T15:46:51Z.


Native Windows run, since no Windows results were posted. Setup: Windows 10 (19045), MinGW-w64 GCC 15.2.0 (WinLibs r7), Release. Head fd7c096b, merged onto main d70b8998 in one build with 38 other PRs that had no Windows run.

  • This PR's tests pass: guest_ult_thread_tryjoin, guest_ult_thread_destroy, guest_ult_thread_outstanding, guest_ult_thread_validation. None of them reported skipping a case.
  • Full ctest in that build: 519 of 519. That needed local fixes to three other PRs in the batch that don't build or pass on Windows: #1611, #1796 and #1824 (reported there).

No title was run.

🤖 Addressed by Claude Code

<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6084278520 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/2153#issuecomment-6084278520). Originally posted by [popcoder565](https://github.com/popcoder565) on 2026-10-09T15:46:51Z. --- Native Windows run, since no Windows results were posted. Setup: Windows 10 (19045), MinGW-w64 GCC 15.2.0 (WinLibs r7), Release. Head `fd7c096b`, merged onto `main` d70b8998 in one build with 38 other PRs that had no Windows run. - This PR's tests pass: `guest_ult_thread_tryjoin`, `guest_ult_thread_destroy`, `guest_ult_thread_outstanding`, `guest_ult_thread_validation`. None of them reported skipping a case. - Full ctest in that build: 519 of 519. That needed local fixes to three other PRs in the batch that don't build or pass on Windows: #1611, #1796 and #1824 (reported there). No title was run. _🤖 Addressed by [Claude Code](https://claude.com/claude-code)_
adriadam10 commented 2026-10-09 21:59:47 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by adriadam10 on 2026-10-09T21:59:47Z.


Checked: the 3 underscore forwarders, TryJoin and RuntimeDestroy against the diff; guest_ult_thread_* pass locally (4/4) and the new tests don't link without the change. The BUSY returns are recorded as inferred in TechnicalDebt (prosper, the only reference, returns EAGAIN with MED confidence and no second source). Windows ctest confirmed by @popcoder565. The only red job (hardware_oracle on Windows) is unrelated; merging once CI is green.

<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6089961156 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/2153#issuecomment-6089961156). Originally posted by [adriadam10](https://github.com/adriadam10) on 2026-10-09T21:59:47Z. --- Checked: the 3 underscore forwarders, `TryJoin` and `RuntimeDestroy` against the diff; `guest_ult_thread_*` pass locally (4/4) and the new tests don't link without the change. The BUSY returns are recorded as inferred in TechnicalDebt (prosper, the only reference, returns EAGAIN with MED confidence and no second source). Windows ctest confirmed by @popcoder565. The only red job (`hardware_oracle` on Windows) is unrelated; merging once CI is green.
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!2153
No description provided.