Skip to content

feat(libs): Deathloop loading support (Ampr, NetCtlApDialog + stubs) - #407

Merged
adriadam10 merged 5 commits into
boykopovar:mainfrom
Pouare514:feat/deathloop-loading
Oct 10, 2026
Merged

adriadam10 merged 5 commits into
boykopovar:mainfrom
Pouare514:feat/deathloop-loading

Conversation

@Pouare514

@Pouare514 Pouare514 commented Oct 2, 2026 •

Copy link
Copy Markdown
Contributor

What

Deathloop (PPSA01670, v01.405) resolves all 931 imports, loads every module and reaches the ELF entry point. New module libSceNetCtlApDialog (network-connection dialog; no studied game imports from it yet); missing-export stubs (all throwing) for Ampr (36, including 0hlfW1O4Aa4 which Deathloop imports from libSceAmpr, IMPORT_LIB index 48), libkernel (17), Http, Json2, Net, AppContent, NpEntitlementAccess, NpManager, WebBrowserDialog and libc (3). NetCtlAp (IMPORT_LIB-only) and VrrPeg need nothing (zero imports).

Tested

  • Windows, Deathloop PPSA01670: relinked unwrapped eboot with --windows --windows-diagnostics; run reaches 'Transferring control to ELF entry point' (was FAIL on missing libSceNetCtlApDialog.prx).
  • Full Release Ninja build OK; ctest -E agc_driver_graphics|guest_rendering_wait|agc_driver_vopc_compare --timeout 120: 179/179 pass (agc_driver_vopc_compare fails on this machine with or without this PR, shader area untouched).

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

@Pouare514
Pouare514 force-pushed the feat/deathloop-loading branch 2 times, most recently from 2594b2a to 6428d6b Compare October 2, 2026 21:16
@github-actions

github-actions Bot commented Oct 2, 2026 •

Copy link
Copy Markdown

Progress report (ae3d5f9 → 998016e)

📉 System libraries: 83.35% (-1.34%, +49 declared functions)

🆕 49 declared as stubs
Library Name
libSceAmpr _Cnd_init_with_name_nid_postfix
libSceAmpr _Cnd_signal_nid_postfix
libSceAmpr _Lock_shared_ptr_spin_lock_nid_postfix
libSceAmpr _Thrd_id_nid_postfix
libSceAmpr _Thrd_join_nid_postfix
libSceAmpr _Thrd_sleep_nid_postfix
libSceAmpr _Unlock_shared_ptr_spin_lock_nid_postfix
libSceAmpr _ZNKSt8time_getIcSt19istreambuf_iteratorIcSt11char_traitsIcEEE3getES3_S3_RSt8ios_baseRNSt5_IosbIiE8_IostateEP2tmPKcSE__nid_postfix
libSceAmpr _ZNSt4_Pad7_LaunchEPP7pthread_nid_postfix
libSceAmpr _ZNSt4_Pad8_ReleaseEv_nid_postfix
libSceAmpr _ZNSt4_PadC2Ev_nid_postfix
libSceAmpr _ZNSt4_PadD2Ev_nid_postfix
libSceAmpr _ZNSt7num_getIcSt19istreambuf_iteratorIcSt11char_traitsIcEEE2idE_nid_postfix
libSceAmpr _ZNSt8ios_base7_AddstdEPS__nid_postfix
libSceAmpr _ZNSt8time_getIcSt19istreambuf_iteratorIcSt11char_traitsIcEEE2idE_nid_postfix
libSceAmpr _ZNSt8time_getIcSt19istreambuf_iteratorIcSt11char_traitsIcEEE7_GetcatEPPKNSt6locale5facetEPKS5__nid_postfix
libSceAmpr _ZSt16_Throw_Cpp_errori_nid_postfix
libSceAmpr _ZTVN10__cxxabiv119__pointer_type_infoE_nid_postfix
libSceAmpr _ZTVN10__cxxabiv120__function_type_infoE_nid_postfix
libSceAmpr _ZTVSt7num_getIcSt19istreambuf_iteratorIcSt11char_traitsIcEEE_nid_postfix
libSceAmpr __cxa_call_unexpected_nid_postfix
libSceAmpr wcstombs_s_nid_postfix
libSceHttp sceHttpAbortWaitRequest
libSceJson2 _ZN3sce4Json14InitParameter2C2Ev
libSceJson2 _ZN3sce4Json18InitParameterRtti216setAllocatorRttiEPNS0_14AllocParamRttiEPv
libSceNetCtlApDialog sceNetCtlApDialogClose
libSceNetCtlApDialog sceNetCtlApDialogGetResult
libSceNetCtlApDialog sceNetCtlApDialogInitialize
libSceNetCtlApDialog sceNetCtlApDialogOpen
libSceNetCtlApDialog sceNetCtlApDialogTerminate
libSceNetCtlApDialog sceNetCtlApDialogUpdateStatus
libc swscanf_s_nid_postfix
libkernel sceKernelUnknown03
libkernel sceKernelUnknown04
libkernel sceKernelUnknown05
libkernel sceKernelUnknown06
libkernel sceKernelUnknown07
libkernel sceKernelUnknown08
libkernel sceKernelUnknown09
libkernel sceKernelUnknown10
libkernel sceKernelUnknown11
libkernel sceKernelUnknown12
libkernel sceKernelUnknown13
libkernel sceKernelUnknown14
libkernel sceKernelUnknown15
libkernel sceKernelUnknown16
libkernel sceKernelUnknown17
libkernel sceKernelUnknown18
libkernel sceKernelUnknown19

