Skip to content

feat(libSceAmpr): implement _Cnd_signal and _Cnd_init_with_name - #3499

Merged
adriadam10 merged 1 commit into
boykopovar:mainfrom
blawesom:carry/ampr-cnd-signal
Oct 11, 2026
Merged

adriadam10 merged 1 commit into
boykopovar:mainfrom
blawesom:carry/ampr-cnd-signal

Conversation

@blawesom

Copy link
Copy Markdown
Contributor

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 feat(libc): implement Dinkumware mutex and condition exports #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

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 libSceAmpr: _Cnd_signal and _Cnd_init_with_name are stubs after #3079; fix branch ready #3342; this carry PR was assembled with AI assistance)

Deathloop (PPSA01670), Minecraft Legends (PPSA05510) and GTA III
Definitive Edition import both from libSceAmpr. They take a pointer to
the handle slot and act on the conditions created by the libc _Cnd_init:
_Cnd_signal wakes one waiter through a libc helper, _Cnd_init_with_name
is _Cnd_init with the name ignored. _Thrd_id still throws.

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
@github-actions

Copy link
Copy Markdown

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

@blawesom

Copy link
Copy Markdown
Contributor Author

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.

@MarcZX10

Copy link
Copy Markdown
Contributor

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.

@github-actions

github-actions Bot commented Oct 11, 2026 •

Copy link
Copy Markdown

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

@adriadam10

Copy link
Copy Markdown
Collaborator

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.

@adriadam10
adriadam10 merged commit d2e1f20 into boykopovar:main Oct 11, 2026
13 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants