diff options
Diffstat (limited to 'src/core/hle/service/mii')
-rw-r--r-- | src/core/hle/service/mii/mii_manager.cpp | 21 | ||||
-rw-r--r-- | src/core/hle/service/mii/mii_manager.h | 10 |
2 files changed, 11 insertions, 20 deletions
diff --git a/src/core/hle/service/mii/mii_manager.cpp b/src/core/hle/service/mii/mii_manager.cpp index ca4ed35bb..aa1a9a6c7 100644 --- a/src/core/hle/service/mii/mii_manager.cpp +++ b/src/core/hle/service/mii/mii_manager.cpp @@ -118,16 +118,6 @@ u16 GenerateCrc16(const void* data, std::size_t size) { return Common::swap16(static_cast<u16>(crc)); } -Common::UUID GenerateValidUUID() { - auto uuid{Common::UUID::Generate()}; - - // Bit 7 must be set, and bit 6 unset for the UUID to be valid - uuid.uuid[1] &= 0xFFFFFFFFFFFFFF3FULL; - uuid.uuid[1] |= 0x0000000000000080ULL; - - return uuid; -} - template <typename T> T GetRandomValue(T min, T max) { std::random_device device; @@ -141,7 +131,8 @@ T GetRandomValue(T max) { return GetRandomValue<T>({}, max); } -MiiStoreData BuildRandomStoreData(Age age, Gender gender, Race race, const Common::UUID& user_id) { +MiiStoreData BuildRandomStoreData(Age age, Gender gender, Race race, + const Common::NewUUID& user_id) { MiiStoreBitFields bf{}; if (gender == Gender::All) { @@ -320,7 +311,7 @@ MiiStoreData BuildRandomStoreData(Age age, Gender gender, Race race, const Commo return {DefaultMiiName, bf, user_id}; } -MiiStoreData BuildDefaultStoreData(const DefaultMii& info, const Common::UUID& user_id) { +MiiStoreData BuildDefaultStoreData(const DefaultMii& info, const Common::NewUUID& user_id) { MiiStoreBitFields bf{}; bf.font_region.Assign(info.font_region); @@ -381,13 +372,13 @@ MiiStoreData BuildDefaultStoreData(const DefaultMii& info, const Common::UUID& u MiiStoreData::MiiStoreData() = default; MiiStoreData::MiiStoreData(const MiiStoreData::Name& name, const MiiStoreBitFields& bit_fields, - const Common::UUID& user_id) { + const Common::NewUUID& user_id) { data.name = name; - data.uuid = GenerateValidUUID(); + data.uuid = Common::NewUUID::MakeRandomRFC4122V4(); std::memcpy(data.data.data(), &bit_fields, sizeof(MiiStoreBitFields)); data_crc = GenerateCrc16(data.data.data(), sizeof(data)); - device_crc = GenerateCrc16(&user_id, sizeof(Common::UUID)); + device_crc = GenerateCrc16(&user_id, sizeof(Common::NewUUID)); } MiiManager::MiiManager() : user_id{Service::Account::ProfileManager().GetLastOpenedUser()} {} diff --git a/src/core/hle/service/mii/mii_manager.h b/src/core/hle/service/mii/mii_manager.h index 8e048fc56..580a64fc9 100644 --- a/src/core/hle/service/mii/mii_manager.h +++ b/src/core/hle/service/mii/mii_manager.h @@ -8,7 +8,7 @@ #include <vector> #include "common/bit_field.h" #include "common/common_funcs.h" -#include "common/uuid.h" +#include "common/new_uuid.h" #include "core/hle/result.h" #include "core/hle/service/mii/types.h" @@ -29,7 +29,7 @@ enum class SourceFlag : u32 { DECLARE_ENUM_FLAG_OPERATORS(SourceFlag); struct MiiInfo { - Common::UUID uuid; + Common::NewUUID uuid; std::array<char16_t, 11> name; u8 font_region; u8 favorite_color; @@ -192,7 +192,7 @@ struct MiiStoreData { MiiStoreData(); MiiStoreData(const Name& name, const MiiStoreBitFields& bit_fields, - const Common::UUID& user_id); + const Common::NewUUID& user_id); // This corresponds to the above structure MiiStoreBitFields. I did it like this because the // BitField<> type makes this (and any thing that contains it) not trivially copyable, which is @@ -202,7 +202,7 @@ struct MiiStoreData { static_assert(sizeof(MiiStoreBitFields) == sizeof(data), "data field has incorrect size."); Name name{}; - Common::UUID uuid{Common::INVALID_UUID}; + Common::NewUUID uuid{}; } data; u16 data_crc{}; @@ -326,7 +326,7 @@ public: ResultCode GetIndex(const MiiInfo& info, u32& index); private: - const Common::UUID user_id{Common::INVALID_UUID}; + const Common::NewUUID user_id{}; u64 update_counter{}; }; |