diff options
| author | 2021-03-30 20:27:27 +1100 | |
|---|---|---|
| committer | 2021-03-30 20:27:27 +1100 | |
| commit | 4930242c20a45905dd3d81aa9acda167be586b27 (patch) | |
| tree | d3498de21c932ec0c1f93c0f03673dae1b6c338e /src/core/hle/service/pctl | |
| parent | pctl: Rework how pctl works to be more accurate (diff) | |
| download | yuzu-4930242c20a45905dd3d81aa9acda167be586b27.tar.gz yuzu-4930242c20a45905dd3d81aa9acda167be586b27.tar.xz yuzu-4930242c20a45905dd3d81aa9acda167be586b27.zip | |
Addressed issues
Diffstat (limited to 'src/core/hle/service/pctl')
| -rw-r--r-- | src/core/hle/service/pctl/module.cpp | 37 | ||||
| -rw-r--r-- | src/core/hle/service/pctl/module.h | 6 |
2 files changed, 22 insertions, 21 deletions
diff --git a/src/core/hle/service/pctl/module.cpp b/src/core/hle/service/pctl/module.cpp index 2f0edde2a..f17c1cf7f 100644 --- a/src/core/hle/service/pctl/module.cpp +++ b/src/core/hle/service/pctl/module.cpp | |||
| @@ -17,7 +17,7 @@ namespace Error { | |||
| 17 | 17 | ||
| 18 | constexpr ResultCode ResultNoFreeCommunication{ErrorModule::PCTL, 101}; | 18 | constexpr ResultCode ResultNoFreeCommunication{ErrorModule::PCTL, 101}; |
| 19 | constexpr ResultCode ResultStereoVisionRestricted{ErrorModule::PCTL, 104}; | 19 | constexpr ResultCode ResultStereoVisionRestricted{ErrorModule::PCTL, 104}; |
| 20 | constexpr ResultCode ResultNoCapatability{ErrorModule::PCTL, 131}; | 20 | constexpr ResultCode ResultNoCapability{ErrorModule::PCTL, 131}; |
| 21 | constexpr ResultCode ResultNoRestrictionEnabled{ErrorModule::PCTL, 181}; | 21 | constexpr ResultCode ResultNoRestrictionEnabled{ErrorModule::PCTL, 181}; |
| 22 | 22 | ||
| 23 | } // namespace Error | 23 | } // namespace Error |
| @@ -133,7 +133,7 @@ public: | |||
| 133 | } | 133 | } |
| 134 | 134 | ||
| 135 | private: | 135 | private: |
| 136 | bool CheckFreeCommunicationPermissionImpl() { | 136 | bool CheckFreeCommunicationPermissionImpl() const { |
| 137 | if (states.temporary_unlocked) { | 137 | if (states.temporary_unlocked) { |
| 138 | return true; | 138 | return true; |
| 139 | } | 139 | } |
| @@ -146,11 +146,13 @@ private: | |||
| 146 | if (!settings.is_free_communication_default_on) { | 146 | if (!settings.is_free_communication_default_on) { |
| 147 | return true; | 147 | return true; |
| 148 | } | 148 | } |
| 149 | // TODO(ogniK): Check for blacklisted/exempted applications | 149 | // TODO(ogniK): Check for blacklisted/exempted applications. Return false can happen here |
| 150 | // but as we don't have multiproceses support yet, we can just assume our application is | ||
| 151 | // valid for the time being | ||
| 150 | return true; | 152 | return true; |
| 151 | } | 153 | } |
| 152 | 154 | ||
| 153 | bool ConfirmStereoVisionPermissionImpl() { | 155 | bool ConfirmStereoVisionPermissionImpl() const { |
| 154 | if (states.temporary_unlocked) { | 156 | if (states.temporary_unlocked) { |
| 155 | return true; | 157 | return true; |
| 156 | } | 158 | } |
| @@ -179,12 +181,11 @@ private: | |||
| 179 | IPC::ResponseBuilder rb{ctx, 2}; | 181 | IPC::ResponseBuilder rb{ctx, 2}; |
| 180 | 182 | ||
| 181 | if (False(capability & (Capability::Application | Capability::System))) { | 183 | if (False(capability & (Capability::Application | Capability::System))) { |
| 182 | LOG_ERROR(Service_PCTL, "Invalid capability! capability={:X}", | 184 | LOG_ERROR(Service_PCTL, "Invalid capability! capability={:X}", capability); |
| 183 | static_cast<s32>(capability)); | ||
| 184 | return; | 185 | return; |
| 185 | } | 186 | } |
| 186 | 187 | ||
| 187 | // TODO(ogniK): Recovery | 188 | // TODO(ogniK): Recovery flag initialization for pctl:r |
| 188 | 189 | ||
| 189 | const auto tid = system.CurrentProcess()->GetTitleID(); | 190 | const auto tid = system.CurrentProcess()->GetTitleID(); |
| 190 | if (tid != 0) { | 191 | if (tid != 0) { |
| @@ -251,7 +252,7 @@ private: | |||
| 251 | IPC::ResponseBuilder rb{ctx, 3}; | 252 | IPC::ResponseBuilder rb{ctx, 3}; |
| 252 | if (False(capability & (Capability::Status | Capability::Recovery))) { | 253 | if (False(capability & (Capability::Status | Capability::Recovery))) { |
| 253 | LOG_ERROR(Service_PCTL, "Application does not have Status or Recovery capabilities!"); | 254 | LOG_ERROR(Service_PCTL, "Application does not have Status or Recovery capabilities!"); |
| 254 | rb.Push(Error::ResultNoCapatability); | 255 | rb.Push(Error::ResultNoCapability); |
| 255 | rb.Push(false); | 256 | rb.Push(false); |
| 256 | return; | 257 | return; |
| 257 | } | 258 | } |
| @@ -264,9 +265,9 @@ private: | |||
| 264 | 265 | ||
| 265 | IPC::ResponseBuilder rb{ctx, 2}; | 266 | IPC::ResponseBuilder rb{ctx, 2}; |
| 266 | 267 | ||
| 267 | if (False(capability & Capability::SteroVision)) { | 268 | if (False(capability & Capability::StereoVision)) { |
| 268 | LOG_ERROR(Service_PCTL, "Application does not have SteroVision capability!"); | 269 | LOG_ERROR(Service_PCTL, "Application does not have StereoVision capability!"); |
| 269 | rb.Push(Error::ResultNoCapatability); | 270 | rb.Push(Error::ResultNoCapability); |
| 270 | return; | 271 | return; |
| 271 | } | 272 | } |
| 272 | 273 | ||
| @@ -297,9 +298,9 @@ private: | |||
| 297 | LOG_DEBUG(Service_PCTL, "called, can_use={}", can_use); | 298 | LOG_DEBUG(Service_PCTL, "called, can_use={}", can_use); |
| 298 | 299 | ||
| 299 | IPC::ResponseBuilder rb{ctx, 2}; | 300 | IPC::ResponseBuilder rb{ctx, 2}; |
| 300 | if (False(capability & Capability::SteroVision)) { | 301 | if (False(capability & Capability::StereoVision)) { |
| 301 | LOG_ERROR(Service_PCTL, "Application does not have SteroVision capability!"); | 302 | LOG_ERROR(Service_PCTL, "Application does not have StereoVision capability!"); |
| 302 | rb.Push(Error::ResultNoCapatability); | 303 | rb.Push(Error::ResultNoCapability); |
| 303 | return; | 304 | return; |
| 304 | } | 305 | } |
| 305 | 306 | ||
| @@ -311,9 +312,9 @@ private: | |||
| 311 | LOG_DEBUG(Service_PCTL, "called"); | 312 | LOG_DEBUG(Service_PCTL, "called"); |
| 312 | 313 | ||
| 313 | IPC::ResponseBuilder rb{ctx, 3}; | 314 | IPC::ResponseBuilder rb{ctx, 3}; |
| 314 | if (False(capability & Capability::SteroVision)) { | 315 | if (False(capability & Capability::StereoVision)) { |
| 315 | LOG_ERROR(Service_PCTL, "Application does not have SteroVision capability!"); | 316 | LOG_ERROR(Service_PCTL, "Application does not have StereoVision capability!"); |
| 316 | rb.Push(Error::ResultNoCapatability); | 317 | rb.Push(Error::ResultNoCapability); |
| 317 | rb.Push(false); | 318 | rb.Push(false); |
| 318 | return; | 319 | return; |
| 319 | } | 320 | } |
| @@ -391,7 +392,7 @@ void InstallInterfaces(SM::ServiceManager& service_manager, Core::System& system | |||
| 391 | auto module = std::make_shared<Module>(); | 392 | auto module = std::make_shared<Module>(); |
| 392 | std::make_shared<PCTL>(system, module, "pctl", | 393 | std::make_shared<PCTL>(system, module, "pctl", |
| 393 | Capability::Application | Capability::SnsPost | Capability::Status | | 394 | Capability::Application | Capability::SnsPost | Capability::Status | |
| 394 | Capability::SteroVision) | 395 | Capability::StereoVision) |
| 395 | ->InstallAsService(service_manager); | 396 | ->InstallAsService(service_manager); |
| 396 | // TODO(ogniK): Implement remaining capabilities | 397 | // TODO(ogniK): Implement remaining capabilities |
| 397 | std::make_shared<PCTL>(system, module, "pctl:a", Capability::None) | 398 | std::make_shared<PCTL>(system, module, "pctl:a", Capability::None) |
diff --git a/src/core/hle/service/pctl/module.h b/src/core/hle/service/pctl/module.h index cdba11d60..032481b00 100644 --- a/src/core/hle/service/pctl/module.h +++ b/src/core/hle/service/pctl/module.h | |||
| @@ -13,13 +13,13 @@ class System; | |||
| 13 | 13 | ||
| 14 | namespace Service::PCTL { | 14 | namespace Service::PCTL { |
| 15 | 15 | ||
| 16 | enum class Capability : s32 { | 16 | enum class Capability : u32 { |
| 17 | None = 0x0, | 17 | None = 0, |
| 18 | Application = 1 << 0, | 18 | Application = 1 << 0, |
| 19 | SnsPost = 1 << 1, | 19 | SnsPost = 1 << 1, |
| 20 | Recovery = 1 << 6, | 20 | Recovery = 1 << 6, |
| 21 | Status = 1 << 8, | 21 | Status = 1 << 8, |
| 22 | SteroVision = 1 << 9, | 22 | StereoVision = 1 << 9, |
| 23 | System = 1 << 15, | 23 | System = 1 << 15, |
| 24 | }; | 24 | }; |
| 25 | DECLARE_ENUM_FLAG_OPERATORS(Capability); | 25 | DECLARE_ENUM_FLAG_OPERATORS(Capability); |