summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorGravatar Yuri Kunde Schlesner2015-09-01 12:34:59 -0300
committerGravatar Yuri Kunde Schlesner2015-09-14 17:39:48 -0300
commitac4f7b0fde64512bc50dc5c66cf9bb59962abba9 (patch)
treecb405dd2f08433b5fde0c8a3c1cf64692c1d2e61 /src
parentMerge pull request #1123 from yuriks/gsp-flush (diff)
downloadyuzu-ac4f7b0fde64512bc50dc5c66cf9bb59962abba9.tar.gz
yuzu-ac4f7b0fde64512bc50dc5c66cf9bb59962abba9.tar.xz
yuzu-ac4f7b0fde64512bc50dc5c66cf9bb59962abba9.zip
Service/CFG: Clean up default block creation
Diffstat (limited to 'src')
-rw-r--r--src/core/hle/service/cfg/cfg.cpp42
-rw-r--r--src/core/hle/service/cfg/cfg.h2
2 files changed, 17 insertions, 27 deletions
diff --git a/src/core/hle/service/cfg/cfg.cpp b/src/core/hle/service/cfg/cfg.cpp
index 62ad90fdc..0868b3698 100644
--- a/src/core/hle/service/cfg/cfg.cpp
+++ b/src/core/hle/service/cfg/cfg.cpp
@@ -212,7 +212,7 @@ ResultCode GetConfigInfoBlock(u32 block_id, u32 size, u32 flag, u8* output) {
212 return RESULT_SUCCESS; 212 return RESULT_SUCCESS;
213} 213}
214 214
215ResultCode CreateConfigInfoBlk(u32 block_id, u16 size, u16 flags, const u8* data) { 215ResultCode CreateConfigInfoBlk(u32 block_id, u16 size, u16 flags, const void* data) {
216 SaveFileConfig* config = reinterpret_cast<SaveFileConfig*>(cfg_config_file_buffer.data()); 216 SaveFileConfig* config = reinterpret_cast<SaveFileConfig*>(cfg_config_file_buffer.data());
217 if (config->total_entries >= CONFIG_FILE_MAX_BLOCK_ENTRIES) 217 if (config->total_entries >= CONFIG_FILE_MAX_BLOCK_ENTRIES)
218 return ResultCode(-1); // TODO(Subv): Find the right error code 218 return ResultCode(-1); // TODO(Subv): Find the right error code
@@ -277,33 +277,23 @@ ResultCode FormatConfig() {
277 SaveFileConfig* config = reinterpret_cast<SaveFileConfig*>(cfg_config_file_buffer.data()); 277 SaveFileConfig* config = reinterpret_cast<SaveFileConfig*>(cfg_config_file_buffer.data());
278 // This value is hardcoded, taken from 3dbrew, verified by hardware, it's always the same value 278 // This value is hardcoded, taken from 3dbrew, verified by hardware, it's always the same value
279 config->data_entries_offset = 0x455C; 279 config->data_entries_offset = 0x455C;
280
280 // Insert the default blocks 281 // Insert the default blocks
281 res = CreateConfigInfoBlk(0x00050005, sizeof(STEREO_CAMERA_SETTINGS), 0xE, 282 res = CreateConfigInfoBlk(0x00050005, sizeof(STEREO_CAMERA_SETTINGS), 0xE, STEREO_CAMERA_SETTINGS.data());
282 reinterpret_cast<const u8*>(STEREO_CAMERA_SETTINGS.data())); 283 if (!res.IsSuccess()) return res;
283 if (!res.IsSuccess())
284 return res;
285 res = CreateConfigInfoBlk(0x00090001, sizeof(CONSOLE_UNIQUE_ID), 0xE,
286 reinterpret_cast<const u8*>(&CONSOLE_UNIQUE_ID));
287 if (!res.IsSuccess())
288 return res;
289 res = CreateConfigInfoBlk(0x000F0004, sizeof(CONSOLE_MODEL), 0x8,
290 reinterpret_cast<const u8*>(&CONSOLE_MODEL));
291 if (!res.IsSuccess())
292 return res;
293 res = CreateConfigInfoBlk(0x000A0002, sizeof(CONSOLE_LANGUAGE), 0xA, &CONSOLE_LANGUAGE);
294 if (!res.IsSuccess())
295 return res;
296 res = CreateConfigInfoBlk(0x00070001, sizeof(SOUND_OUTPUT_MODE), 0xE, &SOUND_OUTPUT_MODE); 284 res = CreateConfigInfoBlk(0x00070001, sizeof(SOUND_OUTPUT_MODE), 0xE, &SOUND_OUTPUT_MODE);
297 if (!res.IsSuccess()) 285 if (!res.IsSuccess()) return res;
298 return res; 286 res = CreateConfigInfoBlk(0x00090001, sizeof(CONSOLE_UNIQUE_ID), 0xE, &CONSOLE_UNIQUE_ID);
299 res = CreateConfigInfoBlk(0x000B0000, sizeof(COUNTRY_INFO), 0xE, 287 if (!res.IsSuccess()) return res;
300 reinterpret_cast<const u8*>(&COUNTRY_INFO)); 288 res = CreateConfigInfoBlk(0x000A0000, sizeof(CONSOLE_USERNAME_BLOCK), 0xE, &CONSOLE_USERNAME_BLOCK);
301 if (!res.IsSuccess()) 289 if (!res.IsSuccess()) return res;
302 return res; 290 res = CreateConfigInfoBlk(0x000A0002, sizeof(CONSOLE_LANGUAGE), 0xA, &CONSOLE_LANGUAGE);
303 res = CreateConfigInfoBlk(0x000A0000, sizeof(CONSOLE_USERNAME_BLOCK), 0xE, 291 if (!res.IsSuccess()) return res;
304 reinterpret_cast<const u8*>(&CONSOLE_USERNAME_BLOCK)); 292 res = CreateConfigInfoBlk(0x000B0000, sizeof(COUNTRY_INFO), 0xE, &COUNTRY_INFO);
305 if (!res.IsSuccess()) 293 if (!res.IsSuccess()) return res;
306 return res; 294 res = CreateConfigInfoBlk(0x000F0004, sizeof(CONSOLE_MODEL), 0x8, &CONSOLE_MODEL);
295 if (!res.IsSuccess()) return res;
296
307 // Save the buffer to the file 297 // Save the buffer to the file
308 res = UpdateConfigNANDSavegame(); 298 res = UpdateConfigNANDSavegame();
309 if (!res.IsSuccess()) 299 if (!res.IsSuccess())
diff --git a/src/core/hle/service/cfg/cfg.h b/src/core/hle/service/cfg/cfg.h
index ff76dc9dc..2d25ebfbf 100644
--- a/src/core/hle/service/cfg/cfg.h
+++ b/src/core/hle/service/cfg/cfg.h
@@ -278,7 +278,7 @@ ResultCode GetConfigInfoBlock(u32 block_id, u32 size, u32 flag, u8* output);
278 * @param data A pointer containing the data we will write to the new block 278 * @param data A pointer containing the data we will write to the new block
279 * @returns ResultCode indicating the result of the operation, 0 on success 279 * @returns ResultCode indicating the result of the operation, 0 on success
280 */ 280 */
281ResultCode CreateConfigInfoBlk(u32 block_id, u16 size, u16 flags, const u8* data); 281ResultCode CreateConfigInfoBlk(u32 block_id, u16 size, u16 flags, const void* data);
282 282
283/** 283/**
284 * Deletes the config savegame file from the filesystem, the buffer in memory is not affected 284 * Deletes the config savegame file from the filesystem, the buffer in memory is not affected