feat(libSceLibcInternal): implement the money_get and money_put get and put members #15790
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/15790"
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:52:10Z.
What
The public
getmembers ofmoney_get<char>andmoney_get<wchar_t>and the publicputmembers ofmoney_put<char>andmoney_put<wchar_t>in libSceLibcInternal threw from thePending4placeholders inExport.cpp. They now returndo_getordo_putof the same value type through the facet's own vtable.money_get<char>::get(..., long double&)G84okRnyJJg(Pending4_076)money_get<char>::get(..., string&)2fxdcyt5tGs(Pending4_075)money_get<wchar_t>::get(..., long double&)cx-1THpef1A(Pending4_081)money_get<wchar_t>::get(..., wstring&)wWIsjOqfcSc(Pending4_080)money_put<char>::put(..., long double)65cvm2NDLmU(Pending4_086)money_put<char>::put(..., const string&)DR029KeWsHw(Pending4_085)money_put<wchar_t>::put(..., long double)fsF-tGtGsD4(Pending4_091)money_put<wchar_t>::put(..., const wstring&)JruBeQgsAaU(Pending4_090)Each NID matches
tools/nid_names.pycompute_nidof its mangled name, for example_ZNKSt9money_getIcSt19istreambuf_iteratorIcSt11char_traitsIcEEE3getES3_S3_bRSt8ios_baseRNSt5_IosbIiE8_IostateERegivesG84okRnyJJgand_ZNKSt9money_putIwSt19ostreambuf_iteratorIwSt11char_traitsIwEEE3putES3_bRSt8ios_basewRKSbIwS2_SaIwEEgivesJruBeQgsAaU. All 8 were checked.Where the behaviour comes from:
getreturnsdo_get(s, end, intl, f, err, quant)(ordigits), andputreturnsdo_put(s, intl, f, fill, quant)(ordigits). The first microsoft/STL commit does the same: xlocmon L326-L334 forget(return do_get(_First, _Last, _Intl, _Iosbase, _State, _Val);) and L629-L637 forput(return do_put(_Dest, _Intl, _Iosbase, _Fill, _Val);).long doublevirtual is declared before the string one,do_getat L363 and L390,do_putat L666 and L697, as in the standard synopsis. After the fourFacetVtableslots that putslong doubleat 0x20 and the string at 0x28. With offset-to-top and RTTI this gives 8 entries, the size open #12511 and #12518 give themoney_get<char>andmoney_put<char>_ZTVobjects as zeroed data, from theirst_sizeof 64 in thelibc.prxof PPSA26344; this PR does not depend on them. 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. Theistreambuf_iteratormembers are_Strbuf,_Gotand_Val: streambuf L519-L521 in the first commit, moved to iterator L480-L482 ate1ed302683. Forcharand for the 2-bytewchar_tthe iterator is 16 bytes with no user-declared copy constructor or destructor, so it is passed and returned in two integer registers like this struct.money_puttakes and returns the existing 16-byteGuestLocale::OutputIterator.GuestLocale.hpp: newGuestLocale::MoneyGetVtable<TString>andGuestLocale::MoneyPutVtable<TCharacter, TString>, used asCharMoneyGetVtable,WideMoneyGetVtable,CharMoneyPutVtableandWideMoneyPutVtable, withstatic_asserts on both slots and the size of each. The narrow string is the existing 0x28-byteGuestLocale::String; the wide string has no layout in AnyPS5 and is forwarded as an opaque pointer. Thewchar_tfill isstd::uint16_t.ios_base::iostate&is_Iosb<int>::_Iostate&in the mangled names and is passed asstd::int32_t*.MoneyGetPut.cppwith the 8 forwarders, and the 8 placeholders removed fromExport.cpp.docs/dev/debt/libSceLibcInternal.md: the 8 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_getandtime_getPRs 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:
money_getormoney_putfacet or implements theirdo_members, so today these calls reach only a facet the title provides.do_get,do_put,_Getmfld,_Putmfldandmoneypunctstill throw.Tested
No title was run. I added the guest test
guest_libc_internal_money_get_put(core/libs/tests/GuestLibcInternalMoneyGetPut.cpp). It loadslibSceLibcInternal, calls each of the 8 exports with a facet whose vtable records every call, and checks:do_getordo_putslot of its own value type exactly once, withintlfalse and true (each slot records a different index, so a wrong slot order fails);getpasses the facet, both 16-byte iterators word for word,intl, the stream, the state pointer and the value pointer, and returns the iteratordo_getreturns;putpasses the facet, the output iterator,intl, the stream, the fill ('*',0xa4,0x20ac,0xffe5) and the units or digits pointer; thelong doubleunits are-(1 + 2^-60) * 2^40, which needs the full 64-bit x87 mantissa; it returns the iteratordo_putreturns;The header
static_asserts pin both slot offsets and the size of all four vtable types.Results:
ctest -R '^guest_libc_internal_money_get_put$'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_money_get_put|public_headers)$'3 of 3 runs (2/2 each), and 1 of 1 after the restore.Export.cppput back andMoneyGetPut.cppemptied, keeping the new test, the test fails on both hosts withsceLibcInternalPending4_076_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 100 (+8), todo 1045 to 1037. Overall done 9921 to 9929 of 37146; the total does not change, so no new todo.python3 tools/pr_overlap.py --branch feat/r4-money-get-put-membersfailed closed. It reported no PR with the same exports or new files. Line conflicts are neighbours only: #13881 at debt line 346, and #14664 and #14836 atCMakeLists.txtline 78. 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 #13881, #14664 and #14836 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