feat(libSceIcu): implement the enumeration dispatch exports #11132
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/11132"
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 mantavisual on 2026-10-25T19:08:20Z.
What
Implements the four
uenum_exports that firmware 13.42'slibSceIcuhas (BunnyFl's export list):uenum_close,uenum_count,uenum_nextanduenum_unext. They don't enumerate anything themselves. They dispatch through the callbacks in aUEnumeration, the object ICU's enumeration producers return; 13.42 exports producers such asucal_openTimeZones,ucol_getKeywordValuesanducurr_openISOCurrencies.Behaviour follows ICU 78.1's uenum.cpp over the
UEnumerationlayout in uenumimp.h:baseContext,context, then theclose,count,uNext,nextandresetcallbacks, 56 bytes. The callbacks are called with the guest ABI (APS5_VABI), so an enumeration built by guest code or by a future producer here works the same way.uenum_count,uenum_nextanduenum_unextreturn −1 or null for a null enumeration without reading the status, and for an error that is already set without calling anything. If the callback is missing, they setU_UNSUPPORTED_ERROR. Otherwise they return whatever the callback returns, and the callback may change the status.uenum_nextpasses a local length slot when the caller gives a nullresultLength.uenum_unextforwards the null as ICU does.uenum_closedoes nothing for null. With aclosecallback, it freesbaseContext(if set) and then callsclose. Without one, it frees only the enumeration. Freeing uses the guestfree, because ICU'suprv_freedefaults tofreeand 13.42 exports nou_setMemoryFunctionsto change it.A null status with a nonnull enumeration throws
APS5_INVALID_ARG_EX, since ICU dereferences it.uenum_resetand the*Defaulthelpers are not in 13.42's exports and are not added. The new debt entry records this, and that no export here creates an enumeration yet.Depends on #11122 (stacked on it). The agreed ICU order is #11013 → #10961 → … → #10967 → #11088 → #11115 → #11118 → #11122, and this PR comes after #11122. Until those merge, the diff also shows their commits. This PR's own change is the last commit,
c1d9fa2f64.Tested
Windows 11 Pro 23H2, WinLibs GCC 15.2.0 r7, Release,
BUILD_TESTING=ON, on #11122 (0bcb2ae1aa).guest_icu_enumeration, using enumerations whose callbacks areAPS5_VABIfunctions:count(the callback's status change is kept),nextwith and without a length slot,unext(including a forwarded null length), the end of the enumeration, andclose.U_UNSUPPORTED_ERROR, with the length left alone).closecallback, onlybaseContextis freed andcloseis called. Without one, only the enumeration is freed and itsbaseContextis left alone, as in ICU.ctest -R "guest_icu_|patched_libraries": all 7 pass. The NID-patchedlibSceIcu.prxbuilds.tools/progress.py --module libSceIcu: 50 implemented, 0 stubs.tools/check_test_registration.py build: 1346 test executables, none built and not run.python3 tools/check_conventions.py --base origin/mainpasses. Overlap: no open PR implements or names anyuenum_function (checked 2026-10-25).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)Imported from boykopovar/AnyPS5. Originally posted by MarcZX10 on 2026-10-25T19:12:49Z.
Review: APPROVED
Reviewed the PR-specific
Enumeration.cppandUEnumerationlayout against pinned ICU 78.1uenum.cpp/uenumimp.h. Null-enumeration and pre-set-error short circuits, missing-callback status, thenextdummy length slot,unextnull forwarding, and close/baseContext free ordering match the source. The callback types use the guest calling convention and the 56-byte layout matches ICU. I syntax-compiled the changed dispatcher andGuestIcuEnumeration.cpplocally with GCC 12.2 (g++ -std=c++20 -Icore/libs -fsyntax-only); the PR reports Windowsguest_icu_enumerationandctest -R "guest_icu_|patched_libraries"passing. Hosted eligibility, conventions, intake, labels and report pass; product build/test jobs are skipped. This is stacked on #11122, which remains a merge-order dependency.