summaryrefslogtreecommitdiff
path: root/src/core
diff options
context:
space:
mode:
authorGravatar bunnei2018-08-20 20:54:34 -0400
committerGravatar GitHub2018-08-20 20:54:34 -0400
commit19b05c3f554cadaf6f5040e06fb7caabe0b6682f (patch)
treeff317c15003599b4de47162d771041a12e818286 /src/core
parentMerge pull request #1125 from bunnei/update-dynarmic (diff)
parentacc: Replace profile_manager include with a forward declaration (diff)
downloadyuzu-19b05c3f554cadaf6f5040e06fb7caabe0b6682f.tar.gz
yuzu-19b05c3f554cadaf6f5040e06fb7caabe0b6682f.tar.xz
yuzu-19b05c3f554cadaf6f5040e06fb7caabe0b6682f.zip
Merge pull request #1122 from lioncash/acc
acc/profile_manager: General cleanup
Diffstat (limited to 'src/core')
-rw-r--r--src/core/hle/service/acc/acc.cpp15
-rw-r--r--src/core/hle/service/acc/acc.h4
-rw-r--r--src/core/hle/service/acc/profile_manager.cpp42
-rw-r--r--src/core/hle/service/acc/profile_manager.h57
4 files changed, 61 insertions, 57 deletions
diff --git a/src/core/hle/service/acc/acc.cpp b/src/core/hle/service/acc/acc.cpp
index 979f2f892..1502dbf55 100644
--- a/src/core/hle/service/acc/acc.cpp
+++ b/src/core/hle/service/acc/acc.cpp
@@ -13,7 +13,7 @@
13#include "core/hle/service/acc/acc_su.h" 13#include "core/hle/service/acc/acc_su.h"
14#include "core/hle/service/acc/acc_u0.h" 14#include "core/hle/service/acc/acc_u0.h"
15#include "core/hle/service/acc/acc_u1.h" 15#include "core/hle/service/acc/acc_u1.h"
16#include "core/settings.h" 16#include "core/hle/service/acc/profile_manager.h"
17 17
18namespace Service::Account { 18namespace Service::Account {
19// TODO: RE this structure 19// TODO: RE this structure
@@ -27,13 +27,10 @@ struct UserData {
27}; 27};
28static_assert(sizeof(UserData) == 0x80, "UserData structure has incorrect size"); 28static_assert(sizeof(UserData) == 0x80, "UserData structure has incorrect size");
29 29
30// TODO(ogniK): Generate a real user id based on username, md5(username) maybe?
31static UUID DEFAULT_USER_ID{1ull, 0ull};
32
33class IProfile final : public ServiceFramework<IProfile> { 30class IProfile final : public ServiceFramework<IProfile> {
34public: 31public:
35 explicit IProfile(UUID user_id, ProfileManager& profile_manager) 32 explicit IProfile(UUID user_id, ProfileManager& profile_manager)
36 : ServiceFramework("IProfile"), user_id(user_id), profile_manager(profile_manager) { 33 : ServiceFramework("IProfile"), profile_manager(profile_manager), user_id(user_id) {
37 static const FunctionInfo functions[] = { 34 static const FunctionInfo functions[] = {
38 {0, &IProfile::Get, "Get"}, 35 {0, &IProfile::Get, "Get"},
39 {1, &IProfile::GetBase, "GetBase"}, 36 {1, &IProfile::GetBase, "GetBase"},
@@ -79,8 +76,8 @@ private:
79 LOG_WARNING(Service_ACC, "(STUBBED) called"); 76 LOG_WARNING(Service_ACC, "(STUBBED) called");
80 // smallest jpeg https://github.com/mathiasbynens/small/blob/master/jpeg.jpg 77 // smallest jpeg https://github.com/mathiasbynens/small/blob/master/jpeg.jpg
81 // TODO(mailwl): load actual profile image from disk, width 256px, max size 0x20000 78 // TODO(mailwl): load actual profile image from disk, width 256px, max size 0x20000
82 const u32 jpeg_size = 107; 79 constexpr u32 jpeg_size = 107;
83 static const std::array<u8, jpeg_size> jpeg{ 80 static constexpr std::array<u8, jpeg_size> jpeg{
84 0xff, 0xd8, 0xff, 0xdb, 0x00, 0x43, 0x00, 0x03, 0x02, 0x02, 0x02, 0x02, 0x02, 0x03, 81 0xff, 0xd8, 0xff, 0xdb, 0x00, 0x43, 0x00, 0x03, 0x02, 0x02, 0x02, 0x02, 0x02, 0x03,
85 0x02, 0x02, 0x02, 0x03, 0x03, 0x03, 0x03, 0x04, 0x06, 0x04, 0x04, 0x04, 0x04, 0x04, 82 0x02, 0x02, 0x02, 0x03, 0x03, 0x03, 0x03, 0x04, 0x06, 0x04, 0x04, 0x04, 0x04, 0x04,
86 0x08, 0x06, 0x06, 0x05, 0x06, 0x09, 0x08, 0x0a, 0x0a, 0x09, 0x08, 0x09, 0x09, 0x0a, 83 0x08, 0x06, 0x06, 0x05, 0x06, 0x09, 0x08, 0x0a, 0x0a, 0x09, 0x08, 0x09, 0x09, 0x0a,
@@ -90,7 +87,7 @@ private:
90 0xff, 0xcc, 0x00, 0x06, 0x00, 0x10, 0x10, 0x05, 0xff, 0xda, 0x00, 0x08, 0x01, 0x01, 87 0xff, 0xcc, 0x00, 0x06, 0x00, 0x10, 0x10, 0x05, 0xff, 0xda, 0x00, 0x08, 0x01, 0x01,
91 0x00, 0x00, 0x3f, 0x00, 0xd2, 0xcf, 0x20, 0xff, 0xd9, 88 0x00, 0x00, 0x3f, 0x00, 0xd2, 0xcf, 0x20, 0xff, 0xd9,
92 }; 89 };
93 ctx.WriteBuffer(jpeg.data(), jpeg_size); 90 ctx.WriteBuffer(jpeg);
94 IPC::ResponseBuilder rb{ctx, 3}; 91 IPC::ResponseBuilder rb{ctx, 3};
95 rb.Push(RESULT_SUCCESS); 92 rb.Push(RESULT_SUCCESS);
96 rb.Push<u32>(jpeg_size); 93 rb.Push<u32>(jpeg_size);
@@ -205,6 +202,8 @@ Module::Interface::Interface(std::shared_ptr<Module> module,
205 : ServiceFramework(name), module(std::move(module)), 202 : ServiceFramework(name), module(std::move(module)),
206 profile_manager(std::move(profile_manager)) {} 203 profile_manager(std::move(profile_manager)) {}
207 204
205Module::Interface::~Interface() = default;
206
208void InstallInterfaces(SM::ServiceManager& service_manager) { 207void InstallInterfaces(SM::ServiceManager& service_manager) {
209 auto module = std::make_shared<Module>(); 208 auto module = std::make_shared<Module>();
210 auto profile_manager = std::make_shared<ProfileManager>(); 209 auto profile_manager = std::make_shared<ProfileManager>();
diff --git a/src/core/hle/service/acc/acc.h b/src/core/hle/service/acc/acc.h
index d7c6d2415..c7ed74351 100644
--- a/src/core/hle/service/acc/acc.h
+++ b/src/core/hle/service/acc/acc.h
@@ -4,17 +4,19 @@
4 4
5#pragma once 5#pragma once
6 6
7#include "core/hle/service/acc/profile_manager.h"
8#include "core/hle/service/service.h" 7#include "core/hle/service/service.h"
9 8
10namespace Service::Account { 9namespace Service::Account {
11 10
11class ProfileManager;
12
12class Module final { 13class Module final {
13public: 14public:
14 class Interface : public ServiceFramework<Interface> { 15 class Interface : public ServiceFramework<Interface> {
15 public: 16 public:
16 explicit Interface(std::shared_ptr<Module> module, 17 explicit Interface(std::shared_ptr<Module> module,
17 std::shared_ptr<ProfileManager> profile_manager, const char* name); 18 std::shared_ptr<ProfileManager> profile_manager, const char* name);
19 ~Interface() override;
18 20
19 void GetUserCount(Kernel::HLERequestContext& ctx); 21 void GetUserCount(Kernel::HLERequestContext& ctx);
20 void GetUserExistence(Kernel::HLERequestContext& ctx); 22 void GetUserExistence(Kernel::HLERequestContext& ctx);
diff --git a/src/core/hle/service/acc/profile_manager.cpp b/src/core/hle/service/acc/profile_manager.cpp
index 62c2121fa..e0b03d763 100644
--- a/src/core/hle/service/acc/profile_manager.cpp
+++ b/src/core/hle/service/acc/profile_manager.cpp
@@ -2,6 +2,7 @@
2// Licensed under GPLv2 or any later version 2// Licensed under GPLv2 or any later version
3// Refer to the license.txt file included. 3// Refer to the license.txt file included.
4 4
5#include <random>
5#include <boost/optional.hpp> 6#include <boost/optional.hpp>
6#include "core/hle/service/acc/profile_manager.h" 7#include "core/hle/service/acc/profile_manager.h"
7#include "core/settings.h" 8#include "core/settings.h"
@@ -12,6 +13,15 @@ constexpr ResultCode ERROR_TOO_MANY_USERS(ErrorModule::Account, -1);
12constexpr ResultCode ERROR_USER_ALREADY_EXISTS(ErrorModule::Account, -2); 13constexpr ResultCode ERROR_USER_ALREADY_EXISTS(ErrorModule::Account, -2);
13constexpr ResultCode ERROR_ARGUMENT_IS_NULL(ErrorModule::Account, 20); 14constexpr ResultCode ERROR_ARGUMENT_IS_NULL(ErrorModule::Account, 20);
14 15
16const UUID& UUID::Generate() {
17 std::random_device device;
18 std::mt19937 gen(device());
19 std::uniform_int_distribution<u64> distribution(1, std::numeric_limits<u64>::max());
20 uuid[0] = distribution(gen);
21 uuid[1] = distribution(gen);
22 return *this;
23}
24
15ProfileManager::ProfileManager() { 25ProfileManager::ProfileManager() {
16 // 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
17 auto user_uuid = UUID{1, 0}; 27 auto user_uuid = UUID{1, 0};
@@ -25,7 +35,7 @@ boost::optional<size_t> ProfileManager::AddToProfiles(const ProfileInfo& user) {
25 if (user_count >= MAX_USERS) { 35 if (user_count >= MAX_USERS) {
26 return boost::none; 36 return boost::none;
27 } 37 }
28 profiles[user_count] = std::move(user); 38 profiles[user_count] = user;
29 return user_count++; 39 return user_count++;
30} 40}
31 41
@@ -43,7 +53,7 @@ bool ProfileManager::RemoveProfileAtIndex(size_t index) {
43} 53}
44 54
45/// Helper function to register a user to the system 55/// Helper function to register a user to the system
46ResultCode ProfileManager::AddUser(ProfileInfo user) { 56ResultCode ProfileManager::AddUser(const ProfileInfo& user) {
47 if (AddToProfiles(user) == boost::none) { 57 if (AddToProfiles(user) == boost::none) {
48 return ERROR_TOO_MANY_USERS; 58 return ERROR_TOO_MANY_USERS;
49 } 59 }
@@ -52,7 +62,7 @@ ResultCode ProfileManager::AddUser(ProfileInfo user) {
52 62
53/// Create a new user on the system. If the uuid of the user already exists, the user is not 63/// Create a new user on the system. If the uuid of the user already exists, the user is not
54/// created. 64/// created.
55ResultCode ProfileManager::CreateNewUser(UUID uuid, std::array<u8, 0x20>& username) { 65ResultCode ProfileManager::CreateNewUser(UUID uuid, const ProfileUsername& username) {
56 if (user_count == MAX_USERS) { 66 if (user_count == MAX_USERS) {
57 return ERROR_TOO_MANY_USERS; 67 return ERROR_TOO_MANY_USERS;
58 } 68 }
@@ -67,7 +77,7 @@ ResultCode ProfileManager::CreateNewUser(UUID uuid, std::array<u8, 0x20>& userna
67 return ERROR_USER_ALREADY_EXISTS; 77 return ERROR_USER_ALREADY_EXISTS;
68 } 78 }
69 ProfileInfo profile; 79 ProfileInfo profile;
70 profile.user_uuid = std::move(uuid); 80 profile.user_uuid = uuid;
71 profile.username = username; 81 profile.username = username;
72 profile.data = {}; 82 profile.data = {};
73 profile.creation_time = 0x0; 83 profile.creation_time = 0x0;
@@ -79,7 +89,7 @@ ResultCode ProfileManager::CreateNewUser(UUID uuid, std::array<u8, 0x20>& userna
79/// specifically by allowing an std::string for the username. This is required specifically since 89/// specifically by allowing an std::string for the username. This is required specifically since
80/// we're loading a string straight from the config 90/// we're loading a string straight from the config
81ResultCode ProfileManager::CreateNewUser(UUID uuid, const std::string& username) { 91ResultCode ProfileManager::CreateNewUser(UUID uuid, const std::string& username) {
82 std::array<u8, 0x20> username_output; 92 ProfileUsername username_output;
83 if (username.size() > username_output.size()) { 93 if (username.size() > username_output.size()) {
84 std::copy_n(username.begin(), username_output.size(), username_output.begin()); 94 std::copy_n(username.begin(), username_output.size(), username_output.begin());
85 } else { 95 } else {
@@ -102,7 +112,7 @@ boost::optional<size_t> ProfileManager::GetUserIndex(const UUID& uuid) const {
102} 112}
103 113
104/// Returns a users profile index based on their profile 114/// Returns a users profile index based on their profile
105boost::optional<size_t> ProfileManager::GetUserIndex(ProfileInfo user) const { 115boost::optional<size_t> ProfileManager::GetUserIndex(const ProfileInfo& user) const {
106 return GetUserIndex(user.user_uuid); 116 return GetUserIndex(user.user_uuid);
107} 117}
108 118
@@ -125,7 +135,7 @@ bool ProfileManager::GetProfileBase(UUID uuid, ProfileBase& profile) const {
125} 135}
126 136
127/// Returns the data structure used by the switch when GetProfileBase is called on acc:* 137/// Returns the data structure used by the switch when GetProfileBase is called on acc:*
128bool ProfileManager::GetProfileBase(ProfileInfo user, ProfileBase& profile) const { 138bool ProfileManager::GetProfileBase(const ProfileInfo& user, ProfileBase& profile) const {
129 return GetProfileBase(user.user_uuid, profile); 139 return GetProfileBase(user.user_uuid, profile);
130} 140}
131 141
@@ -168,8 +178,8 @@ void ProfileManager::CloseUser(UUID uuid) {
168} 178}
169 179
170/// Gets all valid user ids on the system 180/// Gets all valid user ids on the system
171std::array<UUID, MAX_USERS> ProfileManager::GetAllUsers() const { 181UserIDArray ProfileManager::GetAllUsers() const {
172 std::array<UUID, MAX_USERS> output; 182 UserIDArray output;
173 std::transform(profiles.begin(), profiles.end(), output.begin(), 183 std::transform(profiles.begin(), profiles.end(), output.begin(),
174 [](const ProfileInfo& p) { return p.user_uuid; }); 184 [](const ProfileInfo& p) { return p.user_uuid; });
175 return output; 185 return output;
@@ -177,8 +187,8 @@ std::array<UUID, MAX_USERS> ProfileManager::GetAllUsers() const {
177 187
178/// Get all the open users on the system and zero out the rest of the data. This is specifically 188/// Get all the open users on the system and zero out the rest of the data. This is specifically
179/// needed for GetOpenUsers and we need to ensure the rest of the output buffer is zero'd out 189/// needed for GetOpenUsers and we need to ensure the rest of the output buffer is zero'd out
180std::array<UUID, MAX_USERS> ProfileManager::GetOpenUsers() const { 190UserIDArray ProfileManager::GetOpenUsers() const {
181 std::array<UUID, MAX_USERS> output; 191 UserIDArray output;
182 std::transform(profiles.begin(), profiles.end(), output.begin(), [](const ProfileInfo& p) { 192 std::transform(profiles.begin(), profiles.end(), output.begin(), [](const ProfileInfo& p) {
183 if (p.is_open) 193 if (p.is_open)
184 return p.user_uuid; 194 return p.user_uuid;
@@ -195,9 +205,9 @@ UUID ProfileManager::GetLastOpenedUser() const {
195 205
196/// Return the users profile base and the unknown arbitary data. 206/// Return the users profile base and the unknown arbitary data.
197bool ProfileManager::GetProfileBaseAndData(boost::optional<size_t> index, ProfileBase& profile, 207bool ProfileManager::GetProfileBaseAndData(boost::optional<size_t> index, ProfileBase& profile,
198 std::array<u8, MAX_DATA>& data) const { 208 ProfileData& data) const {
199 if (GetProfileBase(index, profile)) { 209 if (GetProfileBase(index, profile)) {
200 std::memcpy(data.data(), profiles[index.get()].data.data(), MAX_DATA); 210 data = profiles[index.get()].data;
201 return true; 211 return true;
202 } 212 }
203 return false; 213 return false;
@@ -205,14 +215,14 @@ bool ProfileManager::GetProfileBaseAndData(boost::optional<size_t> index, Profil
205 215
206/// Return the users profile base and the unknown arbitary data. 216/// Return the users profile base and the unknown arbitary data.
207bool ProfileManager::GetProfileBaseAndData(UUID uuid, ProfileBase& profile, 217bool ProfileManager::GetProfileBaseAndData(UUID uuid, ProfileBase& profile,
208 std::array<u8, MAX_DATA>& data) const { 218 ProfileData& data) const {
209 auto idx = GetUserIndex(uuid); 219 auto idx = GetUserIndex(uuid);
210 return GetProfileBaseAndData(idx, profile, data); 220 return GetProfileBaseAndData(idx, profile, data);
211} 221}
212 222
213/// Return the users profile base and the unknown arbitary data. 223/// Return the users profile base and the unknown arbitary data.
214bool ProfileManager::GetProfileBaseAndData(ProfileInfo user, ProfileBase& profile, 224bool ProfileManager::GetProfileBaseAndData(const ProfileInfo& user, ProfileBase& profile,
215 std::array<u8, MAX_DATA>& data) const { 225 ProfileData& data) const {
216 return GetProfileBaseAndData(user.user_uuid, profile, data); 226 return GetProfileBaseAndData(user.user_uuid, profile, data);
217} 227}
218 228
diff --git a/src/core/hle/service/acc/profile_manager.h b/src/core/hle/service/acc/profile_manager.h
index 314bccbf9..52967844d 100644
--- a/src/core/hle/service/acc/profile_manager.h
+++ b/src/core/hle/service/acc/profile_manager.h
@@ -5,7 +5,7 @@
5#pragma once 5#pragma once
6 6
7#include <array> 7#include <array>
8#include <random> 8
9#include "boost/optional.hpp" 9#include "boost/optional.hpp"
10#include "common/common_types.h" 10#include "common/common_types.h"
11#include "common/swap.h" 11#include "common/swap.h"
@@ -14,23 +14,21 @@
14namespace Service::Account { 14namespace Service::Account {
15constexpr size_t MAX_USERS = 8; 15constexpr size_t MAX_USERS = 8;
16constexpr size_t MAX_DATA = 128; 16constexpr size_t MAX_DATA = 128;
17static const u128 INVALID_UUID = {0, 0}; 17constexpr u128 INVALID_UUID{{0, 0}};
18 18
19struct UUID { 19struct UUID {
20 // UUIDs which are 0 are considered invalid! 20 // UUIDs which are 0 are considered invalid!
21 u128 uuid = INVALID_UUID; 21 u128 uuid = INVALID_UUID;
22 UUID() = default; 22 UUID() = default;
23 explicit UUID(const u128& id) : uuid{id} {} 23 explicit UUID(const u128& id) : uuid{id} {}
24 explicit UUID(const u64 lo, const u64 hi) { 24 explicit UUID(const u64 lo, const u64 hi) : uuid{{lo, hi}} {}
25 uuid[0] = lo; 25
26 uuid[1] = hi;
27 };
28 explicit operator bool() const { 26 explicit operator bool() const {
29 return uuid[0] != INVALID_UUID[0] || uuid[1] != INVALID_UUID[1]; 27 return uuid != INVALID_UUID;
30 } 28 }
31 29
32 bool operator==(const UUID& rhs) const { 30 bool operator==(const UUID& rhs) const {
33 return std::tie(uuid[0], uuid[1]) == std::tie(rhs.uuid[0], rhs.uuid[1]); 31 return uuid == rhs.uuid;
34 } 32 }
35 33
36 bool operator!=(const UUID& rhs) const { 34 bool operator!=(const UUID& rhs) const {
@@ -38,15 +36,7 @@ struct UUID {
38 } 36 }
39 37
40 // TODO(ogniK): Properly generate uuids based on RFC-4122 38 // TODO(ogniK): Properly generate uuids based on RFC-4122
41 const UUID& Generate() { 39 const UUID& Generate();
42 std::random_device device;
43 std::mt19937 gen(device());
44 std::uniform_int_distribution<uint64_t> distribution(1,
45 std::numeric_limits<uint64_t>::max());
46 uuid[0] = distribution(gen);
47 uuid[1] = distribution(gen);
48 return *this;
49 }
50 40
51 // Set the UUID to {0,0} to be considered an invalid user 41 // Set the UUID to {0,0} to be considered an invalid user
52 void Invalidate() { 42 void Invalidate() {
@@ -58,20 +48,24 @@ struct UUID {
58}; 48};
59static_assert(sizeof(UUID) == 16, "UUID is an invalid size!"); 49static_assert(sizeof(UUID) == 16, "UUID is an invalid size!");
60 50
51using ProfileUsername = std::array<u8, 0x20>;
52using ProfileData = std::array<u8, MAX_DATA>;
53using UserIDArray = std::array<UUID, MAX_USERS>;
54
61/// This holds general information about a users profile. This is where we store all the information 55/// This holds general information about a users profile. This is where we store all the information
62/// based on a specific user 56/// based on a specific user
63struct ProfileInfo { 57struct ProfileInfo {
64 UUID user_uuid; 58 UUID user_uuid;
65 std::array<u8, 0x20> username; 59 ProfileUsername username;
66 u64 creation_time; 60 u64 creation_time;
67 std::array<u8, MAX_DATA> data; // TODO(ognik): Work out what this is 61 ProfileData data; // TODO(ognik): Work out what this is
68 bool is_open; 62 bool is_open;
69}; 63};
70 64
71struct ProfileBase { 65struct ProfileBase {
72 UUID user_uuid; 66 UUID user_uuid;
73 u64_le timestamp; 67 u64_le timestamp;
74 std::array<u8, 0x20> username; 68 ProfileUsername username;
75 69
76 // Zero out all the fields to make the profile slot considered "Empty" 70 // Zero out all the fields to make the profile slot considered "Empty"
77 void Invalidate() { 71 void Invalidate() {
@@ -88,27 +82,26 @@ static_assert(sizeof(ProfileBase) == 0x38, "ProfileBase is an invalid size");
88class ProfileManager { 82class ProfileManager {
89public: 83public:
90 ProfileManager(); // TODO(ogniK): Load from system save 84 ProfileManager(); // TODO(ogniK): Load from system save
91 ResultCode AddUser(ProfileInfo user); 85 ResultCode AddUser(const ProfileInfo& user);
92 ResultCode CreateNewUser(UUID uuid, std::array<u8, 0x20>& username); 86 ResultCode CreateNewUser(UUID uuid, const ProfileUsername& username);
93 ResultCode CreateNewUser(UUID uuid, const std::string& username); 87 ResultCode CreateNewUser(UUID uuid, const std::string& username);
94 boost::optional<size_t> GetUserIndex(const UUID& uuid) const; 88 boost::optional<size_t> GetUserIndex(const UUID& uuid) const;
95 boost::optional<size_t> GetUserIndex(ProfileInfo user) const; 89 boost::optional<size_t> GetUserIndex(const ProfileInfo& user) const;
96 bool GetProfileBase(boost::optional<size_t> index, ProfileBase& profile) const; 90 bool GetProfileBase(boost::optional<size_t> index, ProfileBase& profile) const;
97 bool GetProfileBase(UUID uuid, ProfileBase& profile) const; 91 bool GetProfileBase(UUID uuid, ProfileBase& profile) const;
98 bool GetProfileBase(ProfileInfo user, ProfileBase& profile) const; 92 bool GetProfileBase(const ProfileInfo& user, ProfileBase& profile) const;
99 bool GetProfileBaseAndData(boost::optional<size_t> index, ProfileBase& profile, 93 bool GetProfileBaseAndData(boost::optional<size_t> index, ProfileBase& profile,
100 std::array<u8, MAX_DATA>& data) const; 94 ProfileData& data) const;
101 bool GetProfileBaseAndData(UUID uuid, ProfileBase& profile, 95 bool GetProfileBaseAndData(UUID uuid, ProfileBase& profile, ProfileData& data) const;
102 std::array<u8, MAX_DATA>& data) const; 96 bool GetProfileBaseAndData(const ProfileInfo& user, ProfileBase& profile,
103 bool GetProfileBaseAndData(ProfileInfo user, ProfileBase& profile, 97 ProfileData& data) const;
104 std::array<u8, MAX_DATA>& data) const;
105 size_t GetUserCount() const; 98 size_t GetUserCount() const;
106 size_t GetOpenUserCount() const; 99 size_t GetOpenUserCount() const;
107 bool UserExists(UUID uuid) const; 100 bool UserExists(UUID uuid) const;
108 void OpenUser(UUID uuid); 101 void OpenUser(UUID uuid);
109 void CloseUser(UUID uuid); 102 void CloseUser(UUID uuid);
110 std::array<UUID, MAX_USERS> GetOpenUsers() const; 103 UserIDArray GetOpenUsers() const;
111 std::array<UUID, MAX_USERS> GetAllUsers() const; 104 UserIDArray GetAllUsers() const;
112 UUID GetLastOpenedUser() const; 105 UUID GetLastOpenedUser() const;
113 106
114 bool CanSystemRegisterUser() const; 107 bool CanSystemRegisterUser() const;
@@ -118,7 +111,7 @@ private:
118 size_t user_count = 0; 111 size_t user_count = 0;
119 boost::optional<size_t> AddToProfiles(const ProfileInfo& profile); 112 boost::optional<size_t> AddToProfiles(const ProfileInfo& profile);
120 bool RemoveProfileAtIndex(size_t index); 113 bool RemoveProfileAtIndex(size_t index);
121 UUID last_opened_user{0, 0}; 114 UUID last_opened_user{INVALID_UUID};
122}; 115};
123 116
124}; // namespace Service::Account 117}; // namespace Service::Account