feat(libSceFreeType): provide the default memory record #12321

Merged
santhoshkumar-dev merged 1 commit from upstream-pr/12321 into main 2026-11-02 13:37:10 +00:00
santhoshkumar-dev commented 2026-10-28 09:22:46 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by santhoshkumar-dev on 2026-10-28T09:22:46Z.


What

Add FT_New_Memory (tCMhTh7h8D4) and FT_Done_Memory (UTumVjeIQtg) to the physical libSceFreeType adapter. FT_New_Memory takes no arguments and returns a guest GuestMemoryRec wired to host allocator callbacks; FT_Done_Memory releases the record itself, matching the record-creation pairing. The record is the object the legacy allocator family (#12004) and FT_List_Finalize operate on, so a guest can now obtain a provider-backed record instead of building its own.

The names/NIDs are in the PS5 3.20 inventory. The argument-less interface, null user, callback wiring and record destruction follow FreeType 2.4.12 ftsystem.c, which agrees with the bundled FreeType 2.13.3 source on this interface; the callbacks wrap the host allocator instead of the console's system layer. Console equivalence is unverified and recorded in debt.

The matching OT inventory helper is named sceFreeTypeOtNewMemory_nid_no_patch and declared in the public header reachable through its umbrella; its no-parameter placeholder, explicit NID alias and throwing behavior remain. The FT_Done_Memory NID is not currently exported by this repository's libSceFreeTypeOt (it carries a curated subset of the console inventory); completing that inventory is left to the maintainers' stub-curation PRs such as #11765 for the separate libSceFreeTypeOl module, which shares no files with this change.

Ordering: whole-branch comparisons at this head against current main 316615d042 and against #11613 and #10606 are clean. #11878, #11996 and #12004 add an include line at the same include/Api.hpp spot; #11996 and #12004 additionally append the neighbouring CMakeLists.txt include and the adjacent debt entry. All are one-line insertions kept on rebase of whichever lands first; there is no functional or build dependency beyond the pairing noted above. Open/closed/merged history was rechecked for both names and NIDs immediately before opening; the only matches are #11765 (Ol-module stubs, different physical library) and a passing mention in #10606, whose library-lifetime change does not implement these functions and merges cleanly with this head.

Tested

Submitted and tested head 6aea55b3db687ba4c8ce7d24c12837cf2ad5d3b1, based on upstream main bbb11b6974df7889842ade9dd6fe55a5947b7654; it merges cleanly into current main 316615d042.

Windows 11 x64 / WinLibs GCC 15.2.0 r7 and local Ubuntu 24.04.1 x86-64 under WSL2 / GCC 13.3.0 / glibc 2.39: Ninja Release, bundled dependencies, BUILD_TESTING=ON, ANYPS5_ENABLE_SPIRV_TOOLS=OFF. On each platform the complete libs target (including all packaged-NID .prx patching) and selected test executables build, and 70/70 CTests pass: public-header audit, all 64 header compilation batches, both memory-record export modes (unpatched names and packaged NIDs tCMhTh7h8D4/UTumVjeIQtg), charmap checks and the packaged-library loader.

The fixture verifies in both modes that the created record has a null user and all three callbacks, that the record's own alloc/realloc/free callbacks round-trip a block (realloc preserves the written prefix, free accepts the moved block), that destroying the record and destroying null are both accepted, and that 256 create/use/destroy cycles complete without interference.

No full application/test-suite, macOS, title or physical-console run is claimed.

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: #12004
  • Fixes: none
  • Unblocks: none
  • GPUs tested: n/a
  • AI-assisted: yes
<!-- greyfinch-sync:boykopovar/AnyPS5:issue:5048116496 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/12321). Originally posted by [santhoshkumar-dev](https://github.com/santhoshkumar-dev) on 2026-10-28T09:22:46Z. --- ### What Add `FT_New_Memory` (`tCMhTh7h8D4`) and `FT_Done_Memory` (`UTumVjeIQtg`) to the physical `libSceFreeType` adapter. `FT_New_Memory` takes no arguments and returns a guest `GuestMemoryRec` wired to host allocator callbacks; `FT_Done_Memory` releases the record itself, matching the record-creation pairing. The record is the object the legacy allocator family (#12004) and `FT_List_Finalize` operate on, so a guest can now obtain a provider-backed record instead of building its own. The names/NIDs are in the [PS5 3.20 inventory](https://github.com/DNNDHH/PS5-3.20_Libs/blob/b2a77c09cd71c01f34c790cfbe98c751a13262ad/libSceFreeTypeOt.c). The argument-less interface, null `user`, callback wiring and record destruction follow [FreeType 2.4.12 ftsystem.c](https://github.com/freetype/freetype/blob/cecf93ef90c660a8b0b45e5adbbfb5ea443fb6b9/src/base/ftsystem.c#L286-L317), which agrees with the bundled FreeType 2.13.3 source on this interface; the callbacks wrap the host allocator instead of the console's system layer. Console equivalence is unverified and recorded in debt. The matching OT inventory helper is named `sceFreeTypeOtNewMemory_nid_no_patch` and declared in the public header reachable through its umbrella; its no-parameter placeholder, explicit NID alias and throwing behavior remain. The `FT_Done_Memory` NID is not currently exported by this repository's `libSceFreeTypeOt` (it carries a curated subset of the console inventory); completing that inventory is left to the maintainers' stub-curation PRs such as #11765 for the separate `libSceFreeTypeOl` module, which shares no files with this change. Ordering: whole-branch comparisons at this head against current main `316615d042` and against #11613 and #10606 are clean. #11878, #11996 and #12004 add an include line at the same `include/Api.hpp` spot; #11996 and #12004 additionally append the neighbouring `CMakeLists.txt` include and the adjacent debt entry. All are one-line insertions kept on rebase of whichever lands first; there is no functional or build dependency beyond the pairing noted above. Open/closed/merged history was rechecked for both names and NIDs immediately before opening; the only matches are #11765 (Ol-module stubs, different physical library) and a passing mention in #10606, whose library-lifetime change does not implement these functions and merges cleanly with this head. ### Tested Submitted and tested head `6aea55b3db687ba4c8ce7d24c12837cf2ad5d3b1`, based on upstream main `bbb11b6974df7889842ade9dd6fe55a5947b7654`; it merges cleanly into current main `316615d042`. Windows 11 x64 / WinLibs GCC 15.2.0 r7 and local Ubuntu 24.04.1 x86-64 under WSL2 / GCC 13.3.0 / glibc 2.39: Ninja Release, bundled dependencies, `BUILD_TESTING=ON`, `ANYPS5_ENABLE_SPIRV_TOOLS=OFF`. On each platform the complete `libs` target (including all packaged-NID `.prx` patching) and selected test executables build, and **70/70 CTests pass**: public-header audit, all 64 header compilation batches, both memory-record export modes (unpatched names and packaged NIDs `tCMhTh7h8D4`/`UTumVjeIQtg`), charmap checks and the packaged-library loader. The fixture verifies in both modes that the created record has a null `user` and all three callbacks, that the record's own `alloc`/`realloc`/`free` callbacks round-trip a block (realloc preserves the written prefix, free accepts the moved block), that destroying the record and destroying null are both accepted, and that 256 create/use/destroy cycles complete without interference. No full application/test-suite, macOS, title or physical-console run is claimed. ### 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: #12004 <!-- #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-28 09:39:57 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by MarcZX10 on 2026-10-28T09:39:57Z.

Review: APPROVED


Reviewed exact head 6aea55b3db687ba4c8ce7d24c12837cf2ad5d3b1. FT_New_Memory constructs the 32-byte callback record with null user context, and FT_Done_Memory pairs its allocation with free; the callback signatures and allocator behavior match the cited FreeType memory-record contract. The test exercises unpatched and packaged-NID entry points, callback wiring, allocate/reallocate/free, repeated create/destroy, and null destruction. Hosted Windows passed; the author reports 70/70 focused CTests on Windows and WSL. The PR is clean/mergeable with current main, and I found no blocking issue in the exact diff. Console equivalence remains unverified as documented in technical debt; no console run is claimed.

<!-- greyfinch-sync:boykopovar/AnyPS5:review:5680579016 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/12321#pullrequestreview-5680579016). Originally posted by [MarcZX10](https://github.com/MarcZX10) on 2026-10-28T09:39:57Z. **Review:** APPROVED --- Reviewed exact head `6aea55b3db687ba4c8ce7d24c12837cf2ad5d3b1`. `FT_New_Memory` constructs the 32-byte callback record with null user context, and `FT_Done_Memory` pairs its allocation with `free`; the callback signatures and allocator behavior match the cited FreeType memory-record contract. The test exercises unpatched and packaged-NID entry points, callback wiring, allocate/reallocate/free, repeated create/destroy, and null destruction. Hosted Windows passed; the author reports 70/70 focused CTests on Windows and WSL. The PR is clean/mergeable with current `main`, and I found no blocking issue in the exact diff. Console equivalence remains unverified as documented in technical debt; no console run is claimed.
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!12321
No description provided.