@oneandonlydean

Copy link
Copy Markdown
Collaborator

Thanks for the Deathloop work. Before review this needs a few changes: no comments in code (libc/Export.cpp), generic names instead of title names (libcDeathUnknown00 to 02), and the Party module looks like the game's own sys_module (the description says it is bundled as sys_module/Party.prx and nothing imports it), so I don't think it should be reimplemented here. The PR says the unknown NIDs are in TechnicalDebt, but the diff doesn't touch it. Splitting by library would also make it reviewable. Note 0hlfW1O4Aa4 is also claimed by #338 for libc.

@Pouare514

Copy link
Copy Markdown
Contributor Author

Done: comments removed from libc/Export.cpp, the three unknowns renamed to generic libcUnknown_ names, Party module removed (game sys_module, zero imports), rebased on current main, full build + 179/179 ctest green. Two notes: 0hlfW1O4Aa4 stays in Ampr — Deathloop imports it from libSceAmpr (IMPORT_LIB index 48, verified from the ELF dynamic section), and I removed the same NID from #338's libc. On TechnicalDebt: the merged #358 had its bulk unknown-NID lines stripped upstream, so I did not add a new bulk list; all stubs throw with per-library mapping in the description. Happy to split by library on request.

@Pouare514

Copy link
Copy Markdown
Contributor Author

Follow-up note: I checked all 36 Ampr unknowns against the public PS5 NID database (zecoxao/sce_symbols aerolib.csv, verified by recomputing 8/8 NIDs locally). They are almost all C/C++ runtime re-exports (localeconv, strtok_s, wcscpy_s, ctime_s, mbstowcs, asctime_s, Thrd, Cnd, num_get/time_get facets, __udivti3, etc.). Same for most NpCppWebApi unknowns (dtors/getters with full mangled names). I'll do a rename + forwarder follow-up PR once this one lands, to avoid conflicts.

@oneandonlydean

Copy link
Copy Markdown
Collaborator

Thanks for the changes and for the NID database check. Since the names are known now, I'd rather they go in under those names here than land as Unknown and get renamed in a follow-up. Of the 184 raw NIDs in this PR, 106 give their NID back exactly when I recompute it from the name (for example P41kTWUS3EI = scePthreadGetschedparam, oIRFTjoILbg = scePthreadSetschedparam, tQNolUV1q5A = swscanf_s). Doing the rename here also clears two clashes:

The CONTRIBUTING rule for the NIDs that stay unknown still asks for TechnicalDebt entries; @boykopovar, is it fine to skip them for bulk loader stubs like these, as #358 did? Splitting by library would still make it much easier to review.

@Pouare514

Copy link
Copy Markdown
Contributor Author

Reworked per review, using hash-verified renames (every new name recomputes to its NID; my DB now pins a commit and always verifies): 151 stubs now carry their real names as plain exports without APS5_EXPORT (two that collide with host CRT declarations use the _nid_postfix form). Dropped: the 12 Ampr NIDs that #545 implements (they'll come back there with real bodies), sceNetHtonll/sceNetNtohll (merged #302 owns them), and the two Vrr NIDs from WebBrowserDialog (#518 owns them). The 17 NIDs with no database hit stay Unknown with TechnicalDebt lines. Clean libs build (nid_patcher resolves every rename, no duplicates) and 183/183 ctest green. On splitting: this is now 11 small per-file groups of mechanical renames; happy to split into per-library PRs if you'd still prefer that.

