feat(libSceAmpr): implement _Cnd_signal and _Cnd_init_with_name #3499

Merged
blawesom merged 1 commit from upstream-pr/3499 into main 2026-10-11 21:29:12 +00:00
blawesom commented 2026-10-11 11:45:50 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by blawesom on 2026-10-11T11:45:50Z.


What

Carries @screamm's fix from #3342 (the author is under the open-PR limit). The commit is theirs, unchanged (dce174749), rebased onto current main.

Deathloop (PPSA01670), Minecraft Legends and GTA III Definitive Edition import these exports; both were NotImplemented_nid_no_patch stubs after #3079 gave libc the Dinkumware _Cnd_* family:

  • _Cnd_signal(pthread_cond**) uses the pointer-to-slot ABI the #3079 review established and a new libc helper SignalCondition_nid_no_patch (in Threads.cpp) that wakes one waiter of the condition objects libc's _Cnd_init creates and returns _Thrd_success, like the merged _Cnd_broadcast; bad handles throw the same invalid_argument as libc.
  • _Cnd_init_with_name(pthread_cond**, const char*) calls libc's _Cnd_init and ignores the name, following fpPS4's reverse-engineered PS4 _Mtx_init_with_name where the name only names the pthread object.
  • _Thrd_id keeps throwing: no public source settles the PS5 return form. All recorded in TechnicalDebt.

