diff options
author | David Marcec <dmarcecguzman@gmail.com> | 2018-08-08 17:09:12 +0200 |
---|---|---|
committer | David Marcec <dmarcecguzman@gmail.com> | 2018-08-08 17:09:12 +0200 |
commit | 75169c75708d9f54297537b387182bee10ada9ab (patch) | |
tree | 474dc8046e64ed4eeb57a10e99e93be835918e5b /src/core/hle/service/acc/profile_manager.cpp | |
parent | GetProfileBase and GetProfileBaseAndData added (diff) | |
download | yuzu-75169c75708d9f54297537b387182bee10ada9ab.tar yuzu-75169c75708d9f54297537b387182bee10ada9ab.tar.gz yuzu-75169c75708d9f54297537b387182bee10ada9ab.tar.bz2 yuzu-75169c75708d9f54297537b387182bee10ada9ab.tar.lz yuzu-75169c75708d9f54297537b387182bee10ada9ab.tar.xz yuzu-75169c75708d9f54297537b387182bee10ada9ab.tar.zst yuzu-75169c75708d9f54297537b387182bee10ada9ab.zip |
Diffstat (limited to 'src/core/hle/service/acc/profile_manager.cpp')
-rw-r--r-- | src/core/hle/service/acc/profile_manager.cpp | 18 |
1 files changed, 16 insertions, 2 deletions
diff --git a/src/core/hle/service/acc/profile_manager.cpp b/src/core/hle/service/acc/profile_manager.cpp index 925022018..1633d5d48 100644 --- a/src/core/hle/service/acc/profile_manager.cpp +++ b/src/core/hle/service/acc/profile_manager.cpp @@ -1,3 +1,4 @@ +#include "core/settings.h" #include "profile_manager.h" namespace Service::Account { @@ -5,6 +6,10 @@ namespace Service::Account { constexpr ResultCode ERROR_TOO_MANY_USERS(ErrorModule::Account, -1); constexpr ResultCode ERROR_ARGUMENT_IS_NULL(ErrorModule::Account, 20); +ProfileManager::ProfileManager() { + CreateNewUser(UUID{1, 0}, Settings::values.username); +} + size_t ProfileManager::AddToProfiles(const ProfileInfo& user) { if (user_count >= MAX_USERS) { return -1; @@ -39,14 +44,23 @@ ResultCode ProfileManager::CreateNewUser(UUID uuid, std::array<u8, 0x20> usernam if (username[0] == 0x0) return ERROR_ARGUMENT_IS_NULL; ProfileInfo prof_inf; - prof_inf.user_uuid = uuid; - prof_inf.username = username; + prof_inf.user_uuid = std::move(uuid); + prof_inf.username = std::move(username); prof_inf.data = std::array<u8, MAX_DATA>(); prof_inf.creation_time = 0x0; prof_inf.is_open = false; return AddUser(prof_inf); } +ResultCode ProfileManager::CreateNewUser(UUID uuid, std::string username) { + std::array<u8, 0x20> username_output; + if (username.size() > username_output.size()) + std::copy_n(username.begin(), username_output.size(), username_output.begin()); + else + std::copy(username.begin(), username.end(), username_output.begin()); + return CreateNewUser(uuid, std::move(username_output)); +} + size_t ProfileManager::GetUserIndex(UUID uuid) { if (!uuid) return -1; |