summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorYuri Kunde Schlesner <yuriks@yuriks.net>2015-09-01 17:34:59 +0200
committerYuri Kunde Schlesner <yuriks@yuriks.net>2015-09-14 22:39:48 +0200
commitac4f7b0fde64512bc50dc5c66cf9bb59962abba9 (patch)
treecb405dd2f08433b5fde0c8a3c1cf64692c1d2e61 /src
parentMerge pull request #1123 from yuriks/gsp-flush (diff)
downloadyuzu-ac4f7b0fde64512bc50dc5c66cf9bb59962abba9.tar
yuzu-ac4f7b0fde64512bc50dc5c66cf9bb59962abba9.tar.gz
yuzu-ac4f7b0fde64512bc50dc5c66cf9bb59962abba9.tar.bz2
yuzu-ac4f7b0fde64512bc50dc5c66cf9bb59962abba9.tar.lz
yuzu-ac4f7b0fde64512bc50dc5c66cf9bb59962abba9.tar.xz
yuzu-ac4f7b0fde64512bc50dc5c66cf9bb59962abba9.tar.zst
yuzu-ac4f7b0fde64512bc50dc5c66cf9bb59962abba9.zip
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) {
return RESULT_SUCCESS;
}
-ResultCode CreateConfigInfoBlk(u32 block_id, u16 size, u16 flags, const u8* data) {
+ResultCode CreateConfigInfoBlk(u32 block_id, u16 size, u16 flags, const void* data) {
SaveFileConfig* config = reinterpret_cast<SaveFileConfig*>(cfg_config_file_buffer.data());
if (config->total_entries >= CONFIG_FILE_MAX_BLOCK_ENTRIES)
return ResultCode(-1); // TODO(Subv): Find the right error code
@@ -277,33 +277,23 @@ ResultCode FormatConfig() {
SaveFileConfig* config = reinterpret_cast<SaveFileConfig*>(cfg_config_file_buffer.data());
// This value is hardcoded, taken from 3dbrew, verified by hardware, it's always the same value
config->data_entries_offset = 0x455C;
+
// Insert the default blocks
- res = CreateConfigInfoBlk(0x00050005, sizeof(STEREO_CAMERA_SETTINGS), 0xE,
- reinterpret_cast<const u8*>(STEREO_CAMERA_SETTINGS.data()));
- if (!res.IsSuccess())
- return res;
- res = CreateConfigInfoBlk(0x00090001, sizeof(CONSOLE_UNIQUE_ID), 0xE,
- reinterpret_cast<const u8*>(&CONSOLE_UNIQUE_ID));
- if (!res.IsSuccess())
- return res;
- res = CreateConfigInfoBlk(0x000F0004, sizeof(CONSOLE_MODEL), 0x8,
- reinterpret_cast<const u8*>(&CONSOLE_MODEL));
- if (!res.IsSuccess())
- return res;
- res = CreateConfigInfoBlk(0x000A0002, sizeof(CONSOLE_LANGUAGE), 0xA, &CONSOLE_LANGUAGE);
- if (!res.IsSuccess())
- return res;
+ res = CreateConfigInfoBlk(0x00050005, sizeof(STEREO_CAMERA_SETTINGS), 0xE, STEREO_CAMERA_SETTINGS.data());
+ if (!res.IsSuccess()) return res;
res = CreateConfigInfoBlk(0x00070001, sizeof(SOUND_OUTPUT_MODE), 0xE, &SOUND_OUTPUT_MODE);
- if (!res.IsSuccess())
- return res;
- res = CreateConfigInfoBlk(0x000B0000, sizeof(COUNTRY_INFO), 0xE,
- reinterpret_cast<const u8*>(&COUNTRY_INFO));
- if (!res.IsSuccess())
- return res;
- res = CreateConfigInfoBlk(0x000A0000, sizeof(CONSOLE_USERNAME_BLOCK), 0xE,
- reinterpret_cast<const u8*>(&CONSOLE_USERNAME_BLOCK));
- if (!res.IsSuccess())
- return res;
+ if (!res.IsSuccess()) return res;
+ res = CreateConfigInfoBlk(0x00090001, sizeof(CONSOLE_UNIQUE_ID), 0xE, &CONSOLE_UNIQUE_ID);
+ if (!res.IsSuccess()) return res;
+ res = CreateConfigInfoBlk(0x000A0000, sizeof(CONSOLE_USERNAME_BLOCK), 0xE, &CONSOLE_USERNAME_BLOCK);
+ if (!res.IsSuccess()) return res;
+ res = CreateConfigInfoBlk(0x000A0002, sizeof(CONSOLE_LANGUAGE), 0xA, &CONSOLE_LANGUAGE);
+ if (!res.IsSuccess()) return res;
+ res = CreateConfigInfoBlk(0x000B0000, sizeof(COUNTRY_INFO), 0xE, &COUNTRY_INFO);
+ if (!res.IsSuccess()) return res;
+ res = CreateConfigInfoBlk(0x000F0004, sizeof(CONSOLE_MODEL), 0x8, &CONSOLE_MODEL);
+ if (!res.IsSuccess()) return res;
+
// Save the buffer to the file
res = UpdateConfigNANDSavegame();
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);
* @param data A pointer containing the data we will write to the new block
* @returns ResultCode indicating the result of the operation, 0 on success
*/
-ResultCode CreateConfigInfoBlk(u32 block_id, u16 size, u16 flags, const u8* data);
+ResultCode CreateConfigInfoBlk(u32 block_id, u16 size, u16 flags, const void* data);
/**
* Deletes the config savegame file from the filesystem, the buffer in memory is not affected