fix(libSceFreeType): preserve helpers through NID patching #9848

Closed
Felipebmaitan wants to merge 21 commits from upstream-pr/9848 into main
Felipebmaitan commented 2026-10-22 18:01:44 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by Felipebmaitan on 2026-10-22T18:01:44Z.


What

Merged current main e481b135558fc4316bc3b24e7408156737eff08d into the existing author branch and kept every published commit. Submitted head f05ce37dbbd3e8718e2b7f4a1e2b4159e5ff4826.

Keep the upstream -load_hidden rule for the bundled FreeType archive on macOS. Use canonical C-linkage _nid_no_patch names for helpers that must survive NID patching and update their callers, including variations. Preserve main's SFNT and PostScript value conversions and guarded size request. Upstream archive isolation

Keep both Apple import regressions and build only the patched FreeType, libkernel and libc modules they load. The independent reviewer found that three dynamically imported functions were called through incompatible pointer types. The test now derives all eight pointer types from the guest API declarations, with every original assertion and lookup name preserved.

Tested

Executed on Windows 11 x86-64 with WinLibs GCC 15.2.0 r7.

  • 40 selected FreeType production and test translation units passed syntax checks with the stock MinGW compile flags. Three compiled objects contain all eight canonical helper names as unmangled symbols.
  • The existing PFR null-face test passed after rebuilding its three source files and linking against the prebuilt libc from c8f72e905c. A freshly compiled nid_patcher passed the synthetic Mach-O fixture on Windows.
  • Compiled the Apple import test with a declaration-only dlfcn.h shim and inspected the COFF object. It refers to dlsym and has zero direct guest-wrapper link references. A synthetic CMake/Ninja dry run selected exactly the three patched modules.
  • Conventions, debt validation, the CRLF-aware whitespace check and the public-header audit passed. The function-name overlap scan covered 2,239 open PRs. Read-only merges with #9410 and #23127 were clean.

The stock focused CTest build remained queued for the shared compiler slot and was discontinued after the targeted Windows results above. Fresh macOS validation of this head remains open, including both dyld import tests, the FreeType-family CTests and the Mach-O export audit. The historical 90/90 macOS result was on local e3bfd382b091, based on 6a86d4d1a9cb with the curl build helper from #17425. Kali113's November 14 report

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 and the licence notice of code adapted from upstream (see AGENTS.md)
  • 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
