summaryrefslogtreecommitdiff
path: root/src/core
diff options
context:
space:
mode:
authorGravatar Subv2014-12-21 17:41:35 -0500
committerGravatar Subv2014-12-21 17:41:35 -0500
commit6f304d3b00b4c877dd04b7b953302c147020f2e8 (patch)
tree7dc1f56f8237fc61ad105080c4ea229f79f5d839 /src/core
parentCFG: Changed the CreateConfigInfoBlk search loop (diff)
downloadyuzu-6f304d3b00b4c877dd04b7b953302c147020f2e8.tar.gz
yuzu-6f304d3b00b4c877dd04b7b953302c147020f2e8.tar.xz
yuzu-6f304d3b00b4c877dd04b7b953302c147020f2e8.zip
CFG: Some indentation
Diffstat (limited to 'src/core')
-rw-r--r--src/core/hle/service/cfg/cfg.cpp24
1 files changed, 13 insertions, 11 deletions
diff --git a/src/core/hle/service/cfg/cfg.cpp b/src/core/hle/service/cfg/cfg.cpp
index 2697f8036..2d17496e4 100644
--- a/src/core/hle/service/cfg/cfg.cpp
+++ b/src/core/hle/service/cfg/cfg.cpp
@@ -43,8 +43,9 @@ ResultCode GetConfigInfoBlock(u32 block_id, u32 size, u32 flag, u8* output) {
43 SaveFileConfig* config = reinterpret_cast<SaveFileConfig*>(cfg_config_file_buffer.data()); 43 SaveFileConfig* config = reinterpret_cast<SaveFileConfig*>(cfg_config_file_buffer.data());
44 44
45 auto itr = std::find_if(std::begin(config->block_entries), std::end(config->block_entries), 45 auto itr = std::find_if(std::begin(config->block_entries), std::end(config->block_entries),
46 [&](const SaveConfigBlockEntry& entry) { 46 [&](const SaveConfigBlockEntry& entry) {
47 return entry.block_id == block_id && entry.size == size && (entry.flags & flag); 47 return entry.block_id == block_id && entry.size == size &&
48 (entry.flags & flag);
48 }); 49 });
49 50
50 if (itr == std::end(config->block_entries)) { 51 if (itr == std::end(config->block_entries)) {
@@ -76,7 +77,7 @@ ResultCode CreateConfigInfoBlk(u32 block_id, u32 size, u32 flags, const u8* data
76 // Ignore the blocks that don't have a separate data offset 77 // Ignore the blocks that don't have a separate data offset
77 if (config->block_entries[i].size > 4) { 78 if (config->block_entries[i].size > 4) {
78 offset = config->block_entries[i].offset_or_data + 79 offset = config->block_entries[i].offset_or_data +
79 config->block_entries[i].size; 80 config->block_entries[i].size;
80 break; 81 break;
81 } 82 }
82 } 83 }
@@ -125,15 +126,15 @@ ResultCode FormatConfig() {
125 config->data_entries_offset = 0x455C; 126 config->data_entries_offset = 0x455C;
126 // Insert the default blocks 127 // Insert the default blocks
127 res = CreateConfigInfoBlk(0x00050005, sizeof(STEREO_CAMERA_SETTINGS), 0xE, 128 res = CreateConfigInfoBlk(0x00050005, sizeof(STEREO_CAMERA_SETTINGS), 0xE,
128 reinterpret_cast<const u8*>(STEREO_CAMERA_SETTINGS.data())); 129 reinterpret_cast<const u8*>(STEREO_CAMERA_SETTINGS.data()));
129 if (!res.IsSuccess()) 130 if (!res.IsSuccess())
130 return res; 131 return res;
131 res = CreateConfigInfoBlk(0x00090001, sizeof(CONSOLE_UNIQUE_ID), 0xE, 132 res = CreateConfigInfoBlk(0x00090001, sizeof(CONSOLE_UNIQUE_ID), 0xE,
132 reinterpret_cast<const u8*>(&CONSOLE_UNIQUE_ID)); 133 reinterpret_cast<const u8*>(&CONSOLE_UNIQUE_ID));
133 if (!res.IsSuccess()) 134 if (!res.IsSuccess())
134 return res; 135 return res;
135 res = CreateConfigInfoBlk(0x000F0004, sizeof(CONSOLE_MODEL), 0x8, 136 res = CreateConfigInfoBlk(0x000F0004, sizeof(CONSOLE_MODEL), 0x8,
136 reinterpret_cast<const u8*>(&CONSOLE_MODEL)); 137 reinterpret_cast<const u8*>(&CONSOLE_MODEL));
137 if (!res.IsSuccess()) 138 if (!res.IsSuccess())
138 return res; 139 return res;
139 res = CreateConfigInfoBlk(0x000A0002, sizeof(CONSOLE_LANGUAGE), 0xA, &CONSOLE_LANGUAGE); 140 res = CreateConfigInfoBlk(0x000A0002, sizeof(CONSOLE_LANGUAGE), 0xA, &CONSOLE_LANGUAGE);
@@ -143,11 +144,11 @@ ResultCode FormatConfig() {
143 if (!res.IsSuccess()) 144 if (!res.IsSuccess())
144 return res; 145 return res;
145 res = CreateConfigInfoBlk(0x000B0000, sizeof(COUNTRY_INFO), 0xE, 146 res = CreateConfigInfoBlk(0x000B0000, sizeof(COUNTRY_INFO), 0xE,
146 reinterpret_cast<const u8*>(&COUNTRY_INFO)); 147 reinterpret_cast<const u8*>(&COUNTRY_INFO));
147 if (!res.IsSuccess()) 148 if (!res.IsSuccess())
148 return res; 149 return res;
149 res = CreateConfigInfoBlk(0x000A0000, sizeof(CONSOLE_USERNAME_BLOCK), 0xE, 150 res = CreateConfigInfoBlk(0x000A0000, sizeof(CONSOLE_USERNAME_BLOCK), 0xE,
150 reinterpret_cast<const u8*>(&CONSOLE_USERNAME_BLOCK)); 151 reinterpret_cast<const u8*>(&CONSOLE_USERNAME_BLOCK));
151 if (!res.IsSuccess()) 152 if (!res.IsSuccess())
152 return res; 153 return res;
153 // Save the buffer to the file 154 // Save the buffer to the file
@@ -160,9 +161,10 @@ ResultCode FormatConfig() {
160void CFGInit() { 161void CFGInit() {
161 // TODO(Subv): In the future we should use the FS service to query this archive, 162 // TODO(Subv): In the future we should use the FS service to query this archive,
162 // currently it is not possible because you can only have one open archive of the same type at any time 163 // currently it is not possible because you can only have one open archive of the same type at any time
164 using Common::make_unique;
163 std::string syssavedata_directory = FileUtil::GetUserPath(D_SYSSAVEDATA_IDX); 165 std::string syssavedata_directory = FileUtil::GetUserPath(D_SYSSAVEDATA_IDX);
164 cfg_system_save_data = Common::make_unique<FileSys::Archive_SystemSaveData>(syssavedata_directory, 166 cfg_system_save_data = make_unique<FileSys::Archive_SystemSaveData>(
165 CFG_SAVE_ID); 167 syssavedata_directory, CFG_SAVE_ID);
166 if (!cfg_system_save_data->Initialize()) { 168 if (!cfg_system_save_data->Initialize()) {
167 LOG_CRITICAL(Service_CFG, "Could not initialize SystemSaveData archive for the CFG:U service"); 169 LOG_CRITICAL(Service_CFG, "Could not initialize SystemSaveData archive for the CFG:U service");
168 return; 170 return;
@@ -189,7 +191,7 @@ void CFGInit() {
189 // Copy string to buffer and pad with zeros at the end 191 // Copy string to buffer and pad with zeros at the end
190 auto size = Common::UTF8ToUTF16(CONSOLE_USERNAME).copy(CONSOLE_USERNAME_BLOCK.username, 0x14); 192 auto size = Common::UTF8ToUTF16(CONSOLE_USERNAME).copy(CONSOLE_USERNAME_BLOCK.username, 0x14);
191 std::fill(std::begin(CONSOLE_USERNAME_BLOCK.username) + size, 193 std::fill(std::begin(CONSOLE_USERNAME_BLOCK.username) + size,
192 std::end(CONSOLE_USERNAME_BLOCK.username), 0); 194 std::end(CONSOLE_USERNAME_BLOCK.username), 0);
193 FormatConfig(); 195 FormatConfig();
194} 196}
195 197