Skip to content

Commit

Permalink
Fix PTMSYSM_CheckNew3DS, closes #540
Browse files Browse the repository at this point in the history
  • Loading branch information
TuxSH committed Mar 13, 2024
1 parent a6a6548 commit faf5162
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 4 deletions.
5 changes: 3 additions & 2 deletions libctru/include/3ds/services/ptmsysm.h
Expand Up @@ -109,9 +109,10 @@ Result PTMSYSM_GetRtcTime(s64 *outMsY2k);
Result PTMSYSM_SetRtcTime(s64 msY2k);

/**
* @brief Returns 1 if it's a New 3DS, otherwise 0.
* @brief Checks whether the system is a New 3DS.
* @param[out] out Pointer to write the New 3DS flag to.
*/
Result PTMSYSM_CheckNew3DS(void);
Result PTMSYSM_CheckNew3DS(bool *out);

/**
* @brief Configures the New 3DS' CPU clock speed and L2 cache.
Expand Down
5 changes: 3 additions & 2 deletions libctru/source/services/ptmsysm.c
Expand Up @@ -98,13 +98,14 @@ Result PTMSYSM_Awaken(void)
return (Result)cmdbuf[1];
}

Result PTMSYSM_CheckNew3DS(void)
Result PTMSYSM_CheckNew3DS(bool *out)
{
Result ret;
u32 *cmdbuf = getThreadCommandBuffer();
cmdbuf[0] = IPC_MakeHeader(0x040A,0,0); // 0x040A0000

if(R_FAILED(ret = svcSendSyncRequest(ptmSysmHandle)))return 0;
if(R_FAILED(ret = svcSendSyncRequest(ptmSysmHandle)))return ret;
*out = (bool)cmdbuf[2]; // if cmdbuf[1] is != 0 then this is uninitialized (this is fine)

return (Result)cmdbuf[1];
}
Expand Down

0 comments on commit faf5162

Please sign in to comment.