summaryrefslogtreecommitdiffstats
path: root/src/core/hle/service/acc/acc.h
diff options
context:
space:
mode:
authorDavid Marcec <dmarcecguzman@gmail.com>2018-08-08 13:09:45 +0200
committerDavid Marcec <dmarcecguzman@gmail.com>2018-08-08 13:09:45 +0200
commit5f8d253ce0a940cdb668861c2c96749c7b9ce626 (patch)
treed5de1ee30b41330d09f78c2b3c2b1bb23257211a /src/core/hle/service/acc/acc.h
parentMerge pull request #972 from lioncash/catch (diff)
downloadyuzu-5f8d253ce0a940cdb668861c2c96749c7b9ce626.tar
yuzu-5f8d253ce0a940cdb668861c2c96749c7b9ce626.tar.gz
yuzu-5f8d253ce0a940cdb668861c2c96749c7b9ce626.tar.bz2
yuzu-5f8d253ce0a940cdb668861c2c96749c7b9ce626.tar.lz
yuzu-5f8d253ce0a940cdb668861c2c96749c7b9ce626.tar.xz
yuzu-5f8d253ce0a940cdb668861c2c96749c7b9ce626.tar.zst
yuzu-5f8d253ce0a940cdb668861c2c96749c7b9ce626.zip
Diffstat (limited to '')
-rw-r--r--src/core/hle/service/acc/acc.h37
1 files changed, 37 insertions, 0 deletions
diff --git a/src/core/hle/service/acc/acc.h b/src/core/hle/service/acc/acc.h
index 88cabaa01..e392b3557 100644
--- a/src/core/hle/service/acc/acc.h
+++ b/src/core/hle/service/acc/acc.h
@@ -8,6 +8,43 @@
namespace Service::Account {
+struct UUID {
+ // UUIDs which are 0 are considered invalid!
+ u128 uuid{0, 0};
+ UUID() = default;
+ explicit UUID(const u128& id) {
+ uuid[0] = id[0];
+ uuid[1] = id[1];
+ };
+ explicit UUID(const u64& lo, const u64& hi) {
+ uuid[0] = lo;
+ uuid[1] = hi;
+ };
+ operator bool() const {
+ return uuid[0] != 0x0 && uuid[1] != 0x0;
+ }
+
+ bool operator==(const UUID& rhs) {
+ return uuid[0] == rhs.uuid[0] && uuid[1] == rhs.uuid[1];
+ }
+
+ bool operator!=(const UUID& rhs) {
+ return uuid[0] != rhs.uuid[0] || uuid[1] != rhs.uuid[1];
+ }
+
+ // TODO(ogniK): Properly generate uuids based on RFC-4122
+ const UUID& Generate() {
+ uuid[0] = (static_cast<u64>(std::rand()) << 32) | std::rand();
+ uuid[1] = (static_cast<u64>(std::rand()) << 32) | std::rand();
+ return *this;
+ }
+
+ std::string Format() {
+ return fmt::format("0x{:016X}{:016X}", uuid[1], uuid[0]);
+ }
+};
+static_assert(sizeof(UUID) == 16, "UUID is an invalid size!");
+
class Module final {
public:
class Interface : public ServiceFramework<Interface> {