<!-- greyfinch-sync:boykopovar/AnyPS5:issue:4971864197 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/9848). Originally posted by [Felipebmaitan](https://github.com/Felipebmaitan) on 2026-10-22T18:01:44Z. --- ### What Merged current main `e481b135558fc4316bc3b24e7408156737eff08d` into the existing author branch and kept every published commit. Submitted head `f05ce37dbbd3e8718e2b7f4a1e2b4159e5ff4826`. Keep the upstream `-load_hidden` rule for the bundled FreeType archive on macOS. Use canonical C-linkage `_nid_no_patch` names for helpers that must survive NID patching and update their callers, including variations. Preserve main's SFNT and PostScript value conversions and guarded size request. [Upstream archive isolation](https://github.com/boykopovar/AnyPS5/commit/79e2e5926c0b978d61cd654a09aa434acfbb400b) Keep both Apple import regressions and build only the patched FreeType, libkernel and libc modules they load. The independent reviewer found that three dynamically imported functions were called through incompatible pointer types. The test now derives all eight pointer types from the guest API declarations, with every original assertion and lookup name preserved. ### Tested Executed on Windows 11 x86-64 with WinLibs GCC 15.2.0 r7. - 40 selected FreeType production and test translation units passed syntax checks with the stock MinGW compile flags. Three compiled objects contain all eight canonical helper names as unmangled symbols. - The existing PFR null-face test passed after rebuilding its three source files and linking against the prebuilt libc from `c8f72e905c`. A freshly compiled `nid_patcher` passed the synthetic Mach-O fixture on Windows. - Compiled the Apple import test with a declaration-only `dlfcn.h` shim and inspected the COFF object. It refers to `dlsym` and has zero direct guest-wrapper link references. A synthetic CMake/Ninja dry run selected exactly the three patched modules. - Conventions, debt validation, the CRLF-aware whitespace check and the public-header audit passed. The function-name overlap scan covered 2,239 open PRs. Read-only merges with #9410 and #23127 were clean. The stock focused CTest build remained queued for the shared compiler slot and was discontinued after the targeted Windows results above. Fresh macOS validation of this head remains open, including both dyld import tests, the FreeType-family CTests and the Mach-O export audit. The historical 90/90 macOS result was on local `e3bfd382b091`, based on `6a86d4d1a9cb` with the curl build helper from #17425. [Kali113's November 14 report](https://github.com/boykopovar/AnyPS5/pull/9848#issuecomment-6884156531) <!-- OS, title or homebrew, what was checked. "Not tested" is a valid answer. A performance change: the summary lines of main and of this PR from the same machine and scene, with the traces attached, captured as the Performance report issue form describes. --> ### Checklist <!-- Rules behind each item: https://github.com/boykopovar/AnyPS5/blob/main/CONTRIBUTING.md --> - [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) and the licence notice of code adapted from upstream (see AGENTS.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 <!-- #PR, or none --> - [x] Fixes: none <!-- issue it closes as Fixes #N, or none --> - [x] Unblocks: none <!-- title ID and Game bring-up discussion, e.g. PPSA01325 #3232, or none --> - [x] GPUs tested: n/a <!-- for AGC, shader recompiler or VideoOut changes: vendor, model, driver and OS of each GPU the GPU tests ran on; otherwise n/a --> - [x] AI-assisted: yes <!-- yes / no -->
MarcZX10 commented 2026-10-29 23:57:17 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by MarcZX10 on 2026-10-29T23:57:17Z.

Review: COMMENTED


Re-checked — new head, Mac export validation remains unverified

The updated source and tests preserve the requested helper exports, but the PR's Apple-specific export behavior has not yet been validated on the current head.

What I ran

  • Reviewed head 127836bf97942113cf09abfece38fdcada17684c against main d65bff2679b627e6c1dde84f2e95af0bece3c476; git merge-tree --write-tree merged cleanly as 8269d6de571f64ed75e18472dbc9851ce8ff624d.
  • Environment: Linux workspace; no compiler or build was run.
git merge-tree --write-tree upstream/main refs/review/pr-9848-current
git diff --check upstream/main...refs/review/pr-9848-current
python3 tools/check_conventions.py --base upstream/main --head refs/review/pr-9848-current

Results

Check Result
Merge preview Clean; tree 8269d6de571f64ed75e18472dbc9851ce8ff624d
git diff --check Exit 0; no output
Conventions Passed
Hosted checks Eligibility in progress; conventions and labels queued; report passed
Command output
8269d6de571f64ed75e18472dbc9851ce8ff624d
All conventions checks passed.

Not verified

  • The Apple linker rule -exported_symbol,*_nid_* and the patched/unpatched import tests have not run on macOS. The author also identifies the full macOS validation as pending; Windows syntax checks do not verify Mach-O exports.
  • No build or runtime tests were run locally.
<!-- greyfinch-sync:boykopovar/AnyPS5:review:5706483823 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/9848#pullrequestreview-5706483823). Originally posted by [MarcZX10](https://github.com/MarcZX10) on 2026-10-29T23:57:17Z. **Review:** COMMENTED --- # Re-checked — new head, Mac export validation remains unverified The updated source and tests preserve the requested helper exports, but the PR's Apple-specific export behavior has not yet been validated on the current head. ## What I ran - Reviewed head `127836bf97942113cf09abfece38fdcada17684c` against `main` `d65bff2679b627e6c1dde84f2e95af0bece3c476`; `git merge-tree --write-tree` merged cleanly as `8269d6de571f64ed75e18472dbc9851ce8ff624d`. - Environment: Linux workspace; no compiler or build was run. ```sh git merge-tree --write-tree upstream/main refs/review/pr-9848-current git diff --check upstream/main...refs/review/pr-9848-current python3 tools/check_conventions.py --base upstream/main --head refs/review/pr-9848-current ``` ## Results | Check | Result | |---|---| | Merge preview | Clean; tree `8269d6de571f64ed75e18472dbc9851ce8ff624d` | | `git diff --check` | Exit 0; no output | | Conventions | Passed | | Hosted checks | Eligibility in progress; conventions and labels queued; report passed | <details> <summary>Command output</summary> ```text 8269d6de571f64ed75e18472dbc9851ce8ff624d All conventions checks passed. ``` </details> ## Not verified - The Apple linker rule `-exported_symbol,*_nid_*` and the patched/unpatched import tests have not run on macOS. The author also identifies the full macOS validation as pending; Windows syntax checks do not verify Mach-O exports. - No build or runtime tests were run locally.
MarcZX10 commented 2026-11-14 10:01:10 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by MarcZX10 on 2026-11-14T10:01:10Z.

Review: COMMENTED


Reviewed — comments

The code changes consistently route FreeType calls through the guest adapters and add macOS symbol and import checks, but this review cannot confirm the macOS loader behavior on the submitted head.

What I ran

Reviewed head c031df26c6bebd58c5a2fe022a36e947a4bb784a. I did not run commands or tests; repository access was limited to the pinned reader. The Windows checks in the description are author-reported. The description reports fresh macOS verification remains outstanding.

Results

Check Result Note
Diff and changed lines passed Reviewed all 39 changed files
Local tests or build not run No execution available
macOS import and export checks not run Author reports these remain outstanding

Findings

Blocking

None.

Non-blocking

None.

Sources

Reviewed the prepared diff and changed-file contents at the submitted head, including the macOS linker option and import test in core/libs/prx/libSceFreeType/CMakeLists.txt, core/libs/tests/GuestFreeTypeImports.cpp, and the helper declarations and definitions in core/libs/prx/libSceFreeType/include/GuestObjects.hpp and core/libs/prx/libSceFreeType/src/GuestObjects.cpp.

Not verified

No local build or test was run. macOS export behavior, patched and unpatched dynamic imports, and runtime behavior remain unverified in this review. The description’s reported Windows results and historical Mac results were not independently reproduced. All 39 changed files were included in the prepared review bundle; the changed lines were reviewed in the diff. Files excluded by bundle rules: none listed.

To get this to a good state

Nothing is required.

<!-- greyfinch-sync:boykopovar/AnyPS5:review:5903603308 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/9848#pullrequestreview-5903603308). Originally posted by [MarcZX10](https://github.com/MarcZX10) on 2026-11-14T10:01:10Z. **Review:** COMMENTED --- # Reviewed — comments The code changes consistently route FreeType calls through the guest adapters and add macOS symbol and import checks, but this review cannot confirm the macOS loader behavior on the submitted head. ## What I ran Reviewed head `c031df26c6bebd58c5a2fe022a36e947a4bb784a`. I did not run commands or tests; repository access was limited to the pinned reader. The Windows checks in the description are author-reported. The description reports fresh macOS verification remains outstanding. ## Results | Check | Result | Note | |---|---|---| | Diff and changed lines | passed | Reviewed all 39 changed files | | Local tests or build | not run | No execution available | | macOS import and export checks | not run | Author reports these remain outstanding | ## Findings ### Blocking None. ### Non-blocking None. ## Sources Reviewed the prepared diff and changed-file contents at the submitted head, including the macOS linker option and import test in `core/libs/prx/libSceFreeType/CMakeLists.txt`, `core/libs/tests/GuestFreeTypeImports.cpp`, and the helper declarations and definitions in `core/libs/prx/libSceFreeType/include/GuestObjects.hpp` and `core/libs/prx/libSceFreeType/src/GuestObjects.cpp`. ## Not verified No local build or test was run. macOS export behavior, patched and unpatched dynamic imports, and runtime behavior remain unverified in this review. The description’s reported Windows results and historical Mac results were not independently reproduced. All 39 changed files were included in the prepared review bundle; the changed lines were reviewed in the diff. Files excluded by bundle rules: none listed. ## To get this to a good state Nothing is required.
MarcZX10 commented 2026-11-21 05:53:12 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by MarcZX10 on 2026-11-21T05:53:12Z.

Review: APPROVED


Reviewed — looks good

Nothing in the inspected changes blocks merging; the Apple import regression test exercises both patched and unpatched loading paths, but this head has not had fresh macOS validation.

What I ran

Reviewed head f05ce37dbbd3e8718e2b7f4a1e2b4159e5ff4826 using the prepared bundle and repo_read.py at that pinned head. No build or test commands were run. The author reports Windows 11 x86-64 checks; these were not run by me.

Files read: all review documents and diff; all changed files from the manifest were marked included, but only targeted source ranges were read: CMakeLists.txt, Export.cpp, GuestObjects.hpp, GuestObjects.cpp, Bitmap.cpp, OutlineRender.cpp, Variations.cpp, and GuestFreeTypeImports.cpp. No changed file was excluded by files.json.

Results

Check Result Note
Source review passed Helper renames and callers are consistent in inspected paths.
Build and tests not run Author reports targeted Windows checks.
Fresh macOS validation not run Author identifies this as still open.

Findings

Blocking

None.

Non-blocking

None.

Not verified

I did not read every changed file in full or run builds/tests. In particular, fresh macOS validation, both dyld import tests, the FreeType-family CTests, and the Mach-O export audit remain unconfirmed for this head. The author reports that the focused CTest build was discontinued while queued.

To get this to a good state

Nothing is required.

<!-- greyfinch-sync:boykopovar/AnyPS5:review:6003326617 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/9848#pullrequestreview-6003326617). Originally posted by [MarcZX10](https://github.com/MarcZX10) on 2026-11-21T05:53:12Z. **Review:** APPROVED --- # Reviewed — looks good Nothing in the inspected changes blocks merging; the Apple import regression test exercises both patched and unpatched loading paths, but this head has not had fresh macOS validation. ## What I ran Reviewed head `f05ce37dbbd3e8718e2b7f4a1e2b4159e5ff4826` using the prepared bundle and `repo_read.py` at that pinned head. No build or test commands were run. The author reports Windows 11 x86-64 checks; these were not run by me. Files read: all review documents and diff; all changed files from the manifest were marked included, but only targeted source ranges were read: `CMakeLists.txt`, `Export.cpp`, `GuestObjects.hpp`, `GuestObjects.cpp`, `Bitmap.cpp`, `OutlineRender.cpp`, `Variations.cpp`, and `GuestFreeTypeImports.cpp`. No changed file was excluded by `files.json`. ## Results | Check | Result | Note | |---|---|---| | Source review | passed | Helper renames and callers are consistent in inspected paths. | | Build and tests | not run | Author reports targeted Windows checks. | | Fresh macOS validation | not run | Author identifies this as still open. | ## Findings ### Blocking None. ### Non-blocking None. ## Not verified I did not read every changed file in full or run builds/tests. In particular, fresh macOS validation, both dyld import tests, the FreeType-family CTests, and the Mach-O export audit remain unconfirmed for this head. The author reports that the focused CTest build was discontinued while queued. ## To get this to a good state Nothing is required.

Pull request closed

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!9848
No description provided.