@Pouare514

Copy link
Copy Markdown
Contributor Author

Rebased onto current main (this should also restart CI, which never ran for the previous push). Two adjustments from the rebase: my sceHttpGetLastErrno/sceHttpCreateRequest2 throwing stubs are gone in favour of #555's real implementations that landed on main (same NIDs), keeping only ParseStatusLine/AbortWaitRequest from that group; and the Net file is back to main since merged #302 owns those NIDs now. libs builds clean and full ctest (221) passes locally.

@Pouare514
Pouare514 force-pushed the feat/deathloop-loading branch from ec56c00 to 6063c9c Compare October 5, 2026 00:49
@github-actions github-actions Bot added the docs label Oct 5, 2026
@Pouare514

Copy link
Copy Markdown
Contributor Author

Linux failure root-caused and fixed: the renamed C++ runtime names (_ZTV*, methods, _Lock/_Unlock_shared_ptr_spin_lock, __cxa_call_unexpected, _Thrd/_Cnd/_Pad and friends) were exported plain, so on Linux they interposed the real libstdc++ symbols for every process linking libSceAmpr — only guest_ampr_markers and guest_crt link it, which matches the two failures exactly. They are now exported in _nid_postfix form (same NIDs, no host-visible collision), like the earlier wcstombs_s/swscanf_s cases. Verified locally with a clean libs build.

@Pouare514
Pouare514 force-pushed the feat/deathloop-loading branch from 22e3335 to fd3b24e Compare October 5, 2026 01:10
@oneandonlydean

Copy link
Copy Markdown
Collaborator

