Skip to content

feat(libSceSsl): add the connection calls - #5226

Merged
oneandonlydean merged 3 commits into
boykopovar:mainfrom
ErenYeager1836:carry/libSceSsl-connection-calls
Oct 14, 2026
Merged

oneandonlydean merged 3 commits into
boykopovar:mainfrom
ErenYeager1836:carry/libSceSsl-connection-calls

Conversation

@ErenYeager1836

Copy link
Copy Markdown
Contributor

What

Carried from @screamm with author attribution preserved.

Implements connection lifecycle and parameter exports in libSceSsl:

  • Implements sceSslCreateConnection, sceSslConnect, sceSslRead, sceSslWrite, sceSslDeleteConnection, and sceSslSetVerifyCallback.
  • Manages connection context tracking, socket peer port lookup via sceNetGetpeername, and verification callbacks following SharpProspero Http.cs bindings.
  • Returns SSL_ERROR_INVALID_ID (0x8095F006) for unknown context IDs and throws on null hosts or unimplemented handshake initiation.
  • Updates docs/dev/debt/libSceSsl.md.

Tested

GuestSsl.cpp: exercises connection creation, context validation, callback registration, deletion, and socket lifecycle checks.

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
  • Unblocks: none
  • AI-assisted: yes

@github-actions

github-actions Bot commented Oct 13, 2026 •

Copy link
Copy Markdown

Progress report (d8888df → 8e68896)

📈 System libraries: 88.28% (+0.08%, +3 implemented functions)

✅ 3 implemented
Library Name
libSceSsl sceSslCreateConnection
libSceSsl sceSslDeleteConnection
libSceSsl sceSslSetVerifyCallback

screamm and others added 2 commits October 13, 2026 17:15
Implements connection lifecycle and parameter exports in libSceSsl:
sceSslCreateConnection, sceSslConnect, sceSslRead, sceSslWrite,
sceSslDeleteConnection, and sceSslSetVerifyCallback.

The repository has no TLS client, so a connection records its context,
socket, host and verification callback:
- sceSslCreateConnection returns a new connection id, or
  SSL_ERROR_INVALID_ID (0x8095F006) for an unknown context. A null host throws.
- sceSslDeleteConnection drops the connection and leaves socket open.
- sceSslSetVerifyCallback stores the callback and argument.
- sceSslConnect, sceSslRead and sceSslWrite throw where handshake starts,
  naming the host and the socket peer port.

Carried from @screamm with author attribution preserved.
Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
Co-Authored-By: Claude <noreply@anthropic.com>
@adriadam10

Copy link
Copy Markdown
Collaborator

Thanks for carrying this. On top of current main it did not build: the old parameterless (void) stubs of sceSslCreateConnection, sceSslDeleteConnection, sceSslSetVerifyCallback, sceSslConnect, sceSslRead and sceSslWrite were still in Export.cpp (conflicting C declarations), and GuestSsl.cpp still called sceSslSetVerifyCallback() with no arguments.

I added one commit on your branch removing those stubs and the old test line. The scoped build and tests (27, including guest_ssl) pass. Merging once the Windows build is green.

@oneandonlydean

Copy link
Copy Markdown
Collaborator

sceSslConnect, sceSslRead and sceSslWrite still can't do anything here, but they now throw their own runtime_error instead of NotImplemented_nid_no_patch(__func__), so the progress report counts them as implemented. Please keep those three as NotImplemented_nid_no_patch(__func__) stubs until there is a transport. Which title calls the connection functions?

@ErenYeager1836

Copy link
Copy Markdown
Contributor Author

Updated as requested! Kept sceSslConnect, sceSslRead, and sceSslWrite as NotImplemented_nid_no_patch(func) stubs so they remain counted as todo/unimplemented in progress reports until TLS transport is implemented, and cleaned up the unused transport exception helpers and tests.

Regarding which title calls the connection functions:

  • They were originally introduced as parameterless stubs for PPSA07411 (Resident Evil 4) in commit �03afed4c ( ix(exports): export the calls PPSA07411 imports), as RE4 failed to load without them.
  • They are also imported by titles using fmpeg.prx (e.g., media playback/streaming).

@oneandonlydean
oneandonlydean merged commit 5642906 into boykopovar:main Oct 14, 2026
8 checks passed
oneandonlydean pushed a commit that referenced this pull request Nov 2, 2026
…t callback

sceSaveDataRegisterEventCallback and sceSaveDataUnregisterEventCallback
were parameterless declarations that threw. They now follow shadPS4
#5226: registering before initialization is NOT_INITIALIZED, a null
callback is PARAMETER, a second registration replaces the callback and
its userdata, and unregistering needs no initialization.

Every backup completion that queues an event for
sceSaveDataGetEventResult, type 2 from sceSaveDataBackup and type 1 from
sceSaveDataUmountWithBackup, is queued for polling first and then handed
to the callback registered at that moment. A library thread delivers it:
sceSaveDataInitialize3 starts it with scePthreadCreate, as
libSceUsbStorage starts its monitor, so the callback runs on a guest
thread, and the last sceSaveDataTerminate joins it. Unregistering waits
for a running callback and drops completions not yet delivered, and a
terminate from inside the callback returns BUSY instead of joining its
own thread, as shadPS4 does.

guest_savedata_event_callback covers the errors, both event types, the
delivering thread, unregistration, replacement, a terminate from inside
the callback and an idle terminate followed by a restart.
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.

4 participants