Skip to content

feat(libSceHttp2): complete asynchronous requests through the kqueue option - #1092

Merged
oneandonlydean merged 1 commit into
boykopovar:mainfrom
kjhq:feat/libscehttp2-async
Oct 8, 2026
Merged

oneandonlydean merged 1 commit into
boykopovar:mainfrom
kjhq:feat/libscehttp2-async

Conversation

@kjhq

@kjhq kjhq commented Oct 7, 2026 •

Copy link
Copy Markdown
Contributor

What

No network is emulated, so every libSceHttp2 request fails with the library's network error (0x80436063). Until now sceHttp2SendRequestAsync returned that error synchronously and sceHttp2WaitAsync returned it too. Titles that use the asynchronous API expect the failure to arrive as a completion instead:

  • sceHttp2SendRequestAsync takes the kqueue option (new Http2AsyncOption in SceTypes.hpp: equeue at 0, user event id at 8, user data at 16; layout inferred from PPSA17221), queues an Http2AsyncResult for the request with result = network error, triggers the user event on that equeue with the user data, and returns 0.
  • sceHttp2WaitAsync returns and removes the oldest completion of the request. sceHttp2DeleteRequest drops pending completions.
  • A missing kqueue option, a non-null extra option, a user event that is not registered, and a wait with no completed operation throw (NotImplemented_nid_no_patch).
  • TechnicalDebt (Functional) describes this, including that the completion's event_type value is unknown and left 0.

PPSA17221 (Minecraft) completes its request object only after sceHttp2SendRequestAsync returns, and its handler for a synchronous failure calls shared_from_this before that, so a synchronous failure crashed it.

guest_http2 now registers a user event, sends asynchronously, receives the event with the request id and user data, reads the completion with sceHttp2WaitAsync, and checks the throwing cases.

Title

PPSA17221 (Minecraft) needs #716 to load the modules in its app root, so every run below is current main + #716 + the PRs of this set (#1088, #1090–#1096), plus local changes outside it: dialog, NpAuth and TextToSpeech2 stubs that open PRs cover (#560, #925, #301) and a GPU end-of-pipe change that is not submitted. With all of them the title loads a world. The line below is from a run with only this PR left out, Windows 11, WinLibs GCC, normal user session.

Without it the title terminates about 8 s after start:

Terminating due to uncaught exception 'bad_weak_ptr' of type std::bad_weak_ptr
FATAL: unhandled exception 0xc000001d on thread 18280 'REST Thread(0)'

Tested

Debian 13 (WSL2), GCC 14.2.0, Release: full ctest 390/390 passed (GPU tests skipped: no Vulkan device in WSL), including guest_http2.

Windows 11, WinLibs GCC: PPSA17221 with this PR and the rest of the set loads a world (runs described above). Not tested with Windows ctest.

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

🤖 Generated with Claude Code

…option

sceHttp2SendRequestAsync no longer fails synchronously: it queues a
completion carrying the network error and triggers the user event named
by the kqueue option. sceHttp2WaitAsync returns queued completions.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@github-actions

github-actions Bot commented Oct 7, 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
#1116 docs/dev/TechnicalDebt.md L211
#1119 core/libs/prx/libSceHttp2/Export.cpp L4-5, L10
#1126 docs/dev/TechnicalDebt.md L211
#1128 sceHttp2SendRequestAsync
#1184 docs/dev/TechnicalDebt.md L211

@github-actions

github-actions Bot commented Oct 8, 2026

Copy link
Copy Markdown

Progress report (0d3c1ee → 1cc4d25)

📉 System libraries: 86.54% (-0.07%, -2 reverted functions)

⚠️ 2 went back to stubs
Library Name
libSceHttp2 sceHttp2SendRequestAsync
libSceHttp2 sceHttp2WaitAsync

@oneandonlydean
oneandonlydean merged commit 10cb0d2 into boykopovar:main Oct 8, 2026
3 checks passed

@samimalokozay7009-rgb samimalokozay7009-rgb left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Khan

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