Skip to content
Snippets Groups Projects
Commit 1af13e08 authored by Lioncash's avatar Lioncash
Browse files

profile_manager: Move UUID Format function definitions into the cpp file

Avoids relying on fmt always being indirectly included.
parent e1ea8cc7
No related branches found
No related tags found
No related merge requests found
...@@ -2,8 +2,11 @@ ...@@ -2,8 +2,11 @@
// Licensed under GPLv2 or any later version // Licensed under GPLv2 or any later version
// Refer to the license.txt file included. // Refer to the license.txt file included.
#include <cstring>
#include <random> #include <random>
#include <fmt/format.h>
#include "common/file_util.h" #include "common/file_util.h"
#include "core/hle/service/acc/profile_manager.h" #include "core/hle/service/acc/profile_manager.h"
#include "core/settings.h" #include "core/settings.h"
...@@ -39,6 +42,19 @@ UUID UUID::Generate() { ...@@ -39,6 +42,19 @@ UUID UUID::Generate() {
return UUID{distribution(gen), distribution(gen)}; return UUID{distribution(gen), distribution(gen)};
} }
std::string UUID::Format() const {
return fmt::format("0x{:016X}{:016X}", uuid[1], uuid[0]);
}
std::string UUID::FormatSwitch() const {
std::array<u8, 16> s{};
std::memcpy(s.data(), uuid.data(), sizeof(u128));
return fmt::format("{:02x}{:02x}{:02x}{:02x}-{:02x}{:02x}-{:02x}{:02x}-{:02x}{:02x}-{:02x}{"
":02x}{:02x}{:02x}{:02x}{:02x}",
s[0], s[1], s[2], s[3], s[4], s[5], s[6], s[7], s[8], s[9], s[10], s[11],
s[12], s[13], s[14], s[15]);
}
ProfileManager::ProfileManager() { ProfileManager::ProfileManager() {
ParseUserSaveFile(); ParseUserSaveFile();
......
...@@ -42,18 +42,9 @@ struct UUID { ...@@ -42,18 +42,9 @@ struct UUID {
void Invalidate() { void Invalidate() {
uuid = INVALID_UUID; uuid = INVALID_UUID;
} }
std::string Format() const {
return fmt::format("0x{:016X}{:016X}", uuid[1], uuid[0]);
}
std::string FormatSwitch() const { std::string Format() const;
std::array<u8, 16> s{}; std::string FormatSwitch() const;
std::memcpy(s.data(), uuid.data(), sizeof(u128));
return fmt::format("{:02x}{:02x}{:02x}{:02x}-{:02x}{:02x}-{:02x}{:02x}-{:02x}{:02x}-{:02x}{"
":02x}{:02x}{:02x}{:02x}{:02x}",
s[0], s[1], s[2], s[3], s[4], s[5], s[6], s[7], s[8], s[9], s[10], s[11],
s[12], s[13], s[14], s[15]);
}
}; };
static_assert(sizeof(UUID) == 16, "UUID is an invalid size!"); static_assert(sizeof(UUID) == 16, "UUID is an invalid size!");
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment