From ca5638a1426ce560f3896b3ff0d3efd02b654585 Mon Sep 17 00:00:00 2001 From: Zach Hilman Date: Tue, 18 Dec 2018 09:07:25 -0500 Subject: common: Extract UUID to its own class Since the Mii database uses UUIDs very similar to the Accounts database, it makes no sense to not share code between them. --- src/core/hle/service/acc/acc.cpp | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) (limited to 'src/core/hle/service/acc/acc.cpp') diff --git a/src/core/hle/service/acc/acc.cpp b/src/core/hle/service/acc/acc.cpp index ba7d7acbd..86bf53d08 100644 --- a/src/core/hle/service/acc/acc.cpp +++ b/src/core/hle/service/acc/acc.cpp @@ -34,7 +34,7 @@ constexpr std::array backup_jpeg{{ 0x01, 0x01, 0x00, 0x00, 0x3f, 0x00, 0xd2, 0xcf, 0x20, 0xff, 0xd9, }}; -static std::string GetImagePath(UUID uuid) { +static std::string GetImagePath(Common::UUID uuid) { return FileUtil::GetUserPath(FileUtil::UserPath::NANDDir) + "/system/save/8000000000000010/su/avators/" + uuid.FormatSwitch() + ".jpg"; } @@ -46,7 +46,7 @@ static constexpr u32 SanitizeJPEGSize(std::size_t size) { class IProfile final : public ServiceFramework { public: - explicit IProfile(UUID user_id, ProfileManager& profile_manager) + explicit IProfile(Common::UUID user_id, ProfileManager& profile_manager) : ServiceFramework("IProfile"), profile_manager(profile_manager), user_id(user_id) { static const FunctionInfo functions[] = { {0, &IProfile::Get, "Get"}, @@ -131,7 +131,7 @@ private: } const ProfileManager& profile_manager; - UUID user_id; ///< The user id this profile refers to. + Common::UUID user_id; ///< The user id this profile refers to. }; class IManagerForApplication final : public ServiceFramework { @@ -179,7 +179,7 @@ void Module::Interface::GetUserCount(Kernel::HLERequestContext& ctx) { void Module::Interface::GetUserExistence(Kernel::HLERequestContext& ctx) { IPC::RequestParser rp{ctx}; - UUID user_id = rp.PopRaw(); + Common::UUID user_id = rp.PopRaw(); LOG_INFO(Service_ACC, "called user_id={}", user_id.Format()); IPC::ResponseBuilder rb{ctx, 3}; @@ -205,12 +205,12 @@ void Module::Interface::GetLastOpenedUser(Kernel::HLERequestContext& ctx) { LOG_INFO(Service_ACC, "called"); IPC::ResponseBuilder rb{ctx, 6}; rb.Push(RESULT_SUCCESS); - rb.PushRaw(profile_manager->GetLastOpenedUser()); + rb.PushRaw(profile_manager->GetLastOpenedUser()); } void Module::Interface::GetProfile(Kernel::HLERequestContext& ctx) { IPC::RequestParser rp{ctx}; - UUID user_id = rp.PopRaw(); + Common::UUID user_id = rp.PopRaw(); LOG_DEBUG(Service_ACC, "called user_id={}", user_id.Format()); IPC::ResponseBuilder rb{ctx, 2, 0, 1}; @@ -245,15 +245,15 @@ void Module::Interface::TrySelectUserWithoutInteraction(Kernel::HLERequestContex IPC::ResponseBuilder rb{ctx, 6}; if (profile_manager->GetUserCount() != 1) { rb.Push(RESULT_SUCCESS); - rb.PushRaw(INVALID_UUID); + rb.PushRaw(Common::INVALID_UUID); return; } const auto user_list = profile_manager->GetAllUsers(); if (std::all_of(user_list.begin(), user_list.end(), - [](const auto& user) { return user.uuid == INVALID_UUID; })) { + [](const auto& user) { return user.uuid == Common::INVALID_UUID; })) { rb.Push(ResultCode(-1)); // TODO(ogniK): Find the correct error code - rb.PushRaw(INVALID_UUID); + rb.PushRaw(Common::INVALID_UUID); return; } -- cgit v1.2.3