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
This commit is contained in:
parent
733c47623b
commit
9155c8daeb
@ -25,7 +25,7 @@ const UUID& UUID::Generate() {
|
|||||||
ProfileManager::ProfileManager() {
|
ProfileManager::ProfileManager() {
|
||||||
// TODO(ogniK): Create the default user we have for now until loading/saving users is added
|
// TODO(ogniK): Create the default user we have for now until loading/saving users is added
|
||||||
auto user_uuid = UUID{1, 0};
|
auto user_uuid = UUID{1, 0};
|
||||||
CreateNewUser(user_uuid, Settings::values.username);
|
ASSERT(CreateNewUser(user_uuid, Settings::values.username).IsSuccess());
|
||||||
OpenUser(user_uuid);
|
OpenUser(user_uuid);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -91,7 +91,8 @@ ResultCode ProfileManager::CreateNewUser(UUID uuid, const ProfileUsername& usern
|
|||||||
/// specifically by allowing an std::string for the username. This is required specifically since
|
/// specifically by allowing an std::string for the username. This is required specifically since
|
||||||
/// we're loading a string straight from the config
|
/// we're loading a string straight from the config
|
||||||
ResultCode ProfileManager::CreateNewUser(UUID uuid, const std::string& username) {
|
ResultCode ProfileManager::CreateNewUser(UUID uuid, const std::string& username) {
|
||||||
ProfileUsername username_output;
|
ProfileUsername username_output{};
|
||||||
|
|
||||||
if (username.size() > username_output.size()) {
|
if (username.size() > username_output.size()) {
|
||||||
std::copy_n(username.begin(), username_output.size(), username_output.begin());
|
std::copy_n(username.begin(), username_output.size(), username_output.begin());
|
||||||
} else {
|
} else {
|
||||||
|
@ -125,6 +125,10 @@ void Config::ReadValues() {
|
|||||||
|
|
||||||
// System
|
// System
|
||||||
Settings::values.use_docked_mode = sdl2_config->GetBoolean("System", "use_docked_mode", false);
|
Settings::values.use_docked_mode = sdl2_config->GetBoolean("System", "use_docked_mode", false);
|
||||||
|
Settings::values.username = sdl2_config->Get("System", "username", "yuzu");
|
||||||
|
if (Settings::values.username.empty()) {
|
||||||
|
Settings::values.username = "yuzu";
|
||||||
|
}
|
||||||
|
|
||||||
// Miscellaneous
|
// Miscellaneous
|
||||||
Settings::values.log_filter = sdl2_config->Get("Miscellaneous", "log_filter", "*:Trace");
|
Settings::values.log_filter = sdl2_config->Get("Miscellaneous", "log_filter", "*:Trace");
|
||||||
|
@ -176,7 +176,7 @@ use_docked_mode =
|
|||||||
|
|
||||||
# Sets the account username, max length is 32 characters
|
# Sets the account username, max length is 32 characters
|
||||||
# yuzu (default)
|
# yuzu (default)
|
||||||
username =
|
username = yuzu
|
||||||
|
|
||||||
# Sets the systems language index
|
# Sets the systems language index
|
||||||
# 0: Japanese, 1: English (default), 2: French, 3: German, 4: Italian, 5: Spanish, 6: Chinese,
|
# 0: Japanese, 1: English (default), 2: French, 3: German, 4: Italian, 5: Spanish, 6: Chinese,
|
||||||
|
Loading…
Reference in New Issue
Block a user