Skip to content

feat(libs): implement font, libc, libkernel and misc prx stubs - #2193

Closed
Thomas73737 wants to merge 3 commits into
boykopovar:mainfrom
Thomas73737:feat/prx-stub-implementation
Closed

Thomas73737 wants to merge 3 commits into
boykopovar:mainfrom
Thomas73737:feat/prx-stub-implementation

Conversation

@Thomas73737

@Thomas73737 Thomas73737 commented Oct 9, 2026 •

Copy link
Copy Markdown

What

Implements library exports that were still unimplemented on main, in several areas:

  • libSceFont / libSceFontFt: font and glyph attribute get/set, script language and typographic design, words (create/destroy/find word characters), string and character text-code iteration, text/glyph rendering paths and the FreeType format support queries.
  • libc / libSceLibcInternal: heap diagnostics, the std::__atomic_assert helper (prints the failed assertion to stderr and aborts instead of the previous no-op stub), and the forced TLS destructor pass.
  • libkernel: sceKernelFcntl, page table statistics, module info, pthread_attr_setsolosched_np and __tls_get_addr on Linux.
  • libScePsml_debug / libSceSystemGesture / libSceVoiceQoS: state machines instead of stubs — NID-based names recovered from KytyPS5 and SharpEmu for the MFSR entry points, recognizers and touch events for system gesture, and endpoint/connection handling for voice QoS.
  • libSceSsl: the certificate readers (serial number, subject/issuer names, name entry count/info, load cert, close) with signatures from SharpProspero; sceSslGetPem stays a throwing stub.
  • libSceAjm.native / libSceNgs2.native / libSceAudioOut / libSceAudioIn: sceAjmBatchJobDecodeSplit delegation, NGS2 geometry/panifier/render parameters, AudioOut2 mastering state/init/terminate, 3D latency and supported-attribute queries, and AudioIn open/hq/async capture paths.

Every unimplemented path still throws NotImplemented_nid_no_patch; the silent stubs that remain are documented in docs/dev/TechnicalDebt.md in this pull request.

To keep this PR overlap-free with the open backlog, the following were left out (already covered elsewhere, or reverted here):

After the review of #1498: tools/progress.py now counts UnsupportedQuery calls as stub markers (so the libSceFont UnsupportedQuery throwers stay "pending"), scePsmlMfsr2* and sceAgcDriverRegisterMultipleResources keep the honest NotImplemented_nid_no_patch path, and the pthread_cancel/scePthreadCancel work was dropped because PR #1739 covers it.

