Skip to content

feat(libSceFreeType): query Type 1 private dictionaries - #9933

Open
santhoshkumar-dev wants to merge 4 commits into
boykopovar:mainfrom
santhoshkumar-dev:codex/freetype-postscript-private
Open

santhoshkumar-dev wants to merge 4 commits into
boykopovar:mainfrom
santhoshkumar-dev:codex/freetype-postscript-private

Conversation

@santhoshkumar-dev

@santhoshkumar-dev santhoshkumar-dev commented Oct 22, 2026 •

Copy link
Copy Markdown
Contributor

What

Implement FT_Get_PS_Font_Private (+yNEa4OFH1M) through the existing guest face bridge. The returned dictionary uses an explicit 224-byte LP64 guest record: every scalar, count, flag and fixed-size array is copied field by field, widening native fixed-point and long values. The Windows native record is 196 bytes. Errors leave the output unchanged, and the query does not refresh unrelated guest face or glyph data.

The name/NID matches the PS5 3.20 inventory. Layout and behavior follow bundled FreeType 2.13.3 t1tables.h, fttype1.c and the native Type 1 font driver. Console ABI/backend equivalence remains unverified and is recorded in debt.

Refresh: merge fetched main e3d03fbae64e1b49e5d4e84e753ccce6edf60da5 while retaining the intervening features and test registrations. Link the test executable to libc only on Windows. Linux/macOS start without that dependency and load the selected normal or packaged module explicitly. On Windows, the normal test prepends the unpatched dependency directory and the NID test prepends the packaged directory, so libc is selected consistently before module loading. Loader failures now print the Windows error code. The production adapter and behavioral fixtures are unchanged.

Overlap: #9453 declares the private-dictionary NID as a throwing placeholder in libSceFreeTypeOl. This PR implements only the distinct libSceFreeType provider. Documentation order remains #9924, then #9933, preserving both entries and the already-merged SFNT/naming/charmap/outline/size entries. Each branch builds independently on main. File-specific three-way checks against 25 older shared-CMake branches add no CMake conflict and keep this registration outside their existing conflict hunks; no joint builds with those branches are claimed.

Tested

Final submitted head 276360b78d63a25ccccb672e8d6b251ff492a8db, based on main e3d03fbae64e1b49e5d4e84e753ccce6edf60da5.

Windows 11 x64, supported WinLibs GCC 15.2.0 r7, Ninja Release, bundled dependencies, BUILD_TESTING=ON, ANYPS5_ENABLE_SPIRV_TOOLS=OFF: full default build passed; 5/5 focused CTests passed, zero skips.

Local Linux: Ubuntu 24.04.1 x86-64 under WSL2 (kernel 6.6.87.2, GCC 13.3.0, glibc 2.39), Ninja Release with the same dependency/testing options. Built the complete libs target and selected test executables; 5/5 focused CTests each passed three consecutive runs, including actual packaged-NID loading and the 368-module loader.

Four generated Type 1 fonts cover default and populated private dictionaries, maximum blue/snap arrays and negative fixed-point values. Every scalar and array is compared with bundled native FreeType. Canaries, null/error output preservation, repeated queries and unchanged face/font records are checked. Historical Windows negative controls at c45cf89081 made both modes fail for a raw native-record copy and for zero-extending signed fixed-point fields; the adapter and fixtures are unchanged by this refresh.

Conventions, whitespace and current-main integration checks pass. The Linux runs above are local. The independent macOS report by @jotitadev used Apple M2 Max, macOS 27.2, AppleClang/Xcode 27, x86-64 under Rosetta, #8658 at fa063d8b07 plus the original PR diff: both focused tests reportedly pass three times with this same conditional-link correction. That report is attributed evidence on that pinned platform stack, not a macOS run on this refreshed head. A fresh macOS run remains outstanding; no title or console-hardware result is claimed.

A local Linux linkage control on the preceding head 77342636eb253275bff1e75ac99abc42b92c0382 restored only the unconditional libc test dependency. The normal test passed; the packaged-NID test failed with libkernel.prx: undefined symbol: g5PTgiKQ9Eo. Restoring the conditional dependency passed both tests three consecutive times. The production source and test fixtures are unchanged between that control and this refresh.

Upstream freshness: rechecked fetched main 74f6fa8e312462bc4b373b5ec498b2eea2b28efc immediately before publication. The branch merges cleanly. The full build/runtime results above are pinned to the submitted head and its stated base, rather than claiming a build of newer upstream commits. No FreeType production, behavioral-test or debt file changed in that intervening upstream range.

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: feat(libSceFreeType): expose PostScript font information #9924 (documentation merge order only)
  • Fixes: none
  • Unblocks: none
  • GPUs tested: n/a
  • AI-assisted: yes

@santhoshkumar-dev

Copy link
Copy Markdown
Contributor Author

Recorded the documentation order in our affected PR descriptions/checklists: #9924 -> #9933 -> #9045 -> #9054, preserving each distinct entry and the existing #8286 prerequisite. These branches build independently on main; the dependency here is merge coordination only.

@github-actions

github-actions Bot commented Oct 22, 2026 •

