Skip to content

Commit faf5162

Browse files
committed
Fix PTMSYSM_CheckNew3DS, closes #540
1 parent a6a6548 commit faf5162

File tree

2 files changed

+6
-4
lines changed

2 files changed

+6
-4
lines changed

libctru/include/3ds/services/ptmsysm.h

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -109,9 +109,10 @@ Result PTMSYSM_GetRtcTime(s64 *outMsY2k);
109109
Result PTMSYSM_SetRtcTime(s64 msY2k);
110110

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

116117
/**
117118
* @brief Configures the New 3DS' CPU clock speed and L2 cache.

libctru/source/services/ptmsysm.c

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -98,13 +98,14 @@ Result PTMSYSM_Awaken(void)
9898
return (Result)cmdbuf[1];
9999
}
100100

101-
Result PTMSYSM_CheckNew3DS(void)
101+
Result PTMSYSM_CheckNew3DS(bool *out)
102102
{
103103
Result ret;
104104
u32 *cmdbuf = getThreadCommandBuffer();
105105
cmdbuf[0] = IPC_MakeHeader(0x040A,0,0); // 0x040A0000
106106

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

109110
return (Result)cmdbuf[1];
110111
}

0 commit comments

Comments
 (0)