fix(prx): build and export the stubs that eight libraries never shipped #10944

Merged
ahmadmuj merged 3 commits from upstream-pr/10944 into main 2026-10-26 21:56:59 +00:00
ahmadmuj commented 2026-10-25 11:16:07 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by ahmadmuj on 2026-10-25T11:16:07Z.


What

The split PRs from #8747 (#8808, #8809, #8812, #8814, #8829, #8831, #8832) each added an Export.cpp of NotImplemented_nid_no_patch stubs. All seven libraries have their own CMakeLists.txt, so core/libs/CMakeLists.txt never adds Export.cpp for them, and nothing else did. None of the 101 stubs got built:

Library Stubs
libSceAgc 1
libSceAgcDriver 35
libSceAudiodec.native 14
libSceAvPlayer.native 2
libSceNgs2.native 15
libSceNpTrophy2 23
libSceNpUniversalDataSystem 11

A title that imports one of these doesn't get the throw on call; the import is absent and the loader fails (USAGE.md "absent"). This adds each Export.cpp to its target. For AgcDriver it goes into agcDriverSources, not at the end of the file, to stay clear of the many open PRs on that file.

Ngs2.native and AvPlayer.native build with CXX_VISIBILITY_PRESET hidden, so those two files also get -fvisibility=default as a source property (the twins use #pragma GCC visibility, but the extension check rejects new pragmas). libSceNgs2's PendingExports.cpp has the same visibility problem: it's compiled, but its 6 stubs (sceNgs2FftInit, sceNgs2FftProcess, sceNgs2FftQuerySize, sceNgs2ParseWaveformUser, sceNgs2SystemEnumHandles, sceNgs2SystemEnumRackHandles) end up local, so it gets the same line.

The visibility lines only matter on Linux, and presumably macOS. MinGW's PE exports ignore -fvisibility, so on Windows the 6 libSceNgs2 stubs were already exported; wachi35676 confirmed that below. The CMake part (building the seven Export.cpp files) is what fixes Windows.

No stub bodies change. Side note: libScePlayerInvitationDialog/Export.cpp isn't compiled either, but its two functions are already built from libScePlayerInvitationDialog.cpp, so I left it alone.

Tested

Ubuntu 24.04 on WSL2, GCC 13.3, full build with tests.

  • Five tests each take one stub's address through a volatile pointer, without calling it, so they keep passing once the stub is implemented: agc_platform_tests (sceAgcSuspendPointAndCheckStatus), agc_driver_unsupported_diagnostics (sceAgcDriverSetFlip), ngs2_handleerrors (sceNgs2RackQueryInfo), guest_nptrophy2 (sceNpTrophy2SystemCreateContext), guest_np_trophy_data (sceNpUniversalDataSystemIntInitialize). Without the CMake change all five fail to link with undefined reference (rechecked in Release after merging main 85f8e113); with it they pass.
  • nm -D --defined-only on the unpatched .prx files: all 101 names plus the 6 libSceNgs2 ones are exported. In the patched .prx files, all of them are NID-renamed.
  • Audiodec.native, AvPlayer.native and libSceNgs2 have no test that links their stubs, so for those the nm check is the evidence.
  • Latest run (main 85f8e113 merged): the five tests plus public_headers (65) pass, 70/70.
  • Full ctest on the original base: 2210/2212 pass. The two failures (guest_socket_options, guest_socket_read_write) fail the same way on main on this machine (WSL loopback).
  • check_conventions.py --base origin/main passes.
  • Windows: not run by me; ycbuzi and wachi35676 ran it (see their comments). Not tested: macOS, and no game dumps.

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 (AgcDriver only gains NotImplemented exports, no rendering change; the AGC tests ran on lavapipe)
  • AI-assisted: yes
<!-- greyfinch-sync:boykopovar/AnyPS5:issue:5004214066 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/10944). Originally posted by [ahmadmuj](https://github.com/ahmadmuj) on 2026-10-25T11:16:07Z. --- ### What The split PRs from #8747 (#8808, #8809, #8812, #8814, #8829, #8831, #8832) each added an `Export.cpp` of `NotImplemented_nid_no_patch` stubs. All seven libraries have their own `CMakeLists.txt`, so `core/libs/CMakeLists.txt` never adds `Export.cpp` for them, and nothing else did. None of the 101 stubs got built: | Library | Stubs | |---|---| | libSceAgc | 1 | | libSceAgcDriver | 35 | | libSceAudiodec.native | 14 | | libSceAvPlayer.native | 2 | | libSceNgs2.native | 15 | | libSceNpTrophy2 | 23 | | libSceNpUniversalDataSystem | 11 | A title that imports one of these doesn't get the throw on call; the import is `absent` and the loader fails (USAGE.md "absent"). This adds each `Export.cpp` to its target. For AgcDriver it goes into `agcDriverSources`, not at the end of the file, to stay clear of the many open PRs on that file. Ngs2.native and AvPlayer.native build with `CXX_VISIBILITY_PRESET hidden`, so those two files also get `-fvisibility=default` as a source property (the twins use `#pragma GCC visibility`, but the extension check rejects new pragmas). libSceNgs2's `PendingExports.cpp` has the same visibility problem: it's compiled, but its 6 stubs (`sceNgs2FftInit`, `sceNgs2FftProcess`, `sceNgs2FftQuerySize`, `sceNgs2ParseWaveformUser`, `sceNgs2SystemEnumHandles`, `sceNgs2SystemEnumRackHandles`) end up local, so it gets the same line. The visibility lines only matter on Linux, and presumably macOS. MinGW's PE exports ignore `-fvisibility`, so on Windows the 6 libSceNgs2 stubs were already exported; wachi35676 confirmed that below. The CMake part (building the seven `Export.cpp` files) is what fixes Windows. No stub bodies change. Side note: `libScePlayerInvitationDialog/Export.cpp` isn't compiled either, but its two functions are already built from `libScePlayerInvitationDialog.cpp`, so I left it alone. ### Tested Ubuntu 24.04 on WSL2, GCC 13.3, full build with tests. - Five tests each take one stub's address through a `volatile` pointer, without calling it, so they keep passing once the stub is implemented: `agc_platform_tests` (`sceAgcSuspendPointAndCheckStatus`), `agc_driver_unsupported_diagnostics` (`sceAgcDriverSetFlip`), `ngs2_handleerrors` (`sceNgs2RackQueryInfo`), `guest_nptrophy2` (`sceNpTrophy2SystemCreateContext`), `guest_np_trophy_data` (`sceNpUniversalDataSystemIntInitialize`). Without the CMake change all five fail to link with `undefined reference` (rechecked in Release after merging `main` 85f8e113); with it they pass. - `nm -D --defined-only` on the unpatched `.prx` files: all 101 names plus the 6 libSceNgs2 ones are exported. In the patched `.prx` files, all of them are NID-renamed. - Audiodec.native, AvPlayer.native and libSceNgs2 have no test that links their stubs, so for those the `nm` check is the evidence. - Latest run (`main` 85f8e113 merged): the five tests plus `public_headers` (65) pass, 70/70. - Full `ctest` on the original base: 2210/2212 pass. The two failures (`guest_socket_options`, `guest_socket_read_write`) fail the same way on main on this machine (WSL loopback). - `check_conventions.py --base origin/main` passes. - Windows: not run by me; ycbuzi and wachi35676 ran it (see their comments). Not tested: macOS, and no game dumps. ### Checklist - [x] Based on current `main`; no other open PR implements the same functions - [x] One topic per PR; follow-ups go in a new PR - [x] No comments in code except [technical debt](https://github.com/boykopovar/AnyPS5/blob/main/docs/dev/CONVENTIONS.md) - [x] Unimplemented paths throw (`NotImplemented_nid_no_patch`); silent stubs are listed under Silent stubs in their library's [technical debt](https://github.com/boykopovar/AnyPS5/tree/main/docs/dev/debt) file - [x] No notes, investigation `.md` files or images added to the repository (attach them to this PR) - [x] New third-party code is a submodule built from source - [x] Generic behaviour, not specific to one title - [x] Depends on: none - [x] Fixes: none - [x] Unblocks: none - [x] GPUs tested: n/a (AgcDriver only gains NotImplemented exports, no rendering change; the AGC tests ran on lavapipe) - [x] AI-assisted: yes
MarcZX10 commented 2026-10-25 11:24:36 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by MarcZX10 on 2026-10-25T11:24:36Z.

Review: APPROVED


Reviewed exact head 11b193c. The previously uncompiled stub files are now wired into their owning targets; source visibility is explicitly raised where the shared target uses hidden visibility, including the existing six NGS2 pending stubs. The five added runtime tests call representative stubs and verify their diagnostics, and the reported dynamic-symbol check covers all 101 newly wired names plus those six. Local conventions and diff checks passed. The author reports the full build and CTest results, including two failures reproduced on main; Windows/macOS and title runs were not performed. I did not independently rerun the full build or symbol scan locally.

<!-- greyfinch-sync:boykopovar/AnyPS5:review:5642917621 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/10944#pullrequestreview-5642917621). Originally posted by [MarcZX10](https://github.com/MarcZX10) on 2026-10-25T11:24:36Z. **Review:** APPROVED --- Reviewed exact head 11b193c. The previously uncompiled stub files are now wired into their owning targets; source visibility is explicitly raised where the shared target uses hidden visibility, including the existing six NGS2 pending stubs. The five added runtime tests call representative stubs and verify their diagnostics, and the reported dynamic-symbol check covers all 101 newly wired names plus those six. Local conventions and diff checks passed. The author reports the full build and CTest results, including two failures reproduced on main; Windows/macOS and title runs were not performed. I did not independently rerun the full build or symbol scan locally.
Sign in to join this conversation.
No reviewers
No labels
No milestone
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Reference
boykopovar/AnyPS5!10944
No description provided.