diff options
Diffstat (limited to 'src/core')
| -rw-r--r-- | src/core/frontend/applets/profile_select.cpp | 3 | ||||
| -rw-r--r-- | src/core/hid/emulated_controller.cpp | 11 | ||||
| -rw-r--r-- | src/core/hle/ipc_helpers.h | 8 | ||||
| -rw-r--r-- | src/core/hle/service/acc/acc.cpp | 42 | ||||
| -rw-r--r-- | src/core/hle/service/acc/profile_manager.cpp | 19 | ||||
| -rw-r--r-- | src/core/hle/service/acc/profile_manager.h | 6 | ||||
| -rw-r--r-- | src/core/hle/service/am/am.cpp | 6 | ||||
| -rw-r--r-- | src/core/hle/service/am/applets/applet_profile_select.cpp | 4 | ||||
| -rw-r--r-- | src/core/hle/service/am/applets/applet_profile_select.h | 2 | ||||
| -rw-r--r-- | src/core/hle/service/friend/friend.cpp | 6 | ||||
| -rw-r--r-- | src/core/hle/service/mii/mii_manager.cpp | 12 | ||||
| -rw-r--r-- | src/core/hle/service/mii/mii_manager.h | 4 | ||||
| -rw-r--r-- | src/core/hle/service/ns/pdm_qry.cpp | 2 | ||||
| -rw-r--r-- | src/core/hle/service/time/clock_types.h | 2 | ||||
| -rw-r--r-- | src/core/hle/service/time/steady_clock_core.h | 2 | ||||
| -rw-r--r-- | src/core/hle/service/time/time_manager.cpp | 2 |
16 files changed, 65 insertions, 66 deletions
diff --git a/src/core/frontend/applets/profile_select.cpp b/src/core/frontend/applets/profile_select.cpp index 3e4f90be2..4c58c310f 100644 --- a/src/core/frontend/applets/profile_select.cpp +++ b/src/core/frontend/applets/profile_select.cpp | |||
| @@ -13,8 +13,7 @@ ProfileSelectApplet::~ProfileSelectApplet() = default; | |||
| 13 | void DefaultProfileSelectApplet::SelectProfile( | 13 | void DefaultProfileSelectApplet::SelectProfile( |
| 14 | std::function<void(std::optional<Common::UUID>)> callback) const { | 14 | std::function<void(std::optional<Common::UUID>)> callback) const { |
| 15 | Service::Account::ProfileManager manager; | 15 | Service::Account::ProfileManager manager; |
| 16 | callback(manager.GetUser(Settings::values.current_user.GetValue()) | 16 | callback(manager.GetUser(Settings::values.current_user.GetValue()).value_or(Common::UUID{})); |
| 17 | .value_or(Common::UUID{Common::INVALID_UUID})); | ||
| 18 | LOG_INFO(Service_ACC, "called, selecting current user instead of prompting..."); | 17 | LOG_INFO(Service_ACC, "called, selecting current user instead of prompting..."); |
| 19 | } | 18 | } |
| 20 | 19 | ||
diff --git a/src/core/hid/emulated_controller.cpp b/src/core/hid/emulated_controller.cpp index a7cdf45e6..2bee173b3 100644 --- a/src/core/hid/emulated_controller.cpp +++ b/src/core/hid/emulated_controller.cpp | |||
| @@ -269,7 +269,8 @@ void EmulatedController::ReloadInput() { | |||
| 269 | } | 269 | } |
| 270 | 270 | ||
| 271 | // Use a common UUID for TAS | 271 | // Use a common UUID for TAS |
| 272 | const auto tas_uuid = Common::UUID{0x0, 0x7A5}; | 272 | static constexpr Common::UUID TAS_UUID = Common::UUID{ |
| 273 | {0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x7, 0xA5, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0}}; | ||
| 273 | 274 | ||
| 274 | // Register TAS devices. No need to force update | 275 | // Register TAS devices. No need to force update |
| 275 | for (std::size_t index = 0; index < tas_button_devices.size(); ++index) { | 276 | for (std::size_t index = 0; index < tas_button_devices.size(); ++index) { |
| @@ -278,8 +279,8 @@ void EmulatedController::ReloadInput() { | |||
| 278 | } | 279 | } |
| 279 | tas_button_devices[index]->SetCallback({ | 280 | tas_button_devices[index]->SetCallback({ |
| 280 | .on_change = | 281 | .on_change = |
| 281 | [this, index, tas_uuid](const Common::Input::CallbackStatus& callback) { | 282 | [this, index](const Common::Input::CallbackStatus& callback) { |
| 282 | SetButton(callback, index, tas_uuid); | 283 | SetButton(callback, index, TAS_UUID); |
| 283 | }, | 284 | }, |
| 284 | }); | 285 | }); |
| 285 | } | 286 | } |
| @@ -290,8 +291,8 @@ void EmulatedController::ReloadInput() { | |||
| 290 | } | 291 | } |
| 291 | tas_stick_devices[index]->SetCallback({ | 292 | tas_stick_devices[index]->SetCallback({ |
| 292 | .on_change = | 293 | .on_change = |
| 293 | [this, index, tas_uuid](const Common::Input::CallbackStatus& callback) { | 294 | [this, index](const Common::Input::CallbackStatus& callback) { |
| 294 | SetStick(callback, index, tas_uuid); | 295 | SetStick(callback, index, TAS_UUID); |
| 295 | }, | 296 | }, |
| 296 | }); | 297 | }); |
| 297 | } | 298 | } |
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() { | |||
| 404 | return static_cast<s32>(Pop<u32>()); | 404 | return static_cast<s32>(Pop<u32>()); |
| 405 | } | 405 | } |
| 406 | 406 | ||
| 407 | // Ignore the -Wclass-memaccess warning on memcpy for non-trivially default constructible objects. | ||
| 408 | #if defined(__GNUC__) | ||
| 409 | #pragma GCC diagnostic push | ||
| 410 | #pragma GCC diagnostic ignored "-Wclass-memaccess" | ||
| 411 | #endif | ||
| 407 | template <typename T> | 412 | template <typename T> |
| 408 | void RequestParser::PopRaw(T& value) { | 413 | void RequestParser::PopRaw(T& value) { |
| 409 | static_assert(std::is_trivially_copyable_v<T>, | 414 | static_assert(std::is_trivially_copyable_v<T>, |
| @@ -411,6 +416,9 @@ void RequestParser::PopRaw(T& value) { | |||
| 411 | std::memcpy(&value, cmdbuf + index, sizeof(T)); | 416 | std::memcpy(&value, cmdbuf + index, sizeof(T)); |
| 412 | index += (sizeof(T) + 3) / 4; // round up to word length | 417 | index += (sizeof(T) + 3) / 4; // round up to word length |
| 413 | } | 418 | } |
| 419 | #if defined(__GNUC__) | ||
| 420 | #pragma GCC diagnostic pop | ||
| 421 | #endif | ||
| 414 | 422 | ||
| 415 | template <typename T> | 423 | template <typename T> |
| 416 | T RequestParser::PopRaw() { | 424 | T RequestParser::PopRaw() { |
diff --git a/src/core/hle/service/acc/acc.cpp b/src/core/hle/service/acc/acc.cpp index 6e63e057e..e34ef5a78 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}; | |||
| 39 | // Thumbnails are hard coded to be at least this size | 39 | // Thumbnails are hard coded to be at least this size |
| 40 | constexpr std::size_t THUMBNAIL_SIZE = 0x24000; | 40 | constexpr std::size_t THUMBNAIL_SIZE = 0x24000; |
| 41 | 41 | ||
| 42 | static std::filesystem::path GetImagePath(Common::UUID uuid) { | 42 | static std::filesystem::path GetImagePath(const Common::UUID& uuid) { |
| 43 | return Common::FS::GetYuzuPath(Common::FS::YuzuPath::NANDDir) / | 43 | return Common::FS::GetYuzuPath(Common::FS::YuzuPath::NANDDir) / |
| 44 | fmt::format("system/save/8000000000000010/su/avators/{}.jpg", uuid.FormatSwitch()); | 44 | fmt::format("system/save/8000000000000010/su/avators/{}.jpg", uuid.FormattedString()); |
| 45 | } | 45 | } |
| 46 | 46 | ||
| 47 | static constexpr u32 SanitizeJPEGSize(std::size_t size) { | 47 | static constexpr u32 SanitizeJPEGSize(std::size_t size) { |
| @@ -290,7 +290,7 @@ public: | |||
| 290 | 290 | ||
| 291 | protected: | 291 | protected: |
| 292 | void Get(Kernel::HLERequestContext& ctx) { | 292 | void Get(Kernel::HLERequestContext& ctx) { |
| 293 | LOG_DEBUG(Service_ACC, "called user_id=0x{}", user_id.Format()); | 293 | LOG_DEBUG(Service_ACC, "called user_id=0x{}", user_id.RawString()); |
| 294 | ProfileBase profile_base{}; | 294 | ProfileBase profile_base{}; |
| 295 | ProfileData data{}; | 295 | ProfileData data{}; |
| 296 | if (profile_manager.GetProfileBaseAndData(user_id, profile_base, data)) { | 296 | if (profile_manager.GetProfileBaseAndData(user_id, profile_base, data)) { |
| @@ -300,21 +300,21 @@ protected: | |||
| 300 | rb.PushRaw(profile_base); | 300 | rb.PushRaw(profile_base); |
| 301 | } else { | 301 | } else { |
| 302 | LOG_ERROR(Service_ACC, "Failed to get profile base and data for user=0x{}", | 302 | LOG_ERROR(Service_ACC, "Failed to get profile base and data for user=0x{}", |
| 303 | user_id.Format()); | 303 | user_id.RawString()); |
| 304 | IPC::ResponseBuilder rb{ctx, 2}; | 304 | IPC::ResponseBuilder rb{ctx, 2}; |
| 305 | rb.Push(ResultUnknown); // TODO(ogniK): Get actual error code | 305 | rb.Push(ResultUnknown); // TODO(ogniK): Get actual error code |
| 306 | } | 306 | } |
| 307 | } | 307 | } |
| 308 | 308 | ||
| 309 | void GetBase(Kernel::HLERequestContext& ctx) { | 309 | void GetBase(Kernel::HLERequestContext& ctx) { |
| 310 | LOG_DEBUG(Service_ACC, "called user_id=0x{}", user_id.Format()); | 310 | LOG_DEBUG(Service_ACC, "called user_id=0x{}", user_id.RawString()); |
| 311 | ProfileBase profile_base{}; | 311 | ProfileBase profile_base{}; |
| 312 | if (profile_manager.GetProfileBase(user_id, profile_base)) { | 312 | if (profile_manager.GetProfileBase(user_id, profile_base)) { |
| 313 | IPC::ResponseBuilder rb{ctx, 16}; | 313 | IPC::ResponseBuilder rb{ctx, 16}; |
| 314 | rb.Push(ResultSuccess); | 314 | rb.Push(ResultSuccess); |
| 315 | rb.PushRaw(profile_base); | 315 | rb.PushRaw(profile_base); |
| 316 | } else { | 316 | } else { |
| 317 | LOG_ERROR(Service_ACC, "Failed to get profile base for user=0x{}", user_id.Format()); | 317 | LOG_ERROR(Service_ACC, "Failed to get profile base for user=0x{}", user_id.RawString()); |
| 318 | IPC::ResponseBuilder rb{ctx, 2}; | 318 | IPC::ResponseBuilder rb{ctx, 2}; |
| 319 | rb.Push(ResultUnknown); // TODO(ogniK): Get actual error code | 319 | rb.Push(ResultUnknown); // TODO(ogniK): Get actual error code |
| 320 | } | 320 | } |
| @@ -373,7 +373,7 @@ protected: | |||
| 373 | LOG_DEBUG(Service_ACC, "called, username='{}', timestamp={:016X}, uuid=0x{}", | 373 | LOG_DEBUG(Service_ACC, "called, username='{}', timestamp={:016X}, uuid=0x{}", |
| 374 | Common::StringFromFixedZeroTerminatedBuffer( | 374 | Common::StringFromFixedZeroTerminatedBuffer( |
| 375 | reinterpret_cast<const char*>(base.username.data()), base.username.size()), | 375 | reinterpret_cast<const char*>(base.username.data()), base.username.size()), |
| 376 | base.timestamp, base.user_uuid.Format()); | 376 | base.timestamp, base.user_uuid.RawString()); |
| 377 | 377 | ||
| 378 | if (user_data.size() < sizeof(ProfileData)) { | 378 | if (user_data.size() < sizeof(ProfileData)) { |
| 379 | LOG_ERROR(Service_ACC, "ProfileData buffer too small!"); | 379 | LOG_ERROR(Service_ACC, "ProfileData buffer too small!"); |
| @@ -406,7 +406,7 @@ protected: | |||
| 406 | LOG_DEBUG(Service_ACC, "called, username='{}', timestamp={:016X}, uuid=0x{}", | 406 | LOG_DEBUG(Service_ACC, "called, username='{}', timestamp={:016X}, uuid=0x{}", |
| 407 | Common::StringFromFixedZeroTerminatedBuffer( | 407 | Common::StringFromFixedZeroTerminatedBuffer( |
| 408 | reinterpret_cast<const char*>(base.username.data()), base.username.size()), | 408 | reinterpret_cast<const char*>(base.username.data()), base.username.size()), |
| 409 | base.timestamp, base.user_uuid.Format()); | 409 | base.timestamp, base.user_uuid.RawString()); |
| 410 | 410 | ||
| 411 | if (user_data.size() < sizeof(ProfileData)) { | 411 | if (user_data.size() < sizeof(ProfileData)) { |
| 412 | LOG_ERROR(Service_ACC, "ProfileData buffer too small!"); | 412 | LOG_ERROR(Service_ACC, "ProfileData buffer too small!"); |
| @@ -435,7 +435,7 @@ protected: | |||
| 435 | } | 435 | } |
| 436 | 436 | ||
| 437 | ProfileManager& profile_manager; | 437 | ProfileManager& profile_manager; |
| 438 | Common::UUID user_id{Common::INVALID_UUID}; ///< The user id this profile refers to. | 438 | Common::UUID user_id{}; ///< The user id this profile refers to. |
| 439 | }; | 439 | }; |
| 440 | 440 | ||
| 441 | class IProfile final : public IProfileCommon { | 441 | class IProfile final : public IProfileCommon { |
| @@ -547,7 +547,7 @@ private: | |||
| 547 | 547 | ||
| 548 | IPC::ResponseBuilder rb{ctx, 4}; | 548 | IPC::ResponseBuilder rb{ctx, 4}; |
| 549 | rb.Push(ResultSuccess); | 549 | rb.Push(ResultSuccess); |
| 550 | rb.PushRaw<u64>(user_id.GetNintendoID()); | 550 | rb.PushRaw<u64>(user_id.Hash()); |
| 551 | } | 551 | } |
| 552 | 552 | ||
| 553 | void EnsureIdTokenCacheAsync(Kernel::HLERequestContext& ctx) { | 553 | void EnsureIdTokenCacheAsync(Kernel::HLERequestContext& ctx) { |
| @@ -577,7 +577,7 @@ private: | |||
| 577 | 577 | ||
| 578 | IPC::ResponseBuilder rb{ctx, 4}; | 578 | IPC::ResponseBuilder rb{ctx, 4}; |
| 579 | rb.Push(ResultSuccess); | 579 | rb.Push(ResultSuccess); |
| 580 | rb.PushRaw<u64>(user_id.GetNintendoID()); | 580 | rb.PushRaw<u64>(user_id.Hash()); |
| 581 | } | 581 | } |
| 582 | 582 | ||
| 583 | void StoreOpenContext(Kernel::HLERequestContext& ctx) { | 583 | void StoreOpenContext(Kernel::HLERequestContext& ctx) { |
| @@ -587,7 +587,7 @@ private: | |||
| 587 | } | 587 | } |
| 588 | 588 | ||
| 589 | std::shared_ptr<EnsureTokenIdCacheAsyncInterface> ensure_token_id{}; | 589 | std::shared_ptr<EnsureTokenIdCacheAsyncInterface> ensure_token_id{}; |
| 590 | Common::UUID user_id{Common::INVALID_UUID}; | 590 | Common::UUID user_id{}; |
| 591 | }; | 591 | }; |
| 592 | 592 | ||
| 593 | // 6.0.0+ | 593 | // 6.0.0+ |
| @@ -687,7 +687,7 @@ void Module::Interface::GetUserCount(Kernel::HLERequestContext& ctx) { | |||
| 687 | void Module::Interface::GetUserExistence(Kernel::HLERequestContext& ctx) { | 687 | void Module::Interface::GetUserExistence(Kernel::HLERequestContext& ctx) { |
| 688 | IPC::RequestParser rp{ctx}; | 688 | IPC::RequestParser rp{ctx}; |
| 689 | Common::UUID user_id = rp.PopRaw<Common::UUID>(); | 689 | Common::UUID user_id = rp.PopRaw<Common::UUID>(); |
| 690 | LOG_DEBUG(Service_ACC, "called user_id=0x{}", user_id.Format()); | 690 | LOG_DEBUG(Service_ACC, "called user_id=0x{}", user_id.RawString()); |
| 691 | 691 | ||
| 692 | IPC::ResponseBuilder rb{ctx, 3}; | 692 | IPC::ResponseBuilder rb{ctx, 3}; |
| 693 | rb.Push(ResultSuccess); | 693 | rb.Push(ResultSuccess); |
| @@ -718,7 +718,7 @@ void Module::Interface::GetLastOpenedUser(Kernel::HLERequestContext& ctx) { | |||
| 718 | void Module::Interface::GetProfile(Kernel::HLERequestContext& ctx) { | 718 | void Module::Interface::GetProfile(Kernel::HLERequestContext& ctx) { |
| 719 | IPC::RequestParser rp{ctx}; | 719 | IPC::RequestParser rp{ctx}; |
| 720 | Common::UUID user_id = rp.PopRaw<Common::UUID>(); | 720 | Common::UUID user_id = rp.PopRaw<Common::UUID>(); |
| 721 | LOG_DEBUG(Service_ACC, "called user_id=0x{}", user_id.Format()); | 721 | LOG_DEBUG(Service_ACC, "called user_id=0x{}", user_id.RawString()); |
| 722 | 722 | ||
| 723 | IPC::ResponseBuilder rb{ctx, 2, 0, 1}; | 723 | IPC::ResponseBuilder rb{ctx, 2, 0, 1}; |
| 724 | rb.Push(ResultSuccess); | 724 | rb.Push(ResultSuccess); |
| @@ -833,7 +833,7 @@ void Module::Interface::GetProfileEditor(Kernel::HLERequestContext& ctx) { | |||
| 833 | IPC::RequestParser rp{ctx}; | 833 | IPC::RequestParser rp{ctx}; |
| 834 | Common::UUID user_id = rp.PopRaw<Common::UUID>(); | 834 | Common::UUID user_id = rp.PopRaw<Common::UUID>(); |
| 835 | 835 | ||
| 836 | LOG_DEBUG(Service_ACC, "called, user_id=0x{}", user_id.Format()); | 836 | LOG_DEBUG(Service_ACC, "called, user_id=0x{}", user_id.RawString()); |
| 837 | 837 | ||
| 838 | IPC::ResponseBuilder rb{ctx, 2, 0, 1}; | 838 | IPC::ResponseBuilder rb{ctx, 2, 0, 1}; |
| 839 | rb.Push(ResultSuccess); | 839 | rb.Push(ResultSuccess); |
| @@ -875,7 +875,7 @@ void Module::Interface::StoreSaveDataThumbnailApplication(Kernel::HLERequestCont | |||
| 875 | IPC::RequestParser rp{ctx}; | 875 | IPC::RequestParser rp{ctx}; |
| 876 | const auto uuid = rp.PopRaw<Common::UUID>(); | 876 | const auto uuid = rp.PopRaw<Common::UUID>(); |
| 877 | 877 | ||
| 878 | LOG_WARNING(Service_ACC, "(STUBBED) called, uuid=0x{}", uuid.Format()); | 878 | LOG_WARNING(Service_ACC, "(STUBBED) called, uuid=0x{}", uuid.RawString()); |
| 879 | 879 | ||
| 880 | // TODO(ogniK): Check if application ID is zero on acc initialize. As we don't have a reliable | 880 | // TODO(ogniK): Check if application ID is zero on acc initialize. As we don't have a reliable |
| 881 | // way of confirming things like the TID, we're going to assume a non zero value for the time | 881 | // way of confirming things like the TID, we're going to assume a non zero value for the time |
| @@ -889,7 +889,7 @@ void Module::Interface::StoreSaveDataThumbnailSystem(Kernel::HLERequestContext& | |||
| 889 | const auto uuid = rp.PopRaw<Common::UUID>(); | 889 | const auto uuid = rp.PopRaw<Common::UUID>(); |
| 890 | const auto tid = rp.Pop<u64_le>(); | 890 | const auto tid = rp.Pop<u64_le>(); |
| 891 | 891 | ||
| 892 | LOG_WARNING(Service_ACC, "(STUBBED) called, uuid=0x{}, tid={:016X}", uuid.Format(), tid); | 892 | LOG_WARNING(Service_ACC, "(STUBBED) called, uuid=0x{}, tid={:016X}", uuid.RawString(), tid); |
| 893 | StoreSaveDataThumbnail(ctx, uuid, tid); | 893 | StoreSaveDataThumbnail(ctx, uuid, tid); |
| 894 | } | 894 | } |
| 895 | 895 | ||
| @@ -903,7 +903,7 @@ void Module::Interface::StoreSaveDataThumbnail(Kernel::HLERequestContext& ctx, | |||
| 903 | return; | 903 | return; |
| 904 | } | 904 | } |
| 905 | 905 | ||
| 906 | if (!uuid) { | 906 | if (uuid.IsInvalid()) { |
| 907 | LOG_ERROR(Service_ACC, "User ID is not valid!"); | 907 | LOG_ERROR(Service_ACC, "User ID is not valid!"); |
| 908 | rb.Push(ERR_INVALID_USER_ID); | 908 | rb.Push(ERR_INVALID_USER_ID); |
| 909 | return; | 909 | return; |
| @@ -927,20 +927,20 @@ void Module::Interface::TrySelectUserWithoutInteraction(Kernel::HLERequestContex | |||
| 927 | IPC::ResponseBuilder rb{ctx, 6}; | 927 | IPC::ResponseBuilder rb{ctx, 6}; |
| 928 | if (profile_manager->GetUserCount() != 1) { | 928 | if (profile_manager->GetUserCount() != 1) { |
| 929 | rb.Push(ResultSuccess); | 929 | rb.Push(ResultSuccess); |
| 930 | rb.PushRaw<u128>(Common::INVALID_UUID); | 930 | rb.PushRaw(Common::InvalidUUID); |
| 931 | return; | 931 | return; |
| 932 | } | 932 | } |
| 933 | 933 | ||
| 934 | const auto user_list = profile_manager->GetAllUsers(); | 934 | const auto user_list = profile_manager->GetAllUsers(); |
| 935 | if (std::ranges::all_of(user_list, [](const auto& user) { return user.IsInvalid(); })) { | 935 | if (std::ranges::all_of(user_list, [](const auto& user) { return user.IsInvalid(); })) { |
| 936 | rb.Push(ResultUnknown); // TODO(ogniK): Find the correct error code | 936 | rb.Push(ResultUnknown); // TODO(ogniK): Find the correct error code |
| 937 | rb.PushRaw<u128>(Common::INVALID_UUID); | 937 | rb.PushRaw(Common::InvalidUUID); |
| 938 | return; | 938 | return; |
| 939 | } | 939 | } |
| 940 | 940 | ||
| 941 | // Select the first user we have | 941 | // Select the first user we have |
| 942 | rb.Push(ResultSuccess); | 942 | rb.Push(ResultSuccess); |
| 943 | rb.PushRaw<u128>(profile_manager->GetUser(0)->uuid); | 943 | rb.PushRaw(profile_manager->GetUser(0)->uuid); |
| 944 | } | 944 | } |
| 945 | 945 | ||
| 946 | Module::Interface::Interface(std::shared_ptr<Module> module_, | 946 | Module::Interface::Interface(std::shared_ptr<Module> module_, |
diff --git a/src/core/hle/service/acc/profile_manager.cpp b/src/core/hle/service/acc/profile_manager.cpp index 568303ced..fba847142 100644 --- a/src/core/hle/service/acc/profile_manager.cpp +++ b/src/core/hle/service/acc/profile_manager.cpp | |||
| @@ -19,8 +19,8 @@ namespace FS = Common::FS; | |||
| 19 | using Common::UUID; | 19 | using Common::UUID; |
| 20 | 20 | ||
| 21 | struct UserRaw { | 21 | struct UserRaw { |
| 22 | UUID uuid{Common::INVALID_UUID}; | 22 | UUID uuid{}; |
| 23 | UUID uuid2{Common::INVALID_UUID}; | 23 | UUID uuid2{}; |
| 24 | u64 timestamp{}; | 24 | u64 timestamp{}; |
| 25 | ProfileUsername username{}; | 25 | ProfileUsername username{}; |
| 26 | ProfileData extra_data{}; | 26 | ProfileData extra_data{}; |
| @@ -45,7 +45,7 @@ ProfileManager::ProfileManager() { | |||
| 45 | 45 | ||
| 46 | // Create an user if none are present | 46 | // Create an user if none are present |
| 47 | if (user_count == 0) { | 47 | if (user_count == 0) { |
| 48 | CreateNewUser(UUID::Generate(), "yuzu"); | 48 | CreateNewUser(UUID::MakeRandom(), "yuzu"); |
| 49 | } | 49 | } |
| 50 | 50 | ||
| 51 | auto current = | 51 | auto current = |
| @@ -101,7 +101,7 @@ ResultCode ProfileManager::CreateNewUser(UUID uuid, const ProfileUsername& usern | |||
| 101 | if (user_count == MAX_USERS) { | 101 | if (user_count == MAX_USERS) { |
| 102 | return ERROR_TOO_MANY_USERS; | 102 | return ERROR_TOO_MANY_USERS; |
| 103 | } | 103 | } |
| 104 | if (!uuid) { | 104 | if (uuid.IsInvalid()) { |
| 105 | return ERROR_ARGUMENT_IS_NULL; | 105 | return ERROR_ARGUMENT_IS_NULL; |
| 106 | } | 106 | } |
| 107 | if (username[0] == 0x0) { | 107 | if (username[0] == 0x0) { |
| @@ -145,7 +145,7 @@ std::optional<UUID> ProfileManager::GetUser(std::size_t index) const { | |||
| 145 | 145 | ||
| 146 | /// Returns a users profile index based on their user id. | 146 | /// Returns a users profile index based on their user id. |
| 147 | std::optional<std::size_t> ProfileManager::GetUserIndex(const UUID& uuid) const { | 147 | std::optional<std::size_t> ProfileManager::GetUserIndex(const UUID& uuid) const { |
| 148 | if (!uuid) { | 148 | if (uuid.IsInvalid()) { |
| 149 | return std::nullopt; | 149 | return std::nullopt; |
| 150 | } | 150 | } |
| 151 | 151 | ||
| @@ -250,9 +250,10 @@ UserIDArray ProfileManager::GetOpenUsers() const { | |||
| 250 | std::ranges::transform(profiles, output.begin(), [](const ProfileInfo& p) { | 250 | std::ranges::transform(profiles, output.begin(), [](const ProfileInfo& p) { |
| 251 | if (p.is_open) | 251 | if (p.is_open) |
| 252 | return p.user_uuid; | 252 | return p.user_uuid; |
| 253 | return UUID{Common::INVALID_UUID}; | 253 | return Common::InvalidUUID; |
| 254 | }); | 254 | }); |
| 255 | std::stable_partition(output.begin(), output.end(), [](const UUID& uuid) { return uuid; }); | 255 | std::stable_partition(output.begin(), output.end(), |
| 256 | [](const UUID& uuid) { return uuid.IsValid(); }); | ||
| 256 | return output; | 257 | return output; |
| 257 | } | 258 | } |
| 258 | 259 | ||
| @@ -299,7 +300,7 @@ bool ProfileManager::RemoveUser(UUID uuid) { | |||
| 299 | 300 | ||
| 300 | profiles[*index] = ProfileInfo{}; | 301 | profiles[*index] = ProfileInfo{}; |
| 301 | std::stable_partition(profiles.begin(), profiles.end(), | 302 | std::stable_partition(profiles.begin(), profiles.end(), |
| 302 | [](const ProfileInfo& profile) { return profile.user_uuid; }); | 303 | [](const ProfileInfo& profile) { return profile.user_uuid.IsValid(); }); |
| 303 | return true; | 304 | return true; |
| 304 | } | 305 | } |
| 305 | 306 | ||
| @@ -361,7 +362,7 @@ void ProfileManager::ParseUserSaveFile() { | |||
| 361 | } | 362 | } |
| 362 | 363 | ||
| 363 | std::stable_partition(profiles.begin(), profiles.end(), | 364 | std::stable_partition(profiles.begin(), profiles.end(), |
| 364 | [](const ProfileInfo& profile) { return profile.user_uuid; }); | 365 | [](const ProfileInfo& profile) { return profile.user_uuid.IsValid(); }); |
| 365 | } | 366 | } |
| 366 | 367 | ||
| 367 | void ProfileManager::WriteUserSaveFile() { | 368 | 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..17347f7ef 100644 --- a/src/core/hle/service/acc/profile_manager.h +++ b/src/core/hle/service/acc/profile_manager.h | |||
| @@ -35,7 +35,7 @@ static_assert(sizeof(ProfileData) == 0x80, "ProfileData structure has incorrect | |||
| 35 | /// This holds general information about a users profile. This is where we store all the information | 35 | /// This holds general information about a users profile. This is where we store all the information |
| 36 | /// based on a specific user | 36 | /// based on a specific user |
| 37 | struct ProfileInfo { | 37 | struct ProfileInfo { |
| 38 | Common::UUID user_uuid{Common::INVALID_UUID}; | 38 | Common::UUID user_uuid{}; |
| 39 | ProfileUsername username{}; | 39 | ProfileUsername username{}; |
| 40 | u64 creation_time{}; | 40 | u64 creation_time{}; |
| 41 | ProfileData data{}; // TODO(ognik): Work out what this is | 41 | ProfileData data{}; // TODO(ognik): Work out what this is |
| @@ -49,7 +49,7 @@ struct ProfileBase { | |||
| 49 | 49 | ||
| 50 | // Zero out all the fields to make the profile slot considered "Empty" | 50 | // Zero out all the fields to make the profile slot considered "Empty" |
| 51 | void Invalidate() { | 51 | void Invalidate() { |
| 52 | user_uuid.Invalidate(); | 52 | user_uuid = {}; |
| 53 | timestamp = 0; | 53 | timestamp = 0; |
| 54 | username.fill(0); | 54 | username.fill(0); |
| 55 | } | 55 | } |
| @@ -103,7 +103,7 @@ private: | |||
| 103 | 103 | ||
| 104 | std::array<ProfileInfo, MAX_USERS> profiles{}; | 104 | std::array<ProfileInfo, MAX_USERS> profiles{}; |
| 105 | std::size_t user_count{}; | 105 | std::size_t user_count{}; |
| 106 | Common::UUID last_opened_user{Common::INVALID_UUID}; | 106 | Common::UUID last_opened_user{}; |
| 107 | }; | 107 | }; |
| 108 | 108 | ||
| 109 | }; // namespace Service::Account | 109 | }; // namespace Service::Account |
diff --git a/src/core/hle/service/am/am.cpp b/src/core/hle/service/am/am.cpp index e60661fe1..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; | |||
| 55 | struct LaunchParameterAccountPreselectedUser { | 55 | struct LaunchParameterAccountPreselectedUser { |
| 56 | u32_le magic; | 56 | u32_le magic; |
| 57 | u32_le is_account_selected; | 57 | u32_le is_account_selected; |
| 58 | u128 current_user; | 58 | Common::UUID current_user; |
| 59 | INSERT_PADDING_BYTES(0x70); | 59 | INSERT_PADDING_BYTES(0x70); |
| 60 | }; | 60 | }; |
| 61 | static_assert(sizeof(LaunchParameterAccountPreselectedUser) == 0x88); | 61 | static_assert(sizeof(LaunchParameterAccountPreselectedUser) == 0x88); |
| @@ -1453,8 +1453,8 @@ void IApplicationFunctions::PopLaunchParameter(Kernel::HLERequestContext& ctx) { | |||
| 1453 | 1453 | ||
| 1454 | Account::ProfileManager profile_manager{}; | 1454 | Account::ProfileManager profile_manager{}; |
| 1455 | const auto uuid = profile_manager.GetUser(static_cast<s32>(Settings::values.current_user)); | 1455 | const auto uuid = profile_manager.GetUser(static_cast<s32>(Settings::values.current_user)); |
| 1456 | ASSERT(uuid); | 1456 | ASSERT(uuid.has_value() && uuid->IsValid()); |
| 1457 | params.current_user = uuid->uuid; | 1457 | params.current_user = *uuid; |
| 1458 | 1458 | ||
| 1459 | IPC::ResponseBuilder rb{ctx, 2, 0, 1}; | 1459 | IPC::ResponseBuilder rb{ctx, 2, 0, 1}; |
| 1460 | 1460 | ||
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..82500e121 100644 --- a/src/core/hle/service/am/applets/applet_profile_select.cpp +++ b/src/core/hle/service/am/applets/applet_profile_select.cpp | |||
| @@ -62,11 +62,11 @@ void ProfileSelect::SelectionComplete(std::optional<Common::UUID> uuid) { | |||
| 62 | 62 | ||
| 63 | if (uuid.has_value() && uuid->IsValid()) { | 63 | if (uuid.has_value() && uuid->IsValid()) { |
| 64 | output.result = 0; | 64 | output.result = 0; |
| 65 | output.uuid_selected = uuid->uuid; | 65 | output.uuid_selected = *uuid; |
| 66 | } else { | 66 | } else { |
| 67 | status = ERR_USER_CANCELLED_SELECTION; | 67 | status = ERR_USER_CANCELLED_SELECTION; |
| 68 | output.result = ERR_USER_CANCELLED_SELECTION.raw; | 68 | output.result = ERR_USER_CANCELLED_SELECTION.raw; |
| 69 | output.uuid_selected = Common::INVALID_UUID; | 69 | output.uuid_selected = Common::InvalidUUID; |
| 70 | } | 70 | } |
| 71 | 71 | ||
| 72 | final_data = std::vector<u8>(sizeof(UserSelectionOutput)); | 72 | final_data = std::vector<u8>(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..852e1e0c0 100644 --- a/src/core/hle/service/am/applets/applet_profile_select.h +++ b/src/core/hle/service/am/applets/applet_profile_select.h | |||
| @@ -27,7 +27,7 @@ static_assert(sizeof(UserSelectionConfig) == 0xA0, "UserSelectionConfig has inco | |||
| 27 | 27 | ||
| 28 | struct UserSelectionOutput { | 28 | struct UserSelectionOutput { |
| 29 | u64 result; | 29 | u64 result; |
| 30 | u128 uuid_selected; | 30 | Common::UUID uuid_selected; |
| 31 | }; | 31 | }; |
| 32 | static_assert(sizeof(UserSelectionOutput) == 0x18, "UserSelectionOutput has incorrect size."); | 32 | static_assert(sizeof(UserSelectionOutput) == 0x18, "UserSelectionOutput has incorrect size."); |
| 33 | 33 | ||
diff --git a/src/core/hle/service/friend/friend.cpp b/src/core/hle/service/friend/friend.cpp index 9f9cea1e0..79cd3acbb 100644 --- a/src/core/hle/service/friend/friend.cpp +++ b/src/core/hle/service/friend/friend.cpp | |||
| @@ -173,7 +173,7 @@ private: | |||
| 173 | const auto uuid = rp.PopRaw<Common::UUID>(); | 173 | const auto uuid = rp.PopRaw<Common::UUID>(); |
| 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); |
| @@ -186,7 +186,7 @@ private: | |||
| 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); |
| @@ -312,7 +312,7 @@ void 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::UUID>(); |
| 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..0a57c3cde 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 | ||
| 121 | Common::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 | |||
| 131 | template <typename T> | 121 | template <typename T> |
| 132 | T GetRandomValue(T min, T max) { | 122 | T GetRandomValue(T min, T max) { |
| 133 | std::random_device device; | 123 | std::random_device device; |
| @@ -383,7 +373,7 @@ MiiStoreData::MiiStoreData() = default; | |||
| 383 | MiiStoreData::MiiStoreData(const MiiStoreData::Name& name, const MiiStoreBitFields& bit_fields, | 373 | MiiStoreData::MiiStoreData(const MiiStoreData::Name& name, const MiiStoreBitFields& bit_fields, |
| 384 | const Common::UUID& user_id) { | 374 | const Common::UUID& user_id) { |
| 385 | data.name = name; | 375 | data.name = name; |
| 386 | data.uuid = GenerateValidUUID(); | 376 | data.uuid = Common::UUID::MakeRandomRFC4122V4(); |
| 387 | 377 | ||
| 388 | std::memcpy(data.data.data(), &bit_fields, sizeof(MiiStoreBitFields)); | 378 | std::memcpy(data.data.data(), &bit_fields, sizeof(MiiStoreBitFields)); |
| 389 | data_crc = GenerateCrc16(data.data.data(), sizeof(data)); | 379 | data_crc = GenerateCrc16(data.data.data(), sizeof(data)); |
diff --git a/src/core/hle/service/mii/mii_manager.h b/src/core/hle/service/mii/mii_manager.h index 8e048fc56..6999d15b1 100644 --- a/src/core/hle/service/mii/mii_manager.h +++ b/src/core/hle/service/mii/mii_manager.h | |||
| @@ -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::UUID 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 | ||
| 328 | private: | 328 | private: |
| 329 | const Common::UUID user_id{Common::INVALID_UUID}; | 329 | const Common::UUID 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..36ce46353 100644 --- a/src/core/hle/service/ns/pdm_qry.cpp +++ b/src/core/hle/service/ns/pdm_qry.cpp | |||
| @@ -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..d0cacb80c 100644 --- a/src/core/hle/service/time/clock_types.h +++ b/src/core/hle/service/time/clock_types.h | |||
| @@ -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::UUID::MakeRandom()}; |
| 40 | } | 40 | } |
| 41 | }; | 41 | }; |
| 42 | static_assert(sizeof(SteadyClockTimePoint) == 0x18, "SteadyClockTimePoint is incorrect size"); | 42 | static_assert(sizeof(SteadyClockTimePoint) == 0x18, "SteadyClockTimePoint is incorrect size"); |
diff --git a/src/core/hle/service/time/steady_clock_core.h b/src/core/hle/service/time/steady_clock_core.h index d80a2385f..5ee2c0e0a 100644 --- a/src/core/hle/service/time/steady_clock_core.h +++ b/src/core/hle/service/time/steady_clock_core.h | |||
| @@ -49,7 +49,7 @@ public: | |||
| 49 | } | 49 | } |
| 50 | 50 | ||
| 51 | private: | 51 | private: |
| 52 | Common::UUID clock_source_id{Common::UUID::Generate()}; | 52 | Common::UUID clock_source_id{Common::UUID::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..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 { | |||
| 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::UUID::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{}; |