diff options
| author | 2015-09-01 14:40:50 -0300 | |
|---|---|---|
| committer | 2015-09-14 17:39:49 -0300 | |
| commit | 1fe72dcc0494a4439fb73ca78f718d179904429a (patch) | |
| tree | 3397dfdaaa1fc603af78c3ef164438a83d5aeb7d /src/core | |
| parent | Service/CFG: Clean up default block creation (diff) | |
| download | yuzu-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.cpp | 59 | ||||
| -rw-r--r-- | src/core/hle/service/cfg/cfg.h | 53 |
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 @@ | |||
| 21 | namespace Service { | 21 | namespace Service { |
| 22 | namespace CFG { | 22 | namespace CFG { |
| 23 | 23 | ||
| 24 | const u64 CFG_SAVE_ID = 0x00010017; | 24 | /// The maximum number of block entries that can exist in the config file |
| 25 | const u64 CONSOLE_UNIQUE_ID = 0xDEADC0DE; | 25 | static const u32 CONFIG_FILE_MAX_BLOCK_ENTRIES = 1479; |
| 26 | const ConsoleModelInfo CONSOLE_MODEL = { NINTENDO_3DS_XL, { 0, 0, 0 } }; | 26 | |
| 27 | const u8 CONSOLE_LANGUAGE = LANGUAGE_EN; | 27 | namespace { |
| 28 | const 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 | */ | ||
| 33 | struct 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 | }; | ||
| 39 | static_assert(sizeof(SaveFileConfig) == 0x455C, "SaveFileConfig header must be exactly 0x455C bytes"); | ||
| 40 | |||
| 41 | struct 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 | }; | ||
| 46 | static_assert(sizeof(UsernameBlock) == 0x1C, "UsernameBlock must be exactly 0x1C bytes"); | ||
| 47 | |||
| 48 | struct ConsoleModelInfo { | ||
| 49 | u8 model; ///< The console model (3DS, 2DS, etc) | ||
| 50 | u8 unknown[3]; ///< Unknown data | ||
| 51 | }; | ||
| 52 | static_assert(sizeof(ConsoleModelInfo) == 4, "ConsoleModelInfo must be exactly 4 bytes"); | ||
| 53 | |||
| 54 | struct ConsoleCountryInfo { | ||
| 55 | u8 unknown[3]; ///< Unknown data | ||
| 56 | u8 country_code; ///< The country code of the console | ||
| 57 | }; | ||
| 58 | static_assert(sizeof(ConsoleCountryInfo) == 4, "ConsoleCountryInfo must be exactly 4 bytes"); | ||
| 59 | |||
| 60 | } | ||
| 61 | |||
| 62 | static const u64 CFG_SAVE_ID = 0x00010017; | ||
| 63 | static const u64 CONSOLE_UNIQUE_ID = 0xDEADC0DE; | ||
| 64 | static const ConsoleModelInfo CONSOLE_MODEL = { NINTENDO_3DS_XL, { 0, 0, 0 } }; | ||
| 65 | static const u8 CONSOLE_LANGUAGE = LANGUAGE_EN; | ||
| 66 | static 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 |
| 30 | UsernameBlock CONSOLE_USERNAME_BLOCK; | 68 | static UsernameBlock CONSOLE_USERNAME_BLOCK; |
| 31 | /// TODO(Subv): Find out what this actually is | 69 | /// TODO(Subv): Find out what this actually is |
| 32 | const u8 SOUND_OUTPUT_MODE = 2; | 70 | static const u8 SOUND_OUTPUT_MODE = 2; |
| 33 | const u8 UNITED_STATES_COUNTRY_ID = 49; | 71 | static 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 |
| 35 | const ConsoleCountryInfo COUNTRY_INFO = { { 0, 0, 0 }, UNITED_STATES_COUNTRY_ID }; | 73 | static 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 | */ |
| 42 | const std::array<float, 8> STEREO_CAMERA_SETTINGS = { | 80 | static 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 | }; |
| 84 | static_assert(sizeof(STEREO_CAMERA_SETTINGS) == 0x20, "STEREO_CAMERA_SETTINGS must be exactly 0x20 bytes"); | ||
| 46 | 85 | ||
| 47 | static const u32 CONFIG_SAVEFILE_SIZE = 0x8000; | 86 | static const u32 CONFIG_SAVEFILE_SIZE = 0x8000; |
| 48 | static std::array<u8, CONFIG_SAVEFILE_SIZE> cfg_config_file_buffer; | 87 | static 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 | */ |
| 205 | void FormatConfig(Service::Interface* self); | 205 | void FormatConfig(Service::Interface* self); |
| 206 | 206 | ||
| 207 | /// The maximum number of block entries that can exist in the config file | ||
| 208 | static 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 | */ | ||
| 214 | struct 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 | }; | ||
| 220 | static_assert(sizeof(SaveFileConfig) == 0x455C, "The SaveFileConfig header must be exactly 0x455C bytes"); | ||
| 221 | |||
| 222 | struct 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 | }; | ||
| 227 | static_assert(sizeof(UsernameBlock) == 0x1C, "Size of UsernameBlock must be 0x1C"); | ||
| 228 | |||
| 229 | struct ConsoleModelInfo { | ||
| 230 | u8 model; ///< The console model (3DS, 2DS, etc) | ||
| 231 | u8 unknown[3]; ///< Unknown data | ||
| 232 | }; | ||
| 233 | static_assert(sizeof(ConsoleModelInfo) == 4, "ConsoleModelInfo must be exactly 4 bytes"); | ||
| 234 | |||
| 235 | struct ConsoleCountryInfo { | ||
| 236 | u8 unknown[3]; ///< Unknown data | ||
| 237 | u8 country_code; ///< The country code of the console | ||
| 238 | }; | ||
| 239 | static_assert(sizeof(ConsoleCountryInfo) == 4, "ConsoleCountryInfo must be exactly 4 bytes"); | ||
| 240 | |||
| 241 | extern const u64 CFG_SAVE_ID; | ||
| 242 | extern const u64 CONSOLE_UNIQUE_ID; | ||
| 243 | extern const ConsoleModelInfo CONSOLE_MODEL; | ||
| 244 | extern const u8 CONSOLE_LANGUAGE; | ||
| 245 | extern const char CONSOLE_USERNAME[0x14]; | ||
| 246 | /// This will be initialized in the Interface constructor, and will be used when creating the block | ||
| 247 | extern UsernameBlock CONSOLE_USERNAME_BLOCK; | ||
| 248 | /// TODO(Subv): Find out what this actually is | ||
| 249 | extern const u8 SOUND_OUTPUT_MODE; | ||
| 250 | extern const u8 UNITED_STATES_COUNTRY_ID; | ||
| 251 | /// TODO(Subv): Find what the other bytes are | ||
| 252 | extern const ConsoleCountryInfo COUNTRY_INFO; | ||
| 253 | extern const std::array<float, 8> STEREO_CAMERA_SETTINGS; | ||
| 254 | |||
| 255 | static_assert(sizeof(STEREO_CAMERA_SETTINGS) == 0x20, "STEREO_CAMERA_SETTINGS must be exactly 0x20 bytes"); | ||
| 256 | static_assert(sizeof(CONSOLE_UNIQUE_ID) == 8, "CONSOLE_UNIQUE_ID must be exactly 8 bytes"); | ||
| 257 | static_assert(sizeof(CONSOLE_LANGUAGE) == 1, "CONSOLE_LANGUAGE must be exactly 1 byte"); | ||
| 258 | static_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. |