diff options
| author | 2022-06-26 10:19:17 -0500 | |
|---|---|---|
| committer | 2022-07-14 16:33:07 -0500 | |
| commit | 32b522b1fddf57006fdcc833bc1f5b18132275ee (patch) | |
| tree | a95f207aff9e3f2a85f0cb7101ba6967d146bb6b | |
| parent | Merge pull request #8559 from liamwhite/waiter-list (diff) | |
| download | yuzu-32b522b1fddf57006fdcc833bc1f5b18132275ee.tar.gz yuzu-32b522b1fddf57006fdcc833bc1f5b18132275ee.tar.xz yuzu-32b522b1fddf57006fdcc833bc1f5b18132275ee.zip | |
service: ac: Replace intances of ProfileData with UserData
Diffstat (limited to '')
| -rw-r--r-- | src/core/hle/service/acc/acc.cpp | 20 | ||||
| -rw-r--r-- | src/core/hle/service/acc/profile_manager.cpp | 11 | ||||
| -rw-r--r-- | src/core/hle/service/acc/profile_manager.h | 15 |
3 files changed, 22 insertions, 24 deletions
diff --git a/src/core/hle/service/acc/acc.cpp b/src/core/hle/service/acc/acc.cpp index b726ac27a..def105832 100644 --- a/src/core/hle/service/acc/acc.cpp +++ b/src/core/hle/service/acc/acc.cpp | |||
| @@ -290,7 +290,7 @@ protected: | |||
| 290 | void Get(Kernel::HLERequestContext& ctx) { | 290 | void Get(Kernel::HLERequestContext& ctx) { |
| 291 | LOG_DEBUG(Service_ACC, "called user_id=0x{}", user_id.RawString()); | 291 | LOG_DEBUG(Service_ACC, "called user_id=0x{}", user_id.RawString()); |
| 292 | ProfileBase profile_base{}; | 292 | ProfileBase profile_base{}; |
| 293 | ProfileData data{}; | 293 | UserData data{}; |
| 294 | if (profile_manager.GetProfileBaseAndData(user_id, profile_base, data)) { | 294 | if (profile_manager.GetProfileBaseAndData(user_id, profile_base, data)) { |
| 295 | ctx.WriteBuffer(data); | 295 | ctx.WriteBuffer(data); |
| 296 | IPC::ResponseBuilder rb{ctx, 16}; | 296 | IPC::ResponseBuilder rb{ctx, 16}; |
| @@ -373,18 +373,18 @@ protected: | |||
| 373 | reinterpret_cast<const char*>(base.username.data()), base.username.size()), | 373 | reinterpret_cast<const char*>(base.username.data()), base.username.size()), |
| 374 | base.timestamp, base.user_uuid.RawString()); | 374 | base.timestamp, base.user_uuid.RawString()); |
| 375 | 375 | ||
| 376 | if (user_data.size() < sizeof(ProfileData)) { | 376 | if (user_data.size() < sizeof(UserData)) { |
| 377 | LOG_ERROR(Service_ACC, "ProfileData buffer too small!"); | 377 | LOG_ERROR(Service_ACC, "UserData buffer too small!"); |
| 378 | IPC::ResponseBuilder rb{ctx, 2}; | 378 | IPC::ResponseBuilder rb{ctx, 2}; |
| 379 | rb.Push(ERR_INVALID_BUFFER); | 379 | rb.Push(ERR_INVALID_BUFFER); |
| 380 | return; | 380 | return; |
| 381 | } | 381 | } |
| 382 | 382 | ||
| 383 | ProfileData data; | 383 | UserData data; |
| 384 | std::memcpy(&data, user_data.data(), sizeof(ProfileData)); | 384 | std::memcpy(&data, user_data.data(), sizeof(UserData)); |
| 385 | 385 | ||
| 386 | if (!profile_manager.SetProfileBaseAndData(user_id, base, data)) { | 386 | if (!profile_manager.SetProfileBaseAndData(user_id, base, data)) { |
| 387 | LOG_ERROR(Service_ACC, "Failed to update profile data and base!"); | 387 | LOG_ERROR(Service_ACC, "Failed to update user data and base!"); |
| 388 | IPC::ResponseBuilder rb{ctx, 2}; | 388 | IPC::ResponseBuilder rb{ctx, 2}; |
| 389 | rb.Push(ERR_FAILED_SAVE_DATA); | 389 | rb.Push(ERR_FAILED_SAVE_DATA); |
| 390 | return; | 390 | return; |
| @@ -406,15 +406,15 @@ protected: | |||
| 406 | reinterpret_cast<const char*>(base.username.data()), base.username.size()), | 406 | reinterpret_cast<const char*>(base.username.data()), base.username.size()), |
| 407 | base.timestamp, base.user_uuid.RawString()); | 407 | base.timestamp, base.user_uuid.RawString()); |
| 408 | 408 | ||
| 409 | if (user_data.size() < sizeof(ProfileData)) { | 409 | if (user_data.size() < sizeof(UserData)) { |
| 410 | LOG_ERROR(Service_ACC, "ProfileData buffer too small!"); | 410 | LOG_ERROR(Service_ACC, "UserData buffer too small!"); |
| 411 | IPC::ResponseBuilder rb{ctx, 2}; | 411 | IPC::ResponseBuilder rb{ctx, 2}; |
| 412 | rb.Push(ERR_INVALID_BUFFER); | 412 | rb.Push(ERR_INVALID_BUFFER); |
| 413 | return; | 413 | return; |
| 414 | } | 414 | } |
| 415 | 415 | ||
| 416 | ProfileData data; | 416 | UserData data; |
| 417 | std::memcpy(&data, user_data.data(), sizeof(ProfileData)); | 417 | std::memcpy(&data, user_data.data(), sizeof(UserData)); |
| 418 | 418 | ||
| 419 | Common::FS::IOFile image(GetImagePath(user_id), Common::FS::FileAccessMode::Write, | 419 | Common::FS::IOFile image(GetImagePath(user_id), Common::FS::FileAccessMode::Write, |
| 420 | Common::FS::FileType::BinaryFile); | 420 | Common::FS::FileType::BinaryFile); |
diff --git a/src/core/hle/service/acc/profile_manager.cpp b/src/core/hle/service/acc/profile_manager.cpp index 8118ead33..a58da4d5f 100644 --- a/src/core/hle/service/acc/profile_manager.cpp +++ b/src/core/hle/service/acc/profile_manager.cpp | |||
| @@ -22,7 +22,7 @@ struct UserRaw { | |||
| 22 | UUID uuid2{}; | 22 | UUID uuid2{}; |
| 23 | u64 timestamp{}; | 23 | u64 timestamp{}; |
| 24 | ProfileUsername username{}; | 24 | ProfileUsername username{}; |
| 25 | ProfileData extra_data{}; | 25 | UserData extra_data{}; |
| 26 | }; | 26 | }; |
| 27 | static_assert(sizeof(UserRaw) == 0xC8, "UserRaw has incorrect size."); | 27 | static_assert(sizeof(UserRaw) == 0xC8, "UserRaw has incorrect size."); |
| 28 | 28 | ||
| @@ -263,7 +263,7 @@ UUID ProfileManager::GetLastOpenedUser() const { | |||
| 263 | 263 | ||
| 264 | /// Return the users profile base and the unknown arbitary data. | 264 | /// Return the users profile base and the unknown arbitary data. |
| 265 | bool ProfileManager::GetProfileBaseAndData(std::optional<std::size_t> index, ProfileBase& profile, | 265 | bool ProfileManager::GetProfileBaseAndData(std::optional<std::size_t> index, ProfileBase& profile, |
| 266 | ProfileData& data) const { | 266 | UserData& data) const { |
| 267 | if (GetProfileBase(index, profile)) { | 267 | if (GetProfileBase(index, profile)) { |
| 268 | data = profiles[*index].data; | 268 | data = profiles[*index].data; |
| 269 | return true; | 269 | return true; |
| @@ -272,15 +272,14 @@ bool ProfileManager::GetProfileBaseAndData(std::optional<std::size_t> index, Pro | |||
| 272 | } | 272 | } |
| 273 | 273 | ||
| 274 | /// Return the users profile base and the unknown arbitary data. | 274 | /// Return the users profile base and the unknown arbitary data. |
| 275 | bool ProfileManager::GetProfileBaseAndData(UUID uuid, ProfileBase& profile, | 275 | bool ProfileManager::GetProfileBaseAndData(UUID uuid, ProfileBase& profile, UserData& data) const { |
| 276 | ProfileData& data) const { | ||
| 277 | const auto idx = GetUserIndex(uuid); | 276 | const auto idx = GetUserIndex(uuid); |
| 278 | return GetProfileBaseAndData(idx, profile, data); | 277 | return GetProfileBaseAndData(idx, profile, data); |
| 279 | } | 278 | } |
| 280 | 279 | ||
| 281 | /// Return the users profile base and the unknown arbitary data. | 280 | /// Return the users profile base and the unknown arbitary data. |
| 282 | bool ProfileManager::GetProfileBaseAndData(const ProfileInfo& user, ProfileBase& profile, | 281 | bool ProfileManager::GetProfileBaseAndData(const ProfileInfo& user, ProfileBase& profile, |
| 283 | ProfileData& data) const { | 282 | UserData& data) const { |
| 284 | return GetProfileBaseAndData(user.user_uuid, profile, data); | 283 | return GetProfileBaseAndData(user.user_uuid, profile, data); |
| 285 | } | 284 | } |
| 286 | 285 | ||
| @@ -318,7 +317,7 @@ bool ProfileManager::SetProfileBase(UUID uuid, const ProfileBase& profile_new) { | |||
| 318 | } | 317 | } |
| 319 | 318 | ||
| 320 | bool ProfileManager::SetProfileBaseAndData(Common::UUID uuid, const ProfileBase& profile_new, | 319 | bool ProfileManager::SetProfileBaseAndData(Common::UUID uuid, const ProfileBase& profile_new, |
| 321 | const ProfileData& data_new) { | 320 | const UserData& data_new) { |
| 322 | const auto index = GetUserIndex(uuid); | 321 | const auto index = GetUserIndex(uuid); |
| 323 | if (index.has_value() && SetProfileBase(uuid, profile_new)) { | 322 | if (index.has_value() && SetProfileBase(uuid, profile_new)) { |
| 324 | profiles[*index].data = data_new; | 323 | profiles[*index].data = data_new; |
diff --git a/src/core/hle/service/acc/profile_manager.h b/src/core/hle/service/acc/profile_manager.h index 9940957f1..135f7d0d5 100644 --- a/src/core/hle/service/acc/profile_manager.h +++ b/src/core/hle/service/acc/profile_manager.h | |||
| @@ -22,7 +22,7 @@ using UserIDArray = std::array<Common::UUID, MAX_USERS>; | |||
| 22 | 22 | ||
| 23 | /// Contains extra data related to a user. | 23 | /// Contains extra data related to a user. |
| 24 | /// TODO: RE this structure | 24 | /// TODO: RE this structure |
| 25 | struct ProfileData { | 25 | struct UserData { |
| 26 | INSERT_PADDING_WORDS_NOINIT(1); | 26 | INSERT_PADDING_WORDS_NOINIT(1); |
| 27 | u32 icon_id; | 27 | u32 icon_id; |
| 28 | u8 bg_color_id; | 28 | u8 bg_color_id; |
| @@ -30,7 +30,7 @@ struct ProfileData { | |||
| 30 | INSERT_PADDING_BYTES_NOINIT(0x10); | 30 | INSERT_PADDING_BYTES_NOINIT(0x10); |
| 31 | INSERT_PADDING_BYTES_NOINIT(0x60); | 31 | INSERT_PADDING_BYTES_NOINIT(0x60); |
| 32 | }; | 32 | }; |
| 33 | static_assert(sizeof(ProfileData) == 0x80, "ProfileData structure has incorrect size"); | 33 | static_assert(sizeof(UserData) == 0x80, "UserData structure has incorrect size"); |
| 34 | 34 | ||
| 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 |
| @@ -38,7 +38,7 @@ struct ProfileInfo { | |||
| 38 | Common::UUID user_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 | UserData data{}; // TODO(ognik): Work out what this is |
| 42 | bool is_open{}; | 42 | bool is_open{}; |
| 43 | }; | 43 | }; |
| 44 | 44 | ||
| @@ -74,10 +74,9 @@ public: | |||
| 74 | bool GetProfileBase(Common::UUID uuid, ProfileBase& profile) const; | 74 | bool GetProfileBase(Common::UUID uuid, ProfileBase& profile) const; |
| 75 | bool GetProfileBase(const ProfileInfo& user, ProfileBase& profile) const; | 75 | bool GetProfileBase(const ProfileInfo& user, ProfileBase& profile) const; |
| 76 | bool GetProfileBaseAndData(std::optional<std::size_t> index, ProfileBase& profile, | 76 | bool GetProfileBaseAndData(std::optional<std::size_t> index, ProfileBase& profile, |
| 77 | ProfileData& data) const; | 77 | UserData& data) const; |
| 78 | bool GetProfileBaseAndData(Common::UUID uuid, ProfileBase& profile, ProfileData& data) const; | 78 | bool GetProfileBaseAndData(Common::UUID uuid, ProfileBase& profile, UserData& data) const; |
| 79 | bool GetProfileBaseAndData(const ProfileInfo& user, ProfileBase& profile, | 79 | bool GetProfileBaseAndData(const ProfileInfo& user, ProfileBase& profile, UserData& data) const; |
| 80 | ProfileData& data) const; | ||
| 81 | std::size_t GetUserCount() const; | 80 | std::size_t GetUserCount() const; |
| 82 | std::size_t GetOpenUserCount() const; | 81 | std::size_t GetOpenUserCount() const; |
| 83 | bool UserExists(Common::UUID uuid) const; | 82 | bool UserExists(Common::UUID uuid) const; |
| @@ -93,7 +92,7 @@ public: | |||
| 93 | bool RemoveUser(Common::UUID uuid); | 92 | bool RemoveUser(Common::UUID uuid); |
| 94 | bool SetProfileBase(Common::UUID uuid, const ProfileBase& profile_new); | 93 | bool SetProfileBase(Common::UUID uuid, const ProfileBase& profile_new); |
| 95 | bool SetProfileBaseAndData(Common::UUID uuid, const ProfileBase& profile_new, | 94 | bool SetProfileBaseAndData(Common::UUID uuid, const ProfileBase& profile_new, |
| 96 | const ProfileData& data_new); | 95 | const UserData& data_new); |
| 97 | 96 | ||
| 98 | private: | 97 | private: |
| 99 | void ParseUserSaveFile(); | 98 | void ParseUserSaveFile(); |