summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/core/hle/service/cfg_u.cpp24
1 files changed, 13 insertions, 11 deletions
diff --git a/src/core/hle/service/cfg_u.cpp b/src/core/hle/service/cfg_u.cpp
index ca70e48b6..9701e6aed 100644
--- a/src/core/hle/service/cfg_u.cpp
+++ b/src/core/hle/service/cfg_u.cpp
@@ -57,7 +57,7 @@ static const u8 SOUND_OUTPUT_MODE = 2;
57static const u32 CONFIG_SAVEFILE_SIZE = 0x8000; 57static const u32 CONFIG_SAVEFILE_SIZE = 0x8000;
58static std::array<u8, CONFIG_SAVEFILE_SIZE> cfg_config_file_buffer = { }; 58static std::array<u8, CONFIG_SAVEFILE_SIZE> cfg_config_file_buffer = { };
59 59
60/// TODO(Subv): Find out what this actually is 60/// TODO(Subv): Find out what this actually is, these values fix some NaN uniforms in some games
61/// Thanks Normmatt for providing this information 61/// Thanks Normmatt for providing this information
62static const std::array<float, 8> STEREO_CAMERA_SETTINGS = { 62static const std::array<float, 8> STEREO_CAMERA_SETTINGS = {
63 62.0f, 289.0f, 76.80000305175781f, 46.08000183105469f, 63 62.0f, 289.0f, 76.80000305175781f, 46.08000183105469f,
@@ -67,8 +67,9 @@ static const std::array<float, 8> STEREO_CAMERA_SETTINGS = {
67// TODO(Link Mauve): use a constexpr once MSVC starts supporting it. 67// TODO(Link Mauve): use a constexpr once MSVC starts supporting it.
68#define C(code) ((code)[0] | ((code)[1] << 8)) 68#define C(code) ((code)[0] | ((code)[1] << 8))
69 69
70static const u8 UNITED_STATES_COUNTRY_ID = 49;
70/// TODO(Subv): Find what the other bytes are 71/// TODO(Subv): Find what the other bytes are
71static const std::array<u8, 4> COUNTRY_INFO = { 0, 0, 0, C("US") }; 72static const std::array<u8, 4> COUNTRY_INFO = { 0, 0, 0, UNITED_STATES_COUNTRY_ID };
72 73
73static const std::array<u16, 187> country_codes = { 74static const std::array<u16, 187> country_codes = {
74 0, C("JP"), 0, 0, 0, 0, 0, 0, // 0-7 75 0, C("JP"), 0, 0, 0, 0, 0, 0, // 0-7
@@ -224,16 +225,16 @@ ResultCode CreateConfigInfoBlk(u32 block_id, u32 size, u32 flags, u8 const* data
224 s32 total_entries = config->total_entries - 1; 225 s32 total_entries = config->total_entries - 1;
225 u32 offset = config->data_entries_offset; 226 u32 offset = config->data_entries_offset;
226 // Perform a search to locate the next offset for the new data 227 // Perform a search to locate the next offset for the new data
228 // use the offset and size of the previous block to determine the new position
227 while (total_entries >= 0) { 229 while (total_entries >= 0) {
228 // Ignore the blocks that don't have a separate data offset 230 // Ignore the blocks that don't have a separate data offset
229 if (config->block_entries[total_entries].size <= 4) { 231 if (config->block_entries[total_entries].size > 4) {
230 --total_entries; 232 offset = config->block_entries[total_entries].offset_or_data +
231 continue; 233 config->block_entries[total_entries].size;
234 break;
232 } 235 }
233 236
234 offset = config->block_entries[total_entries].offset_or_data + 237 --total_entries;
235 config->block_entries[total_entries].size;
236 break;
237 } 238 }
238 239
239 config->block_entries[config->total_entries].offset_or_data = offset; 240 config->block_entries[config->total_entries].offset_or_data = offset;
@@ -424,11 +425,12 @@ Interface::Interface() {
424 } 425 }
425 426
426 // Initialize the Username block 427 // Initialize the Username block
427 // TODO(Subv): Do this somewhere else, or in another way 428 // TODO(Subv): Initialize this directly in the variable when MSVC supports char16_t string literals
428 CONSOLE_USERNAME_BLOCK.ng_word = 0; 429 CONSOLE_USERNAME_BLOCK.ng_word = 0;
429 CONSOLE_USERNAME_BLOCK.zero = 0; 430 CONSOLE_USERNAME_BLOCK.zero = 0;
430 std::fill(std::begin(CONSOLE_USERNAME_BLOCK.username) + 431 // Copy string to buffer and pad with zeros at the end
431 Common::UTF8ToUTF16(CONSOLE_USERNAME).copy(CONSOLE_USERNAME_BLOCK.username, 0x14), 432 auto itr = Common::UTF8ToUTF16(CONSOLE_USERNAME).copy(CONSOLE_USERNAME_BLOCK.username, 0x14);
433 std::fill(std::begin(CONSOLE_USERNAME_BLOCK.username) + itr,
432 std::end(CONSOLE_USERNAME_BLOCK.username), 0); 434 std::end(CONSOLE_USERNAME_BLOCK.username), 0);
433 FormatConfig(); 435 FormatConfig();
434} 436}