From cb30fe50cd074fe05dd1d6e4b0d58116d3d98489 Mon Sep 17 00:00:00 2001 From: Morph <39850852+Morph1984@users.noreply.github.com> Date: Sat, 5 Feb 2022 00:40:28 -0500 Subject: input/hid: Migrate to the new UUID implementation --- src/core/hid/emulated_controller.cpp | 23 ++++++++++++----------- src/core/hid/emulated_controller.h | 6 +++--- src/core/hid/hid_types.h | 2 +- 3 files changed, 16 insertions(+), 15 deletions(-) (limited to 'src/core') diff --git a/src/core/hid/emulated_controller.cpp b/src/core/hid/emulated_controller.cpp index a7cdf45e6..44e9f22b9 100644 --- a/src/core/hid/emulated_controller.cpp +++ b/src/core/hid/emulated_controller.cpp @@ -204,7 +204,7 @@ void EmulatedController::ReloadInput() { if (!button_devices[index]) { continue; } - const auto uuid = Common::UUID{button_params[index].Get("guid", "")}; + const auto uuid = Common::NewUUID{button_params[index].Get("guid", "")}; button_devices[index]->SetCallback({ .on_change = [this, index, uuid](const Common::Input::CallbackStatus& callback) { @@ -218,7 +218,7 @@ void EmulatedController::ReloadInput() { if (!stick_devices[index]) { continue; } - const auto uuid = Common::UUID{stick_params[index].Get("guid", "")}; + const auto uuid = Common::NewUUID{stick_params[index].Get("guid", "")}; stick_devices[index]->SetCallback({ .on_change = [this, index, uuid](const Common::Input::CallbackStatus& callback) { @@ -232,7 +232,7 @@ void EmulatedController::ReloadInput() { if (!trigger_devices[index]) { continue; } - const auto uuid = Common::UUID{trigger_params[index].Get("guid", "")}; + const auto uuid = Common::NewUUID{trigger_params[index].Get("guid", "")}; trigger_devices[index]->SetCallback({ .on_change = [this, index, uuid](const Common::Input::CallbackStatus& callback) { @@ -269,7 +269,8 @@ void EmulatedController::ReloadInput() { } // Use a common UUID for TAS - const auto tas_uuid = Common::UUID{0x0, 0x7A5}; + static constexpr Common::NewUUID TAS_UUID = Common::NewUUID{ + {0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x7, 0xA5, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0}}; // Register TAS devices. No need to force update for (std::size_t index = 0; index < tas_button_devices.size(); ++index) { @@ -278,8 +279,8 @@ void EmulatedController::ReloadInput() { } tas_button_devices[index]->SetCallback({ .on_change = - [this, index, tas_uuid](const Common::Input::CallbackStatus& callback) { - SetButton(callback, index, tas_uuid); + [this, index](const Common::Input::CallbackStatus& callback) { + SetButton(callback, index, TAS_UUID); }, }); } @@ -290,8 +291,8 @@ void EmulatedController::ReloadInput() { } tas_stick_devices[index]->SetCallback({ .on_change = - [this, index, tas_uuid](const Common::Input::CallbackStatus& callback) { - SetStick(callback, index, tas_uuid); + [this, index](const Common::Input::CallbackStatus& callback) { + SetStick(callback, index, TAS_UUID); }, }); } @@ -489,7 +490,7 @@ void EmulatedController::SetMotionParam(std::size_t index, Common::ParamPackage } void EmulatedController::SetButton(const Common::Input::CallbackStatus& callback, std::size_t index, - Common::UUID uuid) { + Common::NewUUID uuid) { if (index >= controller.button_values.size()) { return; } @@ -638,7 +639,7 @@ void EmulatedController::SetButton(const Common::Input::CallbackStatus& callback } void EmulatedController::SetStick(const Common::Input::CallbackStatus& callback, std::size_t index, - Common::UUID uuid) { + Common::NewUUID uuid) { if (index >= controller.stick_values.size()) { return; } @@ -688,7 +689,7 @@ void EmulatedController::SetStick(const Common::Input::CallbackStatus& callback, } void EmulatedController::SetTrigger(const Common::Input::CallbackStatus& callback, - std::size_t index, Common::UUID uuid) { + std::size_t index, Common::NewUUID uuid) { if (index >= controller.trigger_values.size()) { return; } diff --git a/src/core/hid/emulated_controller.h b/src/core/hid/emulated_controller.h index d8642c5b3..ed61e9522 100644 --- a/src/core/hid/emulated_controller.h +++ b/src/core/hid/emulated_controller.h @@ -354,7 +354,7 @@ private: * @param index Button ID of the to be updated */ void SetButton(const Common::Input::CallbackStatus& callback, std::size_t index, - Common::UUID uuid); + Common::NewUUID uuid); /** * Updates the analog stick status of the controller @@ -362,7 +362,7 @@ private: * @param index stick ID of the to be updated */ void SetStick(const Common::Input::CallbackStatus& callback, std::size_t index, - Common::UUID uuid); + Common::NewUUID uuid); /** * Updates the trigger status of the controller @@ -370,7 +370,7 @@ private: * @param index trigger ID of the to be updated */ void SetTrigger(const Common::Input::CallbackStatus& callback, std::size_t index, - Common::UUID uuid); + Common::NewUUID uuid); /** * Updates the motion status of the controller diff --git a/src/core/hid/hid_types.h b/src/core/hid/hid_types.h index 778b328b9..a4ccdf11c 100644 --- a/src/core/hid/hid_types.h +++ b/src/core/hid/hid_types.h @@ -7,8 +7,8 @@ #include "common/bit_field.h" #include "common/common_funcs.h" #include "common/common_types.h" +#include "common/new_uuid.h" #include "common/point.h" -#include "common/uuid.h" namespace Core::HID { -- cgit v1.2.3 From ee0547e4c4d38d681d9cd3b9f7071c4dade9110d Mon Sep 17 00:00:00 2001 From: Morph <39850852+Morph1984@users.noreply.github.com> Date: Sat, 5 Feb 2022 00:40:48 -0500 Subject: service: Migrate to the new UUID implementation --- src/core/hle/service/friend/friend.cpp | 18 +++++++++--------- src/core/hle/service/mii/mii_manager.cpp | 21 ++++++--------------- src/core/hle/service/mii/mii_manager.h | 10 +++++----- src/core/hle/service/ns/pdm_qry.cpp | 6 +++--- src/core/hle/service/time/clock_types.h | 8 ++++---- src/core/hle/service/time/steady_clock_core.h | 8 ++++---- src/core/hle/service/time/time_manager.cpp | 4 ++-- src/core/hle/service/time/time_sharedmemory.cpp | 2 +- src/core/hle/service/time/time_sharedmemory.h | 4 ++-- 9 files changed, 36 insertions(+), 45 deletions(-) (limited to 'src/core') 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 @@ #include #include "common/logging/log.h" -#include "common/uuid.h" +#include "common/new_uuid.h" #include "core/core.h" #include "core/hle/ipc_helpers.h" #include "core/hle/kernel/k_event.h" @@ -170,10 +170,10 @@ private: void GetPlayHistoryRegistrationKey(Kernel::HLERequestContext& ctx) { IPC::RequestParser rp{ctx}; const auto local_play = rp.Pop(); - const auto uuid = rp.PopRaw(); + const auto uuid = rp.PopRaw(); LOG_WARNING(Service_Friend, "(STUBBED) called, local_play={}, uuid=0x{}", local_play, - uuid.Format()); + uuid.RawString()); IPC::ResponseBuilder rb{ctx, 2}; rb.Push(ResultSuccess); @@ -182,11 +182,11 @@ private: void GetFriendList(Kernel::HLERequestContext& ctx) { IPC::RequestParser rp{ctx}; const auto friend_offset = rp.Pop(); - const auto uuid = rp.PopRaw(); + const auto uuid = rp.PopRaw(); [[maybe_unused]] const auto filter = rp.PopRaw(); const auto pid = rp.Pop(); LOG_WARNING(Service_Friend, "(STUBBED) called, offset={}, uuid=0x{}, pid={}", friend_offset, - uuid.Format(), pid); + uuid.RawString(), pid); IPC::ResponseBuilder rb{ctx, 3}; rb.Push(ResultSuccess); @@ -202,7 +202,7 @@ private: class INotificationService final : public ServiceFramework { public: - explicit INotificationService(Core::System& system_, Common::UUID uuid_) + explicit INotificationService(Core::System& system_, Common::NewUUID uuid_) : ServiceFramework{system_, "INotificationService"}, uuid{uuid_}, service_context{system_, "INotificationService"} { // clang-format off @@ -293,7 +293,7 @@ private: bool has_received_friend_request; }; - Common::UUID uuid; + Common::NewUUID uuid; KernelHelpers::ServiceContext service_context; Kernel::KEvent* notification_event; @@ -310,9 +310,9 @@ void Module::Interface::CreateFriendService(Kernel::HLERequestContext& ctx) { void Module::Interface::CreateNotificationService(Kernel::HLERequestContext& ctx) { IPC::RequestParser rp{ctx}; - auto uuid = rp.PopRaw(); + auto uuid = rp.PopRaw(); - LOG_DEBUG(Service_Friend, "called, uuid=0x{}", uuid.Format()); + LOG_DEBUG(Service_Friend, "called, uuid=0x{}", uuid.RawString()); IPC::ResponseBuilder rb{ctx, 2, 0, 1}; 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) { return Common::swap16(static_cast(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 T GetRandomValue(T min, T max) { std::random_device device; @@ -141,7 +131,8 @@ T GetRandomValue(T max) { return GetRandomValue({}, 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 #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 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{}; }; 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 @@ #include #include "common/logging/log.h" -#include "common/uuid.h" +#include "common/new_uuid.h" #include "core/hle/ipc_helpers.h" #include "core/hle/service/ns/pdm_qry.h" #include "core/hle/service/service.h" @@ -49,7 +49,7 @@ void PDM_QRY::QueryPlayStatisticsByApplicationIdAndUserAccountId(Kernel::HLERequ const auto unknown = rp.Pop(); rp.Pop(); // Padding const auto application_id = rp.Pop(); - const auto user_account_uid = rp.PopRaw(); + const auto user_account_uid = rp.PopRaw(); // TODO(German77): Read statistics of the game PlayStatistics statistics{ @@ -59,7 +59,7 @@ void PDM_QRY::QueryPlayStatisticsByApplicationIdAndUserAccountId(Kernel::HLERequ LOG_WARNING(Service_NS, "(STUBBED) called. unknown={}. application_id=0x{:016X}, user_account_uid=0x{}", - unknown, application_id, user_account_uid.Format()); + unknown, application_id, user_account_uid.RawString()); IPC::ResponseBuilder rb{ctx, 12}; 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 @@ #include "common/common_funcs.h" #include "common/common_types.h" -#include "common/uuid.h" +#include "common/new_uuid.h" #include "core/hle/service/time/errors.h" #include "core/hle/service/time/time_zone_types.h" @@ -21,7 +21,7 @@ enum class TimeType : u8 { /// https://switchbrew.org/wiki/Glue_services#SteadyClockTimePoint struct SteadyClockTimePoint { s64 time_point; - Common::UUID clock_source_id; + Common::NewUUID clock_source_id; ResultCode GetSpanBetween(SteadyClockTimePoint other, s64& span) const { span = 0; @@ -36,7 +36,7 @@ struct SteadyClockTimePoint { } static SteadyClockTimePoint GetRandom() { - return {0, Common::UUID::Generate()}; + return {0, Common::NewUUID::MakeRandom()}; } }; static_assert(sizeof(SteadyClockTimePoint) == 0x18, "SteadyClockTimePoint is incorrect size"); @@ -45,7 +45,7 @@ static_assert(std::is_trivially_copyable_v, struct SteadyClockContext { u64 internal_offset; - Common::UUID steady_time_point; + Common::NewUUID steady_time_point; }; static_assert(sizeof(SteadyClockContext) == 0x18, "SteadyClockContext is incorrect size"); static_assert(std::is_trivially_copyable_v, 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 @@ #pragma once -#include "common/uuid.h" +#include "common/new_uuid.h" #include "core/hle/service/time/clock_types.h" namespace Core { @@ -18,11 +18,11 @@ public: SteadyClockCore() = default; virtual ~SteadyClockCore() = default; - const Common::UUID& GetClockSourceId() const { + const Common::NewUUID& GetClockSourceId() const { return clock_source_id; } - void SetClockSourceId(const Common::UUID& value) { + void SetClockSourceId(const Common::NewUUID& value) { clock_source_id = value; } @@ -49,7 +49,7 @@ public: } private: - Common::UUID clock_source_id{Common::UUID::Generate()}; + Common::NewUUID clock_source_id{Common::NewUUID::MakeRandom()}; bool is_initialized{}; }; 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 { time_zone_content_manager{system} { const auto system_time{Clock::TimeSpanType::FromSeconds(GetExternalRtcValue())}; - SetupStandardSteadyClock(system, Common::UUID::Generate(), system_time, {}, {}); + SetupStandardSteadyClock(system, Common::NewUUID::MakeRandom(), system_time, {}, {}); SetupStandardLocalSystemClock(system, {}, system_time.ToSeconds()); Clock::SystemClockContext clock_context{}; @@ -132,7 +132,7 @@ struct TimeManager::Impl final { return 0; } - void SetupStandardSteadyClock(Core::System& system_, Common::UUID clock_source_id, + void SetupStandardSteadyClock(Core::System& system_, Common::NewUUID clock_source_id, Clock::TimeSpanType setup_value, Clock::TimeSpanType internal_offset, bool is_rtc_reset_detected) { 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_) { SharedMemory::~SharedMemory() = default; -void SharedMemory::SetupStandardSteadyClock(const Common::UUID& clock_source_id, +void SharedMemory::SetupStandardSteadyClock(const Common::NewUUID& clock_source_id, Clock::TimeSpanType current_time_point) { const Clock::TimeSpanType ticks_time_span{Clock::TimeSpanType::FromTicks( 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 @@ #pragma once #include "common/common_types.h" -#include "common/uuid.h" +#include "common/new_uuid.h" #include "core/hle/kernel/k_shared_memory.h" #include "core/hle/service/time/clock_types.h" @@ -52,7 +52,7 @@ public: }; static_assert(sizeof(Format) == 0xd8, "Format is an invalid size"); - void SetupStandardSteadyClock(const Common::UUID& clock_source_id, + void SetupStandardSteadyClock(const Common::NewUUID& clock_source_id, Clock::TimeSpanType current_time_point); void UpdateLocalSystemClockContext(const Clock::SystemClockContext& context); void UpdateNetworkSystemClockContext(const Clock::SystemClockContext& context); -- cgit v1.2.3 From f0340b8d22c8e2d9319726b8d90f9b3a3636882e Mon Sep 17 00:00:00 2001 From: Morph <39850852+Morph1984@users.noreply.github.com> Date: Sat, 5 Feb 2022 11:29:44 -0500 Subject: hle: ipc_helpers: Ignore -Wclass-memaccess This warning is triggered by GCC when copying into non-trivially default constructible types, as it uses the more restrictive std::is_trivial (which includes std::is_trivially_default_constructible) to determine whether memcpy is safe instead of std::is_trivially_copyable. --- src/core/hle/ipc_helpers.h | 8 ++++++++ 1 file changed, 8 insertions(+) (limited to 'src/core') diff --git a/src/core/hle/ipc_helpers.h b/src/core/hle/ipc_helpers.h index cf204f570..026257115 100644 --- a/src/core/hle/ipc_helpers.h +++ b/src/core/hle/ipc_helpers.h @@ -404,6 +404,11 @@ inline s32 RequestParser::Pop() { return static_cast(Pop()); } +// Ignore the -Wclass-memaccess warning on memcpy for non-trivially default constructible objects. +#if defined(__GNUC__) +#pragma GCC diagnostic push +#pragma GCC diagnostic ignored "-Wclass-memaccess" +#endif template void RequestParser::PopRaw(T& value) { static_assert(std::is_trivially_copyable_v, @@ -411,6 +416,9 @@ void RequestParser::PopRaw(T& value) { std::memcpy(&value, cmdbuf + index, sizeof(T)); index += (sizeof(T) + 3) / 4; // round up to word length } +#if defined(__GNUC__) +#pragma GCC diagnostic pop +#endif template T RequestParser::PopRaw() { -- cgit v1.2.3 From dfe11d72e3eb14dee718b7fa67a673514d199f20 Mon Sep 17 00:00:00 2001 From: Morph <39850852+Morph1984@users.noreply.github.com> Date: Sat, 5 Feb 2022 12:29:09 -0500 Subject: profile: Migrate to the new UUID implementation --- src/core/frontend/applets/profile_select.cpp | 5 +- src/core/frontend/applets/profile_select.h | 7 +- src/core/hle/service/acc/acc.cpp | 93 +++++++++++----------- src/core/hle/service/acc/acc.h | 4 +- src/core/hle/service/acc/profile_manager.cpp | 51 ++++++------ src/core/hle/service/acc/profile_manager.h | 38 ++++----- src/core/hle/service/am/am.cpp | 6 +- .../service/am/applets/applet_profile_select.cpp | 9 ++- .../hle/service/am/applets/applet_profile_select.h | 6 +- 9 files changed, 111 insertions(+), 108 deletions(-) (limited to 'src/core') diff --git a/src/core/frontend/applets/profile_select.cpp b/src/core/frontend/applets/profile_select.cpp index 3e4f90be2..a7ff2ccf9 100644 --- a/src/core/frontend/applets/profile_select.cpp +++ b/src/core/frontend/applets/profile_select.cpp @@ -11,10 +11,9 @@ namespace Core::Frontend { ProfileSelectApplet::~ProfileSelectApplet() = default; void DefaultProfileSelectApplet::SelectProfile( - std::function)> callback) const { + std::function)> callback) const { Service::Account::ProfileManager manager; - callback(manager.GetUser(Settings::values.current_user.GetValue()) - .value_or(Common::UUID{Common::INVALID_UUID})); + callback(manager.GetUser(Settings::values.current_user.GetValue()).value_or(Common::NewUUID{})); LOG_INFO(Service_ACC, "called, selecting current user instead of prompting..."); } diff --git a/src/core/frontend/applets/profile_select.h b/src/core/frontend/applets/profile_select.h index 3506b9885..5b2346e72 100644 --- a/src/core/frontend/applets/profile_select.h +++ b/src/core/frontend/applets/profile_select.h @@ -6,7 +6,7 @@ #include #include -#include "common/uuid.h" +#include "common/new_uuid.h" namespace Core::Frontend { @@ -14,12 +14,13 @@ class ProfileSelectApplet { public: virtual ~ProfileSelectApplet(); - virtual void SelectProfile(std::function)> callback) const = 0; + virtual void SelectProfile( + std::function)> callback) const = 0; }; class DefaultProfileSelectApplet final : public ProfileSelectApplet { public: - void SelectProfile(std::function)> callback) const override; + void SelectProfile(std::function)> callback) const override; }; } // namespace Core::Frontend diff --git a/src/core/hle/service/acc/acc.cpp b/src/core/hle/service/acc/acc.cpp index 6e63e057e..6abb7dbc4 100644 --- a/src/core/hle/service/acc/acc.cpp +++ b/src/core/hle/service/acc/acc.cpp @@ -39,9 +39,9 @@ constexpr ResultCode ERR_FAILED_SAVE_DATA{ErrorModule::Account, 100}; // Thumbnails are hard coded to be at least this size constexpr std::size_t THUMBNAIL_SIZE = 0x24000; -static std::filesystem::path GetImagePath(Common::UUID uuid) { +static std::filesystem::path GetImagePath(const Common::NewUUID& uuid) { return Common::FS::GetYuzuPath(Common::FS::YuzuPath::NANDDir) / - fmt::format("system/save/8000000000000010/su/avators/{}.jpg", uuid.FormatSwitch()); + fmt::format("system/save/8000000000000010/su/avators/{}.jpg", uuid.FormattedString()); } static constexpr u32 SanitizeJPEGSize(std::size_t size) { @@ -51,7 +51,7 @@ static constexpr u32 SanitizeJPEGSize(std::size_t size) { class IManagerForSystemService final : public ServiceFramework { public: - explicit IManagerForSystemService(Core::System& system_, Common::UUID) + explicit IManagerForSystemService(Core::System& system_, Common::NewUUID) : ServiceFramework{system_, "IManagerForSystemService"} { // clang-format off static const FunctionInfo functions[] = { @@ -87,7 +87,7 @@ public: // 3.0.0+ class IFloatingRegistrationRequest final : public ServiceFramework { public: - explicit IFloatingRegistrationRequest(Core::System& system_, Common::UUID) + explicit IFloatingRegistrationRequest(Core::System& system_, Common::NewUUID) : ServiceFramework{system_, "IFloatingRegistrationRequest"} { // clang-format off static const FunctionInfo functions[] = { @@ -112,7 +112,7 @@ public: class IAdministrator final : public ServiceFramework { public: - explicit IAdministrator(Core::System& system_, Common::UUID) + explicit IAdministrator(Core::System& system_, Common::NewUUID) : ServiceFramework{system_, "IAdministrator"} { // clang-format off static const FunctionInfo functions[] = { @@ -170,7 +170,7 @@ public: class IAuthorizationRequest final : public ServiceFramework { public: - explicit IAuthorizationRequest(Core::System& system_, Common::UUID) + explicit IAuthorizationRequest(Core::System& system_, Common::NewUUID) : ServiceFramework{system_, "IAuthorizationRequest"} { // clang-format off static const FunctionInfo functions[] = { @@ -189,7 +189,7 @@ public: class IOAuthProcedure final : public ServiceFramework { public: - explicit IOAuthProcedure(Core::System& system_, Common::UUID) + explicit IOAuthProcedure(Core::System& system_, Common::NewUUID) : ServiceFramework{system_, "IOAuthProcedure"} { // clang-format off static const FunctionInfo functions[] = { @@ -208,7 +208,7 @@ public: // 3.0.0+ class IOAuthProcedureForExternalNsa final : public ServiceFramework { public: - explicit IOAuthProcedureForExternalNsa(Core::System& system_, Common::UUID) + explicit IOAuthProcedureForExternalNsa(Core::System& system_, Common::NewUUID) : ServiceFramework{system_, "IOAuthProcedureForExternalNsa"} { // clang-format off static const FunctionInfo functions[] = { @@ -231,7 +231,7 @@ public: class IOAuthProcedureForNintendoAccountLinkage final : public ServiceFramework { public: - explicit IOAuthProcedureForNintendoAccountLinkage(Core::System& system_, Common::UUID) + explicit IOAuthProcedureForNintendoAccountLinkage(Core::System& system_, Common::NewUUID) : ServiceFramework{system_, "IOAuthProcedureForNintendoAccountLinkage"} { // clang-format off static const FunctionInfo functions[] = { @@ -252,7 +252,7 @@ public: class INotifier final : public ServiceFramework { public: - explicit INotifier(Core::System& system_, Common::UUID) + explicit INotifier(Core::System& system_, Common::NewUUID) : ServiceFramework{system_, "INotifier"} { // clang-format off static const FunctionInfo functions[] = { @@ -267,7 +267,7 @@ public: class IProfileCommon : public ServiceFramework { public: explicit IProfileCommon(Core::System& system_, const char* name, bool editor_commands, - Common::UUID user_id_, ProfileManager& profile_manager_) + Common::NewUUID user_id_, ProfileManager& profile_manager_) : ServiceFramework{system_, name}, profile_manager{profile_manager_}, user_id{user_id_} { static const FunctionInfo functions[] = { {0, &IProfileCommon::Get, "Get"}, @@ -290,7 +290,7 @@ public: protected: void Get(Kernel::HLERequestContext& ctx) { - LOG_DEBUG(Service_ACC, "called user_id=0x{}", user_id.Format()); + LOG_DEBUG(Service_ACC, "called user_id=0x{}", user_id.RawString()); ProfileBase profile_base{}; ProfileData data{}; if (profile_manager.GetProfileBaseAndData(user_id, profile_base, data)) { @@ -300,21 +300,21 @@ protected: rb.PushRaw(profile_base); } else { LOG_ERROR(Service_ACC, "Failed to get profile base and data for user=0x{}", - user_id.Format()); + user_id.RawString()); IPC::ResponseBuilder rb{ctx, 2}; rb.Push(ResultUnknown); // TODO(ogniK): Get actual error code } } void GetBase(Kernel::HLERequestContext& ctx) { - LOG_DEBUG(Service_ACC, "called user_id=0x{}", user_id.Format()); + LOG_DEBUG(Service_ACC, "called user_id=0x{}", user_id.RawString()); ProfileBase profile_base{}; if (profile_manager.GetProfileBase(user_id, profile_base)) { IPC::ResponseBuilder rb{ctx, 16}; rb.Push(ResultSuccess); rb.PushRaw(profile_base); } else { - LOG_ERROR(Service_ACC, "Failed to get profile base for user=0x{}", user_id.Format()); + LOG_ERROR(Service_ACC, "Failed to get profile base for user=0x{}", user_id.RawString()); IPC::ResponseBuilder rb{ctx, 2}; rb.Push(ResultUnknown); // TODO(ogniK): Get actual error code } @@ -373,7 +373,7 @@ protected: LOG_DEBUG(Service_ACC, "called, username='{}', timestamp={:016X}, uuid=0x{}", Common::StringFromFixedZeroTerminatedBuffer( reinterpret_cast(base.username.data()), base.username.size()), - base.timestamp, base.user_uuid.Format()); + base.timestamp, base.user_uuid.RawString()); if (user_data.size() < sizeof(ProfileData)) { LOG_ERROR(Service_ACC, "ProfileData buffer too small!"); @@ -406,7 +406,7 @@ protected: LOG_DEBUG(Service_ACC, "called, username='{}', timestamp={:016X}, uuid=0x{}", Common::StringFromFixedZeroTerminatedBuffer( reinterpret_cast(base.username.data()), base.username.size()), - base.timestamp, base.user_uuid.Format()); + base.timestamp, base.user_uuid.RawString()); if (user_data.size() < sizeof(ProfileData)) { LOG_ERROR(Service_ACC, "ProfileData buffer too small!"); @@ -435,26 +435,26 @@ protected: } ProfileManager& profile_manager; - Common::UUID user_id{Common::INVALID_UUID}; ///< The user id this profile refers to. + Common::NewUUID user_id{}; ///< The user id this profile refers to. }; class IProfile final : public IProfileCommon { public: - explicit IProfile(Core::System& system_, Common::UUID user_id_, + explicit IProfile(Core::System& system_, Common::NewUUID user_id_, ProfileManager& profile_manager_) : IProfileCommon{system_, "IProfile", false, user_id_, profile_manager_} {} }; class IProfileEditor final : public IProfileCommon { public: - explicit IProfileEditor(Core::System& system_, Common::UUID user_id_, + explicit IProfileEditor(Core::System& system_, Common::NewUUID user_id_, ProfileManager& profile_manager_) : IProfileCommon{system_, "IProfileEditor", true, user_id_, profile_manager_} {} }; class ISessionObject final : public ServiceFramework { public: - explicit ISessionObject(Core::System& system_, Common::UUID) + explicit ISessionObject(Core::System& system_, Common::NewUUID) : ServiceFramework{system_, "ISessionObject"} { // clang-format off static const FunctionInfo functions[] = { @@ -468,7 +468,7 @@ public: class IGuestLoginRequest final : public ServiceFramework { public: - explicit IGuestLoginRequest(Core::System& system_, Common::UUID) + explicit IGuestLoginRequest(Core::System& system_, Common::NewUUID) : ServiceFramework{system_, "IGuestLoginRequest"} { // clang-format off static const FunctionInfo functions[] = { @@ -514,7 +514,7 @@ protected: class IManagerForApplication final : public ServiceFramework { public: - explicit IManagerForApplication(Core::System& system_, Common::UUID user_id_) + explicit IManagerForApplication(Core::System& system_, Common::NewUUID user_id_) : ServiceFramework{system_, "IManagerForApplication"}, ensure_token_id{std::make_shared(system)}, user_id{user_id_} { @@ -547,7 +547,7 @@ private: IPC::ResponseBuilder rb{ctx, 4}; rb.Push(ResultSuccess); - rb.PushRaw(user_id.GetNintendoID()); + rb.PushRaw(user_id.Hash()); } void EnsureIdTokenCacheAsync(Kernel::HLERequestContext& ctx) { @@ -577,7 +577,7 @@ private: IPC::ResponseBuilder rb{ctx, 4}; rb.Push(ResultSuccess); - rb.PushRaw(user_id.GetNintendoID()); + rb.PushRaw(user_id.Hash()); } void StoreOpenContext(Kernel::HLERequestContext& ctx) { @@ -587,14 +587,14 @@ private: } std::shared_ptr ensure_token_id{}; - Common::UUID user_id{Common::INVALID_UUID}; + Common::NewUUID user_id{}; }; // 6.0.0+ class IAsyncNetworkServiceLicenseKindContext final : public ServiceFramework { public: - explicit IAsyncNetworkServiceLicenseKindContext(Core::System& system_, Common::UUID) + explicit IAsyncNetworkServiceLicenseKindContext(Core::System& system_, Common::NewUUID) : ServiceFramework{system_, "IAsyncNetworkServiceLicenseKindContext"} { // clang-format off static const FunctionInfo functions[] = { @@ -614,7 +614,7 @@ public: class IOAuthProcedureForUserRegistration final : public ServiceFramework { public: - explicit IOAuthProcedureForUserRegistration(Core::System& system_, Common::UUID) + explicit IOAuthProcedureForUserRegistration(Core::System& system_, Common::NewUUID) : ServiceFramework{system_, "IOAuthProcedureForUserRegistration"} { // clang-format off static const FunctionInfo functions[] = { @@ -638,7 +638,8 @@ public: class DAUTH_O final : public ServiceFramework { public: - explicit DAUTH_O(Core::System& system_, Common::UUID) : ServiceFramework{system_, "dauth:o"} { + explicit DAUTH_O(Core::System& system_, Common::NewUUID) + : ServiceFramework{system_, "dauth:o"} { // clang-format off static const FunctionInfo functions[] = { {0, nullptr, "EnsureAuthenticationTokenCacheAsync"}, @@ -662,7 +663,7 @@ public: // 6.0.0+ class IAsyncResult final : public ServiceFramework { public: - explicit IAsyncResult(Core::System& system_, Common::UUID) + explicit IAsyncResult(Core::System& system_, Common::NewUUID) : ServiceFramework{system_, "IAsyncResult"} { // clang-format off static const FunctionInfo functions[] = { @@ -686,8 +687,8 @@ void Module::Interface::GetUserCount(Kernel::HLERequestContext& ctx) { void Module::Interface::GetUserExistence(Kernel::HLERequestContext& ctx) { IPC::RequestParser rp{ctx}; - Common::UUID user_id = rp.PopRaw(); - LOG_DEBUG(Service_ACC, "called user_id=0x{}", user_id.Format()); + Common::NewUUID user_id = rp.PopRaw(); + LOG_DEBUG(Service_ACC, "called user_id=0x{}", user_id.RawString()); IPC::ResponseBuilder rb{ctx, 3}; rb.Push(ResultSuccess); @@ -712,13 +713,13 @@ void Module::Interface::GetLastOpenedUser(Kernel::HLERequestContext& ctx) { LOG_DEBUG(Service_ACC, "called"); IPC::ResponseBuilder rb{ctx, 6}; rb.Push(ResultSuccess); - rb.PushRaw(profile_manager->GetLastOpenedUser()); + rb.PushRaw(profile_manager->GetLastOpenedUser()); } void Module::Interface::GetProfile(Kernel::HLERequestContext& ctx) { IPC::RequestParser rp{ctx}; - Common::UUID user_id = rp.PopRaw(); - LOG_DEBUG(Service_ACC, "called user_id=0x{}", user_id.Format()); + Common::NewUUID user_id = rp.PopRaw(); + LOG_DEBUG(Service_ACC, "called user_id=0x{}", user_id.RawString()); IPC::ResponseBuilder rb{ctx, 2, 0, 1}; rb.Push(ResultSuccess); @@ -831,9 +832,9 @@ void Module::Interface::InitializeApplicationInfoV2(Kernel::HLERequestContext& c void Module::Interface::GetProfileEditor(Kernel::HLERequestContext& ctx) { IPC::RequestParser rp{ctx}; - Common::UUID user_id = rp.PopRaw(); + Common::NewUUID user_id = rp.PopRaw(); - LOG_DEBUG(Service_ACC, "called, user_id=0x{}", user_id.Format()); + LOG_DEBUG(Service_ACC, "called, user_id=0x{}", user_id.RawString()); IPC::ResponseBuilder rb{ctx, 2, 0, 1}; rb.Push(ResultSuccess); @@ -873,9 +874,9 @@ void Module::Interface::ListOpenContextStoredUsers(Kernel::HLERequestContext& ct void Module::Interface::StoreSaveDataThumbnailApplication(Kernel::HLERequestContext& ctx) { IPC::RequestParser rp{ctx}; - const auto uuid = rp.PopRaw(); + const auto uuid = rp.PopRaw(); - LOG_WARNING(Service_ACC, "(STUBBED) called, uuid=0x{}", uuid.Format()); + LOG_WARNING(Service_ACC, "(STUBBED) called, uuid=0x{}", uuid.RawString()); // TODO(ogniK): Check if application ID is zero on acc initialize. As we don't have a reliable // way of confirming things like the TID, we're going to assume a non zero value for the time @@ -886,15 +887,15 @@ void Module::Interface::StoreSaveDataThumbnailApplication(Kernel::HLERequestCont void Module::Interface::StoreSaveDataThumbnailSystem(Kernel::HLERequestContext& ctx) { IPC::RequestParser rp{ctx}; - const auto uuid = rp.PopRaw(); + const auto uuid = rp.PopRaw(); const auto tid = rp.Pop(); - LOG_WARNING(Service_ACC, "(STUBBED) called, uuid=0x{}, tid={:016X}", uuid.Format(), tid); + LOG_WARNING(Service_ACC, "(STUBBED) called, uuid=0x{}, tid={:016X}", uuid.RawString(), tid); StoreSaveDataThumbnail(ctx, uuid, tid); } void Module::Interface::StoreSaveDataThumbnail(Kernel::HLERequestContext& ctx, - const Common::UUID& uuid, const u64 tid) { + const Common::NewUUID& uuid, const u64 tid) { IPC::ResponseBuilder rb{ctx, 2}; if (tid == 0) { @@ -903,7 +904,7 @@ void Module::Interface::StoreSaveDataThumbnail(Kernel::HLERequestContext& ctx, return; } - if (!uuid) { + if (uuid.IsInvalid()) { LOG_ERROR(Service_ACC, "User ID is not valid!"); rb.Push(ERR_INVALID_USER_ID); return; @@ -927,20 +928,20 @@ void Module::Interface::TrySelectUserWithoutInteraction(Kernel::HLERequestContex IPC::ResponseBuilder rb{ctx, 6}; if (profile_manager->GetUserCount() != 1) { rb.Push(ResultSuccess); - rb.PushRaw(Common::INVALID_UUID); + rb.PushRaw(Common::InvalidUUID); return; } const auto user_list = profile_manager->GetAllUsers(); if (std::ranges::all_of(user_list, [](const auto& user) { return user.IsInvalid(); })) { rb.Push(ResultUnknown); // TODO(ogniK): Find the correct error code - rb.PushRaw(Common::INVALID_UUID); + rb.PushRaw(Common::InvalidUUID); return; } // Select the first user we have rb.Push(ResultSuccess); - rb.PushRaw(profile_manager->GetUser(0)->uuid); + rb.PushRaw(profile_manager->GetUser(0)->uuid); } Module::Interface::Interface(std::shared_ptr module_, diff --git a/src/core/hle/service/acc/acc.h b/src/core/hle/service/acc/acc.h index f7e9bc4f8..b57342701 100644 --- a/src/core/hle/service/acc/acc.h +++ b/src/core/hle/service/acc/acc.h @@ -4,7 +4,7 @@ #pragma once -#include "common/uuid.h" +#include "common/new_uuid.h" #include "core/hle/service/glue/glue_manager.h" #include "core/hle/service/service.h" @@ -43,7 +43,7 @@ public: private: ResultCode InitializeApplicationInfoBase(); - void StoreSaveDataThumbnail(Kernel::HLERequestContext& ctx, const Common::UUID& uuid, + void StoreSaveDataThumbnail(Kernel::HLERequestContext& ctx, const Common::NewUUID& uuid, const u64 tid); enum class ApplicationType : u32_le { diff --git a/src/core/hle/service/acc/profile_manager.cpp b/src/core/hle/service/acc/profile_manager.cpp index 568303ced..366f3fe14 100644 --- a/src/core/hle/service/acc/profile_manager.cpp +++ b/src/core/hle/service/acc/profile_manager.cpp @@ -16,11 +16,11 @@ namespace Service::Account { namespace FS = Common::FS; -using Common::UUID; +using Common::NewUUID; struct UserRaw { - UUID uuid{Common::INVALID_UUID}; - UUID uuid2{Common::INVALID_UUID}; + NewUUID uuid{}; + NewUUID uuid2{}; u64 timestamp{}; ProfileUsername username{}; ProfileData extra_data{}; @@ -45,7 +45,7 @@ ProfileManager::ProfileManager() { // Create an user if none are present if (user_count == 0) { - CreateNewUser(UUID::Generate(), "yuzu"); + CreateNewUser(NewUUID::MakeRandom(), "yuzu"); } auto current = @@ -97,11 +97,11 @@ ResultCode ProfileManager::AddUser(const ProfileInfo& user) { /// Create a new user on the system. If the uuid of the user already exists, the user is not /// created. -ResultCode ProfileManager::CreateNewUser(UUID uuid, const ProfileUsername& username) { +ResultCode ProfileManager::CreateNewUser(NewUUID uuid, const ProfileUsername& username) { if (user_count == MAX_USERS) { return ERROR_TOO_MANY_USERS; } - if (!uuid) { + if (uuid.IsInvalid()) { return ERROR_ARGUMENT_IS_NULL; } if (username[0] == 0x0) { @@ -124,7 +124,7 @@ ResultCode ProfileManager::CreateNewUser(UUID uuid, const ProfileUsername& usern /// Creates a new user on the system. This function allows a much simpler method of registration /// specifically by allowing an std::string for the username. This is required specifically since /// we're loading a string straight from the config -ResultCode ProfileManager::CreateNewUser(UUID uuid, const std::string& username) { +ResultCode ProfileManager::CreateNewUser(NewUUID uuid, const std::string& username) { ProfileUsername username_output{}; if (username.size() > username_output.size()) { @@ -135,7 +135,7 @@ ResultCode ProfileManager::CreateNewUser(UUID uuid, const std::string& username) return CreateNewUser(uuid, username_output); } -std::optional ProfileManager::GetUser(std::size_t index) const { +std::optional ProfileManager::GetUser(std::size_t index) const { if (index >= MAX_USERS) { return std::nullopt; } @@ -144,8 +144,8 @@ std::optional ProfileManager::GetUser(std::size_t index) const { } /// Returns a users profile index based on their user id. -std::optional ProfileManager::GetUserIndex(const UUID& uuid) const { - if (!uuid) { +std::optional ProfileManager::GetUserIndex(const NewUUID& uuid) const { + if (uuid.IsInvalid()) { return std::nullopt; } @@ -176,7 +176,7 @@ bool ProfileManager::GetProfileBase(std::optional index, ProfileBas } /// Returns the data structure used by the switch when GetProfileBase is called on acc:* -bool ProfileManager::GetProfileBase(UUID uuid, ProfileBase& profile) const { +bool ProfileManager::GetProfileBase(NewUUID uuid, ProfileBase& profile) const { const auto idx = GetUserIndex(uuid); return GetProfileBase(idx, profile); } @@ -203,7 +203,7 @@ std::size_t ProfileManager::GetOpenUserCount() const { } /// Checks if a user id exists in our profile manager -bool ProfileManager::UserExists(UUID uuid) const { +bool ProfileManager::UserExists(NewUUID uuid) const { return GetUserIndex(uuid).has_value(); } @@ -215,7 +215,7 @@ bool ProfileManager::UserExistsIndex(std::size_t index) const { } /// Opens a specific user -void ProfileManager::OpenUser(UUID uuid) { +void ProfileManager::OpenUser(NewUUID uuid) { const auto idx = GetUserIndex(uuid); if (!idx) { return; @@ -226,7 +226,7 @@ void ProfileManager::OpenUser(UUID uuid) { } /// Closes a specific user -void ProfileManager::CloseUser(UUID uuid) { +void ProfileManager::CloseUser(NewUUID uuid) { const auto idx = GetUserIndex(uuid); if (!idx) { return; @@ -250,14 +250,15 @@ UserIDArray ProfileManager::GetOpenUsers() const { std::ranges::transform(profiles, output.begin(), [](const ProfileInfo& p) { if (p.is_open) return p.user_uuid; - return UUID{Common::INVALID_UUID}; + return Common::InvalidUUID; }); - std::stable_partition(output.begin(), output.end(), [](const UUID& uuid) { return uuid; }); + std::stable_partition(output.begin(), output.end(), + [](const NewUUID& uuid) { return uuid.IsValid(); }); return output; } /// Returns the last user which was opened -UUID ProfileManager::GetLastOpenedUser() const { +NewUUID ProfileManager::GetLastOpenedUser() const { return last_opened_user; } @@ -272,7 +273,7 @@ bool ProfileManager::GetProfileBaseAndData(std::optional index, Pro } /// Return the users profile base and the unknown arbitary data. -bool ProfileManager::GetProfileBaseAndData(UUID uuid, ProfileBase& profile, +bool ProfileManager::GetProfileBaseAndData(NewUUID uuid, ProfileBase& profile, ProfileData& data) const { const auto idx = GetUserIndex(uuid); return GetProfileBaseAndData(idx, profile, data); @@ -291,7 +292,7 @@ bool ProfileManager::CanSystemRegisterUser() const { // emulate qlaunch. Update this to dynamically change. } -bool ProfileManager::RemoveUser(UUID uuid) { +bool ProfileManager::RemoveUser(NewUUID uuid) { const auto index = GetUserIndex(uuid); if (!index) { return false; @@ -299,11 +300,11 @@ bool ProfileManager::RemoveUser(UUID uuid) { profiles[*index] = ProfileInfo{}; std::stable_partition(profiles.begin(), profiles.end(), - [](const ProfileInfo& profile) { return profile.user_uuid; }); + [](const ProfileInfo& profile) { return profile.user_uuid.IsValid(); }); return true; } -bool ProfileManager::SetProfileBase(UUID uuid, const ProfileBase& profile_new) { +bool ProfileManager::SetProfileBase(NewUUID uuid, const ProfileBase& profile_new) { const auto index = GetUserIndex(uuid); if (!index || profile_new.user_uuid.IsInvalid()) { return false; @@ -317,7 +318,7 @@ bool ProfileManager::SetProfileBase(UUID uuid, const ProfileBase& profile_new) { return true; } -bool ProfileManager::SetProfileBaseAndData(Common::UUID uuid, const ProfileBase& profile_new, +bool ProfileManager::SetProfileBaseAndData(Common::NewUUID uuid, const ProfileBase& profile_new, const ProfileData& data_new) { const auto index = GetUserIndex(uuid); if (index.has_value() && SetProfileBase(uuid, profile_new)) { @@ -335,14 +336,14 @@ void ProfileManager::ParseUserSaveFile() { if (!save.IsOpen()) { LOG_WARNING(Service_ACC, "Failed to load profile data from save data... Generating new " - "user 'yuzu' with random UUID."); + "user 'yuzu' with random NewUUID."); return; } ProfileDataRaw data; if (!save.ReadObject(data)) { LOG_WARNING(Service_ACC, "profiles.dat is smaller than expected... Generating new user " - "'yuzu' with random UUID."); + "'yuzu' with random NewUUID."); return; } @@ -361,7 +362,7 @@ void ProfileManager::ParseUserSaveFile() { } std::stable_partition(profiles.begin(), profiles.end(), - [](const ProfileInfo& profile) { return profile.user_uuid; }); + [](const ProfileInfo& profile) { return profile.user_uuid.IsValid(); }); } void ProfileManager::WriteUserSaveFile() { diff --git a/src/core/hle/service/acc/profile_manager.h b/src/core/hle/service/acc/profile_manager.h index 71b9d5518..e9c58a826 100644 --- a/src/core/hle/service/acc/profile_manager.h +++ b/src/core/hle/service/acc/profile_manager.h @@ -8,8 +8,8 @@ #include #include "common/common_types.h" +#include "common/new_uuid.h" #include "common/swap.h" -#include "common/uuid.h" #include "core/hle/result.h" namespace Service::Account { @@ -18,7 +18,7 @@ constexpr std::size_t MAX_USERS{8}; constexpr std::size_t profile_username_size{32}; using ProfileUsername = std::array; -using UserIDArray = std::array; +using UserIDArray = std::array; /// Contains extra data related to a user. /// TODO: RE this structure @@ -35,7 +35,7 @@ static_assert(sizeof(ProfileData) == 0x80, "ProfileData structure has incorrect /// This holds general information about a users profile. This is where we store all the information /// based on a specific user struct ProfileInfo { - Common::UUID user_uuid{Common::INVALID_UUID}; + Common::NewUUID user_uuid{}; ProfileUsername username{}; u64 creation_time{}; ProfileData data{}; // TODO(ognik): Work out what this is @@ -43,13 +43,13 @@ struct ProfileInfo { }; struct ProfileBase { - Common::UUID user_uuid; + Common::NewUUID user_uuid; u64_le timestamp; ProfileUsername username; // Zero out all the fields to make the profile slot considered "Empty" void Invalidate() { - user_uuid.Invalidate(); + user_uuid = {}; timestamp = 0; username.fill(0); } @@ -65,34 +65,34 @@ public: ~ProfileManager(); ResultCode AddUser(const ProfileInfo& user); - ResultCode CreateNewUser(Common::UUID uuid, const ProfileUsername& username); - ResultCode CreateNewUser(Common::UUID uuid, const std::string& username); - std::optional GetUser(std::size_t index) const; - std::optional GetUserIndex(const Common::UUID& uuid) const; + ResultCode CreateNewUser(Common::NewUUID uuid, const ProfileUsername& username); + ResultCode CreateNewUser(Common::NewUUID uuid, const std::string& username); + std::optional GetUser(std::size_t index) const; + std::optional GetUserIndex(const Common::NewUUID& uuid) const; std::optional GetUserIndex(const ProfileInfo& user) const; bool GetProfileBase(std::optional index, ProfileBase& profile) const; - bool GetProfileBase(Common::UUID uuid, ProfileBase& profile) const; + bool GetProfileBase(Common::NewUUID uuid, ProfileBase& profile) const; bool GetProfileBase(const ProfileInfo& user, ProfileBase& profile) const; bool GetProfileBaseAndData(std::optional index, ProfileBase& profile, ProfileData& data) const; - bool GetProfileBaseAndData(Common::UUID uuid, ProfileBase& profile, ProfileData& data) const; + bool GetProfileBaseAndData(Common::NewUUID uuid, ProfileBase& profile, ProfileData& data) const; bool GetProfileBaseAndData(const ProfileInfo& user, ProfileBase& profile, ProfileData& data) const; std::size_t GetUserCount() const; std::size_t GetOpenUserCount() const; - bool UserExists(Common::UUID uuid) const; + bool UserExists(Common::NewUUID uuid) const; bool UserExistsIndex(std::size_t index) const; - void OpenUser(Common::UUID uuid); - void CloseUser(Common::UUID uuid); + void OpenUser(Common::NewUUID uuid); + void CloseUser(Common::NewUUID uuid); UserIDArray GetOpenUsers() const; UserIDArray GetAllUsers() const; - Common::UUID GetLastOpenedUser() const; + Common::NewUUID GetLastOpenedUser() const; bool CanSystemRegisterUser() const; - bool RemoveUser(Common::UUID uuid); - bool SetProfileBase(Common::UUID uuid, const ProfileBase& profile_new); - bool SetProfileBaseAndData(Common::UUID uuid, const ProfileBase& profile_new, + bool RemoveUser(Common::NewUUID uuid); + bool SetProfileBase(Common::NewUUID uuid, const ProfileBase& profile_new); + bool SetProfileBaseAndData(Common::NewUUID uuid, const ProfileBase& profile_new, const ProfileData& data_new); private: @@ -103,7 +103,7 @@ private: std::array profiles{}; std::size_t user_count{}; - Common::UUID last_opened_user{Common::INVALID_UUID}; + Common::NewUUID last_opened_user{}; }; }; // namespace Service::Account diff --git a/src/core/hle/service/am/am.cpp b/src/core/hle/service/am/am.cpp index e60661fe1..4cdc029b7 100644 --- a/src/core/hle/service/am/am.cpp +++ b/src/core/hle/service/am/am.cpp @@ -55,7 +55,7 @@ constexpr u32 LAUNCH_PARAMETER_ACCOUNT_PRESELECTED_USER_MAGIC = 0xC79497CA; struct LaunchParameterAccountPreselectedUser { u32_le magic; u32_le is_account_selected; - u128 current_user; + Common::NewUUID current_user; INSERT_PADDING_BYTES(0x70); }; static_assert(sizeof(LaunchParameterAccountPreselectedUser) == 0x88); @@ -1453,8 +1453,8 @@ void IApplicationFunctions::PopLaunchParameter(Kernel::HLERequestContext& ctx) { Account::ProfileManager profile_manager{}; const auto uuid = profile_manager.GetUser(static_cast(Settings::values.current_user)); - ASSERT(uuid); - params.current_user = uuid->uuid; + ASSERT(uuid.has_value() && uuid->IsValid()); + params.current_user = *uuid; IPC::ResponseBuilder rb{ctx, 2, 0, 1}; diff --git a/src/core/hle/service/am/applets/applet_profile_select.cpp b/src/core/hle/service/am/applets/applet_profile_select.cpp index a6e891944..3ac32fa58 100644 --- a/src/core/hle/service/am/applets/applet_profile_select.cpp +++ b/src/core/hle/service/am/applets/applet_profile_select.cpp @@ -54,19 +54,20 @@ void ProfileSelect::Execute() { return; } - frontend.SelectProfile([this](std::optional uuid) { SelectionComplete(uuid); }); + frontend.SelectProfile( + [this](std::optional uuid) { SelectionComplete(uuid); }); } -void ProfileSelect::SelectionComplete(std::optional uuid) { +void ProfileSelect::SelectionComplete(std::optional uuid) { UserSelectionOutput output{}; if (uuid.has_value() && uuid->IsValid()) { output.result = 0; - output.uuid_selected = uuid->uuid; + output.uuid_selected = *uuid; } else { status = ERR_USER_CANCELLED_SELECTION; output.result = ERR_USER_CANCELLED_SELECTION.raw; - output.uuid_selected = Common::INVALID_UUID; + output.uuid_selected = Common::InvalidUUID; } final_data = std::vector(sizeof(UserSelectionOutput)); diff --git a/src/core/hle/service/am/applets/applet_profile_select.h b/src/core/hle/service/am/applets/applet_profile_select.h index 8fb76e6c4..c5c506c41 100644 --- a/src/core/hle/service/am/applets/applet_profile_select.h +++ b/src/core/hle/service/am/applets/applet_profile_select.h @@ -7,7 +7,7 @@ #include #include "common/common_funcs.h" -#include "common/uuid.h" +#include "common/new_uuid.h" #include "core/hle/result.h" #include "core/hle/service/am/applets/applets.h" @@ -27,7 +27,7 @@ static_assert(sizeof(UserSelectionConfig) == 0xA0, "UserSelectionConfig has inco struct UserSelectionOutput { u64 result; - u128 uuid_selected; + Common::NewUUID uuid_selected; }; static_assert(sizeof(UserSelectionOutput) == 0x18, "UserSelectionOutput has incorrect size."); @@ -44,7 +44,7 @@ public: void ExecuteInteractive() override; void Execute() override; - void SelectionComplete(std::optional uuid); + void SelectionComplete(std::optional uuid); private: const Core::Frontend::ProfileSelectApplet& frontend; -- cgit v1.2.3 From 25db62ce1534cbd8b93b4284869229e4bd7de54d Mon Sep 17 00:00:00 2001 From: Morph <39850852+Morph1984@users.noreply.github.com> Date: Sat, 5 Feb 2022 12:35:39 -0500 Subject: general: Rename NewUUID to UUID, and remove the previous UUID impl This completes the removal of the old UUID implementation. --- src/core/frontend/applets/profile_select.cpp | 4 +- src/core/frontend/applets/profile_select.h | 7 ++- src/core/hid/emulated_controller.cpp | 14 +++--- src/core/hid/emulated_controller.h | 6 +-- src/core/hid/hid_types.h | 2 +- src/core/hle/service/acc/acc.cpp | 57 +++++++++++----------- src/core/hle/service/acc/acc.h | 4 +- src/core/hle/service/acc/profile_manager.cpp | 40 +++++++-------- src/core/hle/service/acc/profile_manager.h | 36 +++++++------- src/core/hle/service/am/am.cpp | 2 +- .../service/am/applets/applet_profile_select.cpp | 5 +- .../hle/service/am/applets/applet_profile_select.h | 6 +-- src/core/hle/service/friend/friend.cpp | 12 ++--- src/core/hle/service/mii/mii_manager.cpp | 11 ++--- src/core/hle/service/mii/mii_manager.h | 10 ++-- src/core/hle/service/ns/pdm_qry.cpp | 4 +- src/core/hle/service/time/clock_types.h | 8 +-- src/core/hle/service/time/steady_clock_core.h | 8 +-- src/core/hle/service/time/time_manager.cpp | 4 +- src/core/hle/service/time/time_sharedmemory.cpp | 2 +- src/core/hle/service/time/time_sharedmemory.h | 4 +- 21 files changed, 121 insertions(+), 125 deletions(-) (limited to 'src/core') diff --git a/src/core/frontend/applets/profile_select.cpp b/src/core/frontend/applets/profile_select.cpp index a7ff2ccf9..4c58c310f 100644 --- a/src/core/frontend/applets/profile_select.cpp +++ b/src/core/frontend/applets/profile_select.cpp @@ -11,9 +11,9 @@ namespace Core::Frontend { ProfileSelectApplet::~ProfileSelectApplet() = default; void DefaultProfileSelectApplet::SelectProfile( - std::function)> callback) const { + std::function)> callback) const { Service::Account::ProfileManager manager; - callback(manager.GetUser(Settings::values.current_user.GetValue()).value_or(Common::NewUUID{})); + callback(manager.GetUser(Settings::values.current_user.GetValue()).value_or(Common::UUID{})); LOG_INFO(Service_ACC, "called, selecting current user instead of prompting..."); } diff --git a/src/core/frontend/applets/profile_select.h b/src/core/frontend/applets/profile_select.h index 5b2346e72..3506b9885 100644 --- a/src/core/frontend/applets/profile_select.h +++ b/src/core/frontend/applets/profile_select.h @@ -6,7 +6,7 @@ #include #include -#include "common/new_uuid.h" +#include "common/uuid.h" namespace Core::Frontend { @@ -14,13 +14,12 @@ class ProfileSelectApplet { public: virtual ~ProfileSelectApplet(); - virtual void SelectProfile( - std::function)> callback) const = 0; + virtual void SelectProfile(std::function)> callback) const = 0; }; class DefaultProfileSelectApplet final : public ProfileSelectApplet { public: - void SelectProfile(std::function)> callback) const override; + void SelectProfile(std::function)> callback) const override; }; } // namespace Core::Frontend diff --git a/src/core/hid/emulated_controller.cpp b/src/core/hid/emulated_controller.cpp index 44e9f22b9..2bee173b3 100644 --- a/src/core/hid/emulated_controller.cpp +++ b/src/core/hid/emulated_controller.cpp @@ -204,7 +204,7 @@ void EmulatedController::ReloadInput() { if (!button_devices[index]) { continue; } - const auto uuid = Common::NewUUID{button_params[index].Get("guid", "")}; + const auto uuid = Common::UUID{button_params[index].Get("guid", "")}; button_devices[index]->SetCallback({ .on_change = [this, index, uuid](const Common::Input::CallbackStatus& callback) { @@ -218,7 +218,7 @@ void EmulatedController::ReloadInput() { if (!stick_devices[index]) { continue; } - const auto uuid = Common::NewUUID{stick_params[index].Get("guid", "")}; + const auto uuid = Common::UUID{stick_params[index].Get("guid", "")}; stick_devices[index]->SetCallback({ .on_change = [this, index, uuid](const Common::Input::CallbackStatus& callback) { @@ -232,7 +232,7 @@ void EmulatedController::ReloadInput() { if (!trigger_devices[index]) { continue; } - const auto uuid = Common::NewUUID{trigger_params[index].Get("guid", "")}; + const auto uuid = Common::UUID{trigger_params[index].Get("guid", "")}; trigger_devices[index]->SetCallback({ .on_change = [this, index, uuid](const Common::Input::CallbackStatus& callback) { @@ -269,7 +269,7 @@ void EmulatedController::ReloadInput() { } // Use a common UUID for TAS - static constexpr Common::NewUUID TAS_UUID = Common::NewUUID{ + static constexpr Common::UUID TAS_UUID = Common::UUID{ {0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x7, 0xA5, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0}}; // Register TAS devices. No need to force update @@ -490,7 +490,7 @@ void EmulatedController::SetMotionParam(std::size_t index, Common::ParamPackage } void EmulatedController::SetButton(const Common::Input::CallbackStatus& callback, std::size_t index, - Common::NewUUID uuid) { + Common::UUID uuid) { if (index >= controller.button_values.size()) { return; } @@ -639,7 +639,7 @@ void EmulatedController::SetButton(const Common::Input::CallbackStatus& callback } void EmulatedController::SetStick(const Common::Input::CallbackStatus& callback, std::size_t index, - Common::NewUUID uuid) { + Common::UUID uuid) { if (index >= controller.stick_values.size()) { return; } @@ -689,7 +689,7 @@ void EmulatedController::SetStick(const Common::Input::CallbackStatus& callback, } void EmulatedController::SetTrigger(const Common::Input::CallbackStatus& callback, - std::size_t index, Common::NewUUID uuid) { + std::size_t index, Common::UUID uuid) { if (index >= controller.trigger_values.size()) { return; } diff --git a/src/core/hid/emulated_controller.h b/src/core/hid/emulated_controller.h index ed61e9522..d8642c5b3 100644 --- a/src/core/hid/emulated_controller.h +++ b/src/core/hid/emulated_controller.h @@ -354,7 +354,7 @@ private: * @param index Button ID of the to be updated */ void SetButton(const Common::Input::CallbackStatus& callback, std::size_t index, - Common::NewUUID uuid); + Common::UUID uuid); /** * Updates the analog stick status of the controller @@ -362,7 +362,7 @@ private: * @param index stick ID of the to be updated */ void SetStick(const Common::Input::CallbackStatus& callback, std::size_t index, - Common::NewUUID uuid); + Common::UUID uuid); /** * Updates the trigger status of the controller @@ -370,7 +370,7 @@ private: * @param index trigger ID of the to be updated */ void SetTrigger(const Common::Input::CallbackStatus& callback, std::size_t index, - Common::NewUUID uuid); + Common::UUID uuid); /** * Updates the motion status of the controller diff --git a/src/core/hid/hid_types.h b/src/core/hid/hid_types.h index a4ccdf11c..778b328b9 100644 --- a/src/core/hid/hid_types.h +++ b/src/core/hid/hid_types.h @@ -7,8 +7,8 @@ #include "common/bit_field.h" #include "common/common_funcs.h" #include "common/common_types.h" -#include "common/new_uuid.h" #include "common/point.h" +#include "common/uuid.h" namespace Core::HID { diff --git a/src/core/hle/service/acc/acc.cpp b/src/core/hle/service/acc/acc.cpp index 6abb7dbc4..e34ef5a78 100644 --- a/src/core/hle/service/acc/acc.cpp +++ b/src/core/hle/service/acc/acc.cpp @@ -39,7 +39,7 @@ constexpr ResultCode ERR_FAILED_SAVE_DATA{ErrorModule::Account, 100}; // Thumbnails are hard coded to be at least this size constexpr std::size_t THUMBNAIL_SIZE = 0x24000; -static std::filesystem::path GetImagePath(const Common::NewUUID& uuid) { +static std::filesystem::path GetImagePath(const Common::UUID& uuid) { return Common::FS::GetYuzuPath(Common::FS::YuzuPath::NANDDir) / fmt::format("system/save/8000000000000010/su/avators/{}.jpg", uuid.FormattedString()); } @@ -51,7 +51,7 @@ static constexpr u32 SanitizeJPEGSize(std::size_t size) { class IManagerForSystemService final : public ServiceFramework { public: - explicit IManagerForSystemService(Core::System& system_, Common::NewUUID) + explicit IManagerForSystemService(Core::System& system_, Common::UUID) : ServiceFramework{system_, "IManagerForSystemService"} { // clang-format off static const FunctionInfo functions[] = { @@ -87,7 +87,7 @@ public: // 3.0.0+ class IFloatingRegistrationRequest final : public ServiceFramework { public: - explicit IFloatingRegistrationRequest(Core::System& system_, Common::NewUUID) + explicit IFloatingRegistrationRequest(Core::System& system_, Common::UUID) : ServiceFramework{system_, "IFloatingRegistrationRequest"} { // clang-format off static const FunctionInfo functions[] = { @@ -112,7 +112,7 @@ public: class IAdministrator final : public ServiceFramework { public: - explicit IAdministrator(Core::System& system_, Common::NewUUID) + explicit IAdministrator(Core::System& system_, Common::UUID) : ServiceFramework{system_, "IAdministrator"} { // clang-format off static const FunctionInfo functions[] = { @@ -170,7 +170,7 @@ public: class IAuthorizationRequest final : public ServiceFramework { public: - explicit IAuthorizationRequest(Core::System& system_, Common::NewUUID) + explicit IAuthorizationRequest(Core::System& system_, Common::UUID) : ServiceFramework{system_, "IAuthorizationRequest"} { // clang-format off static const FunctionInfo functions[] = { @@ -189,7 +189,7 @@ public: class IOAuthProcedure final : public ServiceFramework { public: - explicit IOAuthProcedure(Core::System& system_, Common::NewUUID) + explicit IOAuthProcedure(Core::System& system_, Common::UUID) : ServiceFramework{system_, "IOAuthProcedure"} { // clang-format off static const FunctionInfo functions[] = { @@ -208,7 +208,7 @@ public: // 3.0.0+ class IOAuthProcedureForExternalNsa final : public ServiceFramework { public: - explicit IOAuthProcedureForExternalNsa(Core::System& system_, Common::NewUUID) + explicit IOAuthProcedureForExternalNsa(Core::System& system_, Common::UUID) : ServiceFramework{system_, "IOAuthProcedureForExternalNsa"} { // clang-format off static const FunctionInfo functions[] = { @@ -231,7 +231,7 @@ public: class IOAuthProcedureForNintendoAccountLinkage final : public ServiceFramework { public: - explicit IOAuthProcedureForNintendoAccountLinkage(Core::System& system_, Common::NewUUID) + explicit IOAuthProcedureForNintendoAccountLinkage(Core::System& system_, Common::UUID) : ServiceFramework{system_, "IOAuthProcedureForNintendoAccountLinkage"} { // clang-format off static const FunctionInfo functions[] = { @@ -252,7 +252,7 @@ public: class INotifier final : public ServiceFramework { public: - explicit INotifier(Core::System& system_, Common::NewUUID) + explicit INotifier(Core::System& system_, Common::UUID) : ServiceFramework{system_, "INotifier"} { // clang-format off static const FunctionInfo functions[] = { @@ -267,7 +267,7 @@ public: class IProfileCommon : public ServiceFramework { public: explicit IProfileCommon(Core::System& system_, const char* name, bool editor_commands, - Common::NewUUID user_id_, ProfileManager& profile_manager_) + Common::UUID user_id_, ProfileManager& profile_manager_) : ServiceFramework{system_, name}, profile_manager{profile_manager_}, user_id{user_id_} { static const FunctionInfo functions[] = { {0, &IProfileCommon::Get, "Get"}, @@ -435,26 +435,26 @@ protected: } ProfileManager& profile_manager; - Common::NewUUID user_id{}; ///< The user id this profile refers to. + Common::UUID user_id{}; ///< The user id this profile refers to. }; class IProfile final : public IProfileCommon { public: - explicit IProfile(Core::System& system_, Common::NewUUID user_id_, + explicit IProfile(Core::System& system_, Common::UUID user_id_, ProfileManager& profile_manager_) : IProfileCommon{system_, "IProfile", false, user_id_, profile_manager_} {} }; class IProfileEditor final : public IProfileCommon { public: - explicit IProfileEditor(Core::System& system_, Common::NewUUID user_id_, + explicit IProfileEditor(Core::System& system_, Common::UUID user_id_, ProfileManager& profile_manager_) : IProfileCommon{system_, "IProfileEditor", true, user_id_, profile_manager_} {} }; class ISessionObject final : public ServiceFramework { public: - explicit ISessionObject(Core::System& system_, Common::NewUUID) + explicit ISessionObject(Core::System& system_, Common::UUID) : ServiceFramework{system_, "ISessionObject"} { // clang-format off static const FunctionInfo functions[] = { @@ -468,7 +468,7 @@ public: class IGuestLoginRequest final : public ServiceFramework { public: - explicit IGuestLoginRequest(Core::System& system_, Common::NewUUID) + explicit IGuestLoginRequest(Core::System& system_, Common::UUID) : ServiceFramework{system_, "IGuestLoginRequest"} { // clang-format off static const FunctionInfo functions[] = { @@ -514,7 +514,7 @@ protected: class IManagerForApplication final : public ServiceFramework { public: - explicit IManagerForApplication(Core::System& system_, Common::NewUUID user_id_) + explicit IManagerForApplication(Core::System& system_, Common::UUID user_id_) : ServiceFramework{system_, "IManagerForApplication"}, ensure_token_id{std::make_shared(system)}, user_id{user_id_} { @@ -587,14 +587,14 @@ private: } std::shared_ptr ensure_token_id{}; - Common::NewUUID user_id{}; + Common::UUID user_id{}; }; // 6.0.0+ class IAsyncNetworkServiceLicenseKindContext final : public ServiceFramework { public: - explicit IAsyncNetworkServiceLicenseKindContext(Core::System& system_, Common::NewUUID) + explicit IAsyncNetworkServiceLicenseKindContext(Core::System& system_, Common::UUID) : ServiceFramework{system_, "IAsyncNetworkServiceLicenseKindContext"} { // clang-format off static const FunctionInfo functions[] = { @@ -614,7 +614,7 @@ public: class IOAuthProcedureForUserRegistration final : public ServiceFramework { public: - explicit IOAuthProcedureForUserRegistration(Core::System& system_, Common::NewUUID) + explicit IOAuthProcedureForUserRegistration(Core::System& system_, Common::UUID) : ServiceFramework{system_, "IOAuthProcedureForUserRegistration"} { // clang-format off static const FunctionInfo functions[] = { @@ -638,8 +638,7 @@ public: class DAUTH_O final : public ServiceFramework { public: - explicit DAUTH_O(Core::System& system_, Common::NewUUID) - : ServiceFramework{system_, "dauth:o"} { + explicit DAUTH_O(Core::System& system_, Common::UUID) : ServiceFramework{system_, "dauth:o"} { // clang-format off static const FunctionInfo functions[] = { {0, nullptr, "EnsureAuthenticationTokenCacheAsync"}, @@ -663,7 +662,7 @@ public: // 6.0.0+ class IAsyncResult final : public ServiceFramework { public: - explicit IAsyncResult(Core::System& system_, Common::NewUUID) + explicit IAsyncResult(Core::System& system_, Common::UUID) : ServiceFramework{system_, "IAsyncResult"} { // clang-format off static const FunctionInfo functions[] = { @@ -687,7 +686,7 @@ void Module::Interface::GetUserCount(Kernel::HLERequestContext& ctx) { void Module::Interface::GetUserExistence(Kernel::HLERequestContext& ctx) { IPC::RequestParser rp{ctx}; - Common::NewUUID user_id = rp.PopRaw(); + Common::UUID user_id = rp.PopRaw(); LOG_DEBUG(Service_ACC, "called user_id=0x{}", user_id.RawString()); IPC::ResponseBuilder rb{ctx, 3}; @@ -713,12 +712,12 @@ void Module::Interface::GetLastOpenedUser(Kernel::HLERequestContext& ctx) { LOG_DEBUG(Service_ACC, "called"); IPC::ResponseBuilder rb{ctx, 6}; rb.Push(ResultSuccess); - rb.PushRaw(profile_manager->GetLastOpenedUser()); + rb.PushRaw(profile_manager->GetLastOpenedUser()); } void Module::Interface::GetProfile(Kernel::HLERequestContext& ctx) { IPC::RequestParser rp{ctx}; - Common::NewUUID user_id = rp.PopRaw(); + Common::UUID user_id = rp.PopRaw(); LOG_DEBUG(Service_ACC, "called user_id=0x{}", user_id.RawString()); IPC::ResponseBuilder rb{ctx, 2, 0, 1}; @@ -832,7 +831,7 @@ void Module::Interface::InitializeApplicationInfoV2(Kernel::HLERequestContext& c void Module::Interface::GetProfileEditor(Kernel::HLERequestContext& ctx) { IPC::RequestParser rp{ctx}; - Common::NewUUID user_id = rp.PopRaw(); + Common::UUID user_id = rp.PopRaw(); LOG_DEBUG(Service_ACC, "called, user_id=0x{}", user_id.RawString()); @@ -874,7 +873,7 @@ void Module::Interface::ListOpenContextStoredUsers(Kernel::HLERequestContext& ct void Module::Interface::StoreSaveDataThumbnailApplication(Kernel::HLERequestContext& ctx) { IPC::RequestParser rp{ctx}; - const auto uuid = rp.PopRaw(); + const auto uuid = rp.PopRaw(); LOG_WARNING(Service_ACC, "(STUBBED) called, uuid=0x{}", uuid.RawString()); @@ -887,7 +886,7 @@ void Module::Interface::StoreSaveDataThumbnailApplication(Kernel::HLERequestCont void Module::Interface::StoreSaveDataThumbnailSystem(Kernel::HLERequestContext& ctx) { IPC::RequestParser rp{ctx}; - const auto uuid = rp.PopRaw(); + const auto uuid = rp.PopRaw(); const auto tid = rp.Pop(); LOG_WARNING(Service_ACC, "(STUBBED) called, uuid=0x{}, tid={:016X}", uuid.RawString(), tid); @@ -895,7 +894,7 @@ void Module::Interface::StoreSaveDataThumbnailSystem(Kernel::HLERequestContext& } void Module::Interface::StoreSaveDataThumbnail(Kernel::HLERequestContext& ctx, - const Common::NewUUID& uuid, const u64 tid) { + const Common::UUID& uuid, const u64 tid) { IPC::ResponseBuilder rb{ctx, 2}; if (tid == 0) { diff --git a/src/core/hle/service/acc/acc.h b/src/core/hle/service/acc/acc.h index b57342701..f7e9bc4f8 100644 --- a/src/core/hle/service/acc/acc.h +++ b/src/core/hle/service/acc/acc.h @@ -4,7 +4,7 @@ #pragma once -#include "common/new_uuid.h" +#include "common/uuid.h" #include "core/hle/service/glue/glue_manager.h" #include "core/hle/service/service.h" @@ -43,7 +43,7 @@ public: private: ResultCode InitializeApplicationInfoBase(); - void StoreSaveDataThumbnail(Kernel::HLERequestContext& ctx, const Common::NewUUID& uuid, + void StoreSaveDataThumbnail(Kernel::HLERequestContext& ctx, const Common::UUID& uuid, const u64 tid); enum class ApplicationType : u32_le { diff --git a/src/core/hle/service/acc/profile_manager.cpp b/src/core/hle/service/acc/profile_manager.cpp index 366f3fe14..fba847142 100644 --- a/src/core/hle/service/acc/profile_manager.cpp +++ b/src/core/hle/service/acc/profile_manager.cpp @@ -16,11 +16,11 @@ namespace Service::Account { namespace FS = Common::FS; -using Common::NewUUID; +using Common::UUID; struct UserRaw { - NewUUID uuid{}; - NewUUID uuid2{}; + UUID uuid{}; + UUID uuid2{}; u64 timestamp{}; ProfileUsername username{}; ProfileData extra_data{}; @@ -45,7 +45,7 @@ ProfileManager::ProfileManager() { // Create an user if none are present if (user_count == 0) { - CreateNewUser(NewUUID::MakeRandom(), "yuzu"); + CreateNewUser(UUID::MakeRandom(), "yuzu"); } auto current = @@ -97,7 +97,7 @@ ResultCode ProfileManager::AddUser(const ProfileInfo& user) { /// Create a new user on the system. If the uuid of the user already exists, the user is not /// created. -ResultCode ProfileManager::CreateNewUser(NewUUID uuid, const ProfileUsername& username) { +ResultCode ProfileManager::CreateNewUser(UUID uuid, const ProfileUsername& username) { if (user_count == MAX_USERS) { return ERROR_TOO_MANY_USERS; } @@ -124,7 +124,7 @@ ResultCode ProfileManager::CreateNewUser(NewUUID uuid, const ProfileUsername& us /// Creates a new user on the system. This function allows a much simpler method of registration /// specifically by allowing an std::string for the username. This is required specifically since /// we're loading a string straight from the config -ResultCode ProfileManager::CreateNewUser(NewUUID uuid, const std::string& username) { +ResultCode ProfileManager::CreateNewUser(UUID uuid, const std::string& username) { ProfileUsername username_output{}; if (username.size() > username_output.size()) { @@ -135,7 +135,7 @@ ResultCode ProfileManager::CreateNewUser(NewUUID uuid, const std::string& userna return CreateNewUser(uuid, username_output); } -std::optional ProfileManager::GetUser(std::size_t index) const { +std::optional ProfileManager::GetUser(std::size_t index) const { if (index >= MAX_USERS) { return std::nullopt; } @@ -144,7 +144,7 @@ std::optional ProfileManager::GetUser(std::size_t index) const { } /// Returns a users profile index based on their user id. -std::optional ProfileManager::GetUserIndex(const NewUUID& uuid) const { +std::optional ProfileManager::GetUserIndex(const UUID& uuid) const { if (uuid.IsInvalid()) { return std::nullopt; } @@ -176,7 +176,7 @@ bool ProfileManager::GetProfileBase(std::optional index, ProfileBas } /// Returns the data structure used by the switch when GetProfileBase is called on acc:* -bool ProfileManager::GetProfileBase(NewUUID uuid, ProfileBase& profile) const { +bool ProfileManager::GetProfileBase(UUID uuid, ProfileBase& profile) const { const auto idx = GetUserIndex(uuid); return GetProfileBase(idx, profile); } @@ -203,7 +203,7 @@ std::size_t ProfileManager::GetOpenUserCount() const { } /// Checks if a user id exists in our profile manager -bool ProfileManager::UserExists(NewUUID uuid) const { +bool ProfileManager::UserExists(UUID uuid) const { return GetUserIndex(uuid).has_value(); } @@ -215,7 +215,7 @@ bool ProfileManager::UserExistsIndex(std::size_t index) const { } /// Opens a specific user -void ProfileManager::OpenUser(NewUUID uuid) { +void ProfileManager::OpenUser(UUID uuid) { const auto idx = GetUserIndex(uuid); if (!idx) { return; @@ -226,7 +226,7 @@ void ProfileManager::OpenUser(NewUUID uuid) { } /// Closes a specific user -void ProfileManager::CloseUser(NewUUID uuid) { +void ProfileManager::CloseUser(UUID uuid) { const auto idx = GetUserIndex(uuid); if (!idx) { return; @@ -253,12 +253,12 @@ UserIDArray ProfileManager::GetOpenUsers() const { return Common::InvalidUUID; }); std::stable_partition(output.begin(), output.end(), - [](const NewUUID& uuid) { return uuid.IsValid(); }); + [](const UUID& uuid) { return uuid.IsValid(); }); return output; } /// Returns the last user which was opened -NewUUID ProfileManager::GetLastOpenedUser() const { +UUID ProfileManager::GetLastOpenedUser() const { return last_opened_user; } @@ -273,7 +273,7 @@ bool ProfileManager::GetProfileBaseAndData(std::optional index, Pro } /// Return the users profile base and the unknown arbitary data. -bool ProfileManager::GetProfileBaseAndData(NewUUID uuid, ProfileBase& profile, +bool ProfileManager::GetProfileBaseAndData(UUID uuid, ProfileBase& profile, ProfileData& data) const { const auto idx = GetUserIndex(uuid); return GetProfileBaseAndData(idx, profile, data); @@ -292,7 +292,7 @@ bool ProfileManager::CanSystemRegisterUser() const { // emulate qlaunch. Update this to dynamically change. } -bool ProfileManager::RemoveUser(NewUUID uuid) { +bool ProfileManager::RemoveUser(UUID uuid) { const auto index = GetUserIndex(uuid); if (!index) { return false; @@ -304,7 +304,7 @@ bool ProfileManager::RemoveUser(NewUUID uuid) { return true; } -bool ProfileManager::SetProfileBase(NewUUID uuid, const ProfileBase& profile_new) { +bool ProfileManager::SetProfileBase(UUID uuid, const ProfileBase& profile_new) { const auto index = GetUserIndex(uuid); if (!index || profile_new.user_uuid.IsInvalid()) { return false; @@ -318,7 +318,7 @@ bool ProfileManager::SetProfileBase(NewUUID uuid, const ProfileBase& profile_new return true; } -bool ProfileManager::SetProfileBaseAndData(Common::NewUUID uuid, const ProfileBase& profile_new, +bool ProfileManager::SetProfileBaseAndData(Common::UUID uuid, const ProfileBase& profile_new, const ProfileData& data_new) { const auto index = GetUserIndex(uuid); if (index.has_value() && SetProfileBase(uuid, profile_new)) { @@ -336,14 +336,14 @@ void ProfileManager::ParseUserSaveFile() { if (!save.IsOpen()) { LOG_WARNING(Service_ACC, "Failed to load profile data from save data... Generating new " - "user 'yuzu' with random NewUUID."); + "user 'yuzu' with random UUID."); return; } ProfileDataRaw data; if (!save.ReadObject(data)) { LOG_WARNING(Service_ACC, "profiles.dat is smaller than expected... Generating new user " - "'yuzu' with random NewUUID."); + "'yuzu' with random UUID."); return; } diff --git a/src/core/hle/service/acc/profile_manager.h b/src/core/hle/service/acc/profile_manager.h index e9c58a826..17347f7ef 100644 --- a/src/core/hle/service/acc/profile_manager.h +++ b/src/core/hle/service/acc/profile_manager.h @@ -8,8 +8,8 @@ #include #include "common/common_types.h" -#include "common/new_uuid.h" #include "common/swap.h" +#include "common/uuid.h" #include "core/hle/result.h" namespace Service::Account { @@ -18,7 +18,7 @@ constexpr std::size_t MAX_USERS{8}; constexpr std::size_t profile_username_size{32}; using ProfileUsername = std::array; -using UserIDArray = std::array; +using UserIDArray = std::array; /// Contains extra data related to a user. /// TODO: RE this structure @@ -35,7 +35,7 @@ static_assert(sizeof(ProfileData) == 0x80, "ProfileData structure has incorrect /// This holds general information about a users profile. This is where we store all the information /// based on a specific user struct ProfileInfo { - Common::NewUUID user_uuid{}; + Common::UUID user_uuid{}; ProfileUsername username{}; u64 creation_time{}; ProfileData data{}; // TODO(ognik): Work out what this is @@ -43,7 +43,7 @@ struct ProfileInfo { }; struct ProfileBase { - Common::NewUUID user_uuid; + Common::UUID user_uuid; u64_le timestamp; ProfileUsername username; @@ -65,34 +65,34 @@ public: ~ProfileManager(); ResultCode AddUser(const ProfileInfo& user); - ResultCode CreateNewUser(Common::NewUUID uuid, const ProfileUsername& username); - ResultCode CreateNewUser(Common::NewUUID uuid, const std::string& username); - std::optional GetUser(std::size_t index) const; - std::optional GetUserIndex(const Common::NewUUID& uuid) const; + ResultCode CreateNewUser(Common::UUID uuid, const ProfileUsername& username); + ResultCode CreateNewUser(Common::UUID uuid, const std::string& username); + std::optional GetUser(std::size_t index) const; + std::optional GetUserIndex(const Common::UUID& uuid) const; std::optional GetUserIndex(const ProfileInfo& user) const; bool GetProfileBase(std::optional index, ProfileBase& profile) const; - bool GetProfileBase(Common::NewUUID uuid, ProfileBase& profile) const; + bool GetProfileBase(Common::UUID uuid, ProfileBase& profile) const; bool GetProfileBase(const ProfileInfo& user, ProfileBase& profile) const; bool GetProfileBaseAndData(std::optional index, ProfileBase& profile, ProfileData& data) const; - bool GetProfileBaseAndData(Common::NewUUID uuid, ProfileBase& profile, ProfileData& data) const; + bool GetProfileBaseAndData(Common::UUID uuid, ProfileBase& profile, ProfileData& data) const; bool GetProfileBaseAndData(const ProfileInfo& user, ProfileBase& profile, ProfileData& data) const; std::size_t GetUserCount() const; std::size_t GetOpenUserCount() const; - bool UserExists(Common::NewUUID uuid) const; + bool UserExists(Common::UUID uuid) const; bool UserExistsIndex(std::size_t index) const; - void OpenUser(Common::NewUUID uuid); - void CloseUser(Common::NewUUID uuid); + void OpenUser(Common::UUID uuid); + void CloseUser(Common::UUID uuid); UserIDArray GetOpenUsers() const; UserIDArray GetAllUsers() const; - Common::NewUUID GetLastOpenedUser() const; + Common::UUID GetLastOpenedUser() const; bool CanSystemRegisterUser() const; - bool RemoveUser(Common::NewUUID uuid); - bool SetProfileBase(Common::NewUUID uuid, const ProfileBase& profile_new); - bool SetProfileBaseAndData(Common::NewUUID uuid, const ProfileBase& profile_new, + bool RemoveUser(Common::UUID uuid); + bool SetProfileBase(Common::UUID uuid, const ProfileBase& profile_new); + bool SetProfileBaseAndData(Common::UUID uuid, const ProfileBase& profile_new, const ProfileData& data_new); private: @@ -103,7 +103,7 @@ private: std::array profiles{}; std::size_t user_count{}; - Common::NewUUID last_opened_user{}; + Common::UUID last_opened_user{}; }; }; // namespace Service::Account diff --git a/src/core/hle/service/am/am.cpp b/src/core/hle/service/am/am.cpp index 4cdc029b7..773dc9f29 100644 --- a/src/core/hle/service/am/am.cpp +++ b/src/core/hle/service/am/am.cpp @@ -55,7 +55,7 @@ constexpr u32 LAUNCH_PARAMETER_ACCOUNT_PRESELECTED_USER_MAGIC = 0xC79497CA; struct LaunchParameterAccountPreselectedUser { u32_le magic; u32_le is_account_selected; - Common::NewUUID current_user; + Common::UUID current_user; INSERT_PADDING_BYTES(0x70); }; static_assert(sizeof(LaunchParameterAccountPreselectedUser) == 0x88); diff --git a/src/core/hle/service/am/applets/applet_profile_select.cpp b/src/core/hle/service/am/applets/applet_profile_select.cpp index 3ac32fa58..82500e121 100644 --- a/src/core/hle/service/am/applets/applet_profile_select.cpp +++ b/src/core/hle/service/am/applets/applet_profile_select.cpp @@ -54,11 +54,10 @@ void ProfileSelect::Execute() { return; } - frontend.SelectProfile( - [this](std::optional uuid) { SelectionComplete(uuid); }); + frontend.SelectProfile([this](std::optional uuid) { SelectionComplete(uuid); }); } -void ProfileSelect::SelectionComplete(std::optional uuid) { +void ProfileSelect::SelectionComplete(std::optional uuid) { UserSelectionOutput output{}; if (uuid.has_value() && uuid->IsValid()) { diff --git a/src/core/hle/service/am/applets/applet_profile_select.h b/src/core/hle/service/am/applets/applet_profile_select.h index c5c506c41..852e1e0c0 100644 --- a/src/core/hle/service/am/applets/applet_profile_select.h +++ b/src/core/hle/service/am/applets/applet_profile_select.h @@ -7,7 +7,7 @@ #include #include "common/common_funcs.h" -#include "common/new_uuid.h" +#include "common/uuid.h" #include "core/hle/result.h" #include "core/hle/service/am/applets/applets.h" @@ -27,7 +27,7 @@ static_assert(sizeof(UserSelectionConfig) == 0xA0, "UserSelectionConfig has inco struct UserSelectionOutput { u64 result; - Common::NewUUID uuid_selected; + Common::UUID uuid_selected; }; static_assert(sizeof(UserSelectionOutput) == 0x18, "UserSelectionOutput has incorrect size."); @@ -44,7 +44,7 @@ public: void ExecuteInteractive() override; void Execute() override; - void SelectionComplete(std::optional uuid); + void SelectionComplete(std::optional uuid); private: const Core::Frontend::ProfileSelectApplet& frontend; diff --git a/src/core/hle/service/friend/friend.cpp b/src/core/hle/service/friend/friend.cpp index 3c621f7f0..79cd3acbb 100644 --- a/src/core/hle/service/friend/friend.cpp +++ b/src/core/hle/service/friend/friend.cpp @@ -4,7 +4,7 @@ #include #include "common/logging/log.h" -#include "common/new_uuid.h" +#include "common/uuid.h" #include "core/core.h" #include "core/hle/ipc_helpers.h" #include "core/hle/kernel/k_event.h" @@ -170,7 +170,7 @@ private: void GetPlayHistoryRegistrationKey(Kernel::HLERequestContext& ctx) { IPC::RequestParser rp{ctx}; const auto local_play = rp.Pop(); - const auto uuid = rp.PopRaw(); + const auto uuid = rp.PopRaw(); LOG_WARNING(Service_Friend, "(STUBBED) called, local_play={}, uuid=0x{}", local_play, uuid.RawString()); @@ -182,7 +182,7 @@ private: void GetFriendList(Kernel::HLERequestContext& ctx) { IPC::RequestParser rp{ctx}; const auto friend_offset = rp.Pop(); - const auto uuid = rp.PopRaw(); + const auto uuid = rp.PopRaw(); [[maybe_unused]] const auto filter = rp.PopRaw(); const auto pid = rp.Pop(); LOG_WARNING(Service_Friend, "(STUBBED) called, offset={}, uuid=0x{}, pid={}", friend_offset, @@ -202,7 +202,7 @@ private: class INotificationService final : public ServiceFramework { public: - explicit INotificationService(Core::System& system_, Common::NewUUID uuid_) + explicit INotificationService(Core::System& system_, Common::UUID uuid_) : ServiceFramework{system_, "INotificationService"}, uuid{uuid_}, service_context{system_, "INotificationService"} { // clang-format off @@ -293,7 +293,7 @@ private: bool has_received_friend_request; }; - Common::NewUUID uuid; + Common::UUID uuid; KernelHelpers::ServiceContext service_context; Kernel::KEvent* notification_event; @@ -310,7 +310,7 @@ void Module::Interface::CreateFriendService(Kernel::HLERequestContext& ctx) { void Module::Interface::CreateNotificationService(Kernel::HLERequestContext& ctx) { IPC::RequestParser rp{ctx}; - auto uuid = rp.PopRaw(); + auto uuid = rp.PopRaw(); LOG_DEBUG(Service_Friend, "called, uuid=0x{}", uuid.RawString()); diff --git a/src/core/hle/service/mii/mii_manager.cpp b/src/core/hle/service/mii/mii_manager.cpp index aa1a9a6c7..0a57c3cde 100644 --- a/src/core/hle/service/mii/mii_manager.cpp +++ b/src/core/hle/service/mii/mii_manager.cpp @@ -131,8 +131,7 @@ T GetRandomValue(T max) { return GetRandomValue({}, max); } -MiiStoreData BuildRandomStoreData(Age age, Gender gender, Race race, - const Common::NewUUID& user_id) { +MiiStoreData BuildRandomStoreData(Age age, Gender gender, Race race, const Common::UUID& user_id) { MiiStoreBitFields bf{}; if (gender == Gender::All) { @@ -311,7 +310,7 @@ MiiStoreData BuildRandomStoreData(Age age, Gender gender, Race race, return {DefaultMiiName, bf, user_id}; } -MiiStoreData BuildDefaultStoreData(const DefaultMii& info, const Common::NewUUID& user_id) { +MiiStoreData BuildDefaultStoreData(const DefaultMii& info, const Common::UUID& user_id) { MiiStoreBitFields bf{}; bf.font_region.Assign(info.font_region); @@ -372,13 +371,13 @@ MiiStoreData BuildDefaultStoreData(const DefaultMii& info, const Common::NewUUID MiiStoreData::MiiStoreData() = default; MiiStoreData::MiiStoreData(const MiiStoreData::Name& name, const MiiStoreBitFields& bit_fields, - const Common::NewUUID& user_id) { + const Common::UUID& user_id) { data.name = name; - data.uuid = Common::NewUUID::MakeRandomRFC4122V4(); + data.uuid = Common::UUID::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::NewUUID)); + device_crc = GenerateCrc16(&user_id, sizeof(Common::UUID)); } 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 580a64fc9..6999d15b1 100644 --- a/src/core/hle/service/mii/mii_manager.h +++ b/src/core/hle/service/mii/mii_manager.h @@ -8,7 +8,7 @@ #include #include "common/bit_field.h" #include "common/common_funcs.h" -#include "common/new_uuid.h" +#include "common/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::NewUUID uuid; + Common::UUID uuid; std::array name; u8 font_region; u8 favorite_color; @@ -192,7 +192,7 @@ struct MiiStoreData { MiiStoreData(); MiiStoreData(const Name& name, const MiiStoreBitFields& bit_fields, - const Common::NewUUID& user_id); + const Common::UUID& 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::NewUUID uuid{}; + Common::UUID uuid{}; } data; u16 data_crc{}; @@ -326,7 +326,7 @@ public: ResultCode GetIndex(const MiiInfo& info, u32& index); private: - const Common::NewUUID user_id{}; + const Common::UUID user_id{}; u64 update_counter{}; }; diff --git a/src/core/hle/service/ns/pdm_qry.cpp b/src/core/hle/service/ns/pdm_qry.cpp index 3eda444d2..36ce46353 100644 --- a/src/core/hle/service/ns/pdm_qry.cpp +++ b/src/core/hle/service/ns/pdm_qry.cpp @@ -5,7 +5,7 @@ #include #include "common/logging/log.h" -#include "common/new_uuid.h" +#include "common/uuid.h" #include "core/hle/ipc_helpers.h" #include "core/hle/service/ns/pdm_qry.h" #include "core/hle/service/service.h" @@ -49,7 +49,7 @@ void PDM_QRY::QueryPlayStatisticsByApplicationIdAndUserAccountId(Kernel::HLERequ const auto unknown = rp.Pop(); rp.Pop(); // Padding const auto application_id = rp.Pop(); - const auto user_account_uid = rp.PopRaw(); + const auto user_account_uid = rp.PopRaw(); // TODO(German77): Read statistics of the game PlayStatistics statistics{ diff --git a/src/core/hle/service/time/clock_types.h b/src/core/hle/service/time/clock_types.h index 23d6c859b..d0cacb80c 100644 --- a/src/core/hle/service/time/clock_types.h +++ b/src/core/hle/service/time/clock_types.h @@ -6,7 +6,7 @@ #include "common/common_funcs.h" #include "common/common_types.h" -#include "common/new_uuid.h" +#include "common/uuid.h" #include "core/hle/service/time/errors.h" #include "core/hle/service/time/time_zone_types.h" @@ -21,7 +21,7 @@ enum class TimeType : u8 { /// https://switchbrew.org/wiki/Glue_services#SteadyClockTimePoint struct SteadyClockTimePoint { s64 time_point; - Common::NewUUID clock_source_id; + Common::UUID clock_source_id; ResultCode GetSpanBetween(SteadyClockTimePoint other, s64& span) const { span = 0; @@ -36,7 +36,7 @@ struct SteadyClockTimePoint { } static SteadyClockTimePoint GetRandom() { - return {0, Common::NewUUID::MakeRandom()}; + return {0, Common::UUID::MakeRandom()}; } }; static_assert(sizeof(SteadyClockTimePoint) == 0x18, "SteadyClockTimePoint is incorrect size"); @@ -45,7 +45,7 @@ static_assert(std::is_trivially_copyable_v, struct SteadyClockContext { u64 internal_offset; - Common::NewUUID steady_time_point; + Common::UUID steady_time_point; }; static_assert(sizeof(SteadyClockContext) == 0x18, "SteadyClockContext is incorrect size"); static_assert(std::is_trivially_copyable_v, diff --git a/src/core/hle/service/time/steady_clock_core.h b/src/core/hle/service/time/steady_clock_core.h index dfc9fade4..5ee2c0e0a 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 @@ #pragma once -#include "common/new_uuid.h" +#include "common/uuid.h" #include "core/hle/service/time/clock_types.h" namespace Core { @@ -18,11 +18,11 @@ public: SteadyClockCore() = default; virtual ~SteadyClockCore() = default; - const Common::NewUUID& GetClockSourceId() const { + const Common::UUID& GetClockSourceId() const { return clock_source_id; } - void SetClockSourceId(const Common::NewUUID& value) { + void SetClockSourceId(const Common::UUID& value) { clock_source_id = value; } @@ -49,7 +49,7 @@ public: } private: - Common::NewUUID clock_source_id{Common::NewUUID::MakeRandom()}; + Common::UUID clock_source_id{Common::UUID::MakeRandom()}; bool is_initialized{}; }; diff --git a/src/core/hle/service/time/time_manager.cpp b/src/core/hle/service/time/time_manager.cpp index 15a2d99e8..00f1ae8cf 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 { time_zone_content_manager{system} { const auto system_time{Clock::TimeSpanType::FromSeconds(GetExternalRtcValue())}; - SetupStandardSteadyClock(system, Common::NewUUID::MakeRandom(), system_time, {}, {}); + SetupStandardSteadyClock(system, Common::UUID::MakeRandom(), system_time, {}, {}); SetupStandardLocalSystemClock(system, {}, system_time.ToSeconds()); Clock::SystemClockContext clock_context{}; @@ -132,7 +132,7 @@ struct TimeManager::Impl final { return 0; } - void SetupStandardSteadyClock(Core::System& system_, Common::NewUUID clock_source_id, + void SetupStandardSteadyClock(Core::System& system_, Common::UUID clock_source_id, Clock::TimeSpanType setup_value, Clock::TimeSpanType internal_offset, bool is_rtc_reset_detected) { 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 ac31cd9ca..ed9f75ed6 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_) { SharedMemory::~SharedMemory() = default; -void SharedMemory::SetupStandardSteadyClock(const Common::NewUUID& clock_source_id, +void SharedMemory::SetupStandardSteadyClock(const Common::UUID& clock_source_id, Clock::TimeSpanType current_time_point) { const Clock::TimeSpanType ticks_time_span{Clock::TimeSpanType::FromTicks( 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 4063ce4e0..9307ea795 100644 --- a/src/core/hle/service/time/time_sharedmemory.h +++ b/src/core/hle/service/time/time_sharedmemory.h @@ -5,7 +5,7 @@ #pragma once #include "common/common_types.h" -#include "common/new_uuid.h" +#include "common/uuid.h" #include "core/hle/kernel/k_shared_memory.h" #include "core/hle/service/time/clock_types.h" @@ -52,7 +52,7 @@ public: }; static_assert(sizeof(Format) == 0xd8, "Format is an invalid size"); - void SetupStandardSteadyClock(const Common::NewUUID& clock_source_id, + void SetupStandardSteadyClock(const Common::UUID& clock_source_id, Clock::TimeSpanType current_time_point); void UpdateLocalSystemClockContext(const Clock::SystemClockContext& context); void UpdateNetworkSystemClockContext(const Clock::SystemClockContext& context); -- cgit v1.2.3