Repository navigation
feat(libSceFont): build and search word dictionaries as the console does - #9731
Conversation
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01RbLgECLQ2bpDM7oe2urGZK
Progress report (f26434a → 6f4d796)📈 System libraries: 48.82% (+0.02%, +3 implemented functions) ✅ 3 implemented
Changed libraries (implemented exports)
|
|
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.
|
MarcZX10
left a comment
There was a problem hiding this comment.
WordsFindWordCharacters has an empty-range boundary bug. The existing band test passes endCharacter == band[2] and expects the matcher to stop before that character, so the bound is exclusive. In MatchWords, the character == endCharacter check only happens after the first lookup and after advancing; when firstCharacter == endCharacter, it still reads firstCharacter and can return a match outside the requested range. Please check the bound before the initial FindCode and add a regression where the first and exclusive end pointers are equal (also assert both output pointers are null).
I checked the current source and test suite; this case is not covered. The current convention and whitespace checks pass, while product Linux/Windows CI jobs are skipped. Please rerun the focused font tests after the fix and refresh the branch to current main before merge.
The firmware matcher at 0x1bb70 looks up the first character before it compares any character with the end pointer, and the export at 0x1bd90 calls it without comparing the first and end pointers, so a range whose first and end characters are the same still matches a word starting there. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01RbLgECLQ2bpDM7oe2urGZK
|
@MarcZX10 thanks for checking the empty range. I went back to the firmware (libSceFont, 12.00) before changing it, and the console does the same as this PR:
So when the first and end characters are the same, the console still matches a word that starts there. Checking the bound first would make us differ from the console, so I kept the matcher as it is. Instead I added a regression for this case in I also merged current |
|
Correction to my earlier review: based on your cited firmware disassembly and the new regression test, I withdraw the request to treat |
MarcZX10
left a comment
There was a problem hiding this comment.
I reviewed current head 7518b87dea2049ca05274fc647b4cad4fb6923b4. I withdraw my earlier empty-range code finding: the firmware disassembly explanation and new regression support the behavior as written. No implementation defect is alleged in this review.
Local checks on the exact head: g++ -std=c++20 -fsyntax-only passed for Words.cpp and GuestFontWords.cpp (with the new header overlaid from the PR head); diff-check and conventions passed. I could not run guest_font_words because this checkout has no configured build. The reported Linux and Windows runtime tests are author-reported; current PR hosted product build/test jobs are skipped.
Two integration items remain before merge:
- This branch is based on
8b3a6ba, 50 commits behind currentmain(b7d1d47a). Please refresh it and rerun the focused font tests on the current base. - Open #6044 rewrites the Font CTest registrations. Your description notes
guest_font_wordsneeds itsadd_library_testform when the branches are rebased, but this PR still saysDepends on: none. Please coordinate landing order with #6044’s author and record the dependency/order in the checklist so the new test remains registered after both changes land.
I manually checked the #5209 overlap: its Text.cpp hunk is separate from this PR's changed text-source checks; no same-function duplicate was found there. #9722's Font graphics test addition is separate from the new words test.
|
@MarcZX10 thanks for the recheck and for withdrawing the empty-range point.
🤖 Generated with Claude Code |
|
Correction: I mislabelled the firmware. The decrypted modules I read are firmware 13.60, not 12.00 (each module's module-param segment records SDK 13.60). The behaviour described is unchanged; only the version label was wrong. I've updated the description. Assisted With AI: Yes But all test done locally on actual hardware |
Kept main's Api.hpp declarations and dropped the duplicated struct block from Unimplemented.cpp. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
… and test Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Dismissing a stale review: the requested changes were addressed after it (new head) and the merge queue blocks on it. Please request changes again if anything is still open.
|
Checked the trie build, the word matcher, the three |
What
libSceFont's word dictionary calls threw:sceFontCreateWords,sceFontDestroyWordsandsceFontWordsFindWordCharacters. They only need the text source, the caller's allocator and the character list that upstream already models, so they can work now.This PR implements them in a new
src/Words.cpp. Their exported entry points stay where the stubs were, in the existing export block ofUnimplemented.cpp, and call into it, so no new visibility pragma is needed. They follow the decrypted PS5 13.60libSceFont.sprx(read from disassembly, not measured on a console):CreateWordsSCE_FONT_ERROR_NO_SUPPORT_CODE. A parser error passes on its negative code, and anything else returnsINVALID_TEXT_SOURCE. A character at depth 128 stops reading and keeps what was read. The result is a header plus one array of nodes, both from the caller'sFontMemory. It is a trie laid out by depth, so each node's children are a sorted contiguous run. The source is rewound again on every exit.DestroyWordsWordsFindWordCharactersnextCharacteris the next rendered character.Error codes are the existing
SCE_FONT_ERROR_*constants:INVALID_PARAMETER,INVALID_MEMORY,INVALID_TEXT_SOURCE,INVALID_WORDS,ALLOCATION_FAILED,NO_SUPPORT_CODEandFUNCTIONAL_LIMIT.The firmware's
CreateWordsreturns the result ofsceFontTextSourceRewind. That export,SetDefaultFontandSetWritingFormreturnINVALID_TEXT_SOURCE(0x80460008) for an object that is not a text source, notINVALID_PARAMETER, so this PR corrects those three checks inText.cpp. A null source still returnsINVALID_PARAMETER.Differences, listed in the new debt entry:
FUNCTIONAL_LIMIT, where the native 16-bit indices would wrap.The code is written from the observed behaviour; nothing from the module is copied.
Tested
New
guest_font_wordstest. It checks:On
mainall three calls throw.guest_font_words,guest_fontandguest_font_writing_linepass.guest_font_wordsandguest_fontpass.main2e0c925 (7e3a978):guest_font_wordspasses on Linux and on Windows (WinLibs GCC 15.2.0, Release, under Wine), with the NID-patchedlibSceFont.prxbuilt on both.tools/check_conventions.pyis clean. Overlap:Text.cppat lines 151 to 162 and adds a debt line at 25. This PR changes lines 249 to 275 and appends to the end of the debt file;tools/pr_overlap.pycould not compare them automatically because fix(libSceFont): keep horizontal writing on a single baseline #5209 conflicts withmain.Graphics.cppand a test registration elsewhere in the same CMake files.core/libs/tests/media/and registers them withadd_library_test(media ...). Either landing order works. If test: organize library tests and label CTest suites #6044 lands first, I mergemain, moveGuestFontWords.cpptotests/media/and register it asadd_library_test(media NAME guest_font_words COMMAND guest_font_words_tests). If this PR lands first, test: organize library tests and label CTest suites #6044 needs that one registration converted. I noted this on test: organize library tests and label CTest suites #6044.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)guest_font_wordsregistration, see Overlap)🤖 Generated with Claude Code
https://claude.ai/code/session_01RbLgECLQ2bpDM7oe2urGZK