summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorGravatar Lioncash2020-08-03 08:55:41 -0400
committerGravatar Lioncash2020-08-03 09:01:31 -0400
commit3fcaf937d2d59a2797acfb8fd0063be69ba5296e (patch)
treee148436f48d09ddbb23509cd4843171c5213d36e /src
parentMerge pull request #4437 from lioncash/ptr (diff)
downloadyuzu-3fcaf937d2d59a2797acfb8fd0063be69ba5296e.tar.gz
yuzu-3fcaf937d2d59a2797acfb8fd0063be69ba5296e.tar.xz
yuzu-3fcaf937d2d59a2797acfb8fd0063be69ba5296e.zip
profile_manager: Make use of designated initializers
More compact code.
Diffstat (limited to 'src')
-rw-r--r--src/core/hle/service/acc/profile_manager.cpp35
1 files changed, 22 insertions, 13 deletions
diff --git a/src/core/hle/service/acc/profile_manager.cpp b/src/core/hle/service/acc/profile_manager.cpp
index eb8c81645..3867ca29a 100644
--- a/src/core/hle/service/acc/profile_manager.cpp
+++ b/src/core/hle/service/acc/profile_manager.cpp
@@ -101,13 +101,14 @@ ResultCode ProfileManager::CreateNewUser(UUID uuid, const ProfileUsername& usern
101 [&uuid](const ProfileInfo& profile) { return uuid == profile.user_uuid; })) { 101 [&uuid](const ProfileInfo& profile) { return uuid == profile.user_uuid; })) {
102 return ERROR_USER_ALREADY_EXISTS; 102 return ERROR_USER_ALREADY_EXISTS;
103 } 103 }
104 ProfileInfo profile; 104
105 profile.user_uuid = uuid; 105 return AddUser({
106 profile.username = username; 106 .user_uuid = uuid,
107 profile.data = {}; 107 .username = username,
108 profile.creation_time = 0x0; 108 .creation_time = 0,
109 profile.is_open = false; 109 .data = {},
110 return AddUser(profile); 110 .is_open = false,
111 });
111} 112}
112 113
113/// Creates a new user on the system. This function allows a much simpler method of registration 114/// Creates a new user on the system. This function allows a much simpler method of registration
@@ -339,7 +340,13 @@ void ProfileManager::ParseUserSaveFile() {
339 continue; 340 continue;
340 } 341 }
341 342
342 AddUser({user.uuid, user.username, user.timestamp, user.extra_data, false}); 343 AddUser({
344 .user_uuid = user.uuid,
345 .username = user.username,
346 .creation_time = user.timestamp,
347 .data = user.extra_data,
348 .is_open = false,
349 });
343 } 350 }
344 351
345 std::stable_partition(profiles.begin(), profiles.end(), 352 std::stable_partition(profiles.begin(), profiles.end(),
@@ -350,11 +357,13 @@ void ProfileManager::WriteUserSaveFile() {
350 ProfileDataRaw raw{}; 357 ProfileDataRaw raw{};
351 358
352 for (std::size_t i = 0; i < MAX_USERS; ++i) { 359 for (std::size_t i = 0; i < MAX_USERS; ++i) {
353 raw.users[i].username = profiles[i].username; 360 raw.users[i] = {
354 raw.users[i].uuid2 = profiles[i].user_uuid; 361 .uuid = profiles[i].user_uuid,
355 raw.users[i].uuid = profiles[i].user_uuid; 362 .uuid2 = profiles[i].user_uuid,
356 raw.users[i].timestamp = profiles[i].creation_time; 363 .timestamp = profiles[i].creation_time,
357 raw.users[i].extra_data = profiles[i].data; 364 .username = profiles[i].username,
365 .extra_data = profiles[i].data,
366 };
358 } 367 }
359 368
360 const auto raw_path = 369 const auto raw_path =