feat(libc): export _Getptimes with the console's C-locale time names #11735

Merged
verusferro merged 1 commit from upstream-pr/11735 into main 2026-11-02 12:26:31 +00:00
verusferro commented 2026-10-27 06:22:06 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by verusferro on 2026-10-27T06:22:06Z.


What

libc did not export Dinkumware's _Getptimes, which the console's libc.prx exports. In the SDK 7.00 libc.prx that PPSA06416 ships in sce_module/ (0x3cdb0, read from its disassembly, REVERSE_ENGINEERING source 2) it is lea rax, [rip + ...]; ret: it returns the address of the module's time-name record at 0x1114e0, which is 21 string pointers (0xa8 bytes, the layout of Dinkumware's _Tinfo). Read through the module's relocations, the C-locale record holds:

  • :AM:PM;
  • :Sun:Sunday:...:Sat:Saturday in the three day fields;
  • :Jan:January:...:Dec:December in the three month fields;
  • |%a %b %e %T %Y|%m/%d/%y|%H:%M:%S|%I:%M:%S %p in the ten format fields (date and time, date, time, 12-hour time and their era forms);
  • four empty strings for the era, the alternative digits, daylight saving and the zone.

_Getptimes now returns the same record, as a static GuestLocale::TimeInfo with the same pointer sharing.

Tested

