libctru v2.5.0
Loading...
Searching...
No Matches
cfgu.h
Go to the documentation of this file.
1/**
2 * @file cfgu.h
3 * @brief CFGU (Configuration) Service
4 */
5#pragma once
6#include <3ds/types.h>
7
8/// Configuration region values.
9typedef enum
10{
11 CFG_REGION_JPN = 0, ///< Japan
12 CFG_REGION_USA = 1, ///< USA
13 CFG_REGION_EUR = 2, ///< Europe
14 CFG_REGION_AUS = 3, ///< Australia
15 CFG_REGION_CHN = 4, ///< China
16 CFG_REGION_KOR = 5, ///< Korea
17 CFG_REGION_TWN = 6, ///< Taiwan
19
20/// Configuration language values.
21typedef enum
22{
23 CFG_LANGUAGE_DEFAULT = -1, ///< Use system language in errorInit
24 CFG_LANGUAGE_JP, ///< Japanese
25 CFG_LANGUAGE_EN, ///< English
26 CFG_LANGUAGE_FR, ///< French
27 CFG_LANGUAGE_DE, ///< German
28 CFG_LANGUAGE_IT, ///< Italian
29 CFG_LANGUAGE_ES, ///< Spanish
30 CFG_LANGUAGE_ZH, ///< Simplified Chinese
31 CFG_LANGUAGE_KO, ///< Korean
32 CFG_LANGUAGE_NL, ///< Dutch
33 CFG_LANGUAGE_PT, ///< Portugese
34 CFG_LANGUAGE_RU, ///< Russian
35 CFG_LANGUAGE_TW, ///< Traditional Chinese
37
38// Configuration system model values.
39typedef enum
40{
41 CFG_MODEL_3DS = 0, ///< Old 3DS (CTR)
42 CFG_MODEL_3DSXL = 1, ///< Old 3DS XL (SPR)
43 CFG_MODEL_N3DS = 2, ///< New 3DS (KTR)
44 CFG_MODEL_2DS = 3, ///< Old 2DS (FTR)
45 CFG_MODEL_N3DSXL = 4, ///< New 3DS XL (RED)
46 CFG_MODEL_N2DSXL = 5, ///< New 2DS XL (JAN)
48
49/// Initializes CFGU.
51
52/// Exits CFGU.
53void cfguExit(void);
54
55/**
56 * @brief Gets the system's region from secure info.
57 * @param region Pointer to output the region to. (see @ref CFG_Region)
58 */
60
61/**
62 * @brief Generates a console-unique hash.
63 * @param appIDSalt Salt to use.
64 * @param hash Pointer to output the hash to.
65 */
67
68/**
69 * @brief Gets whether the system's region is Canada or USA.
70 * @param value Pointer to output the result to. (0 = no, 1 = yes)
71 */
73
74/**
75 * @brief Gets the system's model.
76 * @param model Pointer to output the model to. (see @ref CFG_SystemModel)
77 */
79
80/**
81 * @brief Gets whether the system is a 2DS.
82 * @param value Pointer to output the result to. (0 = yes, 1 = no)
83 */
85
86/**
87 * @brief Gets a string representing a country code.
88 * @param code Country code to use.
89 * @param string Pointer to output the string to.
90 */
92
93/**
94 * @brief Gets a country code ID from its string.
95 * @param string String to use.
96 * @param code Pointer to output the country code to.
97 */
99
100/**
101 * @brief Checks if NFC (code name: fangate) is supported.
102 * @param isSupported pointer to the output the result to.
103 */
104Result CFGU_IsNFCSupported(bool* isSupported);
105
106/**
107 * @brief Gets a config info block with flags = 2.
108 * @param size Size of the data to retrieve.
109 * @param blkID ID of the block to retrieve.
110 * @param outData Pointer to write the block data to.
111 */
112Result CFGU_GetConfigInfoBlk2(u32 size, u32 blkID, void* outData);
113
114/**
115 * @brief Gets a config info block with flags = 4.
116 * @param size Size of the data to retrieve.
117 * @param blkID ID of the block to retrieve.
118 * @param outData Pointer to write the block data to.
119 */
120Result CFG_GetConfigInfoBlk4(u32 size, u32 blkID, void* outData);
121
122/**
123 * @brief Gets a config info block with flags = 8.
124 * @param size Size of the data to retrieve.
125 * @param blkID ID of the block to retrieve.
126 * @param outData Pointer to write the block data to.
127 */
128Result CFG_GetConfigInfoBlk8(u32 size, u32 blkID, void* outData);
129
130/**
131 * @brief Sets a config info block with flags = 4.
132 * @param size Size of the data to retrieve.
133 * @param blkID ID of the block to retrieve.
134 * @param inData Pointer to block data to write.
135 */
136Result CFG_SetConfigInfoBlk4(u32 size, u32 blkID, const void* inData);
137
138/**
139 * @brief Sets a config info block with flags = 8.
140 * @param size Size of the data to retrieve.
141 * @param blkID ID of the block to retrieve.
142 * @param inData Pointer to block data to write.
143 */
144Result CFG_SetConfigInfoBlk8(u32 size, u32 blkID, const void* inData);
145
146
147/**
148 * @brief Writes the CFG buffer in memory to the savegame in NAND.
149 */
151
152/**
153 * @brief Gets the system's language.
154 * @param language Pointer to write the language to. (see @ref CFG_Language)
155 */
157
158/**
159 * @brief Deletes the NAND LocalFriendCodeSeed file, then recreates it using the LocalFriendCodeSeed data stored in memory.
160 */
162
163/**
164 * @brief Deletes the NAND SecureInfo file, then recreates it using the SecureInfo data stored in memory.
165 */
167
168/**
169 * @brief Deletes the "config" file stored in the NAND Config_Savegame.
170 */
172
173/**
174 * @brief Formats Config_Savegame.
175 */
177
178/**
179 * @brief Clears parental controls
180 */
182
183/**
184 * @brief Verifies the RSA signature for the LocalFriendCodeSeed data already stored in memory.
185 */
187
188/**
189 * @brief Verifies the RSA signature for the SecureInfo data already stored in memory.
190 */
192
193/**
194 * @brief Gets the system's serial number.
195 * @param serial Pointer to output the serial to. (This is normally 0xF)
196 */
198
199/**
200 * @brief Gets the 0x110-byte buffer containing the data for the LocalFriendCodeSeed.
201 * @param data Pointer to output the buffer. (The size must be at least 0x110-bytes)
202 */
204
205/**
206 * @brief Gets the 64-bit local friend code seed.
207 * @param seed Pointer to write the friend code seed to.
208 */
210
211/**
212 * @brief Gets the 0x11-byte data following the SecureInfo signature.
213 * @param data Pointer to output the buffer. (The size must be at least 0x11-bytes)
214 */
216
217/**
218 * @brief Gets the 0x100-byte RSA-2048 SecureInfo signature.
219 * @param data Pointer to output the buffer. (The size must be at least 0x100-bytes)
220 */
Result CFGI_VerifySigSecureInfo(void)
Verifies the RSA signature for the SecureInfo data already stored in memory.
Result CFGU_GetSystemLanguage(u8 *language)
Gets the system's language.
Result CFGI_VerifySigLocalFriendCodeSeed(void)
Verifies the RSA signature for the LocalFriendCodeSeed data already stored in memory.
Result CFGI_FormatConfig(void)
Formats Config_Savegame.
Result CFGU_GetCountryCodeString(u16 code, u16 *string)
Gets a string representing a country code.
Result CFGI_DeleteConfigSavefile(void)
Deletes the "config" file stored in the NAND Config_Savegame.
Result CFGI_GetSecureInfoData(u8 *data)
Gets the 0x11-byte data following the SecureInfo signature.
Result CFG_SetConfigInfoBlk8(u32 size, u32 blkID, const void *inData)
Sets a config info block with flags = 8.
Result CFGU_GetModelNintendo2DS(u8 *value)
Gets whether the system is a 2DS.
Result CFGU_GetCountryCodeID(u16 string, u16 *code)
Gets a country code ID from its string.
Result CFGU_GenHashConsoleUnique(u32 appIDSalt, u64 *hash)
Generates a console-unique hash.
Result CFGI_SecureInfoGetSerialNumber(u8 *serial)
Gets the system's serial number.
Result CFGU_GetConfigInfoBlk2(u32 size, u32 blkID, void *outData)
Gets a config info block with flags = 2.
Result CFG_GetConfigInfoBlk8(u32 size, u32 blkID, void *outData)
Gets a config info block with flags = 8.
Result CFGU_GetSystemModel(u8 *model)
Gets the system's model.
Result CFG_UpdateConfigSavegame(void)
Writes the CFG buffer in memory to the savegame in NAND.
CFG_SystemModel
Definition cfgu.h:40
@ CFG_MODEL_N3DS
New 3DS (KTR)
Definition cfgu.h:43
@ CFG_MODEL_3DSXL
Old 3DS XL (SPR)
Definition cfgu.h:42
@ CFG_MODEL_N3DSXL
New 3DS XL (RED)
Definition cfgu.h:45
@ CFG_MODEL_2DS
Old 2DS (FTR)
Definition cfgu.h:44
@ CFG_MODEL_3DS
Old 3DS (CTR)
Definition cfgu.h:41
@ CFG_MODEL_N2DSXL
New 2DS XL (JAN)
Definition cfgu.h:46
Result CFGU_IsNFCSupported(bool *isSupported)
Checks if NFC (code name: fangate) is supported.
Result CFGI_RestoreLocalFriendCodeSeed(void)
Deletes the NAND LocalFriendCodeSeed file, then recreates it using the LocalFriendCodeSeed data store...
Result CFGU_GetRegionCanadaUSA(u8 *value)
Gets whether the system's region is Canada or USA.
Result CFGI_GetLocalFriendCodeSeed(u64 *seed)
Gets the 64-bit local friend code seed.
Result cfguInit(void)
Initializes CFGU.
Result CFGI_GetLocalFriendCodeSeedData(u8 *data)
Gets the 0x110-byte buffer containing the data for the LocalFriendCodeSeed.
CFG_Language
Configuration language values.
Definition cfgu.h:22
@ CFG_LANGUAGE_NL
Dutch.
Definition cfgu.h:32
@ CFG_LANGUAGE_TW
Traditional Chinese.
Definition cfgu.h:35
@ CFG_LANGUAGE_DE
German.
Definition cfgu.h:27
@ CFG_LANGUAGE_KO
Korean.
Definition cfgu.h:31
@ CFG_LANGUAGE_IT
Italian.
Definition cfgu.h:28
@ CFG_LANGUAGE_EN
English.
Definition cfgu.h:25
@ CFG_LANGUAGE_ZH
Simplified Chinese.
Definition cfgu.h:30
@ CFG_LANGUAGE_FR
French.
Definition cfgu.h:26
@ CFG_LANGUAGE_ES
Spanish.
Definition cfgu.h:29
@ CFG_LANGUAGE_RU
Russian.
Definition cfgu.h:34
@ CFG_LANGUAGE_PT
Portugese.
Definition cfgu.h:33
@ CFG_LANGUAGE_JP
Japanese.
Definition cfgu.h:24
@ CFG_LANGUAGE_DEFAULT
Use system language in errorInit.
Definition cfgu.h:23
CFG_Region
Configuration region values.
Definition cfgu.h:10
@ CFG_REGION_AUS
Australia.
Definition cfgu.h:14
@ CFG_REGION_EUR
Europe.
Definition cfgu.h:13
@ CFG_REGION_USA
USA.
Definition cfgu.h:12
@ CFG_REGION_TWN
Taiwan.
Definition cfgu.h:17
@ CFG_REGION_JPN
Japan.
Definition cfgu.h:11
@ CFG_REGION_KOR
Korea.
Definition cfgu.h:16
@ CFG_REGION_CHN
China.
Definition cfgu.h:15
Result CFGI_ClearParentalControls(void)
Clears parental controls.
Result CFGU_SecureInfoGetRegion(u8 *region)
Gets the system's region from secure info.
Result CFG_SetConfigInfoBlk4(u32 size, u32 blkID, const void *inData)
Sets a config info block with flags = 4.
Result CFGI_RestoreSecureInfo(void)
Deletes the NAND SecureInfo file, then recreates it using the SecureInfo data stored in memory.
Result CFGI_GetSecureInfoSignature(u8 *data)
Gets the 0x100-byte RSA-2048 SecureInfo signature.
void cfguExit(void)
Exits CFGU.
Result CFG_GetConfigInfoBlk4(u32 size, u32 blkID, void *outData)
Gets a config info block with flags = 4.
Various system types.
uint64_t u64
64-bit unsigned integer
Definition types.h:24
uint8_t u8
would be nice if newlib had this already
Definition types.h:21
s32 Result
Function result.
Definition types.h:42
uint16_t u16
16-bit unsigned integer
Definition types.h:22
uint32_t u32
32-bit unsigned integer
Definition types.h:23