Tested

  • OS: Linux (GCC 15.3, CMake 4.3.4, Ninja, CMAKE_BUILD_TYPE=Release).
  • ninja -C build: builds clean.
  • ctest --test-dir build -j2: 511/513 pass. The two failures are environmental on this host: guest_random (std::random_device returns the constant 0xFFFFFFFF here, reproduced by a standalone program with no project code involved) and agc_driver_f32_denormal_flush (this GPU's float-denormal handling differs from the expected RDNA behaviour). Three AGC-driver tests skip by design.
  • python3 tools/progress.py: libraries 2678/3044 (87.98%) against 2578/3044 (84.69%) on main (+100 functions); shaders 1166/1166 (100%). tools/progress.py now also treats a call to the UnsupportedQuery throw helper as a stub marker, so the count only grows for real implementations.
  • python3 tools/check_conventions.py --base origin/main --head HEAD: passed.

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

@github-actions

github-actions Bot commented Oct 9, 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
#2150 core/libs/prx/libSceFont/src/Unimplemented.cpp L106-120
#2181 tools/progress.py L75
#2269 core/libs/prx/libkernel/Unimplemented.cpp L24-25

@AchrafReyani

Copy link
Copy Markdown
Contributor

H+8UBOwfScI (libcCyberUnknown08 in core/libs/prx/libc/Export.cpp) is compiler-rt's __powidf2, which #2158 already implements under its name. #2158 is reviewed, and its full Linux and Windows builds are green. The pr-overlap bot reports the conflict on both PRs. Could you drop that stub change from this PR so the two don't collide? Nothing else here overlaps with my open PRs.

@Thomas73737

Thomas73737 commented Oct 9, 2026 •

Copy link
Copy Markdown
Author

Done — dropped the libcCyberUnknown08 change from this PR; it is back to the main-line stub, so it no longer collides with #2158's __powidf2. Rebuilt libc, guest libc tests pass, conventions clean, progress now 2714/3048 (89.04%). Thanks for the heads-up.

@Thomas73737
Thomas73737 force-pushed the feat/prx-stub-implementation branch 2 times, most recently from 583a206 to ab61709 Compare October 9, 2026 12:09
@Thomas73737

Copy link
Copy Markdown
Author

De-conflicted this PR against the overlapping open PRs flagged by the overlap bot:

Progress is now 2710/3048 (88.91%) computed honestly.

@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 ab61709d, merged onto main d70b899 together with #1324, #2039 and #2247.

It doesn't build on Windows:

core/libs/prx/libkernel/File/src/Open.cpp:205:26: error: '::_fcntl' has not been declared; did you mean '_fcvt'?

The Windows CRT has no fcntl (or _fcntl). The _WIN32 branch of sceKernelFcntl needs to keep the NotImplemented_nid_no_patch stub, or implement the commands it needs on top of Windows calls.

Its BnMAMrsfVWo stub is malloc_stats_fast, which #2039 implements. sceLibcUnknown_BnMAMrsfVWo is exported under that NID, and #2039's malloc_stats_fast_nid_postfix patches to the same name. With both PRs merged, libc.prx fails on Windows with duplicate patched export name: BnMAMrsfVWo.

With the _WIN32 branch stubbed and that stub dropped locally, the full suite passes in this build (512 of 512), including guest_ssl and guest_vdecsw.

🤖 Addressed by Claude Code

@Thomas73737
Thomas73737 force-pushed the feat/prx-stub-implementation branch from ab61709 to 7f94f1c Compare October 9, 2026 17:32
@Thomas73737

Copy link
Copy Markdown
Author

Fixed both Windows issues from the native build. Thanks for catching them:

  • sceKernelFcntl: the _WIN32 branch is back to NotImplemented_nid_no_patch (+ return 0); the POSIX fcntl wrapper is kept. The Windows CRT has no _fcntl, so the branch no longer references it.
  • sceLibcUnknown_BnMAMrsfVWo: dropped entirely — it is malloc_stats_fast, which feat(libc): implement malloc_stats_fast through the application allocator #2039 implements via malloc_stats_fast_nid_postfix under the same NID, so no duplicate patched export name remains. (The throw std::bad_weak_ptr() body was a misidentification anyway.)

Also built/libtested on Linux (clean), conventions pass. Progress is now 2708/3047 (88.87%) counted honestly.

- libSceFont/libSceFontFt: attribute, script language, typographic design, words, text layout and FreeType rendering paths
- libc/libSceLibcInternal: locale data, heap diagnostics, vsnprintf, forced TLS destructor
- libkernel: sceKernelFcntl, page table stats, module info, coredump debug text, exception handling, pthread_cancel
- libScePsml_debug/libSceSystemGesture/libSceVoiceQoS: real state machines instead of stubs
@Thomas73737
Thomas73737 force-pushed the feat/prx-stub-implementation branch from f14564e to 6a5f125 Compare October 9, 2026 18:15
@Thomas73737

Copy link
Copy Markdown
Author

Force-pushed an update to keep this PR overlap-free with the open backlog. Dropped the groups that other open PRs already cover (thank you @popcoder565 for the Windows follow-up too):

Also fixed the Windows build (the _WIN32 branch of sceKernelFcntl no longer uses the missing _fcntl, back to NotImplemented_nid_no_patch), and kept the std::__atomic_assert helper (real fprintf + abort instead of the no-op stub).

Re-validated on this tree: ninja clean, ctest 511/513 (only the two environmental failures), tools/check_conventions.py passed, tools/progress.py libraries 2678/3044 (87.98%).

@popcoder565

Copy link
Copy Markdown
Contributor

@Thomas73737 thanks. 6a5f125a still doesn't compile on Windows:

core/libs/prx/libkernel/File/src/Open.cpp:210:9: error: 'result' was not declared in this scope

The #endif comes before the shared if (result < 0) tail, so on Windows result is never declared. Moving the #endif after return result; fixes it:

     const int result = ::fcntl(d, cmd, arg);
-#endif
     if (result < 0) {
         return SceErrorFromErrno(errno);
     }
     return result;
+#endif
 }

