summaryrefslogtreecommitdiff
path: root/src/core
diff options
context:
space:
mode:
authorGravatar Yuri Kunde Schlesner2015-09-01 14:40:50 -0300
committerGravatar Yuri Kunde Schlesner2015-09-14 17:39:49 -0300
commit1fe72dcc0494a4439fb73ca78f718d179904429a (patch)
tree3397dfdaaa1fc603af78c3ef164438a83d5aeb7d /src/core
parentService/CFG: Clean up default block creation (diff)
downloadyuzu-1fe72dcc0494a4439fb73ca78f718d179904429a.tar.gz
yuzu-1fe72dcc0494a4439fb73ca78f718d179904429a.tar.xz
yuzu-1fe72dcc0494a4439fb73ca78f718d179904429a.zip
Service/CFG: Move several private types from the header to the cpp
Diffstat (limited to 'src/core')
-rw-r--r--src/core/hle/service/cfg/cfg.cpp59
-rw-r--r--src/core/hle/service/cfg/cfg.h53
2 files changed, 49 insertions, 63 deletions
diff --git a/src/core/hle/service/cfg/cfg.cpp b/src/core/hle/service/cfg/cfg.cpp
index 0868b3698..de4af18bd 100644
--- a/src/core/hle/service/cfg/cfg.cpp
+++ b/src/core/hle/service/cfg/cfg.cpp
@@ -21,28 +21,67 @@
21namespace Service { 21namespace Service {
22namespace CFG { 22namespace CFG {
23 23
24const u64 CFG_SAVE_ID = 0x00010017; 24/// The maximum number of block entries that can exist in the config file
25const u64 CONSOLE_UNIQUE_ID = 0xDEADC0DE; 25static const u32 CONFIG_FILE_MAX_BLOCK_ENTRIES = 1479;
26const ConsoleModelInfo CONSOLE_MODEL = { NINTENDO_3DS_XL, { 0, 0, 0 } }; 26
27const u8 CONSOLE_LANGUAGE = LANGUAGE_EN; 27namespace {
28const char CONSOLE_USERNAME[0x14] = "CITRA"; 28
29/**
30 * The header of the config savedata file,
31 * contains information about the blocks in the file
32 */
33struct SaveFileConfig {
34 u16 total_entries; ///< The total number of set entries in the config file
35 u16 data_entries_offset; ///< The offset where the data for the blocks start, this is hardcoded to 0x455C as per hardware
36 SaveConfigBlockEntry block_entries[CONFIG_FILE_MAX_BLOCK_ENTRIES]; ///< The block headers, the maximum possible value is 1479 as per hardware
37 u32 unknown; ///< This field is unknown, possibly padding, 0 has been observed in hardware
38};
39static_assert(sizeof(SaveFileConfig) == 0x455C, "SaveFileConfig header must be exactly 0x455C bytes");
40
41struct UsernameBlock {
42 char16_t username[10]; ///< Exactly 20 bytes long, padded with zeros at the end if necessary
43 u32 zero;
44 u32 ng_word;
45};
46static_assert(sizeof(UsernameBlock) == 0x1C, "UsernameBlock must be exactly 0x1C bytes");
47
48struct ConsoleModelInfo {
49 u8 model; ///< The console model (3DS, 2DS, etc)
50 u8 unknown[3]; ///< Unknown data
51};
52static_assert(sizeof(ConsoleModelInfo) == 4, "ConsoleModelInfo must be exactly 4 bytes");
53
54struct ConsoleCountryInfo {
55 u8 unknown[3]; ///< Unknown data
56 u8 country_code; ///< The country code of the console
57};
58static_assert(sizeof(ConsoleCountryInfo) == 4, "ConsoleCountryInfo must be exactly 4 bytes");
59
60}
61
62static const u64 CFG_SAVE_ID = 0x00010017;
63static const u64 CONSOLE_UNIQUE_ID = 0xDEADC0DE;
64static const ConsoleModelInfo CONSOLE_MODEL = { NINTENDO_3DS_XL, { 0, 0, 0 } };
65static const u8 CONSOLE_LANGUAGE = LANGUAGE_EN;
66static const char CONSOLE_USERNAME[0x14] = "CITRA";
29/// This will be initialized in Init, and will be used when creating the block 67/// This will be initialized in Init, and will be used when creating the block
30UsernameBlock CONSOLE_USERNAME_BLOCK; 68static UsernameBlock CONSOLE_USERNAME_BLOCK;
31/// TODO(Subv): Find out what this actually is 69/// TODO(Subv): Find out what this actually is
32const u8 SOUND_OUTPUT_MODE = 2; 70static const u8 SOUND_OUTPUT_MODE = 2;
33const u8 UNITED_STATES_COUNTRY_ID = 49; 71static const u8 UNITED_STATES_COUNTRY_ID = 49;
34/// TODO(Subv): Find what the other bytes are 72/// TODO(Subv): Find what the other bytes are
35const ConsoleCountryInfo COUNTRY_INFO = { { 0, 0, 0 }, UNITED_STATES_COUNTRY_ID }; 73static const ConsoleCountryInfo COUNTRY_INFO = { { 0, 0, 0 }, UNITED_STATES_COUNTRY_ID };
36 74
37/** 75/**
38 * TODO(Subv): Find out what this actually is, these values fix some NaN uniforms in some games, 76 * TODO(Subv): Find out what this actually is, these values fix some NaN uniforms in some games,
39 * for example Nintendo Zone 77 * for example Nintendo Zone
40 * Thanks Normmatt for providing this information 78 * Thanks Normmatt for providing this information
41 */ 79 */
42const std::array<float, 8> STEREO_CAMERA_SETTINGS = { 80static const std::array<float, 8> STEREO_CAMERA_SETTINGS = {
43 62.0f, 289.0f, 76.80000305175781f, 46.08000183105469f, 81 62.0f, 289.0f, 76.80000305175781f, 46.08000183105469f,
44 10.0f, 5.0f, 55.58000183105469f, 21.56999969482422f 82 10.0f, 5.0f, 55.58000183105469f, 21.56999969482422f
45}; 83};
84static_assert(sizeof(STEREO_CAMERA_SETTINGS) == 0x20, "STEREO_CAMERA_SETTINGS must be exactly 0x20 bytes");
46 85
47static const u32 CONFIG_SAVEFILE_SIZE = 0x8000; 86static const u32 CONFIG_SAVEFILE_SIZE = 0x8000;
48static std::array<u8, CONFIG_SAVEFILE_SIZE> cfg_config_file_buffer; 87static std::array<u8, CONFIG_SAVEFILE_SIZE> cfg_config_file_buffer;
diff --git a/src/core/hle/service/cfg/cfg.h b/src/core/hle/service/cfg/cfg.h
index 2d25ebfbf..c4155da81 100644
--- a/src/core/hle/service/cfg/cfg.h
+++ b/src/core/hle/service/cfg/cfg.h
@@ -204,59 +204,6 @@ void UpdateConfigNANDSavegame(Service::Interface* self);
204 */ 204 */
205void FormatConfig(Service::Interface* self); 205void FormatConfig(Service::Interface* self);
206 206
207/// The maximum number of block entries that can exist in the config file
208static const u32 CONFIG_FILE_MAX_BLOCK_ENTRIES = 1479;
209
210/**
211* The header of the config savedata file,
212* contains information about the blocks in the file
213*/
214struct SaveFileConfig {
215 u16 total_entries; ///< The total number of set entries in the config file
216 u16 data_entries_offset; ///< The offset where the data for the blocks start, this is hardcoded to 0x455C as per hardware
217 SaveConfigBlockEntry block_entries[CONFIG_FILE_MAX_BLOCK_ENTRIES]; ///< The block headers, the maximum possible value is 1479 as per hardware
218 u32 unknown; ///< This field is unknown, possibly padding, 0 has been observed in hardware
219};
220static_assert(sizeof(SaveFileConfig) == 0x455C, "The SaveFileConfig header must be exactly 0x455C bytes");
221
222struct UsernameBlock {
223 char16_t username[10]; ///< Exactly 20 bytes long, padded with zeros at the end if necessary
224 u32 zero;
225 u32 ng_word;
226};
227static_assert(sizeof(UsernameBlock) == 0x1C, "Size of UsernameBlock must be 0x1C");
228
229struct ConsoleModelInfo {
230 u8 model; ///< The console model (3DS, 2DS, etc)
231 u8 unknown[3]; ///< Unknown data
232};
233static_assert(sizeof(ConsoleModelInfo) == 4, "ConsoleModelInfo must be exactly 4 bytes");
234
235struct ConsoleCountryInfo {
236 u8 unknown[3]; ///< Unknown data
237 u8 country_code; ///< The country code of the console
238};
239static_assert(sizeof(ConsoleCountryInfo) == 4, "ConsoleCountryInfo must be exactly 4 bytes");
240
241extern const u64 CFG_SAVE_ID;
242extern const u64 CONSOLE_UNIQUE_ID;
243extern const ConsoleModelInfo CONSOLE_MODEL;
244extern const u8 CONSOLE_LANGUAGE;
245extern const char CONSOLE_USERNAME[0x14];
246/// This will be initialized in the Interface constructor, and will be used when creating the block
247extern UsernameBlock CONSOLE_USERNAME_BLOCK;
248/// TODO(Subv): Find out what this actually is
249extern const u8 SOUND_OUTPUT_MODE;
250extern const u8 UNITED_STATES_COUNTRY_ID;
251/// TODO(Subv): Find what the other bytes are
252extern const ConsoleCountryInfo COUNTRY_INFO;
253extern const std::array<float, 8> STEREO_CAMERA_SETTINGS;
254
255static_assert(sizeof(STEREO_CAMERA_SETTINGS) == 0x20, "STEREO_CAMERA_SETTINGS must be exactly 0x20 bytes");
256static_assert(sizeof(CONSOLE_UNIQUE_ID) == 8, "CONSOLE_UNIQUE_ID must be exactly 8 bytes");
257static_assert(sizeof(CONSOLE_LANGUAGE) == 1, "CONSOLE_LANGUAGE must be exactly 1 byte");
258static_assert(sizeof(SOUND_OUTPUT_MODE) == 1, "SOUND_OUTPUT_MODE must be exactly 1 byte");
259
260/** 207/**
261 * Reads a block with the specified id and flag from the Config savegame buffer 208 * Reads a block with the specified id and flag from the Config savegame buffer
262 * and writes the output to output. 209 * and writes the output to output.