Copy link
Copy Markdown

Progress report (74f6fa8 → 276360b)

📈 System libraries: 47.04% (+0.01%, +1 implemented functions)

✅ 1 implemented
Library Name
libSceFreeType FT_Get_PS_Font_Private_nid_postfix

@MarcZX10

Copy link
Copy Markdown
Contributor

I reviewed the LP64 guest layout assertions, field-by-field adapter, error-path output preservation, CMake/test registration and font fixtures. The adapter avoids copying the native Windows layout and widens the guest long/fixed-point fields explicitly; the tests compare each field against bundled FreeType, cover maximum arrays and negative fixed-point values, and include patched-NID loading. The console ABI remains clearly marked unverified. I found no code defect in this diff.

I independently ran git diff --check upstream/main...refs/review/9933 and python3 -I tools/check_conventions.py --base upstream/main --head refs/review/9933; both pass. The author reports a Windows full build and 5/5 focused CTests on the submitted head; hosted policy checks pass while product jobs are skipped. The head is eight commits behind current main, so please refresh it and rerun the focused FreeType tests on the final head before merge. I did not run the C++ tests locally; this VM has no free disk space for a build.

@github-actions

github-actions Bot commented Oct 22, 2026 •

Copy link
Copy Markdown

Other open pull requests touch the same code. Merging one will break the other, or both implement the same thing. If this one builds on them, list them in Depends on.

Pull request Conflicting files (lines on main) Same exports Same new files
PR 10579 docs/dev/debt/libSceFreeType.md L5
PR 10582 docs/dev/debt/libSceFreeType.md L5
PR 10588 docs/dev/debt/libSceFreeType.md L5
PR 10591 docs/dev/debt/libSceFreeType.md L5
PR 10593 docs/dev/debt/libSceFreeType.md L5
PR 10598 docs/dev/debt/libSceFreeType.md L5
PR 10600 docs/dev/debt/libSceFreeType.md L5
PR 10601 docs/dev/debt/libSceFreeType.md L5
PR 10602 docs/dev/debt/libSceFreeType.md L5
PR 10609 docs/dev/debt/libSceFreeType.md L5
PR 10611 docs/dev/debt/libSceFreeType.md L5
PR 10613 docs/dev/debt/libSceFreeType.md L5
PR 11130 core/libs/CMakeLists.txt L227-228

Some comparisons could not be completed because a pull request conflicts with the base branch. Review these shared files manually before concluding that there is no overlap.

Pull request Shared files not compared
PR 5021 core/libs/CMakeLists.txt
PR 7201 core/libs/CMakeLists.txt
PR 7275 core/libs/CMakeLists.txt
PR 7780 core/libs/CMakeLists.txt
PR 8285 core/libs/CMakeLists.txt
PR 8650 core/libs/CMakeLists.txt
PR 9156 core/libs/CMakeLists.txt
PR 9284 core/libs/CMakeLists.txt
PR 9293 core/libs/CMakeLists.txt
PR 9297 core/libs/CMakeLists.txt
PR 9302 core/libs/CMakeLists.txt
PR 9383 core/libs/CMakeLists.txt
PR 9419 docs/dev/debt/libSceFreeType.md
PR 9465 docs/dev/debt/libSceFreeType.md
PR 9535 core/libs/CMakeLists.txt
PR 9536 core/libs/CMakeLists.txt
PR 9571 core/libs/CMakeLists.txt
PR 9632 core/libs/CMakeLists.txt
PR 9848 docs/dev/debt/libSceFreeType.md
PR 10255 core/libs/CMakeLists.txt
PR 10604 docs/dev/debt/libSceFreeType.md
PR 10606 docs/dev/debt/libSceFreeType.md
PR 10616 docs/dev/debt/libSceFreeType.md

@MarcZX10

Copy link
Copy Markdown
Contributor

Upstream main now includes #9054, adding SFNT-name entries to docs/dev/debt/libSceFreeType.md. I rechecked this head against current main fcd455870c: diff-check and conventions pass, and the only overlap since the previous main is that debt file; the implementation/test paths are untouched. When refreshing, please retain the merged #9054 entries and this Type 1 private-dictionary entry alongside #9924/#9045 so the agreed documentation sequence is preserved.

@github-actions github-actions Bot added the needs rebase Conflicts with main, rebase needed label Oct 22, 2026

@MarcZX10 MarcZX10 left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The field-by-field LP64 adapter, output-preserving errors and font fixtures look sound; current-main whitespace and conventions pass. The author reports the Windows full build and 5/5 focused tests, including patched-NID loading and native-FreeType field comparisons. I inspected the bundled FreeType implementation: it returns Invalid_Argument for a null output before the adapter writes, matching the tested unchanged-output behavior.\n\nCurrent check_main_sync.py reports the branch is 308 commits behind and has a merge conflict in docs/dev/debt/libSceFreeType.md; core/libs/CMakeLists.txt also changed on both sides. Please refresh onto current main, retain the merged debt entries as well as this Type 1 entry, and keep the test registration. The implementation/test source paths are otherwise untouched by intervening main changes.