Thanks for the renames. I checked them all: every new name recomputes to one of the NIDs the previous head exported, nothing new was added, and the only NIDs dropped are the ones you listed (the 12 Ampr functions, sceNetHtonll/Ntohll, the two Vrr functions, and #555's two Http functions). None of the remaining ones is exported on main. The 17 kernel NIDs aren't in the database here either, and they have their TechnicalDebt lines.

The Linux CI job fails on this head, though, and I think the renames cause it: guest_ampr_markers (from #579) aborts with std::bad_alloc. On Linux each prx is an ELF shared object, so a plain export whose name is also a libstdc++ symbol interposes the host runtime's own definition. Eight of the new libSceAmpr names are:

  • _ZTVN10__cxxabiv119__pointer_type_infoE, _ZTVN10__cxxabiv120__function_type_infoE, _ZTVSt12bad_weak_ptr, _ZTVSt7num_getIcSt19istreambuf_iteratorIcSt11char_traitsIcEEE (vtables)
  • _ZNSt7num_getIcSt19istreambuf_iteratorIcSt11char_traitsIcEEE2idE, _ZNSt8time_getIcSt19istreambuf_iteratorIcSt11char_traitsIcEEE2idE (facet ids)
  • _ZNSt12bad_weak_ptrD1Ev, __cxa_call_unexpected

I see the same here: main plus this PR alone makes guest_ampr_markers abort every time, and LD_DEBUG=bindings shows the host libstdc++ binding those eight names to the libSceAmpr stubs. Once the host's __pointer_type_info vtable resolves to a stub, a thrown exception can no longer be matched. A ten-line host program that throws and catches, linked against a .so that defines just these eight names, terminates with the same std::bad_alloc, and without the .so it works. Windows isn't affected because PE exports don't interpose. I checked every new name in the other libraries against libstdc++, glibc, libm and libgcc_s, and only these eight collide. GCC also warns that int __cxa_call_unexpected() doesn't match its built-in declaration. That one is on my suggestion to use the real names, sorry. The _nid_postfix form you already use for wcstombs_s and swscanf_s avoids it. Also, six of the eight are data (vtables and facet ids) rather than functions, so a stub there can't throw if a title reads them. A TechnicalDebt line saying they are placeholders would cover that.

One overlap: Eu95jmqn5Rw and IXW-z8pggfg (the two sce::Json initializer functions in libSceJson2) are also added by #369, so whichever lands second has to drop them.

With the eight names changed and CI green, it's ready to merge from my side. #545 carries this commit, so it will pick up the fix on its next rebase.

@adriadam10 adriadam10 left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

This conflicts with main in six files again, and some of the conflicts mean dropping code, not just resolving context:

  • core/libs/prx/libSceNpCppWebApi/Export.cpp (+565): #676 removed this module from main (titles ship their own libSceNpCppWebApi.prx), as @oneandonlydean noted. Please drop the file from the branch.
  • core/libs/prx/libSceJson2/Export.cpp: #369 has merged and defines sce::Json::Initializer::initialize and InitParameter2::setFileBufferSize. Drop those two and keep only the NIDs main doesn't export.
  • core/libs/prx/libSceHttp/Export.cpp: sceHttpParseStatusLine is now implemented on main (libSceHttp/src/Parse.cpp), so the stub has to go.
  • libSceNpEntitlementAccess, libSceNpManager: content conflicts with later merges. After the rebase, check that none of your stubs share a NID with something main now implements.
  • docs/dev/TechnicalDebt.md: the 17 kernel lines are at the end of "Unknown function info" again, which is where everyone appends, so this keeps conflicting. Put them somewhere in the middle of the section.
  • The title and What still mention Party, which the branch no longer adds.

Once it's rebased with CI green, we'll review it again.

@Pouare514
Pouare514 force-pushed the feat/deathloop-loading branch from 993ccfa to 998016e Compare October 9, 2026 18:46
@Pouare514

Copy link
Copy Markdown
Contributor Author

Rebased onto current main (forced update 993ccfa...998016e):

(a) TechnicalDebt.md: kept main's new lines (_sceUlobjmgrRegisterObject, sceShareGetCurrentStatus, sceAgcDcbSet Predication lines, Resource registration) and placed our 17 kernel unknown-NID lines after them.
(b) #369 overlap: #369 is merged with the real versions, and this branch no longer contains sce::Json::Initializer::initialize or InitParameter2::setFileBufferSize (verified on main lines 479/800/804) — no duplicates. The two Json functions this branch still adds (InitParameter2C2Ev, setAllocatorRtti) are not on main.
(c) #676: dropped the whole libSceNpCppWebApi replacement (565 lines gone); diff vs main no longer touches that file.
(d) Overlap bot: #1143 is merged but this branch never had bad_weak_ptr, so nothing to drop. #1128 is still open (formatting chore); the Json initialize overlap is gone with (b), sceHttpParseStatusLine is only added here (not on main). No Depends on added — this PR builds on nothing else.

Old-vs-new diff check: Ampr 119, AppContent 5, Http 9, Json2 9, NetCtlApDialog 38, NpEntitlement 4, NpManager 4, libc 15, kernel 102 (incl. 24 _nid_postfix lines, interposition fix intact), TD 17 — everything else identical to the reviewed head, git diff --check clean.

@github-actions github-actions Bot removed the needs rebase Conflicts with main, rebase needed label Oct 9, 2026
@popcoder565

Copy link
Copy Markdown
Contributor

Native Windows run, since no Windows results were posted. Setup: Windows 10 (19045), MinGW-w64 GCC 15.2.0 (WinLibs r7), Release. Head 998016e7, merged onto main 8b393b6 in one build with 31 other PRs that had no Windows run.

  • This PR has no test of its own. It builds, and the suite passes apart from the failure below.
  • Full ctest in that build: 520 of 521. The one failure is guest_offline_imports, broken by feat(libSceRudp): implement sceRudpGetStatus #2359 (reported there).

No title was run.

🤖 Addressed by Claude Code

@oneandonlydean

Copy link
Copy Markdown
Collaborator

Conventions is red only because the "Depends on: none" box is unticked; please tick it. The title and What still mention Party and the NpCppWebApi stubs, which the branch no longer adds, so please update those too.

@Pouare514 Pouare514 changed the title feat(libs): Deathloop loading support (Ampr, NetCtlApDialog, Party + stubs) feat(libs): Deathloop loading support (Ampr, NetCtlApDialog + stubs) Oct 9, 2026
@Pouare514

Copy link
Copy Markdown
Contributor Author

Done: title no longer mentions Party, What no longer mentions the NpCppWebApi stubs, Depends on: none ticked. Thanks also to popcoder565 for the Windows run (520/521 with the unrelated guest_offline_imports failure from #2359).

@adriadam10 adriadam10 left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Checked the diff against main: every export is a throwing stub, no duplicates with main, no NID alias repeating its own name, TechnicalDebt lines sit in "Unknown function info". The merged tree builds (including the new libSceNetCtlApDialog module) and the libs ctest scope passes; Windows run by @popcoder565 covers MinGW. Merging.

@adriadam10
adriadam10 merged commit 948a526 into boykopovar:main Oct 10, 2026
8 of 9 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.

4 participants