feat(rtc): implement sceRtcGetDosTime and sceRtcSetDosTime #803
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/803"
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 adriadam10 on 2026-10-06T05:23:10Z.
What
Adds
sceRtcGetDosTimeandsceRtcSetDosTimeto libSceRtc. Neither was declared onmain.rtc.cpp), the only reference with a body. It is the standard FAT date/time: seconds/2, minutes, hours, day, month, and years since 1980, in bits 0-4, 5-10, 11-15, 16-20, 21-24 and 25-31.GetDosTime: a null output, or a date that failssceRtcCheckValid, returns the same errors as the otherGet*converters. One difference from shadPS4: it ORs the fields into*dosTimewithout clearing it first, so the result depends on the old value. Here the output is assigned.SetDosTime: a null pointer returnsINVALID_POINTER. As in shadPS4, the fields are not validated,microsecondis set to 0 and seconds are doubled.GetDosTimefor years outside 1980-2107. shadPS4 masks them, so they wrap around.SetDosTimewith a year field above 63. shadPS4 reads the date half asint16_t, so 2044 and later become years before 1980.Tested
Linux, guest test (
guest_rtc). The expected values were computed by a separate Python model of the FAT layout, not taken from this code. Cases covered:Negative checks: 12 mutations, 11 caught. The one left (masking the year field with
0x3f) changes nothing once fields above 63 throw. Onmainthe test fails to link, because the functions don't exist. Full Release build (GCC) passes, as doesctest -R guest_.Checklist
main; no other open PR implements the same functionsNotImplemented_nid_no_patch); silent stubs are listed in TechnicalDebt.mdfiles or images added to the repository (attach them to this PR)Imported from boykopovar/AnyPS5. Originally posted by github-actions[bot] on 2026-10-06T05:23:30Z.
Progress report (
def8119→0781225)📉 System libraries: 85.99% (-0.02%, +1 implemented, +1 declared functions)
✅ 1 implemented
sceRtcSetDosTime🆕 1 declared as stubs
sceRtcGetDosTimeImported from boykopovar/AnyPS5. Originally posted by oneandonlydean on 2026-10-06T09:27:47Z.
The encoding checks out. I recomputed
0x585d645cand0xff9fbf7dby hand, and the null and validation order matches the otherGet*converters.There's one fix:
And one optional point:
SetDosTimethrows for year fields 64-127. FAT defines the year as an unsigned 7-bit field (1980-2107), andGetDosTimehere produces those values for 2044-2107. So a title that round-trips a date after 2043 would hit the throw. shadPS4'sint16_tcould just be a decompiler type. I'd decode the field as unsigned unless there's a reason to think the library sign-extends it. Throwing is within the rules, though, so this is your call.Imported from boykopovar/AnyPS5. Originally posted by adriadam10 on 2026-10-06T09:52:04Z.
Rebased on main and fixed:
SetDosTimedecodes the year as the unsigned 7-bit FAT field (1980-2107), so every valueGetDosTimeproduces round-trips. The test pins0xff9fbf7d→ 2107-12-31 and0x80210000→ 2044-01-01, and the TechnicalDebt line notes that shadPS4 sign-extends.Imported from boykopovar/AnyPS5. Originally posted by oneandonlydean on 2026-10-06T21:24:13Z.
Thanks, this is ready to merge, but it now conflicts with main in
docs/dev/TechnicalDebt.mdafter the last batch landed. Could you rebase onto main? I'll merge once CI is green.Imported from boykopovar/AnyPS5. Originally posted by adriadam10 on 2026-10-07T15:55:49Z.
Rebased onto main (
f71bf7fd4). The only conflict was indocs/dev/TechnicalDebt.md. The line stays under "Unknown function info", now in the middle of the section rather than at its end. Build and full ctest pass, includingguest_rtc.