# libSceIcu technical debt ### Unknown function info - The 134 [recovered inventory exports](../../../core/libs/prx/libSceIcu/RecoveredInventory.cpp) have unverified parameters, return types, callback ABIs and behavior. Every entry immediately throws through `NotImplemented_nid_no_patch`; the parameterless `int` declarations are import-resolution placeholders. The [13.60 inventory](https://github.com/xdCloudy/PS5-13.60-Function-Stub-Library/blob/226383a7fa4b1275d6cebf61eb1c1e7ca7b58bcb/data/firmware-13.60/libsceicu-9790ee85e3.jsonl) establishes only name/NID bindings. The [module map](https://github.com/boykopovar/ps5-nid-map/blob/cc1d586fddab576a520f226da6b2632b031e6d09/data/Modules/libSceIcu.inc) assigns all 134 NIDs to logical `libSceIcu` in `libSceIcu.sprx`. Recovered `ucfpos`, `uset` and `uiter` groups are excluded. Console ABI, behavior and title compatibility remain unverified. - [ICU export availability](../../../core/libs/prx/libSceIcu/Unescape.cpp) across firmware versions remains unproven. The [PS5 3.20 inventory](https://github.com/DNNDHH/PS5-3.20_Libs/blob/b2a77c09cd71c01f34c790cfbe98c751a13262ad/libSceIcu.c) includes the implemented escape, invariant-character and version helpers. [BunnyFl’s firmware 13.42 report](https://github.com/boykopovar/AnyPS5/pull/10961#issuecomment-6400071863) records `u_getVersion` returning `78.1.0.0` under an emulator, but neither escape function is in the checked native `system_ex/common_ex/lib/libSceIcu.sprx` export table. Only 104 of the 661 inventory NIDs appear among that module’s 299 exports. The exports for compatibility with older firmware are retained; availability and routing across firmware versions remain unproven. ### Older dispatch exports - [Older dispatch exports](../../../core/libs/prx/libSceIcu/Export.cpp) - Four 3.20 callable NIDs are declared as throwing placeholders. Their signatures and behavior are unverified. The four selector wrappers have identical instruction bytes in the 3.20 and later version-labelled modules, and corresponding consumer switch cases call them. Their NIDs and internal layouts differ; no forwarding or binary compatibility is claimed. Later image version metadata does not authenticate a retail firmware release. | 3.20 NID | Later candidate NID | Selector | | --- | --- | --- | | `BufsAiaX0+s` | `3lVihhFbXus` | 0 | | `xdF5zg0V5Oc` | `HFkUTLyJkZ0` | 1 | | `Con4H1SB3nw` | `jXOj7dZh7RQ` | 2 | | `lME28PLmu54` | `bxjI++g9NkE` | 3 | ### Functional - [Older callable exports](../../../core/libs/prx/libSceIcu/LegacyExports.cpp) - 2347 3.20 callable NIDs have unidentified names and are declared as throwing placeholders. Their signatures and behavior are unverified; no ICU functionality is implemented. These NIDs do not appear in the later version-labelled module inventory; no cross-version identity or compatibility is claimed. - [UTF-8 macro helpers](../../../core/libs/prx/libSceIcu/Utf8.cpp) have no console ABI or behavior verification. Their names and NIDs are in the [PS5 3.20 inventory](https://github.com/DNNDHH/PS5-3.20_Libs/blob/b2a77c09cd71c01f34c790cfbe98c751a13262ad/libSceIcu.c); behavior follows ICU 78.1 [utf_impl.cpp](https://github.com/unicode-org/icu/blob/049e0d6a420629ac7db77256987d083a563287b5/icu4c/source/common/utf_impl.cpp). These are macro bodies, not complete UTF-8 operations: append encodes ASCII with two bytes, and null-error-pointer failures write the legacy length-dependent error characters. Null index pointers, negative positions, reversed bounds, overflowing index or capacity arithmetic, and null buffers when accessed throw instead of reproducing undefined behavior. Negative forward lengths denote NUL-terminated input. Cross-firmware export availability and native behavior outside the macros' preconditions remain unverified. - [Space classification](../../../core/libs/prx/libSceIcu/Space.cpp) is unverified on a console. `u_isspace`, `u_isblank`, `u_isWhitespace`, `u_isJavaSpaceChar` and `u_isUWhiteSpace` follow ICU 78.1 [uchar.cpp](https://github.com/unicode-org/icu/blob/049e0d6a420629ac7db77256987d083a563287b5/icu4c/source/common/uchar.cpp#L196-L244) over fixed Zs, Zl, Zp and White_Space sets instead of ICU's property data; the sets are unchanged from ICU 65.1 to 78.1. Firmware 13.42 exports `u_isUWhiteSpace` but not the other four ([#11013](https://github.com/boykopovar/AnyPS5/pull/11013#issuecomment-6401310351)), which are kept from the 3.20 inventory for older firmware (see ICU export availability). Closes when: compared with the console. - [C string helpers](../../../core/libs/prx/libSceIcu/CString.cpp) have no console ABI or behavior verification. Their names/NIDs are in the PS5 3.20 inventory; signatures and behavior follow ICU 78.1's [cstring.cpp](https://github.com/unicode-org/icu/blob/049e0d6a420629ac7db77256987d083a563287b5/icu4c/source/common/cstring.cpp), unchanged since 65.1 apart from casts. Formatting accepts radices 2–16; null buffers or other radices throw an invalid-argument exception, whereas ICU dereferences the buffer and only asserts the radix. Signed minima and outputs exceeding ICU's 30-byte temporary use unsigned arithmetic and caller storage without reproducing upstream undefined behavior. Parsing uses guest LP64 `strtoul` and keeps the low 32 bits; a null source throws. Cross-firmware availability, native invalid-input behavior and the undefined upstream cases remain unverified. - [Converter STOP/SKIP callbacks](../../../core/libs/prx/libSceIcu/ConverterCallbacks.cpp) have no console ABI or behavior verification. Signatures and decisions follow ICU 78.1's [ucnv_err.h](https://github.com/unicode-org/icu/blob/049e0d6a420629ac7db77256987d083a563287b5/icu4c/source/common/unicode/ucnv_err.h) and [ucnv_err.cpp](https://github.com/unicode-org/icu/blob/049e0d6a420629ac7db77256987d083a563287b5/icu4c/source/common/ucnv_err.cpp). The callback-specific default-ignorable ranges include U+180F, which ICU 65.1 excludes; firmware-dependent selection is not implemented. Reasons outside the upstream enum's 0–7 value range and a null error pointer on a path that writes it throw `invalid_argument`; native behavior there is undefined. Untouched pointers remain unread, including the error pointer on no-write paths. Converter argument structures stay opaque because these callbacks do not access them; converter execution and other callbacks remain unavailable. - [Escape decoding](../../../core/libs/prx/libSceIcu/Unescape.cpp) has no behavior or ABI verification on console hardware. It follows ICU 78.1's [ustring.cpp](https://github.com/unicode-org/icu/blob/049e0d6a420629ac7db77256987d083a563287b5/icu4c/source/common/ustring.cpp), including rejection of eight-digit braced hexadecimal escapes although its public header advertises up to eight digits. Null source or offset pointers and null callbacks with an in-range offset, which ICU dereferences, throw `std::invalid_argument`. A negative capacity writes nothing, as in ICU; source lengths exceeding `INT32_MAX` and a capacity that overflows ICU's signed `destCapacity - i` throw. Null-destination preflight ignores capacity. Closes when: compared with the console, including callback ABI, byte conversion, capacity limits and braced hexadecimal parsing. - [Invariant character and version helpers](../../../core/libs/prx/libSceIcu/Version.cpp) are unverified on a console. `u_charsToUChars`, `u_UCharsToChars`, `u_versionFromString`, `u_versionFromUString` and `u_versionToString` follow ICU 78.1 [uinvchar.cpp](https://github.com/unicode-org/icu/blob/release-78.1/icu4c/source/common/uinvchar.cpp) and [putil.cpp](https://github.com/unicode-org/icu/blob/release-78.1/icu4c/source/common/putil.cpp), unchanged since 65.1. Firmware 13.42 reports ICU 78.1 and exports none of them ([#11013](https://github.com/boykopovar/AnyPS5/pull/11013#issuecomment-6400470698)); the [3.20 table](https://github.com/DNNDHH/PS5-3.20_Libs/blob/b2a77c09cd71c01f34c790cfbe98c751a13262ad/libSceIcu.c) has all five. Version parts use the guest `strtoul`, truncated to eight bits; `u_versionToString` keeps ICU's dropped zero tens digit (105 becomes `15`). A null buffer with a positive conversion length throws; ICU dereferences it. Closes when: compared with the console. - [Iterator comparison and Unicode version](../../../core/libs/prx/libSceIcu/CompareIter.cpp) are unverified on a console. `u_strCompareIter` and `u_getUnicodeVersion` follow ICU 78.1 [ustring.cpp](https://github.com/unicode-org/icu/blob/049e0d6a4206/icu4c/source/common/ustring.cpp#L828-L882) and [uchar.cpp](https://github.com/unicode-org/icu/blob/049e0d6a4206/icu4c/source/common/uchar.cpp#L484-L489); the version is 17.0, the Unicode data of 78.1, whatever firmware is emulated. A null iterator callback that ICU would call throws `std::invalid_argument`; ICU dereferences it. The code unit difference wraps instead of overflowing. The `UBool` is read as one byte, nonzero meaning true. Closes when: compared with the console. - [Default-converter string copy helpers](../../../core/libs/prx/libSceIcu/Invariant.cpp) `u_austrcpy` and `u_austrncpy` are unverified on a console and throw `NotImplemented_nid_no_patch` on code units above `0x7f`. Their names and NIDs come from the PS5 3.20 inventory; signatures and ASCII (`0x01`–`0x7f`) behavior follow ICU 78.1's [ustr_cnv.cpp](https://github.com/unicode-org/icu/blob/release-78.1/icu4c/source/common/ustr_cnv.cpp), unchanged since 65.1, without assuming the console's default converter for non-ASCII units. `u_austrncpy` writes a single NUL when the source ends before the count without zero-padding the remainder. Null buffers with `u_austrcpy` or a positive count throw an invalid-argument exception, whereas ICU dereferences in `u_austrcpy` and returns the destination unchanged in `u_austrncpy`. Closes when: compared with the console, including the default converter for non-ASCII units. - [UTF-16 set searches and tokenization](../../../core/libs/prx/libSceIcu/Tokenize.cpp) have no console verification; ICU versions on other firmware are unverified. Signatures and behavior follow ICU 78.1's [ustring.h](https://github.com/unicode-org/icu/blob/049e0d6a420629ac7db77256987d083a563287b5/icu4c/source/common/unicode/ustring.h) and [ustring.cpp](https://github.com/unicode-org/icu/blob/049e0d6a420629ac7db77256987d083a563287b5/icu4c/source/common/ustring.cpp). `u_strtok_r` preserves that source's one-code-unit delimiter overwrite, including the trailing surrogate left after splitting at a supplementary delimiter. Invalid null inputs and rejected guest-write scopes throw; an initial continuation assignment is retained if a later delimiter write is rejected. Set-search offsets beyond `INT32_MAX` throw. - [Numeric platform helpers](../../../core/libs/prx/libSceIcu/Numeric.cpp) are unverified on a console. The 24 `uprv_` IEEE 754, rounding, extreme, overflow and pointer-limit exports follow ICU 78.1 [putil.cpp](https://github.com/unicode-org/icu/blob/release-78.1/icu4c/source/common/putil.cpp) and [umath.cpp](https://github.com/unicode-org/icu/blob/release-78.1/icu4c/source/common/umath.cpp), unchanged since 65.1, assuming the default `IEEE_754` and `U_MAX_PTR` configuration. The 3.20 table has them; firmware 13.42 exports none ([#11013](https://github.com/boykopovar/AnyPS5/pull/11013#issuecomment-6401310351)). The libm wrappers call the guest libc, so their precision is libc's. ICU's quirks are kept: `uprv_trunc` of negative infinity is positive infinity, NaN results are the canonical quiet NaN, `uprv_fmax(0.0, -0.0)` is `-0.0`, and `uprv_round` floors `x + 0.5`. Null `uprv_modf` and overflow result pointers throw; ICU dereferences them. Closes when: compared with the console. - [u_getVersion and u_errorName](../../../core/libs/prx/libSceIcu/ErrorName.cpp) follow ICU 78.1, the version firmware 13.42's module reports and exports both for ([#11013](https://github.com/boykopovar/AnyPS5/pull/11013#issuecomment-6401310351)); only `u_getVersion`'s 78.1.0.0 was measured there. `u_errorName` returns the names in 78.1's [utypes.cpp](https://github.com/unicode-org/icu/blob/release-78.1/icu4c/source/common/utypes.cpp), including its `U_BRK_VARIABLE_REDFINITION` spelling, and `[BOGUS UErrorCode]` for every other code; the names were not compared with the console. Both report 78.1 whatever firmware is emulated, although the 3.20 module was ICU 65 to 68 and has no names for the codes added since. Closes when: compared with the console. - [Constrained field positions](../../../core/libs/prx/libSceIcu/ConstrainedFieldPosition.cpp) are unverified on a console. The seven `ucfpos_` exports firmware 13.42 has ([#11013](https://github.com/boykopovar/AnyPS5/pull/11013#issuecomment-6401310351)) follow ICU 78.1 [formattedvalue.cpp](https://github.com/unicode-org/icu/blob/release-78.1/icu4c/source/i18n/formattedvalue.cpp) and [capi_helper.h](https://github.com/unicode-org/icu/blob/release-78.1/icu4c/source/common/capi_helper.h). A handle is a host object whose first four bytes hold ICU's magic `0x55434600`; the rest of its layout differs from ICU's. A set error changes nothing, a null handle sets `U_ILLEGAL_ARGUMENT_ERROR` and other memory `U_INVALID_FORMAT_ERROR`; `ucfpos_open` ignores the error unless allocation fails. No export fills a position yet, so the indexes stay 0. Null error pointers and index outputs throw where ICU dereferences them. Closes when: compared with the console. ### Known export names; ABI prototypes unverified - The 93 `sceIcuUnknown_*_nid_no_patch` and named `*_nid_postfix` stubs in [Export.cpp](../../../core/libs/prx/libSceIcu/Export.cpp) are present in the PS5 3.20 export inventory from [PS5-3.20_Libs](https://github.com/DNNDHH/PS5-3.20_Libs). Their prototypes and behavior are unverified. Each uses the no-parameter import-resolution convention and throws through `NotImplemented_nid_no_patch`; these declarations make no ABI or behavior claim. - The 73 named stubs declared in [Identified.hpp](../../../core/libs/prx/libSceIcu/Identified.hpp) carry the ICU C API names whose `tools/nid_names.py` hash equals the inventory NID; the names were taken from the identifiers of the ICU 78.1 `common`, `i18n` and `io` sources. A name match does not show that the console function has ICU's prototype or behavior. Most of them read Unicode property, case-folding or resource data that no host library provides. - [Resource type classification](../../../core/libs/prx/libSceIcu/Resource.cpp) has no console ABI or behavior verification. `res_getPublicType` (NID `WPrktCwd+iw` in the PS5 3.20 inventory above) takes an unsigned 32-bit resource and returns a signed 32-bit public type, following ICU 65.1 and [ICU 78.1](https://github.com/unicode-org/icu/blob/049e0d6a420629ac7db77256987d083a563287b5/icu4c/source/common/uresdata.cpp). Both use the same mapping of the high four bits; the low 28 bits do not affect the result. Cross-firmware export availability and native behavior remain unverified. Closes when: compared with the console.