diff options
| author | 2018-09-19 19:53:11 +0800 | |
|---|---|---|
| committer | 2018-09-19 19:53:11 +0800 | |
| commit | c8f9bbbf859c0e38cf691b64c67761382fcebfc2 (patch) | |
| tree | 99529c2277a6b740a6e278985c5147fa649c5497 /src/core/hle/service | |
| parent | Add 1D sampler for TLDS - TexelFetch (Mario Rabbids) (diff) | |
| parent | Merge pull request #1348 from ogniK5377/GetImageSize (diff) | |
| download | yuzu-c8f9bbbf859c0e38cf691b64c67761382fcebfc2.tar.gz yuzu-c8f9bbbf859c0e38cf691b64c67761382fcebfc2.tar.xz yuzu-c8f9bbbf859c0e38cf691b64c67761382fcebfc2.zip | |
Merge branch 'master' into tlds
Diffstat (limited to 'src/core/hle/service')
| -rw-r--r-- | src/core/hle/service/acc/acc.cpp | 10 | ||||
| -rw-r--r-- | src/core/hle/service/acc/profile_manager.cpp | 26 | ||||
| -rw-r--r-- | src/core/hle/service/acc/profile_manager.h | 22 | ||||
| -rw-r--r-- | src/core/hle/service/am/am.cpp | 20 | ||||
| -rw-r--r-- | src/core/hle/service/am/am.h | 1 | ||||
| -rw-r--r-- | src/core/hle/service/audio/hwopus.cpp | 6 | ||||
| -rw-r--r-- | src/core/hle/service/hid/hid.cpp | 34 | ||||
| -rw-r--r-- | src/core/hle/service/lm/lm.cpp | 2 | ||||
| -rw-r--r-- | src/core/hle/service/ns/pl_u.cpp | 12 | ||||
| -rw-r--r-- | src/core/hle/service/nvdrv/devices/nvhost_as_gpu.cpp | 2 | ||||
| -rw-r--r-- | src/core/hle/service/nvflinger/nvflinger.cpp | 2 | ||||
| -rw-r--r-- | src/core/hle/service/service.cpp | 6 | ||||
| -rw-r--r-- | src/core/hle/service/service.h | 6 | ||||
| -rw-r--r-- | src/core/hle/service/set/set.cpp | 10 | ||||
| -rw-r--r-- | src/core/hle/service/set/set.h | 2 | ||||
| -rw-r--r-- | src/core/hle/service/sm/sm.cpp | 8 | ||||
| -rw-r--r-- | src/core/hle/service/sm/sm.h | 6 | ||||
| -rw-r--r-- | src/core/hle/service/spl/module.cpp | 2 | ||||
| -rw-r--r-- | src/core/hle/service/vi/vi.cpp | 17 | ||||
| -rw-r--r-- | src/core/hle/service/vi/vi.h | 5 |
20 files changed, 126 insertions, 73 deletions
diff --git a/src/core/hle/service/acc/acc.cpp b/src/core/hle/service/acc/acc.cpp index 1502dbf55..4d4eb542e 100644 --- a/src/core/hle/service/acc/acc.cpp +++ b/src/core/hle/service/acc/acc.cpp | |||
| @@ -34,7 +34,7 @@ public: | |||
| 34 | static const FunctionInfo functions[] = { | 34 | static const FunctionInfo functions[] = { |
| 35 | {0, &IProfile::Get, "Get"}, | 35 | {0, &IProfile::Get, "Get"}, |
| 36 | {1, &IProfile::GetBase, "GetBase"}, | 36 | {1, &IProfile::GetBase, "GetBase"}, |
| 37 | {10, nullptr, "GetImageSize"}, | 37 | {10, &IProfile::GetImageSize, "GetImageSize"}, |
| 38 | {11, &IProfile::LoadImage, "LoadImage"}, | 38 | {11, &IProfile::LoadImage, "LoadImage"}, |
| 39 | }; | 39 | }; |
| 40 | RegisterHandlers(functions); | 40 | RegisterHandlers(functions); |
| @@ -93,6 +93,14 @@ private: | |||
| 93 | rb.Push<u32>(jpeg_size); | 93 | rb.Push<u32>(jpeg_size); |
| 94 | } | 94 | } |
| 95 | 95 | ||
| 96 | void GetImageSize(Kernel::HLERequestContext& ctx) { | ||
| 97 | LOG_WARNING(Service_ACC, "(STUBBED) called"); | ||
| 98 | constexpr u32 jpeg_size = 107; | ||
| 99 | IPC::ResponseBuilder rb{ctx, 3}; | ||
| 100 | rb.Push(RESULT_SUCCESS); | ||
| 101 | rb.Push<u32>(jpeg_size); | ||
| 102 | } | ||
| 103 | |||
| 96 | const ProfileManager& profile_manager; | 104 | const ProfileManager& profile_manager; |
| 97 | UUID user_id; ///< The user id this profile refers to. | 105 | UUID user_id; ///< The user id this profile refers to. |
| 98 | }; | 106 | }; |
diff --git a/src/core/hle/service/acc/profile_manager.cpp b/src/core/hle/service/acc/profile_manager.cpp index 4ccebef23..bcb3475db 100644 --- a/src/core/hle/service/acc/profile_manager.cpp +++ b/src/core/hle/service/acc/profile_manager.cpp | |||
| @@ -25,7 +25,7 @@ const UUID& UUID::Generate() { | |||
| 25 | ProfileManager::ProfileManager() { | 25 | ProfileManager::ProfileManager() { |
| 26 | // TODO(ogniK): Create the default user we have for now until loading/saving users is added | 26 | // TODO(ogniK): Create the default user we have for now until loading/saving users is added |
| 27 | auto user_uuid = UUID{1, 0}; | 27 | auto user_uuid = UUID{1, 0}; |
| 28 | CreateNewUser(user_uuid, Settings::values.username); | 28 | ASSERT(CreateNewUser(user_uuid, Settings::values.username).IsSuccess()); |
| 29 | OpenUser(user_uuid); | 29 | OpenUser(user_uuid); |
| 30 | } | 30 | } |
| 31 | 31 | ||
| @@ -33,7 +33,7 @@ ProfileManager::~ProfileManager() = default; | |||
| 33 | 33 | ||
| 34 | /// After a users creation it needs to be "registered" to the system. AddToProfiles handles the | 34 | /// After a users creation it needs to be "registered" to the system. AddToProfiles handles the |
| 35 | /// internal management of the users profiles | 35 | /// internal management of the users profiles |
| 36 | boost::optional<size_t> ProfileManager::AddToProfiles(const ProfileInfo& user) { | 36 | boost::optional<std::size_t> ProfileManager::AddToProfiles(const ProfileInfo& user) { |
| 37 | if (user_count >= MAX_USERS) { | 37 | if (user_count >= MAX_USERS) { |
| 38 | return boost::none; | 38 | return boost::none; |
| 39 | } | 39 | } |
| @@ -42,7 +42,7 @@ boost::optional<size_t> ProfileManager::AddToProfiles(const ProfileInfo& user) { | |||
| 42 | } | 42 | } |
| 43 | 43 | ||
| 44 | /// Deletes a specific profile based on it's profile index | 44 | /// Deletes a specific profile based on it's profile index |
| 45 | bool ProfileManager::RemoveProfileAtIndex(size_t index) { | 45 | bool ProfileManager::RemoveProfileAtIndex(std::size_t index) { |
| 46 | if (index >= MAX_USERS || index >= user_count) { | 46 | if (index >= MAX_USERS || index >= user_count) { |
| 47 | return false; | 47 | return false; |
| 48 | } | 48 | } |
| @@ -91,7 +91,8 @@ ResultCode ProfileManager::CreateNewUser(UUID uuid, const ProfileUsername& usern | |||
| 91 | /// specifically by allowing an std::string for the username. This is required specifically since | 91 | /// specifically by allowing an std::string for the username. This is required specifically since |
| 92 | /// we're loading a string straight from the config | 92 | /// we're loading a string straight from the config |
| 93 | ResultCode ProfileManager::CreateNewUser(UUID uuid, const std::string& username) { | 93 | ResultCode ProfileManager::CreateNewUser(UUID uuid, const std::string& username) { |
| 94 | ProfileUsername username_output; | 94 | ProfileUsername username_output{}; |
| 95 | |||
| 95 | if (username.size() > username_output.size()) { | 96 | if (username.size() > username_output.size()) { |
| 96 | std::copy_n(username.begin(), username_output.size(), username_output.begin()); | 97 | std::copy_n(username.begin(), username_output.size(), username_output.begin()); |
| 97 | } else { | 98 | } else { |
| @@ -101,7 +102,7 @@ ResultCode ProfileManager::CreateNewUser(UUID uuid, const std::string& username) | |||
| 101 | } | 102 | } |
| 102 | 103 | ||
| 103 | /// Returns a users profile index based on their user id. | 104 | /// Returns a users profile index based on their user id. |
| 104 | boost::optional<size_t> ProfileManager::GetUserIndex(const UUID& uuid) const { | 105 | boost::optional<std::size_t> ProfileManager::GetUserIndex(const UUID& uuid) const { |
| 105 | if (!uuid) { | 106 | if (!uuid) { |
| 106 | return boost::none; | 107 | return boost::none; |
| 107 | } | 108 | } |
| @@ -110,16 +111,17 @@ boost::optional<size_t> ProfileManager::GetUserIndex(const UUID& uuid) const { | |||
| 110 | if (iter == profiles.end()) { | 111 | if (iter == profiles.end()) { |
| 111 | return boost::none; | 112 | return boost::none; |
| 112 | } | 113 | } |
| 113 | return static_cast<size_t>(std::distance(profiles.begin(), iter)); | 114 | return static_cast<std::size_t>(std::distance(profiles.begin(), iter)); |
| 114 | } | 115 | } |
| 115 | 116 | ||
| 116 | /// Returns a users profile index based on their profile | 117 | /// Returns a users profile index based on their profile |
| 117 | boost::optional<size_t> ProfileManager::GetUserIndex(const ProfileInfo& user) const { | 118 | boost::optional<std::size_t> ProfileManager::GetUserIndex(const ProfileInfo& user) const { |
| 118 | return GetUserIndex(user.user_uuid); | 119 | return GetUserIndex(user.user_uuid); |
| 119 | } | 120 | } |
| 120 | 121 | ||
| 121 | /// Returns the data structure used by the switch when GetProfileBase is called on acc:* | 122 | /// Returns the data structure used by the switch when GetProfileBase is called on acc:* |
| 122 | bool ProfileManager::GetProfileBase(boost::optional<size_t> index, ProfileBase& profile) const { | 123 | bool ProfileManager::GetProfileBase(boost::optional<std::size_t> index, |
| 124 | ProfileBase& profile) const { | ||
| 123 | if (index == boost::none || index >= MAX_USERS) { | 125 | if (index == boost::none || index >= MAX_USERS) { |
| 124 | return false; | 126 | return false; |
| 125 | } | 127 | } |
| @@ -143,14 +145,16 @@ bool ProfileManager::GetProfileBase(const ProfileInfo& user, ProfileBase& profil | |||
| 143 | 145 | ||
| 144 | /// Returns the current user count on the system. We keep a variable which tracks the count so we | 146 | /// Returns the current user count on the system. We keep a variable which tracks the count so we |
| 145 | /// don't have to loop the internal profile array every call. | 147 | /// don't have to loop the internal profile array every call. |
| 146 | size_t ProfileManager::GetUserCount() const { | 148 | |
| 149 | std::size_t ProfileManager::GetUserCount() const { | ||
| 147 | return user_count; | 150 | return user_count; |
| 148 | } | 151 | } |
| 149 | 152 | ||
| 150 | /// Lists the current "opened" users on the system. Users are typically not open until they sign | 153 | /// Lists the current "opened" users on the system. Users are typically not open until they sign |
| 151 | /// into something or pick a profile. As of right now users should all be open until qlaunch is | 154 | /// into something or pick a profile. As of right now users should all be open until qlaunch is |
| 152 | /// booting | 155 | /// booting |
| 153 | size_t ProfileManager::GetOpenUserCount() const { | 156 | |
| 157 | std::size_t ProfileManager::GetOpenUserCount() const { | ||
| 154 | return std::count_if(profiles.begin(), profiles.end(), | 158 | return std::count_if(profiles.begin(), profiles.end(), |
| 155 | [](const ProfileInfo& p) { return p.is_open; }); | 159 | [](const ProfileInfo& p) { return p.is_open; }); |
| 156 | } | 160 | } |
| @@ -206,7 +210,7 @@ UUID ProfileManager::GetLastOpenedUser() const { | |||
| 206 | } | 210 | } |
| 207 | 211 | ||
| 208 | /// Return the users profile base and the unknown arbitary data. | 212 | /// Return the users profile base and the unknown arbitary data. |
| 209 | bool ProfileManager::GetProfileBaseAndData(boost::optional<size_t> index, ProfileBase& profile, | 213 | bool ProfileManager::GetProfileBaseAndData(boost::optional<std::size_t> index, ProfileBase& profile, |
| 210 | ProfileData& data) const { | 214 | ProfileData& data) const { |
| 211 | if (GetProfileBase(index, profile)) { | 215 | if (GetProfileBase(index, profile)) { |
| 212 | data = profiles[index.get()].data; | 216 | data = profiles[index.get()].data; |
diff --git a/src/core/hle/service/acc/profile_manager.h b/src/core/hle/service/acc/profile_manager.h index cd8df93a5..bffd4cf4d 100644 --- a/src/core/hle/service/acc/profile_manager.h +++ b/src/core/hle/service/acc/profile_manager.h | |||
| @@ -12,8 +12,8 @@ | |||
| 12 | #include "core/hle/result.h" | 12 | #include "core/hle/result.h" |
| 13 | 13 | ||
| 14 | namespace Service::Account { | 14 | namespace Service::Account { |
| 15 | constexpr size_t MAX_USERS = 8; | 15 | constexpr std::size_t MAX_USERS = 8; |
| 16 | constexpr size_t MAX_DATA = 128; | 16 | constexpr std::size_t MAX_DATA = 128; |
| 17 | constexpr u128 INVALID_UUID{{0, 0}}; | 17 | constexpr u128 INVALID_UUID{{0, 0}}; |
| 18 | 18 | ||
| 19 | struct UUID { | 19 | struct UUID { |
| @@ -87,18 +87,18 @@ public: | |||
| 87 | ResultCode AddUser(const ProfileInfo& user); | 87 | ResultCode AddUser(const ProfileInfo& user); |
| 88 | ResultCode CreateNewUser(UUID uuid, const ProfileUsername& username); | 88 | ResultCode CreateNewUser(UUID uuid, const ProfileUsername& username); |
| 89 | ResultCode CreateNewUser(UUID uuid, const std::string& username); | 89 | ResultCode CreateNewUser(UUID uuid, const std::string& username); |
| 90 | boost::optional<size_t> GetUserIndex(const UUID& uuid) const; | 90 | boost::optional<std::size_t> GetUserIndex(const UUID& uuid) const; |
| 91 | boost::optional<size_t> GetUserIndex(const ProfileInfo& user) const; | 91 | boost::optional<std::size_t> GetUserIndex(const ProfileInfo& user) const; |
| 92 | bool GetProfileBase(boost::optional<size_t> index, ProfileBase& profile) const; | 92 | bool GetProfileBase(boost::optional<std::size_t> index, ProfileBase& profile) const; |
| 93 | bool GetProfileBase(UUID uuid, ProfileBase& profile) const; | 93 | bool GetProfileBase(UUID uuid, ProfileBase& profile) const; |
| 94 | bool GetProfileBase(const ProfileInfo& user, ProfileBase& profile) const; | 94 | bool GetProfileBase(const ProfileInfo& user, ProfileBase& profile) const; |
| 95 | bool GetProfileBaseAndData(boost::optional<size_t> index, ProfileBase& profile, | 95 | bool GetProfileBaseAndData(boost::optional<std::size_t> index, ProfileBase& profile, |
| 96 | ProfileData& data) const; | 96 | ProfileData& data) const; |
| 97 | bool GetProfileBaseAndData(UUID uuid, ProfileBase& profile, ProfileData& data) const; | 97 | bool GetProfileBaseAndData(UUID uuid, ProfileBase& profile, ProfileData& data) const; |
| 98 | bool GetProfileBaseAndData(const ProfileInfo& user, ProfileBase& profile, | 98 | bool GetProfileBaseAndData(const ProfileInfo& user, ProfileBase& profile, |
| 99 | ProfileData& data) const; | 99 | ProfileData& data) const; |
| 100 | size_t GetUserCount() const; | 100 | std::size_t GetUserCount() const; |
| 101 | size_t GetOpenUserCount() const; | 101 | std::size_t GetOpenUserCount() const; |
| 102 | bool UserExists(UUID uuid) const; | 102 | bool UserExists(UUID uuid) const; |
| 103 | void OpenUser(UUID uuid); | 103 | void OpenUser(UUID uuid); |
| 104 | void CloseUser(UUID uuid); | 104 | void CloseUser(UUID uuid); |
| @@ -110,9 +110,9 @@ public: | |||
| 110 | 110 | ||
| 111 | private: | 111 | private: |
| 112 | std::array<ProfileInfo, MAX_USERS> profiles{}; | 112 | std::array<ProfileInfo, MAX_USERS> profiles{}; |
| 113 | size_t user_count = 0; | 113 | std::size_t user_count = 0; |
| 114 | boost::optional<size_t> AddToProfiles(const ProfileInfo& profile); | 114 | boost::optional<std::size_t> AddToProfiles(const ProfileInfo& profile); |
| 115 | bool RemoveProfileAtIndex(size_t index); | 115 | bool RemoveProfileAtIndex(std::size_t index); |
| 116 | UUID last_opened_user{INVALID_UUID}; | 116 | UUID last_opened_user{INVALID_UUID}; |
| 117 | }; | 117 | }; |
| 118 | 118 | ||
diff --git a/src/core/hle/service/am/am.cpp b/src/core/hle/service/am/am.cpp index a57ed3042..9c975325a 100644 --- a/src/core/hle/service/am/am.cpp +++ b/src/core/hle/service/am/am.cpp | |||
| @@ -20,6 +20,7 @@ | |||
| 20 | #include "core/hle/service/nvflinger/nvflinger.h" | 20 | #include "core/hle/service/nvflinger/nvflinger.h" |
| 21 | #include "core/hle/service/pm/pm.h" | 21 | #include "core/hle/service/pm/pm.h" |
| 22 | #include "core/hle/service/set/set.h" | 22 | #include "core/hle/service/set/set.h" |
| 23 | #include "core/hle/service/vi/vi.h" | ||
| 23 | #include "core/settings.h" | 24 | #include "core/settings.h" |
| 24 | 25 | ||
| 25 | namespace Service::AM { | 26 | namespace Service::AM { |
| @@ -334,7 +335,7 @@ ICommonStateGetter::ICommonStateGetter() : ServiceFramework("ICommonStateGetter" | |||
| 334 | {51, nullptr, "SetVrModeEnabled"}, | 335 | {51, nullptr, "SetVrModeEnabled"}, |
| 335 | {52, nullptr, "SwitchLcdBacklight"}, | 336 | {52, nullptr, "SwitchLcdBacklight"}, |
| 336 | {55, nullptr, "IsInControllerFirmwareUpdateSection"}, | 337 | {55, nullptr, "IsInControllerFirmwareUpdateSection"}, |
| 337 | {60, nullptr, "GetDefaultDisplayResolution"}, | 338 | {60, &ICommonStateGetter::GetDefaultDisplayResolution, "GetDefaultDisplayResolution"}, |
| 338 | {61, &ICommonStateGetter::GetDefaultDisplayResolutionChangeEvent, | 339 | {61, &ICommonStateGetter::GetDefaultDisplayResolutionChangeEvent, |
| 339 | "GetDefaultDisplayResolutionChangeEvent"}, | 340 | "GetDefaultDisplayResolutionChangeEvent"}, |
| 340 | {62, nullptr, "GetHdcpAuthenticationState"}, | 341 | {62, nullptr, "GetHdcpAuthenticationState"}, |
| @@ -393,6 +394,21 @@ void ICommonStateGetter::GetDefaultDisplayResolutionChangeEvent(Kernel::HLEReque | |||
| 393 | LOG_WARNING(Service_AM, "(STUBBED) called"); | 394 | LOG_WARNING(Service_AM, "(STUBBED) called"); |
| 394 | } | 395 | } |
| 395 | 396 | ||
| 397 | void ICommonStateGetter::GetDefaultDisplayResolution(Kernel::HLERequestContext& ctx) { | ||
| 398 | IPC::ResponseBuilder rb{ctx, 4}; | ||
| 399 | rb.Push(RESULT_SUCCESS); | ||
| 400 | |||
| 401 | if (Settings::values.use_docked_mode) { | ||
| 402 | rb.Push(static_cast<u32>(Service::VI::DisplayResolution::DockedWidth)); | ||
| 403 | rb.Push(static_cast<u32>(Service::VI::DisplayResolution::DockedHeight)); | ||
| 404 | } else { | ||
| 405 | rb.Push(static_cast<u32>(Service::VI::DisplayResolution::UndockedWidth)); | ||
| 406 | rb.Push(static_cast<u32>(Service::VI::DisplayResolution::UndockedHeight)); | ||
| 407 | } | ||
| 408 | |||
| 409 | LOG_DEBUG(Service_AM, "called"); | ||
| 410 | } | ||
| 411 | |||
| 396 | void ICommonStateGetter::GetOperationMode(Kernel::HLERequestContext& ctx) { | 412 | void ICommonStateGetter::GetOperationMode(Kernel::HLERequestContext& ctx) { |
| 397 | const bool use_docked_mode{Settings::values.use_docked_mode}; | 413 | const bool use_docked_mode{Settings::values.use_docked_mode}; |
| 398 | IPC::ResponseBuilder rb{ctx, 3}; | 414 | IPC::ResponseBuilder rb{ctx, 3}; |
| @@ -456,7 +472,7 @@ private: | |||
| 456 | IPC::RequestParser rp{ctx}; | 472 | IPC::RequestParser rp{ctx}; |
| 457 | 473 | ||
| 458 | const u64 offset{rp.Pop<u64>()}; | 474 | const u64 offset{rp.Pop<u64>()}; |
| 459 | const size_t size{ctx.GetWriteBufferSize()}; | 475 | const std::size_t size{ctx.GetWriteBufferSize()}; |
| 460 | 476 | ||
| 461 | ASSERT(offset + size <= buffer.size()); | 477 | ASSERT(offset + size <= buffer.size()); |
| 462 | 478 | ||
diff --git a/src/core/hle/service/am/am.h b/src/core/hle/service/am/am.h index fd9ae296b..b39b0d838 100644 --- a/src/core/hle/service/am/am.h +++ b/src/core/hle/service/am/am.h | |||
| @@ -123,6 +123,7 @@ private: | |||
| 123 | void GetOperationMode(Kernel::HLERequestContext& ctx); | 123 | void GetOperationMode(Kernel::HLERequestContext& ctx); |
| 124 | void GetPerformanceMode(Kernel::HLERequestContext& ctx); | 124 | void GetPerformanceMode(Kernel::HLERequestContext& ctx); |
| 125 | void GetBootMode(Kernel::HLERequestContext& ctx); | 125 | void GetBootMode(Kernel::HLERequestContext& ctx); |
| 126 | void GetDefaultDisplayResolution(Kernel::HLERequestContext& ctx); | ||
| 126 | 127 | ||
| 127 | Kernel::SharedPtr<Kernel::Event> event; | 128 | Kernel::SharedPtr<Kernel::Event> event; |
| 128 | }; | 129 | }; |
diff --git a/src/core/hle/service/audio/hwopus.cpp b/src/core/hle/service/audio/hwopus.cpp index 668fef145..fc6067e59 100644 --- a/src/core/hle/service/audio/hwopus.cpp +++ b/src/core/hle/service/audio/hwopus.cpp | |||
| @@ -61,7 +61,7 @@ private: | |||
| 61 | 61 | ||
| 62 | bool Decoder_DecodeInterleaved(u32& consumed, u32& sample_count, const std::vector<u8>& input, | 62 | bool Decoder_DecodeInterleaved(u32& consumed, u32& sample_count, const std::vector<u8>& input, |
| 63 | std::vector<opus_int16>& output) { | 63 | std::vector<opus_int16>& output) { |
| 64 | size_t raw_output_sz = output.size() * sizeof(opus_int16); | 64 | std::size_t raw_output_sz = output.size() * sizeof(opus_int16); |
| 65 | if (sizeof(OpusHeader) > input.size()) | 65 | if (sizeof(OpusHeader) > input.size()) |
| 66 | return false; | 66 | return false; |
| 67 | OpusHeader hdr{}; | 67 | OpusHeader hdr{}; |
| @@ -96,7 +96,7 @@ private: | |||
| 96 | u32 channel_count; | 96 | u32 channel_count; |
| 97 | }; | 97 | }; |
| 98 | 98 | ||
| 99 | static size_t WorkerBufferSize(u32 channel_count) { | 99 | static std::size_t WorkerBufferSize(u32 channel_count) { |
| 100 | ASSERT_MSG(channel_count == 1 || channel_count == 2, "Invalid channel count"); | 100 | ASSERT_MSG(channel_count == 1 || channel_count == 2, "Invalid channel count"); |
| 101 | return opus_decoder_get_size(static_cast<int>(channel_count)); | 101 | return opus_decoder_get_size(static_cast<int>(channel_count)); |
| 102 | } | 102 | } |
| @@ -129,7 +129,7 @@ void HwOpus::OpenOpusDecoder(Kernel::HLERequestContext& ctx) { | |||
| 129 | "Invalid sample rate"); | 129 | "Invalid sample rate"); |
| 130 | ASSERT_MSG(channel_count == 1 || channel_count == 2, "Invalid channel count"); | 130 | ASSERT_MSG(channel_count == 1 || channel_count == 2, "Invalid channel count"); |
| 131 | 131 | ||
| 132 | size_t worker_sz = WorkerBufferSize(channel_count); | 132 | std::size_t worker_sz = WorkerBufferSize(channel_count); |
| 133 | ASSERT_MSG(buffer_sz < worker_sz, "Worker buffer too large"); | 133 | ASSERT_MSG(buffer_sz < worker_sz, "Worker buffer too large"); |
| 134 | std::unique_ptr<OpusDecoder, OpusDeleter> decoder{ | 134 | std::unique_ptr<OpusDecoder, OpusDeleter> decoder{ |
| 135 | static_cast<OpusDecoder*>(operator new(worker_sz))}; | 135 | static_cast<OpusDecoder*>(operator new(worker_sz))}; |
diff --git a/src/core/hle/service/hid/hid.cpp b/src/core/hle/service/hid/hid.cpp index a8e0c869f..256c49bfc 100644 --- a/src/core/hle/service/hid/hid.cpp +++ b/src/core/hle/service/hid/hid.cpp | |||
| @@ -89,7 +89,7 @@ private: | |||
| 89 | controller_header.left_color_body = JOYCON_BODY_NEON_BLUE; | 89 | controller_header.left_color_body = JOYCON_BODY_NEON_BLUE; |
| 90 | controller_header.left_color_buttons = JOYCON_BUTTONS_NEON_BLUE; | 90 | controller_header.left_color_buttons = JOYCON_BUTTONS_NEON_BLUE; |
| 91 | 91 | ||
| 92 | for (size_t controller = 0; controller < mem.controllers.size(); controller++) { | 92 | for (std::size_t controller = 0; controller < mem.controllers.size(); controller++) { |
| 93 | for (auto& layout : mem.controllers[controller].layouts) { | 93 | for (auto& layout : mem.controllers[controller].layouts) { |
| 94 | layout.header.num_entries = HID_NUM_ENTRIES; | 94 | layout.header.num_entries = HID_NUM_ENTRIES; |
| 95 | layout.header.max_entry_index = HID_NUM_ENTRIES - 1; | 95 | layout.header.max_entry_index = HID_NUM_ENTRIES - 1; |
| @@ -313,7 +313,7 @@ public: | |||
| 313 | {64, nullptr, "DeactivateJoySixAxisSensor"}, | 313 | {64, nullptr, "DeactivateJoySixAxisSensor"}, |
| 314 | {65, nullptr, "GetJoySixAxisSensorLifoHandle"}, | 314 | {65, nullptr, "GetJoySixAxisSensorLifoHandle"}, |
| 315 | {66, &Hid::StartSixAxisSensor, "StartSixAxisSensor"}, | 315 | {66, &Hid::StartSixAxisSensor, "StartSixAxisSensor"}, |
| 316 | {67, nullptr, "StopSixAxisSensor"}, | 316 | {67, &Hid::StopSixAxisSensor, "StopSixAxisSensor"}, |
| 317 | {68, nullptr, "IsSixAxisSensorFusionEnabled"}, | 317 | {68, nullptr, "IsSixAxisSensorFusionEnabled"}, |
| 318 | {69, nullptr, "EnableSixAxisSensorFusion"}, | 318 | {69, nullptr, "EnableSixAxisSensorFusion"}, |
| 319 | {70, nullptr, "SetSixAxisSensorFusionParameters"}, | 319 | {70, nullptr, "SetSixAxisSensorFusionParameters"}, |
| @@ -329,7 +329,7 @@ public: | |||
| 329 | {80, nullptr, "GetGyroscopeZeroDriftMode"}, | 329 | {80, nullptr, "GetGyroscopeZeroDriftMode"}, |
| 330 | {81, nullptr, "ResetGyroscopeZeroDriftMode"}, | 330 | {81, nullptr, "ResetGyroscopeZeroDriftMode"}, |
| 331 | {82, &Hid::IsSixAxisSensorAtRest, "IsSixAxisSensorAtRest"}, | 331 | {82, &Hid::IsSixAxisSensorAtRest, "IsSixAxisSensorAtRest"}, |
| 332 | {91, nullptr, "ActivateGesture"}, | 332 | {91, &Hid::ActivateGesture, "ActivateGesture"}, |
| 333 | {100, &Hid::SetSupportedNpadStyleSet, "SetSupportedNpadStyleSet"}, | 333 | {100, &Hid::SetSupportedNpadStyleSet, "SetSupportedNpadStyleSet"}, |
| 334 | {101, &Hid::GetSupportedNpadStyleSet, "GetSupportedNpadStyleSet"}, | 334 | {101, &Hid::GetSupportedNpadStyleSet, "GetSupportedNpadStyleSet"}, |
| 335 | {102, &Hid::SetSupportedNpadIdType, "SetSupportedNpadIdType"}, | 335 | {102, &Hid::SetSupportedNpadIdType, "SetSupportedNpadIdType"}, |
| @@ -364,8 +364,8 @@ public: | |||
| 364 | {208, nullptr, "GetActualVibrationGcErmCommand"}, | 364 | {208, nullptr, "GetActualVibrationGcErmCommand"}, |
| 365 | {209, nullptr, "BeginPermitVibrationSession"}, | 365 | {209, nullptr, "BeginPermitVibrationSession"}, |
| 366 | {210, nullptr, "EndPermitVibrationSession"}, | 366 | {210, nullptr, "EndPermitVibrationSession"}, |
| 367 | {300, nullptr, "ActivateConsoleSixAxisSensor"}, | 367 | {300, &Hid::ActivateConsoleSixAxisSensor, "ActivateConsoleSixAxisSensor"}, |
| 368 | {301, nullptr, "StartConsoleSixAxisSensor"}, | 368 | {301, &Hid::StartConsoleSixAxisSensor, "StartConsoleSixAxisSensor"}, |
| 369 | {302, nullptr, "StopConsoleSixAxisSensor"}, | 369 | {302, nullptr, "StopConsoleSixAxisSensor"}, |
| 370 | {303, nullptr, "ActivateSevenSixAxisSensor"}, | 370 | {303, nullptr, "ActivateSevenSixAxisSensor"}, |
| 371 | {304, nullptr, "StartSevenSixAxisSensor"}, | 371 | {304, nullptr, "StartSevenSixAxisSensor"}, |
| @@ -579,6 +579,30 @@ private: | |||
| 579 | rb.Push(RESULT_SUCCESS); | 579 | rb.Push(RESULT_SUCCESS); |
| 580 | LOG_WARNING(Service_HID, "(STUBBED) called"); | 580 | LOG_WARNING(Service_HID, "(STUBBED) called"); |
| 581 | } | 581 | } |
| 582 | |||
| 583 | void ActivateConsoleSixAxisSensor(Kernel::HLERequestContext& ctx) { | ||
| 584 | IPC::ResponseBuilder rb{ctx, 2}; | ||
| 585 | rb.Push(RESULT_SUCCESS); | ||
| 586 | LOG_WARNING(Service_HID, "(STUBBED) called"); | ||
| 587 | } | ||
| 588 | |||
| 589 | void StartConsoleSixAxisSensor(Kernel::HLERequestContext& ctx) { | ||
| 590 | IPC::ResponseBuilder rb{ctx, 2}; | ||
| 591 | rb.Push(RESULT_SUCCESS); | ||
| 592 | LOG_WARNING(Service_HID, "(STUBBED) called"); | ||
| 593 | } | ||
| 594 | |||
| 595 | void StopSixAxisSensor(Kernel::HLERequestContext& ctx) { | ||
| 596 | IPC::ResponseBuilder rb{ctx, 2}; | ||
| 597 | rb.Push(RESULT_SUCCESS); | ||
| 598 | LOG_WARNING(Service_HID, "(STUBBED) called"); | ||
| 599 | } | ||
| 600 | |||
| 601 | void ActivateGesture(Kernel::HLERequestContext& ctx) { | ||
| 602 | IPC::ResponseBuilder rb{ctx, 2}; | ||
| 603 | rb.Push(RESULT_SUCCESS); | ||
| 604 | LOG_WARNING(Service_HID, "(STUBBED) called"); | ||
| 605 | } | ||
| 582 | }; | 606 | }; |
| 583 | 607 | ||
| 584 | class HidDbg final : public ServiceFramework<HidDbg> { | 608 | class HidDbg final : public ServiceFramework<HidDbg> { |
diff --git a/src/core/hle/service/lm/lm.cpp b/src/core/hle/service/lm/lm.cpp index 098da2a41..c89157a4d 100644 --- a/src/core/hle/service/lm/lm.cpp +++ b/src/core/hle/service/lm/lm.cpp | |||
| @@ -99,7 +99,7 @@ private: | |||
| 99 | std::string thread; | 99 | std::string thread; |
| 100 | while (addr < end_addr) { | 100 | while (addr < end_addr) { |
| 101 | const Field field{static_cast<Field>(Memory::Read8(addr++))}; | 101 | const Field field{static_cast<Field>(Memory::Read8(addr++))}; |
| 102 | const size_t length{Memory::Read8(addr++)}; | 102 | const std::size_t length{Memory::Read8(addr++)}; |
| 103 | 103 | ||
| 104 | if (static_cast<Field>(Memory::Read8(addr)) == Field::Skip) { | 104 | if (static_cast<Field>(Memory::Read8(addr)) == Field::Skip) { |
| 105 | ++addr; | 105 | ++addr; |
diff --git a/src/core/hle/service/ns/pl_u.cpp b/src/core/hle/service/ns/pl_u.cpp index 447689a1a..1069d103f 100644 --- a/src/core/hle/service/ns/pl_u.cpp +++ b/src/core/hle/service/ns/pl_u.cpp | |||
| @@ -78,7 +78,7 @@ enum class LoadState : u32 { | |||
| 78 | }; | 78 | }; |
| 79 | 79 | ||
| 80 | static void DecryptSharedFont(const std::vector<u32>& input, std::vector<u8>& output, | 80 | static void DecryptSharedFont(const std::vector<u32>& input, std::vector<u8>& output, |
| 81 | size_t& offset) { | 81 | std::size_t& offset) { |
| 82 | ASSERT_MSG(offset + (input.size() * sizeof(u32)) < SHARED_FONT_MEM_SIZE, | 82 | ASSERT_MSG(offset + (input.size() * sizeof(u32)) < SHARED_FONT_MEM_SIZE, |
| 83 | "Shared fonts exceeds 17mb!"); | 83 | "Shared fonts exceeds 17mb!"); |
| 84 | ASSERT_MSG(input[0] == EXPECTED_MAGIC, "Failed to derive key, unexpected magic number"); | 84 | ASSERT_MSG(input[0] == EXPECTED_MAGIC, "Failed to derive key, unexpected magic number"); |
| @@ -95,7 +95,7 @@ static void DecryptSharedFont(const std::vector<u32>& input, std::vector<u8>& ou | |||
| 95 | } | 95 | } |
| 96 | 96 | ||
| 97 | static void EncryptSharedFont(const std::vector<u8>& input, std::vector<u8>& output, | 97 | static void EncryptSharedFont(const std::vector<u8>& input, std::vector<u8>& output, |
| 98 | size_t& offset) { | 98 | std::size_t& offset) { |
| 99 | ASSERT_MSG(offset + input.size() + 8 < SHARED_FONT_MEM_SIZE, "Shared fonts exceeds 17mb!"); | 99 | ASSERT_MSG(offset + input.size() + 8 < SHARED_FONT_MEM_SIZE, "Shared fonts exceeds 17mb!"); |
| 100 | const u32 KEY = EXPECTED_MAGIC ^ EXPECTED_RESULT; | 100 | const u32 KEY = EXPECTED_MAGIC ^ EXPECTED_RESULT; |
| 101 | std::memcpy(output.data() + offset, &EXPECTED_RESULT, sizeof(u32)); // Magic header | 101 | std::memcpy(output.data() + offset, &EXPECTED_RESULT, sizeof(u32)); // Magic header |
| @@ -113,7 +113,7 @@ static u32 GetU32Swapped(const u8* data) { | |||
| 113 | } | 113 | } |
| 114 | 114 | ||
| 115 | struct PL_U::Impl { | 115 | struct PL_U::Impl { |
| 116 | const FontRegion& GetSharedFontRegion(size_t index) const { | 116 | const FontRegion& GetSharedFontRegion(std::size_t index) const { |
| 117 | if (index >= shared_font_regions.size() || shared_font_regions.empty()) { | 117 | if (index >= shared_font_regions.size() || shared_font_regions.empty()) { |
| 118 | // No font fallback | 118 | // No font fallback |
| 119 | return EMPTY_REGION; | 119 | return EMPTY_REGION; |
| @@ -126,7 +126,7 @@ struct PL_U::Impl { | |||
| 126 | // based on the shared memory dump | 126 | // based on the shared memory dump |
| 127 | unsigned cur_offset = 0; | 127 | unsigned cur_offset = 0; |
| 128 | 128 | ||
| 129 | for (size_t i = 0; i < SHARED_FONTS.size(); i++) { | 129 | for (std::size_t i = 0; i < SHARED_FONTS.size(); i++) { |
| 130 | // Out of shared fonts/invalid font | 130 | // Out of shared fonts/invalid font |
| 131 | if (GetU32Swapped(input.data() + cur_offset) != EXPECTED_RESULT) { | 131 | if (GetU32Swapped(input.data() + cur_offset) != EXPECTED_RESULT) { |
| 132 | break; | 132 | break; |
| @@ -162,7 +162,7 @@ PL_U::PL_U() : ServiceFramework("pl:u"), impl{std::make_unique<Impl>()} { | |||
| 162 | RegisterHandlers(functions); | 162 | RegisterHandlers(functions); |
| 163 | // Attempt to load shared font data from disk | 163 | // Attempt to load shared font data from disk |
| 164 | const auto nand = FileSystem::GetSystemNANDContents(); | 164 | const auto nand = FileSystem::GetSystemNANDContents(); |
| 165 | size_t offset = 0; | 165 | std::size_t offset = 0; |
| 166 | // Rebuild shared fonts from data ncas | 166 | // Rebuild shared fonts from data ncas |
| 167 | if (nand->HasEntry(static_cast<u64>(FontArchives::Standard), | 167 | if (nand->HasEntry(static_cast<u64>(FontArchives::Standard), |
| 168 | FileSys::ContentRecordType::Data)) { | 168 | FileSys::ContentRecordType::Data)) { |
| @@ -344,7 +344,7 @@ void PL_U::GetSharedFontInOrderOfPriority(Kernel::HLERequestContext& ctx) { | |||
| 344 | std::vector<u32> font_sizes; | 344 | std::vector<u32> font_sizes; |
| 345 | 345 | ||
| 346 | // TODO(ogniK): Have actual priority order | 346 | // TODO(ogniK): Have actual priority order |
| 347 | for (size_t i = 0; i < impl->shared_font_regions.size(); i++) { | 347 | for (std::size_t i = 0; i < impl->shared_font_regions.size(); i++) { |
| 348 | font_codes.push_back(static_cast<u32>(i)); | 348 | font_codes.push_back(static_cast<u32>(i)); |
| 349 | auto region = impl->GetSharedFontRegion(i); | 349 | auto region = impl->GetSharedFontRegion(i); |
| 350 | font_offsets.push_back(region.offset); | 350 | font_offsets.push_back(region.offset); |
diff --git a/src/core/hle/service/nvdrv/devices/nvhost_as_gpu.cpp b/src/core/hle/service/nvdrv/devices/nvhost_as_gpu.cpp index 25d5a93fa..d8b8037a8 100644 --- a/src/core/hle/service/nvdrv/devices/nvhost_as_gpu.cpp +++ b/src/core/hle/service/nvdrv/devices/nvhost_as_gpu.cpp | |||
| @@ -71,7 +71,7 @@ u32 nvhost_as_gpu::AllocateSpace(const std::vector<u8>& input, std::vector<u8>& | |||
| 71 | } | 71 | } |
| 72 | 72 | ||
| 73 | u32 nvhost_as_gpu::Remap(const std::vector<u8>& input, std::vector<u8>& output) { | 73 | u32 nvhost_as_gpu::Remap(const std::vector<u8>& input, std::vector<u8>& output) { |
| 74 | size_t num_entries = input.size() / sizeof(IoctlRemapEntry); | 74 | std::size_t num_entries = input.size() / sizeof(IoctlRemapEntry); |
| 75 | 75 | ||
| 76 | LOG_WARNING(Service_NVDRV, "(STUBBED) called, num_entries=0x{:X}", num_entries); | 76 | LOG_WARNING(Service_NVDRV, "(STUBBED) called, num_entries=0x{:X}", num_entries); |
| 77 | 77 | ||
diff --git a/src/core/hle/service/nvflinger/nvflinger.cpp b/src/core/hle/service/nvflinger/nvflinger.cpp index 7455ddd19..d47b6f659 100644 --- a/src/core/hle/service/nvflinger/nvflinger.cpp +++ b/src/core/hle/service/nvflinger/nvflinger.cpp | |||
| @@ -23,7 +23,7 @@ | |||
| 23 | 23 | ||
| 24 | namespace Service::NVFlinger { | 24 | namespace Service::NVFlinger { |
| 25 | 25 | ||
| 26 | constexpr size_t SCREEN_REFRESH_RATE = 60; | 26 | constexpr std::size_t SCREEN_REFRESH_RATE = 60; |
| 27 | constexpr u64 frame_ticks = static_cast<u64>(CoreTiming::BASE_CLOCK_RATE / SCREEN_REFRESH_RATE); | 27 | constexpr u64 frame_ticks = static_cast<u64>(CoreTiming::BASE_CLOCK_RATE / SCREEN_REFRESH_RATE); |
| 28 | 28 | ||
| 29 | NVFlinger::NVFlinger() { | 29 | NVFlinger::NVFlinger() { |
diff --git a/src/core/hle/service/service.cpp b/src/core/hle/service/service.cpp index 9bb7c7b26..62f049660 100644 --- a/src/core/hle/service/service.cpp +++ b/src/core/hle/service/service.cpp | |||
| @@ -50,6 +50,7 @@ | |||
| 50 | #include "core/hle/service/nim/nim.h" | 50 | #include "core/hle/service/nim/nim.h" |
| 51 | #include "core/hle/service/ns/ns.h" | 51 | #include "core/hle/service/ns/ns.h" |
| 52 | #include "core/hle/service/nvdrv/nvdrv.h" | 52 | #include "core/hle/service/nvdrv/nvdrv.h" |
| 53 | #include "core/hle/service/nvflinger/nvflinger.h" | ||
| 53 | #include "core/hle/service/pcie/pcie.h" | 54 | #include "core/hle/service/pcie/pcie.h" |
| 54 | #include "core/hle/service/pctl/pctl.h" | 55 | #include "core/hle/service/pctl/pctl.h" |
| 55 | #include "core/hle/service/pcv/pcv.h" | 56 | #include "core/hle/service/pcv/pcv.h" |
| @@ -58,7 +59,6 @@ | |||
| 58 | #include "core/hle/service/psc/psc.h" | 59 | #include "core/hle/service/psc/psc.h" |
| 59 | #include "core/hle/service/service.h" | 60 | #include "core/hle/service/service.h" |
| 60 | #include "core/hle/service/set/settings.h" | 61 | #include "core/hle/service/set/settings.h" |
| 61 | #include "core/hle/service/sm/controller.h" | ||
| 62 | #include "core/hle/service/sm/sm.h" | 62 | #include "core/hle/service/sm/sm.h" |
| 63 | #include "core/hle/service/sockets/sockets.h" | 63 | #include "core/hle/service/sockets/sockets.h" |
| 64 | #include "core/hle/service/spl/module.h" | 64 | #include "core/hle/service/spl/module.h" |
| @@ -129,9 +129,9 @@ Kernel::SharedPtr<Kernel::ClientPort> ServiceFrameworkBase::CreatePort() { | |||
| 129 | return client_port; | 129 | return client_port; |
| 130 | } | 130 | } |
| 131 | 131 | ||
| 132 | void ServiceFrameworkBase::RegisterHandlersBase(const FunctionInfoBase* functions, size_t n) { | 132 | void ServiceFrameworkBase::RegisterHandlersBase(const FunctionInfoBase* functions, std::size_t n) { |
| 133 | handlers.reserve(handlers.size() + n); | 133 | handlers.reserve(handlers.size() + n); |
| 134 | for (size_t i = 0; i < n; ++i) { | 134 | for (std::size_t i = 0; i < n; ++i) { |
| 135 | // Usually this array is sorted by id already, so hint to insert at the end | 135 | // Usually this array is sorted by id already, so hint to insert at the end |
| 136 | handlers.emplace_hint(handlers.cend(), functions[i].expected_header, functions[i]); | 136 | handlers.emplace_hint(handlers.cend(), functions[i].expected_header, functions[i]); |
| 137 | } | 137 | } |
diff --git a/src/core/hle/service/service.h b/src/core/hle/service/service.h index 7a051523e..2fc57a82e 100644 --- a/src/core/hle/service/service.h +++ b/src/core/hle/service/service.h | |||
| @@ -88,7 +88,7 @@ private: | |||
| 88 | ServiceFrameworkBase(const char* service_name, u32 max_sessions, InvokerFn* handler_invoker); | 88 | ServiceFrameworkBase(const char* service_name, u32 max_sessions, InvokerFn* handler_invoker); |
| 89 | ~ServiceFrameworkBase(); | 89 | ~ServiceFrameworkBase(); |
| 90 | 90 | ||
| 91 | void RegisterHandlersBase(const FunctionInfoBase* functions, size_t n); | 91 | void RegisterHandlersBase(const FunctionInfoBase* functions, std::size_t n); |
| 92 | void ReportUnimplementedFunction(Kernel::HLERequestContext& ctx, const FunctionInfoBase* info); | 92 | void ReportUnimplementedFunction(Kernel::HLERequestContext& ctx, const FunctionInfoBase* info); |
| 93 | 93 | ||
| 94 | /// Identifier string used to connect to the service. | 94 | /// Identifier string used to connect to the service. |
| @@ -152,7 +152,7 @@ protected: | |||
| 152 | : ServiceFrameworkBase(service_name, max_sessions, Invoker) {} | 152 | : ServiceFrameworkBase(service_name, max_sessions, Invoker) {} |
| 153 | 153 | ||
| 154 | /// Registers handlers in the service. | 154 | /// Registers handlers in the service. |
| 155 | template <size_t N> | 155 | template <std::size_t N> |
| 156 | void RegisterHandlers(const FunctionInfo (&functions)[N]) { | 156 | void RegisterHandlers(const FunctionInfo (&functions)[N]) { |
| 157 | RegisterHandlers(functions, N); | 157 | RegisterHandlers(functions, N); |
| 158 | } | 158 | } |
| @@ -161,7 +161,7 @@ protected: | |||
| 161 | * Registers handlers in the service. Usually prefer using the other RegisterHandlers | 161 | * Registers handlers in the service. Usually prefer using the other RegisterHandlers |
| 162 | * overload in order to avoid needing to specify the array size. | 162 | * overload in order to avoid needing to specify the array size. |
| 163 | */ | 163 | */ |
| 164 | void RegisterHandlers(const FunctionInfo* functions, size_t n) { | 164 | void RegisterHandlers(const FunctionInfo* functions, std::size_t n) { |
| 165 | RegisterHandlersBase(functions, n); | 165 | RegisterHandlersBase(functions, n); |
| 166 | } | 166 | } |
| 167 | 167 | ||
diff --git a/src/core/hle/service/set/set.cpp b/src/core/hle/service/set/set.cpp index 59eb20155..9e5af7839 100644 --- a/src/core/hle/service/set/set.cpp +++ b/src/core/hle/service/set/set.cpp | |||
| @@ -32,21 +32,21 @@ constexpr std::array<LanguageCode, 17> available_language_codes = {{ | |||
| 32 | LanguageCode::ZH_HANT, | 32 | LanguageCode::ZH_HANT, |
| 33 | }}; | 33 | }}; |
| 34 | 34 | ||
| 35 | constexpr size_t pre4_0_0_max_entries = 0xF; | 35 | constexpr std::size_t pre4_0_0_max_entries = 0xF; |
| 36 | constexpr size_t post4_0_0_max_entries = 0x40; | 36 | constexpr std::size_t post4_0_0_max_entries = 0x40; |
| 37 | 37 | ||
| 38 | LanguageCode GetLanguageCodeFromIndex(size_t index) { | 38 | LanguageCode GetLanguageCodeFromIndex(std::size_t index) { |
| 39 | return available_language_codes.at(index); | 39 | return available_language_codes.at(index); |
| 40 | } | 40 | } |
| 41 | 41 | ||
| 42 | template <size_t size> | 42 | template <std::size_t size> |
| 43 | static std::array<LanguageCode, size> MakeLanguageCodeSubset() { | 43 | static std::array<LanguageCode, size> MakeLanguageCodeSubset() { |
| 44 | std::array<LanguageCode, size> arr; | 44 | std::array<LanguageCode, size> arr; |
| 45 | std::copy_n(available_language_codes.begin(), size, arr.begin()); | 45 | std::copy_n(available_language_codes.begin(), size, arr.begin()); |
| 46 | return arr; | 46 | return arr; |
| 47 | } | 47 | } |
| 48 | 48 | ||
| 49 | static void PushResponseLanguageCode(Kernel::HLERequestContext& ctx, size_t max_size) { | 49 | static void PushResponseLanguageCode(Kernel::HLERequestContext& ctx, std::size_t max_size) { |
| 50 | IPC::ResponseBuilder rb{ctx, 3}; | 50 | IPC::ResponseBuilder rb{ctx, 3}; |
| 51 | rb.Push(RESULT_SUCCESS); | 51 | rb.Push(RESULT_SUCCESS); |
| 52 | if (available_language_codes.size() > max_size) | 52 | if (available_language_codes.size() > max_size) |
diff --git a/src/core/hle/service/set/set.h b/src/core/hle/service/set/set.h index 5f0214359..266f13e46 100644 --- a/src/core/hle/service/set/set.h +++ b/src/core/hle/service/set/set.h | |||
| @@ -28,7 +28,7 @@ enum class LanguageCode : u64 { | |||
| 28 | ZH_HANS = 0x00736E61482D687A, | 28 | ZH_HANS = 0x00736E61482D687A, |
| 29 | ZH_HANT = 0x00746E61482D687A, | 29 | ZH_HANT = 0x00746E61482D687A, |
| 30 | }; | 30 | }; |
| 31 | LanguageCode GetLanguageCodeFromIndex(size_t idx); | 31 | LanguageCode GetLanguageCodeFromIndex(std::size_t idx); |
| 32 | 32 | ||
| 33 | class SET final : public ServiceFramework<SET> { | 33 | class SET final : public ServiceFramework<SET> { |
| 34 | public: | 34 | public: |
diff --git a/src/core/hle/service/sm/sm.cpp b/src/core/hle/service/sm/sm.cpp index 18d1641b8..096f0fd52 100644 --- a/src/core/hle/service/sm/sm.cpp +++ b/src/core/hle/service/sm/sm.cpp | |||
| @@ -15,6 +15,10 @@ | |||
| 15 | 15 | ||
| 16 | namespace Service::SM { | 16 | namespace Service::SM { |
| 17 | 17 | ||
| 18 | constexpr ResultCode ERR_ALREADY_REGISTERED(ErrorModule::SM, 4); | ||
| 19 | constexpr ResultCode ERR_INVALID_NAME(ErrorModule::SM, 6); | ||
| 20 | constexpr ResultCode ERR_SERVICE_NOT_REGISTERED(ErrorModule::SM, 7); | ||
| 21 | |||
| 18 | ServiceManager::ServiceManager() = default; | 22 | ServiceManager::ServiceManager() = default; |
| 19 | ServiceManager::~ServiceManager() = default; | 23 | ServiceManager::~ServiceManager() = default; |
| 20 | 24 | ||
| @@ -24,10 +28,10 @@ void ServiceManager::InvokeControlRequest(Kernel::HLERequestContext& context) { | |||
| 24 | 28 | ||
| 25 | static ResultCode ValidateServiceName(const std::string& name) { | 29 | static ResultCode ValidateServiceName(const std::string& name) { |
| 26 | if (name.size() <= 0 || name.size() > 8) { | 30 | if (name.size() <= 0 || name.size() > 8) { |
| 27 | return ERR_INVALID_NAME_SIZE; | 31 | return ERR_INVALID_NAME; |
| 28 | } | 32 | } |
| 29 | if (name.find('\0') != std::string::npos) { | 33 | if (name.find('\0') != std::string::npos) { |
| 30 | return ERR_NAME_CONTAINS_NUL; | 34 | return ERR_INVALID_NAME; |
| 31 | } | 35 | } |
| 32 | return RESULT_SUCCESS; | 36 | return RESULT_SUCCESS; |
| 33 | } | 37 | } |
diff --git a/src/core/hle/service/sm/sm.h b/src/core/hle/service/sm/sm.h index a58d922a0..da2c51082 100644 --- a/src/core/hle/service/sm/sm.h +++ b/src/core/hle/service/sm/sm.h | |||
| @@ -36,12 +36,6 @@ private: | |||
| 36 | std::shared_ptr<ServiceManager> service_manager; | 36 | std::shared_ptr<ServiceManager> service_manager; |
| 37 | }; | 37 | }; |
| 38 | 38 | ||
| 39 | constexpr ResultCode ERR_SERVICE_NOT_REGISTERED(-1); | ||
| 40 | constexpr ResultCode ERR_MAX_CONNECTIONS_REACHED(-1); | ||
| 41 | constexpr ResultCode ERR_INVALID_NAME_SIZE(-1); | ||
| 42 | constexpr ResultCode ERR_NAME_CONTAINS_NUL(-1); | ||
| 43 | constexpr ResultCode ERR_ALREADY_REGISTERED(-1); | ||
| 44 | |||
| 45 | class ServiceManager { | 39 | class ServiceManager { |
| 46 | public: | 40 | public: |
| 47 | static void InstallInterfaces(std::shared_ptr<ServiceManager> self); | 41 | static void InstallInterfaces(std::shared_ptr<ServiceManager> self); |
diff --git a/src/core/hle/service/spl/module.cpp b/src/core/hle/service/spl/module.cpp index 0d8441fb1..44a6717d0 100644 --- a/src/core/hle/service/spl/module.cpp +++ b/src/core/hle/service/spl/module.cpp | |||
| @@ -21,7 +21,7 @@ Module::Interface::~Interface() = default; | |||
| 21 | void Module::Interface::GetRandomBytes(Kernel::HLERequestContext& ctx) { | 21 | void Module::Interface::GetRandomBytes(Kernel::HLERequestContext& ctx) { |
| 22 | IPC::RequestParser rp{ctx}; | 22 | IPC::RequestParser rp{ctx}; |
| 23 | 23 | ||
| 24 | size_t size = ctx.GetWriteBufferSize(); | 24 | std::size_t size = ctx.GetWriteBufferSize(); |
| 25 | 25 | ||
| 26 | std::vector<u8> data(size); | 26 | std::vector<u8> data(size); |
| 27 | std::generate(data.begin(), data.end(), std::rand); | 27 | std::generate(data.begin(), data.end(), std::rand); |
diff --git a/src/core/hle/service/vi/vi.cpp b/src/core/hle/service/vi/vi.cpp index cf94b00e6..d0cde5ede 100644 --- a/src/core/hle/service/vi/vi.cpp +++ b/src/core/hle/service/vi/vi.cpp | |||
| @@ -4,25 +4,28 @@ | |||
| 4 | 4 | ||
| 5 | #include <algorithm> | 5 | #include <algorithm> |
| 6 | #include <array> | 6 | #include <array> |
| 7 | #include <cstring> | ||
| 7 | #include <memory> | 8 | #include <memory> |
| 8 | #include <type_traits> | 9 | #include <type_traits> |
| 9 | #include <utility> | 10 | #include <utility> |
| 10 | #include <boost/optional.hpp> | 11 | #include <boost/optional.hpp> |
| 11 | #include "common/alignment.h" | 12 | #include "common/alignment.h" |
| 13 | #include "common/assert.h" | ||
| 14 | #include "common/common_funcs.h" | ||
| 15 | #include "common/logging/log.h" | ||
| 12 | #include "common/math_util.h" | 16 | #include "common/math_util.h" |
| 13 | #include "common/scope_exit.h" | 17 | #include "common/swap.h" |
| 14 | #include "core/core_timing.h" | 18 | #include "core/core_timing.h" |
| 15 | #include "core/hle/ipc_helpers.h" | 19 | #include "core/hle/ipc_helpers.h" |
| 16 | #include "core/hle/kernel/event.h" | 20 | #include "core/hle/kernel/event.h" |
| 17 | #include "core/hle/service/nvdrv/nvdrv.h" | 21 | #include "core/hle/service/nvdrv/nvdrv.h" |
| 18 | #include "core/hle/service/nvflinger/buffer_queue.h" | 22 | #include "core/hle/service/nvflinger/buffer_queue.h" |
| 23 | #include "core/hle/service/nvflinger/nvflinger.h" | ||
| 19 | #include "core/hle/service/vi/vi.h" | 24 | #include "core/hle/service/vi/vi.h" |
| 20 | #include "core/hle/service/vi/vi_m.h" | 25 | #include "core/hle/service/vi/vi_m.h" |
| 21 | #include "core/hle/service/vi/vi_s.h" | 26 | #include "core/hle/service/vi/vi_s.h" |
| 22 | #include "core/hle/service/vi/vi_u.h" | 27 | #include "core/hle/service/vi/vi_u.h" |
| 23 | #include "core/settings.h" | 28 | #include "core/settings.h" |
| 24 | #include "video_core/renderer_base.h" | ||
| 25 | #include "video_core/video_core.h" | ||
| 26 | 29 | ||
| 27 | namespace Service::VI { | 30 | namespace Service::VI { |
| 28 | 31 | ||
| @@ -38,7 +41,7 @@ static_assert(sizeof(DisplayInfo) == 0x60, "DisplayInfo has wrong size"); | |||
| 38 | class Parcel { | 41 | class Parcel { |
| 39 | public: | 42 | public: |
| 40 | // This default size was chosen arbitrarily. | 43 | // This default size was chosen arbitrarily. |
| 41 | static constexpr size_t DefaultBufferSize = 0x40; | 44 | static constexpr std::size_t DefaultBufferSize = 0x40; |
| 42 | Parcel() : buffer(DefaultBufferSize) {} | 45 | Parcel() : buffer(DefaultBufferSize) {} |
| 43 | explicit Parcel(std::vector<u8> data) : buffer(std::move(data)) {} | 46 | explicit Parcel(std::vector<u8> data) : buffer(std::move(data)) {} |
| 44 | virtual ~Parcel() = default; | 47 | virtual ~Parcel() = default; |
| @@ -66,7 +69,7 @@ public: | |||
| 66 | return val; | 69 | return val; |
| 67 | } | 70 | } |
| 68 | 71 | ||
| 69 | std::vector<u8> ReadBlock(size_t length) { | 72 | std::vector<u8> ReadBlock(std::size_t length) { |
| 70 | ASSERT(read_index + length <= buffer.size()); | 73 | ASSERT(read_index + length <= buffer.size()); |
| 71 | const u8* const begin = buffer.data() + read_index; | 74 | const u8* const begin = buffer.data() + read_index; |
| 72 | const u8* const end = begin + length; | 75 | const u8* const end = begin + length; |
| @@ -156,8 +159,8 @@ private: | |||
| 156 | static_assert(sizeof(Header) == 16, "ParcelHeader has wrong size"); | 159 | static_assert(sizeof(Header) == 16, "ParcelHeader has wrong size"); |
| 157 | 160 | ||
| 158 | std::vector<u8> buffer; | 161 | std::vector<u8> buffer; |
| 159 | size_t read_index = 0; | 162 | std::size_t read_index = 0; |
| 160 | size_t write_index = 0; | 163 | std::size_t write_index = 0; |
| 161 | }; | 164 | }; |
| 162 | 165 | ||
| 163 | class NativeWindow : public Parcel { | 166 | class NativeWindow : public Parcel { |
diff --git a/src/core/hle/service/vi/vi.h b/src/core/hle/service/vi/vi.h index c2dc83605..e3963502a 100644 --- a/src/core/hle/service/vi/vi.h +++ b/src/core/hle/service/vi/vi.h | |||
| @@ -4,11 +4,10 @@ | |||
| 4 | 4 | ||
| 5 | #pragma once | 5 | #pragma once |
| 6 | 6 | ||
| 7 | #include "core/hle/service/nvflinger/nvflinger.h" | ||
| 8 | #include "core/hle/service/service.h" | 7 | #include "core/hle/service/service.h" |
| 9 | 8 | ||
| 10 | namespace CoreTiming { | 9 | namespace Service::NVFlinger { |
| 11 | struct EventType; | 10 | class NVFlinger; |
| 12 | } | 11 | } |
| 13 | 12 | ||
| 14 | namespace Service::VI { | 13 | namespace Service::VI { |