summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorGravatar Philippe Babin2018-09-18 19:58:28 -0400
committerGravatar bunnei2018-09-18 19:58:28 -0400
commit9155c8daeb2207dfa23ab4bf33a2ba244a325cf9 (patch)
treee5ff7af81fc0075b357ed9d698d7db194004e96b /src
parentMerge pull request #1343 from lioncash/mutex (diff)
downloadyuzu-9155c8daeb2207dfa23ab4bf33a2ba244a325cf9.tar.gz
yuzu-9155c8daeb2207dfa23ab4bf33a2ba244a325cf9.tar.xz
yuzu-9155c8daeb2207dfa23ab4bf33a2ba244a325cf9.zip
Invalid default value of username in yuzu_cmd (#1334)
* Fix bug where default username value for yuzu_cmd create an userprofile with uninitialize data as username * Fix format * Apply code review changes * Remove nullptr check
Diffstat (limited to 'src')
-rw-r--r--src/core/hle/service/acc/profile_manager.cpp5
-rw-r--r--src/yuzu_cmd/config.cpp4
-rw-r--r--src/yuzu_cmd/default_ini.h2
3 files changed, 8 insertions, 3 deletions
diff --git a/src/core/hle/service/acc/profile_manager.cpp b/src/core/hle/service/acc/profile_manager.cpp
index 0071ca613..bcb3475db 100644
--- a/src/core/hle/service/acc/profile_manager.cpp
+++ b/src/core/hle/service/acc/profile_manager.cpp
@@ -25,7 +25,7 @@ const UUID& UUID::Generate() {
25ProfileManager::ProfileManager() { 25ProfileManager::ProfileManager() {
26 // TODO(ogniK): Create the default user we have for now until loading/saving users is added 26 // TODO(ogniK): Create the default user we have for now until loading/saving users is added
27 auto user_uuid = UUID{1, 0}; 27 auto user_uuid = UUID{1, 0};
28 CreateNewUser(user_uuid, Settings::values.username); 28 ASSERT(CreateNewUser(user_uuid, Settings::values.username).IsSuccess());
29 OpenUser(user_uuid); 29 OpenUser(user_uuid);
30} 30}
31 31
@@ -91,7 +91,8 @@ ResultCode ProfileManager::CreateNewUser(UUID uuid, const ProfileUsername& usern
91/// specifically by allowing an std::string for the username. This is required specifically since 91/// specifically by allowing an std::string for the username. This is required specifically since
92/// we're loading a string straight from the config 92/// we're loading a string straight from the config
93ResultCode ProfileManager::CreateNewUser(UUID uuid, const std::string& username) { 93ResultCode ProfileManager::CreateNewUser(UUID uuid, const std::string& username) {
94 ProfileUsername username_output; 94 ProfileUsername username_output{};
95
95 if (username.size() > username_output.size()) { 96 if (username.size() > username_output.size()) {
96 std::copy_n(username.begin(), username_output.size(), username_output.begin()); 97 std::copy_n(username.begin(), username_output.size(), username_output.begin());
97 } else { 98 } else {
diff --git a/src/yuzu_cmd/config.cpp b/src/yuzu_cmd/config.cpp
index 991abda2e..7ec1f5110 100644
--- a/src/yuzu_cmd/config.cpp
+++ b/src/yuzu_cmd/config.cpp
@@ -125,6 +125,10 @@ void Config::ReadValues() {
125 125
126 // System 126 // System
127 Settings::values.use_docked_mode = sdl2_config->GetBoolean("System", "use_docked_mode", false); 127 Settings::values.use_docked_mode = sdl2_config->GetBoolean("System", "use_docked_mode", false);
128 Settings::values.username = sdl2_config->Get("System", "username", "yuzu");
129 if (Settings::values.username.empty()) {
130 Settings::values.username = "yuzu";
131 }
128 132
129 // Miscellaneous 133 // Miscellaneous
130 Settings::values.log_filter = sdl2_config->Get("Miscellaneous", "log_filter", "*:Trace"); 134 Settings::values.log_filter = sdl2_config->Get("Miscellaneous", "log_filter", "*:Trace");
diff --git a/src/yuzu_cmd/default_ini.h b/src/yuzu_cmd/default_ini.h
index 002a4ec15..d35c441e9 100644
--- a/src/yuzu_cmd/default_ini.h
+++ b/src/yuzu_cmd/default_ini.h
@@ -176,7 +176,7 @@ use_docked_mode =
176 176
177# Sets the account username, max length is 32 characters 177# Sets the account username, max length is 32 characters
178# yuzu (default) 178# yuzu (default)
179username = 179username = yuzu
180 180
181# Sets the systems language index 181# Sets the systems language index
182# 0: Japanese, 1: English (default), 2: French, 3: German, 4: Italian, 5: Spanish, 6: Chinese, 182# 0: Japanese, 1: English (default), 2: French, 3: German, 4: Italian, 5: Spanish, 6: Chinese,