Add a few more CFGI functions (#380)
* CFGI_SecureInfoGetSerialNumber * CFGU_IsNFCSupported (IsFangateSupported) * CFGI_GetLocalFriendCodeSeed * CFGI_GetLocalFriendCodeSeedData
This commit is contained in:
parent
53c42003f3
commit
632f9866e6
@ -84,6 +84,12 @@ Result CFGU_GetCountryCodeString(u16 code, u16* string);
|
|||||||
*/
|
*/
|
||||||
Result CFGU_GetCountryCodeID(u16 string, u16* code);
|
Result CFGU_GetCountryCodeID(u16 string, u16* code);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Checks if NFC (code name: fangate) is supported.
|
||||||
|
* @param isSupported pointer to the output the result to.
|
||||||
|
*/
|
||||||
|
Result CFGU_IsNFCSupported(bool* isSupported);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief Gets a config info block with flags = 2.
|
* @brief Gets a config info block with flags = 2.
|
||||||
* @param size Size of the data to retrieve.
|
* @param size Size of the data to retrieve.
|
||||||
@ -170,3 +176,21 @@ Result CFGI_VerifySigLocalFriendCodeSeed(void);
|
|||||||
* @brief Verifies the RSA signature for the SecureInfo data already stored in memory.
|
* @brief Verifies the RSA signature for the SecureInfo data already stored in memory.
|
||||||
*/
|
*/
|
||||||
Result CFGI_VerifySigSecureInfo(void);
|
Result CFGI_VerifySigSecureInfo(void);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Gets the system's serial number.
|
||||||
|
* @param serial Pointer to output the serial to. (This is normally 0xF)
|
||||||
|
*/
|
||||||
|
Result CFGI_SecureInfoGetSerialNumber(u8 *serial);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Gets the 0x110-byte buffer containing the data for the LocalFriendCodeSeed.
|
||||||
|
* @param data Pointer to output the buffer. (The size must be at least 0x110-bytes)
|
||||||
|
*/
|
||||||
|
Result CFGI_GetLocalFriendCodeSeedData(u8 *data);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Gets the 64-bit local friend code seed.
|
||||||
|
* @param seed Pointer to write the friend code seed to.
|
||||||
|
*/
|
||||||
|
Result CFGI_GetLocalFriendCodeSeed(u64* seed);
|
||||||
|
@ -133,6 +133,20 @@ Result CFGU_GetCountryCodeID(u16 string, u16* code)
|
|||||||
return (Result)cmdbuf[1];
|
return (Result)cmdbuf[1];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Result CFGU_IsNFCSupported(bool* isSupported)
|
||||||
|
{
|
||||||
|
Result ret = 0;
|
||||||
|
u32 *cmdbuf = getThreadCommandBuffer();
|
||||||
|
|
||||||
|
cmdbuf[0] = IPC_MakeHeader(0xB,0,0); // 0x000B0000
|
||||||
|
|
||||||
|
if(R_FAILED(ret = svcSendSyncRequest(cfguHandle)))return ret;
|
||||||
|
|
||||||
|
*isSupported = cmdbuf[2] & 0xFF;
|
||||||
|
|
||||||
|
return (Result)cmdbuf[1];
|
||||||
|
}
|
||||||
|
|
||||||
// See here for block IDs:
|
// See here for block IDs:
|
||||||
// http://3dbrew.org/wiki/Config_Savegame#Configuration_blocks
|
// http://3dbrew.org/wiki/Config_Savegame#Configuration_blocks
|
||||||
Result CFGU_GetConfigInfoBlk2(u32 size, u32 blkID, u8* outData)
|
Result CFGU_GetConfigInfoBlk2(u32 size, u32 blkID, u8* outData)
|
||||||
@ -315,3 +329,47 @@ Result CFGI_VerifySigSecureInfo(void)
|
|||||||
|
|
||||||
return (Result)cmdbuf[1];
|
return (Result)cmdbuf[1];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Result CFGI_SecureInfoGetSerialNumber(u8 *serial)
|
||||||
|
{
|
||||||
|
Result ret = 0;
|
||||||
|
u32 *cmdbuf = getThreadCommandBuffer();
|
||||||
|
|
||||||
|
cmdbuf[0] = IPC_MakeHeader(0x408,1,2); // 0x4080042
|
||||||
|
cmdbuf[1] = 0xF;
|
||||||
|
cmdbuf[2] = IPC_Desc_Buffer(0xF, IPC_BUFFER_W);
|
||||||
|
cmdbuf[3] = (u32)serial;
|
||||||
|
|
||||||
|
if(R_FAILED(ret = svcSendSyncRequest(cfguHandle)))return ret;
|
||||||
|
|
||||||
|
return (Result)cmdbuf[1];
|
||||||
|
}
|
||||||
|
|
||||||
|
Result CFGI_GetLocalFriendCodeSeedData(u8 *data)
|
||||||
|
{
|
||||||
|
Result ret = 0;
|
||||||
|
u32 *cmdbuf = getThreadCommandBuffer();
|
||||||
|
|
||||||
|
cmdbuf[0] = IPC_MakeHeader(0x404,1,2); // 0x4040042
|
||||||
|
cmdbuf[1] = (u32)0x110;
|
||||||
|
cmdbuf[2] = IPC_Desc_Buffer((u32)0x110, IPC_BUFFER_W);
|
||||||
|
cmdbuf[3] = (u32)data;
|
||||||
|
|
||||||
|
if(R_FAILED(ret = svcSendSyncRequest(cfguHandle)))return ret;
|
||||||
|
|
||||||
|
return (Result)cmdbuf[1];
|
||||||
|
}
|
||||||
|
|
||||||
|
Result CFGI_GetLocalFriendCodeSeed(u64* seed)
|
||||||
|
{
|
||||||
|
Result ret = 0;
|
||||||
|
u32 *cmdbuf = getThreadCommandBuffer();
|
||||||
|
|
||||||
|
cmdbuf[0] = IPC_MakeHeader(0x405,0,0); // 0x4050000
|
||||||
|
|
||||||
|
if(R_FAILED(ret = svcSendSyncRequest(cfguHandle)))return ret;
|
||||||
|
|
||||||
|
*seed = (u64)cmdbuf[2] | (u64)cmdbuf[3] << 32;
|
||||||
|
|
||||||
|
return (Result)cmdbuf[1];
|
||||||
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user