mirror of
https://github.com/joel16/3DSident.git
synced 2024-11-23 03:29:45 +00:00
Get NAND local friend code seed
This commit is contained in:
parent
3091371464
commit
4bded33d60
@ -1,6 +1,8 @@
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
|
||||
#include "fs.h"
|
||||
#include "system.h"
|
||||
#include "utils.h"
|
||||
|
||||
@ -203,6 +205,57 @@ u64 System_GetLocalFriendCodeSeed(void)
|
||||
return 0;
|
||||
}
|
||||
|
||||
char *System_GetNANDLocalFriendCodeSeed(void)
|
||||
{
|
||||
FS_Archive nandArchive;
|
||||
Handle handle;
|
||||
u32 bytesread = 0;
|
||||
char *buf = (char *)malloc(6);
|
||||
static char out[0xB];
|
||||
|
||||
FS_OpenArchive(&nandArchive, ARCHIVE_NAND_CTR_FS);
|
||||
|
||||
if (FS_FileExists(nandArchive, "/rw/sys/LocalFriendCodeSeed_B"))
|
||||
{
|
||||
if (R_FAILED(FSUSER_OpenFile(&handle, nandArchive, fsMakePath(PATH_ASCII, "/rw/sys/LocalFriendCodeSeed_B"), FS_OPEN_READ, 0)))
|
||||
{
|
||||
FS_CloseArchive(nandArchive);
|
||||
return NULL;
|
||||
}
|
||||
}
|
||||
else if (FS_FileExists(nandArchive, "/rw/sys/LocalFriendCodeSeed_A"))
|
||||
{
|
||||
if (R_FAILED(FSUSER_OpenFile(&handle, nandArchive, fsMakePath(PATH_ASCII, "/rw/sys/LocalFriendCodeSeed_A"), FS_OPEN_READ, 0)))
|
||||
{
|
||||
FS_CloseArchive(nandArchive);
|
||||
return NULL;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
FS_CloseArchive(nandArchive);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
if (R_FAILED(FSFILE_Read(handle, &bytesread, 0x108, (u32 *)buf, 6)))
|
||||
{
|
||||
FS_CloseArchive(nandArchive);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
if (R_FAILED(FSFILE_Close(handle)))
|
||||
{
|
||||
FS_CloseArchive(nandArchive);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
buf[6] = '\0';
|
||||
FS_CloseArchive(nandArchive);
|
||||
snprintf(out, 0xB, "%02X%02X%02X%02X%02X", buf[0x4], buf[0x3], buf[0x2], buf[0x1], buf[0x0]);
|
||||
|
||||
return out;
|
||||
}
|
||||
|
||||
u8 *System_GetSerialNumber(void)
|
||||
{
|
||||
static u8 serial[0xF];
|
||||
|
@ -53,6 +53,7 @@ const char *System_GetRunningHW(void);
|
||||
char *System_IsDebugUnit(void);
|
||||
char *System_GetScreenType(void);
|
||||
u64 System_GetLocalFriendCodeSeed(void);
|
||||
char *System_GetNANDLocalFriendCodeSeed(void);
|
||||
u8 *System_GetSerialNumber(void);
|
||||
u64 System_GetSoapId(void);
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user