Repository navigation
feat(libSceFreeType): implement the six FreeType functions OpenOrbis samples use - #6376
Merged
Merged
Conversation
…samples use PS4 homebrew built with the OpenOrbis toolchain draws text through the PS4 libSceFreeType: the font, keyboard, threading, system and SDL2 samples stop at start-up with "unresolved ELF import GNsiLzm4SH8" (FT_Init_FreeType) and the five other functions they import. FT_Init_FreeType, FT_New_Face, FT_Set_Pixel_Sizes, FT_Get_Char_Index, FT_Load_Glyph and FT_Render_Glyph now call the bundled FreeType. The guest reads FreeType's structures directly with the LP64 layout, where FT_Long and FT_Pos are 64 bits, so the face, size, charmap and glyph slot it receives are copies in that layout, updated after each call; outline points are converted and written back before rendering. Guest font paths are resolved and the file is read into memory. The face index is masked as FreeType does before it is narrowed, and character codes are truncated to 32 bits as FreeType does. The bundled FreeType's own functions are kept out of the library's exports.
Progress report (0e4ea13 → 38fd195)📈 System libraries: 88.71% (+0.01%, +6 implemented functions) ✅ 6 implemented
|
This was referenced Oct 15, 2026
jotitadev
reviewed
Oct 15, 2026
jotitadev
left a comment
Contributor
There was a problem hiding this comment.
Linux run (Ubuntu 26.04, Intel i7-8700, GCC 15.2, full build, non-GPU tests), head 38fd195e9 merged onto main 44df21632.
- The new library configures, builds and passes NID patching;
guest_freetypepasses (no early exit; the wholemainruns, exit 0). - No red run: the library is new, so the test cannot build without it.
Non-GPU suite (ctest -E "^agc"): same result as main; only file_writer_binary and file_writer_text fail, and they fail on main too on this machine (Ubuntu 26.04 coreutils).
Written with AI assistance (Claude Code). I ran the builds and tests above on my machine.
Contributor
Author
|
Thanks for the Linux run and the NID patching check, @jotitadev. AI-assisted: yes (Claude Code). 🤖 Generated with Claude Code |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What
PS4 homebrew built with the OpenOrbis toolchain draws text through the PS4
libSceFreeType. The OpenOrbis font, keyboard, threading, system and SDL2 samples import six of its functions and stop at start-up without them:FAIL: unresolved ELF import GNsiLzm4SH8(FT_Init_FreeType),j-uMQE+unFY(FT_New_Face),lJxMIwj81SQ(FT_Set_Pixel_Sizes),obnSzeb-KXk(FT_Get_Char_Index),M156RuYoUbU(FT_Load_Glyph) andTCRmigbq7lc(FT_Render_Glyph).This adds
libSceFreeTypewith those six functions on top of the bundled FreeType 2.13.3.FT_LongandFT_Posare 64 bits. On Windows they are 32 bits, so the guest gets copies of the face, size, charmap and glyph slot in the LP64 layout, refreshed after each call that changes them. The offsets are checked withstatic_assertand match what the font sample reads:face->glyphat 0x98,slot->advanceat 0x80,slot->bitmapat 0x98,slot->bitmap_leftat 0xc0. Outline points are copied as 64-bit coordinates, and edits the guest makes to them are written back beforeFT_Render_Glyph.FT_New_Faceresolves the guest path, as libSceFont does, and opens the file from memory.--exclude-libs, as libSceSsl does). Another FreeType function a title imports still fails at start-up instead of resolving to a host function with the Windows calling convention.The limits, such as private fields that are null, faces that are never freed and macOS exports, are in the new
docs/dev/debt/libSceFreeType.md. Part of the PS4 homebrew work tracked in #3093.Tested
Windows 11 Pro 26200, WinLibs GCC 15.2.0 r7, Release, full build with
BUILD_TESTING=ON, onmain9811e9d4b:guest_freetypetest writes a one-glyph TrueType font toapp0/and opens it through the guest path/app0/font.ttf. It loads the same bytes with the host FreeType and compares every mirrored field of the face, size, charmap and slot, before and after rendering: metrics, bitmap bytes, outline points, tags and contours. It also checks:aface;0x180000000opening face 0 and0x80000001failing as index 1;FT_Get_Char_Index(face, 0x100000041)returning the glyph ofA;libSceFreeType.prxexports the six NIDs and none of FreeType's own functions.main92cdc7b62with fix(relinker): search libc.prx for libkernel-only Windows executables #5990 to fix(relinker): stop module syscall scans at the PLT and skip the PS4 loader path #5994, fix(relinker): accept section-relative guest module relocations #5138 and a local change that answers the LinuxTIOCGWINSZ(0x5413) withENOTTY, as fix(libkernel): return ENOTTY for malformed ioctl requests #5569 does:prx_thread_local_destructorsandagc_driver_store_over_untrackedfail the same way onmain92cdc7b62without these changes;agc_driver_preparation_scope_settleandguest_raise_exceptionpass when run alone.tools/check_conventions.py --base origin/mainpasses.Not tested on Linux or macOS.
Checklist
main; no other open PR implements the same functionsNotImplemented_nid_no_patch); silent stubs are listed under Silent stubs in their library's technical debt file.mdfiles or images added to the repository (attach them to this PR)🤖 Generated with Claude Code