Skip to content

feat(libSceNet): implement sceNetResolverStartNtoaMultipleRecordsEx - #1845

Closed
johnmaia wants to merge 1 commit into
boykopovar:mainfrom
johnmaia:feat/net-resolver-multiple-records-ex
Closed

johnmaia wants to merge 1 commit into
boykopovar:mainfrom
johnmaia:feat/net-resolver-multiple-records-ex

Conversation

@johnmaia

@johnmaia johnmaia commented Oct 8, 2026

Copy link
Copy Markdown
Contributor

What

Implements sceNetResolverStartNtoaMultipleRecordsEx in libSceNet. On main it is not exported at all, and four homebrew titles stop at it (#1578 table): PS5VR (PPSA99177), Jelly5 (PPSA99505), Emby5 (PPSA99515) and Nuvio PS5 (PPSA99997). All four use the DNS layer of EVO-PLAYER-PS5's toolkit (tools/native-app/stubs/evo_dns.c). That layer calls the function with timeout, retry and flags 0 and a zeroed buffer, then checks the result: a canary past byte 384, records in 1..10, and family 2 on each record.

int sceNetResolverStartNtoaMultipleRecordsEx(int rid, const char* hostname, SceNetResolverInfoEx* info, int timeout, int retry, int flags);
  • Layout: the 384-byte SceNetResolverInfoEx follows SharpProspero:

    • ten 32-byte records, each a 16-byte address union, an int family and 12 reserved bytes;
    • then records, dns4records, dns6records and rid6;
    • then 12 reserved ints.

    evo_dns.c reads the same offsets (records at 320, dns4 at 324, family at record + 16) and checks them on the console with its canary. static_asserts pin the size and offsets.

  • Lookup: host DNS, as sceNetResolverStartNtoa does. The block is cleared, then filled with up to ten distinct IPv4 addresses in the host resolver's order, each tagged AF_INET (2). records and dns4records are the count; dns6records and rid6 stay 0.

  • Errors, matching the sibling:

    • A null hostname or info returns EINVAL.
    • An unknown resolver returns EBADF.
    • A failed lookup returns RESOLVER_ENODNS and records it for sceNetResolverGetError.
    • On every error path the buffer is left untouched.
  • Flags: only 0 is handled. shadPS4 reads 0x1000000 as AAAA and 0x2000000 as A plus AAAA, and the async flag would need a worker, so any other value throws. Timeout and retry are ignored, as in the sibling.

  • TechnicalDebt records the IPv4-only result, the flags, and that the layout comes from SharpProspero and EVO-PLAYER-PS5 rather than a console trace.

Overlap: #1287 implements the non-Ex sceNetResolverStartNtoaMultipleRecords. It conflicts with main and is waiting for a title that imports it. The two functions are independent: this PR adds the Ex export after that one's stub. Whichever merges second has a small textual rebase in Export.cpp and GuestSceNet.cpp.

Tested

  • guest_sce_net, extended:
    • localhost returns 1..10 records, each 127.x with family 2 and zeroed padding. The records are distinct, the counts match, the unused records and the reserved tail are 0, and a canary after byte 384 is untouched.
    • The resolver error is 0 after a successful lookup.
    • .invalid returns RESOLVER_ENODNS and sets the resolver error.
    • A null hostname or info returns EINVAL with errno 22.
    • An unknown resolver returns EBADF with errno 9.
    • None of these error paths writes to the buffer.
    • Flags 0x2000000 throws.
  • Linux (Ubuntu 24.04.5, GCC 13.3) and Windows 11 (WinLibs GCC 15.2.0 r7): guest_sce_net passes. On Linux the other net/socket tests pass too.
  • No title was run: the four titles are prebuilt downloads, which I don't run here.

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

https://claude.ai/code/session_01DwFnKjMxmwGDWiuYYf1v4D

PS5VR (PPSA99177), Jelly5 (PPSA99505), Emby5 (PPSA99515) and Nuvio PS5
(PPSA99997) stop at this import on main. The lookup goes through host
DNS like sceNetResolverStartNtoa and fills SharpProspero's 384-byte
SceNetResolverInfoEx with up to ten distinct IPv4 records. Only flags 0
is handled; other flags throw.

Assisted by Claude Code.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01DwFnKjMxmwGDWiuYYf1v4D
@github-actions

github-actions Bot commented Oct 8, 2026

Copy link
Copy Markdown

Progress report (364a56b → 869908f)

➖ System libraries: 84.76% (+0.0%, +1 implemented functions)

✅ 1 implemented
Library Name
libSceNet sceNetResolverStartNtoaMultipleRecordsEx

@github-actions

github-actions Bot commented Oct 8, 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
#1772 docs/dev/TechnicalDebt.md L350
#1801 docs/dev/TechnicalDebt.md L350
#1819 docs/dev/TechnicalDebt.md L350
#1831 docs/dev/TechnicalDebt.md L350
#1838 sceNetResolverStartNtoaMultipleRecordsEx

@LeandroLP23

Copy link
Copy Markdown
Contributor

#1838 implements the same export and was opened at 21:12 (with the lookup shared with sceNetResolverStartNtoa); @hikazey has since checked it on Windows with EVO-PLAYER v0.11.0 (#1838 comment). Mentioning it so the two can be reconciled. Happy to take the static_asserts on the offsets from here into #1838 if that's useful.

@johnmaia

johnmaia commented Oct 8, 2026

Copy link
Copy Markdown
Contributor Author

Closing in favour of #1838, which was opened first and is checked with PS5VR on Windows. Sorry for the duplicate; I missed it when I opened this. If useful for #1838, the test here checks three more things: a canary after byte 384 stays intact, the buffer is untouched on every error path (ENODNS, EINVAL, EBADF), and the returned records are distinct. The static_asserts on the layout are in Export.cpp here; feel free to take any of it.

@johnmaia johnmaia closed this Oct 8, 2026
LeandroLP23 added a commit to LeandroLP23/AnyPS5 that referenced this pull request Oct 8, 2026
… errors

The layout offsets the titles read are static_asserts, and guest_sce_net now
checks a canary past byte 384, distinct records, and an untouched buffer on the
EINVAL, RESOLVER_ENODNS and EBADF paths, as boykopovar#1845's test did.

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

Copy link
Copy Markdown
Contributor

Thanks @johnmaia, taken: #1838 now checks a canary past byte 384, an untouched buffer on the ENODNS, EINVAL and EBADF paths and distinct records, and pins the layout with static_asserts.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants