summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/core/hle/service/friend/friend.cpp18
-rw-r--r--src/core/hle/service/mii/mii_manager.cpp21
-rw-r--r--src/core/hle/service/mii/mii_manager.h10
-rw-r--r--src/core/hle/service/ns/pdm_qry.cpp6
-rw-r--r--src/core/hle/service/time/clock_types.h8
-rw-r--r--src/core/hle/service/time/steady_clock_core.h8
-rw-r--r--src/core/hle/service/time/time_manager.cpp4
-rw-r--r--src/core/hle/service/time/time_sharedmemory.cpp2
-rw-r--r--src/core/hle/service/time/time_sharedmemory.h4
9 files changed, 36 insertions, 45 deletions
diff --git a/src/core/hle/service/friend/friend.cpp b/src/core/hle/service/friend/friend.cpp
index 9f9cea1e0..3c621f7f0 100644
--- a/src/core/hle/service/friend/friend.cpp
+++ b/src/core/hle/service/friend/friend.cpp
@@ -4,7 +4,7 @@
4 4
5#include <queue> 5#include <queue>
6#include "common/logging/log.h" 6#include "common/logging/log.h"
7#include "common/uuid.h" 7#include "common/new_uuid.h"
8#include "core/core.h" 8#include "core/core.h"
9#include "core/hle/ipc_helpers.h" 9#include "core/hle/ipc_helpers.h"
10#include "core/hle/kernel/k_event.h" 10#include "core/hle/kernel/k_event.h"
@@ -170,10 +170,10 @@ private:
170 void GetPlayHistoryRegistrationKey(Kernel::HLERequestContext& ctx) { 170 void GetPlayHistoryRegistrationKey(Kernel::HLERequestContext& ctx) {
171 IPC::RequestParser rp{ctx}; 171 IPC::RequestParser rp{ctx};
172 const auto local_play = rp.Pop<bool>(); 172 const auto local_play = rp.Pop<bool>();
173 const auto uuid = rp.PopRaw<Common::UUID>(); 173 const auto uuid = rp.PopRaw<Common::NewUUID>();
174 174
175 LOG_WARNING(Service_Friend, "(STUBBED) called, local_play={}, uuid=0x{}", local_play, 175 LOG_WARNING(Service_Friend, "(STUBBED) called, local_play={}, uuid=0x{}", local_play,
176 uuid.Format()); 176 uuid.RawString());
177 177
178 IPC::ResponseBuilder rb{ctx, 2}; 178 IPC::ResponseBuilder rb{ctx, 2};
179 rb.Push(ResultSuccess); 179 rb.Push(ResultSuccess);
@@ -182,11 +182,11 @@ private:
182 void GetFriendList(Kernel::HLERequestContext& ctx) { 182 void GetFriendList(Kernel::HLERequestContext& ctx) {
183 IPC::RequestParser rp{ctx}; 183 IPC::RequestParser rp{ctx};
184 const auto friend_offset = rp.Pop<u32>(); 184 const auto friend_offset = rp.Pop<u32>();
185 const auto uuid = rp.PopRaw<Common::UUID>(); 185 const auto uuid = rp.PopRaw<Common::NewUUID>();
186 [[maybe_unused]] const auto filter = rp.PopRaw<SizedFriendFilter>(); 186 [[maybe_unused]] const auto filter = rp.PopRaw<SizedFriendFilter>();
187 const auto pid = rp.Pop<u64>(); 187 const auto pid = rp.Pop<u64>();
188 LOG_WARNING(Service_Friend, "(STUBBED) called, offset={}, uuid=0x{}, pid={}", friend_offset, 188 LOG_WARNING(Service_Friend, "(STUBBED) called, offset={}, uuid=0x{}, pid={}", friend_offset,
189 uuid.Format(), pid); 189 uuid.RawString(), pid);
190 190
191 IPC::ResponseBuilder rb{ctx, 3}; 191 IPC::ResponseBuilder rb{ctx, 3};
192 rb.Push(ResultSuccess); 192 rb.Push(ResultSuccess);
@@ -202,7 +202,7 @@ private:
202 202
203class INotificationService final : public ServiceFramework<INotificationService> { 203class INotificationService final : public ServiceFramework<INotificationService> {
204public: 204public:
205 explicit INotificationService(Core::System& system_, Common::UUID uuid_) 205 explicit INotificationService(Core::System& system_, Common::NewUUID uuid_)
206 : ServiceFramework{system_, "INotificationService"}, uuid{uuid_}, 206 : ServiceFramework{system_, "INotificationService"}, uuid{uuid_},
207 service_context{system_, "INotificationService"} { 207 service_context{system_, "INotificationService"} {
208 // clang-format off 208 // clang-format off
@@ -293,7 +293,7 @@ private:
293 bool has_received_friend_request; 293 bool has_received_friend_request;
294 }; 294 };
295 295
296 Common::UUID uuid; 296 Common::NewUUID uuid;
297 KernelHelpers::ServiceContext service_context; 297 KernelHelpers::ServiceContext service_context;
298 298
299 Kernel::KEvent* notification_event; 299 Kernel::KEvent* notification_event;
@@ -310,9 +310,9 @@ void Module::Interface::CreateFriendService(Kernel::HLERequestContext& ctx) {
310 310
311void Module::Interface::CreateNotificationService(Kernel::HLERequestContext& ctx) { 311void Module::Interface::CreateNotificationService(Kernel::HLERequestContext& ctx) {
312 IPC::RequestParser rp{ctx}; 312 IPC::RequestParser rp{ctx};
313 auto uuid = rp.PopRaw<Common::UUID>(); 313 auto uuid = rp.PopRaw<Common::NewUUID>();
314 314
315 LOG_DEBUG(Service_Friend, "called, uuid=0x{}", uuid.Format()); 315 LOG_DEBUG(Service_Friend, "called, uuid=0x{}", uuid.RawString());
316 316
317 IPC::ResponseBuilder rb{ctx, 2, 0, 1}; 317 IPC::ResponseBuilder rb{ctx, 2, 0, 1};
318 rb.Push(ResultSuccess); 318 rb.Push(ResultSuccess);
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) {
118 return Common::swap16(static_cast<u16>(crc)); 118 return Common::swap16(static_cast<u16>(crc));
119} 119}
120 120
121Common::UUID GenerateValidUUID() {
122 auto uuid{Common::UUID::Generate()};
123
124 // Bit 7 must be set, and bit 6 unset for the UUID to be valid
125 uuid.uuid[1] &= 0xFFFFFFFFFFFFFF3FULL;
126 uuid.uuid[1] |= 0x0000000000000080ULL;
127
128 return uuid;
129}
130
131template <typename T> 121template <typename T>
132T GetRandomValue(T min, T max) { 122T GetRandomValue(T min, T max) {
133 std::random_device device; 123 std::random_device device;
@@ -141,7 +131,8 @@ T GetRandomValue(T max) {
141 return GetRandomValue<T>({}, max); 131 return GetRandomValue<T>({}, max);
142} 132}
143 133
144MiiStoreData BuildRandomStoreData(Age age, Gender gender, Race race, const Common::UUID& user_id) { 134MiiStoreData BuildRandomStoreData(Age age, Gender gender, Race race,
135 const Common::NewUUID& user_id) {
145 MiiStoreBitFields bf{}; 136 MiiStoreBitFields bf{};
146 137
147 if (gender == Gender::All) { 138 if (gender == Gender::All) {
@@ -320,7 +311,7 @@ MiiStoreData BuildRandomStoreData(Age age, Gender gender, Race race, const Commo
320 return {DefaultMiiName, bf, user_id}; 311 return {DefaultMiiName, bf, user_id};
321} 312}
322 313
323MiiStoreData BuildDefaultStoreData(const DefaultMii& info, const Common::UUID& user_id) { 314MiiStoreData BuildDefaultStoreData(const DefaultMii& info, const Common::NewUUID& user_id) {
324 MiiStoreBitFields bf{}; 315 MiiStoreBitFields bf{};
325 316
326 bf.font_region.Assign(info.font_region); 317 bf.font_region.Assign(info.font_region);
@@ -381,13 +372,13 @@ MiiStoreData BuildDefaultStoreData(const DefaultMii& info, const Common::UUID& u
381MiiStoreData::MiiStoreData() = default; 372MiiStoreData::MiiStoreData() = default;
382 373
383MiiStoreData::MiiStoreData(const MiiStoreData::Name& name, const MiiStoreBitFields& bit_fields, 374MiiStoreData::MiiStoreData(const MiiStoreData::Name& name, const MiiStoreBitFields& bit_fields,
384 const Common::UUID& user_id) { 375 const Common::NewUUID& user_id) {
385 data.name = name; 376 data.name = name;
386 data.uuid = GenerateValidUUID(); 377 data.uuid = Common::NewUUID::MakeRandomRFC4122V4();
387 378
388 std::memcpy(data.data.data(), &bit_fields, sizeof(MiiStoreBitFields)); 379 std::memcpy(data.data.data(), &bit_fields, sizeof(MiiStoreBitFields));
389 data_crc = GenerateCrc16(data.data.data(), sizeof(data)); 380 data_crc = GenerateCrc16(data.data.data(), sizeof(data));
390 device_crc = GenerateCrc16(&user_id, sizeof(Common::UUID)); 381 device_crc = GenerateCrc16(&user_id, sizeof(Common::NewUUID));
391} 382}
392 383
393MiiManager::MiiManager() : user_id{Service::Account::ProfileManager().GetLastOpenedUser()} {} 384MiiManager::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 @@
8#include <vector> 8#include <vector>
9#include "common/bit_field.h" 9#include "common/bit_field.h"
10#include "common/common_funcs.h" 10#include "common/common_funcs.h"
11#include "common/uuid.h" 11#include "common/new_uuid.h"
12#include "core/hle/result.h" 12#include "core/hle/result.h"
13#include "core/hle/service/mii/types.h" 13#include "core/hle/service/mii/types.h"
14 14
@@ -29,7 +29,7 @@ enum class SourceFlag : u32 {
29DECLARE_ENUM_FLAG_OPERATORS(SourceFlag); 29DECLARE_ENUM_FLAG_OPERATORS(SourceFlag);
30 30
31struct MiiInfo { 31struct MiiInfo {
32 Common::UUID uuid; 32 Common::NewUUID uuid;
33 std::array<char16_t, 11> name; 33 std::array<char16_t, 11> name;
34 u8 font_region; 34 u8 font_region;
35 u8 favorite_color; 35 u8 favorite_color;
@@ -192,7 +192,7 @@ struct MiiStoreData {
192 192
193 MiiStoreData(); 193 MiiStoreData();
194 MiiStoreData(const Name& name, const MiiStoreBitFields& bit_fields, 194 MiiStoreData(const Name& name, const MiiStoreBitFields& bit_fields,
195 const Common::UUID& user_id); 195 const Common::NewUUID& user_id);
196 196
197 // This corresponds to the above structure MiiStoreBitFields. I did it like this because the 197 // This corresponds to the above structure MiiStoreBitFields. I did it like this because the
198 // BitField<> type makes this (and any thing that contains it) not trivially copyable, which is 198 // BitField<> type makes this (and any thing that contains it) not trivially copyable, which is
@@ -202,7 +202,7 @@ struct MiiStoreData {
202 static_assert(sizeof(MiiStoreBitFields) == sizeof(data), "data field has incorrect size."); 202 static_assert(sizeof(MiiStoreBitFields) == sizeof(data), "data field has incorrect size.");
203 203
204 Name name{}; 204 Name name{};
205 Common::UUID uuid{Common::INVALID_UUID}; 205 Common::NewUUID uuid{};
206 } data; 206 } data;
207 207
208 u16 data_crc{}; 208 u16 data_crc{};
@@ -326,7 +326,7 @@ public:
326 ResultCode GetIndex(const MiiInfo& info, u32& index); 326 ResultCode GetIndex(const MiiInfo& info, u32& index);
327 327
328private: 328private:
329 const Common::UUID user_id{Common::INVALID_UUID}; 329 const Common::NewUUID user_id{};
330 u64 update_counter{}; 330 u64 update_counter{};
331}; 331};
332 332
diff --git a/src/core/hle/service/ns/pdm_qry.cpp b/src/core/hle/service/ns/pdm_qry.cpp
index e2fab5c3f..3eda444d2 100644
--- a/src/core/hle/service/ns/pdm_qry.cpp
+++ b/src/core/hle/service/ns/pdm_qry.cpp
@@ -5,7 +5,7 @@
5#include <memory> 5#include <memory>
6 6
7#include "common/logging/log.h" 7#include "common/logging/log.h"
8#include "common/uuid.h" 8#include "common/new_uuid.h"
9#include "core/hle/ipc_helpers.h" 9#include "core/hle/ipc_helpers.h"
10#include "core/hle/service/ns/pdm_qry.h" 10#include "core/hle/service/ns/pdm_qry.h"
11#include "core/hle/service/service.h" 11#include "core/hle/service/service.h"
@@ -49,7 +49,7 @@ void PDM_QRY::QueryPlayStatisticsByApplicationIdAndUserAccountId(Kernel::HLERequ
49 const auto unknown = rp.Pop<bool>(); 49 const auto unknown = rp.Pop<bool>();
50 rp.Pop<u8>(); // Padding 50 rp.Pop<u8>(); // Padding
51 const auto application_id = rp.Pop<u64>(); 51 const auto application_id = rp.Pop<u64>();
52 const auto user_account_uid = rp.PopRaw<Common::UUID>(); 52 const auto user_account_uid = rp.PopRaw<Common::NewUUID>();
53 53
54 // TODO(German77): Read statistics of the game 54 // TODO(German77): Read statistics of the game
55 PlayStatistics statistics{ 55 PlayStatistics statistics{
@@ -59,7 +59,7 @@ void PDM_QRY::QueryPlayStatisticsByApplicationIdAndUserAccountId(Kernel::HLERequ
59 59
60 LOG_WARNING(Service_NS, 60 LOG_WARNING(Service_NS,
61 "(STUBBED) called. unknown={}. application_id=0x{:016X}, user_account_uid=0x{}", 61 "(STUBBED) called. unknown={}. application_id=0x{:016X}, user_account_uid=0x{}",
62 unknown, application_id, user_account_uid.Format()); 62 unknown, application_id, user_account_uid.RawString());
63 63
64 IPC::ResponseBuilder rb{ctx, 12}; 64 IPC::ResponseBuilder rb{ctx, 12};
65 rb.Push(ResultSuccess); 65 rb.Push(ResultSuccess);
diff --git a/src/core/hle/service/time/clock_types.h b/src/core/hle/service/time/clock_types.h
index 392e16863..23d6c859b 100644
--- a/src/core/hle/service/time/clock_types.h
+++ b/src/core/hle/service/time/clock_types.h
@@ -6,7 +6,7 @@
6 6
7#include "common/common_funcs.h" 7#include "common/common_funcs.h"
8#include "common/common_types.h" 8#include "common/common_types.h"
9#include "common/uuid.h" 9#include "common/new_uuid.h"
10#include "core/hle/service/time/errors.h" 10#include "core/hle/service/time/errors.h"
11#include "core/hle/service/time/time_zone_types.h" 11#include "core/hle/service/time/time_zone_types.h"
12 12
@@ -21,7 +21,7 @@ enum class TimeType : u8 {
21/// https://switchbrew.org/wiki/Glue_services#SteadyClockTimePoint 21/// https://switchbrew.org/wiki/Glue_services#SteadyClockTimePoint
22struct SteadyClockTimePoint { 22struct SteadyClockTimePoint {
23 s64 time_point; 23 s64 time_point;
24 Common::UUID clock_source_id; 24 Common::NewUUID clock_source_id;
25 25
26 ResultCode GetSpanBetween(SteadyClockTimePoint other, s64& span) const { 26 ResultCode GetSpanBetween(SteadyClockTimePoint other, s64& span) const {
27 span = 0; 27 span = 0;
@@ -36,7 +36,7 @@ struct SteadyClockTimePoint {
36 } 36 }
37 37
38 static SteadyClockTimePoint GetRandom() { 38 static SteadyClockTimePoint GetRandom() {
39 return {0, Common::UUID::Generate()}; 39 return {0, Common::NewUUID::MakeRandom()};
40 } 40 }
41}; 41};
42static_assert(sizeof(SteadyClockTimePoint) == 0x18, "SteadyClockTimePoint is incorrect size"); 42static_assert(sizeof(SteadyClockTimePoint) == 0x18, "SteadyClockTimePoint is incorrect size");
@@ -45,7 +45,7 @@ static_assert(std::is_trivially_copyable_v<SteadyClockTimePoint>,
45 45
46struct SteadyClockContext { 46struct SteadyClockContext {
47 u64 internal_offset; 47 u64 internal_offset;
48 Common::UUID steady_time_point; 48 Common::NewUUID steady_time_point;
49}; 49};
50static_assert(sizeof(SteadyClockContext) == 0x18, "SteadyClockContext is incorrect size"); 50static_assert(sizeof(SteadyClockContext) == 0x18, "SteadyClockContext is incorrect size");
51static_assert(std::is_trivially_copyable_v<SteadyClockContext>, 51static_assert(std::is_trivially_copyable_v<SteadyClockContext>,
diff --git a/src/core/hle/service/time/steady_clock_core.h b/src/core/hle/service/time/steady_clock_core.h
index d80a2385f..dfc9fade4 100644
--- a/src/core/hle/service/time/steady_clock_core.h
+++ b/src/core/hle/service/time/steady_clock_core.h
@@ -4,7 +4,7 @@
4 4
5#pragma once 5#pragma once
6 6
7#include "common/uuid.h" 7#include "common/new_uuid.h"
8#include "core/hle/service/time/clock_types.h" 8#include "core/hle/service/time/clock_types.h"
9 9
10namespace Core { 10namespace Core {
@@ -18,11 +18,11 @@ public:
18 SteadyClockCore() = default; 18 SteadyClockCore() = default;
19 virtual ~SteadyClockCore() = default; 19 virtual ~SteadyClockCore() = default;
20 20
21 const Common::UUID& GetClockSourceId() const { 21 const Common::NewUUID& GetClockSourceId() const {
22 return clock_source_id; 22 return clock_source_id;
23 } 23 }
24 24
25 void SetClockSourceId(const Common::UUID& value) { 25 void SetClockSourceId(const Common::NewUUID& value) {
26 clock_source_id = value; 26 clock_source_id = value;
27 } 27 }
28 28
@@ -49,7 +49,7 @@ public:
49 } 49 }
50 50
51private: 51private:
52 Common::UUID clock_source_id{Common::UUID::Generate()}; 52 Common::NewUUID clock_source_id{Common::NewUUID::MakeRandom()};
53 bool is_initialized{}; 53 bool is_initialized{};
54}; 54};
55 55
diff --git a/src/core/hle/service/time/time_manager.cpp b/src/core/hle/service/time/time_manager.cpp
index c1e4e6cce..15a2d99e8 100644
--- a/src/core/hle/service/time/time_manager.cpp
+++ b/src/core/hle/service/time/time_manager.cpp
@@ -45,7 +45,7 @@ struct TimeManager::Impl final {
45 time_zone_content_manager{system} { 45 time_zone_content_manager{system} {
46 46
47 const auto system_time{Clock::TimeSpanType::FromSeconds(GetExternalRtcValue())}; 47 const auto system_time{Clock::TimeSpanType::FromSeconds(GetExternalRtcValue())};
48 SetupStandardSteadyClock(system, Common::UUID::Generate(), system_time, {}, {}); 48 SetupStandardSteadyClock(system, Common::NewUUID::MakeRandom(), system_time, {}, {});
49 SetupStandardLocalSystemClock(system, {}, system_time.ToSeconds()); 49 SetupStandardLocalSystemClock(system, {}, system_time.ToSeconds());
50 50
51 Clock::SystemClockContext clock_context{}; 51 Clock::SystemClockContext clock_context{};
@@ -132,7 +132,7 @@ struct TimeManager::Impl final {
132 return 0; 132 return 0;
133 } 133 }
134 134
135 void SetupStandardSteadyClock(Core::System& system_, Common::UUID clock_source_id, 135 void SetupStandardSteadyClock(Core::System& system_, Common::NewUUID clock_source_id,
136 Clock::TimeSpanType setup_value, 136 Clock::TimeSpanType setup_value,
137 Clock::TimeSpanType internal_offset, bool is_rtc_reset_detected) { 137 Clock::TimeSpanType internal_offset, bool is_rtc_reset_detected) {
138 standard_steady_clock_core.SetClockSourceId(clock_source_id); 138 standard_steady_clock_core.SetClockSourceId(clock_source_id);
diff --git a/src/core/hle/service/time/time_sharedmemory.cpp b/src/core/hle/service/time/time_sharedmemory.cpp
index ed9f75ed6..ac31cd9ca 100644
--- a/src/core/hle/service/time/time_sharedmemory.cpp
+++ b/src/core/hle/service/time/time_sharedmemory.cpp
@@ -20,7 +20,7 @@ SharedMemory::SharedMemory(Core::System& system_) : system(system_) {
20 20
21SharedMemory::~SharedMemory() = default; 21SharedMemory::~SharedMemory() = default;
22 22
23void SharedMemory::SetupStandardSteadyClock(const Common::UUID& clock_source_id, 23void SharedMemory::SetupStandardSteadyClock(const Common::NewUUID& clock_source_id,
24 Clock::TimeSpanType current_time_point) { 24 Clock::TimeSpanType current_time_point) {
25 const Clock::TimeSpanType ticks_time_span{Clock::TimeSpanType::FromTicks( 25 const Clock::TimeSpanType ticks_time_span{Clock::TimeSpanType::FromTicks(
26 system.CoreTiming().GetClockTicks(), Core::Hardware::CNTFREQ)}; 26 system.CoreTiming().GetClockTicks(), Core::Hardware::CNTFREQ)};
diff --git a/src/core/hle/service/time/time_sharedmemory.h b/src/core/hle/service/time/time_sharedmemory.h
index 9307ea795..4063ce4e0 100644
--- a/src/core/hle/service/time/time_sharedmemory.h
+++ b/src/core/hle/service/time/time_sharedmemory.h
@@ -5,7 +5,7 @@
5#pragma once 5#pragma once
6 6
7#include "common/common_types.h" 7#include "common/common_types.h"
8#include "common/uuid.h" 8#include "common/new_uuid.h"
9#include "core/hle/kernel/k_shared_memory.h" 9#include "core/hle/kernel/k_shared_memory.h"
10#include "core/hle/service/time/clock_types.h" 10#include "core/hle/service/time/clock_types.h"
11 11
@@ -52,7 +52,7 @@ public:
52 }; 52 };
53 static_assert(sizeof(Format) == 0xd8, "Format is an invalid size"); 53 static_assert(sizeof(Format) == 0xd8, "Format is an invalid size");
54 54
55 void SetupStandardSteadyClock(const Common::UUID& clock_source_id, 55 void SetupStandardSteadyClock(const Common::NewUUID& clock_source_id,
56 Clock::TimeSpanType current_time_point); 56 Clock::TimeSpanType current_time_point);
57 void UpdateLocalSystemClockContext(const Clock::SystemClockContext& context); 57 void UpdateLocalSystemClockContext(const Clock::SystemClockContext& context);
58 void UpdateNetworkSystemClockContext(const Clock::SystemClockContext& context); 58 void UpdateNetworkSystemClockContext(const Clock::SystemClockContext& context);