Ubuntu 24.04 (WSL2) x86-64, GCC 13.3, Release, full build with BUILD_TESTING=ON, on main 2227f13661:

  • The title's libc.prx, converted by the relinker and loaded in a host process, against this library's unpatched libc.prx: both return the same address on a second call, the same 21 strings, and the same fields sharing one string. JJenkx checked the same record in the libc.prx of 11 more titles.
  • No test is added: the function returns constant data, which a test would only restate.
  • ctest -R '^(guest_locale|patched_libraries|conventions_unknown_nids)$': 3/3 pass.
  • tools/progress.py: +1 implemented. libc goes from 1419/1436 to 1420/1437.
  • python3 tools/check_conventions.py --base origin/main: passed. python3 tools/pr_overlap.py --branch feat/libc-getptimes: no conflicting lines and no same exports; the struct sits between two GuestLocale.hpp declarations no open PR changes (#11450 changes the lines after LocinfoStorage). Of the pull requests it could not compare, #7081 and #9526 change other parts of LocaleSupport.cpp, #10324 and #10749 other lines of Api.hpp, and git merge-tree of each with this branch conflicts only in the files where they already conflict with main.

Not tested: Windows, macOS, a title that calls _Getptimes, a console run.

Checklist

  • Based on current main; no other open PR implements the same functions
  • One topic per PR; follow-ups go in a new PR
  • No comments in code except technical debt
  • Unimplemented paths throw (NotImplemented_nid_no_patch); silent stubs are listed under Silent stubs in their library's technical debt file
  • No notes, investigation .md files or images added to the repository (attach them to this PR)
  • New third-party code is a submodule built from source
  • Generic behaviour, not specific to one title
  • Depends on: none
  • Fixes: none
  • Unblocks: none
  • GPUs tested: n/a
  • AI-assisted: yes
<!-- greyfinch-sync:boykopovar/AnyPS5:issue:5029571961 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/11735). Originally posted by [verusferro](https://github.com/verusferro) on 2026-10-27T06:22:06Z. --- ### What libc did not export Dinkumware's `_Getptimes`, which the console's `libc.prx` exports. In the SDK 7.00 `libc.prx` that PPSA06416 ships in `sce_module/` (0x3cdb0, read from its disassembly, [REVERSE_ENGINEERING](https://github.com/boykopovar/AnyPS5/blob/main/docs/dev/REVERSE_ENGINEERING.md) source 2) it is `lea rax, [rip + ...]; ret`: it returns the address of the module's time-name record at 0x1114e0, which is 21 string pointers (0xa8 bytes, the layout of Dinkumware's `_Tinfo`). Read through the module's relocations, the C-locale record holds: - `:AM:PM`; - `:Sun:Sunday:...:Sat:Saturday` in the three day fields; - `:Jan:January:...:Dec:December` in the three month fields; - `|%a %b %e %T %Y|%m/%d/%y|%H:%M:%S|%I:%M:%S %p` in the ten format fields (date and time, date, time, 12-hour time and their era forms); - four empty strings for the era, the alternative digits, daylight saving and the zone. `_Getptimes` now returns the same record, as a static `GuestLocale::TimeInfo` with the same pointer sharing. ### Tested <!-- OS, title or homebrew, what was checked. "Not tested" is a valid answer. A performance change: the summary lines of main and of this PR from the same machine and scene, with the traces attached, captured as the Performance report issue form describes. --> Ubuntu 24.04 (WSL2) x86-64, GCC 13.3, Release, full build with `BUILD_TESTING=ON`, on `main` `2227f13661`: - The title's `libc.prx`, converted by the relinker and loaded in a host process, against this library's unpatched `libc.prx`: both return the same address on a second call, the same 21 strings, and the same fields sharing one string. JJenkx [checked the same record](https://github.com/boykopovar/AnyPS5/pull/11735#issuecomment-6443921013) in the `libc.prx` of 11 more titles. - No test is added: the function returns constant data, which a test would only restate. - `ctest -R '^(guest_locale|patched_libraries|conventions_unknown_nids)$'`: 3/3 pass. - `tools/progress.py`: +1 implemented. libc goes from 1419/1436 to 1420/1437. - `python3 tools/check_conventions.py --base origin/main`: passed. `python3 tools/pr_overlap.py --branch feat/libc-getptimes`: no conflicting lines and no same exports; the struct sits between two `GuestLocale.hpp` declarations no open PR changes (#11450 changes the lines after `LocinfoStorage`). Of the pull requests it could not compare, #7081 and #9526 change other parts of `LocaleSupport.cpp`, #10324 and #10749 other lines of `Api.hpp`, and `git merge-tree` of each with this branch conflicts only in the files where they already conflict with `main`. Not tested: Windows, macOS, a title that calls `_Getptimes`, a console run. ### Checklist <!-- Rules behind each item: https://github.com/boykopovar/AnyPS5/blob/main/CONTRIBUTING.md --> - [x] Based on current `main`; no other open PR implements the same functions - [x] One topic per PR; follow-ups go in a new PR - [x] No comments in code except [technical debt](https://github.com/boykopovar/AnyPS5/blob/main/docs/dev/CONVENTIONS.md) - [x] Unimplemented paths throw (`NotImplemented_nid_no_patch`); silent stubs are listed under Silent stubs in their library's [technical debt](https://github.com/boykopovar/AnyPS5/tree/main/docs/dev/debt) file - [x] No notes, investigation `.md` files or images added to the repository (attach them to this PR) - [x] New third-party code is a submodule built from source - [x] Generic behaviour, not specific to one title - [x] Depends on: none - [x] Fixes: none - [x] Unblocks: none - [x] GPUs tested: n/a - [x] AI-assisted: yes
MarcZX10 commented 2026-10-27 06:30:14 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by MarcZX10 on 2026-10-27T06:30:14Z.

Review: APPROVED


Reviewed exact head 15a1512169eea3c3fcd9fff0b1f6822c3c086eed. The new TimeInfo is exactly 21 pointer fields (the 0xa8 static assertion checks the reported _Tinfo size), and the static record preserves the string sharing described in the disassembly. The export declaration, implementation, and locale type are all updated together; no repository overlap or behavioral blocker is evident from the diff.

The PR reports a full Ubuntu 24.04/WSL2 build and 3/3 focused locale/convention tests. Hosted conventions, intake, labels and Linux/Windows relinker checks pass; macOS relinker jobs remain queued, and the full Linux/Windows product jobs are skipped by repository policy. I did not independently rebuild the full target in this workspace.

<!-- greyfinch-sync:boykopovar/AnyPS5:review:5663084817 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/11735#pullrequestreview-5663084817). Originally posted by [MarcZX10](https://github.com/MarcZX10) on 2026-10-27T06:30:14Z. **Review:** APPROVED --- Reviewed exact head `15a1512169eea3c3fcd9fff0b1f6822c3c086eed`. The new `TimeInfo` is exactly 21 pointer fields (the `0xa8` static assertion checks the reported `_Tinfo` size), and the static record preserves the string sharing described in the disassembly. The export declaration, implementation, and locale type are all updated together; no repository overlap or behavioral blocker is evident from the diff. The PR reports a full Ubuntu 24.04/WSL2 build and 3/3 focused locale/convention tests. Hosted conventions, intake, labels and Linux/Windows relinker checks pass; macOS relinker jobs remain queued, and the full Linux/Windows product jobs are skipped by repository policy. I did not independently rebuild the full target in this workspace.
Sign in to join this conversation.
No reviewers
No labels
No milestone
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Reference
boykopovar/AnyPS5!11735
No description provided.