mirror of
https://github.com/joel16/3DSident.git
synced 2024-11-23 11:39:43 +00:00
529e11a058
W.I.P changes include friend code, and device cert. Device cert doesn't print anything as of now. The NNID is displayed properly. This time it shows both your username and ID. Fixed a problem that caused crashes when de-initializing actu.
63 lines
1.2 KiB
C
63 lines
1.2 KiB
C
#include "frd.h"
|
|
|
|
Result frdInit(u32 sdkVer)
|
|
{
|
|
Result ret;
|
|
|
|
ret = srvGetServiceHandle(&frdHandle, "frd:u");
|
|
if(R_FAILED(ret)) ret = srvGetServiceHandle(&frdHandle, "frd:n");
|
|
if(R_FAILED(ret)) ret = srvGetServiceHandle(&frdHandle, "frd:a");
|
|
|
|
frdSetClientSdkVersion(sdkVer);
|
|
|
|
return ret;
|
|
}
|
|
|
|
Result frdExit()
|
|
{
|
|
return svcCloseHandle(frdHandle);
|
|
}
|
|
|
|
Result frdSetClientSdkVersion(u32 sdkVer)
|
|
{
|
|
Result ret=0;
|
|
u32 *cmdbuf = getThreadCommandBuffer();
|
|
|
|
cmdbuf[0] = IPC_MakeHeader(0x32,1,2); // 0x00320042
|
|
cmdbuf[1] = sdkVer;
|
|
cmdbuf[2] = 0x20;
|
|
|
|
if(R_FAILED(ret = svcSendSyncRequest(frdHandle)))return ret;
|
|
|
|
return (Result)cmdbuf[1];
|
|
}
|
|
|
|
u64 frdPrincipalIdToFriendCode(u64 *fc, u64 pid)
|
|
{
|
|
Result ret=0;
|
|
u32 *cmdbuf = getThreadCommandBuffer();
|
|
|
|
cmdbuf[0] = IPC_MakeHeader(0x24,1,0); // 0x00240040
|
|
cmdbuf[1] = pid;
|
|
|
|
if(R_FAILED(ret = svcSendSyncRequest(frdHandle)))return ret;
|
|
|
|
*fc = (u64)cmdbuf[2];
|
|
|
|
return (Result)cmdbuf[1];
|
|
}
|
|
|
|
|
|
Result frdGetMyFriendKey(FriendKey *key)
|
|
{
|
|
Result ret=0;
|
|
u32 *cmdbuf = getThreadCommandBuffer();
|
|
|
|
cmdbuf[0] = IPC_MakeHeader(5,0,0); // 0x00050000
|
|
|
|
if(R_FAILED(ret = svcSendSyncRequest(frdHandle)))return ret;
|
|
|
|
memcpy(key, &cmdbuf[2], 0x10);
|
|
|
|
return (Result)cmdbuf[1];
|
|
} |