libSceAmpr: _Cnd_signal and _Cnd_init_with_name are stubs after #3079; fix branch ready #3342

Closed
opened 2026-10-11 08:17:47 +00:00 by screamm · 3 comments
screamm commented 2026-10-11 08:17:47 +00:00 (Migrated from github.com)
Contributor

Imported from boykopovar/AnyPS5. Originally posted by screamm on 2026-10-11T08:17:47Z.


_Cnd_signal and _Cnd_init_with_name (libSceAmpr, Export.cpp) are NotImplemented_nid_no_patch stubs now that #3079 gave libc the Dinkumware _Cnd_* family. Deathloop (PPSA01670), Minecraft Legends and GTA III Definitive Edition import them.

Fix branch ready: screamm:feat/ampr-cnd-signal (e21484de, one commit on main a4b0b16b). I cannot open it as a PR because of the intake check; anyone eligible is welcome to carry it, keeping the commit as is.

  • _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.
  • guest_ampr_threads gains a waiter woken by signal on a named condition, two waiters where one signal wakes exactly one, signal with no waiters, a null name, a plain _Cnd_init handle, interop with libc _Cnd_broadcast/_Cnd_destroy, and the error cases.

Tested on Windows 11 Pro 26220, WinLibs MinGW-w64 GCC 15.2.0 r7, Ninja, Release, BUILD_TESTING=ON, full build including libs: guest_ampr_threads and guest_libc_threads 3/3; ctest -j8 -E "^agc_driver_|^video_out_flip" 507/507 (with the #3329 test fix applied locally so the tree builds); with main's Export.cpp the extended Ampr test fails; tools/check_conventions.py --base main and git diff --check pass. Not run on Linux. The "wakes exactly one" check uses a 50 ms window and would misfire only on a spurious host wakeup.

Written with Claude Code assistance (implementation by a subagent, reviewed and validated in this session).

<!-- greyfinch-sync:boykopovar/AnyPS5:issue:5799327763 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/issues/3342). Originally posted by [screamm](https://github.com/screamm) on 2026-10-11T08:17:47Z. --- `_Cnd_signal` and `_Cnd_init_with_name` (libSceAmpr, [Export.cpp](https://github.com/boykopovar/AnyPS5/blob/main/core/libs/prx/libSceAmpr/Export.cpp)) are `NotImplemented_nid_no_patch` stubs now that #3079 gave libc the Dinkumware `_Cnd_*` family. Deathloop (PPSA01670), Minecraft Legends and GTA III Definitive Edition import them. **Fix branch ready:** [`screamm:feat/ampr-cnd-signal`](https://github.com/screamm/AnyPS5/tree/feat/ampr-cnd-signal) (`e21484de`, one commit on `main` `a4b0b16b`). I cannot open it as a PR because of the intake check; anyone eligible is welcome to carry it, keeping the commit as is. - `_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. - `guest_ampr_threads` gains a waiter woken by signal on a named condition, two waiters where one signal wakes exactly one, signal with no waiters, a null name, a plain `_Cnd_init` handle, interop with libc `_Cnd_broadcast`/`_Cnd_destroy`, and the error cases. **Tested** on Windows 11 Pro 26220, WinLibs MinGW-w64 GCC 15.2.0 r7, Ninja, Release, `BUILD_TESTING=ON`, full build including `libs`: `guest_ampr_threads` and `guest_libc_threads` 3/3; `ctest -j8 -E "^agc_driver_|^video_out_flip"` 507/507 (with the #3329 test fix applied locally so the tree builds); with `main`'s `Export.cpp` the extended Ampr test fails; `tools/check_conventions.py --base main` and `git diff --check` pass. Not run on Linux. The "wakes exactly one" check uses a 50 ms window and would misfire only on a spurious host wakeup. Written with Claude Code assistance (implementation by a subagent, reviewed and validated in this session).
blawesom commented 2026-10-11 09:38:45 +00:00 (Migrated from github.com)
Author
Contributor

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


Independent verification on Linux (the gap noted in the report): CachyOS, kernel 7.2.9, GCC 16.2.1, Ninja, Release, BUILD_TESTING=ON.

  • Rebased e21484de onto current main (the branch was 150+ commits behind): the commit applies cleanly, no conflicts.
  • tools/check_conventions.py --base origin/main and git diff --check pass.
  • guest_ampr_threads and guest_libc_threads pass (the 50 ms "wakes exactly one" window held).
  • Full suite mirroring the Windows run (ctest -j8 -E "^agc_driver_|^video_out_flip"): 520/520 passed.

The rebased branch is available at blawesom:verify/3342 for anyone carrying — the commit is otherwise unchanged.

<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6107665218 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/issues/3342#issuecomment-6107665218). Originally posted by [blawesom](https://github.com/blawesom) on 2026-10-11T09:38:45Z. --- Independent verification on **Linux** (the gap noted in the report): CachyOS, kernel 7.2.9, GCC 16.2.1, Ninja, Release, `BUILD_TESTING=ON`. - Rebased `e21484de` onto current `main` (the branch was 150+ commits behind): the commit applies cleanly, no conflicts. - `tools/check_conventions.py --base origin/main` and `git diff --check` pass. - `guest_ampr_threads` and `guest_libc_threads` pass (the 50 ms "wakes exactly one" window held). - Full suite mirroring the Windows run (`ctest -j8 -E "^agc_driver_|^video_out_flip"`): **520/520 passed**. The rebased branch is available at [`blawesom:verify/3342`](https://github.com/blawesom/AnyPS5/tree/verify/3342) for anyone carrying — the commit is otherwise unchanged.
MarcZX10 commented 2026-10-11 15:05:58 +00:00 (Migrated from github.com)
Author
Contributor

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


I carried David’s implementation from #3499 into a current-main branch with his commit authorship preserved, then added bounded waiter setup (5 seconds) and a 20-second CTest timeout. The focused Linux/GCC 12.2 Release test passes 3/3. The #3657 PR had already been closed as a duplicate; GitHub will not reopen it after its branch was force-pushed, so I have not opened a replacement while #3499 remains open. I asked #3499’s author whether they would prefer the consolidated branch as the review target; otherwise the timeout change can be cherry-picked into #3499. The Windows/full-suite evidence in this issue remains attributed to its reporters.

<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6110391485 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/issues/3342#issuecomment-6110391485). Originally posted by [MarcZX10](https://github.com/MarcZX10) on 2026-10-11T15:05:58Z. --- I carried David’s implementation from #3499 into a current-main branch with his commit authorship preserved, then added bounded waiter setup (5 seconds) and a 20-second CTest timeout. The focused Linux/GCC 12.2 Release test passes 3/3. The #3657 PR had already been closed as a duplicate; GitHub will not reopen it after its branch was force-pushed, so I have not opened a replacement while #3499 remains open. I asked #3499’s author whether they would prefer the consolidated branch as the review target; otherwise the timeout change can be cherry-picked into #3499. The Windows/full-suite evidence in this issue remains attributed to its reporters.
oneandonlydean commented 2026-10-11 23:27:16 +00:00 (Migrated from github.com)
Author
Contributor

Imported from boykopovar/AnyPS5. Originally posted by oneandonlydean on 2026-10-11T23:27:16Z.


Closing: fixed by #3499.

<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6115098934 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/issues/3342#issuecomment-6115098934). Originally posted by [oneandonlydean](https://github.com/oneandonlydean) on 2026-10-11T23:27:16Z. --- Closing: fixed by #3499.
Sign in to join this conversation.
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#3342
No description provided.