diff options
| author | 2024-02-18 18:40:37 -0500 | |
|---|---|---|
| committer | 2024-02-18 19:02:00 -0500 | |
| commit | d45a12826c94f7f0da62d1df05245fcae38784e7 (patch) | |
| tree | ff111a1568608a17e47d39fa0305b8ad51efbe10 | |
| parent | ns: rewrite IQueryService (diff) | |
| download | yuzu-d45a12826c94f7f0da62d1df05245fcae38784e7.tar.gz yuzu-d45a12826c94f7f0da62d1df05245fcae38784e7.tar.xz yuzu-d45a12826c94f7f0da62d1df05245fcae38784e7.zip | |
ns: address review comments
3 files changed, 35 insertions, 25 deletions
diff --git a/src/core/hle/service/ns/application_manager_interface.cpp b/src/core/hle/service/ns/application_manager_interface.cpp index 9c7975b77..2e3a44c0d 100644 --- a/src/core/hle/service/ns/application_manager_interface.cpp +++ b/src/core/hle/service/ns/application_manager_interface.cpp | |||
| @@ -441,12 +441,13 @@ Result IApplicationManagerInterface::GetApplicationRightsOnClient( | |||
| 441 | flags, application_id, account_id.FormattedString()); | 441 | flags, application_id, account_id.FormattedString()); |
| 442 | 442 | ||
| 443 | if (!out_rights.empty()) { | 443 | if (!out_rights.empty()) { |
| 444 | out_rights[0] = { | 444 | ApplicationRightsOnClient rights{}; |
| 445 | .application_id = application_id, | 445 | rights.application_id = application_id; |
| 446 | .uid = account_id, | 446 | rights.uid = account_id; |
| 447 | .flags = 0, | 447 | rights.flags = 0; |
| 448 | .flags2 = 0, | 448 | rights.flags2 = 0; |
| 449 | }; | 449 | |
| 450 | out_rights[0] = rights; | ||
| 450 | *out_count = 1; | 451 | *out_count = 1; |
| 451 | } else { | 452 | } else { |
| 452 | *out_count = 0; | 453 | *out_count = 0; |
diff --git a/src/core/hle/service/ns/ns_types.h b/src/core/hle/service/ns/ns_types.h index 37ff078bd..38421b0f4 100644 --- a/src/core/hle/service/ns/ns_types.h +++ b/src/core/hle/service/ns/ns_types.h | |||
| @@ -13,8 +13,8 @@ enum class ApplicationRecordType : u8 { | |||
| 13 | Installing = 2, | 13 | Installing = 2, |
| 14 | Installed = 3, | 14 | Installed = 3, |
| 15 | GameCardNotInserted = 5, | 15 | GameCardNotInserted = 5, |
| 16 | Archived = 0xB, | 16 | Archived = 11, |
| 17 | GameCard = 0x10, | 17 | GameCard = 16, |
| 18 | }; | 18 | }; |
| 19 | 19 | ||
| 20 | enum class ApplicationControlSource : u8 { | 20 | enum class ApplicationControlSource : u8 { |
| @@ -37,31 +37,34 @@ struct ApplicationRecord { | |||
| 37 | u8 unknown2; | 37 | u8 unknown2; |
| 38 | INSERT_PADDING_BYTES_NOINIT(0x7); | 38 | INSERT_PADDING_BYTES_NOINIT(0x7); |
| 39 | }; | 39 | }; |
| 40 | static_assert(sizeof(ApplicationRecord) == 0x18, "ApplicationRecord is an invalid size"); | 40 | static_assert(sizeof(ApplicationRecord) == 0x18, "ApplicationRecord has incorrect size."); |
| 41 | 41 | ||
| 42 | /// ApplicationView | 42 | /// ApplicationView |
| 43 | struct ApplicationView { | 43 | struct ApplicationView { |
| 44 | u64 application_id; ///< ApplicationId. | 44 | u64 application_id; ///< ApplicationId. |
| 45 | u32 unk; ///< Unknown. | 45 | u32 unk; ///< Unknown. |
| 46 | u32 flags; ///< Flags. | 46 | u32 flags; ///< Flags. |
| 47 | u8 unk_x10[0x10]; ///< Unknown. | 47 | std::array<u8, 0x10> unk_x10; ///< Unknown. |
| 48 | u32 unk_x20; ///< Unknown. | 48 | u32 unk_x20; ///< Unknown. |
| 49 | u16 unk_x24; ///< Unknown. | 49 | u16 unk_x24; ///< Unknown. |
| 50 | u8 unk_x26[0x2]; ///< Unknown. | 50 | std::array<u8, 0x2> unk_x26; ///< Unknown. |
| 51 | u8 unk_x28[0x8]; ///< Unknown. | 51 | std::array<u8, 0x8> unk_x28; ///< Unknown. |
| 52 | u8 unk_x30[0x10]; ///< Unknown. | 52 | std::array<u8, 0x10> unk_x30; ///< Unknown. |
| 53 | u32 unk_x40; ///< Unknown. | 53 | u32 unk_x40; ///< Unknown. |
| 54 | u8 unk_x44; ///< Unknown. | 54 | u8 unk_x44; ///< Unknown. |
| 55 | u8 unk_x45[0xb]; ///< Unknown. | 55 | std::array<u8, 0xb> unk_x45; ///< Unknown. |
| 56 | }; | 56 | }; |
| 57 | static_assert(sizeof(ApplicationView) == 0x50, "ApplicationView has incorrect size."); | ||
| 57 | 58 | ||
| 58 | struct ApplicationRightsOnClient { | 59 | struct ApplicationRightsOnClient { |
| 59 | u64 application_id; | 60 | u64 application_id; |
| 60 | Common::UUID uid; | 61 | Common::UUID uid; |
| 61 | u8 flags; | 62 | u8 flags; |
| 62 | u8 flags2; | 63 | u8 flags2; |
| 63 | INSERT_PADDING_BYTES(0x6); | 64 | INSERT_PADDING_BYTES_NOINIT(0x6); |
| 64 | }; | 65 | }; |
| 66 | static_assert(sizeof(ApplicationRightsOnClient) == 0x20, | ||
| 67 | "ApplicationRightsOnClient has incorrect size."); | ||
| 65 | 68 | ||
| 66 | /// NsPromotionInfo | 69 | /// NsPromotionInfo |
| 67 | struct PromotionInfo { | 70 | struct PromotionInfo { |
| @@ -74,12 +77,15 @@ struct PromotionInfo { | |||
| 74 | ///< remaining_time is set. | 77 | ///< remaining_time is set. |
| 75 | INSERT_PADDING_BYTES_NOINIT(0x3); | 78 | INSERT_PADDING_BYTES_NOINIT(0x3); |
| 76 | }; | 79 | }; |
| 80 | static_assert(sizeof(PromotionInfo) == 0x20, "PromotionInfo has incorrect size."); | ||
| 77 | 81 | ||
| 78 | /// NsApplicationViewWithPromotionInfo | 82 | /// NsApplicationViewWithPromotionInfo |
| 79 | struct ApplicationViewWithPromotionInfo { | 83 | struct ApplicationViewWithPromotionInfo { |
| 80 | ApplicationView view; ///< \ref NsApplicationView | 84 | ApplicationView view; ///< \ref NsApplicationView |
| 81 | PromotionInfo promotion; ///< \ref NsPromotionInfo | 85 | PromotionInfo promotion; ///< \ref NsPromotionInfo |
| 82 | }; | 86 | }; |
| 87 | static_assert(sizeof(ApplicationViewWithPromotionInfo) == 0x70, | ||
| 88 | "ApplicationViewWithPromotionInfo has incorrect size."); | ||
| 83 | 89 | ||
| 84 | struct ApplicationOccupiedSizeEntity { | 90 | struct ApplicationOccupiedSizeEntity { |
| 85 | FileSys::StorageId storage_id; | 91 | FileSys::StorageId storage_id; |
| @@ -93,10 +99,13 @@ static_assert(sizeof(ApplicationOccupiedSizeEntity) == 0x20, | |||
| 93 | struct ApplicationOccupiedSize { | 99 | struct ApplicationOccupiedSize { |
| 94 | std::array<ApplicationOccupiedSizeEntity, 4> entities; | 100 | std::array<ApplicationOccupiedSizeEntity, 4> entities; |
| 95 | }; | 101 | }; |
| 102 | static_assert(sizeof(ApplicationOccupiedSize) == 0x80, | ||
| 103 | "ApplicationOccupiedSize has incorrect size."); | ||
| 96 | 104 | ||
| 97 | struct ContentPath { | 105 | struct ContentPath { |
| 98 | u8 file_system_proxy_type; | 106 | u8 file_system_proxy_type; |
| 99 | u64 program_id; | 107 | u64 program_id; |
| 100 | }; | 108 | }; |
| 109 | static_assert(sizeof(ContentPath) == 0x10, "ContentPath has incorrect size."); | ||
| 101 | 110 | ||
| 102 | } // namespace Service::NS | 111 | } // namespace Service::NS |
diff --git a/src/core/hle/service/ns/read_only_application_control_data_interface.cpp b/src/core/hle/service/ns/read_only_application_control_data_interface.cpp index 1587aed44..9b2ca94a4 100644 --- a/src/core/hle/service/ns/read_only_application_control_data_interface.cpp +++ b/src/core/hle/service/ns/read_only_application_control_data_interface.cpp | |||
| @@ -43,7 +43,7 @@ Result IReadOnlyApplicationControlDataInterface::GetApplicationControlData( | |||
| 43 | const auto size = out_buffer.size(); | 43 | const auto size = out_buffer.size(); |
| 44 | 44 | ||
| 45 | const auto icon_size = control.second ? control.second->GetSize() : 0; | 45 | const auto icon_size = control.second ? control.second->GetSize() : 0; |
| 46 | const auto total_size = 0x4000 + icon_size; | 46 | const auto total_size = sizeof(FileSys::RawNACP) + icon_size; |
| 47 | 47 | ||
| 48 | if (size < total_size) { | 48 | if (size < total_size) { |
| 49 | LOG_ERROR(Service_NS, "output buffer is too small! (actual={:016X}, expected_min=0x4000)", | 49 | LOG_ERROR(Service_NS, "output buffer is too small! (actual={:016X}, expected_min=0x4000)", |
| @@ -57,11 +57,11 @@ Result IReadOnlyApplicationControlDataInterface::GetApplicationControlData( | |||
| 57 | } else { | 57 | } else { |
| 58 | LOG_WARNING(Service_NS, "missing NACP data for application_id={:016X}, defaulting to zero", | 58 | LOG_WARNING(Service_NS, "missing NACP data for application_id={:016X}, defaulting to zero", |
| 59 | application_id); | 59 | application_id); |
| 60 | std::memset(out_buffer.data(), 0, 0x4000); | 60 | std::memset(out_buffer.data(), 0, sizeof(FileSys::RawNACP)); |
| 61 | } | 61 | } |
| 62 | 62 | ||
| 63 | if (control.second != nullptr) { | 63 | if (control.second != nullptr) { |
| 64 | control.second->Read(out_buffer.data() + 0x4000, icon_size); | 64 | control.second->Read(out_buffer.data() + sizeof(FileSys::RawNACP), icon_size); |
| 65 | } else { | 65 | } else { |
| 66 | LOG_WARNING(Service_NS, "missing icon data for application_id={:016X}", application_id); | 66 | LOG_WARNING(Service_NS, "missing icon data for application_id={:016X}", application_id); |
| 67 | } | 67 | } |