feat(libSceLibcInternal): implement the time_get<char> and time_get<wchar_t> members #15789
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/15789"
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 B-Howell on 2026-11-04T14:51:44Z.
What
The seven public members of
time_get<char, istreambuf_iterator<char>>and the seven oftime_get<wchar_t, istreambuf_iterator<wchar_t>>in libSceLibcInternal threw from thePending4placeholders inExport.cpp. They now return theirdo_member through the facet's own vtable.charNID (was)wchar_tNID (was)date_order()ShlQcYrzRF8(Pending4_035)nc6OsiDx630(Pending4_051)get_timerrqNi95bhMs(Pending4_049)9TfGnN6xq-U(Pending4_066)get_dateOY5mqEBxP+8(Pending4_048)kwp-0uidHpw(Pending4_065)get_weekdayKwJ5V3D0v3A(Pending4_039)A0PftWMfrhk(Pending4_055)get_monthnamevvA7HtdtWnY(Pending4_041)xy0MR+OOZI8(Pending4_057)get_year5L5Aft+9nZU(Pending4_050)Krt-A7EnHHs(Pending4_067)get(first, last, ios, err, tm*, char format, char modifier)+RuThw5axA4(Pending4_044)64pqofAwJEg(Pending4_061)Each NID matches
tools/nid_names.pycompute_nidof its mangled name, for example_ZNKSt8time_getIcSt19istreambuf_iteratorIcSt11char_traitsIcEEE10date_orderEvgivesShlQcYrzRF8and_ZNKSt8time_getIwSt19istreambuf_iteratorIwSt11char_traitsIwEEE3getES3_S3_RSt8ios_baseRNSt5_IosbIiE8_IostateEP2tmccgives64pqofAwJEg. All 14 were checked.Where the behaviour comes from:
do_member with the same arguments. The first microsoft/STL commit does the same (xloctime L53-L85), for examplereturn do_get(_First, _Last, _Iosbase, _State, _Pt, _Specifier, _Modifier);.do_date_order,do_get_time,do_get_date,do_get_weekday,do_get_monthname,do_get_year,do_get), after the fourFacetVtableslots.time_basederives fromlocale::facetand adds no virtual (xloctime L23-L35). Here the standard synopsis and microsoft/STL agree. With offset-to-top and RTTI this gives the 13 entries libc already declares for_ZTVSt8time_getIcSt19istreambuf_iteratorIcSt11char_traitsIcEEEand_ZTVSt8time_getIwSt19istreambuf_iteratorIwSt11char_traitsIwEEE. The console'slibSceLibcInternal.sprxwas not read, so the slots are not confirmed on the console.Changes:
GuestLocale.hpp: newGuestLocale::InputIterator, an opaque, trivially copyable 16-byte value foristreambuf_iterator, withstatic_asserts on its size and triviality. Nothing reads its fields.istreambuf_iterator<char>andistreambuf_iterator<wchar_t>are both 16 bytes (_Strbuf,_Got,_Valin streambuf L519-L521) with no user-declared copy constructor or destructor, so they are passed and returned in two integer registers like this struct.GuestLocale.hpp: newGuestLocale::TimeGetVtablewithstatic_asserts on all seven slot offsets (0x20 to 0x50) and the size (0x58).ios_base::iostate&is_Iosb<int>::_Iostate&in the mangled names and is passed asstd::int32_t*;dateorderis returned asstd::int32_t;formatandmodifierarecharfor both character types, as the mangledccsays.TimeGet.cppwith the 14 forwarders, and the 14 placeholders removed fromExport.cpp.docs/dev/debt/libSceLibcInternal.md: the 14 per-NID "prototype and behavior are unverified" entries are removed and one entry records what is still open.The
InputIteratorblock inGuestLocale.hpp(and its<type_traits>include) is byte-for-byte the block of thenum_getandmoney_get/money_putPRs from the same batch, at the same place, so the three merge in any order.git merge-tree --write-treeof each pair, of all three, and of each againstmainis clean, and the merged header has oneInputIterator.Still not done:
time_getfacet or implements itsdo_members, so today these calls reach only a facet the title provides. Thedo_members,_Getfmt,_Getint, the pattern overloadget(..., const char_type* first, const char_type* last)(it reads the stream buffer itself) and the rest of the facet still throw.Tested
No title was run. I added the guest test
guest_libc_internal_time_get(core/libs/tests/GuestLibcInternalTimeGet.cpp). It loadslibSceLibcInternal, calls each of the 14 exports with a facet whose vtable records every call, and checks:do_slot exactly once (every slot records a different index, so a wrong slot order fails);tmpointer arrive unchanged, andgetpassesformatandmodifier(checked with'Y'/'E'and'x'/'');do_member returns and leaves the state it wrote;date_orderreturns thedo_date_orderresult;The header
static_asserts pin every slot offset (0x20 to 0x50) and the size.Results:
ctest -R '^guest_libc_internal_time_get$'passed 3 of 3 runs (1/1 each), and once more after the negative-control restore.public_headerspassed.b11c7bf84fwith this commit applied (git write-treeequal to the commit's tree) passedctest -R '^(guest_libc_internal_time_get|public_headers)$'3 of 3 runs (2/2 each), and 1 of 1 after the restore.Export.cppput back andTimeGet.cppemptied, keeping the new test, the test fails on both hosts withsceLibcInternalPending4_035_nid_no_patch not implemented(Windows exit code 0xc0000409, Linux subprocess aborted).python3 tools/check_conventions.py --base origin/mainwith this title and body: "All conventions checks passed."tools/progress.pycollect_libraries()for libSceLibcInternal: done 92 to 106 (+14), todo 1045 to 1031. Overall done 9921 to 9935 of 37146; the total does not change, so no new todo.python3 tools/pr_overlap.py --branch feat/r4-time-get-membersfailed closed. It reported no PR with the same exports or new files. Line conflicts are neighbours only: #10392, #14664 and #14836 at debt line 342, #15577 and #15657 atCMakeLists.txtline 61, and our own #15715 atExport.cppL402-431 (itsPending4_068and later removals sit right after this PR'sPending4_065-067). Whichever lands second rebases. It could not compare 8 PRs that conflict with main: #5021, #13486, #13778, #13782, #14212, #14401, #14837 and #14936. I grepped the added and removed lines of every file patch of each one (from the REST files API; for #14212'sdocs/dev/debt/libSceLibcInternal.md, whose patch the API omits,git diffof the fetched PR head against its merge base) for the 44 NIDs of this batch, thePending3_055-065,Pending3_080-090andPending4stub names it removes, thenum_get/time_get/money_get/money_putmember mangled names,InputIterator,NumGetVtable,TimeGetVtable,MoneyGetVtable,MoneyPutVtableand the new file names. None has a match. The added and removed lines of #10392, #14664, #14836, #15577, #15657 and #15715 have no match either.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)🤖 Generated with Claude Code
Pull request closed