feat(libSceFreeTypeOt): implement FT_Stream_Open, FT_Stream_New and FT_Raccess_Guess #16121
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/16121"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Imported from boykopovar/AnyPS5. Originally posted by noamroger on 2026-11-05T17:50:58Z.
What
Implements the last three stream and resource fork stubs of libSceFreeTypeOt that the debt file still listed as throwing:
FT_Stream_Open(iruPsrXCN7U),FT_Stream_New(uDXTnGbAz44) andFT_Raccess_Guess(8cnVx1yH9-I). It follows up on the mergedFT_Stream_*calls and #15050 (FT_Raccess_Get_HeaderInfo/Get_DataOffsets), in two commits.FT_Stream_Open(newsrc/System.cpp) follows the ANSI layer of FreeType 2.4.12src/base/ftsystem.con the existing 80-byte guest stream record: the guest path resolves like libc paths (ResolvePathError_nid_no_patch), a host file backs guest-callablereadandclosecallbacks, and the errors match 2.4.12 (Invalid_Stream_Handle 0x28, Cannot_Open_Resource 0x01, Cannot_Open_Stream 0x51 for an empty file). Directories and other non-regular files throw, since theirfopenresult depends on the C library.FT_Stream_Newfollows 2.4.12ftobjs.con the 64-byte LP64FT_Open_Args: memory, pathname then stream sources in that order, the record allocated and freed throughft_mem_alloc/ft_mem_freewith the library memory, and a caller stream taking the library memory as in FreeType.FT_Raccess_Guessports the nine rules of 2.4.12ftrfork.cin order (AppleDouble, AppleSingle, darwin._,/..namedfork/rsrc,/rsrc,resource.frk/,.resource/,%,.AppleDouble/). Names are allocated from the library memory, and the AppleDouble probes open their file throughFT_Stream_Newand release it withFT_Stream_Free.The open questions are recorded in
docs/dev/debt/libSceFreeTypeOt.md: the console system layer is unmeasured (the unix layer would map the file and leavereadnull instead of using callbacks), andFT_Raccess_Guessassumes the defaultFT_CONFIG_OPTION_MAC_FONTS. Null pointers that 2.4.12 dereferences throw before anything is allocated or written. The Unknown stub count goes from 61 to 58.Tested
Linux (Ubuntu 24.04, g++ 13), full build with
-DBUILD_TESTING=ON: the newguest_freetype_ot_systemtest plus the existingguest_freetype_ot_raccess,guest_freetype_ot_memory,guest_freetype_ot_constants,guest_freetype_corner,guest_freetype_ot,guest_freetype_streamand their relinked_patchedvariants pass (8/8). The new test was also run with-fsanitize=address,undefined(no error, no leak). It covers:FT_Stream_Open: null stream, missing file (record still reset), empty file, directory and null path (throw), then seek/read/frame/try-read through the existing OtFT_Stream_*calls on a 300-byte file, and close;FT_Stream_New: null result, library and arguments, no source, memory winning over path, path, missing path, throwing path (record freed), caller stream, failed allocation, with allocations and frees counted;FT_Raccess_Guess: the nine rules on real AppleSingle/AppleDouble files (rewind from a non-zero position, unsigned 32-bit fork offset, a double file without a fork entry), no stream, a name without a directory, cut and empty entry lists, failed allocations, null base name and library.tools/check_conventions.py --base upstream/mainpasses.tools/pr_overlap.pycannot reach the GitHub API from my environment; I checked by NID that no open pull request changesiruPsrXCN7U,uDXTnGbAz44or8cnVx1yH9-I. Text conflicts only (stub counter, end ofCMakeLists.txt) are expected with #15052, #15053, #15687 and #12370; I will rebase whichever merges first.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