feat(libSceFreeTypeOt): implement the 2.4.11 outline and memory record calls #15865
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/15865"
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 KernelPanicNT on 2026-11-04T20:29:05Z.
What
Implements three libSceFreeTypeOt exports that called
NotImplemented_nid_no_patch. They follow FreeType 2.4.11, the version libSceFreeTypeOt reports:FT_Outline_New_Internal(NG7OgYsgcF8) andFT_Outline_Done_Internal(umIqupy8UU0), in a newsrc/Outline.cpp. They allocate and free through the caller's memory record with the existingft_mem_realloc/ft_mem_freeofsrc/Memory.cpp, as 2.4.11FT_NEW_ARRAY/FT_FREEdo.FT_New_Memory(tCMhTh7h8D4). libSceFreeTypeOt now builds thelibSceFreeType/src/MemoryRecord.cppthat libSceFreeType already exports with this NID, the same way it already buildsOutlineBorders.cppandTrigonometry.cpp. 2.4.11ftsystem.c(both thesrc/baseand thebuilds/unixcopy) creates the record withmalloc, setsuserto 0 and installsmalloc/realloc/freecallbacks.MemoryRecord.cppdoes the same. Because the file is shared, libSceFreeTypeOt also exportsFT_Done_Memory, which its export list does not have; the debt entry says so.sceFreeTypeOtNewMemory_nid_no_patchdeclaration fromMemoryRecord.hpp. It belonged to the removed stub.Not in this PR: libSceFreeTypeOl
FT_Done_Memory(UTumVjeIQtg). Its debt entry says the export has no parameter and works on a Sony-owned global memory manager, and the 2.4.11 sources disagree with each other on it (src/base/ftsystem.ccallsfree(memory),builds/unix/ftsystem.ccallsmemory->free(memory, memory)), so it keeps throwing.FT_Sin,FT_TanandFT_Vector_Unitwere implemented by #11613. The libSceFreeTypeOt debt line that counts thesceFreeTypeOtUnknown_*stubs still says 68; this PR removes two of them (66), and #15687 rewrites that line to 60 for its own renames, so whichever lands second updates the number.Source of the behaviour
FT_Library_Versionreturned 2.4.11 when measured as a payload process on a device (firmware 13.00)FT_Outline_New_Internal, null memory or outlineInvalid_Argument(6), nothing writtenft_mem_realloc, cleared; counts stored as 16-bit; onlyFT_OUTLINE_OWNERsetInvalid_Argument, both freed, outline clearedFT_INT_MAXbytes (points from0x08000000, contours from0x40000000)Array_Too_Large(0x0A), earlier arrays freedOut_Of_Memory(0x40), earlier arrays freedFT_Outline_Done_InternalInvalid_Argument; otherwise frees points, tags, contours only ifFT_OUTLINE_OWNERis set, then clears the outlineFT_New_Memorymallocrecord,user0, C allocator callbacksMemoryRecord.cpp)c6a66b49e64e, the 2.4.11 release commit):ftoutln.c#L293-L439(FT_Outline_New_Internal,FT_Outline_Done_Internal),ftsystem.c#L286-L304(FT_New_Memory),ftsystem.c#L310-L317andbuilds/unix/ftsystem.c#L408-L416(the twoFT_Done_Memorybodies that differ),ftutil.c#L49-L221(allocator; 2.4.12's differs only byFT_THROW, which yields the same codes).libSceFreeTypeOt/Export.cpp#L197-L200(FT_New_Memory),#L227-L230(umIqupy8UU0),#L257-L260(NG7OgYsgcF8),MemoryRecord.hpp#L11.MemoryRecord.cpp#L21-L29,libSceFreeTypeOt/src/Memory.cpp#L43-L80; shared-source precedent:libSceFreeTypeOt/CMakeLists.txt#L1-L2.FT_Done_Memorydebt:libSceFreeTypeOl.md#L34.Tested
Linux x86-64 (Ubuntu, GCC), on
main9ab6a281ea. The newguest_freetype_ot_outlinetest loads libSceFreeTypeOt and resolves the three calls andFT_Done_Memoryby name (raw) and by NID (_patched). It checks the null-argument errors, the allocation order and sizes (16/1/2 bytes per item), cleared arrays, the stored 16-bit counts (70000 points, 0x12345 contours, 40000 points) and the flags. It also checksInvalid_Argumentfor a negative contour count after points and tags are freed,Array_Too_Largeat0x08000000and0xFFFFFFFFpoints and0x40000000contours, the0x7FFFFFF0-byte boundary reaching the allocator,Out_Of_Memoryon the second and third allocation,FT_Outline_Done_Internalfreeing only owned outlines and skipping null arrays, and an outline built and released on aFT_New_Memoryrecord. The same test binary also passes against FreeType 2.4.11 itself:ftoutln.c,ftutil.candsrc/base/ftsystem.cfromc6a66b49e64ecompiled into a shared object with the_nid_postfixnames forwarding to them, so the expectations are the 2.4.11 behaviour and not just this implementation.ctest -R 'guest_freetype_ot|guest_freetype_corner|guest_freetype_memory_record|public_headers': 73 of 73 passed, including #11613'sguest_freetype_otraw and patched. Negative control: withExport.cppandMemoryRecord.hppfrommainandOutline.cpp/MemoryRecord.cppout of the build, both new tests fail; with only the two outline stubs back andOutline.cppout, both fail too.tools/progress.py --compare: +2 implemented, 3 throwing stubs removed (libSceFreeTypeOt 49/142 -> 51/141);FT_New_Memorycounts under libSceFreeType, which owns the shared source.tools/check_conventions.py --base origin/mainpasses. Not tested on a device.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)Export.cppand its debt file; no shared export)