Skip to content

feat(libSceEsvmDecoderModeEx): scaffold the module from its catalog export - #18080

Closed
ColonelRyzen wants to merge 3 commits into
boykopovar:mainfrom
ColonelRyzen:feat/libSceEsvmDecoderModeEx-catalog-declarations
Closed

ColonelRyzen wants to merge 3 commits into
boykopovar:mainfrom
ColonelRyzen:feat/libSceEsvmDecoderModeEx-catalog-declarations

Conversation

@ColonelRyzen

@ColonelRyzen ColonelRyzen commented Nov 10, 2026 •

Copy link
Copy Markdown
Contributor

What

The PS5 13.60 function stub library catalog names a module libSceEsvmDecoderModeEx - one record, one export, sceEsvmUseCustomMusicCoreForDecoderMode - and this repository carries no module under that name, so a title importing it fails at relink time. This PR adds the module: Export.cpp, include/Api.hpp and the libSceEsvmDecoderModeEx.hpp umbrella header declare the export spelled plainly, and the NID the patcher derives from the name is that catalog NID M8-ylcEPnGo, so no APS5_EXPORT is needed, and the body throws NotImplemented_nid_no_patch(__func__). Nothing is implemented; it is a declaration-only scaffold whose purpose is that an import of libSceEsvmDecoderModeEx resolves. The module name is the catalog's own library field value, which is also what its file name (libsceesvmdecodermodeex-a785deee5d.jsonl) is built from.

The evidence is the pinned catalog file, which contains exactly this one record, kind: defined_function_export with source_evidence: [firmware_export_table, verified_nid_name_map] and signature_status: unknown - the catalog publishes no prototype, so no-parameter-and-throwing is the strongest thing that evidence supports. The NID equals the value this repository's own NID algorithm derives from the name (recomputed with compute_nid from tools/nid_names.py), and no library on main declares the name, so there is nothing to conflict with. The debt file copies the name/NID pair, states the source evidence and marks console behaviour unmeasured.

The stubs are spelled plainly and carry no APS5_EXPORT: Nid::Internal::IsNidNoPatch (core/libs/nid/include/nid/NidPatcherUtils.hpp) leaves a _nid_no_patch name verbatim in the export table, while every other exported name is stripped and hashed, so a plainly spelled stub already becomes its own NID export. Binding that same NID again with APS5_EXPORT would put two exports under one patched name, and spelling the function _nid_no_patch would leave the suffixed name in the guest library's export table next to the NID. This is the shape the merged skeleton libraries use: in core/libs/prx/libSceTtsEngine/Export.cpp the nine exports whose names are known carry no APS5_EXPORT and only the genuinely unknown ones keep an alias. the _nid_no_patch spelling used across the tree: MinGW also exports the defined function symbol itself, whose patched export name is derived from its own spelling, so binding the catalog NID to a plainly spelled function would place two exports under one patched name and the PE patcher rejects the library.

Tested