@MarcZX10 MarcZX10 left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please refresh this branch onto current main and resolve the reported conflict in docs/dev/debt/libSceFreeType.md; current sync also reports a shared core/libs/CMakeLists.txt edit. Preserve the intervening FreeType debt entries and the new PostScript-private test registration. The exact-head implementation review and author-reported Windows tests are positive, and current-main conventions/whitespace pass; the request is solely to resolve the real merge conflict and validate the refreshed merge.

@jotitadev jotitadev left a comment •

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

macOS test: guest_freetype_postscript_private_nid loads the unpatched libc

Apple M2 Max, macOS 27.2, Apple clang (Xcode 27), x86-64 Release build under Rosetta 2, BUILD_TESTING=ON, full default build. Head c45cf89081. main does not build on macOS, so the platform is #8658 (feat/macos-port) @ fa063d8b07 with this PR's diff applied (3-way, no conflicts there; GitHub reports a conflict with current main).

guest_freetype_postscript_private passes. guest_freetype_postscript_private_nid aborts:

dlopen(.../build/core/libs/libs/libSceFreeType.prx, 0x0006): Symbol not found: _QuRm8bUpMP0
  Referenced from: <...> .../build/core/libs/libs/libSceFreeType.prx
  Expected in:     <...> .../build/core/libs/libs/unpatched/libc.prx

guest_freetype_postscript_private_tests links libc on every platform, so the process starts with unpatched/libc.prx loaded. Both libc builds have the install name @rpath/libc.prx, so when the patched libSceFreeType.prx asks for @rpath/libc.prx, dyld reuses the unpatched image that is already loaded, and it has no NID exports.

Linking libc only on Windows in PostScriptPrivate.cmake, as guest_jxr_lookup_tests in #9954 does, fixes it here:

    target_link_libraries(guest_freetype_postscript_private_tests PRIVATE freetype ${CMAKE_DL_LIBS})
    if(WIN32)
        target_link_libraries(guest_freetype_postscript_private_tests PRIVATE libc)
    endif()

With that change both tests pass 3/3 (--repeat until-fail:3). I did not run Linux here, but the same pattern failed on Linux in #9646 (patched tests could not resolve NIDs until libc was linked only on Windows), so this is likely not macOS-only. #9785 has the same pattern.

Written with AI assistance (Claude Code). I ran the builds and tests above on my machine.

@MarcZX10 MarcZX10 left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Reviewed exact head c45cf89081770fa3b9d2c9deb2404069067e5fc2. A focused macOS test report exposes a real portability failure in the new test target: guest_freetype_postscript_private_tests links both freetype and libc unconditionally. On macOS the test process loads unpatched libc.prx first; dyld then reuses its @rpath/libc.prx when loading patched libSceFreeType.prx, which lacks the expected NID symbol _QuRm8bUpMP0, so guest_freetype_postscript_private_nid aborts. Please link the NID libc only on Windows (or otherwise ensure the patched test resolves patched libc) and rerun both focused tests on macOS; the reported temporary conditional-link workaround passes 3/3. Separately, current-main sync reports a real conflict in docs/dev/debt/libSceFreeType.md and 308 commits behind, with core/libs/CMakeLists.txt also touched since the merge base. Please refresh onto current main, resolve the debt entry, and rerun the focused suite on the combined tree. Local conventions pass; I did not run the FreeType runtime tests. This request is based on a platform test failure and an actual merge conflict, not queue size.

@santhoshkumar-dev

Copy link
Copy Markdown
Contributor Author

Addressed the sync and test-loader requests in 276360b78d63a25ccccb672e8d6b251ff492a8db.

  • Merged fetched main e3d03fbae6, retaining every intervening FreeType debt entry and registration. Rechecked newer main 74f6fa8e31 before pushing: the merge remains clean and its FreeType production/test/debt files are unchanged.
  • Link libc only on Windows. On Windows, the NID test now selects packaged dependencies before process startup; the normal test selects unpatched dependencies. Newer FreeType imports the renamed host-write helpers, so preloading raw libc also caused a Windows error 127. Selecting the packaged directory fixed the same built binary. Loader failures now print the Windows error code.
  • Full default Windows build and all 5 focused CTests pass on this head. Local Ubuntu 24.04.1/WSL2, GCC 13.3/glibc 2.39: complete libs build and all 5 focused tests pass three consecutive times, including actual NID loading and the 368-library loader.
  • A Linux control restoring only unconditional libc linkage reproduced the reported g5PTgiKQ9Eo NID failure; restoring the fix passed both modes three times.

The body now credits @jotitadev's pinned macOS report and removes the obsolete future ordering against already-merged PRs. #9924 then #9933 remains documentation-only merge order. A fresh macOS run on this head is still outstanding; @jotitadev, please rerun both modes on your #8658 stack when available. @MarcZX10, the requested refresh and loader changes are ready for re-review; existing change requests remain in place.

@github-actions github-actions Bot removed the needs rebase Conflicts with main, rebase needed label Oct 23, 2026
danielradosa added a commit to danielradosa/AnyPS5 that referenced this pull request Oct 24, 2026

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants