Add more CFGI functions (#376)

This commit is contained in:
Joel 2017-09-23 11:07:50 -05:00 committed by fincs
parent 04bde1de19
commit 25123ba057
2 changed files with 122 additions and 3 deletions

View File

@ -60,7 +60,7 @@ Result CFGU_GetRegionCanadaUSA(u8* value);
/**
* @brief Gets the system's model.
* @param model Pointer to output the model to. (0 = O3DS, 1 = O3DSXL, 2 = N3DS, 3 = 2DS, 4 = N3DSXL)
* @param model Pointer to output the model to. (0 = O3DS, 1 = O3DSXL, 2 = N3DS, 3 = 2DS, 4 = N3DSXL, 5 = N2DSXL)
*/
Result CFGU_GetSystemModel(u8* model);
@ -128,10 +128,45 @@ Result CFG_SetConfigInfoBlk8(u32 size, u32 blkID, u8* inData);
/**
* @brief Writes the CFG buffer in memory to the savegame in NAND.
*/
Result CFG_UpdateConfigNANDSavegame(void);
Result CFG_UpdateConfigSavegame(void);
/**
* @brief Gets the system's language.
* @param language Pointer to write the language to. (see @ref CFG_Language)
*/
Result CFGU_GetSystemLanguage(u8* language);
/**
* @brief Deletes the NAND LocalFriendCodeSeed file, then recreates it using the LocalFriendCodeSeed data stored in memory.
*/
Result CFGI_RestoreLocalFriendCodeSeed(void);
/**
* @brief Deletes the NAND SecureInfo file, then recreates it using the SecureInfo data stored in memory.
*/
Result CFGI_RestoreSecureInfo(void);
/**
* @brief Deletes the "config" file stored in the NAND Config_Savegame.
*/
Result CFGI_DeleteConfigSavefile(void);
/**
* @brief Formats Config_Savegame.
*/
Result CFGI_FormatConfig(void);
/**
* @brief Clears parental controls
*/
Result CFGI_ClearParentalControls(void);
/**
* @brief Verifies the RSA signature for the LocalFriendCodeSeed data already stored in memory.
*/
Result CFGI_VerifySigLocalFriendCodeSeed(void);
/**
* @brief Verifies the RSA signature for the SecureInfo data already stored in memory.
*/
Result CFGI_VerifySigSecureInfo(void);

View File

@ -215,7 +215,7 @@ Result CFG_SetConfigInfoBlk8(u32 size, u32 blkID, u8* inData)
return (Result)cmdbuf[1];
}
Result CFG_UpdateConfigNANDSavegame(void)
Result CFG_UpdateConfigSavegame(void)
{
Result ret = 0;
u32 *cmdbuf = getThreadCommandBuffer();
@ -231,3 +231,87 @@ Result CFGU_GetSystemLanguage(u8* language)
{
return CFGU_GetConfigInfoBlk2(1, 0xA0002, language);
}
Result CFGI_RestoreLocalFriendCodeSeed(void)
{
Result ret = 0;
u32 *cmdbuf = getThreadCommandBuffer();
cmdbuf[0] = IPC_MakeHeader(0x80D, 0, 0); // 0x80D0000
if(R_FAILED(ret = svcSendSyncRequest(cfguHandle)))return ret;
return (Result)cmdbuf[1];
}
Result CFGI_RestoreSecureInfo(void)
{
Result ret = 0;
u32 *cmdbuf = getThreadCommandBuffer();
cmdbuf[0] = IPC_MakeHeader(0x812,0,0); // 0x8120000
if(R_FAILED(ret = svcSendSyncRequest(cfguHandle)))return ret;
return (Result)cmdbuf[1];
}
Result CFGI_DeleteConfigSavefile(void)
{
Result ret = 0;
u32 *cmdbuf = getThreadCommandBuffer();
cmdbuf[0] = IPC_MakeHeader(0x805,0,0); // 0x8050000
if(R_FAILED(ret = svcSendSyncRequest(cfguHandle)))return ret;
return (Result)cmdbuf[1];
}
Result CFGI_FormatConfig(void)
{
Result ret = 0;
u32 *cmdbuf = getThreadCommandBuffer();
cmdbuf[0] = IPC_MakeHeader(0x806,0,0); // 0x8060000
if(R_FAILED(ret = svcSendSyncRequest(cfguHandle)))return ret;
return (Result)cmdbuf[1];
}
Result CFGI_ClearParentalControls(void)
{
Result ret = 0;
u32 *cmdbuf = getThreadCommandBuffer();
cmdbuf[0] = IPC_MakeHeader(0x40F,0,0); // 0x40F0000
if(R_FAILED(ret = svcSendSyncRequest(cfguHandle)))return ret;
return (Result)cmdbuf[1];
}
Result CFGI_VerifySigLocalFriendCodeSeed(void)
{
Result ret = 0;
u32 *cmdbuf = getThreadCommandBuffer();
cmdbuf[0] = IPC_MakeHeader(0x80E,0,0); // 0x80E0000
if(R_FAILED(ret = svcSendSyncRequest(cfguHandle)))return ret;
return (Result)cmdbuf[1];
}
Result CFGI_VerifySigSecureInfo(void)
{
Result ret = 0;
u32 *cmdbuf = getThreadCommandBuffer();
cmdbuf[0] = IPC_MakeHeader(0x813,0,0); // 0x8130000
if(R_FAILED(ret = svcSendSyncRequest(cfguHandle)))return ret;
return (Result)cmdbuf[1];
}