Linux x86-64 (glibc 2.39, gcc 13.3.0). New test guest_esvm_decodermodeex_catalog_exports (core/libs/tests/GuestEsvmDecoderModeExCatalogExports.cpp) includes prx/libSceEsvmDecoderModeEx/libSceEsvmDecoderModeEx.hpp and calls the export by name, so a declaration that disappears is a compile error rather than a passing test, and the call has to reach libc's shared not-implemented path: the test pins NotImplementedCalls advancing by exactly one and the error text naming the export. The registration is in the new module's own core/libs/prx/libSceEsvmDecoderModeEx/CMakeLists.txt with the Windows PATH=path_list_prepend:$<TARGET_FILE_DIR:libSceEsvmDecoderModeEx> block of its neighbours, so this branch touches no shared CMakeLists.txt - core/libs/CMakeLists.txt picks the directory up from its prx/*/CMakeLists.txt glob. The base branch's own copy of tools/check_conventions.py, the ctest registration audit and the PE export-name collision audit (a plain-spelled stub bound to the NID that equals its own spelling) all report nothing for this branch. ctest --test-dir build-ci -R esvm_decodermodeex_catalog: 1/1 passed. No Windows run here. python3 tools/pr_overlap.py --branch feat/libSceEsvmDecoderModeEx-catalog-declarations probed all 1984 open pull requests: none shares a file, a line or an export with this branch, and none had to be excluded.

After this head, readelf --dyn-syms -W build/core/libs/libs/libSceEsvmDecoderModeEx.prx lists exactly the 1 catalog NIDs and none of the function spellings, so no export is lost and none is duplicated by an alias.

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
  • Fixes: none
  • Unblocks: none
  • GPUs tested: n/a
  • AI-assisted: yes

…xport

The PS5 13.60 stub-library catalog names libSceEsvmDecoderModeEx - the spelling its
library field uses, and the module the file libsceesvmdecodermodeex-a785deee5d.jsonl
describes - with one record, sceEsvmUseCustomMusicCoreForDecoderMode, and the
repository carries no module under that name, so a title importing it fails at relink
time. This adds the module as a no-parameter throw stub bound to its catalog NID
through APS5_EXPORT.

The record says signature_status: unknown, so no prototype is implied. The stub
symbol carries the _nid_no_patch spelling used across the tree: MinGW also exports
the defined function symbol itself, whose patched export name is derived from its
own spelling, so binding the catalog NID to a plainly spelled function places two
exports under one patched name and the PE patcher rejects the library. The guest
test is registered in the module's own CMakeLists.txt, so no shared CMakeLists.txt
changes.
@JJenkx

JJenkx commented Nov 10, 2026

Copy link
Copy Markdown
Contributor

Windows check of head b16e814c43, merged onto main 39bac5d055 (c33387de8d, clean merge).

Setup: Windows 11 Enterprise 22621, WinLibs GCC 15.2 UCRT, Release. The hosted Windows check does not run these tests on pull requests.

  • guest_esvm_decodermodeex_catalog_exports passes in 3 of 3 runs, none skipped.

AI-assisted: yes.

@github-actions

github-actions Bot commented Nov 10, 2026 •

Copy link
Copy Markdown

Progress report (b819419 → e1a6c12)

📉 System libraries: 36.38% (-0.0009%, +1 declared functions)

🆕 1 declared as stubs
Library Name
libSceEsvmDecoderModeEx sceEsvmUseCustomMusicCoreForDecoderMode

Changed libraries (implemented exports)

Library Before After Change
libSceEsvmDecoderModeEx Not present 0/1 (0.00%) n/a

… the catalog test

The test tallied failures and returned 1; 1030 of the 1288 files in core/libs/tests
abort instead, and prx/libSceNKWebKit/tests/Forwarding.cpp additionally requires that a
reached stub advance libc's NotImplementedCalls counter. Asserting the counter and the
error text turns "it threw something" into "it threw libc's shared not-implemented error,
once, naming the export that was called".
A plain `sce*` export is renamed to its computed NID by the patcher, so a stub whose
name already hashes to the NID the catalog records needs no APS5_EXPORT alias: the alias
resolves to the same export string and `nid_patcher` fails the build with "duplicate patched
export name", which is what the Windows job reported. A symbol spelled `_nid_no_patch` is
also left in the library's export table under that spelling, so the alias form added a junk
export next to the NID.

This is the shape the merged skeleton libraries use (for example
core/libs/prx/libSceTtsEngine/Export.cpp, where the nine exports whose names are known carry
no APS5_EXPORT and only the NID-named aliases remain), and it follows NidPatcherUtils.hpp:
IsNidNoPatch keeps a suffixed name verbatim, everything else is stripped and hashed.
@ColonelRyzen

Copy link
Copy Markdown
Contributor Author

Two follow-ups prompted by the review on #17847, pushed as ordinary commits (no history rewritten):

  • e1a6c124fd - the stubs are spelled plainly and the APS5_EXPORT aliases are gone. Nid::Internal::IsNidNoPatch (core/libs/nid/include/nid/NidPatcherUtils.hpp) spares only _nid_no_patch and SDL_ names; every other exported name is stripped and hashed, so a plainly spelled stub already becomes its own NID export and the alias was a second export on that same patched name. The _nid_no_patch spelling at the previous head avoided the duplicate but left the suffixed name in the library's export table beside the NID. This is the shape merged skeleton libraries use (core/libs/prx/libSceTtsEngine/Export.cpp, feat(libSceTtsEngine): add skeleton library and 11 firmware 13.60 stubs #13361): named exports carry no APS5_EXPORT, only the genuinely unnamed ones keep aliases.
  • 38465d4ebb - the failure tally and return failures == 0 ? 0 : 1 are replaced by the abort convention, and the assertion follows prx/libSceNKWebKit/tests/Forwarding.cpp (ExpectStub): NotImplementedCalls_nid_no_patch() has to advance by exactly one and the error text has to name the export that was called, so "it threw something" no longer passes.

Verified on Linux at head e1a6c124fd: core/libs/libs/libSceEsvmDecoderModeEx.prx builds, and readelf --dyn-syms -W on the patched .prx lists exactly the 1 catalog NIDs and none of the function spellings, so nothing is lost and nothing is duplicated. guest_esvm_decodermodeex_catalog_exports passes.

@JJenkx the Windows run covered b16e814c43; a run on this head would be welcome, since the export table itself changed.

@oneandonlydean

Copy link
Copy Markdown
Collaborator

@ColonelRyzen, the scaffold itself is fine: the names and NIDs are derivable and every body throws. What is missing is a reason to carry it now. Library scaffolds that only declare throwing exports are kept only when a title is shown to import the library, and this PR lists Unblocks: none and cites no title. Could you add to the PR body a title ID that imports this module, with the evidence (for example the import list from the relinker output for that title, or the unresolved import error it hits today)? With that in place I will review it again. The same applies to your other scaffold PRs of this shape, so please check each one against the same bar.

@ColonelRyzen

Copy link
Copy Markdown
Contributor Author

Closing this myself.

The blocker is evidence I cannot produce. A stub-only module needs a title that imports it to be worth landing - the standard @oneandonlydean set on my other scaffolds. This PR stands on one declaration, sceEsvmUseCustomMusicCoreForDecoderMode, taken from a catalog extract, so a new module for a single unverified name is the weakest of my four cases.

It is also an Esvm-family name, and that family is where the duplicate-export trouble has been reported, so which module a title binds a name to has to come from real imports rather than from a name list.

Why I cannot get that evidence from here. These declarations come from version-labelled catalog extracts - metadata about a dump I do not have - rather than from firmware or a game I own, and enumerating the imports of firmware or titles would need exactly the dumps I do not have: I have no title dumps and no modded console on this side. I am also not going to work from someone else's dump: CONTRIBUTING.md is explicit that you work only from dumps of titles and firmware that you own, that a title dump is a game you own, and that you never use someone else's dump because you cannot know what was done to it or where it came from.

So there is no route from where I sit to what this needs in order to stay open, and an unverifiable stub-only module is not worth review time. Closing rather than leaving it parked. The branch stays (feat/libSceEsvmDecoderModeEx-catalog-declarations) with the declarations, the test and the debt entry on it, in case someone can supply what is missing: a title ID that imports the module, or a dump of the module from firmware or a title they own.

Sorry for the time this took, and for the review time it spent.

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