From 691c5092aafe3f1fc6514fc6d0ed63ca19aa2b22 Mon Sep 17 00:00:00 2001 From: Joel16 Date: Fri, 27 Oct 2017 20:23:54 -0500 Subject: [PATCH] Add CFGI_GetLocalFriendCodeSeedData --- libctru/include/3ds/services/cfgu.h | 6 ++++++ libctru/source/services/cfgu.c | 15 +++++++++++++++ 2 files changed, 21 insertions(+) diff --git a/libctru/include/3ds/services/cfgu.h b/libctru/include/3ds/services/cfgu.h index cc73667..d8db9dd 100644 --- a/libctru/include/3ds/services/cfgu.h +++ b/libctru/include/3ds/services/cfgu.h @@ -183,6 +183,12 @@ Result CFGI_VerifySigSecureInfo(void); */ 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. diff --git a/libctru/source/services/cfgu.c b/libctru/source/services/cfgu.c index 9dcd0a4..cc960bc 100644 --- a/libctru/source/services/cfgu.c +++ b/libctru/source/services/cfgu.c @@ -345,6 +345,21 @@ Result CFGI_SecureInfoGetSerialNumber(u8 *serial) 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;