feat(libSceFreeType): check outlines and query control bounds #9064

Merged
santhoshkumar-dev merged 1 commit from upstream-pr/9064 into main 2026-10-23 06:25:15 +00:00
santhoshkumar-dev commented 2026-10-21 11:25:52 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by santhoshkumar-dev on 2026-10-21T11:25:52Z.


What

Add FT_Outline_Check and FT_Outline_Get_CBox to the guest FreeType bridge. Contour validation uses the bundled library with an explicit host record; control bounds read guest 64-bit coordinates directly, avoiding Windows FT_Pos narrowing. Null arguments, empty outlines and all control points follow the public source.

Names and NIDs are present in the PS5 3.20 inventory. Behavior comes from bundled FreeType 2.13.3 and its public outline layout. Console signatures, count signedness and errors remain unverified and are recorded in debt.

Open, closed and merged PR searches found no implementation of these two exports. The earlier #8247 debt conflict is resolved by rebasing onto its merged implementation. #8286 still shares the CMake insertion; merge #8286 first. There are no shared exports.

Tested

Windows 11 x64, WinLibs MinGW-w64 GCC 15.2.0 r7, Release, BUILD_TESTING=ON.

  • cmake --build build --target libs guest_freetype_outline_tests guest_freetype_tests guest_freetype_charmap_tests -j6 passed. The three registered tests passed (0.25 / 0.12 / 0.34 s).
  • The outline regression compares more than 4,000 small contour/count combinations with native FreeType and checks full unsigned 16-bit counts and endpoints, including 65,535 points and 65,535 contours. It compares native control bounds for empty/single/mixed/extreme-32-bit inputs, ignores unrelated contour/tag data as the source does, and checks full signed-64-bit extrema independently of Windows' native coordinate width. Output guards and null arguments are covered.
  • After adding the maximum-contours case, guest_freetype_outline passed in 0.15 s. Compiled source mutations that truncate coordinates to 32 bits or reject counts above 32,767 fail the regression.
  • Strict -Wall -Wextra -Werror checks and repository conventions passed. The packaged PRX contains C4a3dGgs+Cc and 8ZxmGwESvSQ.

Rebased onto main 3e91c8edf5; all system libraries rebuilt and the three registered tests passed again (0.14 / 0.07 / 0.07 s).

Historical build limitation (2026-10-21): the default Windows build on the stated base failed at ImageArrayWindowPastLayerLimit.cpp because static alignment 65536 exceeded MinGW COFF's maximum 8192. Merged #8310 fixes that declaration; this is no longer a current-main blocker. The library/test results above retain their stated PR head and base.

No title, PS5 hardware or Linux runtime was tested.

Compatibility validation (2026-10-21): temporarily combined this PR with #8247, #8286, #8289, #9045, #9054 and the charmap-metadata follow-up on main 3e91c8edf5. All system libraries built and all seven FreeType tests passed. The C++ changes merged cleanly; temporary CMake/debt resolutions were used only for this local compatibility check and are not published.

Rebase audit (2026-10-21): rebased onto main d099bc6cd8, including the now-merged #8247 and #8289. All system libraries built. A temporary combination of the seven remaining FreeType branches passed all nine tests (0.07 / 0.07 / 0.06 / 0.06 / 0.16 / 0.04 / 0.06 / 0.06 / 0.05 s); all seven branches passed conventions. Temporary integration commits were not published.

Merge coordination update (2026-10-23): the #8558 overlap is a shared debt insertion only. Agreed order is #8558 before #9064, while retaining the existing #8286 order and both debt entries. Filip722 confirmed this order; this is not an implementation dependency. The agreed helper order before #9588 remains.

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: #8286, #8558 (shared debt insertion; agreed merge order)
  • Fixes: none
  • Unblocks: none
  • GPUs tested: n/a
  • AI-assisted: yes
