Преглед изворни кода

Service/CFG: Add block 0x000A0000 (username) to default config file

Yuri Kunde Schlesner пре 10 година
родитељ
комит
228d8ac14a
1 измењених фајлова са 14 додато и 1 уклоњено
  1. 14 1
      src/core/hle/service/cfg/cfg.cpp

+ 14 - 1
src/core/hle/service/cfg/cfg.cpp

@@ -4,9 +4,10 @@
 
 
 #include <algorithm>
 #include <algorithm>
 
 
+#include "common/file_util.h"
 #include "common/logging/log.h"
 #include "common/logging/log.h"
 #include "common/string_util.h"
 #include "common/string_util.h"
-#include "common/file_util.h"
+#include "common/swap.h"
 
 
 #include "core/file_sys/archive_systemsavedata.h"
 #include "core/file_sys/archive_systemsavedata.h"
 #include "core/file_sys/file_backend.h"
 #include "core/file_sys/file_backend.h"
@@ -334,6 +335,18 @@ ResultCode FormatConfig() {
     res = CreateConfigInfoBlk(0x000A0000, sizeof(CONSOLE_USERNAME_BLOCK), 0xE, &CONSOLE_USERNAME_BLOCK);
     res = CreateConfigInfoBlk(0x000A0000, sizeof(CONSOLE_USERNAME_BLOCK), 0xE, &CONSOLE_USERNAME_BLOCK);
     if (!res.IsSuccess()) return res;
     if (!res.IsSuccess()) return res;
 
 
+    // 0x000A0000 - Profile username
+    struct {
+        u16_le username[10];
+        u8 unused[4];
+        u32_le wordfilter_version; // Unused by Citra
+    } profile_username = {};
+
+    std::u16string username_string = Common::UTF8ToUTF16("Citra");
+    std::copy(username_string.cbegin(), username_string.cend(), profile_username.username);
+    res = CreateConfigInfoBlk(0x000A0000, sizeof(profile_username), 0xE, &profile_username);
+    if (!res.IsSuccess()) return res;
+
     // 0x000A0001 - Profile birthday
     // 0x000A0001 - Profile birthday
     const u8 profile_birthday[2] = {3, 25}; // March 25th, 2014
     const u8 profile_birthday[2] = {3, 25}; // March 25th, 2014
     res = CreateConfigInfoBlk(0x000A0001, sizeof(profile_birthday), 0xE, profile_birthday);
     res = CreateConfigInfoBlk(0x000A0001, sizeof(profile_birthday), 0xE, profile_birthday);