feat(libcairo): implement cairo_glyph_free #16954

Merged
jeej1k merged 2 commits from upstream-pr/16954 into main 2026-11-12 01:55:12 +00:00
jeej1k commented 2026-11-08 01:13:19 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by jeej1k on 2026-11-08T01:13:19Z.


What

Implements cairo_glyph_free (NID lAEbTbSUTTo) in libcairo for the inputs this library can account for. A null pointer is a no-op, as in Cairo (API docs). No export here allocates glyph arrays yet (cairo_scaled_font_text_to_glyphs is still a stub, and cairo_glyph_allocate is not in the PS5 catalogue), so a non-null array comes from outside the library and still throws through NotImplemented_nid_no_patch instead of reaching free. Freeing can follow the allocator once an export returns glyph arrays.

cairo_glyph_t is declared with the PS5 (LP64) layout: a 64-bit glyph index followed by two doubles, 24 bytes. The index is std::uint64_t rather than unsigned long, which is 32 bits on Windows. The stub is removed from Export.cpp, the declaration lives once in InventoryExports.hpp, and the debt file drops its row (73 remaining callable NIDs) and gets a short entry for the new file.

Tested

Windows 11 25H2, WinLibs GCC 15.2.0 r7 UCRT, Release, BUILD_TESTING=ON, rebased on current main. New guest_cairo_glyph test: layout static asserts, null is a no-op, and a non-null array throws. Full ctest: 5038 of 5040 passed, guest_cairo_glyph and patched_libraries included; the two failures (configure_seed_stdout, check_compile_test_windows_gcc_response_text_mode_is_not_reinterpreted) also fail on this machine without the change. python tools/check_conventions.py --base origin/main: all checks passed. Not tested on Linux or on a console.

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

🤖 Generated with Claude Code

<!-- greyfinch-sync:boykopovar/AnyPS5:issue:5207493276 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/16954). Originally posted by [jeej1k](https://github.com/jeej1k) on 2026-11-08T01:13:19Z. --- ### What Implements `cairo_glyph_free` (NID `lAEbTbSUTTo`) in libcairo for the inputs this library can account for. A null pointer is a no-op, as in Cairo ([API docs](https://www.cairographics.org/manual/cairo-cairo-scaled-font-t.html#cairo-glyph-free)). No export here allocates glyph arrays yet (`cairo_scaled_font_text_to_glyphs` is still a stub, and `cairo_glyph_allocate` is not in the PS5 catalogue), so a non-null array comes from outside the library and still throws through `NotImplemented_nid_no_patch` instead of reaching `free`. Freeing can follow the allocator once an export returns glyph arrays. `cairo_glyph_t` is declared with the PS5 (LP64) layout: a 64-bit glyph index followed by two doubles, 24 bytes. The index is `std::uint64_t` rather than `unsigned long`, which is 32 bits on Windows. The stub is removed from `Export.cpp`, the declaration lives once in `InventoryExports.hpp`, and the debt file drops its row (73 remaining callable NIDs) and gets a short entry for the new file. ### Tested Windows 11 25H2, WinLibs GCC 15.2.0 r7 UCRT, Release, `BUILD_TESTING=ON`, rebased on current `main`. New `guest_cairo_glyph` test: layout static asserts, null is a no-op, and a non-null array throws. Full `ctest`: 5038 of 5040 passed, `guest_cairo_glyph` and `patched_libraries` included; the two failures (`configure_seed_stdout`, `check_compile_test_windows_gcc_response_text_mode_is_not_reinterpreted`) also fail on this machine without the change. `python tools/check_conventions.py --base origin/main`: all checks passed. Not tested on Linux or on a console. ### 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: none - [x] Fixes: none - [x] Unblocks: none - [x] GPUs tested: n/a - [x] AI-assisted: yes 🤖 Generated with [Claude Code](https://claude.com/claude-code)
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!16954
No description provided.