<!-- greyfinch-sync:boykopovar/AnyPS5:issue:4950773199 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/9064). Originally posted by [santhoshkumar-dev](https://github.com/santhoshkumar-dev) on 2026-10-21T11:25:52Z. --- ### What Add `FT_Outline_Check` and `FT_Outline_Get_CBox` to the guest FreeType bridge. Contour validation uses the bundled library with an explicit host record; control bounds read guest 64-bit coordinates directly, avoiding Windows `FT_Pos` narrowing. Null arguments, empty outlines and all control points follow the public source. Names and NIDs are present in the [PS5 3.20 inventory](https://github.com/DNNDHH/PS5-3.20_Libs/blob/b2a77c09cd71c01f34c790cfbe98c751a13262ad/libSceFreeTypeOt.c). Behavior comes from [bundled FreeType 2.13.3](https://github.com/freetype/freetype/blob/42608f77f20749dd6ddc9e0536788eaad70ea4b5/src/base/ftoutln.c) and its [public outline layout](https://github.com/freetype/freetype/blob/42608f77f20749dd6ddc9e0536788eaad70ea4b5/include/freetype/ftimage.h). Console signatures, count signedness and errors remain unverified and are recorded in debt. Open, closed and merged PR searches found no implementation of these two exports. The earlier #8247 debt conflict is resolved by rebasing onto its merged implementation. #8286 still shares the CMake insertion; merge #8286 first. There are no shared exports. ### Tested Windows 11 x64, WinLibs MinGW-w64 GCC 15.2.0 r7, Release, `BUILD_TESTING=ON`. - `cmake --build build --target libs guest_freetype_outline_tests guest_freetype_tests guest_freetype_charmap_tests -j6` passed. The three registered tests passed (0.25 / 0.12 / 0.34 s). - The outline regression compares more than 4,000 small contour/count combinations with native FreeType and checks full unsigned 16-bit counts and endpoints, including 65,535 points and 65,535 contours. It compares native control bounds for empty/single/mixed/extreme-32-bit inputs, ignores unrelated contour/tag data as the source does, and checks full signed-64-bit extrema independently of Windows' native coordinate width. Output guards and null arguments are covered. - After adding the maximum-contours case, `guest_freetype_outline` passed in 0.15 s. Compiled source mutations that truncate coordinates to 32 bits or reject counts above 32,767 fail the regression. - Strict `-Wall -Wextra -Werror` checks and repository conventions passed. The packaged PRX contains `C4a3dGgs+Cc` and `8ZxmGwESvSQ`. Rebased onto main `3e91c8edf5`; all system libraries rebuilt and the three registered tests passed again (0.14 / 0.07 / 0.07 s). Historical build limitation (2026-10-21): the default Windows build on the stated base failed at `ImageArrayWindowPastLayerLimit.cpp` because static alignment 65536 exceeded MinGW COFF's maximum 8192. Merged #8310 fixes that declaration; this is no longer a current-main blocker. The library/test results above retain their stated PR head and base. No title, PS5 hardware or Linux runtime was tested. <!-- 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. --> Compatibility validation (2026-10-21): temporarily combined this PR with #8247, #8286, #8289, #9045, #9054 and the charmap-metadata follow-up on main `3e91c8edf5`. All system libraries built and all seven FreeType tests passed. The C++ changes merged cleanly; temporary CMake/debt resolutions were used only for this local compatibility check and are not published. Rebase audit (2026-10-21): rebased onto main `d099bc6cd8`, including the now-merged #8247 and #8289. All system libraries built. A temporary combination of the seven remaining FreeType branches passed all nine tests (0.07 / 0.07 / 0.06 / 0.06 / 0.16 / 0.04 / 0.06 / 0.06 / 0.05 s); all seven branches passed conventions. Temporary integration commits were not published. Merge coordination update (2026-10-23): the #8558 overlap is a shared debt insertion only. Agreed order is #8558 before #9064, while retaining the existing #8286 order and both debt entries. [Filip722 confirmed this order](https://github.com/boykopovar/AnyPS5/pull/9064#issuecomment-6351564171); this is not an implementation dependency. The agreed helper order before #9588 remains. ### 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) - [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: <!-- #PR, or none --> #8286, #8558 (shared debt insertion; agreed merge order) - [x] Fixes: <!-- issue it closes as Fixes #N, or none --> none - [x] Unblocks: <!-- title ID and Game bring-up discussion, e.g. PPSA01325 #3232, or none --> none - [x] GPUs tested: <!-- for AGC, shader recompiler or VideoOut changes: vendor, model, driver and OS of each GPU the GPU tests ran on; otherwise n/a --> n/a - [x] AI-assisted: <!-- yes / no --> yes
github-actions[bot] commented 2026-10-21 11:26:33 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by github-actions[bot] on 2026-10-21T11:26:33Z.


Progress report (2f161d4 → 9544a3e)

📈 System libraries: 42.43% (+0.01%, +2 implemented functions)

✅ 2 implemented
Library Name
libSceFreeType FT_Outline_Check_nid_postfix
libSceFreeType FT_Outline_Get_CBox_nid_postfix
<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6314764183 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/9064#issuecomment-6314764183). Originally posted by [github-actions[bot]](https://github.com/apps/github-actions) on 2026-10-21T11:26:33Z. --- <!-- progress-report --> ### Progress report (2f161d4 → 9544a3e) 📈 **System libraries**: 42.43% (+0.01%, +2 implemented functions) <details> <summary>✅ 2 implemented</summary> | Library | Name | | - | - | | libSceFreeType | `FT_Outline_Check_nid_postfix` | | libSceFreeType | `FT_Outline_Get_CBox_nid_postfix` | </details>
Ondra97 commented 2026-10-22 03:31:29 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by Ondra97 on 2026-10-22T03:31:29Z.


I opened #9588 for FT_Glyph_Get_CBox. I declared #9064 as an implementation dependency and reuse its existing LP64 FT_Outline_Get_CBox adapter unchanged. Merge this helper PR first; the new query uses it for retained outline glyphs.

<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6331994135 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/9064#issuecomment-6331994135). Originally posted by [Ondra97](https://github.com/Ondra97) on 2026-10-22T03:31:29Z. --- I opened #9588 for FT_Glyph_Get_CBox. I declared #9064 as an implementation dependency and reuse its existing LP64 FT_Outline_Get_CBox adapter unchanged. Merge this helper PR first; the new query uses it for retained outline glyphs.
santhoshkumar-dev commented 2026-10-22 07:37:38 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by santhoshkumar-dev on 2026-10-22T07:37:38Z.


Confirmed: merge #9064 before #9588. The LP64 FT_Outline_Get_CBox helper here is the shared implementation for the retained-outline query; retain one copy of the helper and its existing test, alongside the distinct glyph-query implementation and regression.

<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6335411513 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/9064#issuecomment-6335411513). Originally posted by [santhoshkumar-dev](https://github.com/santhoshkumar-dev) on 2026-10-22T07:37:38Z. --- Confirmed: merge #9064 before #9588. The LP64 `FT_Outline_Get_CBox` helper here is the shared implementation for the retained-outline query; retain one copy of the helper and its existing test, alongside the distinct glyph-query implementation and regression.
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!9064
No description provided.