feat(font): order writing line runs by embedding level and report their spacing #3260
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/3260"
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 fma-rc on 2026-10-11T03:57:53Z.
What
sceFontWritingLineWritesOrderthrew for every writing attribute except 0. Astro's Playroom (PPSA01325) passes0xFA | level << 8with bits 30 and 31 set on some text runs and stops there withsceFontWritingLineWritesOrder: writing attribute 250 is not modelled.The writing line now follows the PS4 11.00
libSceFont.sprx, read from its disassembly. That module exports the same functions under the same NIDs; the PS5 library was not measured.WritesOrdertakes the attribute as low byte0xFA, embedding level in bits 8-15 (0 to 126), bit 30 / bit 31 for space before / after the run. Runs are linked in visual order by level (odd levels run the other way), and the space at each spaced join is summed for the line. Attribute 0 is still accepted, as level 0 without spacing.RefersRenderStepwalks the visual order from the left (form0x12) or from the right (form0x11, now accepted), reports how much of the line's spacing lies before each step inspacingProgress, and grows the render metrics as steps are consumed.GetOrderingSpacereturns the line advance, leading space, summed inline space and trailing space, in that order.Where the PS4 module returns
SCE_FONT_ERROR_INVALID_PARAMETER(null line, other attribute low byte, level above 126, null orderer, null metrics output) this throws, since no PS5 source confirms the codes. Kept from the old model and not from that module: attribute 0, form0x10(treated as left to right), the0x0FD5detail, throws for unknown handles and forms, host-allocated lines. All listed in TechnicalDebt.Output order of
GetOrderingSpace: Orbital's IDA types and SharpProspero name the outputs head, inline, tail, advance. The PS4 function writes advance, leading, inline, trailing through rsi, rdx, rcx, r8, and the one PS5 caller I have agrees with that: Playroom calls the export once (0x187d380) and computesout1 - out4 - out2 - 0.25 * out3, divided by a scale and compared with a width limit. With the other naming that would be head minus advance. The title subtracts both out2 and out4, so which of the two is leading and which trailing rests on the PS4 module alone.Tested
Linux, GCC 16.2.1, Release.
guest_font_writing_linerewritten: plain and nested levels (including drops of several levels), spacing in both directions, render metrics while stepping, step adjustment, the throws. Onmainit aborts withwriting form 17 is not modelled; with the change it passes, as do the two other font tests.vectors.txtare at https://github.com/fma-rc/AnyPS5/tree/evidence/font-writing-line-oracle (no firmware file in it; the README gives the sha256 of the module used).vectors.txtis the repository test run against the PS4 module in place of this implementation, with the module's output under each assertion; lines markedharness:are the listed departures.maineb15ddc4plus this branch and nothing else: the title no longer stops in libSceFont, logsLoadLevelResources: openingand stops onsceAudioInHqOpen not implemented.Checklist
main; no other open PR implements the same functionsNotImplemented_nid_no_patch); silent stubs are listed in TechnicalDebt.mdfiles or images added to the repository (attach them to this PR)Imported from boykopovar/AnyPS5. Originally posted by github-actions[bot] on 2026-10-11T03:58:03Z.
Thank you for your interest in the project! We are sorry, but we cannot accept more PRs while we work through the existing backlog. This PR has been automatically closed and labeled "intake paused". This is not a judgment of the quality of your changes.
Imported from boykopovar/AnyPS5. Originally posted by adriadam10 on 2026-10-11T07:06:40Z.
Review: CHANGES_REQUESTED
Thanks for the work; the ordering model builds and
guest_font_writing_linepasses here (fails onmain, as it should). Things to fix before this can land:WritingLine.cpp:256-259,321-323,331-337,249: the newSCE_FONT_ERROR_INVALID_PARAMETERreturns (bad attribute, null line/orderer, null metrics) come only from the PS4 module. Unverified error codes/params should keep throwing (exact-or-throw) until a PS5 source confirms them.WritingLine.cpp:257: attribute 0 was accepted onmainand now returns an error. That is a behaviour change on PS4 evidence alone. Keep accepting it (or throw), and list it in TechnicalDebt.WritingLine.cpp:330: the order of the four outputs ofsceFontWritingLineGetOrderingSpaceis swapped against the Orbital IDA types and the SharpProspero bindings, which are the PS5-side references. Please explain why the PS4 order wins for PS5, or keep the documented order until it is measured.GuestFontWritingLine.cpp: the expected values are the model's own outputs; the differential harness is not in the repo, so nobody else can reproduce them. Please attach it (or its generated vectors) to this PR as evidence.Imported from boykopovar/AnyPS5. Originally posted by Mouhand-Kaddo on 2026-10-11T07:19:55Z.
Additional platform validation of standalone PR head
25afd95d3598f3aa030d4efe88bb09fcb9ab5455(2026-10-11):Windows: passed — Windows 11, WinLibs GCC 15.2.0 UCRT/POSIX/SEH r7; CMake 4.3.1 / Ninja; Release,
BUILD_TESTING=ON.1 checks, 0 failures, 0 CTest skips. Built the selected targets and dependencies; this is focused validation, not a full build or full-suite run.
Checks:
guest_font_writing_line.Command after building:
ctest --test-dir <build> --verbose --no-tests=error --timeout 30 -R "^guest_font_writing_line$".No title/gameplay validation. These results cover the standalone head, not a merge with current main.
Imported from boykopovar/AnyPS5. Originally posted by github-actions[bot] on 2026-10-11T07:53:43Z.
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.
main)docs/dev/TechnicalDebt.mdL517-518Imported from boykopovar/AnyPS5. Originally posted by fma-rc on 2026-10-11T07:53:51Z.
All five are in
5680c323and the description.The PS4-only error returns throw now (null line, attribute low byte, level above 126, null orderer, null metrics output), and attribute 0 is accepted again as level 0, with a TechnicalDebt line.
I kept the PS4 output order for
sceFontWritingLineGetOrderingSpacebecause the one PS5 caller I have uses it. Astro's Playroom calls the export once, at 0x187d380, then computes out1 - out4 - out2 - 0.25 * out3, divides by a scale and compares with its width limit. That is the advance minus the two edge spaces minus a quarter of the inter-run spacing, which is what the PS4 function writes through rsi, rdx, rcx, r8. With the Orbital and SharpProspero names it would be head - advance - inline - 0.25 * tail. The title cannot tell out2 from out4, so that part is from the PS4 module only and TechnicalDebt says so.The harness and its vectors are at https://github.com/fma-rc/AnyPS5/tree/evidence/font-writing-line-oracle.
vectors.txtis the repository test itself run against the PS4 module, with the module's output under each assertion.Playroom needs none of the other changes any more: on
maineb15ddc4plus this branch alone it passes the font stop and ends onsceAudioInHqOpen not implemented.Imported from boykopovar/AnyPS5. Originally posted by adriadam10 on 2026-10-11T07:55:41Z.
Review: APPROVED
Checked the rework: error returns that only exist in the PS4 module now throw, attribute 0 is still accepted, and TechnicalDebt lists the PS4-order
GetOrderingSpacewith the PPSA01325 call site as evidence. Built and ranguest_font_writing_line(passes; fails with the library changes reverted); merging.One thing for you: the PR description still says these paths return
SCE_FONT_ERROR_INVALID_PARAMETERand that attribute 0 is rejected. That no longer matches the code after5680c3238; please update it.