feat(libSceFreeType): implement FT_Outline_New and FT_Outline_Done #10589

Merged
MarcZX10 merged 12 commits from upstream-pr/10589 into main 2026-11-02 10:26:09 +00:00
MarcZX10 commented 2026-10-24 11:27:25 +00:00 (Migrated from github.com)

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


What

Adds FT_Outline_New and FT_Outline_Done to libSceFreeType. Both follow ftoutln.c in the bundled FreeType 2.13.3, with the guest's LP64 outline layout: argument validation and error codes, zero-initialised point, tag and contour arrays (null when their count is zero), the owner flag, and a reset to the empty outline on release. Because the guest layout has 64-bit points, the arrays are allocated from the host C heap rather than by native FreeType; they are freed only for an outline that carries the owner flag. Console signatures, errors and allocator are unverified; the debt entry says so.

Commits: for each function in turn (FT_Outline_Done, then FT_Outline_New, which calls it on allocation failure), the implementation, its test and its debt entry.

Tested

Linux x86-64, GCC, full CMake build (Ninja, Release). guest_freetype_outline_storage compares error code, counts, flags, array nullness and zero contents with native FT_Outline_New/FT_Outline_Done over point counts 0, 1, 7, 65535, 65536 and 0xFFFFFFFF and contour counts from -1 to 65535, plus null library, null outline and a non-owning outline that must not be freed. An earlier version of the implementation allocated zero-sized arrays and the test caught the null-versus-non-null difference; that is fixed. The host CPU (Xeon E5-1620 v2) fails the startup CPU-feature gate, so I ran the test with that check disabled in a local, uncommitted edit; it exits 0. Windows was not run. tools/check_conventions.py and git diff --check pass. No title or GPU involved. Current rebase verification: head 239c27e9457d0d34a81413178e365558ae6690dc is based on main 3e33cdafdc2ab1fabc8d54d72c9d8cbada9a0519. git diff --check, the conventions/template check, and the merge preview passed. The ABI audit reported two removed unknown names whose NID aliases remain as the new named exports. The test-quality heuristic flagged the C++ test path, but CMakeLists.txt registers both its executable and CTest entry. The C++ build and CTest were not rerun after rebasing; the Linux build/runtime results above were run on the original head fe72d56ffa75789ef910acef6a57d3e6080352f0.

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
<!-- greyfinch-sync:boykopovar/AnyPS5:issue:4994986099 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/10589). Originally posted by [MarcZX10](https://github.com/MarcZX10) on 2026-10-24T11:27:25Z. --- ### What Adds `FT_Outline_New` and `FT_Outline_Done` to libSceFreeType. Both follow [ftoutln.c](https://github.com/freetype/freetype/blob/42608f77f20749dd6ddc9e0536788eaad70ea4b5/src/base/ftoutln.c) in the bundled FreeType 2.13.3, with the guest's LP64 outline layout: argument validation and error codes, zero-initialised point, tag and contour arrays (null when their count is zero), the owner flag, and a reset to the empty outline on release. Because the guest layout has 64-bit points, the arrays are allocated from the host C heap rather than by native FreeType; they are freed only for an outline that carries the owner flag. Console signatures, errors and allocator are unverified; the debt entry says so. Commits: for each function in turn (`FT_Outline_Done`, then `FT_Outline_New`, which calls it on allocation failure), the implementation, its test and its debt entry. ### Tested Linux x86-64, GCC, full CMake build (Ninja, Release). `guest_freetype_outline_storage` compares error code, counts, flags, array nullness and zero contents with native `FT_Outline_New`/`FT_Outline_Done` over point counts 0, 1, 7, 65535, 65536 and 0xFFFFFFFF and contour counts from -1 to 65535, plus null library, null outline and a non-owning outline that must not be freed. An earlier version of the implementation allocated zero-sized arrays and the test caught the null-versus-non-null difference; that is fixed. The host CPU (Xeon E5-1620 v2) fails the startup CPU-feature gate, so I ran the test with that check disabled in a local, uncommitted edit; it exits 0. Windows was not run. `tools/check_conventions.py` and `git diff --check` pass. No title or GPU involved. Current rebase verification: head `239c27e9457d0d34a81413178e365558ae6690dc` is based on `main` `3e33cdafdc2ab1fabc8d54d72c9d8cbada9a0519`. `git diff --check`, the conventions/template check, and the merge preview passed. The ABI audit reported two removed unknown names whose NID aliases remain as the new named exports. The test-quality heuristic flagged the C++ test path, but `CMakeLists.txt` registers both its executable and CTest entry. The C++ build and CTest were not rerun after rebasing; the Linux build/runtime results above were run on the original head `fe72d56ffa75789ef910acef6a57d3e6080352f0`. ### 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 - [x] AI-assisted: yes
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!10589
No description provided.