Tested

  • The author's run (Windows 11, WinLibs MinGW-w64 GCC 15.2.0, per #3342): guest_ampr_threads and guest_libc_threads pass, full suite 507/507, with main's Export.cpp the extended Ampr test fails.
  • Independent Linux verification (posted on #3342): CachyOS, kernel 7.2.9, GCC 16.2.1, Ninja, Release, BUILD_TESTING=ON — guest_ampr_threads and guest_libc_threads pass (including the 50 ms "wakes exactly one" window); full suite 829/829 including the Vulkan tests on AMD RX 9070 XT (RADV GFX1201); tools/check_conventions.py --base origin/main and git diff --check pass.

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
  • New third-party code is a submodule built from source (none added)
  • Generic behaviour, not specific to one title
  • Depends on: none
  • AI-assisted: yes (the carried commit was written by @screamm with AI assistance per #3342; this carry PR was assembled with AI assistance)
<!-- greyfinch-sync:boykopovar/AnyPS5:issue:4818811482 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/3499). Originally posted by [blawesom](https://github.com/blawesom) on 2026-10-11T11:45:50Z. --- ### What Carries @screamm's fix from #3342 (the author is under the open-PR limit). The commit is theirs, unchanged (`dce174749`), rebased onto current `main`. Deathloop (PPSA01670), Minecraft Legends and GTA III Definitive Edition import these exports; both were `NotImplemented_nid_no_patch` stubs after #3079 gave libc the Dinkumware `_Cnd_*` family: - `_Cnd_signal(pthread_cond**)` uses the pointer-to-slot ABI the #3079 review established and a new libc helper `SignalCondition_nid_no_patch` (in `Threads.cpp`) that wakes one waiter of the condition objects libc's `_Cnd_init` creates and returns `_Thrd_success`, like the merged `_Cnd_broadcast`; bad handles throw the same `invalid_argument` as libc. - `_Cnd_init_with_name(pthread_cond**, const char*)` calls libc's `_Cnd_init` and ignores the name, following fpPS4's reverse-engineered PS4 `_Mtx_init_with_name` where the name only names the pthread object. - `_Thrd_id` keeps throwing: no public source settles the PS5 return form. All recorded in TechnicalDebt. ### Tested - The author's run (Windows 11, WinLibs MinGW-w64 GCC 15.2.0, per #3342): `guest_ampr_threads` and `guest_libc_threads` pass, full suite 507/507, with `main`'s `Export.cpp` the extended Ampr test fails. - Independent Linux verification (posted on #3342): CachyOS, kernel 7.2.9, GCC 16.2.1, Ninja, Release, `BUILD_TESTING=ON` — `guest_ampr_threads` and `guest_libc_threads` pass (including the 50 ms "wakes exactly one" window); full suite **829/829** including the Vulkan tests on AMD RX 9070 XT (RADV GFX1201); `tools/check_conventions.py --base origin/main` and `git diff --check` pass. ### 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 - [x] Unimplemented paths throw (`NotImplemented_nid_no_patch`); silent stubs are listed in TechnicalDebt - [x] No notes, investigation `.md` files or images added to the repository - [x] New third-party code is a submodule built from source (none added) - [x] Generic behaviour, not specific to one title - [x] Depends on: none - [x] AI-assisted: yes (the carried commit was written by @screamm with AI assistance per #3342; this carry PR was assembled with AI assistance)
github-actions[bot] commented 2026-10-11 12:06:00 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by github-actions[bot] on 2026-10-11T12:06:00Z.


Progress report (cafc074 → dce1747)

📈 System libraries: 85.81% (+0.06%, +2 implemented functions)

✅ 2 implemented
Library Name
libSceAmpr _Cnd_init_with_name_nid_postfix
libSceAmpr _Cnd_signal_nid_postfix
<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6108839852 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/3499#issuecomment-6108839852). Originally posted by [github-actions[bot]](https://github.com/apps/github-actions) on 2026-10-11T12:06:00Z. --- <!-- progress-report --> ### Progress report (cafc074 → dce1747) 📈 **System libraries**: 85.81% (+0.06%, +2 implemented functions) <details> <summary>✅ 2 implemented</summary> | Library | Name | | - | - | | libSceAmpr | `_Cnd_init_with_name_nid_postfix` | | libSceAmpr | `_Cnd_signal_nid_postfix` | </details>
blawesom commented 2026-10-11 13:45:52 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by blawesom on 2026-10-11T13:45:52Z.


Highlighting what merging this unblocks, for whoever triages the queue:

The change itself: the last two missing Dinkumware condition-variable exports of libSceAmpr — _Cnd_signal and _Cnd_init_with_name — which Deathloop (PPSA01670), Minecraft Legends and GTA III Definitive Edition import (#3342). The ABI follows the #3079 review's pointer-to-slot model, _Cnd_broadcast is the already-merged sibling, and the commit is @screamm's, unchanged.

Verification state: dual-platform — the author's Windows run in #3342, and an independent Linux full-suite pass (829/829, including every Vulkan test on real RDNA4/RADV, plus guest_ampr_threads/guest_libc_threads and a negative control on main's stubs). All checks here are green, including the macOS register-context and write-watch matrix.

The compounding part: this is currently my only open PR under the intake limit (no merged PRs yet). If it merges, the 20-slot allowance opens — and I maintain 30 dual-platform-verified fix branches from intake-gated authors that are carry-ready against current main (e.g. #3410's Ajm M4AAC decoder for Ghost of Yotei, verified with a negative control). Two of those have already reached main through other carriers (#3181 → #3433, #3360 → #3448). Merging this one PR converts a verifier into a carrier, which is worth more than the two exports themselves.

If main moves before this merges and it needs a rebase, I maintain the branch and will push one promptly.

<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6109677744 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/3499#issuecomment-6109677744). Originally posted by [blawesom](https://github.com/blawesom) on 2026-10-11T13:45:52Z. --- Highlighting what merging this unblocks, for whoever triages the queue: **The change itself**: the last two missing Dinkumware condition-variable exports of libSceAmpr — `_Cnd_signal` and `_Cnd_init_with_name` — which Deathloop (PPSA01670), Minecraft Legends and GTA III Definitive Edition import (#3342). The ABI follows the #3079 review's pointer-to-slot model, `_Cnd_broadcast` is the already-merged sibling, and the commit is @screamm's, unchanged. **Verification state**: dual-platform — the author's Windows run in #3342, and an independent Linux full-suite pass (**829/829**, including every Vulkan test on real RDNA4/RADV, plus `guest_ampr_threads`/`guest_libc_threads` and a negative control on `main`'s stubs). All checks here are green, including the macOS register-context and write-watch matrix. **The compounding part**: this is currently my only open PR under the intake limit (no merged PRs yet). If it merges, the 20-slot allowance opens — and I maintain [30 dual-platform-verified fix branches](https://github.com/blawesom/AnyPS5/branches) from intake-gated authors that are carry-ready against current `main` (e.g. #3410's Ajm M4AAC decoder for Ghost of Yotei, verified with a negative control). Two of those have already reached `main` through other carriers (#3181 → #3433, #3360 → #3448). Merging this one PR converts a verifier into a carrier, which is worth more than the two exports themselves. If `main` moves before this merges and it needs a rebase, I maintain the branch and will push one promptly.
MarcZX10 commented 2026-10-11 15:05:56 +00:00 (Migrated from github.com)

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


Thanks for flagging the overlap. I carried David's #3499 implementation onto current main as commit f6266acb8 with David retained as author, then added a five-second bound to the waiter-state checks and a 20-second CTest timeout. The focused Linux/GCC 12.2 Release test passes 3/3 on that consolidated branch.

I think my #3657 branch is the better review target for the test coverage: it retains David's two-waiter notify_one check, while ensuring a broken waiter setup fails promptly instead of hanging. Your issue report's Windows run and independent full-suite result are stronger than my local evidence, and I've attributed them in the PR body rather than claiming them as my own.

The collaborator closed #3657 as a duplicate before I pushed this consolidation. GitHub now rejects reopening it because its branch was force-pushed after closure. I have not opened another live PR while yours remains open, to avoid leaving two PRs for the same functions. Would you be willing to close #3499 so I can open a replacement from the consolidated branch? If you prefer to keep #3499 as the review target, the test-timeout follow-up is at ca9cc44ce and can be cherry-picked there.

<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6110391267 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/3499#issuecomment-6110391267). Originally posted by [MarcZX10](https://github.com/MarcZX10) on 2026-10-11T15:05:56Z. --- Thanks for flagging the overlap. I carried David's #3499 implementation onto current `main` as commit [`f6266acb8`](https://github.com/MarcZX100/AnyPS5/commit/f6266acb8) with David retained as author, then added a five-second bound to the waiter-state checks and a 20-second CTest timeout. The focused Linux/GCC 12.2 Release test passes 3/3 on that consolidated branch. I think my #3657 branch is the better review target for the test coverage: it retains David's two-waiter `notify_one` check, while ensuring a broken waiter setup fails promptly instead of hanging. Your issue report's Windows run and independent full-suite result are stronger than my local evidence, and I've attributed them in the PR body rather than claiming them as my own. The collaborator closed #3657 as a duplicate before I pushed this consolidation. GitHub now rejects reopening it because its branch was force-pushed after closure. I have not opened another live PR while yours remains open, to avoid leaving two PRs for the same functions. Would you be willing to close #3499 so I can open a replacement from the consolidated branch? If you prefer to keep #3499 as the review target, the test-timeout follow-up is at [`ca9cc44ce`](https://github.com/MarcZX100/AnyPS5/commit/ca9cc44ce) and can be cherry-picked there.
github-actions[bot] commented 2026-10-11 15:27:42 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by github-actions[bot] on 2026-10-11T15:27:42Z.


Other open pull requests touch the same code. Merging one will break the other, or both implement the same thing. If this one builds on them, list them in Depends on.

Pull request Conflicting files (lines on main) Same exports Same new files
#3679 core/libs/prx/libSceAmpr/Export.cpp L236
docs/dev/TechnicalDebt.md L354
#3742 core/libs/tests/GuestAmprThreads.cpp L4, L199-200
docs/dev/TechnicalDebt.md L354
#3743 core/libs/tests/GuestAmprThreads.cpp L4, L199-200
docs/dev/TechnicalDebt.md L354
<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6110590541 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/3499#issuecomment-6110590541). Originally posted by [github-actions[bot]](https://github.com/apps/github-actions) on 2026-10-11T15:27:42Z. --- <!-- pr-overlap --> Other open pull requests touch the same code. Merging one will break the other, or both implement the same thing. If this one builds on them, list them in **Depends on**. | Pull request | Conflicting files (lines on `main`) | Same exports | Same new files | |---|---|---|---| | #3679 | `core/libs/prx/libSceAmpr/Export.cpp` [L236](https://github.com/boykopovar/AnyPS5/blob/1770f352d7546c1eae9cf1e1441e1ae2428dc3a0/core/libs/prx/libSceAmpr/Export.cpp#L236)<br>`docs/dev/TechnicalDebt.md` [L354](https://github.com/boykopovar/AnyPS5/blob/1770f352d7546c1eae9cf1e1441e1ae2428dc3a0/docs/dev/TechnicalDebt.md#L354) | | | | #3742 | `core/libs/tests/GuestAmprThreads.cpp` [L4](https://github.com/boykopovar/AnyPS5/blob/1770f352d7546c1eae9cf1e1441e1ae2428dc3a0/core/libs/tests/GuestAmprThreads.cpp#L4), [L199-200](https://github.com/boykopovar/AnyPS5/blob/1770f352d7546c1eae9cf1e1441e1ae2428dc3a0/core/libs/tests/GuestAmprThreads.cpp#L199-L200)<br>`docs/dev/TechnicalDebt.md` [L354](https://github.com/boykopovar/AnyPS5/blob/1770f352d7546c1eae9cf1e1441e1ae2428dc3a0/docs/dev/TechnicalDebt.md#L354) | | | | #3743 | `core/libs/tests/GuestAmprThreads.cpp` [L4](https://github.com/boykopovar/AnyPS5/blob/1770f352d7546c1eae9cf1e1441e1ae2428dc3a0/core/libs/tests/GuestAmprThreads.cpp#L4), [L199-200](https://github.com/boykopovar/AnyPS5/blob/1770f352d7546c1eae9cf1e1441e1ae2428dc3a0/core/libs/tests/GuestAmprThreads.cpp#L199-L200)<br>`docs/dev/TechnicalDebt.md` [L354](https://github.com/boykopovar/AnyPS5/blob/1770f352d7546c1eae9cf1e1441e1ae2428dc3a0/docs/dev/TechnicalDebt.md#L354) | | |
adriadam10 commented 2026-10-11 21:29:08 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by adriadam10 on 2026-10-11T21:29:08Z.


Checked on Linux (GCC, merged onto current main): guest_ampr_threads passes, and fails when the non-test changes are reverted. Dinkumware ABI matches the merged _Cnd_broadcast, TechnicalDebt entry records the unverified console behaviour; merging.

<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6113977793 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/3499#issuecomment-6113977793). Originally posted by [adriadam10](https://github.com/adriadam10) on 2026-10-11T21:29:08Z. --- Checked on Linux (GCC, merged onto current main): `guest_ampr_threads` passes, and fails when the non-test changes are reverted. Dinkumware ABI matches the merged `_Cnd_broadcast`, TechnicalDebt entry records the unverified console behaviour; merging.
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!3499
No description provided.