feat(libSceIcu): implement UTF-32, Java UTF-8, comparison and configuration exports #12320
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/12320"
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 MarcZX10 on 2026-10-28T09:21:51Z.
What
Implements 20 of the
sceIcuUnknown_*_nid_no_patchstubs of libSceIcu that the PS5 3.20 export inventory (PS5-3.20_Libs) names, using the names that the NIDs hash to (checked withtools/nid_names.py) and the prototypes and behavior of ICU 78.1, unicode-org/icu@049e0d6a420629ac7db77256987d083a563287b5, the commit the escape decoder already cites. The code is written independently; ICU is only the reference for prototypes, error codes and edge cases. The stubs are replaced by named exports, so the remaining stub count drops from 112 to 92.Utf32.cpp, ustrtrns.cpp):u_strFromUTF32,u_strFromUTF32WithSub,u_strToUTF32,u_strToUTF32WithSub.JavaUtf8.cpp, ustrtrns.cpp, utf_impl.cpp):u_strFromJavaModifiedUTF8WithSub,u_strToJavaModifiedUTF8.Compare.cpp,Search.cpp, ustring.cpp):u_strCompare,u_strstr,u_strrstr.Character.cpp, uchar.cpp, unames.cpp):u_isISOControl,u_forDigit,u_getISOComment.Configuration.cpp, umutex.cpp, cmemory.cpp, putil.cpp, ucln_cmn.cpp):u_setMutexFunctions,u_setAtomicIncDecFunctions(both reportU_UNSUPPORTED_ERRORas ICU does),u_setMemoryFunctions,u_setDataDirectory,u_getDataDirectory,u_setTimeZoneFilesDirectory,u_getTimeZoneFilesDirectory,u_cleanup. Stored state is guarded by mutexes.Not implemented:
u_strCompareIterstays a throwing stub because it needs theUCharIteratorlayout, which only the open iterator PR #11136 introduces. Nothing else from the Unicode property tables, converters or name data is touched.None of the 20 names is implemented or removed by the 13 open libSceIcu PRs (#10962-#10967, #11088, #11115, #11118, #11122, #11132, #11136, #12294); this was checked by name against each diff. Those PRs also edit
CMakeLists.txt,libSceIcu.hpp,Export.cppand the debt file, so a textual conflict on those lines is possible whichever lands second. This PR keeps its own files and does not copy code from them.Commits are cut per export group: implementation with its header and stub removal, then its tests, then its debt entry (39 commits). Only the final tree was built; the intermediate commits were not built one by one.
Availability caveat, recorded in the debt file: only 104 of the 661 inventory NIDs appear in the native libSceIcu export table, so whether each of these NIDs exists on current firmware is unproven. Firmware 13.42 is also reported (in #11132) to export no
u_setMemoryFunctions. The functions stay as compatibility exports like the existing escape decoder. A nullUErrorCodethrows where ICU would dereference it, and a result longer thanINT32_MAXthrows. No console behavior of these exports was measured.Tested
Linux x86-64 (host fails the CPU gate, so the archive build with the patched gate was used), GCC. Built
libSceIcuand ran withrun_tests.sh:guest_icu_utf32,guest_icu_java_utf8,guest_icu_compare,guest_icu_search,guest_icu_character,guest_icu_configuration, plus the existingguest_icu_unescapeandguest_icu_version: 8/8 passed.tools/check_conventions.py --base upstream/main,test_public_headers.py --audit-onlyandgit diff --check upstream/mainare clean. The six new test programs also ran standalone under AddressSanitizer and UBSan with no findings.The expected values in the tests were derived by reading the ICU source (UErrorCode values, preflight lengths, surrogate handling, the bytes swallowed by malformed UTF-8 sequences, the 0x2800 code point order adjustment). I checked by mutating the implementation that the UTF-32, comparison and search vectors fail when the pair or boundary logic is broken; I did not do that for every test. Not run: Windows, macOS, a console, or any title; the guest calling convention of the stored memory callbacks is never exercised because nothing calls them.
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)