feat(libSceFont): implement text-code cursor iteration #4050
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/4050"
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 p3n1cillin on 2026-10-11T22:10:26Z.
What
Implement
sceFontCharactersRefersTextCodes,sceFontTextCodesStepNext, andsceFontTextCodesStepBackover the existing font-string character links. The cursor exposes the source ordering token and Unicode code, includes the supplied terminator, stops backward traversal at its starting character, and preserves the last valid step when an end is reached. This replaces three throwing exports, raising the source count from 2,946 to 2,949 of 3,437 on base2c8122c9f(85.71% to 85.80%).Signatures follow Orbital's type database and SharpProspero's bindings. The 64-byte cursor and public order/code fields follow SharpProspero's structure. Traversal rules and private current/start/terminator offsets follow the PS4 11.00 behavior reported in review. Initial clustered or synthetic characters are rejected; traversal skips synthetic characters but keeps cluster continuations. PS5 behavior, null-input results, lifetime requirements, and console error precedence remain unverified and are recorded in TechnicalDebt. No PS5 hardware or title validation of these exports is claimed.
Tested
guest_font,guest_system_font,guest_font_writing_line, and the newguest_font_text_codespassed.Socket.cppon Windows becauseHostPollis undeclared. Windows validation temporarily applied the existing fix from #4021; that patch is not included here.tools/check_conventions.py --base origin/main, andgit diff --check origin/main...HEADpassed.Checklist
main; no other open PR implements the same functions.mdfiles or images added to the repositoryImported from boykopovar/AnyPS5. Originally posted by fma-rc on 2026-10-11T22:18:28Z.
The PS4 11.00
libSceFont.sprxexports all three functions with the same NIDs, and its traversal rules differ from the inferred ones here in three places. This is PS4 behaviour, I have no PS5 source for it.sceFontCharactersRefersTextCodes(0x15f80) never compares the character with the terminator, so equal pointers give a valid cursor. It keeps the start character at cursor +0x30, the current one at +0x28 and the terminator at +0x38.sceFontTextCodesStepNext(0x15fd0) returns null only when the current character is the terminator (cmp 0x38(%rax),%rcxbefore advancing), so the terminator itself is visited: over A B C with C as terminator it yields B, then C, then null. This PR stops at B.sceFontTextCodesStepBack(0x16020) returns null when the current character is the start character (cmp 0x30(%rax),%rcx), so a cursor created at B does not step back to A. This PR walks to the head of the string.Both step functions also skip characters whose byte at +0x33 is set, and
Refersreturns null for a character with +0x31 or +0x33 set;sceFontCharacterRefersTextNexthere already filters on those two fields (clusterIndex,synthetic).Imported from boykopovar/AnyPS5. Originally posted by oneandonlydean on 2026-10-12T08:29:41Z.
Closing: no title is shown to call
sceFontCharactersRefersTextCodes,sceFontTextCodesStepNextorsceFontTextCodesStepBack, and the behaviour comes from the PS4 library only. Reopen with the title ID and the log line when one stops on them.Pull request closed