Add ptm rtc time commands
This commit is contained in:
parent
e3be4b8678
commit
0053d8d076
@ -81,6 +81,21 @@ Result PTMSYSM_GetWakeReason(PtmSleepConfig *outSleepConfig);
|
||||
/// Cancels the "half-awake" state and fully wakes up the 3DS after some delay.
|
||||
Result PTMSYSM_Awaken(void);
|
||||
|
||||
/// Invalidates the "system time" (cfg block 0x30002)
|
||||
Result PTMSYSM_InvalidateSystemTime(void);
|
||||
|
||||
/**
|
||||
* @brief Reads the time and date coming from the RTC and converts the result.
|
||||
* @returns The number of milliseconds since 01/01/2000.
|
||||
*/
|
||||
Result PTMSYSM_GetRtcTime(s64 *outMsY2k);
|
||||
|
||||
/**
|
||||
* @brief Writes the time and date coming to the RTC, after conversion.
|
||||
* @param msY2k The number of milliseconds since 01/01/2000.
|
||||
*/
|
||||
Result PTMSYSM_SetRtcTime(s64 msY2k);
|
||||
|
||||
/**
|
||||
* @brief Returns 1 if it's a New 3DS, otherwise 0.
|
||||
*/
|
||||
|
@ -143,3 +143,36 @@ Result PTMSYSM_RebootAsync(u64 timeout)
|
||||
|
||||
return (Result)cmdbuf[1];
|
||||
}
|
||||
|
||||
Result PTMSYSM_InvalidateSystemTime(void)
|
||||
{
|
||||
Result ret;
|
||||
u32 *cmdbuf = getThreadCommandBuffer();
|
||||
cmdbuf[0] = IPC_MakeHeader(0x080D,0,0); // 0x080D0000
|
||||
|
||||
if(R_FAILED(ret = svcSendSyncRequest(ptmSysmHandle)))return ret;
|
||||
|
||||
return (Result)cmdbuf[1];
|
||||
}
|
||||
|
||||
Result PTMSYSM_GetRtcTime(s64 *outMsY2k)
|
||||
{
|
||||
Result ret;
|
||||
u32 *cmdbuf = getThreadCommandBuffer();
|
||||
cmdbuf[0] = IPC_MakeHeader(0x0816,0,0); // 0x08160000
|
||||
if(R_FAILED(ret = svcSendSyncRequest(ptmSysmHandle)))return ret;
|
||||
memcpy(outMsY2k, &cmdbuf[2], 8);
|
||||
|
||||
return (Result)cmdbuf[1];
|
||||
}
|
||||
|
||||
Result PTMSYSM_SetRtcTime(s64 msY2k)
|
||||
{
|
||||
Result ret;
|
||||
u32 *cmdbuf = getThreadCommandBuffer();
|
||||
cmdbuf[0] = IPC_MakeHeader(0x0817,2,0); // 0x08170080
|
||||
memcpy(&cmdbuf[1], &msY2k, 8);
|
||||
if(R_FAILED(ret = svcSendSyncRequest(ptmSysmHandle)))return ret;
|
||||
|
||||
return (Result)cmdbuf[1];
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user