With that change the full suite passes on Windows (513 of 513, merged onto main 8b393b6 together with #2257).

🤖 Addressed by Claude Code

@adriadam10

Copy link
Copy Markdown
Collaborator

Closing, for the same reason @oneandonlydean closed #1498, which this continues:

  • It still spans many libraries (Font/FontFt, libc, libkernel, Psml, SystemGesture, VoiceQoS, Ssl, Ajm, Ngs2, AudioOut/In, Agc submit) in 32 files; CONTRIBUTING asks for one topic per PR.
  • No title or log line is named for any of the functions, and a good part of the change replaces NotImplemented_nid_no_patch with UnsupportedQuery throws or constant returns (e.g. libSceFont/src/Unimplemented.cpp), and tools/progress.py is changed in the same PR, so the +100 count is not backed by new behaviour.
  • Only one test file (GuestSsl.cpp) covers the whole diff, and the Windows build broke on two consecutive heads.

You are welcome to reopen with one library at a time, each function tied to a title that reaches it on main (ID + log line), with tests pinning the values.

@adriadam10 adriadam10 closed this Oct 9, 2026
@github-actions

github-actions Bot commented Oct 9, 2026

Copy link
Copy Markdown

Progress report (8b393b6 → 8973abb)

📈 System libraries: 87.98% (+3.29%, +100 implemented functions)

✅ 100 implemented
Library Name
libSceAgcDriver sceAgcDriverSubmitCommandBuffer
libSceAgcDriver sceAgcDriverSubmitMultiCommandBuffers
libSceAjm.native sceAjmBatchJobDecodeSplit
libSceAudioIn sceAudioInAsyncOpen
libSceAudioIn sceAudioInHqOpen
libSceAudioIn sceAudioInOpen
libSceAudioOut sceAudioOut2MasteringGetState
libSceAudioOut sceAudioOut2SetSystemDebugState
libSceAudioOut sceAudioOut2UserGetSupportedAttributes
libSceFont sceFontCharacterGetSyllableStringState
libSceFont sceFontCharactersRefersTextCodes
libSceFont sceFontCreateWords
libSceFont sceFontDefineAttribute
libSceFont sceFontDestroyWords
libSceFont sceFontGetAttribute
libSceFont sceFontGetScriptLanguage
libSceFont sceFontGetTypographicDesign
libSceFont sceFontGlyphGetAttribute
libSceFont sceFontSetScriptLanguage
libSceFont sceFontSetTypographicDesign
libSceFont sceFontTextCodesStepBack
libSceFont sceFontTextCodesStepNext
libSceFont sceFontWordsFindWordCharacters
libSceFontFt sceFontFtInitAliases
libSceFontFt sceFontFtSetAliasFont
libSceFontFt sceFontFtSetAliasPath
libSceFontFt sceFontFtSupportBdf
libSceFontFt sceFontFtSupportCid
libSceFontFt sceFontFtSupportFontFormats
libSceFontFt sceFontFtSupportOpenType
libSceFontFt sceFontFtSupportOpenTypeOtf
libSceFontFt sceFontFtSupportOpenTypeTtf
libSceFontFt sceFontFtSupportPcf
libSceFontFt sceFontFtSupportPfr
libSceFontFt sceFontFtSupportSystemFonts
libSceFontFt sceFontFtSupportTrueType
libSceFontFt sceFontFtSupportTrueTypeGx
libSceFontFt sceFontFtSupportType1
libSceFontFt sceFontFtSupportType42
libSceFontFt sceFontFtSupportWinFonts
libSceFontFt sceFontFtTermAliases
libSceFontFt sceFontSelectGlyphsFt
libSceNgs2.native sceNgs2GeomResetListenerParam
libSceNgs2.native sceNgs2GeomResetSourceParam
libSceNgs2.native sceNgs2PanInit
libScePsml_debug scePsmlMfsrCreateContext800M3_2
libScePsml_debug scePsmlMfsrCreateSharedResources
libScePsml_debug scePsmlMfsrGetContextBufferRequirement800M3_2
libScePsml_debug scePsmlMfsrGetDispatchMfsrPacket900
libScePsml_debug scePsmlMfsrGetDispatchMfsrPacketSizeInDwords
libScePsml_debug scePsmlMfsrGetMipmapBias
libScePsml_debug scePsmlMfsrGetSharedResourcesInitRequirement
libScePsml_debug scePsmlMfsrInit
libScePsml_debug scePsmlMfsrIsCaptureInProgress
libScePsml_debug scePsmlMfsrReleaseContext
libScePsml_debug scePsmlMfsrReleaseSharedResources
libScePsml_debug scePsmlMfsrRequestCapture
libScePsml_debug scePsmlMfsrSelectConfig
libSceSsl sceSslClose
libSceSsl sceSslFreeSslCertName
libSceSsl sceSslGetIssuerName
libSceSsl sceSslGetNameEntryCount
libSceSsl sceSslGetNameEntryInfo
libSceSsl sceSslGetSerialNumber
libSceSsl sceSslGetSubjectName
libSceSsl sceSslLoadCert
libSceSystemGesture sceSystemGestureAppendTouchRecognizer
libSceSystemGesture sceSystemGestureGetPrimitiveTouchEventByIndex
libSceSystemGesture sceSystemGestureGetPrimitiveTouchEventByPrimitiveID
libSceSystemGesture sceSystemGestureGetPrimitiveTouchEvents
libSceSystemGesture sceSystemGestureGetPrimitiveTouchEventsCount
libSceSystemGesture sceSystemGestureGetTouchEventByEventID
libSceSystemGesture sceSystemGestureGetTouchEvents
libSceSystemGesture sceSystemGestureGetTouchRecognizerInformation
libSceSystemGesture sceSystemGestureRemoveTouchRecognizer
libSceSystemGesture sceSystemGestureResetPrimitiveTouchRecognizer
libSceSystemGesture sceSystemGestureResetTouchRecognizer
libSceSystemGesture sceSystemGestureUpdateAllTouchRecognizer
libSceSystemGesture sceSystemGestureUpdateTouchRecognizerRectangle
libSceVoiceQoS sceVoiceQoSConnect
libSceVoiceQoS sceVoiceQoSCreateLocalEndpoint
libSceVoiceQoS sceVoiceQoSCreateRemoteEndpoint
libSceVoiceQoS sceVoiceQoSDeleteLocalEndpoint
libSceVoiceQoS sceVoiceQoSDeleteRemoteEndpoint
libSceVoiceQoS sceVoiceQoSDisconnect
libSceVoiceQoS sceVoiceQoSEnd
libSceVoiceQoS sceVoiceQoSGetLocalEndpointAttribute
libSceVoiceQoS sceVoiceQoSReadPacket
libSceVoiceQoS sceVoiceQoSSetLocalEndpointAttribute
libSceVoiceQoS sceVoiceQoSSetRemoteEndpointAttribute
libSceVoiceQoS sceVoiceQoSWritePacket
libc _ZSt14_Atomic_assertPKcS0__nid_postfix
libc sceLibcInternalBacktraceForGame_nid_postfix
libc sceLibcInternalHeapErrorReportForGame_nid_postfix
libkernel __tls_get_addr_nid_postfix
libkernel pthread_attr_setsolosched_np_nid_postfix
libkernel sceKernelGetEventError
libkernel sceKernelGetModuleInfoFromAddr
libkernel sceKernelGetPageTableStats
libkernel sceKernelInternalMemoryGetModuleSegmentInfo_nid_postfix

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