Addressed issues

This commit is contained in:
Chloe Marcec 2021-03-30 20:27:27 +11:00
parent e9a1f29e93
commit 4930242c20
2 changed files with 22 additions and 21 deletions

View file

@ -17,7 +17,7 @@ namespace Error {
constexpr ResultCode ResultNoFreeCommunication{ErrorModule::PCTL, 101};
constexpr ResultCode ResultStereoVisionRestricted{ErrorModule::PCTL, 104};
constexpr ResultCode ResultNoCapatability{ErrorModule::PCTL, 131};
constexpr ResultCode ResultNoCapability{ErrorModule::PCTL, 131};
constexpr ResultCode ResultNoRestrictionEnabled{ErrorModule::PCTL, 181};
} // namespace Error
@ -133,7 +133,7 @@ public:
}
private:
bool CheckFreeCommunicationPermissionImpl() {
bool CheckFreeCommunicationPermissionImpl() const {
if (states.temporary_unlocked) {
return true;
}
@ -146,11 +146,13 @@ private:
if (!settings.is_free_communication_default_on) {
return true;
}
// TODO(ogniK): Check for blacklisted/exempted applications
// TODO(ogniK): Check for blacklisted/exempted applications. Return false can happen here
// but as we don't have multiproceses support yet, we can just assume our application is
// valid for the time being
return true;
}
bool ConfirmStereoVisionPermissionImpl() {
bool ConfirmStereoVisionPermissionImpl() const {
if (states.temporary_unlocked) {
return true;
}
@ -179,12 +181,11 @@ private:
IPC::ResponseBuilder rb{ctx, 2};
if (False(capability & (Capability::Application | Capability::System))) {
LOG_ERROR(Service_PCTL, "Invalid capability! capability={:X}",
static_cast<s32>(capability));
LOG_ERROR(Service_PCTL, "Invalid capability! capability={:X}", capability);
return;
}
// TODO(ogniK): Recovery
// TODO(ogniK): Recovery flag initialization for pctl:r
const auto tid = system.CurrentProcess()->GetTitleID();
if (tid != 0) {
@ -251,7 +252,7 @@ private:
IPC::ResponseBuilder rb{ctx, 3};
if (False(capability & (Capability::Status | Capability::Recovery))) {
LOG_ERROR(Service_PCTL, "Application does not have Status or Recovery capabilities!");
rb.Push(Error::ResultNoCapatability);
rb.Push(Error::ResultNoCapability);
rb.Push(false);
return;
}
@ -264,9 +265,9 @@ private:
IPC::ResponseBuilder rb{ctx, 2};
if (False(capability & Capability::SteroVision)) {
LOG_ERROR(Service_PCTL, "Application does not have SteroVision capability!");
rb.Push(Error::ResultNoCapatability);
if (False(capability & Capability::StereoVision)) {
LOG_ERROR(Service_PCTL, "Application does not have StereoVision capability!");
rb.Push(Error::ResultNoCapability);
return;
}
@ -297,9 +298,9 @@ private:
LOG_DEBUG(Service_PCTL, "called, can_use={}", can_use);
IPC::ResponseBuilder rb{ctx, 2};
if (False(capability & Capability::SteroVision)) {
LOG_ERROR(Service_PCTL, "Application does not have SteroVision capability!");
rb.Push(Error::ResultNoCapatability);
if (False(capability & Capability::StereoVision)) {
LOG_ERROR(Service_PCTL, "Application does not have StereoVision capability!");
rb.Push(Error::ResultNoCapability);
return;
}
@ -311,9 +312,9 @@ private:
LOG_DEBUG(Service_PCTL, "called");
IPC::ResponseBuilder rb{ctx, 3};
if (False(capability & Capability::SteroVision)) {
LOG_ERROR(Service_PCTL, "Application does not have SteroVision capability!");
rb.Push(Error::ResultNoCapatability);
if (False(capability & Capability::StereoVision)) {
LOG_ERROR(Service_PCTL, "Application does not have StereoVision capability!");
rb.Push(Error::ResultNoCapability);
rb.Push(false);
return;
}
@ -391,7 +392,7 @@ void InstallInterfaces(SM::ServiceManager& service_manager, Core::System& system
auto module = std::make_shared<Module>();
std::make_shared<PCTL>(system, module, "pctl",
Capability::Application | Capability::SnsPost | Capability::Status |
Capability::SteroVision)
Capability::StereoVision)
->InstallAsService(service_manager);
// TODO(ogniK): Implement remaining capabilities
std::make_shared<PCTL>(system, module, "pctl:a", Capability::None)

View file

@ -13,13 +13,13 @@ class System;
namespace Service::PCTL {
enum class Capability : s32 {
None = 0x0,
enum class Capability : u32 {
None = 0,
Application = 1 << 0,
SnsPost = 1 << 1,
Recovery = 1 << 6,
Status = 1 << 8,
SteroVision = 1 << 9,
StereoVision = 1 << 9,
System = 1 << 15,
};
DECLARE_ENUM_FLAG_OPERATORS(Capability);